Repository navigation
Auto mode, /btw command, and model size display #21
Description
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-permissionswith--autoflag (and--permission-mode auto) - Create an
AutoModeservice 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+Tabequivalent) 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
askrules to still force prompts even in auto mode
/btw command
- Create a
/btwslash 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_bytesfrom/v1/modelsis properly captured during discovery - Add fallback: use
model_mbfrom/api/fitreport whensize_bytesis unavailable - Display size in GB format in model picker and
opencode modelsoutput - Fix the data flow:
/v1/models→discoverOpenAICompatibleModels→sizeBytesfield → model picker UI
Capabilities
New Capabilities
auto-mode: classifier-based permission mode that auto-approves safe actions while routing risky ones through safety evaluationside-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
--autoflag 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.tswith 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.Servicewithevaluate(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 typecheckpasses; service can be injected into provider layer
- Export
-
1.3 Replace
--dangerously-skip-permissionswith--autoincli/cmd/run.ts- Remove
--dangerously-skip-permissionsflag - Add
--autoflag (alias:-a) - When
--autois set, injectAutoModeinto 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
- Remove
-
1.4 Add
defaultMode: "auto"support in config- Update
src/config/config.tsto supportpermissions.defaultModewith 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
- Update
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
- Parse
-
2.2 Integrate /btw into the slash command registry
- Register in
fork/commands.tsor equivalent - Make available during agent processing (doesn't interrupt main turn)
- Show in
/command menu - Validation:
/btwappears in command menu; works mid-turn
- Register in
-
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
discoverOpenAICompatibleModelsto capturesize_bytes- Verify
size_bytesfrom/v1/modelsis parsed atprovider.ts:1536 - Add fallback: when
size_bytesis null, usemodel_mbfrom fit report × 1024 × 1024 - The fit report's
model_mbis in MB; convert to bytes forsizeBytesfield - Validation:
opencode modelsshows size for local models
- Verify
-
3.2 Display model size in
opencode modelsoutput- When
--verboseflag is used, show size in GB format (e.g., "7.2 GB") - Format: divide bytes by 1024³, show 1 decimal place
- Validation:
opencode models --verboseshows size for models with size data
- When
-
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
sizeBytesis 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 typecheckin packages/opencode — zero errorsbun 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
androidand commentedon Sep 17, 2026
Archived 2026-09-18 — see the change's Disposition section.