-
Notifications
You must be signed in to change notification settings - Fork 21
fix(graph): cloud pull sha + cross-agent VFS parity (Cursor/Codex/Hermes) #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
efenocchi
wants to merge
4
commits into
main
Choose a base branch
from
fix/graph-pull-hash-mismatch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5757b36
fix(graph): verify cloud pull sha over stable fields, not full payload
efenocchi 3df0fc6
feat(graph): cross-agent VFS parity (Cursor/Codex/Hermes) + auto-buil…
efenocchi 6fe819b
feat(graph): hivemind-graph skill (claude-code, codex, hermes)
efenocchi 2e9d73b
feat(graph): deterministic VFS render endpoints (neighborhood/layers/…
efenocchi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| name: hivemind-graph | ||
| 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's the architecture / which subsystems exist?", "what's the impact of changing this?". The graph is an AST-derived map of the repo, queried as files (no build needed — it rebuilds automatically). | ||
| allowed-tools: Read Bash | ||
| --- | ||
|
|
||
| # 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. | ||
|
|
||
| ## 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?" (1-hop 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. | ||
| - Non-TypeScript code (Python, Go, …) — the graph is **TypeScript/TSX only** | ||
| today. For other languages, fall back to grep/read. | ||
|
|
||
| ## Path cheat sheet | ||
|
|
||
| ```bash | ||
| cat ~/.deeplake/memory/graph/index.md | ||
| # Overview: node/edge counts, kind breakdown, top files by node count. | ||
|
|
||
| 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. | ||
| ``` | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Broad? Start at `index.md` to see subsystems and the biggest files. | ||
| 2. Looking for a symbol? `find/<name>` → pick the handle you want. | ||
| 3. Want relationships? `show/<handle>` → see callers/callees, imports, members. | ||
| 4. Need the actual code? Take the `source_file:line` from `show/` and `Read` it. | ||
|
|
||
| ## Anti-patterns (read these) | ||
|
|
||
| - **"Incoming (0)" does NOT mean dead code.** Today `calls` edges are resolved | ||
| *intra-file only* — a node with zero incoming edges may still be called from | ||
| other files. Treat it as "no caller in the same file", not "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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| name: hivemind-graph | ||
| 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). | ||
| allowed-tools: Bash | ||
| --- | ||
|
|
||
| # 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. | ||
|
|
||
| ## 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?" (1-hop 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. | ||
| - Non-TypeScript code (Python, Go, …) — the graph is **TypeScript/TSX only** | ||
| today. For other languages, fall back to grep/read. | ||
|
|
||
| ## Path cheat sheet | ||
|
|
||
| ```bash | ||
| cat ~/.deeplake/memory/graph/index.md | ||
| # Overview: node/edge counts, kind breakdown, top files by node count. | ||
|
|
||
| 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. | ||
| ``` | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Broad? Start at `index.md` to see subsystems and the biggest files. | ||
| 2. Looking for a symbol? `find/<name>` → pick the handle you want. | ||
| 3. Want relationships? `show/<handle>` → see callers/callees, imports, members. | ||
| 4. Need the actual code? Take the `source_file:line` from `show/` and `Read` it. | ||
|
|
||
| ## Anti-patterns (read these) | ||
|
|
||
| - **"Incoming (0)" does NOT mean dead code.** Today `calls` edges are resolved | ||
| *intra-file only* — a node with zero incoming edges may still be called from | ||
| other files. Treat it as "no caller in the same file", not "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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| name: hivemind-graph | ||
| 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). | ||
| allowed-tools: terminal | ||
| --- | ||
|
|
||
| # 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. | ||
|
|
||
| ## 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?" (1-hop 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. | ||
| - Non-TypeScript code (Python, Go, …) — the graph is **TypeScript/TSX only** | ||
| today. For other languages, fall back to grep/read. | ||
|
|
||
| ## Path cheat sheet | ||
|
|
||
| ```bash | ||
| cat ~/.deeplake/memory/graph/index.md | ||
| # Overview: node/edge counts, kind breakdown, top files by node count. | ||
|
|
||
| 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. | ||
| ``` | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Broad? Start at `index.md` to see subsystems and the biggest files. | ||
| 2. Looking for a symbol? `find/<name>` → pick the handle you want. | ||
| 3. Want relationships? `show/<handle>` → see callers/callees, imports, members. | ||
| 4. Need the actual code? Take the `source_file:line` from `show/` and `Read` it. | ||
|
|
||
| ## Anti-patterns (read these) | ||
|
|
||
| - **"Incoming (0)" does NOT mean dead code.** Today `calls` edges are resolved | ||
| *intra-file only* — a node with zero incoming edges may still be called from | ||
| other files. Treat it as "no caller in the same file", not "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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reject JSON
nulland other non-object payloads before touchingnodes/links.JSON.parse("null")succeeds here, and the subsequent property access throws beforepullSnapshotcan return the documentederroroutcome. Please first guard that the parsed value is a non-null object, then validate the snapshot shape before hashing or writing.🤖 Prompt for AI Agents