@deeplake/hivemind 0.7.75 → 0.7.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: hivemind-graph
3
+ description: 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
+ allowed-tools: Bash
5
+ ---
6
+
7
+ # Hivemind Code Graph
8
+
9
+ A deterministic, AST-derived map of the current repository — every function,
10
+ class, method, interface, type, enum, const, and module, plus the edges between
11
+ them (`calls`, `imports`, `extends`, `implements`, `method_of`). It is queried as
12
+ synthesized files under the Deeplake mount; there are no real files on disk and
13
+ no network call in the read path.
14
+
15
+ The graph **builds and refreshes automatically** (on Stop / SessionEnd, gated by
16
+ a rate limit + git diff). You never run a build command — just read it.
17
+
18
+ Use it as a fast **INDEX** to locate the few files/symbols that matter, then open
19
+ them with `Read` to answer. It is not a substitute for the source.
20
+
21
+ ## When to use this skill
22
+
23
+ Activate when the user asks a *structural / relational* question about the code:
24
+
25
+ - "What calls `pushSnapshot`?" / "Who uses this function?"
26
+ - "What does `deeplake-pull.ts` import?" / "What depends on X?"
27
+ - "Where is `GraphSnapshot` defined?" / "Find the function that handles Y."
28
+ - "What are the main subsystems / the architecture here?"
29
+ - "If I change this signature, what's affected?" → use `impact/<symbol>` (transitive blast radius)
30
+
31
+ ## When NOT to use this skill
32
+
33
+ - Reading the **body** of a symbol you already located → use `Read` on the real
34
+ source file. The graph gives location + relationships, not full source.
35
+ - Code that isn't **committed/built** yet — the graph can lag uncommitted edits.
36
+ If a file's mtime is newer than the build timestamp, read the live source.
37
+ - Languages outside **TypeScript, JavaScript, and Python** (Go, Rust, …) — the
38
+ extractor covers those three, with cross-file `calls`/`imports` resolved for
39
+ named imports. For anything else, fall back to grep/read.
40
+
41
+ ## Path cheat sheet
42
+
43
+ ```bash
44
+ cat ~/.deeplake/memory/graph/index.md
45
+ # Overview: node/edge counts, kind breakdown, top files by node count.
46
+
47
+ cat ~/.deeplake/memory/graph/query/<pattern> # START HERE (the 2-in-1)
48
+ # Search + expand the top matches with their 1-hop neighbors (callers,
49
+ # callees, imports, heritage). Multi-token AND: query/<a>+<b>.
50
+
51
+ cat ~/.deeplake/memory/graph/find/<pattern>
52
+ # Case-insensitive substring search on node id + label (max 50 hits).
53
+ # Prints numbered handles [1] [2] ... saved for this worktree.
54
+
55
+ cat ~/.deeplake/memory/graph/show/<handle-or-pattern>
56
+ # <handle>: a digit from a prior find/ (e.g. 3).
57
+ # <pattern>: a substring → unique node detail, or a candidate list.
58
+ # Output: the node + its 1-hop neighbors grouped by edge relation.
59
+
60
+ cat ~/.deeplake/memory/graph/neighborhood/<file>
61
+ # Every symbol in a file + its cross-file neighbors (callers/callees/imports).
62
+
63
+ cat ~/.deeplake/memory/graph/impact/<pattern>
64
+ # Transitive dependents — the blast radius of changing a symbol.
65
+
66
+ cat ~/.deeplake/memory/graph/path/<from>/<to>
67
+ # Shortest dependency path between two symbol patterns (trace a flow across files).
68
+
69
+ cat ~/.deeplake/memory/graph/layers # architectural layers / subsystems
70
+ cat ~/.deeplake/memory/graph/tour # deterministic guided walkthrough
71
+ ```
72
+
73
+ ## Workflow
74
+
75
+ 1. Broad? Start at `index.md` to see subsystems and the biggest files.
76
+ 2. Looking for a symbol? `find/<name>` (or `query/<name>`) → pick the handle.
77
+ 3. Want relationships? `show/<handle>` / `neighborhood/<file>` → callers/callees, imports.
78
+ 4. Tracing a flow? `path/<from>/<to>`. Change impact? `impact/<symbol>`.
79
+ 5. Need the actual code? Take the `source_file:line` and `Read` it — don't answer from the graph alone.
80
+
81
+ ## Anti-patterns (read these)
82
+
83
+ - **"Incoming (0)" does NOT mean dead code.** Cross-file `calls` are resolved for
84
+ *named imports* (TS/JS/Python), but **instance-method dispatch** (`obj.method()`),
85
+ dynamic calls, and nested/inner functions are NOT — a zero-incoming symbol may
86
+ still be reached via one of those. Confirm in the source before calling it unused.
87
+ - **The graph can be stale.** It rebuilds at most once per rate-limit window. The
88
+ SessionStart inject prints the build age; if it's old or you've just edited a
89
+ file, prefer the live source for that file.
90
+ - **Don't try to build it.** There is no user-facing build step in normal use;
91
+ the hooks handle it. Just read the mount.
92
+ - **`find/` is lexical, not semantic.** It matches substrings, not meaning —
93
+ `find/auth` won't surface `login`/`credentials` unless those strings appear in
94
+ the id/label. Try multiple keywords if the first misses.