✨ feat: kavach's worktree guard guards niyam sessions
Slice: #389
Auto-merge is off on purpose. sarathi reads .claude/sarathi.json and the pin from $CLAUDE_PROJECT_DIR, which is the main checkout on the desktop. When Alok pulls main there, the worktree guard comes on for every desktop session, the ones already running included. Until pnpm install brings in sarathi 0.6.11, sarathi.sh refuses every Bash, Edit and Write. So this merges only when Alok is ready to git pull and pnpm install in /Users/alok/code/athya/niyam right after it.
What changes
@veda-hq/sarathi0.6.10 → 0.6.11, which carries kavach 0.6.11. kavach now lets a session write its own scratchpad and the side-session notes folders the app granted it (veda-hq/veda#68, veda-hq/veda#111)..claude/sarathi.jsonputs theworktreeguard first, onBash|Edit|Write|MultiEdit|NotebookEdit, and names.claude/kavach.json.- The PreToolUse matcher in
.claude/settings.jsonwidens to those five tools, assarathi check --settingsrequires. - New
.claude/kavach.json: veda'sreadOnlyCommandsandownCheckout, plus onereviewedCLIsentry,niyam review-threadwith--body-fileas its path option. niyam 0.6.19 and main were audited: it reads only the file it is given, and writes nothing locally. - Run on these files, onboard's
claudeSettings()changes nothing.
Checked through sarathi hook PreToolUse
- Let through:
- writes to this session's scratchpad, its two granted notes folders, and the worktree;
pnpm check,install,buildandlint;git commit -F .tmp/…,git push,git fetchandgit rebase;gh pr create --body-file .tmp/…,gh issue commentandgh issue editwith--body-file .tmp/…;niyam review-thread … --reply "…",--body-fileand--resolve;niyam proposeandniyam --version.
- Refused:
- another session's scratchpad or notes folder, a
..escape,/tmp, and the main checkout; - any write from a session in the main checkout itself;
- heredocs,
node dist/cli.js …andnode --test <file>; - the other
niyamsubcommands (listed in #389's Cost).
- another session's scratchpad or notes folder, a
pnpm check passes.
🤖 Generated with Claude Code
Summary by cubic
Upgrades @veda-hq/sarathi to 0.6.11 so kavach's worktree guard covers niyam sessions. The guard now runs on Bash, Edit, Write, MultiEdit, and NotebookEdit instead of Bash alone, and new .claude/kavach.json lets a session write its own scratchpad and the notes folders the app granted it. Adds a reviewedCLIs entry so niyam review-thread passes with --reply.
Merge timing
Auto-merge is off on purpose: the guard activates in the main checkout the moment this merges, and every tool call in desktop sessions is refused until pnpm install pulls in sarathi 0.6.11. Merge only when ready to git pull and pnpm install immediately after.
Guard behavior
- Passes: writes to the session's own scratchpad, granted notes folders, and worktree;
pnpm check,install,build,lint;git commit -F .tmp/…,push,fetch,rebase;gh pr createandgh issuecommands with--body-file .tmp/…;niyam review-threadwith--reply,--body-file, or--resolve;niyam proposeand--version. - Refuses: another session's scratchpad or notes folders,
..escapes,/tmp, the main checkout, any write from the main checkout itself, heredocs,node dist/cli.js …,node --test <file>, and otherniyamsubcommands.
pnpm check passes.