Mistake Memory Guardrails
Global guardrails for repository edit tasks.
Scope
Apply this skill to any repository edit task, including code, docs, tests, config, infra, and planning files.
Execution Order
- Read
AGENT_MISTAKES.md. If missing, create it using the required schema.
- Read target files and map applicable
scope_tags.
- Run guardrail checks before proposing or applying changes.
- Run a post-edit self-check against known mistake patterns before final response.
- Record every detected mistake occurrence.
Guardrail Checks
- Requirement fidelity and scope discipline:
- Change only what the user requested.
- Reject unrelated refactors and speculative additions.
- Cross-file consistency for shared facts/configs/interfaces:
- Keep shared names, paths, status values, and contracts aligned across touched files.
- Flag stale duplicated facts and mismatched defaults.
- Assertion quality:
- Replace vague claims with measurable criteria.
- Require explicit thresholds, formulas, or pass/fail conditions when asserting quality or correctness.
- Reproducibility metadata when claims depend on run conditions:
- For benchmark/performance/behavior claims, capture model/tool version, dataset revision, seed, environment, and run conditions when relevant.
- Separate deterministic correctness checks from environment-sensitive comparisons.
- Safety and regression checks:
- Verify edits do not silently break existing behavior.
- Call out potential regressions and missing validation coverage.
Mistake Recording Rules
- Record every detected mistake occurrence.
- Deduplicate by normalized
pattern + scope_tags + prevention_rule.
- Normalization: lowercase, trim whitespace, collapse repeated spaces.
- If a deduplicated entry exists:
- Increment
occurrence_count.
- Update
last_seen.
- Append new evidence (file:line and/or commit).
- If no matching entry exists:
- Append a new entry with all required fields from
AGENT_MISTAKES.md.
Enforcement Behavior
- If a known rule is violated, warn and revise the proposal before final response.
- Fix violations before finalizing whenever possible.
- If unresolved, explicitly report the risk and why it could not be fully resolved.
Output Contract
When reporting results, provide:
- What was checked.
- What was changed and why.
- Remaining risks or unresolved ambiguities.
- Whether
AGENT_MISTAKES.md was created or updated.
1---2name: mistake-memory-guardrails3description: Prevent repeated agent mistakes across code, docs, tests, and configs by enforcing repository mistake memory before edits and recording new failures.4---56# Mistake Memory Guardrails78Global guardrails for repository edit tasks.910## Scope1112Apply this skill to any repository edit task, including code, docs, tests, config, infra, and planning files.1314## Execution Order15161. Read `AGENT_MISTAKES.md`. If missing, create it using the required schema.172. Read target files and map applicable `scope_tags`.183. Run guardrail checks before proposing or applying changes.194. Run a post-edit self-check against known mistake patterns before final response.205. Record every detected mistake occurrence.2122## Guardrail Checks23241. Requirement fidelity and scope discipline:25- Change only what the user requested.26- Reject unrelated refactors and speculative additions.27282. Cross-file consistency for shared facts/configs/interfaces:29- Keep shared names, paths, status values, and contracts aligned across touched files.30- Flag stale duplicated facts and mismatched defaults.31323. Assertion quality:33- Replace vague claims with measurable criteria.34- Require explicit thresholds, formulas, or pass/fail conditions when asserting quality or correctness.35364. Reproducibility metadata when claims depend on run conditions:37- For benchmark/performance/behavior claims, capture model/tool version, dataset revision, seed, environment, and run conditions when relevant.38- Separate deterministic correctness checks from environment-sensitive comparisons.39405. Safety and regression checks:41- Verify edits do not silently break existing behavior.42- Call out potential regressions and missing validation coverage.4344## Mistake Recording Rules4546- Record every detected mistake occurrence.47- Deduplicate by normalized `pattern` + `scope_tags` + `prevention_rule`.48 - Normalization: lowercase, trim whitespace, collapse repeated spaces.49- If a deduplicated entry exists:50 - Increment `occurrence_count`.51 - Update `last_seen`.52 - Append new evidence (file:line and/or commit).53- If no matching entry exists:54 - Append a new entry with all required fields from `AGENT_MISTAKES.md`.5556## Enforcement Behavior5758- If a known rule is violated, warn and revise the proposal before final response.59- Fix violations before finalizing whenever possible.60- If unresolved, explicitly report the risk and why it could not be fully resolved.6162## Output Contract6364When reporting results, provide:65661. What was checked.672. What was changed and why.683. Remaining risks or unresolved ambiguities.694. Whether `AGENT_MISTAKES.md` was created or updated.