feat: salvage workspace foundation PR with modular plugin pipeline#5840
Closed
kshitijk4poor wants to merge 2 commits into
Closed
feat: salvage workspace foundation PR with modular plugin pipeline#5840kshitijk4poor wants to merge 2 commits into
kshitijk4poor wants to merge 2 commits into
Conversation
Port and modernize PR NousResearch#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: NousResearch#1324 by @teknium1
30cc557 to
789d893
Compare
This was referenced Apr 7, 2026
40b96e6 to
c66dbbc
Compare
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
c66dbbc to
6ed2f06
Compare
19 tasks
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
Adds a local-first workspace RAG system to Hermes. Users can point Hermes at directories of documents and get automatic context injection during conversations — no external vector DB, no API keys required for basic usage.
Salvages the original workspace foundation from #5619, replaces the monolithic internals with a modular plugin pipeline, and adds five research-backed features on top.
What the workspace does
For users
~/.hermes/workspace/(docs, notes, code, markdown) and Hermes automatically indexes themhermes workspace status|index|list|search|retrieve|delete|roots/workspace status,/workspace search <query>,/workspace retrieve <query>,/workspace delete <path>workspace(action="status|index|list|search|retrieve|delete")directlyhermes workspace roots add /path/to/project.hermesignore: Drop a file in the workspace root to exclude paths (gitignore syntax)For the agent
When retrieval is enabled, workspace context is injected into the user message (never the system prompt — prompt caching safe):
Plugin architecture
Every stage of the indexing/retrieval pipeline is a swappable plugin:
builtin_text,pdf,docxbuiltin_structuralbuiltin_hash,local_sentence_transformers,openai,googledisabled,heuristic,local_cross_encoderbuiltin_hybrid_rrfbuiltin_sqliteZero-dep default:
builtin_hashembedder +builtin_sqlitestore works with no extra packages. Installsentence-transformers+torchfor real embeddings,sqlite-vecfor fast vector search,pymupdffor PDF,python-docxfor Word docs.Features added beyond the original #5619
knowledgebase.watch_for_changes: true)hermes workspace delete <path>/ toolworkspace(action="delete", path="...")hermes workspace indexshowsIndexing [3/12] docs/plan.mdprogressVerification
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 \ tests/agent/test_workspace_watcher.py tests/agent/test_workspace_parsers.py \ tests/hermes_cli/test_workspace_roots.py # 42 passedLive-tested with
hermes -wagainst a sample workspace (4 files, 15 chunks):Config keys added
Config version bumped from 12 → 13.
Notes
get_hermes_home(), each profile gets its own workspace/knowledgebase