Skip to content

context-restore: (1) misses checkpoints a /context-save wrote from a nested repo when restore runs in a non-git parent, (2) current-branch-first loads the superseded plan checkpoint of the main tree #3065

Closed

Description

@tomg65

Both cases return an older checkpoint without any error. Tested on 1.91.32.0
(post-#3003 identity stamps and ROOT_DIFFERS).

1. Save in a nested repo, restore in a non-git parent.
Layout: mono/ is not a git repo; mono/pkg is a git repo with remote
git@gitlab.example.com:grp/sub/repo.git. A session started in mono/, worked in
mono/pkg, and /context-save wrote to the bucket of pkg
(SLUG=sub-repo-<hash>, PROJECT_REMOTE=gitlab.example.com/grp/sub/repo). After
/clear, /context-restore in mono/ resolved SLUG=mono, PROJECT_REMOTE='' and
presented an eleven-day-old checkpoint as the latest. The right one was found only
because a hook had logged the save call and a manual find over all buckets followed.
gstack-slug only walks up from pwd (_outermost_project_root); it never looks at
checkpoints below the cwd. Related, but different from #2163 (non-git dir, save and
restore disagree for the same dir) and #2649 (nested repo resolves to the outer repo).

Suggestion, smallest first: (a) when the cwd is not inside a git repo, or the newest
checkpoint of the cwd's bucket is older than a save event of this session, also scan
other buckets for checkpoints whose project_root: lies below the cwd and offer them;
(b) context-save leaves a pointer (project_root + bucket) in the bucket of the
starting directory.

2. Plan in the main tree, implementation in a ticket worktree: branch-first picks the plan.
Flow: plan checkpoint saved on master of the main tree; implementation continues in a
worktree of the same repo (branch feature/<n>-…), where a second checkpoint is
saved that completes most of the first one's Remaining Work. /context-restore in the
main tree (on master) applies the rule from #2052/#2054 and loads the master
checkpoint. The rule exists to stop sibling worktrees from shadowing a branch's own
save, but here the sibling worktree is the direct continuation (same repository,
worktree path below the main tree, same ticket in the title). Seen three
times in different repos; each time the newer checkpoint was noticed only because the
SessionStart context listed it separately.

Suggestion: in Step 2, when a checkpoint of another branch is newer, belongs to the same
repository and its worktree/title names the same task, show both and propose the
newer one as continuation instead of silently taking the branch match. context-save
could optionally write supersedes: <file> when it continues an earlier checkpoint.
Related: #2052/#2054 introduced the current ordering.

Relevant place: context-restore/SKILL.md.tmpl Step 1 (candidate ordering,
--classify-checkpoints) and Step 2; bin/gstack-slug _outermost_project_root;
context-save/SKILL.md.tmpl frontmatter.

Activity

  1. capy-ai commented on Oct 7, 2026

    @capy-ai
    Contributor

    Fixed in v1.91.34.0 (#3069). (1) Restoring from a non-git parent now lists checkpoints whose project_root is below the current directory. /context-save also leaves a pointer when Claude Code exposes where the session started; note that $CLAUDE_PROJECT_DIR is not set inside the Bash tool on 2.1.292, so the below-cwd scan is what finds it there. (2) When another branch, including a worktree below the main tree, holds a newer checkpoint for the same task (same worktree, normalized title or ticket token), restore shows both and proposes the newer one. Upgrade with /gstack-upgrade (or cd ~/.claude/skills/gstack && git pull && ./setup). Thanks @tomg65.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions