T-RNHP-autonomy-body-fill-lands-on-main
Status: closed/superseded · Impact: medium · Complexity: small
AUTO-DEFINED: this spec was best-effort machine-authored by /sdlc:task-auto-define on 2026-07-04 because the task is autonomy: autonomous/pr. Review the Goal, Approach, Today, Files-to-touch, and Acceptance-criteria carefully before trusting it.
For an autonomy: autonomous/pr task, the ensure-ready gate best-effort fills
missing body sections via /sdlc:task-auto-define. Those auto-defined body edits
(e.g. a synthesized ## Today) are committed on the task branch, but
start_task’s reset --hard origin/main later wipes the branch back to
origin/main. The frontmatter readiness stamp survives because it is written to
origin/main directly, but the required body section does not — so origin/main
ends up carrying a task that is stamped ready yet missing a section the
implementation-ready contract requires. Close the gap so the autonomy auto-define
body edits land on origin/main (like the stamp does), not on the
soon-to-be-reset task branch.
Quote from the originating post-mortem:
autonomy: autonomous/prgap-fill is discarded bystart_task’s reset — the auto-defined## Todaysection lands on the task branch, butstart_task.ts’sreset --hard origin/mainwipes it, so the readiness stamp reachedorigin/mainwhile the required Today section did not. Fix: the ensure-ready autonomy gate’s auto-define body edits should land onorigin/main(like the stamp does), not on the soon-to-be-reset task branch.— from the post-mortem of T-PDDK-gs-scaffold-package-and-tooling
Scope note: the companion post-mortem bullet asked for a sanctioned
--commit-on main body-edit primitive, since only frontmatter has a main-commit
path today and the ad-hoc git push origin HEAD:main is blocked by the sandbox
guard. That primitive is already in flight as
T-NXAM-task-doc-edit-commit-on-main (sdlc task doc-edit --commit-on main).
This task is the autonomy-path consumer of that primitive: route the ensure-ready
autonomy auto-define body-fill through the main-commit path so the synthesized
sections survive start_task’s reset. It builds atop T-NXAM rather than
re-adding the verb.
| Location | Role today |
|---|---|
plugin/skills/task-ensure-ready/SKILL.md | Autonomy gate (Step 3a) dispatches /sdlc:task-auto-define on an autonomous/pr gap, re-verifies, then stamps readiness; the stamp lands on origin/main via ensure_ready_mutate’s --commit-on main path. |
plugin/skills/task-auto-define/SKILL.md | Synthesizes the missing body sections and commits them on the CURRENT branch (Step 7, via sdlc commit create); there is no main-commit mode. |
plugin/skills/task-work/start_task.ts | Step 5b start path runs git reset --hard origin/main inside the task worktree, discarding any edits that live only on the task branch. |
plugin/skills/task-ensure-ready/ensure_ready_mutate.ts | Stamp/downshift mutator; its --commit-on main path already lands the readiness frontmatter on origin/main through an ephemeral worktree. |
plugin/lib/services/git/commit-to-main.ts#commitToMainViaWorktree | Shared ephemeral-worktree isolation primitive that applies a mutation against a clean tree off origin/main and pushes HEAD:main. |
Proposed
Section titled “Proposed”Give /sdlc:task-auto-define an opt-in main-commit mode and have the
ensure-ready autonomy gate use it, so the synthesized body lands on
origin/main alongside the readiness stamp. Then start_task’s
git reset --hard origin/main, which fast-forwards the task branch onto
origin/main, preserves both the stamp and the synthesized sections
instead of wiping the body. The main-commit primitive itself
(sdlc task doc-edit --commit-on main) is delivered by
T-NXAM-task-doc-edit-commit-on-main; this task is its autonomy-path
consumer.
Approach
Section titled “Approach”- Add a
--commit-on mainflag to /sdlc:task-auto-define, mirroring the ensure-ready flag. Default off preserves the current commit-on-current-branch behaviour. Document it in the SKILL.md usage block and Step 7. - In auto-define Step 7, when
--commit-on mainis set, route the synthesized body edits toorigin/mainthrough the T-NXAM-task-doc-edit-commit-on-main primitive (sdlc task doc-edit --commit-on main) instead ofsdlc commit createon the current branch. The new mode is used by the gate path, which passes neither--set-readynor--make-pr. - In /sdlc:task-ensure-ready Step 3a, thread the gate’s own commit target
into the dispatch: when ensure-ready is invoked with
--commit-on main(the task-work Step 5a path), dispatch /sdlc:task-auto-define with--commit-on main; standalone runs dispatch without it, unchanged. - Fix Step 3a’s re-verify to read
origin/main’s post-fill copy of the task file — the body now lands onorigin/main, not the worktree — so the subsequent readiness stamp (itself--commit-on main) builds on the body-carrying tip. Reuse the existing “read the task file inside an ephemeral worktree offorigin/main” pattern that ensure_ready_mutate and start_task already rely on. - Update the auto-define and ensure-ready prose-contract tests to cover the new flag and the Step 3a forwarding, and refresh the two per-skill docs.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/skills/task-auto-define/SKILL.md | modify | Add the --commit-on main flag and route Step 7’s body commit through the T-NXAM-task-doc-edit-commit-on-main primitive when it is set. |
plugin/skills/task-ensure-ready/SKILL.md | modify | Step 3a forwards --commit-on main to the auto-define dispatch when the gate runs in that mode, and re-verifies against origin/main’s post-fill copy. |
plugin/skills/task-auto-define/tests/task_auto_define.test.ts | modify | Extend the prose-contract layer to assert the new flag is documented and the body-on-main routing is described. |
plugin/skills/task-ensure-ready/tests/ensure_ready.test.ts | modify | Extend the autonomy-gate prose-contract test to assert Step 3a forwards --commit-on main to auto-define. |
docs/skills/task-auto-define.md | modify | Refresh the per-skill doc/flowchart for the new main-commit mode. |
docs/skills/task-ensure-ready.md | modify | Refresh the per-skill doc for the gate forwarding the commit target. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: /sdlc:task-auto-define SKILL.md documents a
--commit-on mainflag whose default (off) preserves the existing commit-on-current-branch behaviour. - AC-2: With
--commit-on main, auto-define lands the synthesized body sections onorigin/mainvia the T-NXAM-task-doc-edit-commit-on-main primitive and makes no commit on the caller’s current branch. - AC-3: /sdlc:task-ensure-ready Step 3a forwards
--commit-on mainto the /sdlc:task-auto-define dispatch when, and only when, ensure-ready itself is invoked with--commit-on main. - AC-4: After the autonomy gate fills a gap in the task-work path, both
the synthesized body sections and
readiness_verified_atare present onorigin/main’s copy of the task file (verifiable by readingorigin/mainafter the gate runs). - AC-5: Running start_task’s
git reset --hard origin/mainin the task worktree leaves the synthesized sections intact, because they live onorigin/mainand the reset fast-forwards rather than discards them. - AC-6: The auto-define and ensure-ready prose-contract test suites assert the new flag and the Step 3a forwarding, and the full test run passes.
Out of scope
Section titled “Out of scope”- Adding the
sdlc task doc-edit --commit-on mainprimitive itself — that is T-NXAM-task-doc-edit-commit-on-main. This task consumes it.
Dependencies
Section titled “Dependencies”- T-NXAM-task-doc-edit-commit-on-main — Proposed/Approach build atop
the
sdlc task doc-edit --commit-on mainprimitive that task ships; recorded in frontmatterdepends_on:2026-08-01 (audit found this task open/ready while its substrate is an unimplemented planning/draft).
Discovery context
Section titled “Discovery context”Spawned by /sdlc:spawn-task-pr on 2026-07-04 UTC from T-PDDK-gs-scaffold-package-and-tooling in the sksizer/dev repo.
Dedup search (spawn-from-post-mortem)
Section titled “Dedup search (spawn-from-post-mortem)”Bullet: The autonomy: autonomous/pr auto-define body edit (path-citation fix) committed on the
task branch is discarded by start_task’s reset --hard origin/main, so it never persists and the
readiness stamp lands on main against the still-original body — task-work’s Step 5a auto-define
should land its body edit on origin/main (as the stamp does) so it survives the reset and main
stays self-consistent. Keywords searched: self-consistent, still-original, path-citation,
auto-define, autonomous, start_task, committed, discarded Excluded: T-NLKF-converge-obsidian-bases
Top candidates (score / status / headline):
- 40 / closed/done / T-CF7M-autonomy-gated-best-effort-auto-define — Add autonomous/pr tier + /sdlc:task-auto-define so ensure-ready best-effort self-readies high-autonomy tasks
- 39 / open/ready / T-RNHP-autonomy-body-fill-lands-on-main — Route ensure-ready autonomy auto-define body edits to origin/main so start_task’s reset preserves them
- 38 / closed/superseded / T-2QXZ-start-task-handles-frontmatter-rebase-cleanly — start_task.py auto-merges frontmatter on stamp/start rebase conflict
- 37 / closed/superseded / T-Y7QU-start-task-fails-loud-on-cache-miss — start_task.py exits non-zero and surfaces cache-miss on lease lookup
- 25 / closed/done / T-H7LB-task-work-appends-post-mortem-stub — task-work appends a post-mortem template stub to the task file at start-time Decision: LINKED-EXISTING T-RNHP-autonomy-body-fill-lands-on-main Rationale: Overrode the script’s SPAWNED. The script returns SPAWNED because its #1 candidate (T-CF7M, score 40) is closed/done; the
2 candidate T-RNHP (score 39, open/ready) is a near-verbatim semantic match to this bullet’s fix —
Section titled “2 candidate T-RNHP (score 39, open/ready) is a near-verbatim semantic match to this bullet’s fix —”route the autonomy auto-define body edit to origin/main so start_task’s reset --hard origin/main
preserves it. Linked to T-RNHP instead of spawning a duplicate. Linked from the post-mortem of
T-NLKF-converge-obsidian-bases on 2026-07-19.
Depends on
Section titled “Depends on”T-NXAM-task-doc-edit-commit-on-main