Skip to content

T-SW5E-worktree-init-verifies-clean-checkout

Status: closed/superseded · Impact: medium · Complexity: small

AUTO-DEFINED: this spec was best-effort machine-authored by /sdlc:task-auto-define on 2026-07-18 because the task is autonomy: autonomous/pr. Review the Goal, Approach, Today, Files-to-touch, and Acceptance-criteria carefully before trusting it.

A fresh task worktree can arrive dirty, and nothing in task-work Step 4 notices — the dirt surfaces later as a mysterious quality-gate failure the implementer must diagnose mid-task. From the originating post-mortem:

A fresh task worktree arrived with a broken uncommitted block comment (a path/**/*.ts glob whose */ terminated the comment) that failed typecheck; origin unclear. task-work Step 4 should verify the fresh worktree is clean (git status --porcelain empty) right after git worktree add and again after running the worktree_init verbs, failing loud with a diagnostic instead of letting inherited dirt surface later as a mysterious quality-gate failure.

T-2KK8-capability-kind-grains-and-locations

LocationRole today
apps/sdlc/skills/task-work/SKILL.mdStep 4 (”## 4. Create the worktree” and ”### Initialize the worktree”) runs git worktree add and then the worktree_init verbs via sdlc quality run --key worktree_init --allow-empty. Neither point checks the worktree is clean, so inherited dirt surfaces later as a mysterious Step 7 quality-gate failure.
docs/skills/task-work.mdPer-skill doc; flowchart node S4 describes Step 4 as “Create the worktree + run worktree_init verbs” with no mention of a cleanliness gate.

Step 4 gains two fail-loud cleanliness verifications: one immediately after git worktree add, one immediately after the worktree_init executor returns. Each runs git status --porcelain in the fresh worktree and, when output is non-empty, stops the run with a diagnostic that prints the dirty paths and names which stage introduced them (present at creation vs. introduced by the init verbs) instead of proceeding to Step 5.

  1. In apps/sdlc/skills/task-work/SKILL.md Step 4, immediately after the git worktree add command block, add a short “verify the fresh worktree is clean” instruction: run git -C .sdlc/worktrees/<basename> status --porcelain and expect empty output. Non-empty output is a hard error — print the porcelain lines, state the dirt was present at worktree creation (inherited, e.g. from hooks or copy artifacts), and stop before Step 5.
  2. In ”### Initialize the worktree”, after the executor’s exit-0 outcome, add the second check: re-run the same git status --porcelain probe. Non-empty output now implicates the declared worktree_init verbs — print the porcelain lines plus the verb list from sdlc.yaml, and stop before Step 5.
  3. Word both checks per the house rules in apps/sdlc/skills/CLAUDE.md: gate on the bare command (no pipe that would mask output or exit code), positive framing, and keep each added block to a few constraints so Step 4’s constraint density stays within the S-0006 cap.
  4. Update docs/skills/task-work.md (flowchart node S4 and its Step 4 prose) to mention the two cleanliness verifications so the per-skill doc stays in lockstep with the skill.
  5. Verify: run the repo quality checks from sdlc.yaml (bunx tsc --noEmit and the scoped bun test, which includes the skill-prose contract test apps/sdlc/lib/services/gate/ops/_skill_prose_contract.test.ts) and confirm both new checks appear in Step 4 by re-reading it.
LocationKindChange
apps/sdlc/skills/task-work/SKILL.mdmodifyAdd the two fail-loud git status --porcelain cleanliness checks to Step 4: after git worktree add and after the worktree_init executor.
docs/skills/task-work.mdmodifyReflect the new Step 4 cleanliness gate in flowchart node S4 and the surrounding prose.
  • AC-1: apps/sdlc/skills/task-work/SKILL.md Step 4 instructs a git status --porcelain check immediately after git worktree add, with non-empty output a hard stop that prints the dirty paths.
  • AC-2: Step 4 instructs a second git status --porcelain check after the worktree_init executor returns, and its diagnostic distinguishes dirt introduced by the init verbs from dirt present at creation.
  • AC-3: Neither new check pipes the gated command through a filter (grep -n "porcelain" apps/sdlc/skills/task-work/SKILL.md shows both occurrences unpiped), per “Don’t pipe commands you gate on” in apps/sdlc/skills/CLAUDE.md.
  • AC-4: docs/skills/task-work.md mentions the Step 4 cleanliness verification.
  • AC-5: bunx tsc --noEmit and the scoped bun test from sdlc.yaml pass on the branch.
  • A new sdlc CLI verb or co-located script for the check — two bare git status --porcelain probes in prose don’t warrant deterministic tooling yet.
  • Auto-remediating a dirty worktree (git checkout -- . / git clean) — the step fails loud; remediation stays with the operator.
  • Diagnosing the original broken-block-comment source reported in T-2KK8-capability-kind-grains-and-locations.
  • Changes to worktree_init verb discovery (/sdlc:find-worktree-init) or to the sdlc quality run executor itself.
  • none

Spawned by /sdlc:spawn-task-pr on 2026-07-18 UTC from T-2KK8-capability-kind-grains-and-locations in https://github.com/sksizer/dev.


← Back to Tasks