Introduction¶
When handling code-related tasks in DeepSeek Harness (DSH), Agents often have to rely solely on grep and glob to guess keywords. This is particularly problematic in scenarios where “behaviors are described in Chinese, but the answers are hidden within English identifiers,” often leading to repeated trial-and-error attempts that fail to locate the target. The community plugin dsh-coderag (maintainer: VermilionPasvikin) provides read-only codebase retrieval in the form of an MCP server. It builds indexes and queries symbols via natural language or identifiers, returning file paths, line numbers, and symbol names so the Agent can read the original text by line. The following sections cover its capabilities, installation steps, and usage notes.
What is this¶
dsh-coderag is a codebase retrieval engine designed for DSH. By default, it does not connect to the internet or collect telemetry; it reads code only and does not modify the repository. The plugin exposes 4 fixed MCP tools to the Agent via Cordis patches (names on the DSH side carry the mcp__coderag__ prefix):
| Tool | Description |
|---|---|
code_search |
Retrieves via natural language or identifiers; returns file paths, line numbers, and symbol names |
code_outline |
Provides a symbol outline for a single file |
code_index |
Builds or refreshes the index; returns a taskId immediately for background execution |
index_status |
Views index status and skip statistics |
The index is stored at <workspace>/.coderag/index.sqlite3. It utilizes SQLite FTS5 with Chinese bigrams and uses tree-sitter to chunk code by boundaries such as functions, classes, and interfaces; incremental indexing is supported. Retrieval uses BM25, and hits within the same batch are output in source code order, facilitating the model in reading files by line number. If the index is not ready, there are no results, or the backend is unavailable, a structured status is returned to prevent the Agent from mistaking “not found” for “does not exist.”
The current release version is 2.1.1 (available via GitHub tag/release only; no PyPI/npm package). The SkillHub category is “Network Tools”; the project README focuses on local indexing and retrieval.
Core Features (Documented Portions)¶
- Indexing & Security: Three-layer filtering (built-in secret blacklist,
.gitignore/.coderagignore, and content-level regex). Matched chunks are not stored, and skip reasons are visible to the model (skipped: {count, reasons}). - Retrieval Strategy: Progressive recall precision (Full tokenization → Identifier only → including CJK bigrams). Queries containing only punctuation or overly short symbols will prompt the use of
grepto avoid full table scans. - Async & Budget:
code_indexreturns immediately and indexes in the background (avoiding the ~60-second tool call timeout); individual searches have a token budget, and the number of omitted entries is reported if the budget is exceeded. - Empirical Comparison (README claims): In a comparison on a copy of the DSH source code involving 13 “find code” tasks with 3 sessions each, the success rate increased from approximately 28.2% to 82.1% for the group with this plugin patch attached. Location/cross-file attempts (where “asking in Chinese yields answers in English code”) showed significant improvement, while direct identifier lookups did not degrade. The sample favors retrieval-oriented questions and should not be extrapolated as a universal improvement rate for all queries; see the reports in the repository’s
eval/runs/for details.
Installation and Activation¶
Prerequisites: Python 3.10–3.12, DSH installed, and Git. The README notes macOS and Windows 10 are tested; Linux is not yet tested, and the project does not claim Linux support.
Installation requires cloning the repository (as cordis.patch.yml is inside the repo); pip install dsh-coderag or npm i dsh-coderag cannot be used.
macOS / Linux (POSIX)¶
First, navigate to the directory where you wish to store the repository, then execute:
cd ~
git clone https://github.com/VermilionPasvikin/dsh-coderag.git
cd dsh-coderag
bash scripts/install.sh
Self-check engine (independent of DSH):
"$CODERAG_PYTHON" -m dsh_coderag doctor
"$CODERAG_PYTHON" -m dsh_coderag index /path/to/repo
"$CODERAG_PYTHON" -m dsh_coderag search "用户令牌在哪里校验" --root /path/to/repo
Attach to the DSH web profile and verify:
./scripts/dsh plugin --profile web add .
./scripts/dsh --profile web --dump-config | grep -A2 '== dsh-coderag'
The expected output should include # == dsh-coderag and id: mcp-coderag. Start:
./scripts/dsh --profile web
For restricted networks, use the following during dependency installation: CODERAG_PIP_ARGS="--index-url <mirror>" bash scripts/install.sh.
Windows (PowerShell)¶
A genuine Python 3.10–3.12 is required (check with py -0p), and confirm the current DSH profile being used (usually desktop for the desktop version). Example for cloning, installation, and verification:
git clone https://github.com/VermilionPasvikin/dsh-coderag.git
Set-Location dsh-coderag
& $py -m pip install .
& $py -m dsh_coderag doctor
$repo = "C:\path\to\your\repo"
& $py -m dsh_coderag index $repo
& $py -m dsh_coderag search "用户令牌在哪里校验" --root $repo
It is more reliable to write CODERAG_PYTHON into the profile’s cordis.patch.yml (desktop shortcuts usually do not inherit terminal environment variables). You must completely quit DeepSeek Harness Desktop before modifying the profile, otherwise dsh plugin add may be rejected. Then use the local dsh.cmd or global dsh:
& $dsh plugin --profile $profile add .
For detailed Windows paths and ZIP offline extraction instructions, see the GitHub README.
Typical Usage¶
- Agent Side: In the workspace conversation, trigger
code_indexfirst (or pre-build the index via CLI), useindex_statusto confirm readiness, then usecode_searchto query behavior descriptions or symbols; usecode_outlinewhen the structure of a single file is needed. - CLI Side (for debugging or batch processing unrelated to DSH):
dsh_coderag index <repo>,dsh_coderag search "<query>" --root <repo>, sharing the same index directory as the MCP tools.
The first indexing of a large repository occurs in the background; if the number of files exceeds the limit, it will explicitly fail and report the actual count.
Scenarios and Notes¶
Suitable for: “Finding implementations by describing behavior,” “tracing links across files,” and mixed Chinese-English retrieval queries in medium-to-large repositories; sessions where you wish to reduce the Agent’s blind use of grep.
Security Statement (Must Read - README Key Points): Installing this plugin grants it local permissions similar to the current DSH process; DSH’s read-only / workspace-write / danger-full-access settings do not constrain the plugin. Please only install on trusted repositories and local machines. Read the source code and the MIT license before installation.
The plugin is offline by default; indexing and queries are performed locally.
Conclusion¶
dsh-coderag transforms “semantic + structural” retrieval into MCP tools callable by DSH, complementing grep: complex localization is handled by retrieval, while precise symbols can still be looked up directly. The directory and details can be viewed on SkillHub and GitHub:
- Directory Page: https://www.skillhub.cn/plugins/VermilionPasvikin/dsh-coderag
- Repository: https://github.com/VermilionPasvikin/dsh-coderag