Link agent-created files to commits by name

Commit

Soph4h ago

A new file in FilesTouched linked the session only when the committed (or staged) blob equalled the hash recorded at turn end. A user who edits an agent-created file before committing it is far more common than one who replaces it wholesale, and the two cannot be told apart from content, so the common case lost its Entire-Checkpoint trailer.

Linking is now by name for new files, as it already was for modified and deleted ones. The one exception is a path the session recorded as deleted: if the commit adds it as a new file, someone re-created it after the agent's last action on it, and it does not link. prepare-commit-msg no longer reads the index for this.

Carry-forward is unchanged: it still compares the committed blob and the worktree with the recorded hash to decide what work is left.

The unit and integration tests that asserted no link on a hash mismatch now assert the link, the recorded-deletion exception has its own tests, and the E2E scenario is renamed TestInteractiveNewFileLinksAfterUserRewrite with the opposite expectation.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Entire-Checkpoint: 01M49BR5XR6SCHAPEPS4TVHF85

Checkpoints

can you review if we could get rid of shadow branches and what functionality we would need to cut to do it. please check e2e test scenarios too

Claude CodeOpus 5.5
View session
Checkpoint 1