| name | mistake-memory-guardrails |
| description | Prevent repeated agent mistakes across code, docs, tests, and configs by enforcing repository mistake memory before edits and recording new failures. |
| user-invocable | true |
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.