[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79PMY53NKDHVZ2AFSGNNJH7":3,"skill-same:01M79PMY53NKDHVZ2AFSGNNJH7":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M79PMY53NKDHVZ2AFSGNNJH7","worktrail-sdd-workflow",null,"Internal SDD workflow executor invoked by \u002Fgo only. Do not call directly. Executes classified routes A–J: feature planning, implementation (parallel orchestration, PR generation), defect repair, refactoring, spec changes, investigation, and workflow evolution.","behindthedash\u002Fworktrail","behindthedash","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F30299179?v=4","01M79PHT5395GJXDSNP7MYP63D","OC","01M79PHT68KHMYHPS9D9RCYFJZ",0,"MIT","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-sdd-workflow\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: worktrail-sdd-workflow\ndescription: \"Internal SDD workflow executor invoked by \u002Fgo only. Do not call directly. Executes classified routes A–J: feature planning, implementation (parallel orchestration, PR generation), defect repair, refactoring, spec changes, investigation, and workflow evolution.\"\nallowed-tools: Bash, Read, Glob, Grep, AskUserQuestion, Skill, Agent\nargument-hint: \"[repo-name-or-path|handoff|handoff:ID] [new|implement|continue|pr|brainstorm|route:A-J] [spec-id]\"\n---\n\n# `sdd-workflow` — the SDD conductor (v2)\n\n## Overview\n\nPipeline: `intake (route:X) → record start → execute route → validate → PR → merge gate → outcome`\n\nRoute playbooks: `..\u002Fworktrail-go\u002Freferences\u002Froutes.md`.\n\n## When to Use\n\n**INTERNAL ONLY.** Users do not invoke this skill directly — all SDD work enters\nthrough `\u002Fgo`. A prompt containing `[WORKTRAIL INTERNAL DISPATCH]` is the supported\nadapter form produced after `\u002Fgo` has selected this executor: honor it, execute\nthe supplied arguments directly, and never re-enter `worktrail-go`.\n\n## Instructions\n\n- **Authority:** code + tests = truth for what *is*; spec\u002Fcontracts = what\n  *should be*; `knowledge-graph.json` = self-healing cache; **never read\n  `reviews\u002F*-review.md` as current state.**\n- **Business outcome first:** before planning\u002Fimplementing, identify the\n  user\u002Fbusiness problem, who benefits, the smallest complete outcome, and\n  whether the request fits the product's current scope. Record material\n  assumptions in the run record. Don't build technically interesting work with\n  no defined outcome.\n- **Terse output:** one short status line per phase; print script output, don't\n  paraphrase; batch independent commands in one message.\n- **Token discipline:** retrieval order = instructions → controlling artifact →\n  GitNexus (base-branch map; worktree diff wins) → exact files → targeted grep →\n  tests → merged PRs → broad search last. Load only the selected route playbook.\n  Hand subagents pointers, not blobs. The run record is the working memory —\n  update it instead of re-reading materials.\n- **GitNexus\u002Fworktree boundary:** GitNexus normally indexes the canonical base checkout,\n  not Worktrail's generated task\u002Fspec worktrees. In a worktree, use its actual files,\n  `rg`, and tests as ground truth for the current branch; use GitNexus only for\n  base-branch context and broader callers\u002Fdependents. If they disagree, assume the graph\n  is stale relative to the branch and let the worktree win. Do not require or create a\n  worktree-local `.gitnexus\u002F` index. Before a rename, deletion, or PR, combine an\n  unfiltered `rg \"\u003Cname>\" .` from the worktree root with GitNexus query\u002Fimpact against\n  the canonical repository.\n\n**No script resolution needed.** Every command below is a console script installed by the\n`worktrail` package (`worktrail-run-record`, `worktrail-live`, `worktrail-pre-pr-gate`, …), on\n`PATH`. If one is missing, stop and report that `worktrail` is not installed.\n\n### Step 0 — Direct-invocation guard\n\nIf the prompt contains `[WORKTRAIL INTERNAL DISPATCH]`, treat it as an authorized\nadapter-to-executor handoff. Do not redirect to `\u002Fgo`; apply the same `route:X`\nargument validation below and proceed. `worktrail-skill-dispatch` independently\nbounds this path to one nested dispatch and fails with\n`blocked_internal_dispatch_recursion` if a child re-enters the front door.\n\nIF no `route:X` positional arg is present, THEN print the redirect message and stop.\nThis applies to handoff-seed invocations too: callers must pass both\n`handoff:\u003Cid>` and the resolved `route:X`:\n\n```\nsdd-workflow is an internal executor. Use \u002Fgo for all engineering work.\n```\n\nOtherwise, proceed to Phase 1.\n\n### Phase 1 — Intake (parse args; bypass interactive screens)\n\nThree entry paths, detected in order:\n\n- **Seeded-dispatch** — input contains all five labels (`Repo:`, `Base branch:`, `Route:`, `Spec:`, `Run record path:`). Detect, parse fields, skip to Phase 6. See `#seeded-dispatch` in `..\u002Fworktrail-go\u002Freferences\u002Fsubagent-prompts.md` for detection criteria and bypass behavior.\n- **Handoff-seed** — first arg is `handoff` or `handoff:ID`. See `#handoff-seed` in subagent-prompts.md.\n- **Direct-intent** — positional args for repo hint, intent, spec name. Standard flow below.\n\nPositional args (all optional); hold as `$ARG_REPO`, `$ARG_INTENT`, `$ARG_SPEC`.\nUnrecognised value → warn once and fall back.\n\n| Pos | Values | Effect |\n|---|---|---|\n| 1 | repo name or path hint | passed to resolver as `--hint` |\n| 1 | `handoff` or `handoff:ID` (case-insensitive) | handoff-seed mode — NOT a repo hint; see `#handoff-seed` in subagent-prompts.md. The brief's optional `recommended-route:` frontmatter feeds classification (`--handoff-route`). |\n| 2 | `new` `implement` `continue` `pr` `brainstorm` | v1 intent — skips classification, maps to routes C+D \u002F D \u002F E \u002F E(pr) \u002F A |\n| 2 | `route:A`..`route:J` | explicit route override |\n| 3 | spec folder name (e.g. `003-payments`) | skips spec picker |\n| any | `by:\u003Cdispatch-id>` (labeled, matched by prefix — not positional) | handoff-seed mode only: the caller's `$INVOCATION_CONTEXT_DISPATCH_ID`. Hold as `$GO_DISPATCH_ID` and pass `--by \"$GO_DISPATCH_ID\"` on the handoff-seed claim call (`#handoff-seed` Step 3) so `claim()`'s `same_owner` result can tell this dispatch's own claim apart from a different dispatch's. Every `handoff:\u003Cid>` dispatch from `worktrail-go` carries this token (Dispatch Contract, `worktrail-go\u002FSKILL.md`); its absence means an older caller or a non-`\u002Fgo` invocation — fall back to an unqualified claim call (no `--by`), which yields `same_owner: null` and must be treated as \"not confirmed mine,\" never as true. |\n| any | `run:\u003Cpath>` (labeled, matched by prefix — not positional) | native-skill dispatch only (both the handoff-seed and direct-intent forms): the caller's already-open run record path, i.e. `worktrail-go`'s own Phase 6 `$RUN`. Hold as `$GO_RUN_PATH` — Phase 6 below reuses it instead of starting a second run record. Its absence means an older caller or a non-`\u002Fgo` invocation; fall back to Phase 6's normal `start` call. The seeded-dispatch entry path is unaffected — it already carries `$RUN` directly from the seed and never reaches this token. |\n\n### Phase 6 — Start the run record\n\nIf `$GO_RUN_PATH` was parsed in Phase 1 (native-skill dispatch — see the Dispatch Contract\nin `worktrail-go\u002FSKILL.md`), **reuse it instead of starting a second run record** — this is\nthe fix for the orphaned-parent-record bug documented in\n`docs\u002Fspecs\u002Fresearch\u002Fdead-dispatch-backlog-investigation.md` (observations 5\u002F6: every\nnative-skill dispatch that instead called `start` here left the parent's record stuck at\n`route_selected` forever, since only the child's record ever reached `finish()`):\n\n```bash\nRUN=\"$GO_RUN_PATH\"\nworktrail-run-record set \"$RUN\" base_branch \"$BASE\"\nworktrail-run-record set \"$RUN\" base_commit \"$(git -C \"$REPO\" rev-parse --short HEAD)\"\n```\n\nOtherwise — no `$GO_RUN_PATH` (an older caller or a non-`\u002Fgo` invocation; the\nseeded-dispatch path already skipped straight here in Phase 1 with its own attached `$RUN`\nand never reaches this branch either) — start a fresh run record as before:\n\n```bash\nworktrail-run-record start --repo \"$REPO\" --request \"\u003Csummary>\" \\\n  --route \u003CX> --risk \u003Clevel> --reason \"\u003Cclassifier reason>\" \\\n  --base-branch \"$BASE\" --base-commit \"$(git -C \"$REPO\" rev-parse --short HEAD)\"\n```\n\nHold the returned `path` as `$RUN`. Through the run: `set $RUN status \u003Cphase>`\nat transitions; `append $RUN decisions|assumptions|deferred_work|...` as they\nhappen. End every run with `finish --status \u003Cone of the ten completion states>`\n— vague completion language is forbidden.\n\n**Log every manual rescue** via `run_record.py intervention $RUN --category \u003Ccategory> --minutes \u003Cest> --tokens \u003Cest> --note \"...\"` (categories + rationale: go-design.md §interventions).\n\n### Phase 7 — Execute the route\n\nRead **only** the selected playbook section in `..\u002Fworktrail-go\u002Freferences\u002Froutes.md`:\n\n| Route | Playbook | Engine |\n|---|---|---|\n| A idea-discovery | routes.md §A | brainstorm (discovery framing) |\n| B epic-planning | routes.md §B | epic doc + feature decomposition |\n| C feature-planning | routes.md §C | `new` pipeline (pipeline-details.md#new-pipeline), then explicit C→D transition |\n| D implementation | routes.md §D | `new`\u002F`implement` pipelines (pipeline-details.md) |\n| E continue\u002Fresume | routes.md §E | state restore + re-entry (incl. PR\u002FCI repair) |\n| F defect-repair | routes.md §F | `modify` pipeline (pipeline-details.md#modify-pipeline), change-spec bugfix; 1-task mechanical changes ride the direct branch (`worktrail-modify-direct-gate`) |\n| G spec-change | routes.md §G | `modify` pipeline (pipeline-details.md#modify-pipeline), change-spec delta; 1-task mechanical changes ride the direct branch (`worktrail-modify-direct-gate`) |\n| H refactor\u002Fdebt | routes.md §H | characterization tests → narrow implement |\n| I investigation | routes.md §I | evidence only → recommended next route |\n| J workflow-evolution | routes.md §J | this repo, cassette-gated |\n\nSpecialist skills (security review, typescript\u002Freact review, render, …) are\nloaded by the playbook at the phase that needs them — never all up front.\n\n### Pipeline — `new` (Route C, and Route D when no spec exists)\n\nStep sequence: overlap-check → worktree → brainstorm → spec-check → precheck → (optional technical-plan) → spec-to-tasks → stale-spec-check → orchestrator → sync. See `references\u002Fpipeline-details.md#new-pipeline` for full steps with bash commands and guards.\n\nRoute C closeout: spec PR + implementation-intent transition. Requested intent\ncontinues into Route D in the same run; planning-only intent finishes as\n`planned_ready_for_implementation`; unknown intent asks once and records the\ndecision (`$AUTO_MODE=true`: no ask — take the planning-only default; every ask\nsite in route execution follows\n`..\u002Fworktrail-go\u002Freferences\u002Fsubagent-prompts.md#auto-mode-ask-fallbacks`).\nNever close a requested Route-C brief or create a follow-up handoff\nat the spec\u002Ftask boundary.\n\n### Pipeline — `implement` (Route D, spec already on base)\n\nStep sequence: pick spec → stale-spec-check → precheck → orchestrator → sync. See `references\u002Fpipeline-details.md#implement-pipeline` for full steps.\n\n### Phase 8 — Merge gate and outcome\n\nFor every route whose documented completion requires a PR (`completed_pr_open`,\n`completed_and_merged`, or `completed_awaiting_human_approval`), the run is not\ndone when implementation and validation finish locally. The executor must pass\nthe scope-completeness gate and pre-PR test gate, commit, push, open or update\nthe PR, then evaluate the merge gate before calling `run_record.py finish`.\n\n**Scope completeness gate — before any PR-producing route.** Re-read the\ncontrolling request, handoff Focus\u002FSuggested approach, specification acceptance\ncriteria, and route playbook. For every requested outcome, record one\n`scope-review` entry in the run record with implementation evidence:\n\n```bash\nworktrail-run-record scope-review \"$RUN\" \\\n  --item \"\u003Crequested outcome>\" --status complete --evidence \"\u003Ctest or artifact>\"\n```\n\nDo not create a follow-up handoff for an incomplete requested outcome. Implement\nit before the PR, or stop with a real blocker\u002Fproduct-decision state. An item\nmay be recorded as `out-of-scope` only with a reason beginning `different\npurpose:` or `user approved:` (any other reason is rejected at write time). A\n`blocked` item fails the pre-PR gate. Entries are append-only, but the gate\njudges only the latest entry per `--item`, so re-record an item to supersede an\nearlier `blocked` or mis-phrased entry.\n\n**Commit, compile, gate, push, open PR, watch CI.** Run the shared landing\npipeline from the worktree root; it atomically handles commit, compile-marker\nverification, pre-PR gate, push, PR open\u002Fupdate, CI watch to a terminal\noutcome, and run-record finish. Requires `--repo`, `--base`, `--title`,\n`--summary` or `--summary-file`, `--route`, `--risk`, `--commit-message`\nwhenever the tree is dirty — the normal dispatch case, since a dispatch's work\nis uncommitted; only a clean tree may omit it — optional `--gates`, and\n`--json`:\n\n```bash\nworktrail-land-pr --repo \"$PWD\" --base \"$BASE\" --run \"$RUN\" --title \"$TITLE\" \\\n  --summary-file \u002Fpath\u002Fto\u002Fpr\u002Fbody --route \"$ROUTE\" --risk \"$RISK_LEVEL\" \\\n  --commit-message \"$COMMIT_MESSAGE\" --gates \"$GATES\" --json\n```\n\n| Exit code | Outcome | State |\n|---|---|---|\n| 0 | `landed` | PR merged or auto-merge armed; run record finished. |\n| 2 | `refused` | Rejected before push (dirty tree, compile gaps, preflight fail); remote untouched, re-run with fixes. |\n| 3 | `code_defect` | PR open, CI failed, run record open for repair. |\n| 3 | `review_threads_blocking` | PR open, review threads unresolved, run record open for gate action. |\n| 4 | `ceiling` | Push succeeded but PR create failed, or 5 code-defect iterations exhausted. |\n\n**On `code_defect` outcome:** Repair the failing check per\n`..\u002Fworktrail-go\u002Freferences\u002Fci-watch-loop.md` case 3 (diagnose root cause,\napply minimal patch, disarm auto-merge, push), then re-run the same\n`worktrail-land-pr` command.\n\n**On `review_threads_blocking` outcome:** Review and act on the unresolved\nreview threads per `..\u002Fworktrail-go\u002Freferences\u002Fci-watch-loop.md` review-thread\ngate (fix in code, push + re-run the gate, or record an explicit decision),\nthen re-run the same `worktrail-land-pr` command.\n\nOnly routes with non-PR completion states (for example\n`planned_ready_for_implementation` or `investigation_complete`) may stop\nwithout commit\u002Fpush\u002FPR creation. If a non-PR-completion run produces a PR\nanyway — e.g. Route I committing its investigation note as a PR per §I — the\nsame `run_record.py finish --pr \u003Curl> ...` call above applies the correction\nautomatically; it keys off `$RUN`'s own `pull_request` field (a no-op when\nunset), not the route or completion state, so there is nothing extra to do\nhere either. Gap observed live before this was code-enforced: datalena PR\n#2228 (Route I, `investigation_complete`) merged a docs-only investigation\nnote with no `go:risk-*` label because the correction was then only a prose\ninstruction reachable from the PR-producing-route branch above, and a human\nhad to apply the label by hand before `CI: Auto-merge on open` would arm.\n\n### Defect handling — the three tiers\n\nA defect, gap, or tech-debt finding surfaced mid-run goes through exactly one of three tiers\n— never straight to capture by reflex:\n\n1. **Fold in** — the finding is a verified defect (reproduced or directly evidenced; a\n   hypothesis or a \"while I'm here\" cleanup is never enough), its fix touches only files\n   already in the unit's declared scope (a task's `files:` for workers; the change's own file\n   surface at authoring time), and the fix is mechanical (restores documented\u002Festablished\n   intent; no new design, API, or behavior contract). Cap: at most 2 fold-ins and ~20 changed\n   lines per task. Fold-ins are committed separately (message starts `fold-in:`), declared in\n   the worker report-back's `fold_ins`, validated in code against the task's declared scope\n   (`fold_in_violations` — an out-of-scope declaration fails the task closed), reviewed for\n   mechanicalness by the independent reviewer, and listed on the PR's `## Fold-in Fixes`\n   section. Never fold a behavior-contract change (that is Route G) and never widen a file\n   scope for one.\n2. **Capture, routed into an active change** — anything out of scope, non-mechanical, or over\n   cap is captured as a work-queue brief; the existing triage `fold-into-change` verdict can\n   attach it to a change already in flight instead of minting a new one.\n3. **Standalone brief (Route F)** — an independent defect with no active change to ride.\n\n**Authoring stage (propose\u002Fplan authoring):** when a finding's file is already inside the\nchange's own file surface, fold in — extend the owning task's declared scope or add a task —\ninstead of capturing a brief. The full-pipeline cost of a captured one-line fix is the\nbacklog problem this tiering exists to prevent.\n\n### Artifact policy\n\nSee `docs\u002Fdesign\u002Fhistory\u002Fgo-v1-design.md` §6 (unchanged in v2): commit the durable SDD\nrecord (spec, tasks, contracts, KG, epics); gitignore point-in-time scratch\n(reviews, run scratch). Run records live outside the repo (`~\u002F.worktrail\u002Fruns`).\n\n## Examples\n\n**Example: \u002Fgo dispatches a defect-repair request.** User types `\u002Fgo fix the donation receipt date bug`. The `\u002Fgo` skill classifies it as route F (defect-repair), then invokes: `sdd-workflow \u003Crepo> route:F \u003Cspec-id>`. sdd-workflow executes routes.md §F (reproduce → regression test → narrowest fix → PR) and finishes with `completed_pr_open`.\n\n**Example: Direct invocation redirects.** User types bare `sdd-workflow`. Step 0 guard detects no `route:X` arg and prints: \"sdd-workflow is an internal executor. Use \u002Fgo for all engineering work.\" Stops without action.\n","# `sdd-workflow` — the SDD conductor (v2)\n\n## Overview\n\nPipeline: `intake (route:X) → record start → execute route → validate → PR → merge gate → outcome`\n\nRoute playbooks: `..\u002Fworktrail-go\u002Freferences\u002Froutes.md`.\n\n## When to Use\n\n**INTERNAL ONLY.** Users do not invoke this skill directly — all SDD work enters\nthrough `\u002Fgo`. A prompt containing `[WORKTRAIL INTERNAL DISPATCH]` is the supported\nadapter form produced after `\u002Fgo` has selected this executor: honor it, execute\nthe supplied arguments directly, and never re-enter `worktrail-go`.\n\n## Instructions\n\n- **Authority:** code + tests = truth for what *is*; spec\u002Fcontracts = what\n  *should be*; `knowledge-graph.json` = self-healing cache; **never read\n  `reviews\u002F*-review.md` as current state.**\n- **Business outcome first:** before planning\u002Fimplementing, identify the\n  user\u002Fbusiness problem, who benefits, the smallest complete outcome, and\n  whether the request fits the product's current scope. Record material\n  assumptions in the run record. Don't build technically interesting work with\n  no defined outcome.\n- **Terse output:** one short status line per phase; print script output, don't\n  paraphrase; batch independent commands in one message.\n- **Token discipline:** retrieval order = instructions → controlling artifact →\n  GitNexus (base-branch map; worktree diff wins) → exact files → targeted grep →\n  tests → merged PRs → broad search last. Load only the selected route playbook.\n  Hand subagents pointers, not blobs. The run record is the working memory —\n  update it instead of re-reading materials.\n- **GitNexus\u002Fworktree boundary:** GitNexus normally indexes the canonical base checkout,\n  not Worktrail's generated task\u002Fspec worktrees. In a worktree, use its actual files,\n  `rg`, and tests as ground truth for the current branch; use GitNexus only for\n  base-branch context and broader callers\u002Fdependents. If they disagree, assume the graph\n  is stale relative to the branch and let the worktree win. Do not require or create a\n  worktree-local `.gitnexus\u002F` index. Before a rename, deletion, or PR, combine an\n  unfiltered `rg \"\u003Cname>\" .` from the worktree root with GitNexus query\u002Fimpact against\n  the canonical repository.\n\n**No script resolution needed.** Every command below is a console script installed by the\n`worktrail` package (`worktrail-run-record`, `worktrail-live`, `worktrail-pre-pr-gate`, …), on\n`PATH`. If one is missing, stop and report that `worktrail` is not installed.\n\n### Step 0 — Direct-invocation guard\n\nIf the prompt contains `[WORKTRAIL INTERNAL DISPATCH]`, treat it as an authorized\nadapter-to-executor handoff. Do not redirect to `\u002Fgo`; apply the same `route:X`\nargument validation below and proceed. `worktrail-skill-dispatch` independently\nbounds this path to one nested dispatch and fails with\n`blocked_internal_dispatch_recursion` if a child re-enters the front door.\n\nIF no `route:X` positional arg is present, THEN print the redirect message and stop.\nThis applies to handoff-seed invocations too: callers must pass both\n`handoff:\u003Cid>` and the resolved `route:X`:\n\n```\nsdd-workflow is an internal executor. Use \u002Fgo for all engineering work.\n```\n\nOtherwise, proceed to Phase 1.\n\n### Phase 1 — Intake (parse args; bypass interactive screens)\n\nThree entry paths, detected in order:\n\n- **Seeded-dispatch** — input contains all five labels (`Repo:`, `Base branch:`, `Route:`, `Spec:`, `Run record path:`). Detect, parse fields, skip to Phase 6. See `#seeded-dispatch` in `..\u002Fworktrail-go\u002Freferences\u002Fsubagent-prompts.md` for detection criteria and bypass behavior.\n- **Handoff-seed** — first arg is `handoff` or `handoff:ID`. See `#handoff-seed` in subagent-prompts.md.\n- **Direct-intent** — positional args for repo hint, intent, spec name. Standard flow below.\n\nPositional args (all optional); hold as `$ARG_REPO`, `$ARG_INTENT`, `$ARG_SPEC`.\nUnrecognised value → warn once and fall back.\n\n| Pos | Values | Effect |\n|---|---|---|\n| 1 | repo name or path hint | passed to resolver as `--hint` |\n| 1 | `handoff` or `handoff:ID` (case-insensitive) | handoff-seed mode — NOT a repo hint; see `#handoff-seed` in subagent-prompts.md. The brief's optional `recommended-route:` frontmatter feeds classification (`--handoff-route`). |\n| 2 | `new` `implement` `continue` `pr` `brainstorm` | v1 intent — skips classification, maps to routes C+D \u002F D \u002F E \u002F E(pr) \u002F A |\n| 2 | `route:A`..`route:J` | explicit route override |\n| 3 | spec folder name (e.g. `003-payments`) | skips spec picker |\n| any | `by:\u003Cdispatch-id>` (labeled, matched by prefix — not positional) | handoff-seed mode only: the caller's `$INVOCATION_CONTEXT_DISPATCH_ID`. Hold as `$GO_DISPATCH_ID` and pass `--by \"$GO_DISPATCH_ID\"` on the handoff-seed claim call (`#handoff-seed` Step 3) so `claim()`'s `same_owner` result can tell this dispatch's own claim apart from a different dispatch's. Every `handoff:\u003Cid>` dispatch from `worktrail-go` carries this token (Dispatch Contract, `worktrail-go\u002FSKILL.md`); its absence means an older caller or a non-`\u002Fgo` invocation — fall back to an unqualified claim call (no `--by`), which yields `same_owner: null` and must be treated as \"not confirmed mine,\" never as true. |\n| any | `run:\u003Cpath>` (labeled, matched by prefix — not positional) | native-skill dispatch only (both the handoff-seed and direct-intent forms): the caller's already-open run record path, i.e. `worktrail-go`'s own Phase 6 `$RUN`. Hold as `$GO_RUN_PATH` — Phase 6 below reuses it instead of starting a second run record. Its absence means an older caller or a non-`\u002Fgo` invocation; fall back to Phase 6's normal `start` call. The seeded-dispatch entry path is unaffected — it already carries `$RUN` directly from the seed and never reaches this token. |\n\n### Phase 6 — Start the run record\n\nIf `$GO_RUN_PATH` was parsed in Phase 1 (native-skill dispatch — see the Dispatch Contract\nin `worktrail-go\u002FSKILL.md`), **reuse it instead of starting a second run record** — this is\nthe fix for the orphaned-parent-record bug documented in\n`docs\u002Fspecs\u002Fresearch\u002Fdead-dispatch-backlog-investigation.md` (observations 5\u002F6: every\nnative-skill dispatch that instead called `start` here left the parent's record stuck at\n`route_selected` forever, since only the child's record ever reached `finish()`):\n\n```bash\nRUN=\"$GO_RUN_PATH\"\nworktrail-run-record set \"$RUN\" base_branch \"$BASE\"\nworktrail-run-record set \"$RUN\" base_commit \"$(git -C \"$REPO\" rev-parse --short HEAD)\"\n```\n\nOtherwise — no `$GO_RUN_PATH` (an older caller or a non-`\u002Fgo` invocation; the\nseeded-dispatch path already skipped straight here in Phase 1 with its own attached `$RUN`\nand never reaches this branch either) — start a fresh run record as before:\n\n```bash\nworktrail-run-record start --repo \"$REPO\" --request \"\u003Csummary>\" \\\n  --route \u003CX> --risk \u003Clevel> --reason \"\u003Cclassifier reason>\" \\\n  --base-branch \"$BASE\" --base-commit \"$(git -C \"$REPO\" rev-parse --short HEAD)\"\n```\n\nHold the returned `path` as `$RUN`. Through the run: `set $RUN status \u003Cphase>`\nat transitions; `append $RUN decisions|assumptions|deferred_work|...` as they\nhappen. End every run with `finish --status \u003Cone of the ten completion states>`\n— vague completion language is forbidden.\n\n**Log every manual rescue** via `run_record.py intervention $RUN --category \u003Ccategory> --minutes \u003Cest> --tokens \u003Cest> --note \"...\"` (categories + rationale: go-design.md §interventions).\n\n### Phase 7 — Execute the route\n\nRead **only** the selected playbook section in `..\u002Fworktrail-go\u002Freferences\u002Froutes.md`:\n\n| Route | Playbook | Engine |\n|---|---|---|\n| A idea-discovery | routes.md §A | brainstorm (discovery framing) |\n| B epic-planning | routes.md §B | epic doc + feature decomposition |\n| C feature-planning | routes.md §C | `new` pipeline (pipeline-details.md#new-pipeline), then explicit C→D transition |\n| D implementation | routes.md §D | `new`\u002F`implement` pipelines (pipeline-details.md) |\n| E continue\u002Fresume | routes.md §E | state restore + re-entry (incl. PR\u002FCI repair) |\n| F defect-repair | routes.md §F | `modify` pipeline (pipeline-details.md#modify-pipeline), change-spec bugfix; 1-task mechanical changes ride the direct branch (`worktrail-modify-direct-gate`) |\n| G spec-change | routes.md §G | `modify` pipeline (pipeline-details.md#modify-pipeline), change-spec delta; 1-task mechanical changes ride the direct branch (`worktrail-modify-direct-gate`) |\n| H refactor\u002Fdebt | routes.md §H | characterization tests → narrow implement |\n| I investigation | routes.md §I | evidence only → recommended next route |\n| J workflow-evolution | routes.md §J | this repo, cassette-gated |\n\nSpecialist skills (security review, typescript\u002Freact review, render, …) are\nloaded by the playbook at the phase that needs them — never all up front.\n\n### Pipeline — `new` (Route C, and Route D when no spec exists)\n\nStep sequence: overlap-check → worktree → brainstorm → spec-check → precheck → (optional technical-plan) → spec-to-tasks → stale-spec-check → orchestrator → sync. See `references\u002Fpipeline-details.md#new-pipeline` for full steps with bash commands and guards.\n\nRoute C closeout: spec PR + implementation-intent transition. Requested intent\ncontinues into Route D in the same run; planning-only intent finishes as\n`planned_ready_for_implementation`; unknown intent asks once and records the\ndecision (`$AUTO_MODE=true`: no ask — take the planning-only default; every ask\nsite in route execution follows\n`..\u002Fworktrail-go\u002Freferences\u002Fsubagent-prompts.md#auto-mode-ask-fallbacks`).\nNever close a requested Route-C brief or create a follow-up handoff\nat the spec\u002Ftask boundary.\n\n### Pipeline — `implement` (Route D, spec already on base)\n\nStep sequence: pick spec → stale-spec-check → precheck → orchestrator → sync. See `references\u002Fpipeline-details.md#implement-pipeline` for full steps.\n\n### Phase 8 — Merge gate and outcome\n\nFor every route whose documented completion requires a PR (`completed_pr_open`,\n`completed_and_merged`, or `completed_awaiting_human_approval`), the run is not\ndone when implementation and validation finish locally. The executor must pass\nthe scope-completeness gate and pre-PR test gate, commit, push, open or update\nthe PR, then evaluate the merge gate before calling `run_record.py finish`.\n\n**Scope completeness gate — before any PR-producing route.** Re-read the\ncontrolling request, handoff Focus\u002FSuggested approach, specification acceptance\ncriteria, and route playbook. For every requested outcome, record one\n`scope-review` entry in the run record with implementation evidence:\n\n```bash\nworktrail-run-record scope-review \"$RUN\" \\\n  --item \"\u003Crequested outcome>\" --status complete --evidence \"\u003Ctest or artifact>\"\n```\n\nDo not create a follow-up handoff for an incomplete requested outcome. Implement\nit before the PR, or stop with a real blocker\u002Fproduct-decision state. An item\nmay be recorded as `out-of-scope` only with a reason beginning `different\npurpose:` or `user approved:` (any other reason is rejected at write time). A\n`blocked` item fails the pre-PR gate. Entries are append-only, but the gate\njudges only the latest entry per `--item`, so re-record an item to supersede an\nearlier `blocked` or mis-phrased entry.\n\n**Commit, compile, gate, push, open PR, watch CI.** Run the shared landing\npipeline from the worktree root; it atomically handles commit, compile-marker\nverification, pre-PR gate, push, PR open\u002Fupdate, CI watch to a terminal\noutcome, and run-record finish. Requires `--repo`, `--base`, `--title`,\n`--summary` or `--summary-file`, `--route`, `--risk`, `--commit-message`\nwhenever the tree is dirty — the normal dispatch case, since a dispatch's work\nis uncommitted; only a clean tree may omit it — optional `--gates`, and\n`--json`:\n\n```bash\nworktrail-land-pr --repo \"$PWD\" --base \"$BASE\" --run \"$RUN\" --title \"$TITLE\" \\\n  --summary-file \u002Fpath\u002Fto\u002Fpr\u002Fbody --route \"$ROUTE\" --risk \"$RISK_LEVEL\" \\\n  --commit-message \"$COMMIT_MESSAGE\" --gates \"$GATES\" --json\n```\n\n| Exit code | Outcome | State |\n|---|---|---|\n| 0 | `landed` | PR merged or auto-merge armed; run record finished. |\n| 2 | `refused` | Rejected before push (dirty tree, compile gaps, preflight fail); remote untouched, re-run with fixes. |\n| 3 | `code_defect` | PR open, CI failed, run record open for repair. |\n| 3 | `review_threads_blocking` | PR open, review threads unresolved, run record open for gate action. |\n| 4 | `ceiling` | Push succeeded but PR create failed, or 5 code-defect iterations exhausted. |\n\n**On `code_defect` outcome:** Repair the failing check per\n`..\u002Fworktrail-go\u002Freferences\u002Fci-watch-loop.md` case 3 (diagnose root cause,\napply minimal patch, disarm auto-merge, push), then re-run the same\n`worktrail-land-pr` command.\n\n**On `review_threads_blocking` outcome:** Review and act on the unresolved\nreview threads per `..\u002Fworktrail-go\u002Freferences\u002Fci-watch-loop.md` review-thread\ngate (fix in code, push + re-run the gate, or record an explicit decision),\nthen re-run the same `worktrail-land-pr` command.\n\nOnly routes with non-PR completion states (for example\n`planned_ready_for_implementation` or `investigation_complete`) may stop\nwithout commit\u002Fpush\u002FPR creation. If a non-PR-completion run produces a PR\nanyway — e.g. Route I committing its investigation note as a PR per §I — the\nsame `run_record.py finish --pr \u003Curl> ...` call above applies the correction\nautomatically; it keys off `$RUN`'s own `pull_request` field (a no-op when\nunset), not the route or completion state, so there is nothing extra to do\nhere either. Gap observed live before this was code-enforced: datalena PR\n#2228 (Route I, `investigation_complete`) merged a docs-only investigation\nnote with no `go:risk-*` label because the correction was then only a prose\ninstruction reachable from the PR-producing-route branch above, and a human\nhad to apply the label by hand before `CI: Auto-merge on open` would arm.\n\n### Defect handling — the three tiers\n\nA defect, gap, or tech-debt finding surfaced mid-run goes through exactly one of three tiers\n— never straight to capture by reflex:\n\n1. **Fold in** — the finding is a verified defect (reproduced or directly evidenced; a\n   hypothesis or a \"while I'm here\" cleanup is never enough), its fix touches only files\n   already in the unit's declared scope (a task's `files:` for workers; the change's own file\n   surface at authoring time), and the fix is mechanical (restores documented\u002Festablished\n   intent; no new design, API, or behavior contract). Cap: at most 2 fold-ins and ~20 changed\n   lines per task. Fold-ins are committed separately (message starts `fold-in:`), declared in\n   the worker report-back's `fold_ins`, validated in code against the task's declared scope\n   (`fold_in_violations` — an out-of-scope declaration fails the task closed), reviewed for\n   mechanicalness by the independent reviewer, and listed on the PR's `## Fold-in Fixes`\n   section. Never fold a behavior-contract change (that is Route G) and never widen a file\n   scope for one.\n2. **Capture, routed into an active change** — anything out of scope, non-mechanical, or over\n   cap is captured as a work-queue brief; the existing triage `fold-into-change` verdict can\n   attach it to a change already in flight instead of minting a new one.\n3. **Standalone brief (Route F)** — an independent defect with no active change to ride.\n\n**Authoring stage (propose\u002Fplan authoring):** when a finding's file is already inside the\nchange's own file surface, fold in — extend the owning task's declared scope or add a task —\ninstead of capturing a brief. The full-pipeline cost of a captured one-line fix is the\nbacklog problem this tiering exists to prevent.\n\n### Artifact policy\n\nSee `docs\u002Fdesign\u002Fhistory\u002Fgo-v1-design.md` §6 (unchanged in v2): commit the durable SDD\nrecord (spec, tasks, contracts, KG, epics); gitignore point-in-time scratch\n(reviews, run scratch). Run records live outside the repo (`~\u002F.worktrail\u002Fruns`).\n\n## Examples\n\n**Example: \u002Fgo dispatches a defect-repair request.** User types `\u002Fgo fix the donation receipt date bug`. The `\u002Fgo` skill classifies it as route F (defect-repair), then invokes: `sdd-workflow \u003Crepo> route:F \u003Cspec-id>`. sdd-workflow executes routes.md §F (reproduce → regression test → narrowest fix → PR) and finishes with `completed_pr_open`.\n\n**Example: Direct invocation redirects.** User types bare `sdd-workflow`. Step 0 guard detects no `route:X` arg and prints: \"sdd-workflow is an internal executor. Use \u002Fgo for all engineering work.\" Stops without action.\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25},"Bash, Read, Glob, Grep, AskUserQuestion, Skill, Agent","[repo-name-or-path|handoff|handoff:ID] [new|implement|continue|pr|brainstorm|route:A-J] [spec-id]","main","db448e94704b506e1a5a0665d349fc422611fe9e","skills\u002Fworktrail-sdd-workflow","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail","https:\u002F\u002Fgithub.com\u002Fbehindthedash","2026-11-14 18:34:42",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add behindthedash\u002Fworktrail --skill worktrail-sdd-workflow",{"tool":38,"command":39},"bunx","bunx skills add behindthedash\u002Fworktrail --skill worktrail-sdd-workflow",{"tool":41,"command":42},"pnpm","pnpm dlx skills add behindthedash\u002Fworktrail --skill worktrail-sdd-workflow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-sdd-workflow\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fpipeline-details.md","REFERENCE","参考文档",18818,"https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-sdd-workflow\u002Freferences\u002Fpipeline-details.md",[53,60,67,74,81,88],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M79PMKBE8SYW0ZP14AEJDM5D","worktrail-routing-config","Configure Worktrail's agent routing table (`~\u002F.worktrail\u002Frouting.yaml`, or a repo-local `routing:` policy block) — which harness\u002Fmodel executes each role and tier, and how fallback between them works. Use when the operator wants to add or remove a harness\u002Fadapter (claude\u002Fcodex\u002Fopencode), add a model to an existing harness (e.g. adding a DeepSeek model to opencode), pin or change who does code review, add a new tier or purpose mapping, change the default tier, or is confused about which harness actually served a spawn (e.g. \"why did this use Codex when I only configured Claude\"). Trigger phrases: \"routing.yaml\", \"add a harness\", \"disable a harness\", \"add an adapter\", \"remove an adapter\", \"add a model\", \"add deepseek to opencode\", \"change the reviewer\", \"pin the reviewer\", \"routing tiers\", \"routing targets\", \"default_tier\", \"independent reviewer\", \"why did codex get called\". This skill is about *editing the config file*; it does not cover `\u002Fgo`'s own dispatch mechanics (see `worktrail-go`'s SKILL.md Phase 7 for how `tier_for()`\u002F`select_cell()` resolve it at runtime).","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-routing-config\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M79PMB24YTZTZVVAKA4A4R38","worktrail-repo-init","Bootstrap a new repo, or migrate an existing single-branch repo, onto the workspace's repo-standards doctrine (~\u002Frules\u002FCLAUDE.repo.md): the AGENTS.md-is-truth\u002FCLAUDE.md-imports-it split, a dev\u002Fprd, dev\u002Fstg\u002Fprd, or main-only (trunk) branch model with matching GitHub rulesets, an OpenSpec scaffold, an auto-merge workflow, and a seeded .worktrail\u002Fpolicy.yaml. Trigger phrases: \"onboard this repo\", \"apply repo standards\", \"initialize repo standards\", \"set up this repo like the rest of the fleet\", \"bring this repo into line with the repo standards doctrine\".","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-repo-init\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M79PM54RFP51Q2JPQGE13ZP8","worktrail-help","Show the Worktrail front-door commands and accepted positional arguments. Use when the user asks how to invoke worktrail-go, wants the available handoff, spec, pr, repo, or route forms, invokes worktrail-go with help or with a bare noun, or asks how to answer a filed product decision (worktrail-decision).","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-help\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M79PKVZVBF4VFT5XEPCPNM9S","worktrail-handoff","Capture a discovered problem, gap, tech debt, or deferred work into a local work queue so a future agent session can pick it up cold. Use mid-session whenever you set work aside instead of doing it now — a fix you judge out of scope for this PR, work that belongs in a follow-up or a separate\u002Flater PR, an item you're deferring, or something worth fixing you won't tackle now — so the outstanding item isn't lost without derailing current work; can be called multiple times per session. Trigger phrases: \"defer this\", \"item deferred\", \"out of scope for this PR\", \"follow-up work\", \"leave for another PR\", \"capture for later\", \"outstanding item\". This skill captures only. Picking a brief back up is the front door's job: worktrail-go \u003Cbrief-id>.","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-handoff\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M79PKJZD9MPN7Q8GWR01KX0J","worktrail-go","Use when the user invokes worktrail-go, asks to pick up queued work, resume active specs, implement or fix a spec, route engineering work, or orient across repositories. Renders the orientation dashboard, classifies free-text requests, claims\u002Fresumes handoff briefs, and dispatches SDD work without requiring the user to know sdd-workflow. Grammar: worktrail-go [REPO] \u003Cnoun> \u003Cverb>, nouns handoff \u002F spec \u002F pr \u002F decision. Triggers: worktrail-go, worktrail-go help, worktrail-go spec fix, worktrail-go spec implement, worktrail-go spec route F, worktrail-go handoff new, worktrail-go handoff auto, worktrail-go decision answer, worktrail-go BRIEF-ID, bare worktrail-go, multi-repo orientation.","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fworktrail-go\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M79PKF5TJCEH2ATW902XMSZ3","openspec-update-change","Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.","https:\u002F\u002Fgithub.com\u002Fbehindthedash\u002Fworktrail\u002Fblob\u002Fmain\u002Fskills\u002Fopenspec-update-change\u002FSKILL.md",[],[]]