Skip to content
Skills Library
Programming · Building & coding

implement

/implement

Use when implementing from a GitHub issue with a vetted in-body plan (run /design first). Materialize, implement, validate, review, PR, CI. See /research, /design, /im, /f, /implement --merge.

Repository
larch ↗
Licence
MIT
Last repository change
08.09.2026

Assessment and security

95/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content30 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
92
Scripts
30
HTML comments
21
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 08.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 30 scripts in this package. Review them before installing, as Claude may execute them.
  • SKILL.md zawiera komentarze HTML (21). Nie widać ich w podglądzie Markdown, a model je czyta.

Scripts: scripts/flush-execution-issues.sh, scripts/hook-stop-fail-close.sh, scripts/oos-disposition-checkpoint.sh, scripts/oos-disposition-gate.sh, scripts/post-tracking-issue.sh, scripts/refresh-execution-issues.sh, scripts/run-step-checks.sh, scripts/step-0-bootstrap.sh, scripts/step-0-degraded-gate.sh, scripts/step-18.sh, scripts/step-19.sh, scripts/step-2-post-dispatch.sh, scripts/step-5-resume.sh, sc

What it does and when to use it

Use when implementing from a GitHub issue with a vetted in-body plan (run /design first). Materialize, implement, validate, review, PR, CI. See /research, /design, /im, /f, /implement --merge.

Arguments

/implement [--merge] [--forked] [--draft] [--no-admin-fallback] [--no-logs-commit] [--coder <claude|codex|cursor>] [--run-id <ID>] 
Original author description

Use when implementing from a GitHub issue with a vetted in-body plan (run /design first). Materialize, implement, validate, review, PR, CI. See /research, /design, /im, /f, /implement --merge.

How it works

  1. Load-Bearing Invariants
  2. NEVER List
  3. Progress Reporting
  4. Extracted Script Registry
  5. Bash block prelude
  6. Verbosity Control
  7. Rebase Checkpoint Macro
  8. Checks Failure Entry Macro
  9. Durable Bail to Step 18 Macro
  10. Flags
Original SKILL.md headings · 873 lines, 16,779 words
SKILL.md preview
---
# larch-run-lifecycle: shared-v1 skill=implement
# Referenced implement script files:
# skills/implement/scripts/step-architectural-invariants-write-compose.md
# skills/implement/scripts/step-architectural-invariants-write-compose.sh
# skills/implement/scripts/step-architectural-guidelines-write-compose.md
# skills/implement/scripts/step-architectural-guidelines-write-compose.sh
# skills/implement/scripts/test-architectural-guidelines-step.sh
# skills/implement/scripts/test-architectural-guidelines-step.md
name: implement
description: "Use when implementing from a GitHub issue with a vetted in-body plan (run /design first). Materialize, implement, validate, review, PR, CI. See /research, /design, /im, /f, /implement --merge."
argument-hint: "[--merge] [--forked] [--draft] [--no-admin-fallback] [--no-logs-commit] [--coder <claude|codex|cursor>] [--run-id <ID>] [--force|-f] [--self-review] [--self-implement] [--difficulty <TRIVIAL|MODERATE|HARD>] <issue-N>"
allowed-tools: AskUserQuestion, Bash, Read, Edit, Write, Grep, Glob, Agent, Task, WebFetch, WebSearch, Skill
---

**MANDATORY: `implement`: Rust owns lifecycle start/finish (`skills/shared/run-lifecycle-ownership.tsv`). Never run the generic lifecycle (`${CLAUDE_PLUGIN_ROOT}/skills/shared/run-lifecycle.md`). Send `--lifecycle-parent-context` only to Step 0.**
# Implement Skill

**MANDATORY: READ ENTIRE FILE before composing user-facing prose: `${CLAUDE_PLUGIN_ROOT}/skills/shared/readability-style.md`.**

End-to-end: fetch the vetted `larch:plan`, materialize artifacts, implement, validate, commit, review, ship the PR, monitor CI, and clean up. With `--merge`: also run CI+rebase+merge, delete the local branch, verify main, and have the active Step 8+ driver checkpoint the run-log manifest plus `scripts/larch.sh final-report write` before exit. The tmpdir/tracking summary may reflect `MERGE_RESULT` without any post-merge `git commit` (NEVER #16). Step 18 owns the complete terminal snapshot and publication. Step 19 owns cleanup.

**Protocol Execution Directive.** You are the `/implement` orchestrator. After flag parsing and mutual-exclusion checks, your FIRST external actions MUST be: (1) when `forked_target=true`, run `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" admission fork-env` once and parse `UPSTREAM_REPO` plus sibling fork KV lines from stdout; (2) run exactly one `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" implement preflight` call as the sole mechanical surface for Preflight items 1-3, passing `--repo "$UPSTREAM_REPO"` when forked; (3) after prompt-side Preflight judgment, run Step 0 unchanged through `${CLAUDE_PLUGIN_ROOT}/skills/implement/scripts/step-0-bootstrap.sh --mode initial`. Prompt-side judgment starts only after helper exit `0`. Item 4 is the main-agent plan-adequacy audit when `force_requested=false`; force skips it and proceeds to item 6. Item 6 remains the semantic materiality judgment after `AUDIT=pass` or force skip. When `forked_target=true` and `UPSTREAM_REPO` is already set from (1), **do not** re-run `scripts/larch.sh admission fork-env`; reuse the fork metadata to avoid a second bootstrap tmpdir.

**Anti-halt continuation reminder.** After each child `Skill` call (`/review`, `/issue`, `/implement`) and each numbered or sub-step `Bash` helper, including `scripts/larch.sh checks run-relevant`, IMMEDIATELY continue to this skill's NEXT numbered step. Do NOT stop on cleanup output, Bash stdout, status, summary, handoff, recap, or "returning to parent" prose. For bgjob-migrated steps, `WAIT` means the next action is another identical `bgjob wait`; after final `DONE`, parse required KVs from the last `DONE` stdout and `$IMPLEMENT_TMPDIR/bgjob/<step>.result.env`. Applies from Preflight through Step 19 except explicit non-sequential directives in THIS file (`skip to Step N`, `bail to cleanup`, `jump back`, `loop back`, `fall through`, `break out`). Every relevant-checks helper call is covered. **Critical boundary: Step 9b PR creation → Step 10 CI monitor immediately; PR creation is NOT the end.** **Critical boundary: when the active Rust Step 8+ `ship pr` driver exits, route only from process exit code + JSON stdout; do not parse `ship-pr-state.sh` or the retired bash exit matrix.** **Critical boundary: after `route-exit` emits `NEXT_ACTION=ci-fix`, do NOT end the turn; run the ci-fix repair procedure in the same turn.** **Critical boundary: after preflight audit passes (`AUDIT=pass`), continue through Preflight items 6-7, then run Step 0 `${CLAUDE_PLUGIN_ROOT}/skills/implement/scripts/step-0-bootstrap.sh --mode initial`; do NOT end the turn on the audit-pass envelope. Critical boundary: after the force plan-adequacy audit skip breadcrumb prints, continue through Preflight items 6–7, then run Step 0; do NOT halt waiting for an `AUDIT=pass` envelope on the force skip path.** **Terminal boundary: the combined Step 16-17 wrapper only captures a pending final-report body; Step 18 terminalizes and publishes logs, Step 19 cleans up and relays the teardown tail, then the selected final-report body is the last plain-chat text with no following tool call.** → shared/subskill-invocation.md#anti-halt

**Skill-name fallback reminder.** When invoking a child skill via the Skill tool from this file, ALWAYS try the bare name first (`"design"`, `"review"`, `"issue"`, `"implement"`). Use the fully qualified `larch:` form (`"larch:design"`, etc.) only after bare-name lookup returns `Unknown skill`; in a consumer repo with a different plugin namespace, use that namespace as the fallback. `/implement` does not invoke relevant-checks through the Skill tool on the green path; it uses the captured Rust checks helper so success returns one bounded machine line, or `RELEVANT_CHECKS_SKIPPED=true` only on explicit `--allow-skip` test paths. Phase 1 (#3364) does not invoke `/release`; versioning moves to `/release` (Phase 3). Do NOT mirror this skill's own namespaced invocation (`larch:implement`) onto child Skill calls. → shared/subskill-invocation.md#bare-name-fallback

## Load-Bearing Invariants

Two invariants enforced across multiple steps. Anchor cross-step questions here; do not re-derive inline.

1. **Step 9a.1 OOS Sentinel Idempotency** — re-running `/implement` in the same session MUST NOT double-file vote-accepted non-security OOS. **Enforcement**: Rust-owned `${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh oos file` reads accepted inputs, the sentinel, and run NDJSON; binds prior URLs by stable ID/title; and files only unmatched blocks. **Why**: durable evidence makes retries deterministic.

**Fork-mode carve-out for Invariant #1**: when `forked_target=true`, Rust creates no public OOS issue, records `skipped://oos/<N>` evidence, checkpoints, and preserves accepted items in final-report text. CI comparison uses `upstream/main` via `scripts/larch.sh push rebase --base-remote upstream --base-ref main` and `scripts/larch.sh ci status --base-remote upstream --base-ref main`.

2. **Tracking-Issue Sentinel Idempotency** (umbrella #348) — re-running `/implement` in the same session MUST NOT double-adopt the wrong issue or corrupt `RUN_ID`. **Enforcement**: Step 0 checks `$IMPLEMENT_TMPDIR/parent-issue.md`; on retry it recovers prior `ISSUE_NUMBER` and `RUN_ID`, skipping Branch 2 adoption, `run-log init`, and `scripts/larch.sh tracking post-issue`. Write the sentinel ONLY after `ISSUE_NUMBER`, `RUN_ID`, and the metadata summary comment resolve. If `run-log init` fails, set `IMPLEMENT_BAIL_REASON=tracking-init-failed`, `STALL_TRACKING=true`, skip the sentinel, skip to Step 18, and **preserve `$ISSUE_NUMBER`** so Step 18 can rename the issue to `[STALLED]` when applicable. Reserve `DEFERRED=true` for the non-stalled metadata-publication defer path (`POSTED=false` / no sentinel, then continue within Step 0). **Why**: `"$CLAUDE_PLUGIN_ROOT/scripts/larch.sh" tracking-issue upsert-summary` uses marker literals for the four slim comments, but the local sentinel remains the byte-exact session guard, parallel to Invariant #1.

## NEVER List

Each rule states WHY; per-site reminders reference by anchor name.

1. **NEVER simply "log and return" on push failure in the Step 12 merge loop inside the active Step 8+ driver.** **Why**: `scripts/larch.sh ci wait` and `scripts/larch.sh merge pr` operate on remote PR state only; a log-and-return would let the merge loop proceed to `ACTION=merge` on a remote branch that never received the fix push. **How to apply**: Step 10 CI-fix paths may degrade gracefully; Step 12 family MUST bail to 12d.

2. **(removed in Phase 1 #3364 — bump verification on the ship path; see `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/conflict-resolution.md` retirement stub.)**

3. **NEVER use the `ours`/`theirs` git labels when describing conflict sides during rebase.** **Why**: during rebase their semantics are inverted vs. merge (`--ours` = base being rebased onto = upstream main); labels cause silent resolution errors. **How to apply**: always use "upstream (main)" and "feature branch commit" in Phase 1 commentary and user prompts.

4. **NEVER skip the code-review step regardless of the nature of changes.** **Why**: code, skills, docs, data, and config all require reviewer-panel vetting. **How to apply**: on the standard path, Step 5 invokes `skills/implement/scripts/step-5-review.sh` once per Step 5 entry; that launcher prints the banner, forwards session-env and tmpdir context, and launches the file-backed `review-and-fix CLI` review loop **without** any `--panel` token (see `crates/larch-cli/tests/review_and_fix_commands.rs`). `review-and-fix step5` uses `$IMPLEMENT_TMPDIR/plan.txt` and a fixed cap of 2 for every tier; degraded rounds consume the active budget, and escalated rounds skip pruning. The review panel is applied only inside `review-and-fix CLI` → `review core`. **`--self-review` exception**: when `self_review=true`, Step 5 skips `review-and-fix step5` and a Claude Agent-tool subagent (`larch:claude-self-reviewer`) performs thorough self-review; review still runs.

5. **NEVER let the Step 9a.1 sentinel short-circuit silently skip the larch-log OOS update.** **Why**: recovery MUST write accepted-OOS evidence; silent skip breaks durable logs. **How to apply**: let `${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh oos file` re-read sentinel/NDJSON evidence, materialize recovery rows, checkpoint, then write statistics. Never add a prompt-side sentinel branch. On the security continuation, retained #7681 routing writes statistics only after the Rust disposition checkpoint succeeds (NEVER #14). Fork mode follows Invariant #1.

6. **NEVER let the focus-area enum drift out of checked review prompt surfaces.** **Why**: `.github/workflows/ci.yaml` inspects the canonical review/design prompt files for the unquoted focus-area enum; Step 5 now delegates prompt construction to review scripts instead of embedding prompt strings here. **How to apply**: when moving review prompt text between scripts or skill files, update the CI file list in the same PR so the surface containing `code-quality / risk-integration / correctness / architecture / security` remains checked.

7. **NEVER bail mid-run on orchestrator-judgment "scope" or "capacity" concerns without a mechanical justification.** **Why**: `/implement` is designed for long autonomous runs. Subjective remaining-work judgments are NOT valid bail reasons. The only sanctioned non-error halt paths between Step 2 and Step 19 are: (a) Step 12d under documented judgment conditions; (b) explicit user halt in a fresh interactive turn; (c) hard tool failure. **How to apply**: follow the next explicit control-flow directive unless a sanctioned halt path applies. **Post-merge sub-clause (highest-stakes halt boundary)**: the `✅ 12: CI+merge loop status=complete outcome=merged pr=<N> elapsed=<elapsed>` line at Step 12b, and the analogous `✅ 12: CI+merge loop status=complete outcome=force-merged-externally pr=<N> elapsed=<elapsed>` line at Step 12a's `already_merged` branch, is the most halt-prone point. The run is not done: Steps 14, 15, 16, 17, 18, and 19 still must run. Ending the turn, posting a recap, or writing a handoff between that breadcrumb and Step 14's first action violates NEVER #7. `pr_closed=true` and `DONE_RENAME_APPLIED=true` are PRE-conditions for Steps 14-19, not POST-conditions of a finished run.

8. **NEVER call `ScheduleWakeup` anywhere in the `/implement` orchestrator.** **Why:** improvised wakeups re-fire as `/loop` input and can extend turns past Step 19. **How to apply:** do not call `ScheduleWakeup` at any step. Do not spawn a Monitor or a Bash polling loop (`for`/`while`/`until` + `sleep`) to watch another helper finish. Long helpers use bgjob start/wait (`run-step-checks.sh`, Step 5 `step-5-review.sh`, Step 5 `step-5-resume.sh`, Step 6 `step-6-entry.sh`, Step 7a, Step 8 `step-8-ship.sh`, and `checks repair-loop --bgjob-launch true`): after `BGJOB_STATUS=WAIT`, run the identical `bgjob wait` again with no intervening prose or tools. See `${CLAUDE_PLUGIN_ROOT}/skills/shared/bgjob-wait.md` for the normal wait contract. **NEVER use the `Monitor` tool anywhere within the `/implement` orchestrator.** During bgjob waits, do not use Monitor, TaskOutput, task output reads, sleep, or alternate progress probes between identical `bgjob wait` calls. Step 8 reads the merged ship outcome KVs from its result env on `DONE`; it does not infer success from `BGJOB_RC=0` alone. Do not use `ps`, Monitor, TaskOutput, or background recovery waiters. Do NOT spawn multiple Monitor calls watching logs or PID exits.

9. **NEVER branch Step 2 on `STATUS` before completing §2.1.5 envelope validation.** **Why**: the dispatcher emits `ORCHESTRATOR_EDIT_AUTHORITY=allowed|forbidden`, with `allowed` iff `STATUS=claude_fallback`; any illegal pairing or malformed envelope lets Claude-fallback plan edits start while an external implementer still owns commits (issue #1058). **How to apply**: after parsing §2.1 KV stdout, always run all §2.1.5 checks before §2.2 branches on `STATUS`. On failure, synthesize `orchestrator-envelope-invalid`; do not enter Step 3 or consume `MANIFEST`.

10. **(removed — see issues #2485 / #2487; the post-/design boundary halt rule and its archival hook scripts were deleted after the issue-anchored cutover.)**

11. **NEVER write, recreate, or modify `$IMPLEMENT_TMPDIR/finalize-state.sh` from prompt-side orchestrator code.** **Why**: the ship lifecycle and Rust `implement-finalize` owner write it on terminal outcomes before returning JSON; a prompt-side subset triggers `state-file missing required key` teardown cascades and stale session tmpdirs. **How to apply**: do NOT write it by `cat`, `printf`, `echo`, Write, `sed -i`, `tee`, or any other means. The only pre-teardown reconstructor is conditional `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" session restore-finalize-state`, per Step 19. If `scripts/larch.sh implement-finalize teardown` reports `state-file missing required key` and `ship-pr-state.sh` is absent, surface the error and stop; do NOT compose the file from prompt-side shell variables. See Step 19 cleanup.

12. **NEVER write, append to, or recreate `$IMPLEMENT_TMPDIR/session-env.sh` from prompt-side orchestrator code.** **Why**: child scripts read it on each invocation; prompt-side `>>`, heredoc rewrites, or `printf` fixups bypass the writer's anchored filter and post-condition assertion, reproducing issue #2326's incomplete Step 1 materialization. **How to apply**: sanctioned writers are `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" session write-env`, `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" session setup`, `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" session persist-run-flags`, and the Rust-owned `bootstrap invoke` flow. The plan file is always `$IMPLEMENT_TMPDIR/plan.txt`; child scripts do not read `PLAN_FILE` from `session-env.sh`. If plan logging or Step 5 fails because that path is missing, repair Step 1 materialization. The orchestrator may only READ via `CLAUDE_PLUGIN_ROOT="$CLAUDE_PLUGIN_ROOT" "${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" session read-key` or invoke the sanctioned writers.

13. **(removed — see issue #3111 Stage 4; Family-B background+monitor pairs are deleted.)**

14. **NEVER silently drop a voted-in OOS finding.** **Why**: accepted OOS blocks are the durable contract between reviewers, manifests, and Step 9a.1 disposition. Losing them breaks auditability and follow-up tracking. **How to apply**: non-security accepted OOS is filed by the pre-driver `${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh oos file` path before `step-8-ship.sh`; that Rust path owns disposition-checkpoint, run-statistics, and manifest `steps_ran.step9a1` stamping via `crates/larch-cli/src/oos_file_commands.rs:after_checkpoint`. `references/oos-pipeline.md` documents the Rust pipeline and must not become a prompt-side `/issue` fallback. On `NEXT_ACTION=oos-pipeline`, read `$IMPLEMENT_TMPDIR/security-oos-observations.md`, follow `${CLAUDE_PLUGIN_ROOT}/docs/security/workflow-trust-and-mutations.md` `## Security Findings in OOS Workflows` privately with no public `/issue`, clear the sidecar only after private disposition completes, then run the Step 8 checkpoint wrapper with no `/issue` call. Do not run prompt-side direct `oos disposition-checkpoint`, compose run statistics, or patch `OOS_PENDING=false` outside that wrapper.

15. **NEVER set `OOS_PENDING=false` outside retained #7681 `scripts/larch.sh implement step-8-oos-checkpoint` workflow-router success** (fork-mode and `repo_unavailable=true` skip this gate intentionally). **Why**: `OOS_PENDING` gates ship-pr progress until accepted OOS blocks have filed issue URLs, `Inline-triage rule N:` breadcrumbs, rejection markers, or private security disposition. **How to apply**: invoke the checkpoint wrapper after security-sidecar disposition when applicable and before or at the Step 8 OOS checkpoint wrapper on the `oos-pipeline` branch, or after pre-driver `${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh oos file` on the normal path. Only checkpoint `NEXT_ACTION=reship` may write run statistics, stamp the manifest, and clear `OOS_PENDING=false` through the allowed-key patch helper.

16. **NEVER make any git commit after the PR has merged**, regardless of branch or path. **Why**: `/implement` MUST NOT advance repo history after merge, especially on `main`. Commits after `$IMPLEMENT_TMPDIR/post-merge-sentinel` strand on local main and can break later cleanup or pulls. Past regressions: #2120, #2128, #2140, #2182, #2552. **How to apply**: all post-merge git commits are policy violations. Step 18 validates, sanitizes, and publishes the staging tree through the archive publisher. Do NOT add callers that commit run logs to Git. Do NOT re-render and Git-commit the final summary; re-render in tmpdir only. `scripts/larch.sh final-report write --comment-only` must remain API-only. See `docs/run-log-cli.md` and the Rust ship lifecycle docs.
17. **NEVER write a free-form natural-language recap summary at end of turn after Step 17, Step 18, or Step 19**: including but not limited to a "Run complete." / "Implementation merged." prose line, a bullet list summarizing PR / Version / Changes / Code review / CI / Tracking issue, a parenthetical cost paraphrase (for example `~$10.46`, `~$X total`), or any natural-language replacement for the structured `## /implement run ...: <outcome>` block rendered into `summary-final.md` by `scripts/larch.sh implement step-16-17` through `scripts/larch.sh implement step-17 --no-print-stdout` and marker extraction. **Why**: free-form summaries either omit the canonical `- **Cost**:` line or paraphrase it as a TOTAL-only figure, dropping the per-agent breakdown (`Claude $X, Codex $X, Cursor $X`) users depend on. **How to apply**: Step 17 and Step 18 capture candidate marker bodies until Step 19 finishes cleanup. Follow the marker-first profile in `${CLAUDE_PLUGIN_ROOT}/skills/shared/final-summary-emit.md` with `/implement` markers `---LARCH-SUMMARY-FINAL-BEGIN---` / `---LARCH-SUMMARY-FINAL-END---`. Step 17 binds the source to captured foreground `scripts/larch.sh implement step-16-17` Bash wrapper stdout, not asynchronous notification output, and caches any non-empty body for deferred terminal emit. Step 18b binds the source to captured foreground `scripts/larch.sh implement step-18-gate-logs-flush` Bash wrapper stdout on `NEXT_ACTION=logs-flush-done`, or captured foreground `step-18.sh --phase logs-flush` Bash wrapper stdout on the stall-recovery path, not asynchronous notification output. Read fallback is `forbidden` for Step 17 and Step 18b. Sidecar follow-on is `forbidden`. Do not emit plain-chat final report text until Step 18 terminalization and Step 19 restore, teardown, and tail relay are complete. The Step 18 wrapper writes `.step17-emitted` before final-report refresh when `--step17-emitted true`, and again before it emits markers; the orchestrator does not write `.step17-emitted` after logs-flush returns. Apply `/implement` terminal-emit precedence from the shared contract: refreshed Step 18 marker body wins when `EMIT_BODY=true`, `WFR_RC=0`, and valid markers are present; otherwise use a non-empty Step 17 cache; otherwise emit only the existing missing-marker warning. If a user message interrupts after logs-flush returns, emit the surviving in-context cached body first in the next turn. Never Read or use a disk cache to reconstruct it. Do NOT add a closing recap, do NOT echo the structured block in your own words, and do NOT mention costs in your own prose. The only final orchestrator-text addition permitted is one verbatim full-body emission from the selected cached Step 18 or Step 17 source at terminal text position. **Verbatim means the entire marker body without omission or condensing.** Do NOT wrap any section in `<details>`, collapse or omit `### Round N reviewer timing` ASCII bar charts, or drop the `**Top reviewers**` list. Every part of the marker body, including all Gantt timing sections, must appear as plain chat markdown exactly as it appears between the markers. The missing-marker warning is printed only when `EMIT_BODY=true` and `WFR_RC=0`. When `WFR_RC!=0`, the final report render genuinely failed: the logs-flush wrapper has already printed `**⚠ Step 18: final report render failed (WFR_RC=<n>): <reason>**` (reason from the `ERROR=` KV) to composite stderr, and that warning is the accounted-for outcome. Do not emit a body, do not Read `summary-final.md`, and do not add free-form recap prose (#6979: an rc-failure path must never be fully silent). No prose or tool call may follow the final verbatim report emission.

18. **NEVER spawn Agent-tool subagents for code-writing work during Step 18a stall recovery.** **Why**: recovery is a single-runner continuation; Agent-tool code edits bypass stall classification, retry caps, and atomic `STALL_TRACKING` clear ordering. **How to apply**: for `step2-impl`, main Claude reads `$IMPLEMENT_TMPDIR/plan.txt`, edits inline, checks, commits, and continues in the current run. Review and ship wrappers may still use their documented external lanes.

19. **NEVER print code-flow diagram bodies to chat.** **Why**: diagram content belongs only in the issue-scoped `larch:diagrams` comment and PR body, and printing it bloats context. **How to apply**: do not print `$IMPLEMENT_TMPDIR/code-flow-diagram.md`, `$IMPLEMENT_TMPDIR/code-flow-section.md`, or any `## Code Flow Diagram` section body. Step 7a emits breadcrumbs and KVs only.

20. **NEVER copy diagram failure captures into published implement run logs.** **Why**: generator or sanitizer captures may contain partial Mermaid. **How to apply**: do not copy or flush `code-flow-diagram.failure.log`, code-flow diagram body files, or generator/sanitizer stdout containing Mermaid into `larch-logs/implement/<RUN_ID>/`; durable diagnostics are bounded `execution-issues.md` warnings only.

21. **NEVER make Edit, Write, or repo-mutating Bash calls on git-tracked paths between Preflight item 6 and `BOOTSTRAP_NEXT=step2`.** **Why**: pre-bootstrap edits bypass the dirty-tree checkpoint; partial exits remain gated. **How to apply**: item 6 is a **read-only bounded probe** (`test -f`, `test -e`, targeted `rg`/`grep`) except `$PREFLIGHT_TMPDIR/**`, the stale-notice comment, and `plan-receipt refresh` after a sole `stale-plan-base-scope` finding clears. Deeper work and tracked edits wait for exit 0 plus `BOOTSTRAP_NEXT=step2`. **Carve-out — rebase-routing**: on `BOOTSTRAP_NEXT=rebase-routing`, follow `rebase-checkpoint-routing.md` and `conflict-resolution.md`; only `larch:ci-fixer` `MODE=conflict` edits feature-branch conflicts. Repeat the gate before every `step-0-bootstrap.sh` fence.

**Single-runner assumption**: run one `/implement` per repository at a time. Concurrent sessions can interleave working-tree mutations, corrupt dirty-tree probes, or attribute one runner's edits to another. The inverse hazard — mistaking one of your OWN spawned subprocesses' edits (the `checks repair-loop` lint-fix tiers, the Step 3 pre-commit ruff autofix) for a concurrent runner — is guarded by the self-edit attribution log at `$IMPLEMENT_TMPDIR/self-edit-log.tsv`; consult it (see `references/checks-repair-loop.md` §6) before halting on a suspected parallel session. Dirty-tree guards reduce blast radius but do not serialize writes. Between Step 0 and documented checkpoint probes, `/implement` and child skills write only to session tmpdirs (`$IMPLEMENT_TMPDIR`, `$DESIGN_TMPDIR`, `$REVIEW_TMPDIR`) until implementation intentionally edits the repo.

**Mode matrix**:

| Mode | PR target | Tracking issue lifecycle | Version bump | CI base comparison | Merge |
|---|---|---|---|---|---|
| Default | `$REPO` from session setup | enabled | skipped (Phase 1) | `origin/main` | skipped |
| `--merge` | `$REPO` from session setup | enabled | skipped (Phase 1) | `origin/main` | enabled |
| `--forked` | `$FORK_REPO` from origin | disabled | disabled | `upstream/main` | disabled |

## Progress Reporting

Every step MUST print breadcrumb status lines per shared/progress-reporting.md: start lines on entry, bounded progress lines for long work, and completion lines from wrappers.

**MANDATORY at session start**: Read `${CLAUDE_PLUGIN_ROOT}/skills/implement/scripts/step-name-registry.tsv` to get the Step Name Registry (step number → short name mapping for progress breadcrumbs).

**Phase 1 (#3364)**: Do not print orchestrator `🔶` / `⏩` / `✅` breadcrumbs for ship-pr substeps **8**. The Rust dispatcher owns launch and checkpoint routing, while the Rust `ship pr` owner emits the internal state-machine contract.

**Generated-file rebase conflicts:** the ship driver treats every non-run-log conflict as an existing conflict-route handoff. At Step 8b, the driver persists `RESUME_PHASE=ship-pr-rrr-phase14`, `CALLER_KIND=ship_pr_pre_push`, and `CONFLICT_FILES`, then lets `ship route-exit` emit `NEXT_ACTION=conflict-fix`. Do not invent conflict metadata prompt-side beyond the driver-provided `CONFLICT_FILES`.

## Extracted Script Registry

Load `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/extracted-script-registry.md` only when editing or auditing extracted `/implement` script contracts.

## Bash block prelude

The Claude Code Bash tool does NOT preserve shell state between calls. Step 0 emits `$IMPLEMENT_TMPDIR/larch-run.sh` and the PID-keyed stable launcher, using the top-level Bash-tool `$PPID` captured by the Step 0 fence. Every post-Step-0 Bash fence that calls a plugin script MUST delegate through that stable launcher:

```text
"$HOME/.cache/larch/sessions/implement-run-$PPID.sh" <relative-script-path> ...
```

Post-Step-0 fences have exactly one nonblank, noncomment physical line. Do not source `plugin-root.env` inline, source session pointers, export variables, use continuations, or add inline shell logic. The `LARCH_CLAUDE_PID="$PPID"` prefix on the Step 0 fence is a plain environment-variable-prefix assignment, not post-Step-0 shell logic. Put foreground markers, anti-halt reminders, and rationale in prose outside fences. Each fence is a thin launcher invocation.

Pre-bootstrap fences keep their existing shapes. Step 0 initial bootstrap may keep the source guard plus the one-line `larch-run.sh --print-plugin-root` fallback (the generated launcher owns the `session-env.sh` parse). The single Preflight helper fence may keep its inline `preflight_args` assembly. Do not generalize those old shapes to post-Step-0 fences.

Sourcing full `session-env.sh` remains forbidden because it imports the whole namespace and can shadow caller state. Rust-owned `bootstrap invoke` emits the tmpdir-local launcher only after Step 0 `session write-env` succeeds, then `session write-implement-env` writes the PID-keyed stable launcher. All later script argv assembly belongs inside wrappers.

## Verbosity Control

Follow shared/verbosity-control.md rules.

**Preserved:** step breadcrumbs (`🔶`, `⏩`, `⏭️`), warning/error lines, structured summaries, plans, design decisions, code-review findings, and the final report.

**Suppressed:** explanatory prose, script paths, inter-call rationale, and per-reviewer completion messages. Rebase-skip cases at Steps 1.r, 4.r, 7.r, and 7a.r silently continue unless the referenced routing file says otherwise.

## Rebase Checkpoint Macro

Standardizes post-step rebase checkpoints 1.r, 4.r, 7.r, and 7a.r. Step 4.r is folded into Step 3 `checks-commit-route`; 7.r into Step 6 `step-6-entry`; 7a.r into `step-7a`. Each site routes through `rebase-checkpoint-routing.md` only when its composite emits `CHECKPOINT_NEXT=load-routing` or a malformed/missing routing KV.

**Thin implementation**: `${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh push checkpoint-probe` owns full argv, exit codes, and KV grammar in `skills/implement/references/rebase-checkpoint-routing.md`. Checkpoint **4.r** is folded into Step 3, **7.r** into Step 6, and **7a.r** into Step 7a. The absorbed **1.r** checkpoint is inside Step 0 bootstrap; route only on `BOOTSTRAP_NEXT=rebase-routing` and load the routing reference then.

**Registry identifiers:** `1.r` / `1.m` remain stable macro `<step-prefix>` tokens listed in `skills/implement/scripts/step-name-registry.tsv`; they label internal rebase checkpoints, not standalone orchestrator steps after plan materialization folded into Step 0.

**Conditional routing reference**: Absorbed `1.r`: branch only on `BOOTSTRAP_NEXT=rebase-routing` from the Step 0 bootstrap stdout envelope. Parse `ROUTE=`, `REBASE_RC=`, conflict detail KVs, and advisory `PHANTOM_*`. If `ROUTE=conflict` but no conflict files are present because the rebase auto-committed after earlier conflict resolution, follow `rebase-checkpoint-routing.md` phantom-probe instructions. When `DEGRADED_PROMPT_REQUIRED=true` on the absorbed `1.r` path, **MANDATORY: READ ENTIRE FILE** `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/bootstrap-recovery.md` for degraded-prompt handling before treating absent routing keys as rebase failure. Folded `4.r`, `7.r`, and `7a.r`: parse `CHECKPOINT_NEXT=continue|load-routing` from captured stdout. `CHECKPOINT_NEXT=continue` is the only macro no-op predicate (skip the routing reference). Missing or malformed `CHECKPOINT_NEXT` fails closed: **MANDATORY: READ ENTIRE FILE** `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/rebase-checkpoint-routing.md`. On `CHECKPOINT_NEXT=load-routing`, load that reference and branch on `ROUTE=`, `REBASE_RC=`, `REBASE_OUTCOME=`, and related KVs inside it. Do not use `ROUTE=continue` alone as the skip predicate when `CHECKPOINT_NEXT` is missing or malformed. The `7.r` macro skip is `CHECKPOINT_NEXT`-only. The `7a.r` macro skip is `CHECKPOINT_NEXT`-only.

## Checks Failure Entry Macro

Use this macro after Step 3 emits `STATUS=fail` or a folded composite emits `NEXT_ACTION=checks-failed`; the failure path remains in-step. Call sites should invoke **Checks Failure Entry Macro** by name with their pinned `--site` / `--checks-site` arguments instead of restating these read steps.
1. At folded sites, key-scan the full composite stdout for both `DIGEST_FILE` and `REDACTED_LOG_FILE`, not only the first physical composite line. Do not Read either file on the checks-repair path; never read raw `LOG_FILE`. `REDACTED_LOG_FILE` remains the input passed to `checks repair-loop`, and a later `NEXT_ACTION=main-agent-edit` handoff materializes bounded subagent evidence from it.
2. **MANDATORY: READ ENTIRE FILE**: `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/checks-repair-loop.md`.
3. Follow that reference's pinned site split for the call site, including re-entry and folded-site recapture rules.

## Durable Bail to Step 18 Macro

**MANDATORY: READ ENTIRE FILE**: `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/step5-review-branches.md`; follow its **Durable Bail** section with pinned `STALL_STEP=5`.

## Flags

**Invocation contract**: Accept one leading `--lifecycle-parent-context <absolute-context-path>`; bind `LIFECYCLE_PARENT_CONTEXT` and remove it. Reject other forms before Preflight.

**Flags**: Parse flags from the start of `$ARGUMENTS` before the positional issue. Flags may appear in any order. **All boolean flags default to `false`.** Set a mental flag to `true` only when its listed token appears. `--force` and `-f` both set `force_requested=true`. Strip recognized flags before binding the issue.

| Flag | Default | Purpose |
|------|---------|---------|
| `--merge` | `false` | Enable CI+rebase+merge loop (Steps 12–15) and related merge surfaces |
| `--no-admin-fallback` | `false` | No-queue Step 12b: skip admin and try a plain merge after the eligibility gate |
| `--no-logs-commit` | `false` | Suppress terminal implement archive publication |
| `--forked` | `false` | Fork-CI dry-run against `origin` / `upstream/main`; disables tracking-issue lifecycle, merge |
| `--draft` | `false` | Create PR as draft; implies no merge loop |
| `--force` / `-f` | `false` | Skip the item 4 plan-adequacy audit entirely (no `AUDIT=refuse` result exists to downgrade). Downgrade the three remaining fail-closed Preflight gates — missing plan, malformed plan, and `missing-designed-prefix` — to warn-and-proceed; warn loudly on each triggered bypass. Keeps the helper-side plan-block fallback. Does not affect coder selection. |
| `--self-review` | `false` | Skip the external review panel; a Claude Agent-tool subagent (`larch:claude-self-reviewer`, same model family as the orchestrator) performs thorough self-review at Step 5 instead of the main agent |
| `--self-implement` | `false` | Force `coder=claude` (skip external implementers). Step 2.4 Claude-fallback plan work always runs via `larch:claude-implementer` whether or not this flag is set; the flag only forces the Claude coder selection. Independent of `--force`. |
| `--difficulty <TRIVIAL\|MODERATE\|HARD>` | empty | Set the starting Step 5 review tier. The override beats rating and floors, logs `override_source=operator`, and the 1:30 audit can still upgrade a below-HARD run while preserving both fields. |
| `--coder` | unset | Pin external implementer to claude, codex, or cursor when set; otherwise availability waterfall. Ignored when `--self-implement` is active (always forces claude subagent). |
| `--run-id <ID>` | empty | Optional stable run id |

**Mutual exclusion**: reject `--forked` with `--merge`, `--draft` with `--merge`, and `--force` / `-f` with `--draft`, printing the exact warning named by the pair and exiting before Preflight. (`--force` / `-f` and `--merge` are **compatible**: use both for a forced fix through CI and automatic merge.) The `--force` / `-f` and `--draft` together case uses the third warning. Exact warnings: `**⚠ --forked and --merge are mutually exclusive. Aborting.**`; `**⚠ --draft and --merge are mutually exclusive. Aborting.**`; `**⚠ --force and --draft are mutually exclusive. Aborting.**`.

**Positional `<issue-N>` (required)**:

1. After flag parse, **exactly one** positional token must remain and MUST match `^[0-9]+$`. Bind it as `TARGET_ISSUE_NUMBER` for Preflight and Step 0 tracking adoption (authoritative subject issue for the run).
2. If any **non-flag** token remains that is **not** all digits (a verbal feature description or extra args), print verbatim:

`**❌ /implement no longer accepts a verbal feature description. Run /design <issue-N> first to write a plan to the issue body, then re-run /implement <issue-N>.**`

and exit **2** (orchestrator stop — do not start Preflight or Step 0).

3. Removed argv surfaces (must not be accepted as flags here): `--auto`, `--quick`, `--inline`, `--design-only`, `--no-issues`, `--hard`, `--issue`, `--session-env`, `--subagent`, `--design-classification`, `--branch-info`, `--step-prefix`, `--full`, `--dynamic-archetypes`, `--no-dynamic-archetypes`, `--emergency` (replaced by `--force` / `-f`; when `--emergency` is present print `**⚠ /implement --emergency is removed. Use --force or -f instead. Aborting.**` and exit **2** before Preflight).

**`--forked`**: compatible with `--draft`, `--no-logs-commit`, and `--coder`, subject to `--merge` / `--draft` exclusions above. Disable tracking-issue lifecycle. Treat `TARGET_ISSUE_NUMBER`, when set, only as **`UPSTREAM_DESIGN_ISSUE`** context in Step 0 fork tracking resolution, not as a local tracking issue.

## Preflight — issue-anchored plan

Run **before Step 0** after `TARGET_ISSUE_NUMBER` is known and flag mutex checks pass. Use a shell `mktemp -d` preflight tmpdir, not `$IMPLEMENT_TMPDIR` (not created until Step 0). Keep `PLAN_TMP="$PREFLIGHT_TMPDIR/plan-from-issue.txt"` through Step 0 materialization. When `forked_target=true`, `UPSTREAM_REPO` MUST already come from Protocol `scripts/larch.sh admission fork-env`. Run `admission fork-env`, then the preflight helper, then Step 0 bootstrap.

**Force mode (`--force`)**: when `force_requested=true`, read `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/force-mode.md` completely before applying force behavior. Inline item 4 remains authoritative for the skip breadcrumb and no-read / no-audit-file / no-bypass-log contract.

1. **Mechanical Preflight helper (items 1-3)** — `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" implement preflight` is the sole mechanical Preflight surface for admission, issue fetch, plan extraction, force missing/malformed fallback composition, and zero-review provenance refusal (`panel-init-failed`, `panel-skipped`, `rounds_completed: 0`). Invoke it through the verified larch entrypoint:
   ```bash
   [ -z "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -n "${IMPLEMENT_TMPDIR:-}" ] && [ -f "$IMPLEMENT_TMPDIR/plugin-root.env" ] && . "$IMPLEMENT_TMPDIR/plugin-root.env"
   export IMPLEMENT_TMPDIR

   preflight_args=(--issue "$TARGET_ISSUE_NUMBER" --preflight-tmpdir "$PREFLIGHT_TMPDIR")
   if [ -n "${UPSTREAM_REPO:-}" ]; then
     preflight_args=("${preflight_args[@]}" --repo "$UPSTREAM_REPO")
   fi
   if [ "${force_requested:-false}" = true ]; then
     preflight_args=("${preflight_args[@]}" --force)
   fi

   "${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" implement preflight "${preflight_args[@]}"
   ```
   The helper writes `$PREFLIGHT_TMPDIR/issue.json`, `$PREFLIGHT_TMPDIR/plan-from-issue.txt`, and `$PREFLIGHT_TMPDIR/force-bypass.log` only for bypasses.

   After the helper returns:
   - Capture stdout from the Bash tool result.
   - On non-zero exit, abort before item 4 and preserve the helper's exit semantics.
   - Do not parse or require an envelope on non-zero exit.
   - On exit `0`, parse the validated success envelope; `scripts/larch.sh implement preflight` self-validates the success envelope and exits `2` before success parsing when malformed.
   - Parse one `KEY=value` record per line.
   - Split each envelope line at the first `=` only and preserve the remaining value verbatim.
   - Ignore non-envelope warning or prose lines that do not begin with an allowed envelope key plus `=`.
   - Parse only exact allowed preflight envelope keys: `ADMISSION_RESULT`, `RESUME`, `TITLE`, `BLOCK_PRESENT`, `PLAN_PATH`, `ISSUE_JSON_PATH`, `BYPASS_COUNT`, `PLAN_RECEIPT_SCOPE_REVALIDATION`, `PLAN_RECEIPT_PREVIOUS_BASE_SHA`, `PLAN_RECEIPT_TARGET_BASE_SHA`, `DESIGN_DIFFICULTY`, `MAIN_CI_STATUS`, `MAIN_FAILED_RUN_ID`, `MAIN_HEALTH_HEAD_SHA`, and `MAIN_HEALTH_DETAIL`.
   - Bind `PLAN_TMP` from `PLAN_PATH`, bind the three `PLAN_RECEIPT_*` values, and bind the four `MAIN_*` values from the envelope and/or durable `$IMPLEMENT_TMPDIR/main-health.env` before routing. `PLAN_RECEIPT_SCOPE_REVALIDATION=true` is the sole authority for the conditional refresh below; do not route from a prose warning. After `BOOTSTRAP_NEXT=step2`: `fail` without a matching repair marker loads `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/step2-main-health-fix.md`; a matching marker dispatches; `pending` runs bounded `scripts/larch.sh ci main-health --wait`; `error` operator-bails with detail; `pass` continues; `skip` prints `**⚠ /implement: default-branch push CI is unavailable; continuing without main-health verification.**` and continues because the target repo has no configured main-health workflow or no default-branch push workflow runs.

4. **Plan-adequacy audit (main agent, in-prompt only)** — **When `force_requested=true`, skip this audit entirely.** This force audit-skip branch is the first control-flow instruction in item 4 and runs before any mandatory read below: print one skip breadcrumb `⏭️ /implement --force: skipping plan-adequacy audit for issue #<N>; continuing to semantic materiality.`, then jump directly to item 6. On the force audit-skip branch, do **not** read `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/preflight-plan-audit.md`, do **not** create or overwrite `$PREFLIGHT_TMPDIR/audit.txt`, and do **not** append to `$PREFLIGHT_TMPDIR/force-bypass.log` — the audit skip is not a downgraded gate and writes no bypass-log entry.

   **When `force_requested=false` (only)** — **MANDATORY: READ ENTIRE FILE** at Preflight item 4: `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/preflight-plan-audit.md`. Read issue title/body from `$PREFLIGHT_TMPDIR/issue.json` and plan text from `$PLAN_TMP`. Do not fetch the issue live or rerun plan-block extraction. On `AUDIT=pass`, return the pass envelope in chat only and do not write `$PREFLIGHT_TMPDIR/audit.txt`. On `AUDIT=refuse`, write that file. Do **not** delegate to a subagent or external audit CLI.

5. **On `AUDIT=refuse`** — read `audit.txt` only on refuse. This non-force-only path follows `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/preflight-plan-audit.md` for clarify state, comment, and label flow, then exits **3** before Step 0.
6. **On `AUDIT=pass` or the force audit skip — semantic materiality (read-only bounded probe — see NEVER #21)** — run one bounded read-only probe of cited paths and symbols; before `BOOTSTRAP_NEXT=step2`, only `$PREFLIGHT_TMPDIR/**`, the stale notice, and conditional refresh may write. On clear staleness, write and post `$PREFLIGHT_TMPDIR/stale-notice.md` (retry once; add `--repo "$UPSTREAM_REPO"` when forked), exit **2**, and never close or rename. For `PLAN_RECEIPT_SCOPE_REVALIDATION=true`, resolve `origin/main` (or `upstream/main`) before and after probing its exact object; both SHAs must equal `PLAN_RECEIPT_TARGET_BASE_SHA`.
   If current, invoke `"${CLAUDE_PLUGIN_ROOT}/scripts/larch.sh" plan-receipt refresh --issue "$TARGET_ISSUE_NUMBER"` (add `--repo "$UPSTREAM_REPO"` when set) with `--repo-root "$CLAUDE_PROJECT_DIR" --preflight-tmpdir "$PREFLIGHT_TMPDIR" --base-ref <resolved-ref> --previous-base-sha "$PLAN_RECEIPT_PREVIOUS_BASE_SHA" --base-sha "$PLAN_RECEIPT_TARGET_BASE_SHA"`; require `PLAN_RECEIPT_REFRESHED=true`, matching `PLAN_RECEIPT_BASE_SHA`, `PLAN_RECEIPT_SNAPSHOT_UPDATED=true`, and `PLAN_RECEIPT_SCOPE_DRIFT_LOGGED=true`, else exit **2**. The command alone renews and reads back the issue snapshot and writes one scope-drift `Warnings` record; otherwise continue to Step 0.

7. **Preflight pass gate**: retain `PREFLIGHT_TMPDIR` and `plan-from-issue.txt`; proceed to Step 0.

**Preflight — admission gate known limitation (D3)**: `scripts/larch.sh admission gate` inherits blocker discovery's historical **fail-open** posture on GitHub API failures. API outages can yield zero detected blockers (`ADMISSION_RESULT=pass`) even when blockers are unknown. Operators needing strict fail-closed blocker reads must pause runs during outages; see `crates/larch-cli/src/admission_commands.rs`. **Native-first short-circuit**: native dependency API blockers skip the prose scan for speed, so operator-visible lists may omit prose-only blockers until native blockers clear.

### `/implement` orchestrator exit codes (Preflight + argv)

| Code | When |
|------|------|
| **0** | Normal completion of the scripted skill path. |
| **2** | Flag mutual-exclusion, verbal/non-numeric argv tail, missing/malformed `larch:plan` when not bypassed by `--force`, empty issue body and empty title under `--force` (nothing to implement), `gh` / `scripts/larch.sh plan-block read` / admission hard failures (except `missing-designed-prefix` when bypassed by `--force`), semantic stale notice posted at Preflight item 6, `persist-implement-run-flags` validation failures, and other operator-visible hard errors where this file specifies exit **2**. |
| **3** | **Preflight audit refused** — `AUDIT=refuse` exits **3**. Follow `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/preflight-plan-audit.md` `## Clarify-request flow after AUDIT=refuse` for post, label, `STATE=ambiguous`, and `STATE=awaiting-response` behavior. **Force note**: `--force` skips the item 4 plan-adequacy audit before any `AUDIT=refuse` result exists, so this exit-**3** refuse path is unreachable under `--force`. |

<!-- step:0 — Session Setup -->
## Step 0 — Session Setup

Print: `> **🔶 /implement 0: setup**`

Step 0 is owned by `scripts/larch.sh bootstrap invoke` (`--mode initial` / `--mode resume`). Rust owns session setup/rehydration, the entry gate, session env, source snapshot, reviewer refresh, live pointer, tracking, plan materialization, dirty-tree checkpointing, branch capture, plan logging, implementer selection (`phase_coder_select`), and routing handoff. The wrapper forwards `/implement --force`, `/implement --self-review`, and `/implement --self-implement` via `case "${force_requested:-}" in` / `case "${self_review:-}" in` / `case "${self_implement:-}" in` so omitted flags stay omitted from bootstrap argv. Do not duplicate absorbed helper calls prompt-side. When `self_implement_requested=true`, `phase_coder_select` forces `coder=claude` regardless of `--coder` or tool availability; `--force` alone no longer affects coder selection. Every ordinary Step 2.4 Claude-fallback path (vendor missing, explicit `coder=claude`, or `--self-implement`) implements via the `larch:claude-implementer` Agent-tool subagent — the main agent never Edit/Write plan-scoped files on this branch. Use `SELF_REVIEW_REQUESTED` from the routing envelope to set `self_review` after parse when flag parsing did not already set it.

Wrapper reachability: `${CLAUDE_PLUGIN_ROOT}/skills/implement/scripts/step-0-bootstrap.sh` forwards `--difficulty` when set and delegates to `scripts/larch.sh bootstrap invoke`; the prompt-side entry remains the Step 0 wrapper below. The Rust bootstrap uses the typed Git reader and captures `BRANCH_NAME` after branch creation.

**Bootstrap edit gate (NEVER #21)**: do not call Edit, Write, or repo-mutating Bash on git-tracked paths until bootstrap exits 0 with `BOOTSTRAP_NEXT=step2`. The feature branch is created inside `step-0-bootstrap.sh`. On `dirty-recovery` or `degraded-prompt`, repo edits remain forbidden until resume yields `step2`. Repeat this gate before every `step-0-bootstrap.sh` fence (initial and `--mode resume`) until `BOOTSTRAP_NEXT=step2`. **Carve-out — rebase-routing**: when bootstrap returns `BOOTSTRAP_NEXT=rebase-routing`, follow `rebase-checkpoint-routing.md` and `conflict-resolution.md` (spawn `larch:ci-fixer` `MODE=conflict`; main agent does not edit conflicted files).

**⚠ Foreground required — do not use Claude background mode.**

```bash
[ -z "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -n "${IMPLEMENT_TMPDIR:-}" ] && [ -f "$IMPLEMENT_TMPDIR/plugin-root.env" ] && . "$IMPLEMENT_TMPDIR/plugin-root.env"
export IMPLEMENT_TMPDIR
[ -z "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -n "${IMPLEMENT_TMPDIR:-}" ] && [ -x "$IMPLEMENT_TMPDIR/larch-run.sh" ] && CLAUDE_PLUGIN_ROOT=$("$IMPLEMENT_TMPDIR/larch-run.sh" --print-plugin-root 2>/dev/null || true)
export CLAUDE_PLUGIN_ROOT
# Foreground required
LARCH_CLAUDE_PID="$PPID" "${CLAUDE_PLUGIN_ROOT}/skills/implement/scripts/step-0-bootstrap.sh" --mode initial --issue-number "$TARGET_ISSUE_NUMBER" --preflight-tmpdir "$PREFLIGHT_TMPDIR" --force-requested "${force_requested:-false}" --self-review-requested "${self_review:-false}" --self-implement-requested "${self_implement:-false}" --forked-target "${forked_target:-false}" --merge-requested "${merge:-false}" --draft-requested "${draft:-false}" --no-admin-fallback "${no_admin_fallback:-false}" --no-logs-commit "${no_logs_commit:-false}" --upstream-repo "${UPSTREAM_REPO:-}" --run-id "${RUN_ID:-}" --caller-env "${CALLER_ENV_PATH:-}" --session-env "${SESSION_ENV_PATH:-}" --coder "${coder:-}" --difficulty "${difficulty:-}" --lifecycle-parent-context "${LIFECYCLE_PARENT_CONTEXT:-}"
```

Parse wrapper stdout as a routing envelope; `$IMPLEMENT_TMPDIR/bootstrap-routing.env` is durable. On `--mode resume`, restore persisted coder and parent-context state from `$IMPLEMENT_TMPDIR/lifecycle-parent-context.env`. Rust owns Step 0; `step-0-bootstrap.sh` owns the wrapper. Offline coverage: `crates/larch-cli/src/implement_bootstrap_continuation.rs` unit tests plus Rust parity. Preserve `CONTEXT_FILE` for child skills. If `/implement` would replace the target with 2+ issues, **MANDATORY: READ ENTIRE FILE**: Read `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/umbrella-partition.md` completely and execute it. On exit `0`, require `BOOTSTRAP_NEXT` in `step2|dirty-recovery|degraded-prompt|rebase-routing|cleanup`; if `BOOTSTRAP_NEXT` is absent or any other value, treat the bootstrap envelope as malformed and abort with exit `2`. Routing after parsing:

| `BOOTSTRAP_NEXT` | Routing |
|---|---|
| `BOOTSTRAP_NEXT=step2` | Proceed directly to Step 2 with `--coder "$coder"`. |
| `BOOTSTRAP_NEXT=degraded-prompt` | **MANDATORY: READ ENTIRE FILE**: Read `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/bootstrap-recovery.md` completely. Execute the degraded-prompt branch. |
| `BOOTSTRAP_NEXT=rebase-routing` | **MANDATORY: READ ENTIRE FILE**: `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/rebase-checkpoint-routing.md`. Parse `ROUTE`, `REBASE_RC`, conflict detail KVs, and advisory `PHANTOM_*` KVs from the Step 0 envelope; the Rust owner already selected conflict, bail, or malformed/absent post-1.r `ROUTE` details. |
| `BOOTSTRAP_NEXT=dirty-recovery` | **MANDATORY: READ ENTIRE FILE**: Read `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/bootstrap-recovery.md` completely. Execute the dirty-recovery branch. |
| `BOOTSTRAP_NEXT=cleanup` | Do not enter Step 2; skip to Step 18 terminalization, then Step 19 cleanup, after required local-only cleanup. |

**Absorbed continue tail.** On the continue path (`IMPLEMENT_BAIL_REASON` empty, `STALL_TRACKING=false`, readable `PLAN_FILE`, non-empty `coder`), `scripts/larch.sh bootstrap invoke` runs the degraded-tools gate and checkpoint `1.r` internally and folds KVs into Step 0 stdout. `step-0-bootstrap.sh` forwards `--non-interactive true|false` from the canonical predicate in `${CLAUDE_PLUGIN_ROOT}/skills/shared/external-reviewers.md`; do not rely on `LARCH_SKILL_NON_INTERACTIVE` alone. One-down bootstrap emits `DEGRADED_PROMPT_REQUIRED=true` and stops before 1.r until the explicit Continue sentinel exists. Both-down emits `DEGRADED_HARD_FAIL=true` and stops in every mode. Advisory `PHANTOM_*` KVs appear only on Step 0 stdout, not `$IMPLEMENT_TMPDIR/bootstrap-routing.env`. Do not use `CODEX_STATE` or `CURSOR_STATE` as the operator explanation when stderr relayed the full degraded block.

**Step 1.r routing.** For checkpoint `1.r`, enter rebase handling only when `BOOTSTRAP_NEXT=rebase-routing` appears in the Step 0 bootstrap envelope. In that branch, use `ROUTE=`, `REBASE_RC=`, conflict detail KVs, and advisory `PHANTOM_*` from the same envelope. Step `4.r` is folded into the Step 3 `checks-commit-route` composite; `7.r` is folded into the Step 6 `step-6-entry` composite and `7a.r` into `step-7a`, each relaying `CHECKPOINT_NEXT=continue|load-routing` for the same **Rebase Checkpoint Macro** routing (`continue` skips the reference; `load-routing` or missing/malformed values load it).

`phase_coder_select` is the only omitted-`--coder` authority for Step 0. Explicit `--coder=claude` does not set `coder_fallback=true`; only the implicit waterfall Codex → Cursor → Claude emits that flag when it reaches Claude. `diff_lines: <N>` in `plan.txt` is informational sizing context and does not route the implementer.

`session-env.sh` reaches `review-and-fix CLI` in Step 5 via `--session-env-path`. Bash fences delegate through `$IMPLEMENT_TMPDIR/larch-run.sh`; wrappers read token, timing, stall, and run-id keys from `$IMPLEMENT_TMPDIR/session-env.sh` via `scripts/larch.sh session read-key`. `LARCH_RUN_ID` is written by `_write_base_session_env()` after `_phase_tracking()` resolves `RUN_ID`, not by the initial Step 0 `session write-env` call.

### Cross-Skill Presence Propagation

No cross-skill presence propagation action is required; this anchor preserves the post-review boundary chain.

## Phantom Untracked Probe

Read `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/phantom-probe.md` only when changing probe call sites. Trailing `PHANTOM_*` KVs are advisory telemetry; do not act on them.

## Execution Issues Tracking

Progressive disclosure: do not load `${CLAUDE_PLUGIN_ROOT}/skills/implement/references/execution-issues-tracking.md` at section entry. Load it only for active OOS triage, `Pre-existing Code Issues` dual-write, self-review step 3, or Step 8 `oos-pipeline` call sites.

<!-- step:2 — Implement the Feature -->

Print: `> **🔶 /implement 2: implementation**`

`scripts/larch.sh implement run-dispatch` marks Step 2 token and timing telemetry internally on the first dispatch only. The mark happens after `dispatch.lock` acquisition and is skipped on `--answers` redispatch.

<!-- step:2 entry preconditions — legal next-actions matrix -->

This matrix is authoritative for Step 2. After parsing dispatcher stdout in 2.1 and completing 2.1.5 envelope validation, the orchestrator may take only the rows below. **If 2.2 / 2.4 prose appears to disagree, the matrix wins.** See NEVER #9.

| Resolved `STATUS` | `ORCHESTRATOR_EDIT_AUTHORITY` | Permitted next-actions | Forbidden |
|---|---|---|---|
| `complete` | `forbidden` (required) | Set `MANIFEST_PATH=$MANIFEST`; proceed to Step 3 | Edit, Write, repo-mutating Bash against the **git working tree**; `git diff`-based reconstruction; transcript inspection for diff replay |
| `needs_qa` | `forbidden` (required) | Run Q/A loop in 2.3 (read `$QA_PENDING`, ask via `AskUserQuestion`, **write answers JSON to `$IMPLEMENT_TMPDIR/codex-answers-$RESUME_N.json` — permitted**, re-invoke dispatcher with `--answers`) | Edit, Write, repo-mutating Bash against the **git working tree** unrelated to redispatch |
| `bailed` | `forbidden` (required) | Log `Step 2 — $TOOL_LABEL bailed: $REASON` to `Warnings`; bail per 2.2's REASON-set routing (Step 12d) | Edit, Write, repo-mutating Bash against the **git working tree**; do NOT attempt to "recover" by editing |
| `claude_fallback` + `RECOVERY_FROM=manifest-schema-invalid` | `allowed` (required) | Run Step 2.4 recovery sub-branch only: plan-scope alignment, commit-message synthesis, no implementation edits | Opportunistic Q/A, main-agent re-implementation, Edit/Write against recovered files, `git add -A`, destructive git cleanup |
| `claude_fallback` | `allowed` (required) | Run Step 2.4: spawn `larch:claude-implementer` (`MODE=step2-plan`) for plan edits; relay `FALLBACK_QUESTIONS` via `AskUserQuestion` + `SendMessage`/fresh-spawn; orchestrator owns difficulty/scout/commit fences | Main-agent Edit/Write of plan-scoped files; main-agent reads of plan body, feature body, or `ARCHITECTURAL_*.md` |
| any envelope failure (validation in 2.1.5) | n/a | Synthesize orchestrator-local bail with `REASON=orchestrator-envelope-invalid` (see 2.1.5); route as Step 2 → Step 12d hard-bail | Setting `MANIFEST_PATH`; entering 2.3 / 2.4 / Step 3 |

**Always-permitted writes regardless of row**: `$IMPLEMENT_TMPDIR/**` (Q/A artifacts, larch-log records, execution-issues), larch-log and summary publication calls in 2.5, captured `scripts/larch.sh checks run-relevant` helpers, and reads of `TRANSCRIPT` / `SIDECAR_LOG` for warning text extraction (NOT diff reconstruction). The forbidden column scopes to the **git working tree**.

**No mid-run scope re-litigation.** Once Step 2 begins with a plan, the orchestrator does not ask whether to stop for scope, capacity, or effort. Oversize plans should have failed `/design` or Preflight audit. Mid-run, the dispatcher or Claude-fallback subagent executes the plan or hits a concrete Step 12d bail. This does NOT suppress Codex Q/A loop questions or Claude-fallback `FALLBACK_QUESTIONS` ambiguity questions relayed by the orchestrator. See NEVER #7.

<!-- step:2 dispatch — coder selection -->

Regression coverage for this dispatcher surface lives in the inline tests in `crates/larch-cli/src/implement_step2_commands.rs`. The launcher and dispatcher contract is `skills/implement/references/step2-dispatch.md`.

**2.1 — First dispatch invocation**:

```bash
"$HOME/.cache/larch/sessions/implement-run-$PPID.sh" scripts/larch.sh implement run-dispatch --coder "$coder"
```

**Do NOT poll or print sidecar output while dispatching.** The Rust adapter starts or reattaches `implement-step2-dispatch`; its only launcher output is `BGJOB_STATUS=STARTED STEP=implement-step2-dispatch PGID=<n>`. Wait with the shared bgjob contract below. On `BGJOB_STATUS=WAIT`, repeat the exact wait fence with no intervening prose or tools. On `DONE`, read `$IMPLEMENT_TMPDIR/bgjob/implement-step2-dispatch.result.env`; continue only with `BGJOB_RC=0` and the complete dispatcher envelope from that file. Do not use sidecars, daemon stdout, or launcher stdout as completion evidence.

```bash
"$HOME/.cache/larch/sessions/implement-run-$PPID.sh" scripts/larch.sh bgjob wait --step implement-step2-dispatch --tmpdir "$IMPLEMENT_TMPDIR" --max-wait-s 270
```

The child `scripts/larch.sh implement run-dispatch` always passes `--plan-file "$IMPLEMENT_TMPDIR/plan.txt"` and no workflow flag; it does **not** assemble paths from `PLAN_FILE` keys in `session-env.sh`. It reads `CURSOR_BINARY_FOUND` / `CODEX_BINARY_FOUND` from `$IMPLEMENT_TMPDIR/session-env.sh` or fresh executable checks, uses `$IMPLEMENT_TMPDIR/feature-description.txt`, and if the Step 0 selected binary is missing, relays `STATUS=claude_fallback` with edit authority instead of hard-failing. Before relaying stdout, it resolves repo root and captures `step2-prelaunch-porcelain.nul` plus prelaunch digests for Step 2.4. Its full envelope is atomically published into the bgjob result env. Parse `STATUS`, `TOOL`, `MANIFEST`, `QA_PENDING`, `REASON`, `TRANSCRIPT`, `SIDECAR_LOG`, `ORCHESTRATOR_EDIT_AUTHORITY`, additive plan-coverage KVs, and optional recovery triplet `RECOVERY_FROM`, `RECOVERY_PRIOR_TOOL`, `RECOVERY_PATHS_FILE` only from that result env. Coverage applies only to firm `### NEW:` / `### UPDATED:` / `### REWRITTEN:` headings from `$IMPLEMENT_TMPDIR/plan.txt`, not `### MAY_UPDATE:`. Malformed coverage on a complete path fails closed in the Rust dispatcher. Then run 2.1.5 before branching on `STATUS`. Derive:

Set `TOOL_LABEL` to `Codex` for `TOOL=codex`, `Cursor` for `TOOL=cursor`, and `external implementer` for any other tool token.

**2.1

[…] pełny plik w paczce .zip
Files in this package (92)
  • SKILL.md 139 KB
  • diagram.svg 3 KB
  • prompts/codex-implementer.md 20 KB
  • prompts/cursor-implementer.md 20 KB
  • references/architectural-guidelines-present.md 2 KB
  • references/architectural-invariants-present.md 2 KB
  • references/bootstrap-recovery.md 4 KB
  • references/checks-repair-loop.md 16 KB
  • references/codex-manifest-schema.md 18 KB
  • references/conflict-resolution.md 9 KB
  • references/execution-issues-tracking.md 19 KB
  • references/extracted-script-registry.md 3 KB
  • references/force-mode.md 2 KB
  • references/oos-pipeline.md 8 KB
  • references/phantom-probe.md 3 KB
  • references/postmerge-emergency-repair.md 2 KB
  • references/preflight-plan-audit.md 7 KB
  • references/rebase-checkpoint-routing.md 10 KB
  • references/self-review.md 6 KB
  • references/ship-pr-exit-matrix.md 18 KB
  • references/ship-pr-oos-checkpoint-router.md 3 KB
  • references/stall-recovery.md 14 KB
  • references/step18-logs-flush.md 4 KB
  • references/step19-cleanup.md 1 KB
  • references/step2-dispatch.md 27 KB
  • references/step2-main-health-fix.md 2 KB
  • references/step5-review-branches.md 11 KB
  • references/umbrella-partition.md 3 KB
  • scripts/flush-execution-issues.md 3 KB
  • scripts/flush-execution-issues.sh 1 KB
  • scripts/hook-stop-fail-close.md 2 KB
  • scripts/hook-stop-fail-close.sh 1 KB
  • scripts/oos-disposition-checkpoint.md 7 KB
  • scripts/oos-disposition-checkpoint.sh 1 KB
  • scripts/oos-disposition-gate.md 8 KB
  • scripts/oos-disposition-gate.sh 1 KB
  • scripts/post-tracking-issue.md 2 KB
  • scripts/post-tracking-issue.sh 1 KB
  • scripts/refresh-execution-issues.md 1 KB
  • scripts/refresh-execution-issues.sh 1 KB
  • scripts/run-step-checks.md 3 KB
  • scripts/run-step-checks.sh 1 KB
  • scripts/step-0-bootstrap.md 2 KB
  • scripts/step-0-bootstrap.sh 1 KB
  • scripts/step-0-degraded-gate.md 1 KB
  • scripts/step-0-degraded-gate.sh 1 KB
  • scripts/step-18.md 3 KB
  • scripts/step-18.sh 1 KB
  • scripts/step-19.md 1 KB
  • scripts/step-19.sh 1 KB
  • scripts/step-2-post-dispatch.md 3 KB
  • scripts/step-2-post-dispatch.sh 1 KB
  • scripts/step-5-resume.md 2 KB
  • scripts/step-5-resume.sh 1 KB
  • scripts/step-5-review.md 3 KB
  • scripts/step-5-review.sh 1 KB
  • scripts/step-6-entry.md 4 KB
  • scripts/step-6-entry.sh 1 KB
  • scripts/step-7a.md 5 KB
  • scripts/step-7a.sh 1 KB
  • scripts/step-8-oos-checkpoint.md 2 KB
  • scripts/step-8-oos-checkpoint.sh 1 KB
  • scripts/step-8-seed-initial.md 3 KB
  • scripts/step-8-seed-initial.sh 1 KB
  • scripts/step-8-ship.md 3 KB
  • scripts/step-8-ship.sh 1 KB
  • scripts/step-architectural-guidelines-write-compose.md 1 KB
  • scripts/step-architectural-guidelines-write-compose.sh 1 KB
  • scripts/step-architectural-invariants-write-compose.md 1 KB
  • scripts/step-architectural-invariants-write-compose.sh 1 KB
  • scripts/step-name-registry.tsv 1 KB
  • scripts/test-architectural-guidelines-step.md 1 KB
  • scripts/test-architectural-guidelines-step.sh 10 KB
  • scripts/test-flush-execution-issues.md 1 KB
  • scripts/test-flush-execution-issues.sh 3 KB
  • scripts/test-implement-relevant-checks-anti-halt.md 2 KB
  • scripts/test-implement-relevant-checks-anti-halt.sh 6 KB
  • scripts/test-implement-review-token-propagation.md 1 KB
  • scripts/test-oos-disposition-gate.md 3 KB
  • scripts/test-oos-disposition-gate.sh 4 KB
  • scripts/test-refresh-execution-issues.md 1 KB
  • scripts/test-refresh-execution-issues.sh 3 KB
  • scripts/test-step-18.md 2 KB
  • scripts/test-step-5-review.md 1 KB
  • scripts/test-step-7a.md 2 KB
  • scripts/test-step-7a.sh 3 KB
  • scripts/test-step-8-oos-checkpoint.md 1 KB
  • scripts/test-step-8-oos-checkpoint.sh 1 KB
  • scripts/test-write-final-report.md 3 KB
  • scripts/test-write-final-report.sh 3 KB
  • scripts/write-final-report.md 11 KB
  • scripts/write-final-report.sh 1 KB

Versions

RepositoryScoreLicence
This page · character-ai/larch95MIT
ericrisco/rsc-harness100MIT
yonatangross/orchestkit100MIT
sentimony/agentic-workflow100MIT
moberghr/mtk-agent-toolkit100MIT
michielvandermeer/skills100MIT
rossumai/claude-marketplace100MIT
userKael/rastro100MIT
yonatangross/orchestkit100MIT

Database snapshot: 13.11.2026 · package version b929fe7559d2 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100implement-issue
    Read a GitHub issue, create a branch, implement the solution, and open a PR. Use when given an issue number to implement.
  • 100implement-issue
    Implement a julianpalomo.dev GitHub issue end to end. Reads it with gh, creates its branch, posts the plan on the issue and waits for an OK, implements, runs /handoff and /ship-pr, then acts on the PR's review. Use when asked to implement, build or work on an issue by number.
  • 90implement-task
    Implements an agreed task from a local Markdown plan, GitHub Issue, or Jira ticket, checking dependencies and linked requirements, making scoped changes, and validating acceptance criteria. Use when asked to work on, execute, or implement a planned task and prepare it for review.
  • 91github-pr-audit
    Use when auditing a GitHub PR or issue before merge.
  • 100forge-implement
    Implement a feature or fix from an Issue, plan file, or free-text description, following project standards. Use when the user wants to start working on an Issue, implement a feature, or fix a bug — stops after opening the PR (use forge-ship to also run review).
  • 100implement-issue
    Implement a GitHub issue tests-first - take the acceptance criteria from the issue, write red tests against the public API, commit them, open a draft PR, then implement in checkpoint commits until green, with user-facing docs as one of the criteria. Use when asked to implement,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.