claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Feature][Design proposal] `/ask` command like in Aider via adding to settings.json += "read-only" VS "writable" commands

Open gwpl opened this issue 7 months ago • 0 comments

Feature request

Please add /ask command like in Aider, that allows to Ask AI things without it altering system.

Design proposal

Integrating this idea with Agentic nature of Claude Code may require adding new feature: ability to define which commands are allowed to run in "readonly" "immutable" mode.

As "claude code" is tool giving ability power users to configure it to their needs, it should be flexible design allowing them to configure/customize claude code accordingly.

While keeping backwards compatibility with settings.json => .permissions.{allow,deny},

I propose to add to settings.json .permissions.allow-readonly or .permissions.allow-immutable ,

therefore allowing users to define which commands in their opinion are not altering state of system, allowing "readonly /ask" queries to run.


Appendix

Below generated more info that maybe helpful if you would be processing this issue e.g. together with Claude Code

References from Aider Implementation

This feature request is inspired by aider's /ask command, which has proven to be a valuable tool for code exploration without modification. Here are key references from the aider repository:

Core Implementation

Key Design Principles from Aider

  1. Guaranteed non-destructive: Ask mode never modifies files, providing a safe space for code exploration
  2. Dual usage pattern:
    • /ask <question> - Single question in ask mode, then return to previous mode
    • /ask - Switch to ask mode permanently (until mode change)
  3. Context preservation: Conversations in ask mode carry over when switching to code mode
  4. Workflow integration: Designed to work seamlessly with /code command for discuss-then-implement workflow

Usage Patterns (from aider/website/docs/usage/modes.md:52-66)

  • Users discuss implementation approaches in ask mode
  • Once consensus is reached, switch to code mode (e.g. /code or /edit)
  • All context from ask mode discussion informs the code changes

Evolution of the Feature

  • Initial implementation: Commit 3a1fc35f - Added /ask and /chat-mode commands
  • Mode switching enhancement: Commit 1a84c109 - Allow /ask without arguments to switch modes
  • Autocompletion support: Commit 4e03f416 - Added tab completion for /ask, /code, and /architect
  • Output optimization: Version 0.83.0 - Improved ask mode to elide unchanging code in responses

Similar Features in Aider

  • /read-only command - Add files for reference only / mark which files are to be read-only, preventing modifications
  • /chat-mode command - General mode switching capability
  • Multiple chat modes: code, ask, architect, help - Each with specific permissions and behaviors

Why This Matters for Claude Code

The success of aider's /ask command demonstrates the value of having a dedicated read-only exploration mode. With Claude Code's agent-based architecture and powerful tool system, implementing a similar feature with configurable read-only permissions would provide:

  1. Safety: Users can explore and understand code without risk of unintended modifications
  2. Flexibility: Power users can configure which tools are available in read-only mode
  3. Workflow efficiency: Natural progression from exploration to implementation, similar to aider's ask/code workflow

The proposed .permissions.allow-readonly configuration would align well with Claude Code's existing permission system while adding this valuable capability.

gwpl avatar Jun 11 '25 11:06 gwpl