[FEATURE] Allow memory/lesson file writes in plan mode to close the learning feedback loop
Problem
Plan mode blocks all write operations (Edit, Write, NotebookEdit). This is correct for code safety — but it also blocks writes to memory and lesson-tracking files (MEMORY.md, context/lessons.md, CLAUDE.md), creating a structural learning gap.
**The planning phase is where you discover why something went wrong.** You trace defect patterns, identify cross-references between issues, and draft behavioral rules. These are the highest-quality insights in the entire workflow. But because plan mode is fully read-only, none of this can be persisted until after you exit plan mode and start executing.
In practice, this means:
- Lessons discovered during planning are lost or degraded by the time execution starts
- Users must manually remember to add a "write lessons" step to every plan
- If context compresses between planning and execution, the insights may be gone entirely
Impact
This affects anyone using plan mode alongside a persistent learning system (memory files, lessons files, CLAUDE.md updates). The more iterative your workflow — prompt engineering, QA cycles, multi-round debugging — the more lessons slip through the gap.
Related Issues
- #30634 (closed as duplicate) — User's
tasks/lessons.mdworkflow was overridden by plan mode's system prompt. Filed as an override/priority bug, but the underlying cause is the same: plan mode prevents lesson persistence. That issue didn't identify the structural root cause or propose a solution. - #12771 (closed as not planned) — Requested built-in learning memory and proactive CLAUDE.md updates. General session-level request, not plan-mode-specific. The learning gap described here is a more specific, actionable subset of that broader ask.
- #32916 — Asks about plan-to-implementation context handoff. Related in spirit (information loss at the plan/execute boundary) but focused on carrying the plan itself, not lessons.
Current Workaround
Add a rule to CLAUDE.md that makes lesson capture a mandatory final step in every plan:
### Plan Mode for Non-Trivial Tasks
- **Lessons-capture step (mandatory)**: Every plan must end with a step
that writes lessons learned, new defect patterns, and behavioral rules
to the relevant files. This step is part of plan *execution*, not
planning — since file writes are unavailable in plan mode.
This works — the lesson-writing step is designed during planning but executed after exiting plan mode. But it depends on the user knowing to set it up, and it's fragile (context compression, forgetting the step, the model not following through).
Proposed Feature
Allow plan mode to write to a configurable allowlist of files while keeping all other write operations blocked.
Possible implementation:
{
"planMode": {
"allowWritePaths": [
".claude/projects/**/memory/**",
"context/lessons.md",
"CLAUDE.md"
]
}
}
This preserves plan mode's safety guarantee (no code edits, no command execution) while closing the learning gap. Memory and lesson files are not code — writing to them has no execution side effects and doesn't change application behavior.
Alternative: Lighter-touch option
If a configurable allowlist is too complex, a simpler option: allow plan mode to write to any file under .claude/ (the memory directory). This is already Claude's own workspace and wouldn't require user configuration.
Summary
Plan mode's read-only restriction is good for code safety but inadvertently breaks the learning feedback loop. The phase that produces the best insights is the phase that can't persist them. A small, scoped exception for memory/lesson files would close this gap without compromising plan mode's purpose.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗