dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
claude-context-milvus like plugin for Deepseek Harness (DSH)
English | 简体中文
A DSH plugin that provides semantic code search over a Milvus vector database, with a complete index ↔ search pipeline.
dsh-context-milvus = equips your DSH Agent with a dedicated codebase semantic search engine. Milvus handles high-speed vector retrieval, transforming "needle-in-a-haystack grep" into precise recall of relevant code snippets — reducing tokens, minimizing tool calls, and improving coding agent quality on large repositories.
dsh-context-milvus is an open-source code semantic search plugin for DeepSeek Harness (DSH) coding agents, built on Milvus as the vector database and registered as a Cordis Plugin. Its core purpose: solve the high token consumption, excessive tool calls, context pollution, and poor large-codebase comprehension that plague native DSH Agent grep workflows.
Native DSH Agent workflow: encounter a problem → repeatedly
search_code(grep) →readfiles → search again, flooding the prompt with irrelevant text, exploding tool calls, increasing token costs, and making it easy to miss dependencies in large repositories.
| Native grep workflow pain point | dsh-context-milvus solution |
|---|---|
| Literal string matching only — semantically related but differently named code is missed | Vector semantic search — matches by code meaning, not just keywords |
| Multiple tool call rounds, reading many irrelevant files, token explosion | Returns only truly relevant code snippets, split by AST at function/class boundaries for precision |
| Flooding context with grep output and irrelevant source code, causing context pollution and degraded model reasoning | Milvus pre-built index, Agent gets concise effective context in one tool call without search noise in the prompt |
| Thousands of files in large repos, Agent traversal is extremely inefficient | Milvus vector DB enables fast retrieval over millions of code blocks, supports incremental index updates without full repo rescanning |
| Can only search already-open or known-path files | After full-repo indexing, can semantically search any code location regardless of file path knowledge |
search_code — Semantic code search: natural language query, returns matching code snippetsindex_code — Index codebase: AST parsing + chunking → Embedding → Milvus storageindex_status — View index status: file count, last index time, hash statisticsfind_callers — Code relationship analysis (impact analysis): find all references to a symbol, with cross-file import resolutiontrace_call_chain — Call chain tracing: BFS expansion from entry symbol (impact/dependency analysis), with cross-file resolution disambiguationhybridMode togglechunkContextLines, default 2) for better recallqueryExpansion, default on)rerankEnabled, default on)references, language-specific syntax nodes), supports cross-file exact matchingfind_callers/trace_call_chain to perform precise cross-file symbol matching (same-name disambiguation, cross-module tracing)search_code / index_code / index_status write one JSONL line per execution (enabled by default, metadata only, no source code captured), with an analysis script for descriptive stats + Bootstrap CI + correlationThe retrieval engine behind this plugin is published separately as dsh-context-milvus-core, so the same code also runs as a stdio MCP server for OpenAI Codex CLI (and any other MCP client) from the codex-context-milvus package. It exposes the five retrieval tools — search_code, index_code, index_status, find_callers, trace_call_chain — and shares the same Milvus collection and per-workspace index state as the DSH plugin. Start it with ADR_ENABLED=true and the 8 ADR decision-memory tools are registered as well; the four that write to disk stay gated behind CONTEXT_MILVUS_ADR_WRITE.
Shortest setup:
codex mcp add context-milvus -- npx -y codex-context-milvus mcp
See packages/codex/README.md for the init wizard, the environment variable reference, the error-code table, and current limitations (ADR tools are off by default, no runtime config hot-reload).
An offline machine cannot resolve the ~230-package production closure, so the payload has to be built on a connected one. Seed a scratch install with the package as its only production dependency, then carry either the npm cache or the whole node_modules:
mkdir ctxmilvus-offline && cd ctxmilvus-offline
npm init -y
npm pkg set dependencies.codex-context-milvus=0.7.1
npm install --omit=dev --cache ./npm-cache
tar czf ctxmilvus-offline.tgz npm-cache package.json package-lock.json # method A
tar czf ctxmilvus-tree.tgz node_modules # method B
On the target, method A installs with npm ci --omit=dev --offline --cache ./npm-cache (--offline makes npm fail on a missing tarball instead of reaching for a network that is not there), while method B only needs the tree extracted and the binary invoked directly. Two traps: the generated config.toml starts the server with npx -y, which is a registry call on every Codex launch, so point command/args at the local bin/mcp.js; and the tree-sitter* prebuilds for linux/darwin/win32 × x64/arm64 come inside the tarballs, so one bundle is cross-platform — any other triple needs a compiler. The full recipe, including the prebuild-pruning trick and the exact TOML, is in packages/codex/README.md → Offline install.
A reproducible statistical evaluation suite (see scripts/eval/) quantifies how dsh-context-milvus improves retrieval quality and end-to-end agent efficiency. It covers offline retrieval quality, end-to-end agent evaluation, and native telemetry — using nonparametric statistics (Wilcoxon, Bootstrap CI, Cliff's Δ) with a unified file-level relevance standard. Run instructions and full reports live in scripts/eval/*/output/report.md.
Three retrieval strategies compared: G (grep keyword), R (naive RAG: sliding-window + pure vector), P (plugin: AST chunking + BM25 hybrid + RRF + chunk overlap + query expansion + two-stage reranking).
| Metric | G (grep) | R (naive RAG) | P (plugin) |
|---|---|---|---|
| recall@10 | 0.9524 | 1.0000 | 0.9524 |
| MRR | 0.6754 | 0.9524 | 0.8452 |
| nDCG@10 | 0.7446 | 0.9610 | 0.8725 |
| hit@1 | 0.4762 | 0.9048 | 0.7619 |
| precision@10 (file-level) | 0.4203 | 0.1095 | 0.2730 |
| precision@10 (chunk-level) | — | — | 0.3619 |
Note on precision@10: Two metrics are reported. File-level precision@10 de-duplicates results by file path (each file counted once), measuring how many unique relevant files appear in the top-K. Chunk-level precision@10 counts each result independently, matching the classic IR definition: "of the 10 entries the Agent sees, how many are from relevant files?" The chunk-level metric is higher because the Agent benefits from multiple chunks of the same relevant file clustering in the top results.
Key findings:
withRetry).| Group | Average pass rate | Token consumption |
|---|---|---|
| G (grep) | 37.5% | baseline |
| R (naive RAG) | 50.0% | −928 vs G |
| P (plugin) | 62.5% | −2109 vs G |
Key findings:
search_code / index_code / index_status record execution metrics (query, result count, top score, duration, files/chunks indexed, etc.) as one JSONL line per call — enabled by default (telemetryEnabled: true), no source code content captured. Run node scripts/eval/telemetry/run.mjs to generate a descriptive statistics + Bootstrap CI + correlation report from ~/.milvus-index/telemetry.jsonl (mode 0600).
To turn it off: set telemetryEnabled to false in Settings → Plugins → dsh-context-milvus (or set telemetryEnabled: false in cordis.patch.yml).
Note: BM25 keyword fusion is already implemented — Milvus native BM25 full-text search + vector semantic dual-path retrieval, RRF fusion (
hybridModeenabled by default).
search_code path parameter), allowing directory-limited searches — ideal for codebase scenarios.It is not a standalone MCP service, but a DSH plugin (Cordis Plugin) embedded directly into the DSH Agent process:
| Tool | Function | Key Parameters |
|---|---|---|
search_code | Semantic code search | query (natural language), topK (result count), path (search scope) |
index_code | Index codebase | mode (full/incremental), path (target path) |
index_status | View index status | path (view per-workspace status) |
search_adr | Semantic ADR search | query (natural language), status, topK |
search_adr_by_file | Find ADRs by file path | file_path (code file path), status |
create_adr | Create new ADR | title (required), requirement, change_type |
update_adr | Update existing ADR | adr_id (required), content, status |
list_adrs | List ADR records | status, change_type, limit |
load_constraints | Load active ADR constraints | adr_ids, format |
check_adr_consistency | Check ADR-code consistency | file_path, fix |
find_callers | Find all references to a symbol for impact analysis, supports cross-file import resolution | symbol (required), direction, maxResults, sourceFile, resolve |
trace_call_chain | BFS call chain tracing from entry symbol (impact/dependency analysis), supports import resolution disambiguation | entry (required), direction, maxDepth, maxResults, resolve |
index_code: Parse the project, split code blocks via tree-sitter AST → call Embedding API to generate vectors → store in Milvus collection.search_code for hybrid search (vector semantic + BM25 keyword, RRF fusion).index_code mode=incremental to incrementally re-index only changed files.index_status (indexed files, total code blocks, last index time).find_callers for impact analysis: see which places reference the symbol to avoid missing cascading effects. For same-name symbols across files, use the sourceFile parameter to disambiguate by definition file.trace_call_chain: BFS expansion from entry function, direction=backward traces callers, direction=forward traces downstream dependencies. resolve: false falls back to V1 name-matching mode.find_callers and trace_call_chain enable import resolution by default (resolve: true). The Import Map built during indexing automatically maps import { X } from './foo' to foo.ts's exports, eliminating same-name ambiguity and supporting cross-module call chain tracing. Falls back to V1 name matching when the import map is not built.The ADR decision memory system records the "why" behind code changes (design decisions, trade-offs, constraints), enabling the Agent to not only read code but understand its evolution:
Note: ADR functionality is disabled by default. To enable it, set
adrEnabled: truein the DSH config panel (Settings → Plugins → dsh-context-milvus).
search_adr_by_file to check if the file has decision records, avoiding violation of existing decisions.create_adr to record the context, alternatives, and rationale, and use update_adr to maintain code_anchors linking to code locations.load_constraints to load active ADR constraints into the context.check_adr_consistency to verify ADR-code consistency, with fix for auto-repair.search_adr for semantic search of historical decisions, understanding "why this was done this way."When the brainstorming skill produces specification documents, they can be linked to the codebase through the following steps:
docs/superpowers/specs/YYYY-MM-DD-<topic>-design.mdindex_specs to automatically detect code references in the document and generate frontmatter + code_anchorsindex_code automatically scans docs/superpowers/specs/ and docs/superpowers/plans/ directoriessearch_adr returns both ADR and spec document results (with docType annotation)| Field | Default | Description |
|---|---|---|
specRoot | docs/superpowers/specs | Spec document directory (relative to indexRoot) |
planRoot | docs/superpowers/plans | Implementation plan directory (relative to indexRoot) |
Spec document fusion follows the adrEnabled toggle — no additional configuration needed.
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama service
ollama serve
Or use any OpenAI-compatible Embedding API service (OpenAI, Alibaba Cloud Bailian, etc.) by configuring
embeddingEndpointandembeddingApiKey.
# Pull nomic-embed-text model (default)
ollama pull nomic-embed-text
# Or other supported Embedding models:
ollama pull bge-m3
ollama pull mxbai-embed-large
Docker (recommended):
# Pull and start Milvus standalone
docker run -d --name milvus \
-p 19530:19530 \
-p 9091:9091 \
milvusdb/milvus:latest
# Verify connection
docker ps | grep milvus
Milvus cluster mode (Docker Compose):
# Download docker-compose file
wget https://github.com/milvus-io/milvus/releases/latest/download/milvus-standalone-docker-compose.yml -O docker-compose.yml
# Start
docker compose up -d
Or use Zilliz Cloud managed service — no self-hosting required.
# Verify Ollama
curl http://localhost:11434/api/tags
# Verify Milvus
docker run -it --rm \
-e MILVUS_URL=localhost:19530 \
milvusdb/milvus-sdk-node:latest \
node -e "const {MilvusClient} = require('@zilliz/milvus2-sdk-node'); \
new MilvusClient({address:'localhost:19530'}).listCollections().then(r=>console.log(r))"
Requires DSH ≥ 0.2.0-rc.1. The 0.2.0 release train keeps the settings plugin contract established in 0.1.7 — the host's
installSection()and the client'ssettingsScopeservice are gone, and the config schema now relies on schemastery's.volatile(), which older harnesses do not ship. There is no compatibility mode: on an older harness the plugin cannot load.
The plugin is published to the npm registry. Install directly via DSH CLI:
dsh plugin --profile web add dsh-context-milvus
The npm package includes pre-built
dist/output — no build step required during installation, avoiding theERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWEDerror.
Build and package as a tarball, then install directly:
# 1. Build
npm run build
# 2. Package as tarball
pnpm pack
# 3. Install to profile
dsh plugin --profile web add ./dsh-context-milvus-0.1.3.tgz
pnpm packproduces a tarball containing the compileddist/output — no build step required during installation, so pnpm won't raiseERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED.
dsh plugin --profile web add git+https://github.com/bobjia/dsh-context-milvus.git
dist/output is not committed to git. The plugin uses thepreparescript to automatically runtscduring installation.pnpm 10 limitation: pnpm 10 blocks execution of build scripts by default. If you see:
ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED The git-hosted package "dsh-context-milvus@0.1.2" needs to execute build scripts but is not in the "onlyBuiltDependencies" allowlist.Add to your profile's
pnpm-workspace.yaml:# ~/.dsh/profiles/<profile-name>/pnpm-workspace.yaml onlyBuiltDependencies: - dsh-context-milvusThen re-run the install command. Or run
pnpm approve-buildsand selectdsh-context-milvus.To avoid this authorization, use Method 1 (npm) or Method 2 (tarball).
After installation, edit cordis.patch.yml under your profile:
# ~/.dsh/profiles/<profile-name>/cordis.patch.yml
- id: dsh-context-milvus
config:
milvusAddress: localhost:19530
milvusCollection: code_embeddings
milvusDim: 768
embeddingEndpoint: http://localhost:11434/api/embed
embeddingModel: nomic-embed-text
indexRoot: /path/to/your/code
indexExtensions: .ts,.tsx,.js,.py,.java,.go,.rs,.c,.inc,.cpp,.cs,.scala,.php,.kt,.kts
hybridMode: true
bm25RrfK: 60
Restart DSH after configuration.
If using a local development version:
cd /mnt/home/bobjia/workspace/dsh-context-milvus
npm install --legacy-peer-deps
# Link DSH runtime packages (npm install may break these links)
ln -sf /mnt/home/bobjia/.npm-global/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/cordis \
node_modules/@deepseek-ai/cordis
ln -sf /mnt/home/bobjia/.npm-global/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-tools \
node_modules/@deepseek-ai/dsh-tools
ln -sf /mnt/home/bobjia/.npm-global/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/schemastery \
node_modules/@deepseek-ai/schemastery
# Install as local dependency
dsh plugin --profile web add file:/mnt/home/bobjia/workspace/dsh-context-milvus
dsh plugin addautomatically adds the plugin todsh.profile.bundles— no need to manually editpackage.json.
Edit ~/.dsh/profiles/<profile-name>/cordis.patch.yml (same as above) and restart DSH.
cordis.patch.yml or DSH Web GUI)localhost:19530)| Field | Environment Variable | Type | Default | Description |
|---|---|---|---|---|
milvusAddress | MILVUS_ADDRESS | string | localhost:19530 | Milvus server address |
milvusToken | MILVUS_TOKEN | string (secret) | empty | Milvus auth token |
milvusCollection | MILVUS_COLLECTION | string | code_embeddings | Collection name |
milvusDim | MILVUS_EMBEDDING_DIM | number | 768 | Vector dimension |
| `embeddingE |