Question
What should --prune do when it runs inside a container, where every recorded worktree path resolves?
Raised by the keystone decision on #445, and it goes first among the fog it raised because it is a principle 1 question with a live hazard behind it.
The whole host-side design rests on an asymmetry: a registered agent worktree carries a container path like /workspaces/<id>/.claude/worktrees/agent-abc, which does not resolve on the host. That is what makes git worktree remove <recorded path> a pure metadata operation there: git skips the dirty check and the tree deletion because file_exists(wt->path) is false, and drops only the registration.
Inside a container that path does resolve. So the same call:
- deletes a working tree, not just a registration, and
- does apply git's dirty check, which is a different safety profile rather than simply a worse one.
The two radii the keystone separated collapse into one.
And the hazard as it stands: the keystone's note says the only thing currently stopping a container from collecting its own live agent worktrees is the Held arm of the classification, which is an accident of the classification rather than a decision. Something that prevents data loss by accident is not a safety property, it is a coincidence with a good outcome so far.
Note that running dl inside a container is a supported thing here, not a hypothetical: CLAUDE.md documents pixi run dl as the in-container build, and aid opens nested workspaces (see #327).
Candidates to weigh, at least:
- Refuse.
--prune is a host maintenance command; detect the container and decline with a reason. Simplest, and principle 1's default. Establish how a container is detected without a guess.
- Run, with the container's own semantics acknowledged — every removal is a real tree deletion, so the whole safety predicate applies to every candidate rather than only to the ones with host directories.
- Scope it out — prune only what is not the container's own workspace. Weigh whether that distinction can be drawn soundly from inside.
Whatever wins must make the current accident into a stated property, and the answer feeds a row of the contract table on #455.
How the answer gets tested: a test that pins the in-container behaviour explicitly, so the property stops depending on which arm a classification happens to take.
Question
What should
--prunedo when it runs inside a container, where every recorded worktree path resolves?Raised by the keystone decision on #445, and it goes first among the fog it raised because it is a principle 1 question with a live hazard behind it.
The whole host-side design rests on an asymmetry: a registered agent worktree carries a container path like
/workspaces/<id>/.claude/worktrees/agent-abc, which does not resolve on the host. That is what makesgit worktree remove <recorded path>a pure metadata operation there: git skips the dirty check and the tree deletion becausefile_exists(wt->path)is false, and drops only the registration.Inside a container that path does resolve. So the same call:
The two radii the keystone separated collapse into one.
And the hazard as it stands: the keystone's note says the only thing currently stopping a container from collecting its own live agent worktrees is the
Heldarm of the classification, which is an accident of the classification rather than a decision. Something that prevents data loss by accident is not a safety property, it is a coincidence with a good outcome so far.Note that running
dlinside a container is a supported thing here, not a hypothetical:CLAUDE.mddocumentspixi run dlas the in-container build, andaidopens nested workspaces (see #327).Candidates to weigh, at least:
--pruneis a host maintenance command; detect the container and decline with a reason. Simplest, and principle 1's default. Establish how a container is detected without a guess.Whatever wins must make the current accident into a stated property, and the answer feeds a row of the contract table on #455.
How the answer gets tested: a test that pins the in-container behaviour explicitly, so the property stops depending on which arm a classification happens to take.