Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

chore: regenerate own .claude/ from 0.4.4 templates

Shrish Dwivedi3a3ba3fe15ac
diff --git a/.claude/helpers/graft-hooks.cjs b/.claude/helpers/graft-hooks.cjs
index 9720fa35..c3d8d3e5 100755
--- a/.claude/helpers/graft-hooks.cjs
+++ b/.claude/helpers/graft-hooks.cjs
@@ -1,12 +1,42 @@
#!/usr/bin/env node
const path = require('path');
+const fs = require('fs');
+const { pathToFileURL } = require('url');
+const { execFileSync } = require('child_process');
const dir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
-function entry(name) {
+const BAKED = "/Users/shrishdwivedi/Documents/Context graphs/context-graph-engine/dist/claude";
+
+// The dist/claude dir of @nanonets/graft resolved from a base whose node_modules is searched.
+function fromPkg(base) {
+ try {
+ const pkg = require.resolve('@nanonets/graft/package.json', { paths: [base] });
+ return path.join(path.dirname(pkg), 'dist', 'claude');
+ } catch { return null; }
+}
+
+// The global node_modules dir per npm (handles Homebrew/Windows/volta). Queried on demand.
+function globalRoot() {
try {
- const pkg = require.resolve('@nanonets/graft/package.json', { paths: [dir] });
- return path.join(path.dirname(pkg), 'dist', 'claude', name);
- } catch {
- return path.join(dir, 'dist', 'claude', name);
+ const root = execFileSync('npm', ['root', '-g'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], shell: true }).trim();
+ return root || null;
+ } catch { return null; /* npm unavailable */ }
+}
+
+function candidates() {
+ const out = [];
+ if (BAKED) out.push(BAKED);
+ const local = fromPkg(dir); if (local) out.push(local);
+ const legacy = fromPkg(path.join(path.dirname(process.execPath), '..', 'lib')); if (legacy) out.push(legacy);
+ const gr = globalRoot(); if (gr) out.push(path.join(gr, '@nanonets', 'graft', 'dist', 'claude'));
+ return out;
+}
+
+function entry(name) {
+ for (const d of candidates()) {
+ const f = path.join(d, name);
+ if (fs.existsSync(f)) return f;
}
+ return path.join(dir, 'dist', 'claude', name); // last-ditch; import will no-op if absent
}
-import(entry("hooks.js")).then((m) => m.main(process.argv[2])).catch(() => { /* graft unavailable — no-op */ });
+
+import(pathToFileURL(entry("hooks.js")).href).then((m) => m.main(process.argv[2])).catch(() => { /* graft unavailable — no-op */ });
diff --git a/.claude/helpers/graft-statusline.cjs b/.claude/helpers/graft-statusline.cjs
index 5720dd81..08ed2507 100755
--- a/.claude/helpers/graft-statusline.cjs
+++ b/.claude/helpers/graft-statusline.cjs
@@ -1,12 +1,42 @@
#!/usr/bin/env node
const path = require('path');
+const fs = require('fs');
+const { pathToFileURL } = require('url');
+const { execFileSync } = require('child_process');
const dir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
-function entry(name) {
+const BAKED = "/Users/shrishdwivedi/Documents/Context graphs/context-graph-engine/dist/claude";
+
+// The dist/claude dir of @nanonets/graft resolved from a base whose node_modules is searched.
+function fromPkg(base) {
+ try {
+ const pkg = require.resolve('@nanonets/graft/package.json', { paths: [base] });
+ return path.join(path.dirname(pkg), 'dist', 'claude');
+ } catch { return null; }
+}
+
+// The global node_modules dir per npm (handles Homebrew/Windows/volta). Queried on demand.
+function globalRoot() {
try {
- const pkg = require.resolve('@nanonets/graft/package.json', { paths: [dir] });
- return path.join(path.dirname(pkg), 'dist', 'claude', name);
- } catch {
- return path.join(dir, 'dist', 'claude', name);
+ const root = execFileSync('npm', ['root', '-g'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], shell: true }).trim();
+ return root || null;
+ } catch { return null; /* npm unavailable */ }
+}
+
+function candidates() {
+ const out = [];
+ if (BAKED) out.push(BAKED);
+ const local = fromPkg(dir); if (local) out.push(local);
+ const legacy = fromPkg(path.join(path.dirname(process.execPath), '..', 'lib')); if (legacy) out.push(legacy);
+ const gr = globalRoot(); if (gr) out.push(path.join(gr, '@nanonets', 'graft', 'dist', 'claude'));
+ return out;
+}
+
+function entry(name) {
+ for (const d of candidates()) {
+ const f = path.join(d, name);
+ if (fs.existsSync(f)) return f;
}
+ return path.join(dir, 'dist', 'claude', name); // last-ditch; import will no-op if absent
}
-import(entry("statusline.js")).then((m) => m.main()).catch(() => { /* graft unavailable — no-op */ });
+
+import(pathToFileURL(entry("statusline.js")).href).then((m) => m.main()).catch(() => { /* graft unavailable — no-op */ });
diff --git a/.claude/settings.json b/.claude/settings.json
index bc94c3e6..c36cd082 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -7,34 +7,52 @@
"type": "command",
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-statusline.cjs\""
},
- "footerLinksRegexes": ["graft/[\\w./-]+\\.md"],
+ "footerLinksRegexes": [
+ "graft/[\\w./-]+\\.md"
+ ],
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
- { "type": "command", "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" post-edit", "timeout": 10000 }
+ {
+ "type": "command",
+ "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" post-edit",
+ "timeout": 10000
+ }
]
}
],
"Stop": [
{
"hooks": [
- { "type": "command", "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" stop", "timeout": 8000 }
+ {
+ "type": "command",
+ "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" stop",
+ "timeout": 8000
+ }
]
}
],
"UserPromptSubmit": [
{
"hooks": [
- { "type": "command", "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" prompt", "timeout": 8000 }
+ {
+ "type": "command",
+ "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" prompt",
+ "timeout": 8000
+ }
]
}
],
"SessionStart": [
{
"hooks": [
- { "type": "command", "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" session-start", "timeout": 8000 }
+ {
+ "type": "command",
+ "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" session-start",
+ "timeout": 8000
+ }
]
}
]
diff --git a/.claude/skills/graft/SKILL.md b/.claude/skills/graft/SKILL.md
index 90b5b79c..be6fc768 100644
--- a/.claude/skills/graft/SKILL.md
+++ b/.claude/skills/graft/SKILL.md
@@ -17,24 +17,42 @@ same understanding costs thousands.
- Ask: `graft ask "<your task, in plain words>"` — returns the relevant nodes,
ranked, with file:line pointers. Add `--source` to inline the actual code at
each span, so the result IS the code you need — no separate file read.
+ Ask is cheap (<1s) — re-ask with different phrasings for each sub-question,
+ and use structural forms too: `graft ask "who calls <symbol>"`.
- Or explore as usual: grep / ls / cat inside `graft/`. A grep for any concept,
symbol, or filename hits the node that covers it; `graft/INDEX.md` lists them
all.
-**Then STOP at the node. It is the answer, not a lookup toward the answer.**
+**Match the tool to the task shape:**
-- **Explaining / tracing / understanding** (no code change): the node's prose
- IS your deliverable. Cite files and functions straight from its `covers:`
- list — `covers:` gives you the exact `file:line` for every symbol, so you can
- cite precisely **without opening the source at all.** Do NOT open source to
- "verify," "confirm," or "see the real code" — the node was generated from that
- source and the spans are authoritative. Opening it costs thousands of tokens
- and changes nothing in your answer.
+- **Understanding, explaining, locating where a change goes** — the node IS the
+ answer. Cite files and functions straight from its `covers:` list — it gives
+ the exact `file:line` for every symbol, so you can cite precisely without
+ opening the source. The spans are generated from that source and are
+ authoritative; don't re-open files just to "double-check" them.
- **Editing:** run `graft ask "<symbol>" --source` to pull the exact span's
- code inline, and edit straight from that. Only touch the file to apply the
- change at the named `file:line` — never read the whole file, never open
- neighbouring files to "get oriented"; the pack already oriented you.
+ code inline, and edit straight from that. Touch the file only to apply the
+ change at the named `file:line` — never read the whole file to get oriented;
+ the pack already oriented you.
+- **Exhaustive tasks — "every occurrence / every provider / every caller of
+ this pattern":** ranked results are top-N, not a complete list. Use graft to
+ orient (what is the pattern, where does it live), then ENUMERATE with grep
+ over the source and verify each hit. Ask alone will miss instances; that is
+ expected, not a graft failure.
-If a node genuinely lacks a detail you need, `graft ask` for a more specific
-node before falling back to source. Reading whole source files to build
-understanding is the thing graft exists to replace — it already did that work.
+**Precise graph modes** — for structural questions, skip ranking and go
+straight to precomputed edges:
+
+- `graft callers <symbol>` / `graft callees <symbol>` — who breaks if this
+ changes / what does this call — precomputed edges, exact answers; structural
+ phrasing inside ask ("who calls X") routes here too.
+- `graft impact <symbol> [-d N]` — BFS over incoming edges out to depth N: the
+ full blast radius of a change.
+
+If a returned span is truncated ("+N more lines"), open the file at that exact
+range before finalizing.
+
+If a node genuinely lacks a detail you need, ask for a more specific node, and
+if it still lacks it, read the source — at the exact file:line the node points
+to, not the whole file. Reading whole source files to build understanding is
+the thing graft exists to replace.