Skip to content

/analysis-workflow:allow <guard>: the human lifts a guard for a session - #29

Merged
Marius1311 merged 1 commit into
mainfrom
worktree-rule-exceptions
Nov 18, 2026
Merged

Marius1311 merged 1 commit into
mainfrom
worktree-rule-exceptions

Conversation

@Marius1311

Copy link
Copy Markdown
Member

Closes #24. A rule of these conventions can now be broken on purpose, behind two gates: the human's approval and a note in the PR.

What the human does. A guard's refusal now ends with the command that lifts it, so nobody has to know the guards in advance. The agent passes it on; the human types /analysis-workflow:allow <guard> (layout, paths, pixi or shared-writes), and that guard lets calls through for the rest of the session, its subagents and a resume included. Other guards and other sessions are unaffected.

How. A UserPromptExpansion hook records the guard for the session in the plugin's data directory, and the guards read that record. The event fires only for a command the human types. Tested with Claude Code 2.1.327, it did not fire when the model loaded the skill, when a subagent's report or another session's message was the command line, or for a scheduled prompt. Two simpler channels were ruled out by test: a plain line read by UserPromptSubmit (a scheduled prompt arrives there looking exactly like a typed one), and an environment variable (an env block written to a settings file mid-session reaches the hooks, and it would have to be set before the guard is known).

Rules no hook enforces. One sentence in the session rules: a rule is broken only with the human's explicit approval, noted as CONVENTIONS.md says (quadbio/analysis_template#32).

Limits. Like the guards, this stops accidents: an agent that sets out to can write the session's record itself, which the session rule forbids. Records are never deleted (a few bytes each), so a resumed session keeps its exception. Headless, the model can load the allow skill's text, so that text claims nothing: only the hook's message says a guard was lifted.

+215 −22 lines.

Tests: 176 pass. End to end, in a throwaway repo that enables the plugin, with this branch loaded by --plugin-dir: an off-layout README edit was refused and the agent passed on the command; once it was typed, the edit and a subagent's off-layout write went through and the stop check stayed quiet; a cp into processed/ was still refused; a write still passed after --resume; a fresh session in the same repo was refused; allow nonsense was refused with the four names. Not done: the same run in a repo rendered from the template.

🤖 Generated with Claude Code

…sion

A rule is broken only with the human's approval, noted as `CONVENTIONS.md` says. A guard's
refusal names the command; a UserPromptExpansion hook, which fires only for a command the
human types, records the guard for the session, and the guards read that.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T12:54:47.539153Z 8510e92 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Marius1311
Marius1311 merged commit 5fb9698 into main Nov 18, 2026
3 checks passed
@Marius1311
Marius1311 deleted the worktree-rule-exceptions branch November 18, 2026 13:00
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.

A sanctioned way to break a rule: human approval plus a note

1 participant