Use before every commit touching C# or XML/XSLT, repo or live install; skip only config and docs. Risk-tiered senior reviewers report defects; a second wave follows a CRITICAL or HIGH.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Deep Review?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/haterade22-deep-review)
---
name: deep-review
description: "Use before every commit touching C# or XML/XSLT, repo or live install; skip only config and docs. Risk-tiered senior reviewers report defects; a second wave follows a CRITICAL or HIGH."
argument-hint: "[feature-name]"
---
# Deep Review
Scale the review to the risk of the change (Step 2 "Risk tier", Mike 2026-10-22): the tier picks the lenses and the Codex effort, and a second wave runs only when the first finds a HIGH or CRITICAL. Within a tier there is no limit on agents, at most four at a time (Step 2 "Waves of four").
Run this AFTER completing a feature or fix, BEFORE closing out.
**While lenses run, act only on findings that change runtime behaviour:** editing a file an agent is reading invalidates its report. The one exception is a violation your own change introduced. The tell that you are about to break this is writing "this is polish, not a fix" and continuing anyway.
**Every reviewer is the most senior role available** (Mike, 2026-09-18). Every lens runs as `subagent_type: deep-reviewer` (`.claude/agents/deep-reviewer.md`: Opus 5.5, `claude-opus-5-5`, read-only). **Never pass `model` on these Agent calls:** a per-invocation `model` overrides the definition's (`.claude/rules/harness-skills-agents.md`), which would quietly downgrade the reviewer. **Never pass `effort` either:** every lens runs at the session's effort level (Mike, 2026-11-18).
**The review does not stop at a report.** Two lenses (Agent 3 Efficiency, Agent 6 Design & Elegance) propose better ways to do what the change does; Step 4 applies them. The reviewers stay read-only; the orchestrator applies, after every lens has reported. When neither lens ran, Step 4 is N/A and the report says so.
The feature or area to review: `$ARGUMENTS` (if empty, review all uncommitted changes).
## Step 0: Codex Independent Pre-Review
**Trigger when:** the Step 2 risk tier is 1 or 2, or `$ARGUMENTS` contains `--codex` (strip `--codex` from the feature name before proceeding). Codex costs no Claude usage and, on 2026-10-22, found the B3 defects that seven Claude lenses missed. Tier 1 runs it under Mike's standing word (2026-11-03); a skipped pass is named in the report as owed before merge. Tier 2 asks once per session; without a yes, report `CODEX: NOT AUTHORIZED` and name the pass as owed before merge. `--codex` is the user's word for that run.
If triggered:
1. Identify changed files (same logic as Step 1 below).
2. **Dispatch Codex directly via Bash** -- Claude does this itself, no terminal hand-off:
- Pre-flight: `codex login status` -- expect `Logged in using ChatGPT`. If not, surface the message and continue WITHOUT the Codex pre-review (don't block the Claude agents).
- Write a focused prompt to `docs/reviews/codex-prereview-{feature}-{date}.prompt.md` (short version of the `/review-codex` prompt -- focus on Known Suspects + architectural risks; skip the heavy vanilla-decompile block).
- Run via Bash:
```
command: cd "<repo-root>" && mkdir -p docs/reviews/raw && codex exec -c model_reasoning_effort="<level>" -c project_doc_max_bytes=65536 - < "docs/reviews/codex-prereview-{feature}-{date}.prompt.md" > "docs/reviews/raw/codex-prereview-{feature}-{date}.md" 2>&1
run_in_background: true
timeout: 7200000 (an unattended run stops a background command at its timeout, 2 h at most)
```
- `<level>` defaults to the one the Step 2 tier table gives; the session may lower it and says why in the dispatch line. The shorter prompt shortens the run, not the level.
- See `.claude/skills/review-codex/SKILL.md` "Codex CLI invocation contract" for full dispatch semantics.
3. Continue to Step 1 immediately; do NOT wait for Codex here. The Claude agents run in parallel with the Codex background job.
4. After all Claude agents complete (Step 2), check if the Codex background job has notified. If yes, read `docs/reviews/raw/codex-prereview-{feature}-{date}.md`. If not yet (Claude agents finish faster on this kind of work), Codex result will arrive later -- proceed with Step 3 using just the Claude agent results and append Codex when it arrives.
5. Include Codex findings in the Step 3 compiled report as its own section:
```
CODEX REVIEW: [PASS/ISSUES — N findings]
[Codex findings grouped by severity]
```
If Codex and any Claude agent disagree on a finding, flag the disagreement explicitly — it is valuable signal.
At tier 3 without `--codex`, skip this step entirely.
## Step 1: Identify Scope
Determine what to review:
- If `$ARGUMENTS` is provided, focus on that feature/area
- Otherwise, use `git diff --name-only` and `git ls-files --others --exclude-standard` to find all changed/new files
- **Add every live `TAOM_Map` or `LOTRLOME_Armory` file changed since the last review.** They are unversioned, so git cannot list them, and a live edit missing from the list is an edit nobody reviews, including one a script made in an earlier session. Before launching anything, take the time of the last review OF THIS CHANGE (its RCA or report date), else the start of the work in scope. **Not** the last `agent_type=deep-reviewer` line in `.claude/logs/agent-audit.log` on its own: every session writes to that log, so its latest line can be another session's review of other files (2026-09-18: using it would have dropped a session's whole morning of live edits). Then run `find "<game>/Modules/TAOM_Map/ModuleData" "<game>/Modules/LOTRLOME_Armory/ModuleData" "<game>/Modules/LOTRLOME_Armory/SubModule.xml" "<game>/Modules/TAOM_Map/SubModule.xml" "<game>/Modules/TAOM_Map/Assets" "<game>/Modules/LOTRLOME_Armory/Assets" -type f -newermt "<that time>" ! -name "*.bak*"`. Include each file with its absolute path, or name it NOT IN SCOPE in the report; never drop one. Concurrent sessions edit the same live modules, so attribute each file (this change's, or another session's and out of scope) before it goes to a lens. **Binary packages** (`Assets/**/*.tpac`) are in scope too, though no lens reads their bytes: list each with the tool or Kit step that wrote it and its backup, and give the writing script to the Tooling lens.
**Map the blast radius from the code graph (mandatory when C# or a script is in scope, #677).** Start `python tools/graphify_taom.py refresh --if-stale` in the background as soon as the scope is known (about 2.5 minutes when stale; it extracts the working tree, so the change under review is in the graph). Then, for every public type, interface or member the change adds, renames, re-signs or alters in behaviour, run `python tools/graphify_taom.py affected "<Type>" --depth 2`. Each consumer it names that is not in the changed-file list is a caller outside the diff: pass those to Agents 4 and 5 in SCOPE NOTES, and read a few yourself before launching. graphify reads no XML or XSLT, so an XML-only change skips this step. Exit 3 means graphify is missing on this machine: write BLAST RADIUS: UNCHECKED in the report and do not install it.
Collect the list of changed files for the agents, split into **C# / C++**; **XML / XSLT** (ModuleData, stylesheets, GUI prefabs, `SubModule.xml`, `project.mbproj`, language files, repo and live); **scripts** (`tools/**`, `.claude/hooks/**`); **harness** (`.claude/**`, `CLAUDE.md`, `AGENTS.md`, `.ai/**`); and **docs**. The split decides which lenses launch in Step 2. A module's `SubModule.xml` sits at its root, outside `ModuleData/`, which is why the sweep above names both (#619's edit to TAOM_Map's was invisible to a `ModuleData`-only sweep).
## Step 2: Launch the Review Lenses
Each lens is a prompt file under `lenses/` (next to this file) that the reviewer reads itself, so the orchestrator never pastes one. Every lens, the Step 2b agent and every Step 2c expansion launches as `subagent_type: deep-reviewer`, never with a `model` parameter.
**XML is code** (Mike, 2026-09-18). One wrong attribute spawns a naked troop, hangs a battle load or kills a dedicated server, and the engine reports almost none of it, so XML gets the same review as C#.
### Risk tier (decide first)
Pick the highest tier any file in scope reaches, and say the tier and why in one line before launching.
| Tier | The change touches | Codex (Step 0) | Claude lenses, one wave |
|---|---|---|---|
| 1 | A Harmony patch, a GameModel, save data or a save definer, co-op authority or sync, DI timing or composition, native or engine calls, a mission or campaign tick, live `TAOM_Map` or Armory data | `ultra` | 5 Data flow, 2 Engine compatibility, plus 7 XML for XML and Tooling for scripts |
| 2 | Moves between assemblies, build and deploy targets, release tooling, gates and tests, UI that reads game state, plain C# and repo XML or XSLT that no tier 1 row names | `xhigh` | 5 Data flow, plus 7 XML for XML and Tooling for scripts |
| 3 | Docs, comments, harness text only | none | none: `python tools/lint_docs.py --fail-on-drift` and a read |
**Second wave:** only when the first wave or Codex reports a CRITICAL or HIGH. It runs the remaining lenses in scope from the table below on the files involved, with those findings in SCOPE NOTES. A finding at MEDIUM or below is fixed and verified with tests, not re-reviewed. Lens 1 Standards, 3 Efficiency, 4 Completeness and 6 Design run only in a second wave or when Mike asks for a full review: on 2026-10-22 they found mostly naming, citation and comment items that the fix pass and `/verify` catch. Step 3e says which confirmed findings need an RCA file.
### Which lenses run (their domains)
Decide from the Step 1 split, within the tier above. A lens in scope that the tier does not launch is reported SKIPPED BY TIER in Step 3, never dropped silently.
| Agent | Lens file | Runs when |
|---|---|---|
| 1 Standards | `lenses/1-standards.md` | C# or C++ in scope, or harness files (`.claude/**`, `CLAUDE.md`, `AGENTS.md`, `.ai/**`) |
| 2 Engine compatibility | `lenses/2-engine-compat.md` | C# or C++ in scope, or changed text or tooling that states engine behaviour |
| 3 Efficiency | `lenses/3-efficiency.md` | C# or C++ in scope, or a script under `tools/` or `.claude/hooks/` |
| 4 Completeness | `lenses/4-completeness.md` | always |
| 5 Data flow | `lenses/5-data-flow.md` | always; historically the most productive lens (no per-lens yield is measured yet) |
| 6 Design & Elegance | `lenses/6-design.md` | always |
| 7 XML & ModuleData | `lenses/7-xml.md` | any XML or XSLT in scope, repo or live install |
| Tooling correctness | `lenses/tooling.md` | any script under `tools/` or `.claude/hooks/`, read-only ones included |
### Waves of four
**At most four agents in flight.** Launch a wave, let every agent in it report, then launch the next. A subagent that hits the usage limit returns nothing, so a wave boundary caps what a limit can cost ([agent-teams.md](../../../docs/ai-includes/agent-teams.md) "Budget"; on 2026-09-18 a six-wide review lost three agents that way). Fill the first wave with the tier's lenses; a second wave, when the tier rule calls for one, takes the others in order. A later wave's prompts may carry the earlier waves' CRITICAL and HIGH findings, so the design lens does not polish code about to be restructured. There is no limit on the total, only on what is in flight.
### The spawn prompt
```
Lens: Agent <N> <name>. Read .claude/skills/deep-review/lenses/<file> first; it is your whole task and its output format.
FILES: <the Step 1 list for this lens; absolute paths for live-install files>
SCOPE NOTES: <the change's intent; in shared files, which hunks are this change's; for Agents 4 and 5 the Step 1 callers outside the diff; earlier waves' CRITICAL/HIGH findings>
```
Add only what the lens cannot know. The agent definition already carries the operating-manual briefing and the read-only rules.
**Brief with decisions and facts you read, never your own conclusions stated as facts.** Every lens, and Codex, inherits the premise in the brief, and a false one (an unchecked "nothing else changes") comes back repeated. Under "Deliberate choices" list only what the maintainer decided; put your own readings of the code in SCOPE NOTES as questions. When two lenses disagree on an engine or data fact, read the source yourself before you write either claim into code or a doc ([RCA](../../../docs/reviews/rca-arnor-elite-troops-2026-11-06.md) F8).
**Triage ordering, spec before quality** (`docs/ai-includes/agent-teams.md` "Subagent review ordering"): resolve Agent 1, 2, 5 and 7 findings before acting on Agent 3 and 6 proposals. A standards violation can make quality feedback moot; don't optimise code that is about to be restructured.
## Step 2b: Adversarial Escalation (conditional)
**Only if Agent 1 reports a CRITICAL violation:** direct TaleWorlds sealed-type usage in a service class (ADR-007 breach), a Harmony patch that touches game state without an adapter, or an entry point over 150 lines that does business logic itself. Launch one additional `deep-reviewer` on only the offending files with `lenses/adversarial.md`.
## Step 2c: Adaptive Expansion (always evaluate)
After the core agents complete, assess whether the findings warrant additional focused agents. Every additional agent is a `deep-reviewer` too, launched in waves of four like the core set. Before spawning one, ask whether an existing gate script answers its question: a deterministic check run once beats an agent re-deriving it ([agent-teams.md](../../../docs/ai-includes/agent-teams.md) "Budget").
**Launch additional agents when:**
- Agent 5 (Data Flow) finds gaps → launch per-gap investigation agents to trace the full chain and propose fixes
- Multiple XML config files changed → launch one agent per config file to cross-reference all consumers
- Multiple Harmony patches changed → launch one agent per patch to verify target method signatures and side effects
- Multiple GameModel overrides changed → launch one agent to verify all overrides are registered and don't conflict
- Any agent reports >3 issues → launch a focused agent on just those files to determine root cause
- Feature spans >3 features/ subdirectories → launch per-feature agents with full context of that feature
- The change adds a mission type or a new agent spawn path → launch one agent (Lens 2 method) on every TAOM behavior and `[DefaultView]` that attaches to all missions, judged in the new context (no main agent, no team AI, late spawns, no campaign); per-file lenses cannot see this (Fords of War: a pre-existing warg formation bug became the normal path, `rca-fords-of-war-2026-10-31.md` D4)
(Script tooling is no longer an expansion: the Tooling correctness lens in Step 2 covers every script under `tools/` or `.claude/hooks/`, read-only ones included.)
**When a Claude agent and Codex disagree:** re-read the code first. Offer a focused Codex pass only if that leaves it open; it runs on Mike's word.
**The review is done when:** All agents have reported, all disagreements are resolved, no agent's findings suggest an unexplored area, and Step 4 has applied or accounted for every proposal.
## Step 3: Compile Report
After every launched agent completes, compile their results into a single report. Mark a lens that does not apply to the change as NOT IN SCOPE, and a lens the tier skipped as SKIPPED BY TIER. The three IMPROVEMENTS lists and the VERDICT are filled in by Step 4:
```
DEEP REVIEW REPORT
===================
Feature: [name or "uncommitted changes"]
Date: [today]
Scope: [C#/C++, XML/XSLT, scripts, harness, docs; live files swept since <time>]
Blast radius: [N types checked with graphify affected, M callers outside the diff / UNCHECKED (why) / NOT IN SCOPE (XML only)]
Waves: [which agents ran in which wave]
STANDARDS: [PASS/FAIL — N violations / NOT IN SCOPE / SKIPPED BY TIER]
COMPATIBILITY: [PASS/FAIL — N incompatible, N unverified / NOT IN SCOPE / SKIPPED BY TIER]
EFFICIENCY: [PASS/FAIL — N issues (H high, M medium, L low) / NOT IN SCOPE / SKIPPED BY TIER]
COMPLETENESS: [COMPLETE/INCOMPLETE — list missing items / SKIPPED BY TIER]
DATA FLOW: [PASS/FAIL — N gaps, N inconsistencies / SKIPPED BY TIER]
DESIGN: [N KEEP proposals (A apply, F follow-up) / ALREADY OPTIMAL / SKIPPED BY TIER]
XML: [PASS/FAIL — G gates (F failed, X not run), N findings / NOT IN SCOPE / SKIPPED BY TIER]
TOOLING: [PASS/FAIL — N findings / NOT IN SCOPE / SKIPPED BY TIER]
─────────────────────────
DETAILS
─────────────────────────
[Agent 1 results — Standards]
[Agent 2 results — Compatibility]
[Agent 3 results — Efficiency]
[Agent 4 results — Completeness]
[Agent 5 results — Data Flow]
[Agent 6 results — Design & Elegance]
[Agent 7 results — XML & ModuleData Integrity, incl. OWED in-game checks]
[Tooling correctness results]
─────────────────────────
ACTION ITEMS
─────────────────────────
1. [Most critical issue first]
2. ...
─────────────────────────
IMPROVEMENTS (Step 4)
─────────────────────────
APPLIED: [file:line, what changed, the test that proves it]
NOT APPLIED: [file:line, one-line reason each]
FOLLOW-UP: [pre-existing code outside the change; its issue number, or why none is filed]
VERDICT: READY FOR COMMIT / NEEDS FIXES
```
## Step 3e: Root Cause Analysis (a blocking gate before commit, for the findings named here)
Write an RCA file when a confirmed finding (from any agent, or from the Codex pre-review if Step 0 ran) is CRITICAL or HIGH (Agent 7's CRITICAL and a Codex P1 count), reached a player, or repeats a cause already recorded (grep `docs/reviews/rca-*.md` and `docs/reviews/lessons/`). Every other confirmed finding, MEDIUM or LOW, is fixed and proved by its tests and needs no RCA file; when it shows a systemic pattern it still gets its lessons entry below. The goal is to make the same category of bug impossible in future features.
The recurring failure is patching a symptom and never extracting the systemic lesson, so the same category of bug ships again. Severity decides whether an RCA file is written, never whether the lesson is recorded.
**For each finding that needs an RCA file:**
**First, confirm it is actually confirmed.** Per `.claude/rules/evidence-over-claims.md`, a finding is "confirmed" only if you (or the agent) re-read the actual TAOM source / decompiled vanilla and verified the bug exists — not because an agent reported it confidently. If you took an agent's finding on faith, re-read the code now; an unverified finding is re-flagged for investigation, not entered into RCA.
1. Write the finding text + severity.
2. **Why missed:** what assumption, scope gap, or pattern blindness let it through? Be specific — name the rule that should have caught it, name the file/line that exhibits the pattern.
3. **Preventive action:** generalizable rule, or scope extension to an existing rule? Or one-off?
4. If the pattern has shipped before (grep `docs/reviews/rca-*.md` for it), call that out: repeat-offender bugs need stronger preventive action than first-time bugs.
**Write the result to `docs/reviews/rca-<feature>-<YYYY-MM-DD>.md`** following the format of `docs/reviews/rca-quickactions-2026-05-06.md` or `docs/reviews/rca-scene-scripts-cs-road-2026-05-13.md`:
- Top-line summary
- Findings table: # | Sev | Bug | Category | Why Missed | Preventive Action
- Root-cause pattern section (if 2+ findings share a theme)
- "Why each agent missed these" section: for each deep-review agent that ran and didn't catch the finding, state why their rule set didn't apply or why the agent's scope was too narrow
- "Feedback memories to codify" section — only if there's a genuine systemic pattern; don't manufacture rules
**Append the durable lesson to the master record.** For each systemic finding, also add an entry to the matching category file under `docs/reviews/lessons/` (e.g. `lessons/gamemodels-services.md`, `lessons/harmony-il.md`; index: `docs/reviews/LESSONS-LEARNED.md`), in the house shape (`### <imperative rule>` → `**Why missed:**` → `**Prevent:**` → `**Source:**`). The per-feature `rca-*.md` is the incident report; the lessons entry is the cross-feature rule that stops the *category* from recurring: it is the canonical, always-consulted record. Read the relevant category FILE before the next review of that subsystem (per-category files keep the read cheap). Only touch `MEMORY.md` if a new feature/topic memory file is involved.
**A deferred finding needs an owner.** Every uppercase `FOLLOW-UP` line you write in an RCA cites an issue (`#<number>`) or says `no issue:` and why; `python tools/lint_docs.py --fail-on-drift` fails on a new line that does neither (#984), and the commit hook runs the same check on the staged RCA. To mention the marker in passing, put it in backticks (`` `FOLLOW-UP` ``); an issue number in backticks does not count as a citation.
**When an RCA file is required, it MUST exist BEFORE the closing commit.** The commit message should reference its path.
If the RCA reveals a rule that's already documented but wasn't followed (scope gap or agent prompt missing the rule), update the rule file or agent prompt in a follow-up commit. Commit graph: review → fixes → RCA → preventive-rule update.
## Step 4: Apply improvements
A better way that the review found and left in a report is a better way nobody gets. When Agent 6 returns a KEEP proposal or Agent 3 an APPLY-scoped fix for the changed code (together, "proposals" below), the orchestrator applies it in this session. The reviewers never edit; you do.
1. **After every lens, defects first.** Start only when all agents (Step 2b and 2c included) have reported: editing a file an agent is still reading invalidates its report. Resolve Agent 1, 2, 5 and 7 findings before any improvement, per the Step 2 triage order.
2. **Changed code only** (Mike, 2026-09-18). A FOLLOW-UP proposal (pre-existing code the change did not modify) is never applied here; list it with its issue number, or with the reason none is filed.
3. **Re-verify, then apply or account.** Re-read the source behind each proposal before applying it (`.claude/rules/evidence-over-claims.md` §A). Every proposal not applied goes under NOT APPLIED with its reason: disproved, breaks an ADR, a single-owner file (`IoC.cs`, `SubModule.cs`) held by another session, or Mike declined. No silent skips.
4. **Behaviour-changing proposals: ask once.** Put every CHANGING proposal in one `AskUserQuestion` batch before applying any; PRESERVING ones need no question.
5. **Tests prove it.** The suite is green before you start. PRESERVING: an existing or new characterisation test, green before and after. CHANGING: its RED test first. Run at the `.claude/rules/evidence-over-claims.md` §B cadence and quote the final full suite. For XML, re-run `python tools/data_gates.py` for what you touched and the shipped-data tests Agent 7 named; edit XML per `tools/README.md` "XML I/O convention", never with `sed -i` on a CRLF file.
6. **One convergence pass, then stop.** Launch a single `deep-reviewer` on the diff of the applied improvements, checking standards and behaviour parity. Defects it finds go to the fix loop below; it may NOT open a new design round, which keeps the loop finite.
7. **Review-only assignments skip this step.** Under a `.ai` review packet or any review-only request, the no-fix boundary in `.ai/roles/reviewer.md` wins: report the proposals, apply nothing.
Then fill in the IMPROVEMENTS lists and the VERDICT in the Step 3 report. READY FOR COMMIT requires Step 4 complete and the final full suite green.
## Important
- The review agents are READ-ONLY; they never edit. Code changes happen only in Step 4 (improvements) and the fix loop below (defects), both done by the orchestrator.
- If any agent fails to launch (MCP issues, etc.), note it in the report and run the checks manually.
- Engine signatures and behaviour come from the installed DLLs (`pwsh tools/taom-src.ps1 path <Type>` or ilspycmd). The dump at E:\Decompiled_Bannerlord\ can lag an engine bump; use it to browse, never as the authority.
- Agent 5 (Data Flow) has historically been the most productive lens (no per-lens yield is measured yet).
- If the verdict is NEEDS FIXES, list the fixes needed in priority order.
## HIGH findings: no silent deferrals
If any agent reports a HIGH-severity finding (Agent 7's CRITICAL counts, as does a Codex P1):
1. The default action is FIX. Implement the fix in the same session.
2. If the user explicitly chooses to defer, the deferral MUST be recorded in one of:
- A GitHub issue (`gh issue create`) with the finding text
- A commit trailer `Deferred: <reason>` on the commit that would have fixed it
- A `Known limitation:` paragraph in the commit body (it becomes the release's CHANGELOG entry)
What is NOT allowed: quietly proceeding past a HIGH finding on informal reasoning ("only matters in case X") without writing the decision down.
## Fix-loop guidance
When the verdict is NEEDS FIXES and the user chooses to address findings now:
- If a finding is structural (root cause unclear, multiple symptoms in one area), invoke **`/investigate`** instead of fixing directly — its 6-phase workflow auto-engages `/freeze` and enforces the Iron Law.
- **Verify each fix at the OUTERMOST gate, not just the layer you edited.** When a fix makes a method's behavior unconditional (or changes its guard semantics), grep every CALLER of that method for early-outs that re-condition it before marking the finding fixed, and note that layer-local regression tests cannot see caller-level gates.
- After fixes land, re-review the fix diff only when it fixed a CRITICAL or HIGH, or changed runtime behaviour in a tier 1 area: one Codex pass at `high` plus the lens that found it. Fixes for MEDIUM and lower are proven by their tests and `/verify`.