π fix(claude): the guard lets agent sessions run niyam state
Slice: #654
kavach, the command guard, refused niyam state <slice> --title "β¦" in agent sessions, though the work rules' refusal of a fix and pre-push's warning for a closed slice both tell agents to run it. So #584's sandbox run had to be run by Alok at his terminal.
Change: .claude/kavach.json's reviewed niyam CLI gains the subcommand state, with no path options. Its reason now covers both subcommands and names niyam 0.7.20 for state.
Audit (niyam 0.7.20; src/run.ts and src/work.ts are unchanged for state up to 0.7.21):
stateArgstakes one slice (12or'#12') and one--title(or--title=). A title that starts with-is refused. It has no path option.fileStatereads the repository and its settings, then calls GitHub only: it files the State, attaches it under the slice, and printsState: #M. It writes nothing locally.
Why reviewedCLIs, not a readOnlyCommands pattern: kavach 0.7.19, the version sarathi pins, matches a readOnlyCommands pattern only against a whole line of plain characters ([A-Za-z0-9 ._/=:,@+%-]). The fallback gives up when any word is quoted (ReviewedLine, trusted_opening in python/kavach/boundary.py, read 2026-11-26; the same at veda main 7f265ad). So no read-only pattern could pass a quoted title or '#12'. reviewedCLIs takes single-quoted text, and double-quoted text with no $, backtick or backslash. Alok chose it in chat on 2026-11-26. Unlike a read-only entry, it runs only from the session's own worktree, from its root, and waits while a push runs.
Evidence: kavach 0.7.19's own config.load on this branch's .claude/kavach.json, with its matchers read_only_request and reviewed_cli_paths:
.claude/kavach.json: 4 readOnlyCommands; reviewedCLIs:
niyam: review-thread, state
from the worktree root:
readOnly niyam propose 654
reviewed niyam review-thread PRRT_abc --body-file .tmp/reply.md
reviewed niyam state 12 --title one-word
reviewed niyam state 12 --title "the second batch"
reviewed niyam state '#12' --title "the second batch"
reviewed niyam state 12 --title 'the second batch'
reviewed niyam state 12 '--title=the second batch'
refused niyam state 12 --title "$(whoami)"
refused niyam state 12 --title "`whoami`"
refused niyam state 12 --title "x" > out.txt
refused niyam state 12 --title "x"; rm -rf src
refused niyam state 12 --title "x" | tee out.txt
refused FOO=1 niyam state 12 --title "x"
from src/: refused niyam state 12 --title "the second batch"
On main's file the same lines all come out refused, except the niyam propose control and the review-thread line. A readOnlyCommands pattern built for quoted titles admitted none of them, and one for a bare one-word title admitted only --title one-word.
A live niyam state call from a session can't prove this before merge: sarathi points kavach at the main checkout's .claude/kavach.json (KAVACH_CONFIG), not the worktree's.
Guards: none. .claude/kavach.json is not a guard file here.
Other client repositories (#650): veda and athya_mono run kavach and need the same subcommand; they get their own slices. athya-rules has no .claude/kavach.json and runs no kavach, so it needs none.
π€ Generated with Claude Code
Summary by cubic
Allows agent sessions to run niyam state <slice> --title "β¦" through kavach, since the work rules and pre-push both tell agents to run it. Adds the state subcommand to reviewedCLIs in .claude/kavach.json and updates the audit note to cover niyam 0.7.20.