SNAPSHOT · TIER B · CLI

OpenCode 1.18.16@941e71d

Clean source inspection pinned to OpenCode package version 1.18.16 and one immutable commit. The profile separates semantic permission rules from OS isolation and remains Tier B until a reviewed Native experiment exists.

opencode-2026-08-10-sourcecurrent9 claims
Evidence boundary

Source claims are pinned to commit 941e71dbbb94; product behavior still requires independent experiments.

looppartial
contextpartial
toolspartial
safetypartial
reliabilitypartial
extensibilitypartial
orchestrationpartial
interfacespartial
observabilitypartial

OpenCode source map

This analysis is pinned to OpenCode package 1.18.16 at commit 941e71d. It describes the public monorepo at that revision. It does not claim that every installed binary, desktop release, or hosted service uses the same commit.

client / TUI / desktop / ACP
          │
          ▼
      HTTP server + event bridge
          │
          ▼
      session prompt loop
      ├─ Agent + model adapter
      ├─ permission-filtered tool registry
      ├─ compaction + retry
      ├─ child task sessions
      └─ durable/public events

1. Loop

The prompt service owns a repeated processing loop. It loads the current message projection, handles pending subtask and compaction work, resolves Agent and model configuration, assembles tools, invokes the processor, and checks explicit completion conditions. A tool-producing turn can continue instead of being mistaken for final output. Claim: opencode-source-agent-loop.

2. Context

Compaction is a first-class session operation, not a UI text shortcut. The service checks pressure against model limits, creates a summary turn, keeps a recent tail, and can prune older tool output. This separates full session history from the smaller model-visible projection. Claim: opencode-source-context-compaction.

3. Tools

The registry converges built-in tools, custom tool files, plugin contributions, and MCP definitions. Resolution applies Agent/model context and permission visibility; execution validates input and wraps output with truncation and metadata. The useful invariant is that tool identity, permission, handler, and result remain correlated across layers. Claim: opencode-source-tool-registry.

4. Safety

Permission rules use wildcard matching and last-match precedence. An unresolved operation defaults to ask; deny can fail immediately, while replies distinguish one-time and persistent approval. This is a semantic capability decision. The reviewed files do not prove kernel enforcement around a hostile subprocess, so the OS-sandbox dimension remains unknown. Claim: opencode-source-execution-policy.

5. Reliability

The retry module classifies provider errors, selected HTTP failures, overload signals, and retry headers. Context overflow is not silently replayed as a transient error, and retry delay is calculated explicitly. This maps policy code, not successful recovery under injected faults. Claim: opencode-source-retry-policy.

6. Extensibility

Plugins, skills, custom tools, and MCP are different acquisition paths that eventually affect prompt or tool resolution. MCP supports configured transports; skill discovery loads SKILL.md resources; plugins can add behavior in-process. Their presence expands capability and attack surface together. Claim: opencode-source-extension-runtime.

7. Orchestration

The task tool walks ancestry to enforce a depth boundary, derives child permission, and creates a session linked to its parent. Foreground and background execution share explicit task/session identity. Context separation is visible; filesystem or process isolation is not implied. Claim: opencode-source-subagent-sessions.

8. Interfaces

The HTTP server is a reusable harness surface. The TUI worker can provide an embedded fetch path and forward global events over RPC, keeping UI rendering separate from session ownership. This makes protocol and event compatibility part of the product architecture. Claim: opencode-source-client-server.

9. Observability

The event bridge enriches events with project/directory location and aggregate identity, assigns durable sequence/version metadata, and republishes a public event through the global bus. Consumers still need schema compatibility, resume, redaction, and retention policy; a sequence field alone does not solve those. Claim: opencode-source-event-bridge.

Evidence boundary and next experiment

All nine claims are static source observations pinned to one commit. The next safe step is a pre-registered read-only Native run using documented structured JSON output in a disposable fixture, with tool access minimized and publication disabled by default. Until that trace is captured, normalized, redacted, reviewed, and externally reproduced, OpenCode remains Tier B.

PINNED SOURCE MAP

github.com/anomalyco/opencode

941e71dbbb94ea5b32226c2845585992dadb361f
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/src/session/compaction.ts
  • packages/opencode/src/session/retry.ts
  • packages/opencode/src/tool/registry.ts
  • packages/opencode/src/tool/task.ts
  • packages/opencode/src/permission/index.ts
  • packages/opencode/src/plugin/loader.ts
  • packages/opencode/src/mcp/index.ts
  • packages/opencode/src/skill/discovery.ts
  • packages/opencode/src/server/server.ts
  • packages/opencode/src/cli/cmd/serve.ts
  • packages/opencode/src/cli/tui/worker.ts
  • packages/opencode/src/event-v2-bridge.ts
CLAIM LEDGER9 REVIEWED · 0 DISPUTED
sourcereviewed

opencode-source-agent-loop

OpenCode's pinned session prompt service repeatedly handles pending subtasks and compaction, resolves the active Agent and tools, invokes the model processor, and stops only at an explicit terminal condition.

Mechanism
Agent Loop
Reviewed
2026-08-10
Sources
1
source + sourcereviewed

opencode-source-client-server

OpenCode's pinned source exposes a headless HTTP server, while the terminal UI can use an embedded worker and RPC-forward global server events rather than owning a separate Agent core.

Reviewed
2026-08-10
Sources
2
sourcereviewed

opencode-source-context-compaction

OpenCode's pinned compaction service measures context pressure, constructs a summary turn, preserves recent context, and separately truncates oversized historical tool output.

Reviewed
2026-08-10
Sources
1
sourcereviewed

opencode-source-event-bridge

OpenCode's pinned event bridge enriches events with location and aggregate identity, assigns version and sequence metadata for durable records, and forwards public events through the global bus.

Mechanism
Event Stream
Reviewed
2026-08-10
Sources
1
sourcereviewed

opencode-source-execution-policy

OpenCode's pinned permission service uses last-match wildcard rules, defaults unresolved requests to ask, and represents deny, one-time approval, persistent approval, and rejection explicitly.

Reviewed
2026-08-10
Sources
1
sourcereviewed

opencode-source-retry-policy

OpenCode's pinned retry policy classifies provider and HTTP failures, honors retry-after metadata, applies bounded exponential delay, and excludes non-retryable failures such as context overflow.

Reviewed
2026-08-10
Sources
1
sourcereviewed

opencode-source-subagent-sessions

OpenCode's pinned task tool limits nesting, derives child permissions, creates parent-linked child sessions, and supports foreground or background tasks with explicit metadata.

Reviewed
2026-08-10
Sources
1
sourcereviewed

opencode-source-tool-registry

OpenCode's pinned tool registry combines built-in, custom, plugin, and MCP definitions, permission-filters visibility, validates arguments, and dispatches registered handlers with normalized output metadata.

Mechanism
Tool Dispatch
Reviewed
2026-08-10
Sources
1