⨠feat(sarathi): asks name GitHub issues and comments by full URL; agents delete their own branches (#397)
Slice: #397
Under work item #43.
Alok asked on 2026-11-22 that two corrections be enforced in code, not only kept as agent memory.
Rule B: links in asks. sarathi's ask-gate.sh now refuses an ask of the owner that names a GitHub issue, pull request or comment by number alone, and says how to fix it: give the full https://github.com/... URL.
- A bare reference is
#N,owner/repo#N, orPR,pull request,issueorcommentfollowed by a number. It is read with the URLs taken out. Agithub.comURL in the same ask that carries the same number covers it (/issues/N,/pull/N,#issuecomment-N,#discussion_rNā¦), with the number ending where its digits do. - PreToolUse (
AskUserQuestion, and awrap_upwith anask, buttons included): exit 2 withBLOCKED: give the full link.. This runs before every other pass: a go-ahead, research, a look, a declaredKind: approval. A repeat is refused too, since the fix is always to hand. A URL in thewrap_uprecap covers, because the ask holds 100 characters. - Stop: asking sentences are read with fenced code, quoted lines, inline code and quoted text left out. A line that opens
Needs you:or ends on a question is read whole. The turn goes on once (additionalContextstartinggive the full link.), before the "file the ask" nudge and the research hold, which that continuation skips. A URL anywhere in the message covers. - Acceptance, pinned in
ask-gate.test.ts:- "š the Guards Proposal on #376 (comment 7068450411)" is sent back on Stop and refused on
wrap_upandAskUserQuestion. - The same ask with https://github.com/veda-hq/veda/issues/376#issuecomment-7068450411 passes.
- A report that only mentions
#383passes.
- "š the Guards Proposal on #376 (comment 7068450411)" is sent back on Stop and refused on
- Each refusal is a line in the ask log,
outcome: "held: bare reference", withrefs. - Old fixtures changed on purpose. A few research-hold fixtures used bare ids inside asks (
PR #12 failed CI. Retry it or revert?,Close #12 or keep it?,Needs you: add the approved label to #289.). The new check now refuses those by design, so they say "The PR" or carry the URL. What each one tests (state naming, the nudge) is unchanged.
Rule A: agents delete their own branches.
- kavach: no rule refuses
git push origin --delete <branch>.git_safety.py'spushrefuses--force,--force-with-lease,--mirrorand their abbreviations,-f, and+refspecs;--deleteand-dare none of these. New rows incommand_guard_cases.py:- allowed:
--delete,-d,:branch, and two branches; - still refused:
--force ⦠--delete,-fd, a delete beside+main, and--mirror --delete. - kavach's behaviour does not change; this is tests only.
- allowed:
CLAUDE.mdGuards: "any push that rewrites or deletes history" now names what kavach refuses. It says deleting a branch rewrites no history, and that agents delete their own superseded or closed PR branches themselves and never ask Alok to.ask-gate.test.ts's yes/no fixture is now "Publish v1.0.0?" in place of "Delete the branch?", and so is the README's example.- New lesson in
docs/lessons/git-github.md, "Delete your own old branches". On https://github.com/veda-hq/veda/pull/383, an old branch kept for the owner to delete held a secret-shaped token and failed every PR's Secret scans check.
When it takes effect. The gate guards sessions only after these steps:
- A sarathi release carrying this change.
- A pin bump of
@veda-hq/sarathiin veda, niyam and athya_mono. pnpm installin each main checkout (veda, niyam, athya_mono). This last step is Alok's.
kavach already allows the branch delete, so Rule A needs no release; only its wording and tests change here.
Out of scope: niyam's Guard and refusal texts, and athya-rules' process text, change in their own repositories (separate sessions).
Tests: pnpm --filter @veda-hq/sarathi run check (53 ask-gate tests, coverage and smoke) and pnpm --filter kavach test:python pass locally. So do pnpm guards and eslint on the test file.
š¤ Generated with Claude Code
Summary by cubic
sarathi's ask gate now refuses any ask that names a GitHub issue, pull request, or comment by number alone (#376, PR 382, comment 7068450411, #issuecomment-N) and requires the full https://github.com/... URL instead. It also documents that agents delete their own superseded or closed PR branches; kavach already allowed branch deletion, so only tests and docs change there.
Ask gate
AskUserQuestionandwrap_upasks with a bare reference are refused withBLOCKED: give the full link.before every other check, including repeats.- A closing
Stopmessage that asks with a bare reference goes on once with instructions to rewrite it; a sentence openingcheckoropencounts as asking. - Only a
github.comowner/repository route URL carrying the same number covers a reference; search and query URLs cover nothing. - Refusals are logged as
held: bare referencewith the references; old fixtures that used bare ids now carry URLs or say "the PR", and what each tests is unchanged. - The gate takes effect after a sarathi release, a pin bump of
@veda-hq/sarathiin veda, niyam and athya_mono, andpnpm installin each main checkout.
Branch deletion
- kavach's guard tests pin
git push origin --delete <branch>,-d, and:branchas allowed;--force,-fd,+refspecs, and--mirrordeletions stay refused. CLAUDE.md,README.md, and the git lessons now say agents delete their own superseded or closed branches and never ask the owner to.- The "Delete the branch?" yes/no fixture and README example became "Publish v1.0.0?".