src/agents/ defines all built-in and user-defined AI agents and the registry that converts configuration into OpenCode SDK agent definitions.
Responsibilities:
createAgents(config?)
config.disabled_agentsorchestrator, councillor cannot be disabled).SUBAGENT_FACTORIES.config.agents that are not built-in/aliases.<agent>.md replacement prompt<agent>_append.md appended promptpreset exists.model, temperature, variant, options, displayName) and default permissions.Custom agents:
buildCustomAgentDefinition(...) and allow prompt/orchestratorPrompt/model-chain overrides.AgentDefinition.config.model can be set directly, or set _modelArray for ordered fallback models and clear direct model so resolution occurs later.orchestrator default model is left open for runtime resolution when unset.fixer temporary fallback: if no override, it inherits librarian model.getAgentConfigs():
orchestrator → primarysubagentcouncil → all (callable directly and via delegation)councillor → subagent, hidden: true (internal)question defaults to allow unless already denied.skill comes from configured/default skill presets.council_session is allow only for council.getAgentMcpList(name, config) from config/agent-mcps.ts.config/ exports (getAgentOverride, getCustomAgentNames, AGENT_ALIASES).cli/skills.ts.src/index.ts
└─> createAgents(config)
└─> [orchestrator, explorer, librarian, oracle, designer, fixer, observer, council, councillor(custom)]
└─> getAgentConfigs(config)
└─> OpenCode register
loadPluginConfig()
└─> prompt files + overrides
└─> createAgents()/getAgentConfigs()
src/agents/index.ts now includes extended agent surface and custom-agent extension.orchestrator.ts owns prompt composition and dynamic disabled-agent filtering.council.ts + councillor.ts provide council-agent prompts and result formatter helpers.index.ts (registry, overrides, visibility, disabled/visible behavior)orchestrator.ts (base orchestrator prompt + prompt resolution)council.ts, councillor.ts (council-specific definitions + formatting helpers)observer.ts, explorer.ts, librarian.ts, oracle.ts, designer.ts, fixer.ts