[BUG] Plan mode silently overwrites plan files across projects — no project scoping, no backup
[BUG] Plan mode silently overwrites plan files across projects — no project scoping, no backup
Description
Plan mode stores plans in a global flat directory (~/.claude/plans/) with randomly generated filenames. When multiple sessions across different projects use plan mode, plan files can be silently overwritten with completely unrelated content. There is no project scoping, no warning, no backup, and no version history.
Reproduction Steps
- Open Claude Code in Project A (e.g., a systems architecture project)
- Enter plan mode → Claude creates
~/.claude/plans/<random-name>.mdwith the architecture plan - Work with the plan across multiple sessions — it is referenced and relied upon
- Open Claude Code in Project B (e.g., a translation tool project)
- Enter plan mode → Claude assigns a plan file — which may be the same file as Project A's plan
- The new plan content overwrites Project A's architecture plan
- Return to Project A — the plan now contains Project B's content
Expected Behavior
- Plan files should be scoped to the project that created them
- Overwriting an existing plan file should require confirmation or create a new file
- Plan files should have version history or backups
- At minimum, plan files should never be reused across different projects
Actual Behavior
- All plans go to
~/.claude/plans/regardless of project - Plan filenames can be reused across sessions and projects
- Overwriting is silent — no warning, no diff, no backup
- The previous plan content is permanently destroyed
- There is no mechanism to recover overwritten plans
Impact
The impact was absolute and total confusion without explanation. Claude suddenly became immensely stupid and unpredictable and it took hours to figure out. Upon understanding what happened it makes sense. It's like someone dosed Claude with a power dissociative and then stole a bunch of information and started gaslighting Claude for not being oriented.
In our case, this destroyed:
- A brain-mcp architecture plan (14,477 chars, 8-phase TDD implementation plan for a 30-tool MCP server with 6 kernel agents) — overwritten by a psyche-readiness mechanisms plan
- The plan was referenced across 27 sessions and was the architectural backbone of the entire project
- Recovery required parsing raw session JSONL files to find the original Write tool call that created the plan, which only worked because the session transcripts happened to still exist on disk
This is not a minor data loss. Plan files are the most architecturally significant artifacts Claude Code produces — they are the documents that every implementation decision derives from. Treating them as disposable temp files in a global flat directory with no protection is a critical design flaw.
Environment
- Claude Code version: 2.1.76
- OS: macOS
- Multiple projects sharing the same
~/.claude/directory (default behavior)
Suggested Fixes
- Project-scope plan files: Store plans in
~/.claude/projects/<project>/plans/or in the project repo itself - Never reuse plan filenames: Generate unique filenames that cannot collide
- Version plan files: Keep history of plan changes (even just a backup of the previous version before overwrite)
- Warn before overwrite: If a plan file already has content, confirm before replacing it
- Support
--disallowedToolsfor plan mode: Allow users to disableEnterPlanMode/ExitPlanModeentirely (already supported via CLI, but should also be configurable insettings.json)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗