OpenProgram Docs

Tool toggles and toolsets

The selected Agent decides which tools a branch may call. Each branch stores only intent, never an expanded list, so new tools remain available through the Agent template. Branches inherit intent once and then change independently.

Who chooses

WhereSetsStored in
Agents → Capabilities → ProgramsScope: all, selected, named Access preset, or none. Plus disabled names and a web_search default.Agent profile, tools: {mode, allowed, preset, disabled, web_search}
Composer Web Search switchLayers web_search on or off over the Agent's setBranch configuration, web_search
/skill <name> with allowed-toolsNarrows the turn to the skill's allowlistBranch configuration, tools_override (list[str])

No composer Tools switch or per-chat preset. A chat without tools uses an Agent with Programs set to none. The chat action reads only web_search from a message, never tools or tools_profile. A message without web_search (the CLI, the TUI) leaves the stored intent as it is.

Priority chain

resolve_tools(agent_profile, override, source) in runtime/conversation/model_tools.py; tools_override_from_config(cfg) in session_config.py produces the override.

Session intentOverrideResult
Nothing setNoneAgent profile's tools
web_search set{"inherit": True, "web_search": <bool>}Profile expanded live, then web_search added or removed, unless the Agent's disabled patterns exclude it
/skill allowlistlist[str] plus the web_search overlayagent_tools(names=[...])

Callers: Web chat (ws_actions/chat/turn.py, routes/chat_branches.py), channels (channels/inbound/_conversation.py), goal chat (programs/tools/planning/goal/chat.py).

Available is not resident

StateProvider tools arrayName in catalogCallable
ResidentFull schema, every turnNoYes
Deferred, loadedFull schemaNoYes
Deferred, not loadedNoYesAfter tool_search
Disabled or hiddenNoNoNo

The catalog names built-in deferred tools one by one and gives an MCP server or application one namespace line, within 4 KiB and then a count, so it stays small however many tools are deferred (Deferred tools).

GroupMembers
ResidentDEFAULT_TOOLS minus DEFERRED_DEFAULT_TOOLS, plus read_conversation. DEFAULT_TOOLS holds tool_search, which never defers: it is the only loader, so a set that names deferred tools carries it.
DEFERRED_DEFAULT_TOOLSMemory tools, scheduler, exit_plan_mode (the plan-mode prompt names it), send_message, skill, save_routine. Available by default, large and rarely called.
Other exposed toolsEverything in full outside DEFAULT_TOOLS
Application entriesDeferred, also while their application is open in a window: opening it loads nothing
Explicit web searchA copy promoted to resident, so it ships without tool_search. The shared registry is untouched.
Tool list by nameWithout tool_search in it, every tool ships resident
Mechanics in programs/_host/runtime.py
PartBehaviour
apply_default_deferral()Runs once at import in programs/__init__.py and gives every entry its default tier. Idempotent. Entries registered later get theirs at registration.
split_tools_for_dispatch(tools, loaded)Partitions into (provider_tools, catalog) by tier and the request's loaded set
Loaded setNot stored anywhere. Each request reads it from its own messages (loaded_tools(messages) in shared/tool_loads.py): the load records of its tool results (details.loads) and the names a compaction summary among them carries (carried_tool_names). A nested run reads its own messages, a branch its own history, an edited-and-resent turn the history before the edit.
Discoverytool_search writes a load record on its result (record_loads), so the next provider request carries real schemas. A guide or an opened application names the tools and how to load them; it loads nothing. Schema as tool-result text alone is not enough for providers that accept only tools in the request array.
ExecutionUses the turn's resolved, permission-wrapped tools, not a new registry lookup. Without discovery the array is stable; discovery may change the cached prefix.
CheckpointsA continuation needs no loaded names: the resumed request reads them from the messages it resumes with. The journal's old loaded_deferred_tools field is no longer written or read for loading. Tool-result text is never read as authorization or loading state.
CatalogA conversation's own turn sends it as the turn_context section deferred_catalog beside the user message: in full with no baseline, then only what was added or removed. A call with its own system prompt (an Agent method, runtime.exec) keeps it inline there (_build_deferred_catalog in runtime/context/prompt_assembly/components.py). Empty when nothing is deferred.
_estimate_one_toolIn runtime/context/token_accounting/budget.py. Resident: description, parameters and a small wrapper. Deferred: bare name plus a newline. The two errors point in opposite directions, so test_budget.py checks each half against a real tokenized payload, within 15%.

Do not break

RuleWhy
Expansion is deterministicThe tool array is the root of the prompt cache prefix (models/providers/settings/cache_policy.py; first breakpoint at the last tool, Anthropic and Bedrock explicit mode). Any wobble misses the whole cache silently. No set() iteration or dict churn in agent_tools and _filter_agent_tools.
Never store the Agent's tools on a sessionThe list would freeze: tools added to DEFAULT_TOOLS later would never arrive. list[str] means only a /skill allowlist.
Never filter historyHistorical tool_use and tool_result render from messages regardless of context.tools. Breaking the pairing causes a provider 400.
Mid-turn array growth only through discoveryAnything else discards the cached prefix for the rest of the turn
Cost, cache and replay
QuestionAnswer
Do tools count as tokens?ContextCommit.total_tokens excludes the array (state/store/session/context_commit/types.py); the provider bills it. Invisible to the compaction budget, visible in input cost.
Cache?Any addition, removal or reorder misses the entire prompt cache.
Calls absent from the current array?They replay fine; the model just cannot issue that call this turn.
Commit replay?Unaffected: commits store no tool array.
How other projects do it
ProjectStoresAvoids staleness by
opencodePer-session tools: Record<name, boolean>Builds the table fresh each turn, then filters by intent
claude-code--tools ("" none, "default" all), --allowedTools, --disallowedToolsConstant builtin set; intersection at run time
pi-aiBuiltin toggles and extension tools separatelyBoolean intent; live extension loading unaffected
hermesA preset nameExpands at run time (TOOLSETS is ported from it)

All store intent; none freezes an expanded list.

Carrying files, properties and tests
FileCarries
runtime/conversation/session_settings/session_config.pyweb_search and tools_override on SessionRunConfig, save and load in git session meta (no schema change)
interfaces/server/ws_actions/chat/turn.pytools_flag starts None; a /skill sets it; a new Agent conversation clears both. Nothing expands here.
runtime/conversation/model_tools.py_overlay_web_search in the dict branch of resolve_tools (web_search is not in DEFAULT_TOOLS)
programs/_host/runtime.pyDeferred machinery above, tool_search, deferred_catalog_text
runtime/agent/loop/Reads each request's loaded set from its messages (streaming.py); resolves calls by name against the full list, so a mid-turn load dispatches
TestLocks
tests/unit/programs/tools/test_tool_expansion_deterministic.pySame intent expands element-wise equal
tests/unit/store/session/test_session_config_tools_intent.pyNo intent follows the Agent; web_search overlay added, removed, respecting disabled; /skill lists; cold-provider path
tests/unit/store/session/test_session_config.pyRound-trip: True reads True, a missing field reads None; enabling web_search leaves tools_override absent
tests/unit/context/system_prompt/test_tool_defer.pyDeferred tools out of the array and in the catalog and prompt; tool_search moves them and returns full schema; execution stays on permission-wrapped tools; checkpoint restore; never defers itself; idempotent
tests/unit/context/statistics/test_budget.pyEach half of tool pricing

Also expected: new tools appear in automatic scope; two turns with unchanged intent show a cache hit; no client sends tools or tools_profile.

Boundaries and extension

TopicState
Provider builtin web_searchCodex and OpenAI Responses use builtin opts["web_search"]; others are unconfirmed, so the tool-name path stays. Switch at _overlay_web_search once confirmed.
allowed without a modeFilters DEFAULT_TOOLS; selected and presets expand by name over all tools
Exact array tokensA server-side figure, not statically measurable here
New intent dimensionsAdd scope to the Agent profile or a key to the dict intent. Never revert to a stored list.
Last updated · 2026-11-25