Introduction¶
DeepSeek Harness (DSH) allows capabilities to be extended through plugins. In code assistance scenarios, models need more than text matching; they require structured code context, such as symbol definitions, call relationships, and impact scope. Traditional grep searches are often inefficient and lack context. dsh-codegraph-plugin provides structured code intelligence support for DSH by wrapping the codegraph CLI as tools.
Plugin Overview¶
This is a DSH profile bundle maintained by errrepe. It exposes the codegraph toolkit as 8 model-callable interfaces and keeps the local codebase index synchronized. The plugin executes codegraph commands in the current working directory (CWD) of the session and uses the SQLite WAL mechanism to read index data within a restricted workspace.
Prerequisites¶
The plugin depends on the codegraph CLI installed on the host and is not responsible for installing or managing that CLI.
- Install the
codegraphCLI (via cargo):
cargo install codegraph
- Verify the installation:
codegraph --version
- Ensure the
codegraphexecutable is in the systemPATH.
Installation¶
Installing the plugin adds a bundle to the specified DSH profile:
dsh plugin --profile web add github:errrepe/dsh-codegraph-plugin
After installation, restart the DSH process for that profile to activate the plugin.
Core Features¶
The plugin provides the following 8 tool interfaces. Depending on the operation type, they return JSON or formatted text:
codegraph_query: Searches for symbols by name (functions, classes, methods), supports filtering by type, and returns JSON.codegraph_callers: Queries the code locations that call a specified symbol, used for dependency analysis before refactoring, and returns JSON.codegraph_callees: Queries the targets that a symbol calls, and returns JSON.codegraph_impact: Analyzes the potential impact of modifying a symbol (dependents and test coverage), and returns JSON.codegraph_explore: Explores open-ended questions and returns related symbols, source code, call paths, and impact scope in one call, returning text.codegraph_node: Reads the complete source code of a symbol or a specified file, including line numbers and dependencies, and returns text.codegraph_status: Checks the index status and displays statistics for files, nodes, and edges, returning text.codegraph_sync: Syncs code changes to the index, and returns text.
Configuration¶
In DSH’s Settings > Plugins (Configurables), a configuration item named codegraph is registered:
- enabled (default
true): Controls the registration of plugin tools. When disabled, the tools return an error message and do not block DSH startup. - injectPrompt (default
true): Controls whether to injectcodegraph-guidanceinto the System Prompt. This guidance is positioned at position 50 in the prompt composition and instructs the model to prefer the code graph overgrep.
Configuration is persisted under the codegraph namespace in ~/.dsh/settings.yaml.
Typical Usage¶
- First use: Call
codegraph_statusbefore searching to check whether the index exists. If it does not, manually runcodegraph initonce in the project root directory. - Open-ended questions: Prefer
codegraph_explore, which can return symbols, source code, call paths, and impact scope in a single call. - After code changes: Call
codegraph_syncafter editing files to ensure subsequent queries reflect the latest code. - Precise reading: Use
codegraph_nodeto read detailed source code for a specific symbol or file.
Compatibility and Graceful Degradation¶
The plugin is fault-tolerant:
* Missing DSH services: If the host lacks services such as dsh-settings, the plugin degrades gracefully (enabled by default without a bridge) and does not block DSH startup.
* Missing CLI or no index: The tools directly pass through codegraph CLI error messages to the model.
* Headless scenarios: In environments without a session CWD (such as pure script invocation), the tools return a clear error instead of crashing.
Conclusion¶
This plugin injects static analysis capabilities into the DSH ecosystem through a unified interface, making it suitable for scenarios that require deep understanding of code structure and dependencies. You can refer to the following links for source code and catalog.