Prevent recurrence
- Correct the immediate mistake. Identify the wrong action plainly and fix it within the authorized scope. Do not delay the correction for the prevention work.
- Find the existing knowledge. Search relevant instructions, current state, decisions, archives, and targeted transcript excerpts. Cite the source. If it was never recorded, say so rather than inventing prior documentation.
- Diagnose the missed path. Establish whether the rule was absent, misplaced, buried, in the wrong layer, skipped by this entry point, or read but unenforced. Separate proven causes from hypotheses.
- Change the narrowest reliable layer:
- Mechanical patterns: a tested hook, validator, or deny rule. Before writing a guard, name where the forbidden text physically appears and hook that event: the user's prompt -> UserPromptSubmit; the call the model is about to make -> PreToolUse; a fetched page or other tool output -> PostToolUse on the reading tools; the model's finished reply -> Stop. A guard on any other event can never see it.
- Local workflow constraints: a short colocated instruction in the directory where the work happens, stated in its first lines.
- Stable project behavior: project instructions.
- Mutable state or pending implementation: the project's state or tracker.
- Cross-project behavior: the shared instructions, only when every affected workflow needs it.
When two homes are plausible, pick the one closest to where the bad action physically happens and name the alternative in one line.
- Write the rule tightly. A rule written from the user's correction quotes the user's exact words in the changelog entry or lapse row; the rule line carries a pointer
(-> vN)or(-> <path>)and drops every clause that restricts more than the user's words do. When the rule already exists, rewrite that whole rule as short bullets (trigger, directive, exceptions, one pointer); never bolt a clause onto its end. One idea per sentence; one tight line in the right place beats a paragraph in three places. - Verify reach and behavior. Check that the failing workflow actually loads or fires the change. For enforcement, test a violating case and a legitimate exception. Record any untested limitation.
- Report briefly: correction applied; source and diagnosed gap; durable change and verification. No promises about future behavior; the changed file is the promise.
Preserve detailed records in their existing owner documents; add a short pointer rather than duplicating history. Follow the project's versioning, changelog, and size conventions. Use its designated durable store, not a new parallel memory system.
Do not create an unnecessary edit merely to claim prevention. If the existing rule is correct, address enforcement or the read path. For recurrence across entry points, strengthen the general failure family rather than adding a separate rule for each incident, and move it up a layer (prose -> colocated instruction -> hook or deny rule).
Restricted runtimes
Use the connected filesystem and re-check its reachable roots if needed. A shell in a container does not imply access to the user's machine.
If local configuration or hooks cannot be edited or tested, write a concrete proposal in the owning project's existing tracker: exact destination, trigger, rule text, exceptions, and acceptance checks. Mark implementation pending. If no durable write is possible, give the proposal and state the access blocker; never claim it is installed.