mathews-tom/armory/immune
Claude Code and agent skill by mathews-tom/armory
- community
Checking that the SKILL.md file is still in the repository.
Hybrid adaptive memory: Cheatsheet (positive patterns pre-generation) and Immune (negative patterns post-generation) with Hot/Cold tiered auto-learning. Triggers on: "scan for errors", "immune scan", "check output quality", "antibody scan". NOT for PR review (use pr-review) or repo audits (use repo-sentinel).
Install
npx vskill@latest install mathews-tom/armory/immuneSKILL.md
Immune System v3 — Hybrid Cheatsheet + Immune
You operate a hybrid adaptive system with two complementary memories:
- Cheatsheet (positive patterns): domain-specific strategies injected BEFORE generation to improve output quality
- Immune (negative patterns): antibodies that detect known errors and discover new threats AFTER generation
Both memories use Hot/Cold tiering to keep context lean.
Input Parsing
The user invokes with content to scan. Parse these parameters:
- input: The text/code/content to scan (required — either inline or from context)
- domain: One of: fitness, code, writing, research, strategy, webdesign, \_global (default: auto-detect)
- domains: Array of domains (overrides single domain). Example:
domains=fitness,code - constraints: Any specific requirements the output should satisfy (optional)
- mode:
full(cheatsheet + scan, default) |scan-only(skip cheatsheet) |cheatsheet-only(return cheatsheet, no scan)
<examples> <example> /immune Check this function for common pitfalls → domains=["code"] (auto-detected), mode=full </example> <example> /immune domain=fitness Vérifie ce programme de musculation → domains=["fitness"] (explicit) </example> <example> /immune domains=fitness,code Check this workout generator API → domains=["fitness", "code"] (multi-domain) </example> <example> /immune → scans the most recent output in the conversation </example> </examples>
If no inline text is provided, scan the last substantive output in the conversation.
Domain auto-detection: Read config.yaml (co-located with this skill) and match content against domain_keywords. If no strong match, use ["_global"]. If single domain string provided, wrap in array: domains = [domain].
Task-Conditioned Retrieval (v3.1.0+)
Antibodies and cheatsheet strategies may carry an optional triggers field for per-task filtering. This implements the read phase of the Memento-Skills reflective loop (arXiv 2603.18743) — entries are ranked by lexical overlap between the current task and their historical contexts.
Schema (additive, optional):
Back-compat: entries without triggers behave as always-on (the v3.0.0 behavior). The task_conditioned_retrieval: true flag in config.yaml enables the filter. When disabled, all entries load regardless of task.
Ranking helper: scripts/retrieve.py implements the scoring logic. Callers (including the scanner agent, the skill-librarian in P2, and the skill-router in P3) invoke retrieve(prompt, entries, active_domains, historical_success) to obtain the ranked subset before tier classification. Scoring uses Jaccard similarity over normalized task signatures from scripts/task_signature.py, multiplied by an optional per-entry success rate derived from evals/history.jsonl.
During load (Phase 0 cheatsheet, Phase 1 antibodies), after the domain filter and before Hot/Cold tier classification, apply the retrieve step:
- Compute
task_signature(prompt)for the current task. - Pass entries through
retrieve(...)with the active domains set. - Feed only the returned subset into the tier classification below.
Entries filtered out at retrieval never reach Hot/Cold — this is what keeps the scan context lean and task-focused.
Execution
Step 0 — Cheatsheet Injection (positive patterns)
Skip this step if mode == "scan-only".
0a. Load cheatsheet: Read cheatsheet_memory.json (co-located with this skill).
0b. Filter by domains: Keep strategies where ANY of the strategy's domains overlaps with the detected domains, OR strategy has "_global" in its domains.
0c. Classify into tiers (same logic as antibodies): A strategy is HOT if ANY of:
effectiveness >= 0.7seen_count >= 3last_seenless than 30 days ago
Everything else is COLD.
0d. Cap HOT strategies: Sort by effectiveness descending, then seen_count descending. Keep max 15 (from config.yaml → cheatsheet.max_hot).
0e. Build cheatsheet block: Format HOT strategies as XML:
If there are COLD strategies, add a one-liner:
If mode == "cheatsheet-only", output the cheatsheet block and stop here.
Log:
0f. Present cheatsheet to user: If running standalone (/immune), show the cheatsheet as context the user should apply to their next generation. If called by another system, return the XML block for injection into prompts.
Step 1 — Load & Classify Antibodies (Hot/Cold)
Read immune_memory.json and config.yaml (co-located with this skill).
1a. Filter by domains: Keep antibodies where ANY of the antibody's domains overlaps with detected domains, OR antibody has "_global" in its domains.
Backwards compatibility: If an antibody has "domain" (string) instead of "domains" (array), treat it as domains = [domain].
1b. Classify into tiers: For each filtered antibody, classify as HOT if any of these is true:
severity == "critical"seen_count >= 3last_seenis less than 30 days ago (relative to today's date)
Everything else is COLD.
1c. Cap HOT antibodies: Sort HOT by: severity (critical > warning > info), then seen_count descending. Keep max 15 (from config.yaml → tiers.hot.max_per_scan). If more than 15 qualify as HOT, overflow goes to COLD.
1d. Build COLD summary: For each COLD antibody, extract a short keyword from its pattern field. Join as comma-separated list. Example: "SQL transactions, épicondylite, debug flags, tautologies"
Log:
Step 2 — Scan
Spawn the immune-scan agent (Haiku) with the following XML-structured prompt:
Log: [IMMUNE] Scanning... ({n_hot} active antibodies) Wait for result.
If corrections applied: Log: [IMMUNE] Match {antibody_id}: {original} → {corrected} If new threats detected: Log: [IMMUNE] New threat: {pattern} If new strategies detected: Log: [IMMUNE] New strategy: {pattern}
Step 3 — Update Immune Memory (with COLD deduplication)
Read current immune_memory.json.
3a. Matched HOT antibodies: For each antibody matched by the scanner, increment seen_count and update last_seen to today.
3b. New threats — deduplicate against COLD: For each new threat in new_threats_detected:
- Compare its
patternagainst ALL COLD antibodies (fuzzy match — same domains + similar keywords). - If it matches a COLD antibody → REACTIVATE:
- Increment the COLD antibody's
seen_count - Update its
last_seento today - Log:
[IMMUNE] Reactivated COLD antibody {id}: {pattern} - Do NOT create a new antibody (prevents duplicates)
- If no COLD match AND
auto_add_threatsis true → CREATE new antibody:
- id: "AB-{next_number}"
- domains: from the threat's
recommended_antibody.domains(array) - pattern, severity, correction: from the threat's
recommended_antibody - seen_count: 1
- first_seen: today's date
- last_seen: today's date
- Log:
[IMMUNE] + New antibody {id}: {pattern}
3c. Update stats:
- Increment
stats.outputs_checked - Increment
stats.issues_caughtby number of corrections + new threats - Update
stats.antibodies_totalto current antibody count
Write back to immune_memory.json.
Log: [IMMUNE] Memory: {total} antibodies ({n_hot} hot, {n_cold} cold) | +{new} added | Reactivated: {reactivated}
Step 3b — Update Cheatsheet Memory (positive patterns)
Skip if mode == "scan-only" or no new_strategies_detected in scan result.
Read current cheatsheet_memory.json.
3b-i. Deduplicate: For each new strategy in new_strategies_detected:
- Compare against ALL existing strategies (fuzzy match — overlapping domains + similar pattern).
- If it matches an existing strategy → REINFORCE:
- Increment
seen_count - Update
last_seento today - Adjust
effectiveness:new_eff = old_eff * 0.8 + reported_eff * 0.2(exponential moving average) - Log:
[IMMUNE] Reinforced strategy {id}: {pattern} (eff: {old}→{new})
- If no match AND
auto_add_strategiesis true → CREATE new strategy:
- id: "{prefix}-{next_number}" (prefix from
config.yaml→cheatsheet.id_prefix.{domain}) - domains: from the strategy (array)
- pattern, example: from the strategy
- effectiveness: from the strategy (or
config.yaml→cheatsheet.default_effectiveness) - seen_count: 1
- first_seen: today's date
- last_seen: today's date
- Log:
[IMMUNE] + New strategy {id}: {pattern}
3b-ii. Prune low-effectiveness: If any strategy has effectiveness < config.cheatsheet.min_effectiveness AND seen_count >= 5:
- Remove it
- Log:
[IMMUNE] - Pruned strategy {id}: {pattern} (eff: {eff})
3b-iii. Update stats:
- Increment
stats.outputs_assisted - Increment
stats.strategies_appliedby number of cheatsheet strategies that were used - Update
stats.strategies_totalto current count
Write back to cheatsheet_memory.json.
Log: [IMMUNE] Cheatsheet: {total} strategies | +{new} added | Reinforced: {reinforced}
Step 4 — Output
If clean:
If corrections or threats found:
Then present the corrected output in a human-readable format appropriate to the domain.
Error Handling
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/immune/SKILL.md
Popularity
- Repository stars
- 327
- Repository forks
- 51
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mathews-tom/armory/immune)