claude-code - 💡(How to fix) Fix Feature request: read-only session mode for side chats [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48824Fetched 2026-04-16 06:49:55
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
1
Timeline (top)
labeled ×2commented ×1

Root Cause

The cost of an unwanted write in a side chat is subtle but real:

  • Memory files get polluted with unreviewed observations
  • Plan archives accumulate entries from throwaway discussions
  • Requirement docs drift from casual mentions rather than deliberate updates
  • The next proper session inherits stale or incorrect state

This matters most for power users who treat Claude Code as infrastructure — with MCP servers, structured projects, and multi-session continuity contracts.

Fix Action

Fix / Workaround

Current Workaround

RAW_BUFFERClick to expand / collapse

Problem

Claude Code doesn't distinguish between a main working session and a casual side chat. Both have full tool access, so there's no guardrail preventing writes to persistent state (memory files, project plans, requirement docs) during what the user considers a throwaway conversation.

Users who build structured workflows on top of Claude Code — with session lifecycles, plan archival, requirement update contracts, and memory management — need a way to say "this is a side chat, read-only only."

Current Workaround

Users can add instructions to CLAUDE.md or memory files like "never write memory, archive plans, or update requirements from a side chat." But this relies on the model honoring a soft convention, and it's easy to violate — especially when the model is trying to be helpful by persisting something it learned.

Proposed Solution

A session mode or context marker that scopes what kind of work is appropriate:

  • A flag like --read-only or --side-chat when launching Claude Code
  • Or a /mode read-only slash command that restricts tool access for the remainder of the conversation
  • Or a hook-based approach where a SessionStart hook can set readOnly: true based on context

When active:

  • Read tools (Read, Grep, Glob, Bash read-only commands) work normally
  • Write tools (Edit, Write, Bash write commands) are blocked or require explicit override
  • Memory writes, plan files, and other persistent state changes are suppressed

Why This Matters

The cost of an unwanted write in a side chat is subtle but real:

  • Memory files get polluted with unreviewed observations
  • Plan archives accumulate entries from throwaway discussions
  • Requirement docs drift from casual mentions rather than deliberate updates
  • The next proper session inherits stale or incorrect state

This matters most for power users who treat Claude Code as infrastructure — with MCP servers, structured projects, and multi-session continuity contracts.

extent analysis

TL;DR

Implementing a session mode or context marker to restrict tool access and prevent unwanted writes to persistent state during side chats is the most likely fix.

Guidance

  • Introduce a --read-only or --side-chat flag when launching Claude Code to scope the work and restrict tool access.
  • Develop a /mode read-only slash command to switch to read-only mode for the remainder of the conversation, allowing for more flexibility.
  • Explore a hook-based approach with a SessionStart hook to set readOnly: true based on context, providing a more automated solution.
  • When the read-only mode is active, ensure that write tools (Edit, Write, Bash write commands) are blocked or require explicit override to prevent accidental changes.

Example

# Example of proposed solution
claude-code --read-only

or

# Example of slash command
/mode read-only

Notes

The proposed solution relies on the model honoring the session mode or context marker, and it's crucial to ensure that the implementation is robust and consistent across different use cases.

Recommendation

Apply a workaround by introducing a session mode or context marker, as it provides a clear and explicit way to restrict tool access and prevent unwanted writes to persistent state during side chats. This approach allows for more control and flexibility, making it a more reliable solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature request: read-only session mode for side chats [1 comments, 2 participants]