dsh-codegraph: Modeling the Workspace as a Relationship Graph for Querying Calls, Impact, and Reachability

Introduction

When using DeepSeek Harness (DSH) to let an agent modify code, common problems arise: who calls a certain function, which symbols are affected by changing one place, and whether two code paths can “reach” each other within the code. Full-text search can find strings, but it is hard to reliably express structural relationships between definitions, calls, and imports; a cross-repository global index also does not equal “the workspace for this current conversation.”

Below is an introduction to the community plugin @meteor-system/dsh-codegraph (repository Meteor-system/dsh-codegraph). It indexes the source code of the current workspace into a relationship graph, and answers three kinds of questions through the agent tool codegraph_explore: who calls X, what changing X affects, and whether X can reach Y. The plugin is categorized as an online tool, maintained by Meteor-system; it currently has 0 stars on GitHub, is MIT licensed, and the package version is 0.12.0.

What It Is

CodeGraph is a plugin installed on a DSH profile. It is disabled by default and is independent of the agent preset. When enabled, the tool codegraph_explore becomes visible to agents under that profile.

The query scope is always the workspace root directory bound to the current session; it will not mix in the GUI process home directory or other repositories. When switching repositories or starting a new conversation, both the index and the results target that repository.

Core Features

Relationship Graph and Lazy Indexing

  1. The workspace is only scanned on the first call to codegraph_explore, extracting definitions, calls, imports, inheritance, type references, etc., and writing them into the graph.
  2. The graph is cached in <project>/.dsh/codegraph/; subsequent calls perform an incremental refresh first, then query.
  3. If the initial build or refresh exceeds the configured timeout (default 300s), the tool returns indexing instead of hanging indefinitely.

Scanning respects .gitignore and default exclusions (e.g., node_modules, dist, .dsh, .venv, etc.), and additional include / exclude globs can be added via project configuration.

Three Query Modes

mode purpose typical phrasing
callers who calls the target check who calls graphFor
impact what is affected by changing the target (default depth 5, max 20) which symbols are affected by changing activate
reachability whether the target can reach path_to can apply reach graphFor

Optional parameters include scope (package name or path prefix), limit (default 50, hard cap 200), confidence, relation, and include_snippets.

Confidence and Ambiguity

Each edge carries a confidence level: exact (proven by the parser), inferred (cross-file name matching), heuristic (heuristic). The tool does not present guesses as definitive conclusions. When a symbol is ambiguous, it returns a list of candidates rather than silently picking one.

The /codegraph Command

After enabling the plugin, /codegraph can be used. A single run will:

  1. Index warmup — call codegraph_explore until metadata.index.status is no longer indexing.
  2. Diff impact pass — when the workspace has uncommitted changes, run callers / impact on up to 10 top-level exported symbols in the diff; skips if the working tree is clean.

When not enabled, the command does not exist; enabling it itself does not immediately trigger a full scan.

Installation and Enabling

Install once per DSH profile. The official command is:

dsh plugin --profile web add @meteor-system/dsh-codegraph

Example for a locally developed package (from the README):

dsh plugin --profile web add file:./meteor-system-dsh-codegraph-0.12.0.tgz

After modifying the profile’s patch, a restart of that profile is required; a running GUI will not hot-swap the entire plugin tree.

Disabled by default. Choose one of the following ways to enable it.

For the current project (written next to the repository, not into the profile):

// <project>/.dsh/codegraph/config.json
{ "enabled": true }

Or enable it permanently for the entire profile ($DSH_HOME/profiles/<name>/cordis.patch.yml):

- id: dsh-codegraph
  config:
    enabled: true

After changing the enabled state, restart the session; in-progress requests still use the old toolset.

Project-level configuration (excerpt):

Key Default Meaning
max_file_bytes 1_000_000 files larger than this are skipped
max_files 50_000 maximum number of files scanned
build_timeout_ms 300_000 wait time for build/refresh; returns indexing on timeout
include — globs forced to be included
exclude — globs forced to be excluded

The index directory <project>/.dsh/codegraph/ should not be committed to git.

Typical Usage

In a conversation with the target repository already open, you can just use natural language without hand-writing JSON. The agent will call codegraph_explore, and all returned paths belong to the current workspace.

Example (from the README):

Check who calls graphFor

Other equivalent phrasings:

  • “Which symbols are affected by changing activate” → impact
  • “Can apply reach graphFor” → reachability

The results may carry diagnostic codes (e.g., partial, indexing, truncated, ambiguous_target, etc.); by design, partial results with diagnostics are preferred over fabricated relationships.

Use Cases and Caveats

Suitable for: scenarios where you need to perform call chain, change impact, and inter-symbol reachability analysis within the current repository, and want the agent to query through a single tool instead of repeatedly grepping.

Capability boundaries (explicitly stated in the README):

  • Syntax-level extraction plus import/export and qualified name matching, without a type checker or control flow graph.
  • There is currently no published grammar WASM for Razor, so .razor files may be unsupported_language.
  • C/C++ macros are not expanded (heuristics are limited).
  • Queries are read-only; index writes are internal side effects.
  • The tool call has a maximum limit of 300s; if it times out and returns indexing, a retry is needed.

Security and permissions: the plugin runs with the permissions of the DSH profile and the current process; it reads and scans workspace source code, and writes to .dsh/codegraph/ under the workspace. Before installing, please review the source code and LICENSE to ensure it meets your environment and compliance requirements. The DSH community plugin directory (e.g., the SkillHub entry) is an independent ecosystem site and has no official affiliation with DeepSeek / 幻方.

Conclusion

dsh-codegraph compiles the “current workspace” into a queryable relationship graph, using codegraph_explore to uniformly answer callers, impact, and reachability questions, while labeling edge confidence and diagnostic codes. If your agent workflow frequently asks “who calls whom, and what will changing here affect,” you can install it on a profile, enable it at the project or profile level, and then ask questions in natural language or use /codegraph to warm up the index in the corresponding conversation.

  • Directory page: https://www.skillhub.cn/plugins/Meteor-system/dsh-codegraph
  • GitHub: https://github.com/Meteor-system/dsh-codegraph
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye