# {{STREAM_NAME}} Implementation Loop

Dirtyloop version: `2`

Execution profile: `{{EXECUTION_PROFILE}}`

Canonical tracker: Beads epic `{{EPIC_ID}}`

Accepted plan: `{{PLAN_SOURCE}}`

Beads owns state. These docs preserve accepted intent and execution context.

## Goal

{{STREAM_GOAL}}

## Scope And Non-Goals

{{STREAM_SCOPE_AND_NON_GOALS}}

## Settled Decisions

{{SETTLED_DECISIONS}}

## Stream Acceptance Evidence

{{STREAM_ACCEPTANCE_EVIDENCE}}

## Sources Of Truth

- Beads epic: `{{EPIC_ID}}`
- Accepted plan: `{{PLAN_SOURCE}}`
- Roadmap: `docs/implementation/{{STREAM_SLUG}}/00-roadmap.md`
- Phase docs linked from Beads
- Turn docs: `docs/implementation/{{STREAM_SLUG}}/turn-docs/`
- Resume mirror: `docs/implementation/{{STREAM_SLUG}}/loop-state.md`
- Runtime generation: `docs/implementation/{{STREAM_SLUG}}/runtime/generation.json`
- Harness binding: `docs/implementation/{{STREAM_SLUG}}/runtime/binding.json`
- Pi adapter policy when present: `docs/implementation/{{STREAM_SLUG}}/runtime/adapter.json`

## Control-Plane Invariants

- Select one ready phase, or one approved Wave of dependency-ready qualified tracer-bullet leaves, only when the accepted plan explicitly permits it.
- When broad Phase milestones group work, never claim them. Record phase membership in metadata rather than Beads `parent-child` edges; execute only their qualified tracer-bullet leaves.
- Require `runtime/activation.json` to be ready for the current generated builder closure and coordinator before phase ownership; this state does not certify a separate Program runtime adapter.
- Require a `ready` execution-readiness report before phase mutation. Qualified tracer-bullet Beads leaves may narrow an immutable shared phase doc only when both sources are hashed and the leaf has explicit bounded ownership; clarification or re-slicing is a visible plan amendment, never an automatic rewrite.
- Read its phase doc and write an orchestration brief before broad work.
- Enforce the persisted execution profile as the ownership boundary.
- Within that boundary, choose model, effort, helper missions, concurrency, and coordination from current evidence and capabilities.
- Strongly encourage useful helper subagents during implementation and review. Use at most 20 helper missions per stage; bound active concurrency by user configuration, certified runtime capacity, and available slots. Record a rationale when a non-trivial stage uses none.
- Keep helper missions evidence-driven rather than using a permanent persona catalog.
- In `orchestrator-callback`, keep this control thread orchestrator-only and launch separate implementation and independent review owners with the concrete run-time orchestrator thread ID and one logical terminal-result identity each.
- Keep one owner per mutable checkout and verify repo/worktree/symbolic branch before child mutation or review.
- Bind callback targets at run time whenever callbacks are required or used.
- Acknowledge emitted completion handles and nonces before another child launch.
- Use structured completion callbacks as the normal path with no status, sleep, or wait polling. Reasoned recovery is exceptional, rate-limited, and durable.
- Renew degraded coordinators only at a safe ownership boundary with Beads, turn-doc, PR, branch, checkout, and activation evidence. Do not prescribe a fixed coordinator lifetime or topology.
- Keep one active external implementation PR unless Beads and the accepted plan explicitly permit more. Parallel owner branches may feed that one integration PR.
- Use independent review and resolve CI before completion.
- Update the existing phase turn doc and Beads; file follow-ups instead of widening scope.
- Continue phase-by-phase unless complete, blocked, interrupted, unresolved, or explicitly `--once`.

## Phase Ledger

| Beads Issue | Phase | Outcome | Phase Doc | Depends On | Status |
|---|---|---|---|---|---|
{{PHASE_LEDGER_ROWS}}

## Quality Gates

{{QUALITY_GATES}}

## Branch And PR Constraints

{{BRANCH_PR_POLICY}}

## Storyboard

On epic completion, generate `docs/implementation/{{STREAM_SLUG}}/storyboard-post-run-{{MM_DD_YYYY}}.html`. Use `impeccable` when available and `@pierre/diffs/ssr` for every diff.
