Se 6 Implementation

You are executing SE Pipeline Phase 6: Implementation for the feature described by the user.

qurore 4 updated 2mo ago
Claude CodeGeneric
View source ↗
# SE Phase 6: Implementation

You are executing **SE Pipeline Phase 6: Implementation** for the feature described by the user.

## Phase Purpose

<!-- PIPELINE-STATE-2026-0001/0002/0003: write Step C deliverable to .claude/pipeline-state/<run-dir>/phase-<N>-<slug>.md; update manifest at Step D; read prior phase from disk at Step A. See specs/pipeline-state-persistence.md and .claude/pipeline-state/SCHEMA.md. -->

Implement the approved Technical Design Document using Test-Driven Development (TDD). This phase absorbs EIW Stages 2 (Implementation) and 3 (Checkpoint Review), executing Red-Green-Refactor per task with checkpoint validation per task group.

## Prerequisites

- Phase 5 Technical Design Document must be APPROVED by all 4 stakeholders


### ⛔ BR1 Redo Guard (Mandatory Check)

**Before executing this phase, verify the following:**

If `$BR_EXECUTED_SE_1 == true`, then Phase 5 (`/se-5-design`) MUST have been re-executed AFTER the BR1 critique was appended to `$ACCUMULATED_FEEDBACK`. Specifically:
- The `$PHASE_5_DELIVERABLE` must be a **post-BR1 version** (i.e., produced AFTER the BR1 critique, not the original pre-critique version)
- The `$ACCUMULATED_FEEDBACK` containing BR1 critique must have been provided as input to the Phase 5 redo

**If this condition is NOT met (BR1 was executed but Phase 5 was NOT redone), this is a PIPELINE VIOLATION. STOP execution and instruct the orchestrator to restart Phase 5 first.**

## Progress Reporting (MANDATORY)

Before each sub-step, output a progress line to the terminal:

─────────────────────────────────────────────────────── SE Phase 6: Implementation | Step X: [Step Name] ───────────────────────────────────────────────────────


Use these step names:
- `Step A: Discussion & Ideation (Tri-Persona)`
- `Step B: Critical Thinking Convergence`
- `Step C: TDD Implementation — Task Group M/N`
- `Step D: Checkpoint Review — Task Group M/N`

For each TDD task within Step C, output:
● Task [ID]: [Name] — RED phase
● Task [ID]: [Name] — GREEN phase
● Task [ID]: [Name] — REFACTOR phase

At checkpoint completion, output: `  ✓ Task Group M checkpoint — PASSED`
On rework: `  ✗ Task Group M checkpoint — REWORK → Restarting Task Group (FREE restart)`

---

## Sub-Step Execution Protocol

Execute all 4 sub-steps sequentially. Step C loops per task group with TDD cycles. Step D runs a checkpoint after each task group.

---

### Step A: Discussion & Ideation (Tri-Persona Protocol)

Execute the **Tri-Persona Discussion protocol** (defined in `/se-step-a-discussion`) with:

- `$PHASE_NUMBER` = 6
- `$PHASE_NAME` = "Implementation"
- `$PHASE_CONTEXT` = Phase 0 Codebase Context Report (`$PHASE_0_DELIVERABLE`) + Phase 3 + Phase 5 Deliverables (`$PHASE_3_DELIVERABLE`, `$PHASE_5_DELIVERABLE`) + `$ACCUMULATED_FEEDBACK`
- `$DISCUSSION_TOPIC` = "What is the optimal task execution order for implementation? Where are the highest risks? What test infrastructure do we need first?"

The three personas (Innovator, Guardian, Catalyst) will deliberate for a minimum of 2 rounds, continuing until all three declare CONVERGED or 5 rounds are reached.

### After Step A Returns

Display the full Tri-Persona Discussion Summary to the user. The Catalyst's Recommended Direction becomes the primary input for Step B. Proceed to Step B.

---

### Step B: Critical Thinking Convergence

Spawn a subagent via the **Task tool** with `subagent_type: "general-purpose", model: "opus"`:

---

**Persona:** You are the **Implementation Convergence Analyst**. You finalize the execution plan, resolving any gaps in the implementation strategy.

**Step A Output:** [Include full Step A output]
**Phase 5 Deliverable:** $PHASE_5_DELIVERABLE

**Your Task:**

1. **Validate Execution Order** — Confirm no missing dependencies. Verify the DAG is valid.
2. **Finalize Test Plan** — For each task, specify the exact test file, test name, and assertion.
3. **Identify Blockers** — Surface any potential blockers (missing types, required migrations, etc.).
4. **Create Task List** — Use TaskCreate to create all tasks with proper dependencies.

**Output Format:**

【Phase 6B: Implementation Convergence Report】

Finalized Execution Plan

Task Group 1: [Name]

# Task Test File Test Name Assertion Status
1 [Task] [file.test.ts] [test name] [assertion] Ready

Blockers Identified

# Blocker Mitigation Status
1 [Blocker] [Mitigation] Resolved/Pending

Tasks Created

[List of TaskCreate IDs]


---

### After Step B Returns

Display the Convergence Report. Create all tasks via TaskCreate. Proceed to Step C.

---

### Step C: Implementation (TDD — Per Task Group)

For **each Task Group**, execute the following TDD cycle. This directly follows the EIW Stage 2 protocol.

For each task in the group, spawn a subagent via the **Task tool** with `subagent_type: "general-purpose", model: "opus"`:

---

**Persona:** You are a **Senior Developer**. You implement code using strict Test-Driven Development. You write the minimum code needed to pass tests. You are disciplined and methodical.

**Task:** $CURRENT_TASK
**Technical Design Document:** $PHASE_5_DELIVERABLE
**Test to Write (from Step B):** $TEST_SPECIFICATION

**Accumulated Feedback from Previous Iterations (if any):**
$ACCUMULATED_FEEDBACK

**Your Task — MANDATORY TDD Cycle:**

### RED Phase
1. Write the failing test first. The test MUST fail before you write any implementation.
2. Run the test to confirm it fails: `npm run test -- [test-file]`
3. Record the failure output.

### GREEN Phase
1. Write the MINIMUM code to make the test pass.
2. Run the test again: `npm run test -- [test-file]`
3. Confirm the test passes.

### REFACTOR Phase
1. Clean up the code while keeping tests green.
2. Run full verification:
   - `npm run type-check`
   - `npm run lint`
   - `npm run test`

3. **Layer B

Maintain Se 6 Implementation?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Se 6 Implementation on getagentictools](https://getagentictools.com/loops/qurore-se-phase-6-implementation?ref=badge)