# Live Coding Workflow

Use this workflow when a builder wants a coding agent to implement product work
inside a reviewed boundary.

The rule is simple: review first, code second. A `continue` verdict plus a
valid context pack authorizes implementation only inside the named boundary.
`verify` authorizes only the proof step. `stop_reframe` blocks coding.

## Golden Chain

| Artifact | Role |
|---|---|
| `examples/live-coding-product-brief.json` | Product brief with actors, evidence, assumptions, and execution boundary. |
| `examples/live-coding-review.json` | Canonical review result with `continue` verdict. |
| `examples/live-coding-context-pack.json` | Implementation handoff allowed by the review. |

Validate the chain before coding:

```text
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements-dev.txt
.venv/bin/python -m unittest discover -s tests
.venv/bin/python scripts/check_review.py examples/live-coding-review.json
.venv/bin/python scripts/validate.py
```

## Copyable Prompts

### 1. Select Working Language

```text
Use Product Design Harness for this session.

Set session_config to:
{
  "working_language": "<en|zh-TW|zh-CN|ja|ko|es|fr|de>",
  "canonical_identifiers": "en",
  "fallback_language": "en"
}

Keep JSON property names, enum values, rule IDs, schema IDs, file paths,
evidence IDs, and verdicts in English. Use the selected working language only
for human-readable explanations and free-text fields.
```

### 2. Pre-Code Review

```text
Before coding, convert this request into a Product Design Harness product brief.

Use schema_version 2.1. Include actor_boundary, including
actor_boundary.target_population, product organization, stakeholder effects,
unresolved assumptions, human judgment boundaries,
evidence receipts, and this exact execution_boundary:

may_do: implement the approved bounded change
must_not_do: expand scope or execute external irreversible actions
must_ask: new stakeholder, data, risk, or scope appears

Then run the smallest responsible review mode. Return only a review result
valid through scripts/check_review.py against schemas/review-result.schema.json.
Do not produce an
implementation plan unless the verdict is continue.
```

### 3. Validate Review Output

```text
Validate the review before using it.

Run:
.venv/bin/python scripts/check_review.py <path-to-review-result.json>
.venv/bin/python scripts/validate.py

If validation fails, fix the review artifact. Do not code from an invalid
review. If the verdict is verify, run only the proof step. If the verdict is
stop_reframe, return the reframed product question.
```

### 4. Context-Pack Handoff

```text
The review verdict is continue. Create a context pack valid against
schemas/context-pack.schema.json.

The context pack must copy the review_id, session_config, actor_boundary,
product_organization, stakeholder_effects, unresolved_assumptions,
human_judgment_boundary, evidence IDs, stop conditions, human approval gates,
and exact execution_boundary from the review.

Implementation may begin only after the context pack validates. Implement only
the scope named in the context pack. Do not expand scope.
```

### 5. Scope Change

```text
Pause implementation and return to Product Design Harness review.

Reason: a new stakeholder, data, risk, or scope appeared.

Summarize:
- what changed
- who is newly affected
- what evidence supports the change
- which boundary item was crossed
- whether the current context pack should continue, verify, or stop_reframe

Do not continue coding until a new valid review and context pack authorize the
changed scope.
```

### 6. Post-Build Feedback Classification

```text
Classify post-build feedback for the next Product Design Harness iteration.

For each signal, separate:
- raw artifact or source
- signal type: quote, observed behavior, product log, support pattern,
  workflow trace, market signal, policy, or derived
- interpretation
- decision impact
- counter-signal
- evidence tier
- unresolved assumption changed by the signal

Return updated evidence receipts. Do not change the product direction unless
the evidence changes the review boundary.
```

## Live-Coding Rules

| Situation | Action |
|---|---|
| `continue` and valid context pack | Code only inside the context-pack scope. |
| `verify` | Run only the proof step; do not build the feature. |
| `stop_reframe` | Stop coding and return the reframed product question. |
| Boundary changes | Pause and run a new review. |
| New post-build evidence | Classify it before deciding the next iteration. |

The implementation agent may decide technical details inside the context pack.
It may not decide whether the product direction, stakeholder boundary, evidence
bar, or human judgment boundary changed.
