Documentation
¶
Overview ¶
Demonstrates WithInitialMode(ModePlan). opencode's plan mode ships with a permission ruleset that DENIES every edit — it does not route edit requests through session/request_permission. Asking plan to modify a file reliably produces an inline refusal from the model, which is useful when you want a read-only conversation where the agent can reason about changes without applying them.
WithInitialMode is an ACP-terminology alias for WithAgent; pick whichever reads better in context. ModeBuild and ModePlan are the built-in mode ids that ship with opencode 1.14.20.
If you want the interactive ask-path (session/request_permission) instead, use the default `build` agent and set `"permission": {"edit": "ask"}` in ~/.config/opencode/config.json — see examples/permission_callback.
go run ./examples/plan_mode