Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Agent Immune System governance skill for maintaining long-term agent instruction health. Also trigger this when the user says "agent immune system" or "instruction health manager." Use before editing AGENTS.md, CLAUDE.md, global/project instructions, or SKILL.md files; after Hermes/review/postmortem findings; after long or failed sessions with instruction confusion; and when rules feel duplicated, bloated, stale, conflicting, autoimmune, or overfit. Produces promotion, demotion, pruning, regener
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 53% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 52% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 11% | 0% |
<what-to-do>
Maintain long-term instruction health. Treat AGENTS.md, CLAUDE.md, project instructions, skills, memory reports, issue reports, Hermes findings, and postmortems as inputs to the Agent Immune System.
Do not convert every mistake into a permanent rule. A mistake is an antigen, not automatic memory.
When invoked, produce a concrete instruction-health decision:
knowledge/incidents/, reports, issue history, review history, or prior instruction changes.Ask one question at a time only when the answer materially changes the decision and cannot be discovered from local files.
</what-to-do>
<supporting-info>
This skill is the immune system above task execution:
textPrimary Agent -> Project Agent -> Skills -> Execution Instruction Health Manager -> monitors all layers -> governs instruction memory -> proposes optimized instruction artifacts
Active instructions are the execution contract. This skill governs proposed changes to that contract so AGENTS.md, CLAUDE.md, and SKILL.md files remain the optimized expression of lessons that survived selection pressure.
Inspect only the sources needed for the current review:
AGENTS.md, CLAUDE.md, .codex/AGENTS.md, .claude/CLAUDE.mdskills/*/SKILL.md_reports/, docs/reports/, docs/postmortems/, issue reportsknowledge/ folders inside this skillNever harvest credentials, transcripts, shell history, keychain, or private tokens to reconstruct evidence.
State:
Reject active promotion quickly when any are true:
Promote slowly. Require evidence of recurrence, severity, and generality.
Default threshold:
| Signal | Action | |---|---| | 1 low/medium issue | Log only | | 2 similar issues | Watchlist | | 3 similar issues | Reference antibody candidate | | 4+ similar issues | Direct inclusion candidate | | 1 critical general issue | Immediate reference candidate; direct inclusion only with explicit unacceptable-delay risk | | Old rule with no recent hits | Prune or demote candidate |
Find instructions that create more problems than they solve:
Prefer cleaner principles over accumulated scars. Ask:
> Can five instructions be replaced by one higher-level principle?
Regeneration proposals should list the old rule cluster, the new principle, behavior preserved, behavior intentionally removed, and risks.
Choose the smallest sufficient destination:
knowledge/watchlists/ with promotion/demotion criteriaknowledge/incidents/ with "do not revisit unless pattern recurs"knowledge/reference-antibodies/Use gbrain as memory backend when available. gbrain remembers; this skill judges.
For narrow reviews, use quick-review mode:
Use templates/instruction-health-report.md as drafting scaffolding for broad audits and templates/promotion-proposal.md for active instruction changes.
For deep instruction audits, session reviews, postmortems, or architecture-style comparisons, write the final artifact as a single self-contained HTML file in the current project's _reports/ directory:
text_reports/report-instruction-health-YYYY-MM-DD.html
No external CDNs. Use the markdown template only to structure content before rendering the HTML report.
Every broad audit report must include:
Do not apply active instruction edits unless David explicitly asks in the current conversation.
Hook scripts live in hooks/:
claude-instruction-pretool-hook.sh: detects edits to active instruction files and emits a promotion-gate reminder.claude-instruction-posttool-hook.sh: logs instruction edits as audit candidates.codex-instruction-hook.sh: adapter script for Codex/manual invocation because Codex does not expose Claude-style native hook settings in this environment.See references/hook-integration.md before installing or changing hooks.
references/promotion-rubric.md: when deciding whether a lesson becomes active instruction memory.references/autoimmune-rubric.md: when evaluating harmful, conflicting, bloated, or overfit rules.references/regeneration-rubric.md: when compressing many rules into fewer principles.references/hook-integration.md: Claude/Codex hook wiring and trigger guidance.references/subagent-prompts.md: prompts for independent reviewers once the main skill framework exists.</supporting-info>
Other measured skills in the registry, with their headline benchmark lift.