Skip to content

internals execution modes

github-actions[bot] edited this page Nov 2, 2026 · 6 revisions

Execution modes internals

User guide: Execution modes.

Prompt and cache mechanics

Mode is conveyed to the model with prompt.ModeNotice (internal/prompt/mode_notice.go). Interactive sessions keep the notice sticky (modeNotice, internal/interactive/session.go), so it stays under the provider's second-to-last user cache breakpoint (internal/provider/anthropic_wire.go).

Delegated child workflow modes omit the execution-modes section. sectionExecutionModes in internal/prompt/system.go returns nothing for them.

Enforcement

  • Sandbox resolution is documented in Tool sandboxing internals.
  • With no mode getter set, the mode defaults to build.
  • Plan-mode path checks use a lexical allowlist and a symlink-resolved check (internal/tool/policy_paths.go).
  • Plan-mode writable directories come from config.PlanModeWritableDirs(): .steiner/plans and .steiner/security.
  • Mode changes call mcpManager.UpdatePlanMode (cmd/steiner/interactive_session.go). Delegated child executors take the parent's mode getter through WithModeGetter (internal/delegation/bootstrap.go).
  • Plan-mode limits on delegation use UsesWorktree (internal/delegation/agent_type.go): checkPlanModeWriteDenial (internal/delegation/specialized_tools.go) denies code and documentor children, and denyFollowUpInPlanMode (internal/delegation/follow_up.go) denies follow_up when the child has mutate. Details are in Sub-agent delegation internals.
  • A per-executor write scope is attached with Executor.WithWriteScope (internal/tool/executor.go) and applied in runPipeline (internal/tool/execution_pipeline.go) after plan-mode restrictions, so a scoped executor is bound by both limits. The scope rules are in Sub-agent delegation internals.

Persistence and restoration

internal/interactive/persistence.go saves sess.Mode. An empty saved mode falls back to Config.Modes.Default, which is build by default (internal/config/load.go). Restore accepts only plan and build. Any other value fails with load session: unknown mode "<mode>", reported as load session failed: %v.

Clone this wiki locally