Skip to content

Commit c76a71d

Browse files
committed
Document development worktree cleanup
1 parent 1d06ffb commit c76a71d

4 files changed

Lines changed: 34 additions & 273 deletions

File tree

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ operating principles here; detailed rules live in the referenced files under
1616
the current task.
1717
- When pushing completed work, push directly to the remote `main` branch unless
1818
the requester explicitly specifies a different target branch.
19+
- Dedicated development worktrees are temporary and owned by the task creator
20+
or orchestrator. After explicit approval, preserve the required commits,
21+
remove the worktree from its parent checkout, verify the Git worktree record
22+
is gone, and only then mark the task done. A done task must not leave its
23+
worktree or Rust `target` cache behind. Never remove an active worktree or
24+
discard unpreserved changes to satisfy cleanup.
1925
- When committing from an agent, use the repository's configured Git author and
2026
committer metadata. Do not override local Git identity.
2127
- When you create review tasks for your own work, notify `current-thread` so

CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ operating principles here; detailed rules live in the referenced files under
1616
the current task.
1717
- When pushing completed work, push directly to the remote `main` branch unless
1818
the requester explicitly specifies a different target branch.
19+
- Dedicated development worktrees are temporary and owned by the task creator
20+
or orchestrator. After explicit approval, preserve the required commits,
21+
remove the worktree from its parent checkout, verify the Git worktree record
22+
is gone, and only then mark the task done. A done task must not leave its
23+
worktree or Rust `target` cache behind. Never remove an active worktree or
24+
discard unpreserved changes to satisfy cleanup.
1925
- When committing from an agent, use the repository's configured Git author and
2026
committer metadata. Do not override local Git identity.
2127
- When you create review tasks for your own work, notify `current-thread` so

docs/agents/working-loop.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@
1111
6. Commit every completed code change before handoff. Stage only files changed
1212
for the current task and leave unrelated user work untouched.
1313

14+
## Development Worktree Cleanup
15+
16+
Dedicated worktrees created to implement or review a Garyx task are temporary.
17+
The task creator or orchestrator owns their cleanup; a worker cannot reliably
18+
remove the worktree that is still its own process directory.
19+
20+
After the result is explicitly approved:
21+
22+
1. Confirm no agent, reviewer, Cargo command, or other process is still using
23+
the worktree.
24+
2. Inspect the worktree status and preserve every required change as a commit.
25+
Resolve dirty state instead of forcing deletion over unpreserved work.
26+
3. From the parent checkout, run `git worktree remove <worktree-path>`. This
27+
removes the checkout and its local build artifacts, including Rust
28+
`target/`, while retaining the task branch.
29+
4. Run `git worktree prune`, then verify the path no longer appears in
30+
`git worktree list --porcelain`.
31+
5. Only after that verification, mark the task `done`.
32+
33+
Do not leave an approved/done task's worktree around as a build cache. Shared
34+
compiler caching must be handled separately; task worktrees remain ephemeral.
35+
1436
## Desktop Dev Mode
1537

1638
For fast macOS UI iteration, run the Electron dev build:

docs/architecture/worktree-mode.md

Lines changed: 0 additions & 273 deletions
This file was deleted.

0 commit comments

Comments
 (0)