Skip to content

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

Closed

Description

@Marius1311

Goal

A way for an agent or a human to break a rule of these conventions on purpose, behind two gates:

  1. explicit human approval;
  2. a note of the broken rule in the PR and in the task README.

The case that prompted it: bringing an existing analysis repo up to date with conventions it predates, which
means renaming task directories, adding task ids to READMEs and the like. It is a one-off, it needs agents to
break some rules, and it should have a safe route.

Facts

  • Rules live in three places: the five session rules (hooks/session_context.md), the skill, and the template's
    CONVENTIONS.md. Most are stated only.
  • Four hooks block with exit code 2 and have no override: guard_task_layout (PreToolUse and Stop),
    guard_task_paths, guard_worktree_pixi, guard_shared_writes.
  • In the prompting case, two things stand in the way: the layout hook (READMEs and top-level files of tasks made
    before the template) and session rule 1 (earlier task directories are never edited).

Open questions

Defaults are the briefing session's suggestions; nothing here is decided.

  • Q1 How does a hook learn of an approved exception? Default: the human names it when starting the session
    (for example an environment variable the hooks read), so an agent cannot grant itself one. To verify first:
    that plugin hooks see the launching shell's environment, and that an agent's own commands cannot change it.
    Alternative: the hooks read the note from the task README.
  • Q2 Scope of one exception. Default: one named guard, for one session.
  • Q3 Where the note goes when the work is not one analysis task, as in a repo-wide migration: the PR body
    only, or also each touched task's README?
  • Q4 Rules that are stated only. Default: one sentence and no machinery: a rule may be broken only with the
    human's explicit approval, noted in the README and the PR.
  • Q5 The note's format. Default: one line per exception (rule, why, approved by, date). A new README
    heading would change what the layout hook accepts.

Constraints

Activity

  1. Marius1311 commented on Nov 18, 2026

    @Marius1311
    MemberAuthor

    Decided, per question; implemented in #29 and quadbio/analysis_template#32.

    • Q1 After a guard refuses, its message names the command and the human types it in the session: /analysis-workflow:allow <guard>. Not at session start: a guard is usually learnt of only when it fires.
    • Q2 One named guard, for that session, its subagents and a resume included.
    • Q3 The PR body only; a task README only when the exception belongs to that task.
    • Q4 One sentence in the session rules; how to note an exception lives in the template's CONVENTIONS.md.
    • Q5 A row in the PR's "Method and decisions" table, and a clause in the README's entry for that PR. No new heading.

    The facts Q1 asked to verify, tested with Claude Code 2.1.327:

    result
    plugin hooks see the launching shell's environment yes
    an agent's export, or a line added to the session's env file, reaches the hooks no
    an env block written to a settings file mid-session reaches the hooks yes, at the next hook call: an agent can change it
    UserPromptSubmit fires for a subagent's report, another session's message and a scheduled prompt yes; the scheduled prompt arrives unwrapped, like a typed line
    UserPromptExpansion fires for any of those, or when the model loads the skill no, only for a command the human types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions