Knowledge Base for OpenCodeBusabase × OpenCode

Knowledge Base for OpenCode

OpenCode can merge organization, user, project, and managed configuration; load AGENTS.md and instruction files; delegate to primary agents and subagents; and call local or remote MCP tools. These layers explain execution. They do not make a session summary canonical.

Session outcome proposalPermission and evidence attached
Busabase reviewing OpenCode session output
Configuration precedence explains what the Agent could do. Review explains what others may trust.

Configuration precedence

Resolve the effective config before recording what an OpenCode Agent was allowed to do.

OpenCode merges remote organization defaults, global config, custom paths, project config, `.opencode` directories, inline content, and managed settings. Preserve the resolved inputs and repository revision rather than citing one file as the whole runtime.

REMOTE

Organization defaults from .well-known

GLOBAL

User preferences and runtime defaults

PROJECT

Repository-specific config and files

MANAGED

Admin-enforced highest-priority policy

Rules and instructions

AGENTS.md controls behavior; instruction references do not become a fact database.

OpenCode loads project and global AGENTS.md, supports Claude-compatible fallbacks, and can add files or remote URLs through the instructions array. Commit team guidance with the repository, keep personal preferences global, and query changing facts from their owner.

DURABLE INSTRUCTION

Run focused tests after changing this package.

STALE FACT SNAPSHOT

Customer approval is complete and production is green.

Agent topology

Primary agents, subagents, and hidden system agents create different evidence trails.

Build and Plan are primary agents; General, Explore, and Scout are subagents; compaction, title, and summary agents perform hidden support work. Record which agent acted, which agent delegated, and which tool permissions applied.

Agent roleTypical authorityEvidence to retain
BuildWrite and executeDiffs, commands, tests
PlanAnalyze with restricted writesPlan and cited repository context
GeneralDelegated multi-step workTask boundary and returned artifacts
Explore / ScoutRead-only discoveryFiles or external sources inspected
Hidden system agentsContext supportSummary provenance when material

Permission resolution

Allow, ask, and deny decide whether a tool runs; they do not approve the resulting record.

Permissions can be global, pattern-based, and agent-specific. Last matching rules win, while auto mode changes ask decisions but preserves explicit deny. Capture the resolved rule for every material action.

POLICY

Matching allow / ask / deny rule

USER DECISION

Prompt accepted when required

TOOL RESULT

Action and response captured

VERIFICATION

Diff, test, or external readback

RECORD REVIEW

Owner accepts shared state

Skills and MCP

Skills supply procedures; MCP supplies external tools; neither should silently own current business state.

Skills load on demand from project, global, and compatible agent directories. MCP servers may be local or remote, use OAuth, and be controlled globally or per agent. Pin Skill content and MCP identity separately.

SKILL

Procedure, templates, scripts, checklists

MCP SERVER

Tools, resources, authorization, runtime response

REVIEWED RECORD

Accepted outcome, owner, lifecycle

Sessions and sharing

A shared OpenCode conversation is collaboration context, not a durable system of record.

Session links expose a conversation and its outputs. Keep the session as provenance, but promote one concise outcome with source references, exact repository revision, verification, and an accountable decision.

01 · SESSION

Prompts, agents, tools, summaries

02 · OUTPUT

Files, diffs, commands, responses

03 · VERIFY

Tests and external readback

04 · PROPOSE

One bounded state change

05 · REVIEW

Canonical only after acceptance

Run evidence

Reconstruct the effective runtime without copying the entire conversation.

A compact evidence bundle should identify config layers, instructions, agent topology, permissions, Skills, MCP calls, repository state, and validation.

config_digestResolved config and precedence
instruction_refsAGENTS.md and extra instructions
agent_tracePrimary and delegated agents
permission_traceRules resolved for material tools
tool_evidenceBuilt-in and MCP responses
repository_refCommit, worktree, and diff
verificationTests and external checks
Busabase preserving OpenCode runtime evidence

Reviewed outcome

Promote a decision-sized result, not config files or a session transcript.

The record should remain understandable after the OpenCode session is compacted, shared, or deleted.

outcome_keyStable identity for the result
session_refOpenCode session and agent trace
config_refResolved config digest
source_refsCode, docs, and external records
proposed_stateConcise interpretation
ownerAcceptance responsibility
decisionAccepted, conditional, rejected, superseded
next_review_atFreshness checkpoint

Practical questions

OpenCode knowledge base FAQ

Does Busabase replace AGENTS.md?

No. AGENTS.md guides OpenCode behavior. Busabase holds selected reviewed results.

Which config file should evidence cite?

The resolved config and relevant source layers, not only the project file.

Does auto mode bypass deny?

Current OpenCode docs state explicit deny rules remain enforced.

Can a subagent approve its own result?

Tool permissions may let it act, but record acceptance remains a separate owner decision.

Should shared session links be canonical evidence?

Use them as provenance, alongside repository and external verification that survives link or retention changes.

Start with one resolved runtime

Capture how OpenCode acted, then review only the state another team needs.

Choose one completed OpenCode session, resolve config and permissions, attach verification, and submit one outcome instead of the full transcript.