Repository navigation
Closed
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
There is currently no way for an agent to read or modify OpenCode settings mid-session. Agents that want to switch models, enable auto-compact, adjust verbosity, or toggle permissions must ask the user to do it manually — breaking the agentic loop and creating unnecessary interruptions.
claw-code exposes a Config tool at the AI tool layer so agents can self-configure during a session. OpenCode has settings infrastructure but no AI-callable interface to it.
Proposed solution
Add a Config tool accessible to agents with two modes: get (read current value) and set (update a value).
// packages/opencode/src/tool/config.ts
export const ConfigTool = Tool.define({
name: "Config",
description: "Get or set an OpenCode runtime setting.",
parameters: z.object({
setting: z.string(),
value: z.union([z.string(), z.boolean(), z.number()]).optional()
}),
execute: async ({ setting, value }) => {
if (value === undefined) {
return { operation: "get", setting, value: Config.get(setting) }
}
const previous = Config.get(setting)
Config.set(setting, value)
return { operation: "set", setting, previousValue: previous, newValue: value }
}
})Suggested configurable settings
| Setting | Type | Description |
|---|---|---|
model |
string | Switch active model mid-session |
autoCompactEnabled |
boolean | Toggle automatic context compaction |
verbose |
boolean | Enable/disable verbose tool output |
permissions.defaultMode |
string | "approve" | "ignore" | "auto" |
theme |
string | UI theme |
alwaysThinkingEnabled |
boolean | Force extended thinking on/off |
showTurnDuration |
boolean | Display per-turn timing |
Why this matters
- Self-adjusting orchestrators can downgrade model mid-session to save cost once planning is done
- Background agents can turn off verbose output after bootstrapping
- Multi-agent frameworks can toggle permissions per sub-task without user interruption
Acceptance criteria
-
Configtool is registered in the tool manifest withReadOnlypermission for get,WorkspaceWritefor set - Attempting to set an unknown setting returns a clear error, not a silent no-op
- Setting
modelmid-session takes effect on the next LLM call in the current session - All settings changes are logged to the session event stream for auditability
- Permission mode required for set operations is enforced (agent cannot escalate its own permissions)
Related / cross-reference
- claw-code reference implementation: https://github.com/instructkr/claw-code/tree/main/rust (see
Configtool intools/src/lib.rs) - Sub-agent tool isolation: [FEATURE]: Add hidden field to skill frontmatter to exclude skills from agent selection #20474
- Learnings from claude-code source: Lessons from claude-code-main? #20475
- Original RFC: [FEATURE]: Rust-backed async diff engine via claw-code (fixes write/edit freeze + unlocks claw-code Rust primitives) #20479
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Activity
rekram1-node commentedon Apr 1, 2026
closing due to issue spam