Repository navigation
Claude Code subagents can't write to graphify-out/ (skill.md): chunks silently lost during /graphify --update #808
Description
Summary
When /graphify --update dispatches general-purpose Claude Code subagents for semantic extraction (Step B2), each subagent successfully extracts the JSON but cannot persist it because the bundled skill.md instructs them to write to graphify-out/.graphify_chunk_NN.json — a path outside Claude Code's general-purpose subagent sandbox allowlist.
The subagent does the work, then fails with "Write tool is denied" for that path. Step B3 then can't find the chunks, the merge gets empty input, and docs/images are silently dropped from the graph.
Reproducer
uv tool install graphifyy(v0.6.7 confirmed)graphify install --platform claudein a project- In Claude Code, run
/graphify --updateagainst a project with mixed code + docs/images - Step B2 dispatches
general-purposesubagents perskill.mdlines 351–368 - Each subagent attempts
Writeto<project>/graphify-out/.graphify_chunk_NN.json - Observed: subagent reports "Write tool is denied". It returns gracefully after burning ~3 min of inference per chunk.
- Step B3 reads
graphify-out/.graphify_chunk_*.json→ empty →.graphify_semantic_new.jsonhas 0 nodes added → docs/images effectively skipped from the update.
Root cause
Claude Code's general-purpose subagent runs in a sandbox that does NOT inherit the orchestrator's filesystem allowlist. As of 2026-05 the writable paths for a typical project layout are:
- The specific app/component subdirs the user has open (e.g.
apps/mobile,src/) <project>/.claude//tmp
Notably NOT writable from a general-purpose subagent:
<project>/graphify-out/- The project root itself
The bundled skill.md assumes the orchestrator's permissions propagate. They don't.
Cost data point
A /graphify --update on a ~400-file Expo monorepo on 2026-05-08 lost ~16 min and ~290k tokens across two retry cycles before the issue was diagnosed by reading the subagent's error output. Both subagents reported "Write tool is denied" after completing the extraction work in memory.
Proposed fix
Route subagent chunk writes through /tmp/graphify_chunk_NN.json — universally writable across every Claude Code sandbox configuration I've tested. The orchestrator's merge step copies them into graphify-out/ before the existing glob+merge logic, so cache semantics + the rest of the pipeline are unchanged.
Four small edits to graphify/skill.md (1437 lines → 1437 lines, net):
- Step B2 prompt template (~line 354) — replace "Output exactly this JSON" with explicit "Write to
/tmp/graphify_chunk_NN.json" instruction + sandbox rationale comment. - Step B3 success-signal check (~line 361) — change path from
graphify-out/.graphify_chunk_NN.jsonto/tmp/graphify_chunk_NN.json. - Step B3 merge step (~line 374) — insert 4 lines that
shutil.copy/tmp/graphify_chunk_*.json→graphify-out/before the existing glob (200+ lines unchanged). - Step 9 cleanup (~line 838) — also
rm -f /tmp/graphify_chunk_*.json.
PR coming next with the exact diff.
Tradeoffs of /tmp
- Universally writable across every Claude Code sandbox I've seen
- Auto-cleared on reboot (cleanup-friendly)
- Theoretical concurrency collision: two
/graphifyruns from different projects could clash on filenames. Mitigation: subdirectory-per-run if it ever bites in practice (it hasn't for me across ~30 update runs). - Doesn't survive reboot mid-run. Acceptable —
/graphify --updatecompletes in <10 min.
Why not project-level additionalDirectories
Per-project busywork that doesn't help users running graphify across multiple projects, and would silently regress for any user who hasn't applied it. The /tmp path is portable and works everywhere by default.
Other affected platforms?
The bundled package has 12 platform-specific skill-*.md files. Only skill.md (Claude Code default) is confirmed affected by me. The fix likely applies to other platforms with similar subagent sandbox models — needs verification per-platform. I can scope this PR to skill.md only and let other contributors validate the parallel files.
Activity
fix #811 #803 #801 #808: Unicode IDs, dedup edge keys, direction flip…
safishamsi commentedon May 11, 2026
Fixed in v0.7.14 — subagent prompts now receive an absolute
CHUNK_PATHderived fromgraphify-out/.graphify_rootat dispatch time. The Write tool instruction uses this absolute path so chunk files land in the correctgraphify-out/directory regardless of the subagent's working directory.fix Graphify-Labs#811 Graphify-Labs#803 Graphify-Labs#801 Graphify-La…
fix Graphify-Labs#811 Graphify-Labs#803 Graphify-Labs#801 Graphify-La…