dsh-codegraph: A Local Semantic Code Intelligence Plugin

Introduction

In agent development, enabling models to understand project code structure, retrieve relevant source code, and trace call relationships is a fundamental requirement. Traditional approaches typically rely on grep commands or text search engines, requiring developers to manually construct regex patterns and loop through results—limiting efficiency and often missing semantic information.

DeepSeek Harness (DSH) adopts the “everything is a plugin” philosophy, providing agents with capabilities through an extensible tool interface. dsh-codegraph is one such local semantic code intelligence plugin. Built on CodeGraph, it provides DSH with a set of first-class code-level tools for exploring code, searching symbols, and inspecting call chains and impact scope.

Plugin Positioning

dsh-codegraph is a third-party plugin for DeepSeek Harness, maintained by wunengbiao. It serves as the adapter layer between DeepSeek Harness and a local CodeGraph instance, translating CodeGraph’s symbol graph capabilities into tools that DSH can invoke directly. All indexing and querying are performed locally.

The plugin primarily addresses the following problems:

  • Getting relevant source code and its call paths in a single call, rather than manually grepping and looping
  • Performing code analysis locally, without code or queries leaving the machine
  • Continuing to leverage CodeGraph capabilities in a GUI environment without relying on full environment variable setup
  • Understanding the impact scope of modifying a symbol (callers and callees)

Core Features

The plugin launches a local codegraph serve --mcp process, communicates with DSH via JSON-RPC over stdio, and exposes CodeGraph’s symbol graph as the following tools:

Basic Query Tools

  • codegraph_explore: Returns relevant source code for a query, grouped by file, with line numbers and call paths between symbols
  • codegraph_node: Reads a single file (with line numbers) or a single symbol along with its caller/callee chains
  • codegraph_search: Quick search by symbol name, returning only locations and signatures

Call Relationship Tools

  • codegraph_callers: Lists functions that call a given symbol
  • codegraph_callees: Lists functions that a given symbol calls
  • codegraph_impact: Analyzes the impact scope of modifying a symbol, with configurable traversal depth

Status & Indexing Tools

  • codegraph_status: View index status, including file count, node count, edge count, last indexed time, and pending sync state
  • codegraph_files: List the indexed file tree, including language and symbol statistics
  • codegraph_index: Initialize or rebuild the index for a project
  • codegraph_sync: Perform incremental sync after batch edits

All read tools accept an optional projectPath parameter; by default, the current DSH session working directory is used.

Installation & Activation

Prerequisites

  • CodeGraph 1.6.x installed locally
  • DeepSeek Harness 0.2.2-rc.1 or later
  • Node.js 22.5+ (DSH built-in compatible runtime)

Install the CodeGraph CLI:

curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
# or
npm i -g @colbymchenry/codegraph
codegraph --version

Install the Plugin

Install the plugin as a DSH bundle:

dsh plugin --profile desktop add github:wunengbiao/dsh-codegraph

For the Web/CLI profile, use --profile web instead of desktop. This command adds dsh-codegraph to the profile’s dependencies and dsh.profile.bundles. A restart of DeepSeek Harness is required after installation.

Verify the installation:

dsh plugin --profile desktop list --depth 0

In the DSH Web UI, open Plugins in the left sidebar and view Installed plugins.

Local Checkout Install

git clone https://github.com/wunengbiao/dsh-codegraph.git
dsh plugin --profile desktop add file:/absolute/path/to/dsh-codegraph

Typical Usage

Index a Project

Before first use, build the index for your project:

codegraph_index({ path: "/absolute/path/to/project" })

Index results are stored in the project’s .codegraph/ directory and are never uploaded to a remote.

Get relevant source code by keyword:

codegraph_explore({ query: "authentication flow signIn session" })

Search by symbol name:

codegraph_search({ query: "UserRepository" })

Inspect Symbols & Call Chains

Read a single symbol with its call paths:

codegraph_node({ symbol: "signIn", includeCode: true })

View callers:

codegraph_callers({ symbol: "signIn" })

View callees:

codegraph_callees({ symbol: "signIn" })

View Impact Scope

Analyze the impact of modifying a symbol:

codegraph_impact({ symbol: "signIn", depth: 2 })

Index Maintenance

Check index health:

codegraph_status()

Manually sync after batch edits:

codegraph_sync()

Configuration

Plugin configuration is located in the profile’s cordis.patch.yml, or can be passed directly when adding the bundle:

- id: codegraph
  config:
    command: /absolute/path/to/codegraph   # Optional; auto-discovered if not set
    timeoutMs: 120000                     # Timeout (ms) for a single read/explore call
    indexTimeoutMs: 900000                # Timeout (ms) for index init/rebuild
    defaultProject: /path/to/project      # Optional fixed default project
    watch: true                           # false is equivalent to codegraph --no-watch
    debug: false                          # Log registered tools when true

How It Works

The call chain is as follows:

DSH tool invocation
  -> dsh-codegraph (this plugin)
    -> JSON-RPC over stdio
      -> codegraph serve --mcp (local long-running process)
        -> <project>/.codegraph/codegraph.db
  • Each DSH process launches a single server instance, responsible for index handles, file watching, and explore state
  • A single MCP session serves all projects; each call passes the resolved projectPath
  • The plugin starts the server on demand and automatically restarts it upon exit
  • ctx.effect() cleans up child processes when the plugin is unloaded

Use Cases

Suitable for the following scenarios:

  • An agent needs to understand project structure, retrieve relevant source code, and trace call relationships
  • Local analysis is required; code or queries must not be uploaded to remote services
  • Used within the DSH GUI environment, in coordination with the desktop application

Note: The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installation.

Conclusion

dsh-codegraph provides DeepSeek Harness with a set of local semantic code intelligence tools, enabling agents to directly query source code, call chains, and impact scope without manually constructing grep patterns or looping through results. All indexes are stored locally within the project, queries never leave the machine, making it well-suited for agent development scenarios that require local code analysis.

Catalog Page | GitHub

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

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

Xiaoye