Plan history loses its Versions tab when the agent changes directory into another git repo between submits
Maintainers usually reply within 1 day
@backnotprop is already working on this.
Since Oct 26, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with server/index.ts and trace how startPlannotatorServer detects the project and saves plan history. Then read the Claude Code plan launch path in apps/hook/hooks/mod/controller.ts and the classic PermissionRequest hook to see which session directory information is available. Done means consecutive submits stay in the same history chain after the agent changes directories, so the Versions tab and diff remain available.
Written by the indexing model from the issue text.
Description
What happened?
When the agent changes directory into a different git repo between two plan submits, the Versions tab disappears and there is no diff. The revised plan is correct and the earlier version is still on disk; they just land in two different history projects, so the UI sees a chain of length 1.
Concretely: a Claude Code session started in a workspace repo (workspace) whose subfolders are separate git clones. The first submit went to history/workspace/<slug>/001.md. Before the resubmit, the agent ran cd service-a (a nested clone) in its shell, and the second submit went to history/service-a/<slug>/001.md. The session record for the second review shows "project": "service-a".
Root cause: the history project is detected from the process cwd at every submit.
packages/server/index.ts (startPlannotatorServer):
project = (await detectProjectName()) ?? "_unknown";
historySlug = resolveHistorySlug(project, slug);
const historyResult = saveToHistory(project, historySlug, plan);
detectProjectName() defaults to process.cwd() and returns the basename of git rev-parse --show-toplevel. The plan CLI inherits whatever directory the session is in at that moment:
- the Claude Code mod launches
plannotator claude-mod-planwithout acwdorPLANNOTATOR_CWD(apps/hook/hooks/mod/controller.ts,launch) - the classic
PermissionRequesthook runsplannotatorin the session's current directory
So a shell cd mid-session (common in multi-repo workspaces and monorepos with nested clones) changes the project key, getNextVersionNumber returns 1 in the fresh directory, previousPlan is null, and the Versions gate never opens. The code-review paths already prefer PLANNOTATOR_CWD; the plan paths ignore it.
This is the same class of bug as #1679 (history key not stable across a resubmit), on the project half of history/{project}/{slug} rather than the slug half.
Suggested fix
- Name the history project from the session's project root rather than the current directory:
$.session.root()in the mod (a shellcddoes not move it),CLAUDE_PROJECT_DIRin the classic hook. - Pin a plan's project per (session, date-free slug) on its first save, so
/cdor a worktree move mid-plan still continues the same chain.
Other agents (OpenCode, Pi, Codex, Gemini, Copilot, Droid, Vibe) are unaffected.
Plannotator version
plannotator 0.28.31
OS
macOS
Agent
Claude Code
Where did it happen?
Plan review
- Dominant language
- TypeScript
- Stars
- 8.7k
- Forks
- 649
- Avg merge
- 4h 9m
- Merged PRs (30d)
- 448
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from backnotprop/plannotator
-
Annotate documentation omits per-file version history and privacy controlsMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
backnotprop/plannotator#1086 · 2 comments ·
Maintainers usually reply within 1 day
-
show full file nameOpenaccepted enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
backnotprop/plannotator#2195 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
backnotprop/plannotator#2194 ·
Maintainers usually reply within 1 day
-
[Bug] plannotator-* preference cookies pollute every app running on localhostPossibly taken @utpalsinghdev claimed this 1 day ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
backnotprop/plannotator#2184 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
backnotprop/plannotator#1972 ·
Maintainers usually reply within 1 day
All issues in backnotprop/plannotator
Similar issues
-
e2e-failure ready-to-code
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
redhat-developer/rhdh-plugin-export-overlays#4580 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
devdotfast/whiteboard#1415 · 1 comment ·
Maintainers usually reply within 1 day
-
area/sessions comp/desktop desktop/sessions P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
NousResearch/hermes-agent#145383 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
enhancement p2 setup
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day