What it does
Compares specs to code
Compares existing SDD artifacts against the current codebase to detect divergences.
Classifies divergences
Classifies each divergence into one of 6 types using deterministic rules with clear evidence.
Auto-resolves safe cases
Automatically resolves new functionality, removed features, and refactoring by updating SDD artifacts.
Flags unsafe cases
Flags behavioral changes, potential bugs, and ambiguous cases for user decision.
Invocation modes
| Mode | Behavior | Use Case |
|---|---|---|
| default | Classify, auto-resolve safe types, ask user for unsafe types | Normal reconciliation |
--dry-run | Classify and report only, no modifications | Assessment before committing to changes |
--scope=paths | Only compare specified paths against their specs | Partial reconciliation |
--code-wins | All divergences resolved by updating specs to match code | Post-release sync where code is authoritative |
Eight phases
The reconcile skill executes eight phases to detect and resolve drift:Phase 1: Context loading
Loads all SDD artifacts and establishes comparison baseline:- Verifies SDD artifacts exist:
requirements/REQUIREMENTS.md,spec/directory - Verifies source code exists:
src/or equivalent - Loads
pipeline-state.jsonand checks for stale stages - Loads previous
reconciliation/RECONCILIATION-REPORT.mdfor delta comparison - Parses all requirements: extracts REQ IDs, EARS statements, traceability references
- Parses all specifications: use cases, workflows, API contracts, domain model, NFRs
- Builds a spec artifact index
Reconcile requires both SDD artifacts and source code to exist. If SDD artifacts are missing, use
/sdd:reverse-engineer to generate them first.Phase 2: Code scan
Analyzes current code to build a feature inventory:- Scans all source files in scope
- Extracts endpoints/routes with their handlers
- Extracts entities/models with their fields
- Extracts business logic: validations, state transitions, calculations
- Scans test files to understand tested behavior
- Builds a code feature index
- Maps code features to spec artifacts via
Refs:comments, naming conventions, and endpoint paths
- Queries
sdd_contextfor each artifact to get implementing symbols with callers/callees - Uses symbol table for precise line ranges and types
- Uses call graph to distinguish behavioral change vs refactoring
- Scales to any codebase size via structured MCP data
Phase 3: Spec-code comparison
Compares spec artifacts against code features to find divergences:Compare behavior
- API contracts: method, path, params, request/response shape, status codes
- Business rules: validation conditions, thresholds, error messages
- State machines: states, transitions, guards
- Domain model: entity fields, types, relationships, constraints
Phase 4: Divergence classification
Classifies each divergence using deterministic rules:| Type | Signal | Resolution |
|---|---|---|
NEW_FUNCTIONALITY | Code exists without spec; has tests or is actively used | Auto: Update specs (code wins) |
REMOVED_FEATURE | Spec exists without code; no recent commits touching it | Auto: Deprecate in specs (code wins) |
BEHAVIORAL_CHANGE | Both exist but behavior differs | Ask user: Is code correct or is it a bug? |
REFACTORING | Structure changed but behavior is equivalent (tests still pass) | Auto: Update technical specs only |
BUG_OR_DEFECT | Code behavior contradicts spec AND tests fail or are missing | Ask user: Fix code or update spec? |
AMBIGUOUS | Cannot determine type with confidence | Ask user: Classify manually |
- HIGH: Clear match to one type based on signals
- MEDIUM: Likely match but some counter-signals
- LOW: Multiple types could apply → classify as
AMBIGUOUS
Phase 5: Reconciliation plan
Builds the reconciliation plan before applying any changes:- Auto-resolvable
- User-decision
- Cascade impact
- NEW_FUNCTIONALITY: Draft new requirements (EARS syntax) and spec entries
- REMOVED_FEATURE: Mark specs as deprecated with removal date
- REFACTORING: Update technical references, file paths, method names
Phase 6: User review
Presents the reconciliation plan and gets user decisions:In
--code-wins mode, this phase is skipped and everything is auto-resolved toward code. In --dry-run mode, the summary is presented but no decisions are requested.Phase 7: Apply changes
Applies the reconciliation decisions to SDD artifacts:NEW_FUNCTIONALITY
NEW_FUNCTIONALITY
- Add new requirements to
requirements/REQUIREMENTS.md - Add new use cases to
spec/use-cases.md - Add new API contracts to
spec/contracts.md(if applicable) - Mark as
[RECONCILED]with source reference
REMOVED_FEATURE
REMOVED_FEATURE
- Mark requirement as
[DEPRECATED]with date and reason - Update use case status to “deprecated”
- Add removal note to spec documents
- Do NOT delete — preserve for traceability
REFACTORING
REFACTORING
- Update file paths and method references in specs
- Update API contract if endpoint structure changed
- Update architecture references in plan documents
BEHAVIORAL_CHANGE (option A: code wins)
BEHAVIORAL_CHANGE (option A: code wins)
- Update requirement EARS statement
- Update use case description and acceptance criteria
- Add ADR if the change is architecturally significant
BUG_OR_DEFECT (option B: spec wins)
BUG_OR_DEFECT (option B: spec wins)
- Create a defect task entry (but do NOT modify code)
- Flag in reconciliation report for future
/sdd:task-implementeraction
Phase 8: Pipeline state update
Updates pipeline state to reflect reconciliation:- Recalculates hashes for modified artifact directories
- Marks affected stages as needing re-run:
- If
requirements/changed →spec-auditorand downstream become stale - If
spec/changed →test-plannerand downstream become stale - If
plan/changed →task-generatorand downstream become stale
- If
- Updates
pipeline-state.jsonwith new hashes and stale markers - Generates
reconciliation/RECONCILIATION-REPORT.md
Output format
The reconcile skill generates a comprehensive reconciliation report atreconciliation/RECONCILIATION-REPORT.md:
Key sections:
- Executive summary with divergence counts by type
- Detailed divergence listing with classification evidence
- Actions taken (auto-resolved and user-decided)
- Pending items (deferred decisions, defect tasks created)
- Pipeline cascade impact
- Traceability chain changes
Six divergence types
The reconcile skill classifies divergences into six types:NEW_FUNCTIONALITY
Code exists without spec. Has tests or is actively used. Auto-resolved: Update specs to match code.
REMOVED_FEATURE
Spec exists without code. No recent commits touching it. Auto-resolved: Deprecate in specs.
BEHAVIORAL_CHANGE
Both exist but behavior differs. User decision: Is code correct or is it a bug?
REFACTORING
Structure changed but behavior is equivalent. Tests still pass. Auto-resolved: Update technical specs only.
BUG_OR_DEFECT
Code contradicts spec AND tests fail or are missing. User decision: Fix code or update spec?
AMBIGUOUS
Cannot determine type with confidence. User decision: Classify manually.
Relationship to other skills
Onboarding skill
Onboarding recommends reconcile for SDD drift scenario (scenario 3).
Reverse engineer skill
Use reverse-engineer when NO SDD artifacts exist. Reconcile requires existing specs.
Req-change skill
For intentional changes, use req-change. Reconcile handles unintentional drift.
Traceability check
Run after reconcile to verify chain integrity after updates.
Constraints
- Source read-only: Never modifies files in
src/ortests/. These are the source of truth for current behavior. - Requires SDD artifacts: Cannot run without existing
requirements/andspec/. Aborts if missing. - Summary first: Always presents the reconciliation summary before applying changes, even for auto-resolvable items.
- Atomic per divergence: Each divergence is resolved independently. A failure in one does not block others.
- Deprecate, don’t delete: Removed features are marked deprecated, never deleted from specs (traceability preservation).
- Evidence-based: Every classification must cite the code location, spec reference, and test status.
- No cascading execution: Reconcile updates artifacts and marks stages stale but does NOT invoke downstream skills.