The runtime writes append-only JSON Lines events to:
<project>/.opencode/agent-loop-state/events.jsonl
Each event conforms to config/agent-loop-event.schema.json and includes:
- schema version and unique event ID
- timestamp and task ID
- event type
- optional stage, role, and model ID
- recursively redacted structured data
Current event families include:
workflow.call,workflow.call.completed, andworkflow.call.failedstage.started,stage.completed,stage.failed, andstage.blockedsmoke.completedmodel.attempt.*,model.invocation.*, andmodel.retry.scheduledprovider.cooldown,provider.skipped, andprovider.cooldown-reapedpaid-fallback.deniedbudget.updatedandbudget.exceededrouting.eventfor backward-compatible routing events that do not yet have a dedicated type
node scripts/query-events.mjs --task feature-auth-20260722 --format summary
node scripts/query-events.mjs --type budget.exceeded --format json
node scripts/query-events.mjs --model opencode/deepseek-v4-flash-free --limit 50The stream supports debugging, audit history, budget recovery, performance analysis, and later dashboard integrations. It is local runtime state and must not be committed.
The structured stream supplements rather than replaces existing attempt and progress logs under .opencode/agent-loop-logs/. Existing log consumers can continue reading those files. New integrations should prefer the versioned event stream and treat unknown event types as forward-compatible records.
The logger recursively redacts fields with credential-like names and common token, bearer, private-key, and environment-secret formats. Redaction is defense in depth, not permission to log secrets deliberately. Worker prompts, environment files, credentials, and production data should never be emitted.