Make /settle worktree-aware for multi-task hosts - #11
Merged
jucasoliveira merged 2 commits intoJul 21, 2026
Conversation
Pure-filesystem GitInfo: resolves the enclosing checkout, detects linked worktrees via the .git file's gitdir pointer, and parses the current branch (or detached short SHA) from HEAD. First piece of making /settle worktree-aware for hosts that run parallel tasks in git worktrees (Claude Code, Cursor). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Zycxwvy6wPQwiyRSmmJJz
Hosts like Claude Code and Cursor develop parallel changes in git worktrees; settlement now works with that model: - Decision records carry the branch under review (Subject.Branch, stamped by the CLI from a pure-filesystem GitInfo helper that detects linked worktrees and parses HEAD without the git binary). - settle init writes .settlement/.gitattributes with 'decisions.jsonl merge=union' so decision logs recorded on parallel branches merge without conflicts — reviews travel with the branch they judged. - settle outcome refuses to run in a linked worktree (--force to override): ledger history stays linear on the main checkout. - settle log shows the branch per decision. - SKILL.md gains a multi-task/worktree section: run reviews inside the worktree they judge, branch-scoped task ids, reviewers stay read-only, grade outcomes only after merge. Tests cover main/linked/detached detection (including a real 'git worktree add' layout), the union-merge attribute, and the E2E flow was verified in a scratch repo with a live worktree. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Zycxwvy6wPQwiyRSmmJJz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #10. Modern agentic hosts (Claude Code, Cursor) develop several changes in parallel, each in its own git worktree. This PR makes the
/settleskill andsettleCLI first-class citizens of that model.Design stance: decisions travel with the branch — the record of a change's review commits and merges together with the change it adjudicated — while ledger mutations stay linear on the main checkout.
Changes
Worktree detection (
go/settle/worktree.go)Pure-filesystem
GitInfohelper (no git binary dependency): resolves the enclosing checkout, detects linked worktrees via the.gitfile'sgitdirpointer, and parses the current branch (or detached short SHA) fromHEAD.CLI behavior (
go/cmd/settle,go/settle)subject.branch, so reviews made in parallel worktrees identify the branch they belong to;settle logshows it.settle initwrites.settlement/.gitattributeswithdecisions.jsonl merge=union— decision logs recorded on parallel branches union-merge instead of conflicting.settle outcomerefuses to run in a linked worktree (with--forceas a deliberate escape hatch) — grading happens in the main checkout after merge, soledger.jsonhistory can never diverge across worktrees.Skill guidance (
skill/settle/SKILL.md)New "Multi-task and worktree hosts" section: run
/settle reviewinside the worktree whose change it judges; branch-scoped task ids (review-<branch>-<date>) so parallel reviews never collide; reviewer subagents are read-only and never need worktrees of their own; one branch = one settlement; grade outcomes only from the main checkout; neversettle initinside a worktree.Tests
go/settle/worktree_test.go: main-checkout, linked-worktree, and detached-HEAD detection; a realgit init+git worktree addlayout end-to-end (skips when git is unavailable); the union-merge attribute written by init.branch: task-a;settle outcomethere refuses with exit 1.Verification
cd go && go build ./... && go vet ./... && go test ./...— green.bash scripts/settle-dryrun.sh— PASS (main-checkout path unchanged).🤖 Generated with Claude Code
https://claude.ai/code/session_016Zycxwvy6wPQwiyRSmmJJz
Generated by Claude Code