feat(loop-worktree): manage isolated git worktrees per fix attempt#190
Merged
cobusgreyling merged 1 commit intoJul 7, 2026
Merged
Conversation
LOOP.md and docs/primitives.md describe "one worktree per fix; discard after
verifier REJECT or human escalation" in prose, but nothing created, tracked, or
swept them. loop-audit even scores worktree evidence yet had no tool to produce
it. This adds the missing code.
New package @cobusgreyling/loop-worktree:
- create - git worktree add -b loop/<id> .loop-worktrees/<id> <base>,
recorded in .loop-worktrees/manifest.json
- mark - set an entry's status (active|rejected|escalated|merged|stale)
- cleanup - git worktree remove for rejected/escalated entries, then prune the
manifest; skips dirty worktrees unless --force
- gc - reconcile git worktree list against the manifest (report-only;
--force removes orphans)
- list - human or --json output
Stays independent of loop-context (no ledger coupling); pairs via a
`mark --status escalated` call in the loop's escalation path.
Registered in root test:tools/build:tools and the README tool table; wired into
docs/primitives.md #2. 8 tests over a real git fixture cover the
create/mark/cleanup/gc round-trip, the dirty-worktree safety skip, and the
not-a-repo / duplicate-id errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thanks @KhaiTrang1995 for contributing a docs improvement — visible, reviewable PRs like this grow the reference for everyone. What happens next
More ways to help — loop-engineering maintainers |
|
UNSUBSCRIBE07.07.2026., u 09:11, korisnik Cobus Greyling ***@***.***> je napisao:
Merged #190 into main.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
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
Closes the prose-only "Worktrees" gap. LOOP.md and docs/primitives.md describe
"one worktree per fix; discard after verifier REJECT or human escalation", and
loop-audit already scores worktree evidence -- but nothing created, tracked, or
swept them. This is the missing code.
What
New package
@cobusgreyling/loop-worktree:create--git worktree add -b loop/<id> .loop-worktrees/<id> <base>,recorded in
.loop-worktrees/manifest.jsonmark-- set an entry's status (active|rejected|escalated|merged|stale)cleanup-- remove rejected/escalated worktrees and prune the manifest;skips a dirty worktree unless
--forcegc-- reconcilegit worktree listagainst the manifest (report-only;--forceremoves orphans)list-- human or--jsonRegistered in root
test:tools/build:tools, the README tool table, anddocs/primitives.md.
Why this shape
Independent of loop-context -- no ledger coupling. A loop pairs the two with a
loop-worktree mark --status escalatedcall in its escalation path, matchingthe repo's "independent packages, wire at the edges" convention.
Scope
MVP. Advisory
lock/unlockis intentionally deferred to a follow-up, since alock keys on the same path/branch a worktree does and is cleaner to layer on
once this exists.
Tested
8 tests over a real git fixture: create/mark/cleanup/gc round-trip, the
dirty-worktree safety skip (no delete without
--force), and the not-a-repo /duplicate-id errors. tsc clean; CLI smoke-tested end to end.