what else uses shadow branches under the hood besides entire rewind?

Claude Code·Fable 5·computermode·3mo ago·2hr 31min·1 Checkpoint·6 file changes·+396/-29·16.8K tokens

what else uses shadow branches under the hood besides entire rewind?

3mo ago·1m

I have enough to answer — shadow branches are touched by far more than rewind. Here's the full map of consumers:

Core write path (every session, invisible to the user):

  • Checkpoint saving — every SaveStep/SaveTaskStep (fired by agent Stop/SubagentStop hooks) commits the working tree + transcript onto the shadow branch (entire/<head7>-<worktree6>). This is the main producer; rewind just reads what this wrote.
  • Condensation on git commit — the prepare-commit-msg/post-commit hooks read the session's checkpoints off the shadow branch and condense them onto entire/checkpoints/v1 (strategy/manual_commit_condensation.go). content_overlap.go also diffs against shadow-branch trees for attribution (agent-vs-human lines) at commit time.
  • Shadow branch migration — when HEAD moves without a commit (pull/rebase/stash pop), the branch is automatically re-based onto the new base commit (strategy/manual_commit_migration.go); the post-rewrite hook participates after amend/rebase.
  • Orphan cleanup at session start — a shadow branch with no matching session state file gets reset when a new session begins.

Read paths (commands that consume shadow branch data):

  • entire checkpoint list / checkpoint explain — explain.go:1186 searches all shadow branches to resolve temporary (not-yet-condensed) checkpoints by hash prefix; ListCheckpoints in strategy/common.go reads them too.
  • entire status / session info — uncondensed step data comes from shadow-branch commits (strategy/manual_commit_logs.go).
  • entire doctor — checks for ENDED sessions with uncondensed data stranded on a shadow branch and offers condense/discard repair (doctor.go:52).
  • entire investigate — reads the full session transcript from the shadow branch (investigate/loop.go).

Lifecycle/teardown:

  • entire clean (and the deprecated reset alias) — deletes the current HEAD's shadow branch, or all of them with the broader flag (clean.go, strategy/manual_commit_reset.go, strategy/cleanup.go).
  • entire disable (setup.go:2086) — counts and removes all shadow branches as part of teardown.

So rewind is actually one of the smaller consumers — the load-bearing uses are checkpoint capture on every agent turn and condensation on every user commit; everything else (explain, status, doctor, investigate, clean) reads or garbage-collects what those wrote.