šŸ› fix(kavach): the refusal outside an owned worktree names what it counted, 0.7.5

Merged
AT
12d ago
+119-9

Slice: #240

From a checkout the session doesn't own, kavach 0.7.4 refused with only "use EnterWorktree". That left a session unable to tell a command the guard misreads from a real write: the last ask of Brief #6.

The refusal keeps its leading words and adds one sentence:

… use EnterWorktree. The guard counts this command as a mutation because it uses `claude`, a program whose writes the guard does not know, and cannot read off it what it writes.
… use EnterWorktree. The guard counts this call as writing `/…/veda/new.txt`.
… use EnterWorktree. The guard counts this call as writing `/…/veda`, the folder it runs in, where it cannot prove the command writes nothing.
  • A command the guard could not read: the constructs unreadable_constructs names, the same words the worktree refusal uses.
  • A call whose writes it read: up to three places, then "N more". A folder that only holds another target is left out, and the folder the command runs in is named as that.
  • No place and no construct to name (X=1 ls): "cannot prove this command writes nothing". That is a known limit, since the assignment isn't named.

No verdict changes. Only substring assertions matched the old text, and they still match.

Tests: an adapter test through the real hook from the main checkout, plus the branches it can't reach. The full test_worktree_guard.py (104 tests) and the refusal-hint and refusal-log suites pass, as does a slice of test_boundary.py run from unowned checkouts. kavach's node and corpus tests pass, 767 of 767.

Ships as kavach and sarathi 0.7.5 (v0.7.4 is the newest tag).

šŸ¤– Generated with Claude Code


Summary by cubic

Refusals from a checkout the session doesn't own now name what the guard counted, instead of only "use EnterWorktree", so a session can tell a command the guard misreads from a real write.

  • Names the constructs a command uses that the guard couldn't read, or up to three places it writes, then "N more".
  • The folder a Bash command runs in (after cd or git -C) is named last as that; folders that hold other targets are no longer dropped.
  • A call with nothing to name says it cannot prove the command writes nothing; a file tool with an unreadable path says so.
  • No verdict changes; substring assertions still match.
  • Ships as @veda-hq/kavach and @veda-hq/sarathi 0.7.5.