Skip to content

Auto mode, /btw command, and model size display #21

Closed

Description

@androidand
Proposal

Why

Problem 1: Permission friction blocks autonomous work

The current --dangerously-skip-permissions flag is a blunt instrument — it disables ALL permission checks, including safety-critical ones. Claude Code's auto mode provides a better pattern: a classifier-based approach that auto-approves safe actions (file reads, local writes) while routing risky actions (shell commands, network calls, production deploys) through a safety classifier. Users want full autonomy without the security risk of bypassing all checks.

Problem 2: No way to ask side questions during agent work

Claude Code's /btw command lets users ask quick questions without cluttering conversation history. When the agent is mid-task (especially in a loop), users need to ask "what was that config file name?" or "what did we decide about X?" without derailing the main work or adding noise to the context window.

Problem 3: Model size (GB) not visible outside the repo

Local llama-skein models report size_bytes in their /v1/models endpoint, and the Model.sizeBytes field exists in the schema (provider.ts:1114), but it's never populated or displayed outside the repo where the llama-skein backend is directly accessible. The discoverOpenAICompatibleModels function at provider.ts:1536 reads size_bytes from the API response, but the fit report (/api/fit) also contains model_mb which could be used as a fallback. Additionally, the mergeDiscoveredModel function at provider.ts:1460 preserves sizeBytes correctly, but the initial discovery may not be getting the data.

What Changes

Auto mode

  • Replace --dangerously-skip-permissions with --auto flag (and --permission-mode auto)
  • Create an AutoMode service that evaluates tool calls against safety rules
  • Safe actions (file reads, local edits in working directory) auto-approve
  • Risky actions (shell commands, network calls, destructive operations) route through a classifier-like evaluation
  • Add permission mode cycling (Shift+Tab equivalent) in TUI
  • Support defaultMode: "auto" in settings
  • Classifier rules: block downloads+execution, sensitive data exfiltration, production deploys, mass deletions, IAM changes, force push, etc.
  • Allow explicit ask rules to still force prompts even in auto mode

/btw command

  • Create a /btw slash command for temporary side questions
  • Side questions have full visibility into current conversation context
  • No tool access — answers only from existing context
  • Single response in a dismissible overlay
  • Does not add to conversation history
  • Can run while agent is processing (independent of main turn)
  • Reuses parent conversation's prompt cache for low cost

Model size display fix

  • Ensure size_bytes from /v1/models is properly captured during discovery
  • Add fallback: use model_mb from /api/fit report when size_bytes is unavailable
  • Display size in GB format in model picker and opencode models output
  • Fix the data flow: /v1/models → discoverOpenAICompatibleModels → sizeBytes field → model picker UI

Capabilities

New Capabilities

  • auto-mode: classifier-based permission mode that auto-approves safe actions while routing risky ones through safety evaluation
  • side-questions: temporary /btw command for asking questions without adding to conversation history

Modified Capabilities

  • permissions: enhanced with mode system (default, acceptEdits, auto, dontAsk, bypassPermissions)
  • model-picker: now displays model size in GB for local models

Non-Goals

  • Not implementing a full ML-based classifier (that's a server-side concern)
  • Not changing the loop engine's core behavior
  • Not adding persistent storage for side questions
  • Not implementing Claude Code's full permission mode cycle (Shift+Tab) in this change — just the --auto flag and settings support

Impact

  • Modified: packages/opencode/src/cli/cmd/run.ts (replace --dangerously-skip-permissions with --auto)
  • Modified: packages/opencode/src/permission/index.ts (add mode evaluation)
  • Modified: packages/opencode/src/session/tools.ts (route through auto mode)
  • New: packages/opencode/src/cli/cmd/btw.ts (/btw command implementation)
  • New: packages/opencode/src/auto-mode/ (auto mode service and rules)
  • Modified: packages/opencode/src/provider/provider.ts (model size fallback from fit report)
  • Modified: packages/opencode/src/cli/cmd/models.ts (display size in output)
  • Modified: packages/opencode/src/config/config.ts (add auto mode config)

Disposition (2026-09-18)

Archived — superseded/obsolete. /btw exists as the side-question command; auto mode exists (--auto, auto_mode, footer badge fixed 2026-09-18). The safety-rule categories were never wanted over the permission system.

Tasks

Phase 1: Auto mode permission system

  • 1.1 Create src/auto-mode/rules.ts with safety rule definitions

    • Define rule categories: safe (file reads, local edits), risky (shell, network), blocked (downloads+exec, exfiltration, prod deploys, mass delete, IAM, force push)
    • Create evaluateAction(ruleCategory, action, context) function
    • Validation: unit tests for each rule category with sample actions
  • 1.2 Create src/auto-mode/service.ts — AutoMode service

    • Export AutoMode.Service with evaluate(toolCall) method
    • Integrate with existing Permission.ask() flow
    • In auto mode: safe actions skip Permission.ask(), risky actions still ask but with auto-approve suggestion
    • Blocked actions are rejected immediately with explanation
    • Validation: bun typecheck passes; service can be injected into provider layer
  • 1.3 Replace --dangerously-skip-permissions with --auto in cli/cmd/run.ts

    • Remove --dangerously-skip-permissions flag
    • Add --auto flag (alias: -a)
    • When --auto is set, inject AutoMode into the permission evaluation chain
    • Auto-approve safe tool calls, prompt for risky ones
    • Validation: opencode run --auto "test" runs without permission prompts for safe actions
  • 1.4 Add defaultMode: "auto" support in config

    • Update src/config/config.ts to support permissions.defaultMode with values: default, acceptEdits, auto, dontAsk, bypassPermissions
    • When defaultMode: "auto" is set, start sessions in auto mode
    • Validation: config parses; sessions start in auto mode when configured

Phase 2: /btw command

  • 2.1 Create src/cli/cmd/btw.ts — /btw slash command

    • Parse /btw [question] input
    • Create a temporary "side question" session that inherits context from parent
    • No tool access — only text generation from existing context
    • Single response, then discard
    • Does not persist to conversation history
    • Validation: /btw what was the config file? returns answer without adding to history
  • 2.2 Integrate /btw into the slash command registry

    • Register in fork/commands.ts or equivalent
    • Make available during agent processing (doesn't interrupt main turn)
    • Show in / command menu
    • Validation: /btw appears in command menu; works mid-turn
  • 2.3 Add overlay display for /btw responses in TUI

    • Show /btw response in a dismissible overlay
    • List earlier /btw exchanges above current answer
    • Navigation: Left arrow to step back through earlier answers
    • Validation: TUI shows overlay; earlier answers accessible

Phase 3: Model size display fix

  • 3.1 Fix discoverOpenAICompatibleModels to capture size_bytes

    • Verify size_bytes from /v1/models is parsed at provider.ts:1536
    • Add fallback: when size_bytes is null, use model_mb from fit report × 1024 × 1024
    • The fit report's model_mb is in MB; convert to bytes for sizeBytes field
    • Validation: opencode models shows size for local models
  • 3.2 Display model size in opencode models output

    • When --verbose flag is used, show size in GB format (e.g., "7.2 GB")
    • Format: divide bytes by 1024³, show 1 decimal place
    • Validation: opencode models --verbose shows size for models with size data
  • 3.3 Add size display in model picker (TUI and CLI run)

    • When selecting a model, show size next to model name for local models
    • Only show for models where sizeBytes is defined
    • Validation: model picker shows size for local llama-skein models

Phase 4: Integration and testing

  • 4.1 End-to-end test: auto mode with safe and risky actions

    • Test file read (should auto-approve)
    • Test shell command (should prompt or evaluate)
    • Test blocked action (should reject immediately)
    • Validation: all test cases pass
  • 4.2 End-to-end test: /btw command

    • Test /btw during agent processing
    • Test /btw doesn't add to history
    • Test /btw has access to conversation context
    • Validation: /btw works as expected
  • 4.3 End-to-end test: model size display

    • Test with llama-skein backend that reports size_bytes
    • Test fallback from fit report model_mb
    • Validation: size displayed correctly in all output formats
  • 4.4 Full build and typecheck

    • bun typecheck in packages/opencode — zero errors
    • bun test packages/opencode --timeout 60000 — all tests green
    • Validation: no regressions in existing features

Unchecked items above: see Disposition in proposal.md (2026-09-18).

Activity

  1. androidand commented on Sep 17, 2026

    @androidand
    OwnerAuthor

    Archived 2026-09-18 — see the change's Disposition section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions