Skip to content

docs(trusty-mpm): move worktree/checkout discipline from CLAUDE.md into tm-pr-workflow - #5008

Open
bobmatnyc wants to merge 1 commit into
mainfrom
docs/worktree-discipline-to-skill
Open

docs(trusty-mpm): move worktree/checkout discipline from CLAUDE.md into tm-pr-workflow#5008
bobmatnyc wants to merge 1 commit into
mainfrom
docs/worktree-discipline-to-skill

Conversation

@bobmatnyc

@bobmatnyc bobmatnyc commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Moves checkout/worktree discipline out of root CLAUDE.md into the bundled tm-pr-workflow skill, per the owner's ruling: "the CLAUDE.md rule doesn't belong there. Checkout behavior should be in the workflow skill."

What moved, and where

CLAUDE.md's ## Parallel Worktree Discipline section (~95 lines) is now a 3-line pointer naming tm-pr-workflow and docs/reference/worktree-discipline.md.

Generic rules → crates/trusty-mpm/src/assets/skills/tm-pr-workflow.md (bundled source, not a deployed copy), expanding its existing "Worktree Discipline" section:

  • Source of truth is origin/main:HEAD; always fetch before branching
  • Main checkout is inspection-only (allowed/forbidden op list)
  • "A worktree is a writer; the branch is the workstream" — worktree is ephemeral, branch is durable
  • One branch/worktree per independently reviewable PR outcome; related tickets may share one; cross-references the skill's existing "One Outcome, One PR" section for what stays bundled
  • Experiments stay session-local until accepted
  • Cleanup order: git worktree remove --force first, git branch -D + git push origin --delete last (branch is the only durable copy until squash-merge)
  • Generic stash-first fallback for a command that must run from the main checkout
  • Subagent confinement: every dispatch names its exact worktree path; "operate from the main checkout" is a banned instruction pattern; QA agents get their own worktree too

Rust/macOS-specific bits → docs/reference/worktree-discipline.md (already existed, already linked from CLAUDE.md — merged in, not a third copy):

  • cargo install --path .claude/worktrees/<dirname>/crates/<name> --locked as the preferred install pattern, cross-referencing release-workflow.md's existing cdhash explanation instead of restating it
  • The stash-first fallback's concrete cargo install --path crates/<name> --locked example

Rule inventory → destination mapping

Rule (from CLAUDE.md's old section) Landed in
Source of truth = origin/main:HEAD, fetch before branching skill
Main checkout is inspection-only + forbidden-ops list skill
Worktree provisioning command skill (unchanged)
End-to-end delivery chain pointer already resident in skill's "Full Delivery Chain" section (no change needed)
Worktree is a writer / branch is the workstream skill
One branch+worktree per reviewable outcome; shared tickets skill
Everything the outcome owes stays in one worktree/PR already covered by skill's "One Outcome, One PR"; added a cross-reference
Experiments stay session-local skill
Cleanup order (worktree first, branch last) + rationale skill; mechanics also already in reference doc
Stash-first fallback for a required main-checkout command skill (generic) + reference doc (repo's cargo example)
cargo install from worktree, not main checkout (cdhash) reference doc, cross-referencing release-workflow.md instead of duplicating the cdhash explanation
Subagent inheritance / worktree-path confinement / banned "operate from main checkout" pattern skill
Worktree cleanup is safe (never touches main checkout) skill (brief) + reference doc (existing, unchanged)
Pointer to docs/reference/worktree-discipline.md kept, now in the 3-line CLAUDE.md pointer

Ambiguous call: the stash-first "if you absolutely must run a command from the main checkout" rule is generic in principle but its only illustration was cargo install. Kept the pattern generic in the skill and left the concrete cargo install case in the reference doc.

Gates (docs/skill-source change — no Cargo/Rust source touched)

bash scripts/check_sld.sh
sld-lint: scanned 56 spec doc(s) + 3115 code file(s); 0 error(s), 0 warning(s)

bash scripts/check_line_cap.sh
line-cap: measured 3742 tracked .rs file(s) (floor 500); 7 allowlisted, 0 violations — OK.

bash scripts/check_doc_numbers.sh
doc-numbers: scanned 102 doc(s) / 96 claim(s) (floors 20/20); 4 grandfathered, 0 violations — OK.

bash scripts/check_changelog_fragment.sh
OK   trusty-mpm: changelog.d fragment present and valid
changelog-fragment gate: scanned 4 changed path(s); all 1 crate(s) with source changes are recorded.

Changelog fragment: crates/trusty-mpm/changelog.d/5008-worktree-discipline-to-skill.md.

🤖🤖🤖 Generated with trusty-mpm — https://github.com/bobmatnyc/trusty-tools

@bobmatnyc bobmatnyc added trusty-mpm trusty-mpm platform and related work ws/tm-trusty-tools-05 trusty-mpm workstream tm-trusty-tools-05 labels Aug 6, 2026
@bobmatnyc bobmatnyc self-assigned this Aug 6, 2026
Owner's ruling: checkout behavior belongs in the workflow skill, not
CLAUDE.md. Moves the generic worktree/checkout rules (main checkout
inspection-only, branch off origin/main, one branch per reviewable
outcome, worktree-is-ephemeral/branch-is-durable, cleanup order,
subagent confinement) into tm-pr-workflow's Worktree Discipline
section, so every project deploying the skill gets them.

The repo-specific bits (cargo install cdhash cache hazard, the
stash-first fallback with its cargo install example) move to
docs/reference/worktree-discipline.md, merged into the existing page
rather than duplicated.

CLAUDE.md's Parallel Worktree Discipline section is now a 3-line
pointer naming the skill and the reference doc.

🤖🤖🤖 Generated with trusty-mpm — https://github.com/bobmatnyc/trusty-tools
@bobmatnyc
bobmatnyc force-pushed the docs/worktree-discipline-to-skill branch from 3ea39e1 to 8e4fa2b Compare August 6, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trusty-mpm trusty-mpm platform and related work ws/tm-trusty-tools-05 trusty-mpm workstream tm-trusty-tools-05

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant