Hivemind Code Graph
A deterministic, AST-derived map of the current repository — every function,
class, method, interface, type, enum, const, and module, plus the edges between
them (calls, imports, extends, implements, method_of). It is queried as
synthesized files under the Deeplake mount; there are no real files on disk and
no network call in the read path.
The graph builds and refreshes automatically (on Stop / SessionEnd, gated by
a rate limit + git diff). You never run a build command — just read it.
Use it as a fast INDEX to locate the few files/symbols that matter, then open
them with Read to answer. It is not a substitute for the source.
When to use this skill
Activate when the user asks a structural / relational question about the code:
- "What calls
pushSnapshot?" / "Who uses this function?"
- "What does
deeplake-pull.ts import?" / "What depends on X?"
- "Where is
GraphSnapshot defined?" / "Find the function that handles Y."
- "What are the main subsystems / the architecture here?"
- "If I change this signature, what's affected?" → use
impact/<symbol> (transitive blast radius)
When NOT to use this skill
- Reading the body of a symbol you already located → use
Read on the real
source file. The graph gives location + relationships, not full source.
- Code that isn't committed/built yet — the graph can lag uncommitted edits.
If a file's mtime is newer than the build timestamp, read the live source.
- Languages outside TypeScript, JavaScript, and Python (Go, Rust, …) — the
extractor covers those three, with cross-file
calls/imports resolved for
named imports. For anything else, fall back to grep/read.
Path cheat sheet
cat ~/.deeplake/memory/graph/index.md
# Overview: node/edge counts, kind breakdown, top files by node count.
cat ~/.deeplake/memory/graph/query/<pattern> # START HERE (the 2-in-1)
# Search + expand the top matches with their 1-hop neighbors (callers,
# callees, imports, heritage). Multi-token AND: query/<a>+<b>.
cat ~/.deeplake/memory/graph/find/<pattern>
# Case-insensitive substring search on node id + label (max 50 hits).
# Prints numbered handles [1] [2] ... saved for this worktree.
cat ~/.deeplake/memory/graph/show/<handle-or-pattern>
# <handle>: a digit from a prior find/ (e.g. 3).
# <pattern>: a substring → unique node detail, or a candidate list.
# Output: the node + its 1-hop neighbors grouped by edge relation.
cat ~/.deeplake/memory/graph/neighborhood/<file>
# Every symbol in a file + its cross-file neighbors (callers/callees/imports).
cat ~/.deeplake/memory/graph/impact/<pattern>
# Transitive dependents — the blast radius of changing a symbol.
cat ~/.deeplake/memory/graph/path/<from>/<to>
# Shortest dependency path between two symbol patterns (trace a flow across files).
cat ~/.deeplake/memory/graph/layers # architectural layers / subsystems
cat ~/.deeplake/memory/graph/tour # deterministic guided walkthrough
Workflow
- Broad? Start at
index.md to see subsystems and the biggest files.
- Looking for a symbol?
find/<name> (or query/<name>) → pick the handle.
- Want relationships?
show/<handle> / neighborhood/<file> → callers/callees, imports.
- Tracing a flow?
path/<from>/<to>. Change impact? impact/<symbol>.
- Need the actual code? Take the
source_file:line and Read it — don't answer from the graph alone.
Anti-patterns (read these)
- "Incoming (0)" does NOT mean dead code. Cross-file
calls are resolved for
named imports (TS/JS/Python), but instance-method dispatch (obj.method()),
dynamic calls, and nested/inner functions are NOT — a zero-incoming symbol may
still be reached via one of those. Confirm in the source before calling it unused.
- The graph can be stale. It rebuilds at most once per rate-limit window. The
SessionStart inject prints the build age; if it's old or you've just edited a
file, prefer the live source for that file.
- Don't try to build it. There is no user-facing build step in normal use;
the hooks handle it. Just read the mount.
find/ is lexical, not semantic. It matches substrings, not meaning —
find/auth won't surface login/credentials unless those strings appear in
the id/label. Try multiple keywords if the first misses.
1---2name: hivemind-graph3description: Query the local code graph (functions, classes, calls, imports) through the Deeplake mount at memory/graph/. Use when the user asks structural questions about the codebase — "what calls X?", "what does Y import?", "where is Z defined?", "what is the architecture / which subsystems exist?". The graph is an AST-derived map of the repo, queried as files (no build needed — it rebuilds automatically).4---56# Hivemind Code Graph78A deterministic, AST-derived map of the current repository — every function,9class, method, interface, type, enum, const, and module, plus the edges between10them (`calls`, `imports`, `extends`, `implements`, `method_of`). It is queried as11synthesized files under the Deeplake mount; there are no real files on disk and12no network call in the read path.1314The graph **builds and refreshes automatically** (on Stop / SessionEnd, gated by15a rate limit + git diff). You never run a build command — just read it.1617Use it as a fast **INDEX** to locate the few files/symbols that matter, then open18them with `Read` to answer. It is not a substitute for the source.1920## When to use this skill2122Activate when the user asks a *structural / relational* question about the code:2324- "What calls `pushSnapshot`?" / "Who uses this function?"25- "What does `deeplake-pull.ts` import?" / "What depends on X?"26- "Where is `GraphSnapshot` defined?" / "Find the function that handles Y."27- "What are the main subsystems / the architecture here?"28- "If I change this signature, what's affected?" → use `impact/<symbol>` (transitive blast radius)2930## When NOT to use this skill3132- Reading the **body** of a symbol you already located → use `Read` on the real33 source file. The graph gives location + relationships, not full source.34- Code that isn't **committed/built** yet — the graph can lag uncommitted edits.35 If a file's mtime is newer than the build timestamp, read the live source.36- Languages outside **TypeScript, JavaScript, and Python** (Go, Rust, …) — the37 extractor covers those three, with cross-file `calls`/`imports` resolved for38 named imports. For anything else, fall back to grep/read.3940## Path cheat sheet4142```bash43cat ~/.deeplake/memory/graph/index.md44# Overview: node/edge counts, kind breakdown, top files by node count.4546cat ~/.deeplake/memory/graph/query/<pattern> # START HERE (the 2-in-1)47# Search + expand the top matches with their 1-hop neighbors (callers,48# callees, imports, heritage). Multi-token AND: query/<a>+<b>.4950cat ~/.deeplake/memory/graph/find/<pattern>51# Case-insensitive substring search on node id + label (max 50 hits).52# Prints numbered handles [1] [2] ... saved for this worktree.5354cat ~/.deeplake/memory/graph/show/<handle-or-pattern>55# <handle>: a digit from a prior find/ (e.g. 3).56# <pattern>: a substring → unique node detail, or a candidate list.57# Output: the node + its 1-hop neighbors grouped by edge relation.5859cat ~/.deeplake/memory/graph/neighborhood/<file>60# Every symbol in a file + its cross-file neighbors (callers/callees/imports).6162cat ~/.deeplake/memory/graph/impact/<pattern>63# Transitive dependents — the blast radius of changing a symbol.6465cat ~/.deeplake/memory/graph/path/<from>/<to>66# Shortest dependency path between two symbol patterns (trace a flow across files).6768cat ~/.deeplake/memory/graph/layers # architectural layers / subsystems69cat ~/.deeplake/memory/graph/tour # deterministic guided walkthrough70```7172## Workflow73741. Broad? Start at `index.md` to see subsystems and the biggest files.752. Looking for a symbol? `find/<name>` (or `query/<name>`) → pick the handle.763. Want relationships? `show/<handle>` / `neighborhood/<file>` → callers/callees, imports.774. Tracing a flow? `path/<from>/<to>`. Change impact? `impact/<symbol>`.785. Need the actual code? Take the `source_file:line` and `Read` it — don't answer from the graph alone.7980## Anti-patterns (read these)8182- **"Incoming (0)" does NOT mean dead code.** Cross-file `calls` are resolved for83 *named imports* (TS/JS/Python), but **instance-method dispatch** (`obj.method()`),84 dynamic calls, and nested/inner functions are NOT — a zero-incoming symbol may85 still be reached via one of those. Confirm in the source before calling it unused.86- **The graph can be stale.** It rebuilds at most once per rate-limit window. The87 SessionStart inject prints the build age; if it's old or you've just edited a88 file, prefer the live source for that file.89- **Don't try to build it.** There is no user-facing build step in normal use;90 the hooks handle it. Just read the mount.91- **`find/` is lexical, not semantic.** It matches substrings, not meaning —92 `find/auth` won't surface `login`/`credentials` unless those strings appear in93 the id/label. Try multiple keywords if the first misses.