Feature Request: Expose Sandbox Status to Status Line JSON Input

Resolved 💬 2 comments Opened Jan 16, 2026 by danwan Closed Feb 27, 2026

Problem

When using Claude Code with a custom status line, there's currently no way to display whether sandbox mode is enabled or disabled. Users have to:

  1. Run /sandbox or /config manually to check the current state
  2. Wait until a command gets blocked to realize sandbox is active
  3. Check settings files, which don't reflect runtime overrides

This creates uncertainty about the security posture of the current session, especially when switching between projects or using command-line flags like --sandbox.

Proposed Solution

Add a sandbox object to the status line JSON input:

{
  "hook_event_name": "Status",
  "session_id": "abc123...",
  "cwd": "/current/working/directory",
  "model": { ... },
  "sandbox": {
    "enabled": true,
    "mode": "auto-allow",
    "platform_supported": true
  }
}

Use Cases

  1. Visual awareness: Display a 🔒 or [SANDBOX] indicator in the status line
  2. Security verification: Confirm sandbox is active before running sensitive operations
  3. Debugging: Understand why certain commands are being blocked
  4. Consistency with #6227: Similar to exposing permission mode, sandbox state is session context that scripts should access

Related Issues

  • #6227 - Expose Active Permission Mode to Hooks and Statusline (covers permission mode, not sandbox)
  • #7097 - Implement --sandbox Flag for Granular Control

Environment

  • Platform: macOS (Darwin)
  • Claude Code version: Latest

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗