Introduction¶
DeepSeek Harness’s (DSH) plugin-based architecture allows agents to attach tools on demand. For C/C++ projects, existing approaches typically rely on external tools (such as clangd) or require manually maintaining a compile_commands.json file. These solutions often suffer from slow response times or cumbersome configuration in large codebases (hundreds of thousands of files). The dsh-code-insight plugin parses C/C++ source code directly within the DSH process, builds and maintains a persistent symbol index, and provides millisecond-level query capability for the model.
What It Is¶
dsh-code-insight is a DeepSeek Harness client plugin, maintained by izhongbei. It provides the model with a set of C/C++-oriented symbol indexing capabilities: symbol search, go-to-definition, find-references, caller/callee analysis, call graph viewing, and file outline. The plugin includes a browser-side Code Insight panel and adds @ symbol autocompletion to the editor composer. The index is parsed by the plugin itself—no compile_commands.json or clangd is needed, and there are no external tool dependencies.
Core Features¶
The plugin exposes symbol indexing capabilities to the model through a set of tool interfaces:
-
code_insight_search: Case-insensitive name search across functions, types, macros, declarations, members, enum constants, and global symbols. Priority order: exact match > prefix > subword > substring. Returns symbol locations and signatures.
-
code_insight_definition: Locates the definition of a symbol, sorted by the same priority as editor F12: first resolves from
source_filevia#include, then the index root directory, then path prefixes. Duplicate content is collapsed into one line, and signatures and#ifdefconditions are reconstructed. Header prototypes are hidden when a concrete implementation exists. -
code_insight_references: Scans the entire workspace for references, targeting the identifier index only, ignoring comments and strings.
-
code_insight_callers: Lists functions that call a specified function along with their call sites.
-
code_insight_callees: Lists the signatures of called functions.
-
code_insight_call_graph: Displays call relationships in a multi-hop manner, with adjustable depth and node count limits.
-
code_insight_outline: Lists all symbols and signatures in a single file in definition order.
-
code_insight_index: Queries index status; triggers build/rebuild/clear.
All line numbers returned to the model are 1-based, while the core internals still use 0-based positions. When autoBuild is enabled, the first tool call automatically starts an index build in the background; an un-built index will not block the session.
Browser Panel & @ Autocomplete¶
The plugin provides a Code Insight tab in the right sidebar of the Web GUI, with the following features:
- Symbol search: Results include type labels, file:line, and signatures. Clicking a result opens the definition in the sidebar file viewer.
- Call graph: Rendered as SVG, with callers on the left and callees on the right. Double-clicking a node recenters the view; the toolbar supports toggling direction and depth.
- Definition details: Displays the reconstructed signature and
#ifdefconditions. - File outline: Click a symbol to navigate to it.
- Index status: Shows status, file count, symbol count, and root directory, with one-click incremental build support.
The panel communicates with the host via seven authenticated JSON routes under /api/code-insight/*: status, search, graph, outline, definition, references, build. Click-to-open uses the native ctx.sidebarRight.openResource with session-scoped dsh-resource://file/session/... addresses and 1-based line parameters, with no dependency on additional plugins.
Typing @ in the composer expands the Code Insight symbol group; selecting an entry inserts name (file:line) text.
Installation & Enablement¶
The plugin is packaged as a standard bundle (declaring dsh.bundle.patch) and can be installed via npm:
dsh plugin --profile web add dsh-code-insight
The above command adds the plugin to the web profile and automatically inserts the bundle configuration. A Web GUI restart is required after installation.
When developing from a local checkout, you can use a link dependency:
INSTALL=/home/liujie/.npm/_npx/1e7f6d9597241db0
"$INSTALL/node_modules/.bin/dsh" plugin --profile web add \
link:/path/to/dsh-code-insight
Configuration¶
The bundle line uses default configuration and can be overridden via cordis.patch.yml:
- id: code-insight
config:
indexRoots: ['rcios'] # C/C++ directories to index
exclude: ['**/.git/**', '**/build/**', '**/tmp/**', '**/node_modules/**']
autoRefreshMinutes: 10
Common configuration options:
| Setting | Default | Description |
|---|---|---|
indexRoots |
['.'] |
Workspace-relative directories; "." indexes the entire workspace; order determines #include resolution priority |
exclude |
.git, build, tmp, node_modules |
Glob patterns to exclude |
maxFileSizeKB |
4096 |
Skip source files larger than this size |
concurrency |
4 |
Number of parser worker threads (1–64); automatically reduced to 2 above 80k files |
followSymlinks |
false |
Whether to follow symbolic links during traversal |
autoBuild |
true |
Automatically start a background build on the first tool call |
autoRefreshMinutes |
10 |
Trigger incremental refresh after this many minutes; 0 disables |
searchLimit |
50 |
Default/max hit count for code_insight_search |
maxReferenceResults |
200 |
Default/max hit count for references/callers/callees |
cacheDir |
$DSH_HOME/storages/code-insight |
Cache root directory; one subdirectory per workspace |
Supported source file extensions are .c .h .cc .cpp .hpp .hh .inl (case-sensitive). The index is loaded via memory mapping at startup, and changed files are incrementally refreshed based on mtime/size.
Use Cases¶
Suitable for DSH users who need fast symbol navigation and call analysis for C/C++ codebases, particularly projects with large code scale that require real-time queries for definitions, references, and call graphs.
Before use, confirm that the plugin runs with the current DSH process permissions, and review source code and licenses. Framework packages that the plugin depends on should be listed in peerDependencies.
Summary¶
dsh-code-insight integrates C/C++ symbol indexing into DeepSeek Harness, providing the model with millisecond-level queries and a visual panel without external tools. For C/C++ developers, it is a pluggable set of navigation and analysis tools.
- Directory page: https://www.skillhub.cn/plugins/izhongbei/dsh-code-insight
- GitHub: https://github.com/izhongbei/dsh-code-insight