[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M752SXJA55CM3BZGXJX6GFQ7":3,"skill-same:01M752SXJA55CM3BZGXJX6GFQ7":42},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":17,"linkOnly":18,"markdownContent":19,"markdownBody":19,"frontMatter":20,"refName":21,"commitSha":22,"skillDirectory":23,"forksCount":24,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":27,"install":28,"resources":41},"01M752SXJA55CM3BZGXJX6GFQ7","sd-replan-loop",null,"developzoneio\u002Fspecwright","developzoneio","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F288244965?v=4","01M752S4GQXBCH6H67H28M9HTN","01M752S4HXZ73BTCHG2K1VCYQA",10,"MIT","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Fskills\u002Fsd-replan-loop\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"# sd-replan-loop\n\nSanctioned mid-execution re-plan protocol for specwright. Lets a workflow adapt when execution (or\nthe batch review) reveals that `02-tasks.md` is wrong, **without** violating spec immutability or\nskipping a gate. Referenced at runtime by `\u002Fsd:feature` and `\u002Fsd:refactor` - the only two workflows\nthat produce a `01-plan.md` + `02-tasks.md` pair to re-plan.\n\nNot used by `\u002Fsd:bug`, `\u002Fsd:perf`, or `\u002Fsd:rca`: bug and rca produce no atomic task list, and perf\nalready carries its own adaptive loop (Phase 4 reverts a failed hypothesis and re-selects at Gate 4).\n\n---\n\n## The problem this solves\n\nThe Planning pattern's strength is **adaptivity** - re-planning when execution surfaces new\ninformation. specwright's immutability rule is right for audit, but it left the adaptive path\n**undefined**: when an implementer discovers mid-Execute that a task's premise is false, or the batch\nreview finds the plan itself was wrong, there was no sanctioned move. The failure mode is a model\nsilently hack-editing `02-tasks.md` (violating sequencing, leaving no trail) or stalling.\n\nThe discovery point is **not only mid-task**. In the one measured corpus, the single real case of a\nwrong plan surfaced at **batch review**: an implementer found a spec decision was wrong, hand-edited\nthe task, corrected the spec, and left one sentence in the retro - no gate, no append-only record.\nThe re-plan gate must be reachable from **both** the Execute phase and the review phase.\n\n---\n\n## What counts as a plan-invalidating discovery\n\nA re-plan is warranted only when the **plan** is wrong, not when a single task needs a normal\nimplementation adjustment. Trigger the loop when:\n\n- A task's stated premise is false - a `Pattern refs` precedent does not exist, an interface differs\n  from what the task assumed, a `Depends on` edge is backwards, or the `Files` list cannot carry the\n  change.\n- A task is now known to be missing, redundant, or mis-sequenced given what execution revealed.\n- The batch review (feature Phase 5, refactor Phase 6) finds the plan itself is wrong - the classic\n  case: a spec\u002Fplan decision that only proves incorrect once the code is written.\n\nDo **not** trigger the loop for work that stays inside one task's contract (a rename, a helper reuse,\na test tweak). That is ordinary implementation, handled by the implementer's own scope. Re-planning\nis for changing the **plan**, not for doing the task.\n\n---\n\n## Gate Re-plan (HARD)\n\nWhen a plan-invalidating discovery lands, the workflow returns to this gate. It is HARD - it STOPS\nand waits for explicit user approval; silence is not approval, and there is no override path.\n\n1. **Surface the trigger.** Present to the user: what was discovered, which task(s) it invalidates,\n   and the proposed delta. Ask:\n\n   > Re-plan `\u003CSPEC-ID>`? Discovery: `\u003Ctrigger>`. Affects `\u003Ctask IDs>`. (approve \u002F revise `\u003Cfeedback>` \u002F abort task)\n\n   - `approve` -> proceed to step 2.\n   - `revise` -> adjust the proposed delta and re-ask. Loop.\n   - `abort task` -> do not re-plan; return to the workflow's normal abort handling for that task.\n\n2. **Append a revision entry to `01-plan.md`** (never rewrite prior content - see format below).\n   Assign the next contiguous revision number `R\u003Cn>`.\n\n3. **Regenerate only the affected tasks in `02-tasks.md`.** Invoke `sd-spec-architect` with\n   `TASK = plan`, `REPLAN_SCOPE = \u003Caffected task IDs>`, and `REVISION = R\u003Cn>`. The architect\n   rewrites only those task blocks, marks each with `Revised-by: R\u003Cn>` (per `sd-atomic-task-format`),\n   and leaves every other task block byte-for-byte unchanged.\n\n4. **Resume.** Re-enter the Execute phase at the first affected (now regenerated) task. Already-passed\n   tasks that the revision did not touch stay checked.\n\n---\n\n## The `## Revisions` log (`01-plan.md`)\n\nAppend-only. Lives at the **end** of `01-plan.md`, below the original plan prose. The original plan\ntext - phased overview, sequencing rationale, risks - is **never edited**; a re-plan only appends\nhere. Create the `## Revisions` header on the first revision.\n\n```markdown\n## Revisions\n\n### R1 - \u003CUTC ISO 8601 timestamp>\n\n- Trigger: \u003Cthe discovery that invalidated the plan - one or two lines>\n- Phase: \u003Cexecute | review>\n- Gate: re-plan\n- Affected tasks: \u003CT## list>\n- Delta: \u003Cwhat changed in those tasks and why>\n- revised-from: \u003Cone-line pointer to the original intent - what the tasks assumed before>\n```\n\nRules:\n\n- **Contiguous numbering.** Revisions are `R1`, `R2`, `R3` ... with no gaps and no reuse. `R\u003Cn>`\n  never appears twice.\n- **Append-only.** A prior `R\u003Ck>` entry is never edited or deleted. A later correction is a new\n  entry that supersedes it in prose, never a rewrite.\n- **Every entry names a gate event.** The `Gate: re-plan` and `Phase:` lines record that the entry\n  came through this gate, not from a hand-edit. An entry with no gate\u002Fphase line is malformed.\n- **Symmetry with tasks.** Every `Affected tasks` ID in `R\u003Cn>` must name a task block in\n  `02-tasks.md` that carries `Revised-by: R\u003Cn>`, and every task carrying `Revised-by: R\u003Cn>` must be\n  listed in entry `R\u003Cn>`. `\u002Fsd:spec validate` enforces this both ways (`SL070`-`SL073`).\n\n---\n\n## Immutability boundary\n\n- **Never re-plan a `done` spec.** The loop runs only while the spec is `in-progress`. In-progress\n  specs are mutable by definition; this protocol never touches a `done` (or `archived`) spec.\n- **The original plan prose is intact.** Only the `## Revisions` section grows.\n- **Regenerated task blocks are replaced in place** in `02-tasks.md`; their history lives in the\n  `## Revisions` log and the `revised-from` pointer, not in stale text left behind.\n\n---\n\n## What validate can and cannot see (honest scope)\n\n`\u002Fsd:spec validate` is a **static linter** over `.specs\u002F`. It has no snapshot of `02-tasks.md` as it\nstood at Plan phase, so it **cannot** detect an arbitrary silent edit by diffing. What it enforces is\nthe **internal consistency of the revision record** (`SL070`-`SL073`): a task marked `Revised-by: R\u003Cn>`\nwith no backing entry, an entry naming tasks that do not carry the marker, non-contiguous or rewritten\nhistory, a malformed entry. A compliant re-plan always marks its work, so the linter catches a\n**broken record**; an unmarked hack-edit stays invisible to the linter and is prevented by the gate,\nnot the lint. State this boundary plainly - do not imply the linter diffs the file.\n",{},"main","cb6a2aef549bb625b9ba1869d220d40938e83c18","skills\u002Fsd-replan-loop",0,"https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio","2026-11-11 17:12:43",{"source":7,"skillName":5,"commands":29,"prompt":39,"zipAvailable":40},[30,33,36],{"tool":31,"command":32},"npx","npx skills add developzoneio\u002Fspecwright --skill sd-replan-loop",{"tool":34,"command":35},"bunx","bunx skills add developzoneio\u002Fspecwright --skill sd-replan-loop",{"tool":37,"command":38},"pnpm","pnpm dlx skills add developzoneio\u002Fspecwright --skill sd-replan-loop","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Fskills\u002Fsd-replan-loop\u002FSKILL.md",true,[],[43,49,54,60,65,70],{"skillNo":44,"name":45,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":46,"categories":47,"keywords":48,"publishedAt":17},"01M752V2C4FNMKBZTZETKKN70B","sd-model-escalation","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Ftests\u002Fcontract-lint\u002Ffixtures\u002Ffp-cl605-alias-list\u002Foverlay\u002Fskills\u002Fsd-model-escalation\u002FSKILL.md",[],[],{"skillNo":50,"name":45,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":17},"01M752V0C3S0BHSXZ4JM3B7MF2","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Ftests\u002Fcontract-lint\u002Ffixtures\u002Ffp-cl601-allow-comment\u002Foverlay\u002Fskills\u002Fsd-model-escalation\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":17},"01M752TYQZVASA2BTDRZB4N8W6","sd-demo-guard","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Ftests\u002Fcontract-lint\u002Ffixtures\u002Ffp-cl009-phrase-outside-phase0\u002Foverlay\u002Fskills\u002Fsd-demo-guard\u002FSKILL.md",[],[],{"skillNo":61,"name":45,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":17},"01M752TXBFQHK7NCDTZEBHZRFN","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Ftests\u002Fcontract-lint\u002Ffixtures\u002Fcl605-command-restates-ladder\u002Foverlay\u002Fskills\u002Fsd-model-escalation\u002FSKILL.md",[],[],{"skillNo":66,"name":45,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":17},"01M752TVDG89BJRTGFET80RCK2","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Ftests\u002Fcontract-lint\u002Ffixtures\u002Fcl604-row-skips-rung\u002Foverlay\u002Fskills\u002Fsd-model-escalation\u002FSKILL.md",[],[],{"skillNo":71,"name":45,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":17},"01M752TT6SD0SSK6Z0GQ4HM68P","https:\u002F\u002Fgithub.com\u002Fdevelopzoneio\u002Fspecwright\u002Fblob\u002Fmain\u002Ftests\u002Fcontract-lint\u002Ffixtures\u002Fcl603-full-model-id-in-row\u002Foverlay\u002Fskills\u002Fsd-model-escalation\u002FSKILL.md",[],[]]