Repository navigation
Closed
Description
Item 9 of 9 in the Crews: organic teamwork milestone.
The problem
After #748, archiving a Crew removes every worktree that's safe to remove and keeps the rest. Those kept worktrees have uncommitted changes or commits that never merged. Some of that is work I want, and some is a dead end, but either way I have to find each one and decide by hand.
Where this sits
This is the second half of "Workspace cleanup" in Crews proposal v2 (25 October). Worktrees with uncommitted or unmerged work need one consolidated Inbox approval before removal, never a prompt per worktree. The summary screen isn't designed yet, so design comes first. It builds on the ownership record and the archive result from #748.
What we already have
- After Crews: archiving removes clean, merged worktrees #748, J5's archive returns each kept J5-created worktree with the reason it was kept.
- The Inbox (
apps/web/src/j5/a2a/HumanInboxPage.tsx) and its read-change feeds, which already update other devices when an item resolves. - Upstream's StorageCleanup checks for local changes and merges, plus the removal-under-lease, which Crews: archiving removes clean, merged worktrees #748 reuses.
Proposal
- When an archive keeps any J5-created worktrees, J5 files one Inbox item for that archive.
- The item lists every kept worktree with what removing it would discard. I can remove all, remove some, or keep all.
- Before removing an approved worktree, J5 checks it again and skips any whose work changed.
Acceptance criteria
- The cleanup summary is designed first, in dark mode, with variations. The approved mockup is saved as
artifacts/design/ui/09-worktree-cleanup.htmland linked here before building. It covers a short list, a long list, the result after deciding, and a partial failure. - An archive that keeps one or more J5-created worktrees files exactly one Inbox item, however many threads and worktrees it covered. Archiving a Crew of five seats is one item, not five.
- Each worktree in the item shows:
- the thread and branch;
- the number of uncommitted files;
- the number of commits not on the default branch;
- its PR link, when it has one.
- I can remove all listed worktrees, remove the ones I pick, or keep all. Keeping all clears the item and changes nothing.
- Removal keeps the branch, so unmerged commits survive. The item says that removing discards uncommitted changes.
- Before removing each approved worktree, J5 rechecks it. If anything changed since the item was filed (new commits or changes, now shared with an unarchived thread, its thread was unarchived, or a live session is using it), that worktree is skipped and reported.
- The item resolves once. Answering on one device clears it on the others, and a second answer is refused with a message.
- After deciding, the item shows what was removed, what was kept, and anything skipped or failed, with the reason.
- Only a person can answer the item. Agents can't approve it through any tool.
- A worktree removed or recreated some other way while the item is open is skipped without error.
- Focused tests cover:
- one item for many worktrees;
- remove all;
- remove some;
- keep all;
- a recheck that skips a changed worktree;
- a second answer refused;
- a removal failure.
- archive-flow.md and inbox.md are rewritten for the cleanup item.
Out of scope
- Deleting branches or closing PRs.
- Restoring a removed worktree's uncommitted changes. Removal says up front that they're discarded.
- Mobile. There's no J5 Inbox on mobile.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
bryantderosier commentedon Oct 28, 2026
The worktree cleanup mockup is approved:
artifacts/design/ui/09-worktree-cleanup.html(saved in the J5 artifacts store, not in the repo).What I decided:
fix(j5): the cleanup section compiles, and symbols only their own fil…
feat(j5): one Inbox approval for worktrees with unfinished work (#762)