dsh-codebase-memory:Integrating the Code Graph with DSH and Enable the Model to Actually Leverage It at Decision Points

Introduction

When integrating MCP code graphs into DeepSeek Harness (DSH), the common bottleneck isn’t usually “the service won’t start,” but rather that the model rarely consults the graph during long sessions: the prompt is written at the beginning of the system prompt, but the decision to actually use the tool occurs many steps later. The upstream codebase-memory-mcp provides local code graph capabilities; the community plugin smter/dsh-codebase-memory (maintainer: smter, Category: Workflow) connects this MCP to DSH, nudges the model at decision points within the tool pipeline, corrects failed calls, and automatically indexes unindexed git repositories.

What is this

In short: A DeepSeek Harness plugin that connects to the codebase-memory-mcp code graph, drives model usage at decision points, corrects failed MCP calls, and indexes repositories itself.

The plugin provides three capabilities via a bundle (see the README table):

Row Function
codebase-memory-mcp Connects to the local stdio MCP service, exposing tools as mcp__codebase-memory-mcp__*
codebase-memory-reminder Injects prompts into the system prompt, included in every model step
codebase-memory-nudge Intervenes as needed in the tool pipeline: correcting errors, decision-point reminders, auto-indexing

License: MIT; Package version: 1.0.0; README notes verification on DSH 0.2.0-rc.1.

Core Features

MCP Connection

The codebase-memory-mcp row launches the installed codebase-memory-mcp via the official StdioClientTransport, exposing tools like graph queries to the DSH session.

Decision-Point Reminders (nudge)

codebase-memory-nudge attaches a brief reminder at two types of moments: just after grepping source code, or just after reading a number of source lines that meets a configured threshold (default minLines is 100). The README documents comparisons: with only the system prompt, 10 out of 12 MCP calls in one session failed and gave up quickly; in another session, 0 out of 228 tool calls used the code graph. The reminder cadence is controlled by cooldown (default 6)—after the first reminder, it reminds again every few eligible calls.

Correcting Failed MCP Calls

When correctMCP is enabled (default true), MCP errors trigger an injection of “how to fix this” instructions at the next decision point. The README gives an example: for search_graph, if the semantic_query key is present, all 10 calls with that key failed (empty arrays count) out of 17 calls in a project, while all 7 without it succeeded; a sub-agent once retried 8 times consecutively before abandoning the tool because of this.

Automatic Indexing

autoIndex defaults to true. When the path the model is reading belongs to a git repository that hasn’t been indexed, the plugin executes codebase-memory-mcp cli index_repository itself and provides the accurate project name and a ready-to-paste call to the model, rather than leaving indexing entirely to the model (README records: one session indexed the wrong repo, then the right one, and still never queried the graph even after the project name was resolved correctly).

Indexing modes and guardrails (Settings or Config in index.js / hook.js):

Setting Default Description
autoIndexMode fast fast / moderate / full
autoIndexMaxFiles 20000 Repositories exceeding this file count are not auto-indexed (bounded traversal estimate, does not read .gitignore)
autoIndexCommand codebase-memory-mcp Path to the executable

Installation and Enablement

Prerequisites: DSH 0.2.0-rc.1; codebase-memory-mcp installed and available according to the upstream README.

  1. Verify the MCP CLI is on your PATH:
codebase-memory-mcp --version
  1. Install via the DSH Plugin Manager (the official flow handles both package installation and bundle selection):
github:smter/dsh-codebase-memory#663d24657256321a82934289f5ba3a281be677f4

README Note: Pinned to that commit; for upgrades, switch to a new commit or use the tag v1.0.0.

  1. Restart dsh web. Afterwards, options for the two rows of this plugin will appear in Settings.

If codebase-memory-mcp is not on the PATH, change autoIndexCommand in settings, and the command in the MCP row. To also handle the “stale daemon generation” issue (see limitations below), point both locations to the bin/cbm-mcp-preflight bundled with this repository.

Typical Usage

After installation and restart, no separate scripting is needed: simply using tools like grep and reading files in the session will trigger the nudge; unindexed repositories will trigger cli index_repository via the plugin when a read path matches (you can set CBM_DEBUG=1 to see reasons why auto-indexing was skipped).

MCP tool names follow the format mcp__codebase-memory-mcp__*. In PTC mode, the Tool SDK may render most MCP parameters as unknown; the plugin explicitly writes the call signature in the system prompt as a workaround. The root cause lies in the rendering side.

Development and self-testing (inside the maintainer’s repository):

pnpm install
pnpm test

The README records 57 test cases, requiring no network or real indexing, covering trigger conditions, correction rules driven by real errors, and the auto-indexing chain and guards.

Use Cases and Notes

Who it’s for: Agent/workflow developers who are already using or planning to use codebase-memory-mcp in DSH and want to reduce the “MCP connected but model doesn’t use it” scenario.

Permissions: The plugin runs with the current dsh process privileges; auto-indexing spawns the CLI. Before installing, you should read the GitHub repository source code and MIT license, and evaluate for yourself whether you trust the contents of the maintainer smter’s bundle.

Known Limitations (excerpted from README):

  • Git worktrees are indexed as separate projects; indexes for the main checkout and worktrees do not automatically overwrite each other.
  • Stale daemon generations may cause write failures while read calls still succeed: index_repository may report active daemon coordination could not be verified safely, which is easily misdiagnosed as “unindexed.” You can set the MCP row command and codebase-memory-nudge.autoIndexCommand to bin/cbm-mcp-preflight; or manually pkill -f 'codebase-memory-mcp --cbm-daemon-internal' and retry. The nudge also identifies relevant strings in error text and injects the fix.

The DSH ecosystem philosophy is “everything is a plugin”; the community directory SkillHub Plugin Page is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-codebase-memory connects the codebase-memory-mcp code graph to DSH and uses the trio of connection, reminder, and nudge to advance from “connected” to “actually querying the graph at decision points like grep/reading long files, correcting errors, and handling indexing.” When pinning to a commit for installation or adjusting thresholds and executable paths in Settings, refer to the README and forms.

  • Directory Page: https://www.skillhub.cn/plugins/smter/dsh-codebase-memory
  • GitHub: https://github.com/smter/dsh-codebase-memory
羽毛球分组比赛记分
小程序二维码

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

Xiaoye