Build worktree Thor CLI (bin/worktree start|finish) and merge skills into /os:worktree #508
Labels
No labels
P0
P1
P2
P3
bug
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#508
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The #505 finish run showed /os:worktree-finish improvising: git ops are locked to the worktree, so the session exited with keep, merged from the main checkout, re-entered to remove, and hit ExitWorktree's ownership refusal. Decision (user-approved 2026-08-25): move the mechanics into a deterministic Thor CLI
plugins/os/bin/worktreebacked byplugins/os/lib/worktree/small command classes, and collapse the two skills into one/os:worktree start|finishskill that owns only session movement (EnterWorktree/ExitWorktree) and judgment (conflicts, commit messages). Thor is assumed globally installed — no Gemfile, no fallback hardening. Precedent:plugins/os-sdlc/bin/os-sdlc-runneris already a Thor CLI.Tasks
plugins/os/bin/worktree(Thor,#!/usr/bin/env ruby) +plugins/os/lib/worktree/following the os-sdlc bin/lib patternstart <name>: git worktree add under .claude/worktrees/, branch creation, plugin-symlink setup, then symlink gitignored per-project state:.cc-osdir and.sdlc/pipeline.dbif present (NOT.sdlc/wholesale — it holds tracked files, per ADR-0143), plus extra paths from a new.cc-os/configkey (working nameworktree-symlinks, comma-separated to fit the flat key=value format in plugins/os/hooks/state.py)finish <branch>: sync-check loop — detect base moved since worktree creation; distinct exit codes: done / base-moved (merge base into branch, AI resolves conflicts) / conflicts (naming files); when clean: merge branch into base from the main checkout, verify branch is ancestor + no conflict markers, run bin/refresh-plugins when plugins/ changed, then git worktree remove + branch delete. The script never moves the session; removal happens after the session exits with keep, avoiding the ownership refusalplugins/os/skills/worktree/SKILL.md(/os:worktree start|finish, argument-hint frontmatter, description keeps both trigger phrasings); delete the two old skill dirsAcceptance criteria
bin/worktree start xproduces a worktree with .cc-os + pipeline.db symlinks and configured extras; exits 0 and prints the pathbin/worktree finishexit codes distinguish done / base-moved / conflicts, and refuses removal until branch is ancestor of base/os:worktreeinvocable after cache refreshOut of scope: Gemfile/bundler hardening, thor-availability fallbacks, bulk changes to ADR-0143's symlink decision.
Origin
git worktree remove+git branch -dafter the tool refusalWork started on branch worktree-ticket-508-worktree-cli via /os-sdlc:implement (session 4b7df35f).
implementation_failed: pipeline bound exhausted at behavior-verifier (verdict fail, dispatch 27, session 4b7df35f).
Failed step: behavior-verifier after increment 3.
Gate details: AC1 (bin/worktree start with .cc-os + pipeline.db + configured extra symlinks) is implemented and green — tests worktree_cli_start_test.rb, pipeline_db and extra_symlinks siblings. AC2 (finish exit codes done/base-moved/conflicts, ancestor refusal) and AC3 (skill merge into /os:worktree) have no implementation: Worktree::CLI declares only start, and both old skill dirs still exist.
Work lives on branch worktree-ticket-508-worktree-cli (not merged). Recovery requires a fresh implementation-open.
Resolution
Done: Thor CLI plugins/os/bin/worktree (start|finish) built TDD via the os-sdlc pipeline on branch worktree-ticket-508-worktree-cli: start creates the worktree with .cc-os + pipeline.db symlinks and worktree-symlinks config extras; finish distinguishes exit 0 done / 1 conflicts (naming files) / 2 base-moved and refuses removal until the branch is an ancestor of base. Skills merged into /os:worktree (old dirs deleted), rename sweep across 7 docs files, ADR-0150 supersedes 0085/0087, invariants + History row updated, os target added to .sdlc/project.yaml.
Evidence: implementation_complete at dispatch 66 (behavior-verifier pass, session 4b7df35f); suite ruby plugins/os/tests/all.rb green across 9 worktree tests; gate history in .sdlc/pipeline.db; ADR docs/adr/0150-worktree-mechanics-move-to-a-deterministic-thor-cli-skills-merge-into-os-worktree.md
Follow-ups: #511 progress-based loop-guard reset (pre-existing, user-approved; implementation ready on branch worktree-agent-aac9c5cd71a72ccd3, ADR renumber needed at merge); #512 poodr map test-repair route (captured this session with skeptic VERDICT: CREATE); none further