dsh-codegraph-project: Make DSH Reuse Local CodeGraph Indexes by Session

Introduction

When you already have CodeGraph configured in Codex, Claude Code, or Cursor, switching to DeepSeek Harness (DSH) often requires setting up another service or repeatedly modifying global paths for different repositories. When working with multiple projects in parallel, it is common to encounter a misalignment where “the current session is actually in repository A, but the tool is still querying B.”

Here, we introduce the community plugin dsh-codegraph-project (maintainer: daimingxing). Instead of reinstalling CodeGraph or forcing a rebuild of existing indexes, it locates the corresponding project’s .codegraph/ index based on the DSH session’s working directory and attaches the local CodeGraph MCP tools to the current session. It is classified as a networking/MCP tool integration within the DSH ecosystem.

What is this?

dsh-codegraph-project is the npm package dsh-codegraph-project (version 0.1.1 in current materials, MIT License). Its one-sentence positioning is: Per-project CodeGraph MCP tools for DeepSeek Harness: each session queries the repo it is actually working in.

It serves as a “bridge” to the upstream CodeGraph: The plugin allows DSH to launch or connect to the locally installed codegraph CLI (with default parameters serve --mcp). Tool names typically carry the mcp__codegraph__ prefix (configurable via serverName). The plugin does not automatically run codegraph init, nor does it delete CodeGraph or project indexes upon uninstallation; it only releases the connections and processes it manages.

Core Features

Reuse Existing CodeGraph and Indexes

If CodeGraph is already installed on your machine and the target repository has been initialized with codegraph init, installing this plugin does not require installing a separate copy of CodeGraph for DSH, nor does it require rebuilding indexes to connect the plugin. Existing CodeGraph configurations in other AI agents will not be altered by this plugin.

Route to Corresponding Project by Session

You can open DSH sessions for multiple projects simultaneously: Session A uses project A’s index, while Session B uses project B’s index, eliminating the need to switch fixed project paths in global configurations. The plugin searches upwards from the session directory to find a .codegraph/ directory containing a .db file. It does not cross .git repository boundaries, nor does it treat the home directory or file system root as a project.

No Registration of Tools Without an Index

If the project corresponding to the current working directory lacks a valid index, the plugin will not expose CodeGraph tools to the model. You must maintain the index yourself within the project (via codegraph init and CodeGraph’s own update workflows).

Sensing Environment Changes within a Session

After switching projects or creating a new index, wait a few seconds before sending a message. If the tool list for the current turn has already been generated, changes will be reflected in subsequent messages (the re-check interval can be controlled via watchIntervalMs by default).

Installation and Activation

Please note before installation: DSH plugins run under the permissions of the current DSH process. Before installing, you should read the source code and license (MIT) and confirm that you trust the maintainer and the npm package content. The community directory SkillHub is an independent site and has no official affiliation with DeepSeek or Hithink RoyalFlush.

1. Prepare CodeGraph and Project Indexes

If you already have CodeGraph and the target project has an index, you can skip this section and proceed directly to installing the plugin.

codegraph --version

If CodeGraph is not installed, you can run the following first:

npm install -g @colbymchenry/codegraph

Restart DSH after installation to ensure the codegraph command can be resolved. Only if the project does not yet have an index, enter the project directory to initialize it:

Set-Location 'D:\path\to\your-project'
codegraph init

Replace the path with your project root directory; execute this once for each project you intend to use. If a .codegraph/ index already exists, you do not need to reinitialize solely for this plugin.

2. Install This Plugin

Desktop: Open the Plugins page in the sidebar, enter the npm package name in the installation entry, and complete the installation:

dsh-codegraph-project

Command Line: Install to the profile you actually use (the example is web; replace with your profile name). Do not use the CLI to modify the desktop profile if you are on the desktop.

dsh plugin --profile web add dsh-codegraph-project

3. Open a Session for the Target Project in DSH

Open a workspace or session for the target project in DSH to start chatting. With default settings, there is no need to manually add a separate CodeGraph MCP service or hardcode project paths.

To upgrade the plugin, update via the Plugins page on the Desktop; for CLI, you can install the latest npm version (replace the profile name accordingly):

dsh plugin --profile web add dsh-codegraph-project@latest

Installing a new version of the plugin does not automatically upgrade CodeGraph; CodeGraph versioning is managed by you independently. The verified environment recorded in the materials is DSH 0.2.1-rc.2 + CodeGraph 1.6.2; other combinations require self-verification.

Typical Usage

The plugin provides CodeGraph-related MCP tools to the model. You can directly ask code analysis questions in the conversation. Explicitly requesting the use of CodeGraph helps confirm whether it has been integrated:

Please use CodeGraph to check the call chain of the login request from the entry point to the database, and then explain the key steps.
Please use CodeGraph to check where createOrder is called and which functionalities might be affected if it is modified?

Specifically what can be queried depends on the tool capabilities exposed by the local CodeGraph; the model will choose whether to call it based on the question.

Use Cases and Notes

Who it is for: Developers who already use CodeGraph locally for call chain and impact analysis, need to work with multiple repositories in parallel within DSH, and want each session to query only its current repository’s index.

Usage Notes:

  1. The query targets the project corresponding to the session’s current working directory; mentioning another path in your question does not switch the session’s working directory.
  2. You must run codegraph init first (or have a valid index); the plugin will not create indexes on your behalf.
  3. If you cannot see CodeGraph tools after installation, check the following in order: whether the working directory is inside the target repository, whether the index is complete, whether codegraph --version is available, and whether you need to resend the message after building the index midway; you can check DSH logs for entries containing codegraph-project.
  4. To override the startup path or timeout, you can set values in the plugin configuration within the profile, such as codegraphBin, codegraphArgs, toolCallTimeoutMs, etc., in cordis.patch.yml (see the repository README “Advanced Configuration” for details).

Disabling or uninstalling this plugin will not affect CodeGraph configurations in other AI tools; however, CodeGraph’s own index building, updates, and tool behavior are determined by CodeGraph itself and are not read-only.

Conclusion

The value of dsh-codegraph-project lies in connecting DSH to your already running CodeGraph and binding repository indexes by session, reducing repeated installations and global path switching. If you are doing cross-file, cross-module code comprehension in DSH, you can first ensure local CodeGraph and project indexes are ready, then enable it via the package name or CLI command described above.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye