/context-restore could present an older checkpoint as the latest with no
error in two layouts:
1. A session started in a non-git parent saved from a nested repo, so the
checkpoint went to the nested repo's bucket. Restore in the parent now
lists checkpoints of other buckets whose project_root lies below the cwd
(BELOW_CWD; the 200 newest are read, and from $HOME only each project's
newest). /context-save also leaves a JSON pointer (checkpoint path, bucket,
project_root) in the starting directory's bucket when $CLAUDE_PROJECT_DIR
is set and files elsewhere; restore lists those as POINTER, in or out of git.
2. A plan checkpoint on the main tree's branch shadowed a newer checkpoint
saved in a ticket worktree. When another branch holds a newer checkpoint
for the same task (a worktree below the main tree, read from the new
worktree: stamp; equal normalized titles; or a shared #123 / ABC-123
token in titles or branch names), restore prints NEWER_TASK and the skill
shows both and proposes the newer one. Generic titles (wip, checkpoint,
save, notes, todo) never match on title alone, and the worktree rule
applies only when restoring from the main tree, so sibling worktrees
still never shadow each other.
The branch-first ordering itself is unchanged.
Refs #3065.
Co-authored-by: Thomas Gernhardt <t.gernhardt@softwareprojekt.net>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>