feat: add workspace foundation and RAG retrieval system#5619
Closed
teknium1 wants to merge 1 commit into
Closed
Conversation
Port and modernize PR #1324 onto current main with full profile/HERMES_HOME awareness. New files: - agent/workspace.py: Core workspace engine — path resolution, manifest generation, structural chunking (markdown heading-aware, code symbol-aware), chunk indexing into SQLite, hybrid retrieval (FTS5 sparse + dense embeddings via RRF), optional reranking (local cross-encoder, Cohere, Voyage, heuristic fallback), workspace roots management, turn-scoped context injection - tools/workspace_tool.py: Model-facing workspace tool (status/index/list/search/retrieve) - hermes_cli/workspace.py: CLI subcommands and /workspace slash command handler Integration points: - config.py: workspace and knowledgebase sections in DEFAULT_CONFIG, workspace/ knowledgebase dirs in ensure_hermes_home(), config version bump to 13 - toolsets.py: workspace tool added to _HERMES_CORE_TOOLS - model_tools.py: workspace_tool added to _discover_tools() - commands.py: /workspace CommandDef with subcommands - cli.py: /workspace slash command dispatch - run_agent.py: turn-scoped workspace RAG context injection (cache-safe — appended to current-turn user message only, never touches system prompt) - hermes_cli/main.py: hermes workspace subcommand tree (status/index/list/search/retrieve/roots) - hermes_cli/banner.py: workspace roots visibility in welcome banner - pyproject.toml: workspace-rag optional dependency group Profile-aware: all paths use get_hermes_home() from hermes_constants, never hardcoded ~/.hermes. Each profile gets its own workspace/ and knowledgebase/ directories. Retrieval modes: off (default), gated (heuristic trigger), always. Embedding: local SentenceTransformers when installed, hash fallback otherwise. Dense search: sqlite-vec acceleration when installed, Python cosine fallback. Tests: 18 new workspace-specific tests, all passing. Original PR: #1324 by @teknium1
Contributor
|
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Apr 7, 2026
The original workspace foundation commit ports cleanly onto current main, but it still carried a large monolithic indexing/retrieval implementation. This follow-up extracts the pipeline into plugin contracts, built-in plugin implementations, and a manager that resolves category-specific backends while preserving the existing workspace CLI/tool behavior. Constraint: Salvage PR NousResearch#5619 on top of current upstream main without regressing workspace behavior Rejected: Keep the monolithic workspace engine and merge as-is | leaves duplicated indexing/retrieval logic and makes backend swaps harder Rejected: Rewrite the workspace feature from scratch on upstream main | unnecessary scope and higher merge risk Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep workspace behavior tests plugin-facing; do not reintroduce private helper-only assertions for indexing/retrieval internals Tested: uv run --extra dev python -m pytest -q tests/agent/test_workspace.py tests/tools/test_workspace_tool.py tests/test_workspace_cli_command.py tests/agent/test_workspace_plugins.py Not-tested: Full repo pytest, lint, and typecheck Related: PR NousResearch#5619
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Apr 7, 2026
The original workspace foundation commit ports cleanly onto current main, but it still carried a large monolithic indexing/retrieval implementation. This follow-up extracts the pipeline into plugin contracts, built-in plugin implementations, and a manager that resolves category-specific backends while preserving the existing workspace CLI/tool behavior. Constraint: Salvage PR NousResearch#5619 on top of current upstream main without regressing workspace behavior Rejected: Keep the monolithic workspace engine and merge as-is | leaves duplicated indexing/retrieval logic and makes backend swaps harder Rejected: Rewrite the workspace feature from scratch on upstream main | unnecessary scope and higher merge risk Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep workspace behavior tests plugin-facing; do not reintroduce private helper-only assertions for indexing/retrieval internals Tested: uv run --extra dev python -m pytest -q tests/agent/test_workspace.py tests/tools/test_workspace_tool.py tests/test_workspace_cli_command.py tests/agent/test_workspace_plugins.py Not-tested: Full repo pytest, lint, and typecheck Related: PR NousResearch#5619
19 tasks
Contributor
Author
|
Closing during PR triage — not pursuing this approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port and modernize PR #1324 onto current main with full profile/HERMES_HOME awareness.
Brings the workspace + knowledgebase RAG system to a usable state. Users can drop documents into
~/.hermes/workspace/(or any profile's workspace directory), and the system indexes, chunks, and retrieves relevant context at query time.What this PR does
New files (3):
agent/workspace.py— Core workspace engine: path resolution, manifest generation, structural chunking (markdown heading-aware, code symbol-aware), chunk indexing into SQLite, hybrid retrieval (FTS5 sparse + dense embeddings via RRF), optional reranking (local cross-encoder, Cohere, Voyage, heuristic fallback), workspace roots management, turn-scoped context injectiontools/workspace_tool.py— Model-facing workspace tool (status/index/list/search/retrieve)hermes_cli/workspace.py— CLI subcommands and /workspace slash command handlerIntegration points (9 existing files):
config.py: workspace + knowledgebase sections in DEFAULT_CONFIG, dirs in ensure_hermes_home(), version bump to 13toolsets.py: workspace tool in _HERMES_CORE_TOOLSmodel_tools.py: workspace_tool in _discover_tools()commands.py: /workspace CommandDefcli.py: /workspace slash command dispatchrun_agent.py: turn-scoped workspace RAG context injection (cache-safe — appended to current-turn user message only, never touches system prompt)main.py:hermes workspacesubcommand tree (status/index/list/search/retrieve/roots)banner.py: workspace roots visibility in welcome bannerpyproject.toml:workspace-ragoptional dependency groupKey design decisions
get_hermes_home()from hermes_constants. Each profile gets its own workspace/ and knowledgebase/ directories.off(default),gated(heuristic trigger),always. Default is off — users opt in.hermes workspace roots add.CLI interface
Test plan
Original draft: #1324