Feature 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
Related / cross-reference
Feature 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
Configtool 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
Configtool accessible to agents with two modes: get (read current value) and set (update a value).Suggested configurable settings
modelautoCompactEnabledverbosepermissions.defaultMode"approve"|"ignore"|"auto"themealwaysThinkingEnabledshowTurnDurationWhy this matters
Acceptance criteria
Configtool is registered in the tool manifest withReadOnlypermission for get,WorkspaceWritefor setmodelmid-session takes effect on the next LLM call in the current sessionRelated / cross-reference
Configtool intools/src/lib.rs)