Implementation Plan: [Feature Name]

Phase 9 Artifact — This plan enables vertical slice delivery per ENGINEERING.SOP.md.

Purpose

[Brief description of what this feature delivers and why it matters. 1-2 sentences.]


Pre-Flight Validation

STOP. Before writing this plan, validate all input specifications. Each checkbox must pass.

ADR Validation

Check Requirement Pass
ADR-### exists File: docs/specs/shared/adr/###-<slug>.md [ ]
Has Context section Explains the problem domain [ ]
Has Decision section Lists concrete choices made [ ]
Has Constraints section Contains MUST/MUST NOT statements [ ]
Has Consequences section Documents trade-offs [ ]
References prior ADRs If superseding or extending [ ]

If any ADR check fails: Create or fix the ADR before proceeding. See develop-software.md § Step 2.

PRD Validation

Check Requirement Pass
PRD-### exists File: docs/specs/shared/prd/###-<slug>.md [ ]
Has Satisfies: ADR-### Traces to architectural decision [ ]
Uses EARS notation When/If/While/The [system] shall… [ ]
Each REQ has ID Format: REQ-### [ ]
REQs are testable Can write acceptance criteria [ ]
REQs are atomic One behavior per requirement [ ]

If any PRD check fails: Create or fix the PRD before proceeding. See develop-software.md § Step 3.

SDS Validation

Check Requirement Pass
SDS file exists docs/specs/<ctx>/<ctx>.sds.yaml [ ]
Schema valid just sds-validate <file> passes [ ]
Has metadata.namespace Matches bounded context name [ ]
Has metadata.satisfies Lists PRD IDs [ ]
Entities defined With properties, types, required flags [ ]
Flows defined With type (command/query), input, output [ ]

If any SDS check fails: Run just sds-validate <file> and fix errors. See develop-software.md § Step 4.

SEA-DSL Validation

Check Requirement Pass
SEA™ file exists docs/specs/<ctx>/<ctx>.sea [ ]
Syntax valid just sea-validate <file> passes [ ]
Has namespace declaration First statement in file [ ]
All flows have @cqrs { "kind": "command" \| "query" \| "event" } [ ]
Commands have @idempotency { "enabled": true, "key": "<field>" } [ ]
Transactional flows have @tx { "transactional": true } [ ]
Event flows have @outbox If using outbox pattern [ ]

If any SEA™ check fails: Run just sea-validate <file> and fix errors. Reference SEA-DSL language docs.

Pipeline Verification

1
2
3
4
# Run full pipeline to verify all specs compile
just pipeline <context-name>

# Expected: All steps pass, manifest generated

Provenance Chain

Establish complete traceability from ADR → PRD → SDS → Implementation.

graph TD
    ADR[ADR-###: Decision Title] --> PRD1[PRD-###: Requirement 1]
    ADR --> PRD2[PRD-###: Requirement 2]
    PRD1 --> SDS1[SDS: Entity/Flow A]
    PRD2 --> SDS2[SDS: Entity/Flow B]
    SDS1 --> C1[Cycle C1A: Implementation]
    SDS2 --> C2[Cycle C2A: Implementation]

    style ADR fill:#e1f5ff
    style PRD1 fill:#fff4e1
    style PRD2 fill:#fff4e1
    style SDS1 fill:#e8f5e9
    style SDS2 fill:#e8f5e9
ADR ID PRD ID SDS Element Cycle
ADR-### PRD-### Entity: X C1A
ADR-### PRD-### Flow: Y C1A
ADR-### PRD-### Flow: Z C2A

Implementation Order

Required sequence per ENGINEERING.SOP.md Phase 9. Do not skip steps.

For each vertical slice:

  1. Domain model + invariants — Entities, value objects, policies
  2. Use case / application logic — Commands, queries, handlers
  3. Ports — Interfaces + fake implementations
  4. Adapters — Real implementations
  5. Wiring — API/UI integration
  6. Observability — Telemetry hooks (sea.domain, sea.concept)
  7. Tests — Unit, integration, E2E as appropriate
  8. Feature flag — If rollout risk exists

Proposed Cycles (Worktree-First)

Each cycle = one branch + one worktree. Waves enable parallel work.

Cycle Worktree Branch Wave Implements
C1A ../SEA-p9-c1A cycle/p9-c1A-<slug> 1 SDS: Entity X
C1B ../SEA-p9-c1B cycle/p9-c1B-<slug> 1 SDS: Flow Y
C2AA ../SEA-p9-c2AA cycle/p9-c2AA-<slug> 2 Adapter for Port Z

Starting a Cycle

1
2
3
4
5
6
7
# Creates branch + worktree in one command
just cycle-start 9 1 A entity-order

# Output:
#   Branch: cycle/p9-c1A-entity-order
#   Worktree: ../SEA-p9-c1A
#   cd ../SEA-p9-c1A

Wave 1 (Parallel — can run simultaneously in separate worktrees)

Wave 2 (Depends on Wave 1 — start after Wave 1 PRs merged)

Worktree Lifecycle

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 1. Start cycle (creates branch + worktree)
just cycle-start 9 1 A entity-order
cd ../SEA-p9-c1A

# 2. Do work in the worktree
just pipeline <ctx>
just test
git add . && git commit -m "feat: implement Entity X"

# 3. Complete cycle (pushes, prepares for PR)
just cycle-complete 9 1 A

# 4. Create PR from worktree
gh pr create --base dev

# 5. After PR merged, cleanup
cd /path/to/main/SEA™
just cycle-worktree-remove 9 1 A

# Or clean all merged worktrees at once
just worktrees-clean

Nx Generators to Use

From develop-software.md § Generators.

Generator Command When to Use
Bounded Context just generator-bc <name> New domain context
Adapter just generator-adapter <name> <ctx> New port+fake+real
API Surface just generator-api <name> <ctx> New API endpoint

Expected Filetree After Implementation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
libs/<context>/
├── domain/
│   └── src/
│       ├── index.ts
│       └── lib/
│           ├── <entity>.ts          # [SDS: Entity X]
│           └── <value-object>.ts    # [SDS: VO Y]
├── ports/
│   └── src/
│       └── lib/
│           └── <port>.port.ts       # [SDS: Port Z]
├── adapters/
│   └── src/
│       └── lib/
│           ├── <adapter>.adapter.ts # Real implementation
│           └── <adapter>.fake.ts    # Fake for testing
└── application/
    └── src/
        └── lib/
            ├── <command>.handler.ts # [SDS: Flow Command]
            └── <query>.handler.ts   # [SDS: Flow Query]

Validation & Verification

Per develop-software.md § CI/CD Gates.

Pre-Merge Checks

Post-Implementation Verification


Dependencies Introduced

Only list if this plan introduces NEW dependencies.

Dependency Type Version Justification
(none expected for generated code)

If adding dependencies, complete the Dependency Review Checklist.


Risks & Mitigations

Risk Likelihood Impact Mitigation
Spec validation fails Low Blocks plan Run pre-flight checks first
Generator output doesn’t match spec Medium Rework Review generated code against SDS
Integration tests flaky Medium CI delays Use Testcontainers for isolation

Open Questions

Document 1-3 unresolved items that need clarification before or during implementation.

  1. [Question about unclear requirement or design decision]
  2. [Question about integration with existing systems]

References

Do not duplicate content from these documents. Read them for full context.

Document Purpose
develop-software.md Full workflow, just commands, pipeline steps
ENGINEERING.SOP.md Phase definitions, acceptance criteria
AGENTS.md Allowed edits, sequencing rules
SEA-DSL Reference Language grammar and syntax
Traceability Matrix ADR→PRD→SDS chains