Implementation Review
Overview
Review a completed implementation as a whole — not commit by commit. The reviewer reads the design, the plan, every task file in scope, the scratchpad evidence (including any per-task review.yaml reports), and selectively reads the current state of the codebase.
The review runs at one of two scopes, selected by the scope parameter:
scope |
Covers |
Runs when |
Purpose |
step |
One step's tasks and commits |
After the last task of a step is approved, before advancing |
Catch cross-task drift within a step while it is still cheap to fix |
plan (default) |
Every step in the plan |
After the last task of the last step |
Catch drift that spans steps, and residue the per-step passes missed |
The two are complementary, not alternatives. Running per-step reviews does not remove the value of a final plan-scoped pass, but it should make it quieter: a plan-scoped review MUST treat existing per-step reports as input (see step 5) rather than re-deriving findings already remediated.
It produces:
- A structured YAML report (
{report_path}; schema in report-schema.md).
- A set of follow-on remediation
.code-task.md files addressing findings that warrant code changes — placed so the existing task-to-code flow picks them up (placement differs by scope; see step 8).
- At
plan scope only, an appended remediation step in the implementation plan.
The skill is single-pass: read inputs, analyse, emit artifacts, exit. It does not iterate, does not modify the existing code, and does not run task-to-code itself. It is intended to run with a highly capable model (Opus-class), since the analysis is wide-scope and judgement-heavy — and, when driven by an orchestrator, in a fresh session, since context independence is the whole point of a review that is meant to catch what the per-task reviewer could not.
Parameters
- agents_dir (optional, default:
.agents): Base directory for structured-spec-to-code artifacts
- project_dir (required): Project directory containing the design and plan (e.g.,
{agents_dir}/planning/{project_name})
- scope (optional, default:
plan): plan to review every step, or step to review a single completed step
- step (required iff
scope: step): The step number to review, e.g. 1. Zero-padded step{NN} directory naming is used on disk regardless of how it is passed
- plan_path (optional, default:
{project_dir}/implementation/plan.md): Path to the implementation plan
- report_path (optional): Where to write the YAML report. Defaults to
{project_dir}/implementation/review.yaml at plan scope, and {project_dir}/implementation/review-step{NN}.yaml at step scope — a step-scoped review MUST NOT overwrite the plan-scoped report or another step's
- remediation_step_dir (optional): Where to put generated remediation tasks. Defaults differ by scope:
plan: {agents_dir}/tasks/{project_name}/step{NN}/, where NN is the next available step number after the highest existing step folder
step: the reviewed step's own directory, {agents_dir}/tasks/{project_name}/step{NN}/ — remediation tasks are appended to that step as additional tasks, continuing its task-{MM}- numbering
- prior_step_reports (optional,
plan scope only): Paths to step-scoped reports already produced for this plan. Defaults to any {project_dir}/implementation/review-step*.yaml found
Constraints for parameter acquisition:
- You MUST ask for all parameters upfront in a single prompt
- You MUST validate that the plan and design files exist
- You MUST resolve
scope explicitly and state it in the report; never infer it from whether step happens to be set
- Checklist validation depends on scope:
- At
plan scope, you MUST verify that all checklist items in the plan are marked complete; if not, you MUST escalate — reviewing a partial implementation is out of scope
- At
step scope, you MUST NOT require the step's checklist item to be ticked. Under the current contract the orchestrator ticks it after this review passes, so an unticked item is the expected state. You MUST instead verify that every task file in the step has a recorded commit (see step 1); a step with uncommitted tasks is out of scope and you MUST escalate
- At
step scope you MUST verify the step directory {agents_dir}/tasks/{project_name}/step{NN}/ exists and contains at least one task file
Escalation Policy
This skill does not block on findings — findings go in the report. Escalate to the user ONLY when:
- At
plan scope: the plan still has unchecked items (review of a partial implementation is not supported)
- At
step scope: one or more of the step's tasks has no recorded commit (the step is not finished)
- The design document is missing or unparseable
- No commits can be located for the implementation in scope (no
progress.md files, no commit log entries)
Do NOT escalate because findings are severe — record them in the report and generate remediation tasks for the orchestrator to act on.
Steps
1. Load Inputs
Build a complete picture of the implementation before forming any judgement.
Constraints:
- You MUST read the plan in full. At
plan scope, confirm all checklist items are complete; at step scope, read the reviewed step's section in full and treat the surrounding steps as context for sequencing only
- You MUST read the design document referenced by the plan (typically
{project_dir}/design/detailed-design.md)
- You MUST enumerate task files according to scope and read each one:
plan: every task file under {agents_dir}/tasks/{project_name}/step*/
step: only {agents_dir}/tasks/{project_name}/step{NN}/
- At
step scope you MUST NOT flag work belonging to later, not-yet-implemented steps as missing or as drift. The plan is the authority on what this step was responsible for; a design element the plan defers to a later step is out of scope, and saying otherwise produces findings the orchestrator cannot act on. You SHOULD, however, flag a design element this step was responsible for and did not deliver
- At
plan scope you MUST read any prior_step_reports before analysing, and treat their findings as already-known: a finding that a step-scoped report raised and whose remediation is present in the current code MUST NOT be re-reported. One that was raised and is still unaddressed MUST be re-reported, escalated one severity level, citing the earlier report
- You MUST locate each task's scratchpad and read its
progress.md (for the commit revision) and review.yaml if present
- You MUST collect the list of commits from progress.md entries; if any task lacks a recorded commit you SHOULD note it and continue
- You SHOULD consult
{agents_dir}/summary/ if available — both codebase-summary.md and coding_style.md — to understand pre-existing architecture and conventions
- You MUST NOT read the entire codebase up front; instead, identify the major code surfaces from the design and read those files selectively as the review proceeds
- You MUST NOT re-read prior commits' diffs unless investigating a specific finding; the reviewer's primary frame is the current state of the code, not commit-by-commit history
2. Build the Architecture Map
Map each major design element to where it lives in the code now, and judge whether it aligns with intent.
Constraints:
- You MUST extract the major architectural elements from the design document — components, modules, interfaces, data models, key invariants, layering rules
- For each element, you MUST locate the corresponding code (files, classes, functions, modules) by reading the codebase
- For each element, you MUST assign an alignment status (see schema for allowed values:
aligned / drifted / undocumented_addition / missing / partial)
drifted means the code exists but its shape differs from the design in a way that may not be intentional — flag both possibilities (drift vs. justified evolution) in the notes
undocumented_addition means the code added something not described in the design — this is not automatically bad, but the design should either be updated or the addition justified
- You MUST capture the architecture map in the report's
architecture block
3. Check Doc/Code Alignment
Identify every place where the design or other docs no longer match the implementation.
Constraints:
- For each
drifted, undocumented_addition, or partial element from step 2, you MUST decide whether the appropriate remediation is update_doc (code is correct, doc is stale), update_code (doc captured the right intent, code drifted), or discuss (genuinely ambiguous — needs human judgement)
- You MUST capture these in the
doc_code_alignment block of the report
- You SHOULD also check obvious external docs touched by the implementation: README sections, API references, comments at module headers — but do not exhaustively crawl all docs
4. Cross-Cutting Analysis
Look for issues that no individual task review could have caught.
Constraints:
- You MUST evaluate the following cross-cutting concerns:
- Duplication — the same logic, validation, or data shape implemented in multiple places across tasks
- Dependencies — module/package import cycles, layering violations, leaky abstractions, unnecessary coupling between concerns
- Pattern consistency — error handling, logging, naming, test style differ between tasks; flag opportunities to consolidate
- Coverage gaps — flows that span multiple tasks and end up only partially tested at the seams between them
- Dead code — exports/functions/types added during implementation but unused at end of plan
- You MUST record each issue as a finding in the report
- You MUST NOT include tech-stack-specific cross-cutting checks here — those come from ecosystem reviewers in step 6
5. Aggregate Task-Level Review Residue
Account for findings raised by code-task-review that may not have been addressed.
Constraints:
- For each task that has a
review.yaml, you MUST inspect its findings and verdict
- You MUST identify any
important or critical findings whose suggested_action does not appear to have been carried out (cross-check against the current code)
- You MUST surface unresolved findings as new findings in the implementation review report, category
unresolved_review_findings, citing the original task and finding
- A task whose final
review.yaml has verdict: escalated (or the deprecated verdict: blocked, in archived reports) but no subsequent fix commit is by itself a critical finding
6. Discover and Invoke Ecosystem Reviewers
Detect installed skills that perform tech-stack-specific review at the implementation scope, and invoke them.
Constraints:
- You MUST scan available skills for ones whose purpose is reviewing or auditing within a specific ecosystem (supply-chain audits, framework-specific architecture reviewers, infrastructure-config reviewers, etc.)
- You MUST select only those whose ecosystem matches the project (inferred from the codebase summary or the dominant languages/manifests in the touched files)
- You MUST invoke each selected skill with appropriate context for an implementation-scope review (full codebase, not a single commit)
- You MUST merge their findings into the main
findings list with source set to the skill's name
- You MUST record the invocation in the
ecosystem_reviews block
- If no matching skill is installed, set
ecosystem_reviews: [] and proceed
7. Score Findings and Plan Remediation
Decide which findings warrant a remediation task.
Constraints:
- You MUST assign each finding a severity (
critical, important, suggestion, nit) using the same ladder as code-task-review (see report-schema.md)
- Every
critical finding MUST be matched to a remediation task
- Every
important finding SHOULD be matched to a remediation task; if it is not, you MUST justify in the finding's details
suggestion findings MAY have remediation tasks; they typically do not
nit findings MUST NOT generate remediation tasks
- You SHOULD group multiple related findings under a single remediation task when they share a fix (e.g., "extract duplicated validation" addresses three duplication findings at once)
- You MUST sequence remediation tasks so that prerequisites come first, mirroring the rule used by
plan-to-tasks
8. Generate Remediation Task Files
Write the remediation tasks following the same code task format used by plan-to-tasks.
Constraints:
- Placement depends on scope:
- At
plan scope, you MUST determine the next available step number (NN) by inspecting {agents_dir}/tasks/{project_name}/ and choosing the smallest integer not already used as step{NN}, then create the directory {remediation_step_dir} (defaulting to step{NN}/)
- At
step scope, you MUST write remediation tasks into the reviewed step's own directory, continuing its task-{MM}- numbering from the highest existing task number. You MUST NOT create a new step, and MUST NOT renumber or modify the step's existing task files. Name them so their origin is obvious, e.g. task-04-remediate-duplicated-path-canonicalisation.code-task.md
- At
step scope you MUST cap remediation at 3 tasks. Cross-task issues found within a single step are by construction narrow; if more than 3 are warranted, the step's decomposition is likely wrong and that is itself the finding — generate the top 3, and record in the report's summary that the step needs re-planning rather than more remediation
- You MUST follow the Code Task Format documented in
../plan-to-tasks/SKILL.md (sections: Description, Background, Reference Documentation, Technical Requirements, Dependencies, Implementation Approach, Acceptance Criteria, Metadata)
- Each remediation task MUST:
- Reference the implementation review report in its Reference Documentation section:
Implementation Review: {report_path}
- Cite in Background which finding IDs it addresses (e.g., "Addresses findings F3, F7 from implementation review")
- Have acceptance criteria that make the fix verifiable — typically "the original issue is no longer present, demonstrated by [specific check]"
- Be atomic (single concern, single commit)
- You MUST NOT exceed 5–6 remediation tasks per step. If more are needed, generate the highest-priority 5–6 and note in the report that further remediation rounds will be needed
- You MUST record each generated task in the report's
remediation_tasks block (path + addressed finding IDs)
9. Update the Implementation Plan
This step applies at plan scope only. At step scope you MUST NOT modify plan.md at all — not the checklist, not the step body. The remediation tasks live inside the step that is already in progress, and the orchestrator ticks that step's checklist item once they are done. Skip to step 10.
At plan scope, append a new step to plan.md for the remediation work.
Constraints:
- You MUST append a new numbered step to the plan's checklist, using a title like "Remediation from implementation review {date}"
- You MUST add the corresponding step section in the body of the plan, following the same structure as existing steps (Objective, Implementation guidance, Test requirements, Demo criteria), summarised from the remediation tasks
- You MUST leave the new step's checklist item unchecked — the orchestrator ticks it once all remediation tasks are committed
- If no remediation tasks were generated (verdict:
clean), you MUST NOT modify the plan
10. Emit the Report
Write the YAML report to {report_path}.
Constraints:
- You MUST follow the schema in
report-schema.md exactly
- You MUST record the
scope you ran at, and at step scope the step number, in the report header. A consumer that cannot tell a step report from a plan report will mis-file its findings
- You MUST set
verdict:
clean if no important or critical findings, no drifted/missing architecture elements, and no update_code doc/code alignment items — and therefore no remediation tasks generated
remediation_recommended if important findings or notable doc/code drift exist, but no critical blockers
remediation_required if any critical findings exist
- You MUST sort
findings by severity (critical first), then by category, then by file
- You MUST emit valid YAML; use block scalars (
|) for multi-line content
- After writing, you MUST report to the user (or calling orchestrator) the report path, the verdict, the count of remediation tasks generated, and the new step's path; do not paste the entire report into the response
Examples
Example Input
project_dir: ".agents/planning/template-feature"
Example Process
1. Load: 12-step plan, all complete. 23 task files across 12 steps. 23 commits.
Read design (8KB), plan (4KB), all review.yaml files (3 had unresolved
important findings).
2. Architecture map: 9 elements total.
- 7 aligned
- 1 drifted: TemplateRegistry was specified as a singleton; implementation
has it as a per-request instance. Plausibly intentional, not documented.
- 1 undocumented_addition: A FieldFormatter abstraction added in step 7
that the design didn't mention.
3. Doc/code alignment:
- design/detailed-design.md §"Template Registry" — update_doc (per-request
pattern is the right call given step 4 reqs)
- design/detailed-design.md §"Field Pipeline" — update_doc (mention
FieldFormatter)
4. Cross-cutting:
- Duplication: validation rule "name must be non-empty" appears in 3 modules
- Pattern consistency: errors raised as ValueError in steps 1-6, custom
ValidationError in step 7+. One should win.
5. Task-level review residue:
- step03/task-02 had an unresolved 'important' finding about missing
error-path test. Still missing.
6. Ecosystem reviewers: Python project, no python-specific reviewer installed.
ecosystem_reviews: [].
7. Findings scored: 0 critical, 4 important, 3 suggestions.
8. Remediation tasks generated under step13/:
- task-01-consolidate-empty-name-validation
- task-02-unify-error-types
- task-03-add-error-path-test-from-step03
- task-04-update-design-doc-for-registry-and-formatter
9. plan.md: appended Step 13 "Remediation from implementation review 2026-04-27"
10. Emit: review.yaml, verdict = remediation_recommended.
Troubleshooting
Plan Has Unchecked Items
At plan scope, if any plan checklist item is incomplete:
- You MUST escalate. A plan-scoped review assumes the plan is finished. A partial implementation has different remediation dynamics (in-progress work shouldn't be flagged as drift) and is out of scope
At step scope this is not an error condition: the reviewed step's item is expected to be unticked, because the orchestrator ticks it after this review passes. Escalate only if one of the step's own tasks has no recorded commit.
A Step-Scoped Review Keeps Finding Problems
The orchestrator may re-run a step-scoped review after its remediation tasks are implemented. Guard against an unbounded loop:
- A step SHOULD receive at most two step-scoped reviews: the initial one, and one confirmation pass after remediation
- If the confirmation pass still yields
critical findings, you MUST say so plainly in the summary and recommend the orchestrator stop and surface to the user rather than generating a third round. Repeated remediation on one step means the step was mis-planned, which is a planning decision, not a review one
Design Document Missing or Unparseable
If the design referenced by the plan cannot be read or has no architectural content:
- You MUST escalate. Without a design, there is no baseline for "drift" or "undocumented addition"
- You MAY still produce a partial review focused on cross-cutting issues (duplication, dependencies, pattern consistency) if the user explicitly asks
No Remediation Tasks Needed
If the verdict is clean:
- You MUST NOT create a remediation step folder
- You MUST NOT modify the plan
- You MUST still write the YAML report — it documents that the implementation was reviewed and found clean
Too Many Findings to Address in One Round
If the review surfaces enough issues that more than 5–6 remediation tasks would be needed:
- You MUST generate the highest-priority 5–6 (all
critical, then important by impact)
- You MUST note in the report's summary that a follow-up implementation review is recommended after this round of remediation, to address the remaining findings
Artifacts
At plan scope:
{project_dir}/implementation/
├── plan.md — Updated with appended remediation step (if any)
└── review.yaml — Implementation review report (schema in report-schema.md)
{agents_dir}/tasks/{project_name}/step{NN}/ — NEW step folder
├── task-01-*.code-task.md
└── ... — Generated remediation tasks (if any)
At step scope:
{project_dir}/implementation/
└── review-step{NN}.yaml — Step review report; plan.md is NOT modified
{agents_dir}/tasks/{project_name}/step{NN}/ — the EXISTING step folder
├── task-01-*.code-task.md — untouched
├── task-02-*.code-task.md — untouched
└── task-03-remediate-*.code-task.md — appended remediation tasks (if any)
The skill writes the report unconditionally, and remediation tasks only when the verdict is not clean. It modifies plan.md only at plan scope. It does not modify any other artifact.
1---2name: implementation-review3description: Review an implementation as a whole — either a single completed step or a finished plan. Looks across every commit in scope, the current state of the codebase, the design, and the task-level review residue to surface architectural drift, duplication, undesirable dependencies, doc/code divergence, and cross-cutting issues that no single task review could catch. Produces a structured YAML report and a set of follow-on remediation `.code-task.md` files that re-enter the existing pipeline. Designed to run with clean context after the last task in scope is committed.4---56# Implementation Review78## Overview910Review a completed implementation as a whole — not commit by commit. The reviewer reads the design, the plan, every task file in scope, the scratchpad evidence (including any per-task `review.yaml` reports), and selectively reads the current state of the codebase.1112The review runs at one of two **scopes**, selected by the `scope` parameter:1314| `scope` | Covers | Runs when | Purpose |15|---|---|---|---|16| `step` | One step's tasks and commits | After the last task of a step is approved, before advancing | Catch cross-task drift *within* a step while it is still cheap to fix |17| `plan` (default) | Every step in the plan | After the last task of the last step | Catch drift that spans steps, and residue the per-step passes missed |1819The two are complementary, not alternatives. Running per-step reviews does not remove the value of a final plan-scoped pass, but it should make it quieter: a plan-scoped review MUST treat existing per-step reports as input (see step 5) rather than re-deriving findings already remediated.2021It produces:22231. A structured YAML report (`{report_path}`; schema in `report-schema.md`).242. A set of follow-on remediation `.code-task.md` files addressing findings that warrant code changes — placed so the existing `task-to-code` flow picks them up (placement differs by scope; see step 8).253. At `plan` scope only, an appended remediation step in the implementation plan.2627The skill is single-pass: read inputs, analyse, emit artifacts, exit. It does not iterate, does not modify the existing code, and does not run task-to-code itself. It is intended to run with a highly capable model (Opus-class), since the analysis is wide-scope and judgement-heavy — and, when driven by an orchestrator, in a **fresh session**, since context independence is the whole point of a review that is meant to catch what the per-task reviewer could not.2829## Parameters3031- **agents_dir** (optional, default: `.agents`): Base directory for structured-spec-to-code artifacts32- **project_dir** (required): Project directory containing the design and plan (e.g., `{agents_dir}/planning/{project_name}`)33- **scope** (optional, default: `plan`): `plan` to review every step, or `step` to review a single completed step34- **step** (required iff `scope: step`): The step number to review, e.g. `1`. Zero-padded `step{NN}` directory naming is used on disk regardless of how it is passed35- **plan_path** (optional, default: `{project_dir}/implementation/plan.md`): Path to the implementation plan36- **report_path** (optional): Where to write the YAML report. Defaults to `{project_dir}/implementation/review.yaml` at `plan` scope, and `{project_dir}/implementation/review-step{NN}.yaml` at `step` scope — a step-scoped review MUST NOT overwrite the plan-scoped report or another step's37- **remediation_step_dir** (optional): Where to put generated remediation tasks. Defaults differ by scope:38 - `plan`: `{agents_dir}/tasks/{project_name}/step{NN}/`, where `NN` is the next available step number after the highest existing step folder39 - `step`: the **reviewed step's own** directory, `{agents_dir}/tasks/{project_name}/step{NN}/` — remediation tasks are appended to that step as additional tasks, continuing its `task-{MM}-` numbering40- **prior_step_reports** (optional, `plan` scope only): Paths to step-scoped reports already produced for this plan. Defaults to any `{project_dir}/implementation/review-step*.yaml` found4142**Constraints for parameter acquisition:**43- You MUST ask for all parameters upfront in a single prompt44- You MUST validate that the plan and design files exist45- You MUST resolve `scope` explicitly and state it in the report; never infer it from whether `step` happens to be set46- Checklist validation depends on scope:47 - At `plan` scope, you MUST verify that all checklist items in the plan are marked complete; if not, you MUST escalate — reviewing a partial implementation is out of scope48 - At `step` scope, you MUST NOT require the step's checklist item to be ticked. Under the current contract the orchestrator ticks it *after* this review passes, so an unticked item is the expected state. You MUST instead verify that every task file in the step has a recorded commit (see step 1); a step with uncommitted tasks is out of scope and you MUST escalate49- At `step` scope you MUST verify the step directory `{agents_dir}/tasks/{project_name}/step{NN}/` exists and contains at least one task file5051## Escalation Policy5253This skill does not block on findings — findings go in the report. Escalate to the user ONLY when:54- At `plan` scope: the plan still has unchecked items (review of a partial implementation is not supported)55- At `step` scope: one or more of the step's tasks has no recorded commit (the step is not finished)56- The design document is missing or unparseable57- No commits can be located for the implementation in scope (no `progress.md` files, no commit log entries)5859Do NOT escalate because findings are severe — record them in the report and generate remediation tasks for the orchestrator to act on.6061## Steps6263### 1. Load Inputs6465Build a complete picture of the implementation before forming any judgement.6667**Constraints:**68- You MUST read the plan in full. At `plan` scope, confirm all checklist items are complete; at `step` scope, read the reviewed step's section in full and treat the surrounding steps as context for sequencing only69- You MUST read the design document referenced by the plan (typically `{project_dir}/design/detailed-design.md`)70- You MUST enumerate task files according to scope and read each one:71 - `plan`: every task file under `{agents_dir}/tasks/{project_name}/step*/`72 - `step`: only `{agents_dir}/tasks/{project_name}/step{NN}/`73- At `step` scope you MUST NOT flag work belonging to later, not-yet-implemented steps as `missing` or as drift. The plan is the authority on what this step was responsible for; a design element the plan defers to a later step is out of scope, and saying otherwise produces findings the orchestrator cannot act on. You SHOULD, however, flag a design element this step *was* responsible for and did not deliver74- At `plan` scope you MUST read any `prior_step_reports` before analysing, and treat their findings as already-known: a finding that a step-scoped report raised and whose remediation is present in the current code MUST NOT be re-reported. One that was raised and is still unaddressed MUST be re-reported, escalated one severity level, citing the earlier report75- You MUST locate each task's scratchpad and read its `progress.md` (for the commit revision) and `review.yaml` if present76- You MUST collect the list of commits from progress.md entries; if any task lacks a recorded commit you SHOULD note it and continue77- You SHOULD consult `{agents_dir}/summary/` if available — both `codebase-summary.md` and `coding_style.md` — to understand pre-existing architecture and conventions78- You MUST NOT read the entire codebase up front; instead, identify the major code surfaces from the design and read those files selectively as the review proceeds79- You MUST NOT re-read prior commits' diffs unless investigating a specific finding; the reviewer's primary frame is the *current* state of the code, not commit-by-commit history8081### 2. Build the Architecture Map8283Map each major design element to where it lives in the code now, and judge whether it aligns with intent.8485**Constraints:**86- You MUST extract the major architectural elements from the design document — components, modules, interfaces, data models, key invariants, layering rules87- For each element, you MUST locate the corresponding code (files, classes, functions, modules) by reading the codebase88- For each element, you MUST assign an alignment status (see schema for allowed values: `aligned` / `drifted` / `undocumented_addition` / `missing` / `partial`)89- `drifted` means the code exists but its shape differs from the design in a way that may not be intentional — flag both possibilities (drift vs. justified evolution) in the notes90- `undocumented_addition` means the code added something not described in the design — this is not automatically bad, but the design should either be updated or the addition justified91- You MUST capture the architecture map in the report's `architecture` block9293### 3. Check Doc/Code Alignment9495Identify every place where the design or other docs no longer match the implementation.9697**Constraints:**98- For each `drifted`, `undocumented_addition`, or `partial` element from step 2, you MUST decide whether the appropriate remediation is `update_doc` (code is correct, doc is stale), `update_code` (doc captured the right intent, code drifted), or `discuss` (genuinely ambiguous — needs human judgement)99- You MUST capture these in the `doc_code_alignment` block of the report100- You SHOULD also check obvious external docs touched by the implementation: README sections, API references, comments at module headers — but do not exhaustively crawl all docs101102### 4. Cross-Cutting Analysis103104Look for issues that no individual task review could have caught.105106**Constraints:**107- You MUST evaluate the following cross-cutting concerns:108 - **Duplication** — the same logic, validation, or data shape implemented in multiple places across tasks109 - **Dependencies** — module/package import cycles, layering violations, leaky abstractions, unnecessary coupling between concerns110 - **Pattern consistency** — error handling, logging, naming, test style differ between tasks; flag opportunities to consolidate111 - **Coverage gaps** — flows that span multiple tasks and end up only partially tested at the seams between them112 - **Dead code** — exports/functions/types added during implementation but unused at end of plan113- You MUST record each issue as a finding in the report114- You MUST NOT include tech-stack-specific cross-cutting checks here — those come from ecosystem reviewers in step 6115116### 5. Aggregate Task-Level Review Residue117118Account for findings raised by `code-task-review` that may not have been addressed.119120**Constraints:**121- For each task that has a `review.yaml`, you MUST inspect its `findings` and `verdict`122- You MUST identify any `important` or `critical` findings whose `suggested_action` does not appear to have been carried out (cross-check against the current code)123- You MUST surface unresolved findings as new findings in the implementation review report, category `unresolved_review_findings`, citing the original task and finding124- A task whose final `review.yaml` has `verdict: escalated` (or the deprecated `verdict: blocked`, in archived reports) but no subsequent fix commit is by itself a `critical` finding125126### 6. Discover and Invoke Ecosystem Reviewers127128Detect installed skills that perform tech-stack-specific review at the implementation scope, and invoke them.129130**Constraints:**131- You MUST scan available skills for ones whose purpose is reviewing or auditing within a specific ecosystem (supply-chain audits, framework-specific architecture reviewers, infrastructure-config reviewers, etc.)132- You MUST select only those whose ecosystem matches the project (inferred from the codebase summary or the dominant languages/manifests in the touched files)133- You MUST invoke each selected skill with appropriate context for an implementation-scope review (full codebase, not a single commit)134- You MUST merge their findings into the main `findings` list with `source` set to the skill's name135- You MUST record the invocation in the `ecosystem_reviews` block136- If no matching skill is installed, set `ecosystem_reviews: []` and proceed137138### 7. Score Findings and Plan Remediation139140Decide which findings warrant a remediation task.141142**Constraints:**143- You MUST assign each finding a severity (`critical`, `important`, `suggestion`, `nit`) using the same ladder as `code-task-review` (see report-schema.md)144- Every `critical` finding MUST be matched to a remediation task145- Every `important` finding SHOULD be matched to a remediation task; if it is not, you MUST justify in the finding's `details`146- `suggestion` findings MAY have remediation tasks; they typically do not147- `nit` findings MUST NOT generate remediation tasks148- You SHOULD group multiple related findings under a single remediation task when they share a fix (e.g., "extract duplicated validation" addresses three duplication findings at once)149- You MUST sequence remediation tasks so that prerequisites come first, mirroring the rule used by `plan-to-tasks`150151### 8. Generate Remediation Task Files152153Write the remediation tasks following the same code task format used by `plan-to-tasks`.154155**Constraints:**156- Placement depends on scope:157 - At `plan` scope, you MUST determine the next available step number (`NN`) by inspecting `{agents_dir}/tasks/{project_name}/` and choosing the smallest integer not already used as `step{NN}`, then create the directory `{remediation_step_dir}` (defaulting to `step{NN}/`)158 - At `step` scope, you MUST write remediation tasks into the **reviewed step's own** directory, continuing its `task-{MM}-` numbering from the highest existing task number. You MUST NOT create a new step, and MUST NOT renumber or modify the step's existing task files. Name them so their origin is obvious, e.g. `task-04-remediate-duplicated-path-canonicalisation.code-task.md`159- At `step` scope you MUST cap remediation at **3 tasks**. Cross-task issues found within a single step are by construction narrow; if more than 3 are warranted, the step's decomposition is likely wrong and that is itself the finding — generate the top 3, and record in the report's summary that the step needs re-planning rather than more remediation160- You MUST follow the Code Task Format documented in `../plan-to-tasks/SKILL.md` (sections: Description, Background, Reference Documentation, Technical Requirements, Dependencies, Implementation Approach, Acceptance Criteria, Metadata)161- Each remediation task MUST:162 - Reference the implementation review report in its Reference Documentation section: `Implementation Review: {report_path}`163 - Cite in Background which finding IDs it addresses (e.g., "Addresses findings F3, F7 from implementation review")164 - Have acceptance criteria that make the fix verifiable — typically "the original issue is no longer present, demonstrated by [specific check]"165 - Be atomic (single concern, single commit)166- You MUST NOT exceed 5–6 remediation tasks per step. If more are needed, generate the highest-priority 5–6 and note in the report that further remediation rounds will be needed167- You MUST record each generated task in the report's `remediation_tasks` block (path + addressed finding IDs)168169### 9. Update the Implementation Plan170171**This step applies at `plan` scope only. At `step` scope you MUST NOT modify `plan.md` at all** — not the checklist, not the step body. The remediation tasks live inside the step that is already in progress, and the orchestrator ticks that step's checklist item once they are done. Skip to step 10.172173At `plan` scope, append a new step to `plan.md` for the remediation work.174175**Constraints:**176- You MUST append a new numbered step to the plan's checklist, using a title like "Remediation from implementation review {date}"177- You MUST add the corresponding step section in the body of the plan, following the same structure as existing steps (Objective, Implementation guidance, Test requirements, Demo criteria), summarised from the remediation tasks178- You MUST leave the new step's checklist item *unchecked* — the orchestrator ticks it once all remediation tasks are committed179- If no remediation tasks were generated (verdict: `clean`), you MUST NOT modify the plan180181### 10. Emit the Report182183Write the YAML report to `{report_path}`.184185**Constraints:**186- You MUST follow the schema in `report-schema.md` exactly187- You MUST record the `scope` you ran at, and at `step` scope the `step` number, in the report header. A consumer that cannot tell a step report from a plan report will mis-file its findings188- You MUST set `verdict`:189 - `clean` if no `important` or `critical` findings, no `drifted`/`missing` architecture elements, and no `update_code` doc/code alignment items — and therefore no remediation tasks generated190 - `remediation_recommended` if `important` findings or notable doc/code drift exist, but no `critical` blockers191 - `remediation_required` if any `critical` findings exist192- You MUST sort `findings` by severity (`critical` first), then by category, then by file193- You MUST emit valid YAML; use block scalars (`|`) for multi-line content194- After writing, you MUST report to the user (or calling orchestrator) the report path, the verdict, the count of remediation tasks generated, and the new step's path; do not paste the entire report into the response195196## Examples197198### Example Input199```200project_dir: ".agents/planning/template-feature"201```202203### Example Process204```2051. Load: 12-step plan, all complete. 23 task files across 12 steps. 23 commits.206 Read design (8KB), plan (4KB), all review.yaml files (3 had unresolved207 important findings).2082. Architecture map: 9 elements total.209 - 7 aligned210 - 1 drifted: TemplateRegistry was specified as a singleton; implementation211 has it as a per-request instance. Plausibly intentional, not documented.212 - 1 undocumented_addition: A FieldFormatter abstraction added in step 7213 that the design didn't mention.2143. Doc/code alignment:215 - design/detailed-design.md §"Template Registry" — update_doc (per-request216 pattern is the right call given step 4 reqs)217 - design/detailed-design.md §"Field Pipeline" — update_doc (mention218 FieldFormatter)2194. Cross-cutting:220 - Duplication: validation rule "name must be non-empty" appears in 3 modules221 - Pattern consistency: errors raised as ValueError in steps 1-6, custom222 ValidationError in step 7+. One should win.2235. Task-level review residue:224 - step03/task-02 had an unresolved 'important' finding about missing225 error-path test. Still missing.2266. Ecosystem reviewers: Python project, no python-specific reviewer installed.227 ecosystem_reviews: [].2287. Findings scored: 0 critical, 4 important, 3 suggestions.2298. Remediation tasks generated under step13/:230 - task-01-consolidate-empty-name-validation231 - task-02-unify-error-types232 - task-03-add-error-path-test-from-step03233 - task-04-update-design-doc-for-registry-and-formatter2349. plan.md: appended Step 13 "Remediation from implementation review 2026-04-27"23510. Emit: review.yaml, verdict = remediation_recommended.236```237238## Troubleshooting239240### Plan Has Unchecked Items241At `plan` scope, if any plan checklist item is incomplete:242- You MUST escalate. A plan-scoped review assumes the plan is finished. A partial implementation has different remediation dynamics (in-progress work shouldn't be flagged as drift) and is out of scope243244At `step` scope this is **not** an error condition: the reviewed step's item is expected to be unticked, because the orchestrator ticks it after this review passes. Escalate only if one of the step's own tasks has no recorded commit.245246### A Step-Scoped Review Keeps Finding Problems247The orchestrator may re-run a step-scoped review after its remediation tasks are implemented. Guard against an unbounded loop:248- A step SHOULD receive at most **two** step-scoped reviews: the initial one, and one confirmation pass after remediation249- If the confirmation pass still yields `critical` findings, you MUST say so plainly in the summary and recommend the orchestrator stop and surface to the user rather than generating a third round. Repeated remediation on one step means the step was mis-planned, which is a planning decision, not a review one250251### Design Document Missing or Unparseable252If the design referenced by the plan cannot be read or has no architectural content:253- You MUST escalate. Without a design, there is no baseline for "drift" or "undocumented addition"254- You MAY still produce a partial review focused on cross-cutting issues (duplication, dependencies, pattern consistency) if the user explicitly asks255256### No Remediation Tasks Needed257If the verdict is `clean`:258- You MUST NOT create a remediation step folder259- You MUST NOT modify the plan260- You MUST still write the YAML report — it documents that the implementation was reviewed and found clean261262### Too Many Findings to Address in One Round263If the review surfaces enough issues that more than 5–6 remediation tasks would be needed:264- You MUST generate the highest-priority 5–6 (all `critical`, then `important` by impact)265- You MUST note in the report's summary that a follow-up implementation review is recommended after this round of remediation, to address the remaining findings266267## Artifacts268269At `plan` scope:270271```272{project_dir}/implementation/273├── plan.md — Updated with appended remediation step (if any)274└── review.yaml — Implementation review report (schema in report-schema.md)275276{agents_dir}/tasks/{project_name}/step{NN}/ — NEW step folder277├── task-01-*.code-task.md278└── ... — Generated remediation tasks (if any)279```280281At `step` scope:282283```284{project_dir}/implementation/285└── review-step{NN}.yaml — Step review report; plan.md is NOT modified286287{agents_dir}/tasks/{project_name}/step{NN}/ — the EXISTING step folder288├── task-01-*.code-task.md — untouched289├── task-02-*.code-task.md — untouched290└── task-03-remediate-*.code-task.md — appended remediation tasks (if any)291```292293The skill writes the report unconditionally, and remediation tasks only when the verdict is not `clean`. It modifies `plan.md` only at `plan` scope. It does not modify any other artifact.