Skip to content
CC19990113 edited this page Nov 13, 2026 · 2 revisions

English · 中文

codegraph

Structural code intelligence for DeepSeek Harness. Two tools — codegraph and codegraph_index — answer where is this declared, who calls it, what breaks if I change it, and how does one symbol reach another, from a pre-built on-disk graph instead of text search.

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

Why not grep, why not LSP

  • grep matches a name inside comments, strings and unrelated identifiers — and cannot answer "who calls this" at all.
  • LSP is precise, but needs a running server per language, a warm workspace index, and a cursor position rather than a name.

A symbol graph answers all of it from one cheap lookup, and this plugin ships both halves: a store that serves queries and an indexer that builds the graph, so a fresh workspace needs no external tooling.

The ten operations of codegraph

Operation Answers Needs
search Where is a symbol declared? query
node One symbol with its immediate callers and callees symbol
callers What calls this? symbol
callees What does this call? symbol
impact What can a change to this reach? symbol
trace How does one symbol reach another? from, to
files What is indexed, under a directory or glob? —
status How large and how fresh is the index? —
explore Several related declarations with their source query
context Everything relevant to a task, with source task

codegraph_index is a separate tool, not an eleventh operation: indexing a large workspace takes minutes while a query takes milliseconds, and a tool's timeout is fixed per registration. status is the only operation that answers plainly when no index exists; every other operation fails loudly, so an unindexed workspace is never mistaken for an empty one.

The index

  • Path: <projectRoot>/.codegraph/codegraph.db, schema v4
  • Interoperable: the same file the @colbymchenry/codegraph CLI writes — an existing CLI index is picked up as-is, and the CLI can still read this one
  • Languages: 18 bundled grammars, loaded lazily (TypeScript, TSX, JS, JSX, Python, Go, Java, Kotlin, Dart, C, C++, C#, PHP, Rust, Ruby, Zig, Swift, Scala)
  • Committed build output is skipped by shape (.min. paths, or an average line length past 500), so a checked-in dist/ never pollutes resolution

Auto-indexing

Three things keep the graph current without asking:

  1. A session starts with an index. Opening a session in a workspace that was never indexed — or whose index is over ten minutes old — starts a background build through the host's job registry.
  2. Watching is on by default. Every in-scope directory is watched through the host's filesystem seam; a debounced change triggers a rebuild, and an empty change set schedules nothing.
  3. Re-indexing parses only what changed. Each run persists per-file extractions; the next confirms them by mtime+size and reuses them.

Speed

Before After
parse + extract, 336 files 727 ms (WASM) 110 ms (Rust addon)
repeat index, 337-file workspace 991 ms 45 ms (parse cache)

The Rust engine covers TypeScript, TSX, JavaScript and JSX today; other languages use the JS extractor. Edges are always rebuilt over the whole graph — the unique-name rule is global, so a symbol added in one file can invalidate edges pointing at another that never changed.

Entry points for a human

  • /codegraph status | index | files — no model turn spent
  • Settings → 代码图谱 — index state (files, declarations, relationships, unresolved counts, age, skipped artifacts), a path box, and a rebuild button

Links

codegraph

English

中文

Clone this wiki locally