Skip to content

feat: write the approval record from the person's yes - #157

Merged
mmaclay merged 3 commits into
mainfrom
feat/approval-from-answer
Dec 5, 2026
Merged

mmaclay merged 3 commits into
mainfrom
feat/approval-from-answer

Conversation

@mmaclay

@mmaclay mmaclay commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Origin: the maintainer's note: gate decisions in their sessions from 2026-10-19 to 2026-12-03, with write plans prompting at nearly every Jira write after the yes
Sandbox: tracker-gh-* (11 scenarios). Haiku, current plugin vs branch from run.py compare --check: 8/11 vs 10/11; main fails self-record (writes the record itself), audit-duplicates and unrecorded-ask. Branch --check --repeat 2: Haiku 20/22, Sonnet 19/22; must-not-write 10/10 on both; draft-write (new, refine, unrecorded, drop) Haiku 7/8, Sonnet 6/8, each failure a one-off model slip with the gate holding; no write allowed without approval in any run. On the final guard, Haiku --repeat 2 on new, refine, drop, audit-duplicates and self-record: 9/10, the drop check corrected to allow a follow-up's own comment and replayed on those runs; no guard denial of the plan command.
Canary: pending: a week of real ticket-draft, ticket-audit and design-doc use on this branch

Why

The Atlassian gate lets a Jira write through without a prompt only when .review/jira-approval.json lists it. The skills were meant to write that record with a jq command after the person approved the write plan, and the model mostly skipped the step. In the maintainer's sessions from 2026-10-19 to 2026-12-03, 103 Jira writes prompted and 36 were allowed. 71 of the prompts came in sessions where no record was ever written: a person who answered "All 12" then confirmed 13 creates and 12 transitions one at a time. The rest were records past their 30 minutes (17), records already removed (11), comment edits no plan could hold (5) and Confluence writes, which asked at every call (3). Once this merges, one yes to a write plan covers exactly the writes it lists, and the record comes from the person's answer, so a skipped step no longer turns into a prompt per write.

How the yes becomes the record

  • Skills write the plan with scripts/approval.py plan, one <tool> <target> line per item, in the turn that shows the plan, before the gate. The command checks the shape the hook reads and refuses a bad line while the model can still fix it: hand-written JSON plans came out in shapes of the model's own, so every write prompted. The skills no longer write the record.
  • hooks/approval.sh reads the person's answer: PostToolUse on AskUserQuestion, or a typed reply through UserPromptSubmit, since the sandbox and the prose fallback answer by typing. Only a fixed label carrying the count is a yes, Write all <n> or Publish <n> to <page title>, and the count must match the plan. Any other answer, Drop some and Paste instead included, records nothing, and the skill shows the plan again.
  • A PreToolUse guard refuses the model's writes to either record, and an AskUserQuestion the model filled with answers. In Claude Code 2.1.335 a model-filled answer reaches PostToolUse identical to a person's, so this is the only place to catch it; a widget dismissed with Esc fires no event, so the next prompt clears a pending plan.
  • After each successful gated write, the hook spends that item, and deletes the record with its last one, so the model has no cleanup step to get wrong. A create's key or number replaces new:<slug> in later items, read from the real mcp-atlassian {"result": ...} and GitHub {"issue": {...}} results.

A signed record or a transcript check would be no stronger than the guard, since the model can read a key file and write the transcript as easily as the record. The guard stops a plain write or copy naming .review/, a heredoc a shell or interpreter runs included, and lets reads and commit messages through. A deliberate route, such as a directory copy, a tar pipe or a name built inside a script, is not seen, and it fails open without python3; docs/design.md says so.

What a plan can now hold

jira_edit_comment, only when the person asked for the edit, and the three Confluence writes, so the publish and revise gates stop prompting per call. A confluence_update_page carrying parent_id moves the page and still asks. Every main-session Jira write, a direct request included, now goes through a write plan.

For the reviewer

  • tracker-gh-audit-duplicates now ends "Write all.": ticket-audit's plan has no Looks right to come before it.
  • A record outlives a stopped plan: after Stop here, unwritten items stay allowed until the 30 minutes lapse.
  • With a Jira and a GitHub plan both pending, a yes records neither.
  • The widget path was checked live in Claude Code 2.1.335: Write all, Esc, Other, Paste it all and a typed yes. Not verified: any Jira or Confluence write, since the sandbox's Jira stub is read-only; the result shapes come from the maintainer's transcripts. The canary carries both. tests/test_approval.py guards the parsing and every refusal; tests/test_atlassian_gate.sh builds records through the hook for the new targets.

Tests: bash tests/checks.sh

🤖 Generated with Claude Code. AI assistance level: 5/5 (not read by a person).

The skills wrote .review/jira-approval.json with a command after the
yes, and the model mostly skipped that step, so each write of an
approved plan prompted.

- Add hooks/approval.sh and scripts/approval.py: the answer and prompt
  modes write the record from a gate answered Write all <n> or Publish
  <n> to <page title>, with the count checked against the plan file;
  created puts a new key in place of new:<slug>; guard denies writes
  to either record and an AskUserQuestion carrying answers
- Skills write .review/jira-plan.json or github-plan.json as they show
  the plan; Drop some and Paste instead show it again; conversions run
  before the plan is shown; a failure keeps the record
- Let atlassian-gate.sh allow jira_edit_comment and Confluence writes
  a plan lists; an update carrying parent_id still asks
- Route every main-session Jira write through a write plan, and put
  the Confluence publish and revise gates in the plan form
- Move both approval records to version 2 in docs/contracts.md and
  update README, design.md, ROADMAP and .claude/CLAUDE.md
- Add tests/test_approval.py and gate tests that build the record
  through the hook; add the drop and self-record sandbox scenarios

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mmaclay mmaclay self-assigned this Dec 3, 2026
mmaclay and others added 2 commits December 4, 2026 18:13
- The hook spends each item after a successful gated write and deletes
  the record with its last item; the model no longer removes it
- The gates' target mode is the one definition the spend matches on
- Read the real mcp-atlassian {"result": ...} and GitHub
  {"issue": {...}} create results; the sandbox stub returns the latter
- Skills write the plan file with `approval.py plan` from
  `<tool> <target>` lines; the command checks the shape the hook reads
- The plan command runs in the turn that shows the plan, before the gate
- The guard denies hand-writes of plan files and copies naming .review/,
  checks heredocs a shell or interpreter runs, and lets reads through
- Document the guard's accepted residual routes
- Sandbox write scenarios ask to see the plan before the scripted yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…swer

# Conflicts:
#	skills/ticket-draft/SKILL.md
@mmaclay
mmaclay marked this pull request as ready for review December 5, 2026 19:22
@mmaclay
mmaclay merged commit f9bc56e into main Dec 5, 2026
1 check passed
@mmaclay
mmaclay deleted the feat/approval-from-answer branch December 5, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant