Skip to content

Add a read-only mode toggle (no write/edit/bash) for sessions and subagents #459

Closed as not planned

Description

@m-aebrer

Original Request

We should create a read-only mode toggle, with it easily accessible via /readonly and in the dashboard with an additional context overflow toggle button thingy (I hope you know what I mean by that LOL). The core concept here would be that in read-only mode, there is no write, edit, or bash tool use, in that session, and for all subagent sessions spawned by that session. The global setting would be the default state that a session starts in, and then inside any session it should be toggleable at any point. I am aware that this may cause some cache invalidation but its probably worth it.

As a concept, additionally, it may be an alternative solution to issue #437. Or at least a first-step approach toward it. We can consider that we might have read-only mode automatically toggle on whenever the agent does web_search, web_fetch, or uses git clone or bash curl/wget etc. Would need some careful design to not make it useless, and it would need to be very clear in the UX (like a special border and making the button to toggle it suddenly visible?) what has happened and why, and how to undo it (return the model to edit-allowed mode).

Summary

Add a per-session read-only mode that removes the write, edit, and bash tools from the agent's tool set, both for the session itself and for every subagent session it spawns. A global setting controls the default state new sessions start in, and the mode can be toggled at any point mid-session via a /readonly slash command in the TUI and a toggle button in the dashboard session header overflow menu.

Current Behavior

  • Tool availability is fixed at session start. The only existing mechanisms are the CLI flags --tools <list> / --no-tools (packages/coding-agent/src/cli/args.ts), and the read-only tool factory createReadOnlyToolDefinitions() in packages/coding-agent/src/core/tools/index.ts. There is no way to change the tool set mid-session.
  • There is no /readonly slash command (packages/coding-agent/src/core/slash-commands.ts).
  • Subagents are spawned as separate processes and receive their tool set via a --tools CLI argument computed by filterSubagentTools() in packages/coding-agent/src/core/tools/subagent.ts. They do not inherit the parent's in-memory settings; a child builds its own settings manager from disk.
  • The dashboard session header (packages/dashboard/src/client/screens/session.tsx) has a ⋯ overflow menu with actions like "compact now", "expand tools", "fork", and "stop runtime", but no tool-mode toggle.

Proposed Behavior

  • Global setting: a new global-only setting (e.g. under ~/.dreb/settings.json) that defines whether new sessions start in read-only mode by default.
  • Mid-session toggle:
    • TUI: a /readonly slash command that toggles read-only mode for the current session at any point.
    • Dashboard: a toggle button in the session header overflow menu (the existing ⋯ menu) that reflects the current state and switches it.
  • Tool gating: while read-only mode is active, the write, edit, and bash tools are not available to the model in that session. When toggled off, the full tool set is restored.
  • Subagent propagation: every subagent session spawned while the parent is in read-only mode must also run without write, edit, and bash. This needs to cross the process boundary (subagents are spawned with a --tools argument), so read-only state must be passed explicitly to children rather than relying on settings inheritance.
  • Visibility: the current mode should be clearly visible in the UI (TUI and dashboard) so the user always knows whether the agent can modify files or run commands.
  • Cache invalidation from changing the system prompt / tool list mid-session is an accepted trade-off.

Acceptance Criteria

  • A global-only setting defines the default read-only state for new sessions.
  • /readonly slash command toggles read-only mode in the TUI at any point during a session.
  • The dashboard session header overflow menu contains a read-only toggle that shows current state and switches it.
  • While read-only mode is on, write, edit, and bash are unavailable to the model in that session; toggling off restores the full tool set.
  • Read-only state propagates to all subagent sessions spawned by the session (including the subagent tool's child processes), so they also lack write, edit, and bash.
  • The current mode is clearly indicated in the TUI and dashboard.

Future Considerations (out of scope for this issue)

As noted in the original request, read-only mode may become an alternative or first-step approach to issue #437 (external-content prompt-injection sentinel): read-only mode could automatically engage when the agent ingests untrusted external content (web_search, web_fetch, git clone, curl/wget via bash, etc.). This would need careful design to remain useful, and very clear UX (e.g. a special border, a suddenly-visible toggle button) explaining what happened, why, and how to return to edit-allowed mode. This auto-taint behavior is not part of this issue's scope; it is recorded here for future design discussion.

Technical Notes

  • Tool registry and read-only factory: packages/coding-agent/src/core/tools/index.ts (createReadOnlyToolDefinitions, readOnlyTools).
  • Session options apply --tools at startup in packages/coding-agent/src/main.ts; a mid-session toggle needs a mechanism to swap the live tool set (the agent loop reads tools from session options; changing them mid-session invalidates the provider prompt cache — accepted).
  • Subagent spawn and tool filtering: packages/coding-agent/src/core/tools/subagent.ts (filterSubagentTools, SUBAGENT_DEFAULT_TOOLS, SUBAGENT_EXCLUDED_TOOLS). Read-only state must be added to the child invocation (e.g. a dedicated flag or filtering the --tools list), since children rebuild settings from disk and must not depend on project settings.
  • Slash command registration: packages/coding-agent/src/core/slash-commands.ts (BUILTIN_SLASH_COMMANDS); dispatch in packages/coding-agent/src/modes/interactive/interactive-mode.ts.
  • Dashboard: overflow menu in packages/dashboard/src/client/screens/session.tsx; RPC pattern for per-session actions follows setThinking — client api.ts wrapper → Express route in packages/dashboard/src/server/server.ts → h.client.* RPC method on the agent process. A new RPC method (e.g. setReadOnly) plus a runtime-state field for current mode would follow the existing pattern.
  • Settings: packages/coding-agent/src/core/settings-manager.ts — global vs project scopes; per the security architecture, the read-only default setting should be global-only if it is intended as a guardrail that project settings cannot weaken (mirroring the nested-context trust boundary policy).

Context

Activity

  1. added
    enhancement
    ux
    dashboard
    on Aug 12, 2026
  2. Hrovatin commented on Aug 12, 2026

    @Hrovatin
    Contributor

    Worked on in Hrovatin#11

  3. m-aebrer commented on Aug 12, 2026

    @m-aebrer
    CollaboratorAuthor

    Prior Art: Read-Only / Safe-Mode Fallback at the External Data Boundary

    Research notes for the read-only mode toggle and its possible future auto-engagement (see "Future Considerations" in the issue body, related to issue 437).

    Academic / security-architecture prior art

    Dual-LLM pattern (Simon Willison, 2023) — the foundational privilege-separation design: a Privileged LLM with tool access never sees untrusted content; a Quarantined LLM processes untrusted content but has no tools. They communicate only through symbolic references/typed handles. https://simonwillison.net/2023/Apr/25/dual-llm-pattern/

    CaMeL — "Defeating Prompt Injections by Design" (Google, Google DeepMind, ETH Zurich; arXiv:2503.18813, Apr 2025) — the strongest formal prior art for the auto-taint concept. CaMeL extracts a control-flow plan from the trusted prompt, then a custom interpreter tracks data provenance and applies security policies as capabilities: flows derived from untrusted data can be forbidden from reaching consequential tools. This is exactly "crossing an external data boundary drops privileges", enforced by the host rather than the model. Simon Willison's writeup: https://simonwillison.net/2025/Apr/11/camel/ — code: https://github.com/google-research/camel-prompt-injection

    "Design Patterns for Securing LLM Agents against Prompt Injections" (Beurer-Kellner et al., IBM/Invariant Labs/ETH/Google/Microsoft; arXiv:2506.08837, Jun 2025) — six patterns that constrain what agents can do once untrusted input is possible: Action-Selector, Plan-Then-Execute, LLM Map-Reduce, Dual LLM, Code-Then-Execute, Context-Minimization. Core thesis: general-purpose agents that can do anything are unsecurable; restrict the action space. Reference implementations: https://github.com/ReversecLabs/design-patterns-for-securing-llm-agents-code-samples

    Progent — Privilege Control for LLM Agents (arXiv:2504.11703, Apr 2025) — least-privilege enforcement at the tool-call level via a policy DSL over JSON Schema, with fallbacks when a call is denied. Cut attack success rate from 41.2% to 2.2% on AgentDojo while preserving utility. Direct support for the "deny write/edit/bash at the tool boundary" mechanism (host-side gating beats prompt-side instructions).

    Lethal trifecta (Simon Willison, Jun 2025) — private data + untrusted content + external communication = exploit. A read-only/no-bash mode triggered on untrusted ingestion is a structural way to break the trifecta (removes the exfiltration/mutation leg). https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/

    Classic systems lineage — the general pattern is decades old: Perl taint mode and Android TaintDroid (dynamic information-flow tracking), and Chromium's renderer sandbox (the process that parses untrusted HTML runs with the fewest privileges). Dropping privilege upon contact with untrusted input is the standard answer in every domain that got serious about injection.

    Practical implementations of read-only modes in coding agents

    • Claude Code — Plan Mode: read-only exploration mode; Read/Grep/Glob allowed, Edit/Write/Bash blocked; toggled with Shift+Tab, exiting requires user approval of the plan. https://code.claude.com/docs/en/permission-modes
    • OpenAI Codex CLI — sandbox modes: read-only / workspace-write / danger-full-access, switchable mid-session via /approvals, combined with approval policies. https://github.com/openai/codex/blob/main/docs/sandbox.md
    • Gemini CLI — Plan Mode: read-only subset of tools, configurable as the session-start default; Google made it the default mode in v0.34 — "propose before edit" became the industry default architecture. https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/plan-mode.md
    • Cursor agent read-only mode; Aider --read / read-only file handling. Read-only-then-approve is now table stakes across the top tier of coding agents.
    • Notably: no mainstream coding agent ships automatic taint-triggered lockdown (auto read-only on web fetch). That idea lives only in the research literature (CaMeL, Progent, dual-LLM). Shipping it would be novel — which is both the opportunity and the UX risk the issue flags.

    Design implications for this issue

    1. The manual toggle is well-trodden ground — plan-mode UX (Shift+Tab / /approvals equivalents) validates the /readonly + dashboard toggle design. Match the familiar pattern: easy to enter, deliberate to exit (an explicit user action, not a model request).
    2. Host-side enforcement, not prompt-side — every credible implementation gates at the tool boundary (interpreter/sandbox/policy engine), never via instructions to the model. Our tool-set swap approach aligns.
    3. One-way ratchet UX for auto-taint — if auto-engagement is built later, prior art suggests: ratchet down silently, restore only via explicit human action, and make the state change maximally visible (border/badge, per the issue's own sketch).
    4. Evaluation exists — AgentDojo is the standard benchmark if we ever want to measure the auto-taint variant's effect on attack success vs utility.
  4. m-aebrer commented on Aug 12, 2026

    @m-aebrer
    CollaboratorAuthor

    Superseded by #460 — the manual read-only toggle proposed here is absorbed into that unified design (read-only mode + quarantined external-content retriever), which solves the web-exfiltration gap this design left open.

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

    dashboardenhancementux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions