Use the observability-triage skill for generic monitoring triage patterns. Use this guide for the repository-specific workflow for analyzing opencode-coder/OpenCode behavior in this repo.
Use these sources together (not in isolation):
| Source | Purpose | Typical location / access |
|---|---|---|
| Saved plugin mode | Canonical saved mode intent (team, stealth, disabled) |
.coder/opencode-coder.yaml |
| Project runtime context | Active-session snapshot of detected mode/readiness and plugin version | .coder/project.yaml |
| Project-local plugin logs | Repository-scoped plugin timeline (opencode-coder events) |
.coder/logs/coder-YYYY-MM-DD.log |
| OpenCode logs | Host/runtime-wide session/process log stream | auto-discovered by scripts/log-analyzer (Linux default: ~/.local/share/opencode/log/) |
| Session data access/export | Ground truth for message/tool timeline and token usage | coder("session"), coder("list-sessions"), coder("session-export <path> [session-id]"), /opencode-coder/dump-session |
| Diagnostics bundle | Portable evidence package combining available artifacts | .coder/diagnostics/diagnostics-<timestamp>/ |
docs/TESTING.md may point here for deep troubleshooting, but this document owns
the monitoring/analysis workflow.
Follow this order for most plugin/runtime incidents:
- Capture saved mode and runtime context from
.coder/opencode-coder.yamland.coder/project.yaml. - Inspect project-local logs for repository-scoped plugin events.
- Query OpenCode logs with
scripts/log-analyzer(session/service filters). - Access/export session evidence when behavior depends on tool-call/message flow.
- Collect a diagnostics bundle for sharing/review.
- Correlate across all sources (timestamps,
sessionID,pid, plugin version).
This sequence stays general-purpose for local dev, manual repro, or automated runs.
Use the two .coder/ YAML files for different questions:
.coder/opencode-coder.yamlis the saved mode source of truth used by startup mode resolution..coder/project.yamlis the active-startup project snapshot written during detection.
Treat .coder/project.yaml as the runtime snapshot for the current project session:
- mode (
stealth,team,uninitialized) - readiness signals (
installReady,ecosystemReady) - detector facts for git/beads/aimgr
pluginVersionobserved by runtime detection
Use it to quickly answer:
- Is the plugin running in the expected mode?
- Were ecosystem prerequisites detected as healthy?
- Does the observed plugin version match the scenario being analyzed?
Use .coder/opencode-coder.yaml to answer whether the project was explicitly saved in team, stealth, or disabled mode, even if runtime context is missing or stale.
opencode-coder writes project-local logs to:
<project-root>/.coder/logs/coder-YYYY-MM-DD.log
- daily filename rotation (
YYYY-MM-DD, UTC) - log directory created lazily
- 7-day retention (older files pruned at startup)
These logs are ideal for repository-scoped investigation and process overlap analysis because they persist in the project workspace.
The log analyzer is the primary query tool for OpenCode and project-local logs.
# List recent sessions from default source (opencode)
bun run scripts/log-analyzer list sessions
# Query one session for plugin warnings/errors
bun run scripts/log-analyzer --session=<session-id> --service=opencode-coder --level=WARN,ERROR
# Merge OpenCode + project-local logs in one timeline
bun run scripts/log-analyzer --source=both --session=<session-id> --tail=200
# Structured output for automation
bun run scripts/log-analyzer --session=<session-id> --level=ERROR,WARN --jsonSource options:
--source=opencode(default)--source=project-local--source=both
For quick aliases, package.json also exposes:
bun run logs:sessionsbun run logs:processes
When incident analysis depends on message/tool-call sequencing, include direct session data evidence:
coder("session")
coder("list-sessions")
coder("tokens")
coder("session-export private/session-dump/<session-id>")
You can also use /opencode-coder/dump-session to guide session export in-agent.
Session exports (session.json) are especially useful when logs alone do not explain
tool orchestration or assistant decision flow.
Use the diagnostics collector for a self-describing bundle of available evidence:
bun run diagnostics:collectSession-focused collection with existing export(s):
bun run diagnostics:collect \
--session=<session-id> \
--session-export=private/session-dump/<session-id>Output bundle:
<project-root>/.coder/diagnostics/diagnostics-<timestamp>/
Key artifacts (best effort):
manifest.json(what was included, missing, or errored)README.md(human summary + privacy checklist).coder/project.yamlcopy (if present)- recent project-local logs
- OpenCode session index and optional session extracts
- included/provided
session.jsonexport files
Missing sources are recorded in the manifest; collection does not fail solely because one source is unavailable.
Diagnostics and session exports may include prompts, code snippets, paths, and environment details. Review/redact before sharing outside your trust boundary.
Use the following fields to build a consistent timeline:
sessionID: join OpenCode logs, project-local extracts, and session export.pid: separate overlapping processes in merged logs.- timestamps: align startup, command, and failure windows.
- plugin version: compare
.coder/project.yamlwith package/runtime expectations. - readiness signals: relate failures to
installReady/ecosystemReadystate.
A practical classification after correlation:
- runtime/context mismatch (mode/readiness/version)
- command registration/exposure problems
- resource or dependency gating failures
- tool execution/runtime exceptions
- workspace/setup issues in isolated reproductions
Record the classification together with evidence paths to make bug reports and follow-up debugging reproducible.