Welcome to my OpenCode command center! β¨
This repo gives you a clean, portable OpenCode setup with fast MCP controls inside OpenCode itself. Keep autonomous coding smooth, and only turn on external context when you actually need it. β‘
- One source of truth for global OpenCode config.
- Token-aware workflow by keeping heavy MCPs disabled by default.
- Instant MCP toggling with
/mcpcommands in the OpenCode prompt. - Portable install with a one-liner script and symlinked default config path.
- Worktree-friendly repo so you can iterate on config safely in feature branches.
- π§ Built-in
/mcpcommand forstatus,enable, anddisable. - ποΈ Built-in
/plugincommand to enable or disable plugins without editing JSON. - π Built-in
/notifycommand to tune notification behavior by level (all, channel, event, per-channel event). - π§Ύ Built-in
/digestcommand for session snapshots and optional exit hooks. - π‘ Built-in
/telemetrycommand to manage LangGraph/local event forwarding. - β
Built-in
/post-sessioncommand to configure auto test/lint hooks on session end. - π‘οΈ Built-in
/policycommand for strict/balanced/fast permission-risk presets. - π§΅ Built-in
/bgcommand for minimal background job orchestration and retrieval. - π§± Built-in
/refactor-litecommand for preflighted, safe-first refactor workflows. - π§ Built-in
/safe-editcommand for semantic adapter planning and readiness diagnostics. - π©Ί Built-in
/doctorumbrella command for one-shot health checks. - π€ Built-in
/agent-doctorcommand for custom agent contract, orchestration policy marker, and runtime checks. - πΎ Built-in
/configcommand for backup/restore snapshots. - π§© Built-in
/stackbundles for coordinated multi-command profiles. - π Built-in
/browsercommand for provider switching and dependency diagnostics. - β±οΈ Built-in
/budgetcommand for execution budget profile, override, and diagnostics. - π§ Custom agents for Tab selection:
orchestrator(primary), plusexplore,librarian,oracle,verifier,reviewer, andrelease-scribesubagents. - π§ Built-in
/nvimcommand to install and validate deeperopencode.nvimkeymap integration. - π§° Built-in
/devtoolscommand to manage external productivity tooling. - π§ Built-in
/auto-slashcommand to map natural-language intent to safe slash command previews. - πΈ Better token control by enabling
context7/gh_greponly on demand. - π Autonomous-friendly permissions for trusted project paths.
- π Easy updates by rerunning the installer.
- π§© Clear, versioned config for experiments and rollbacks.
This setup keeps build as the default agent, and adds focused specialists for manual selection via Tab:
orchestrator(primary): execution lead for complex tasks, with explicit delegation and completion gates.explore(subagent): read-only internal codebase scout.librarian(subagent): read-only external docs and OSS evidence researcher.oracle(subagent): read-only architecture/debug advisor for hard tradeoffs.verifier(subagent): read-only validation runner for test/lint/build checks.reviewer(subagent): read-only quality/risk review pass before final delivery.release-scribe(subagent): read-only PR/changelog/release-notes writer from git evidence.
Agent files live in agent/*.md and install globally to ~/.config/opencode/agent/.
Agent source-of-truth specs live in agent/specs/*.json and generate markdown via scripts/build_agents.py.
Quick validation:
/agent-doctor
/agent-doctor-json
Detailed guide: docs/agents-playbook.md π
Operating contract: instructions/agent_operating_contract.md π‘οΈ
Autopilot hook migration plan: docs/autopilot-hook-roadmap.md π
- Track upcoming orchestration features in
IMPLEMENTATION_ROADMAP.md. - Release slicing baseline (Task C1) now groups delivery into deterministic phases (A-N) with explicit readiness gates per slice.
- Epic acceptance baseline (Task C2) now defines reusable completion criteria for functional behavior, reliability, docs quality, validation gates, and rollback evidence.
- Tracking cadence baseline (Task C3) now requires weekly roadmap status entries, a single active
in_progressepic, and monthly review of paused/postponed epics. - Command UX baseline (Task C4) now standardizes shortcut aliases, help/doctor discoverability, and troubleshooting-first quick paths across command families.
- Session intelligence baseline (E6-T1) now records digest-linked session metadata in
~/.config/opencode/sessions/index.jsonwith retention pruning for stale or oversized histories. - Session command baseline (E6-T2) now exposes
/session list|show|searchplus/session doctorfor indexed-session visibility and diagnostics. - Resume support baseline (E6-T3) now emits actionable
resume_hintsin/resumeand/start-work recoverJSON output, and includes resume eligibility hints in digestplan_executionsnapshots. - Roadmap status sync marks Epic 6 and Epic 28 complete after verification and aligns dashboard/task state with shipped functionality.
- Dashboard reconciliation now aligns Epic 25-E27 summary statuses with completed implementation sections.
- Epic 18 roadmap task checkboxes now align with previously shipped safe-edit adapter and command-integration completion notes.
- Paused-epic governance now defines measurable exit criteria for E7/E10 promotion, including demand/prototype/safety gates.
- Auto-slash detector now ships with preview-first dispatch, per-command toggles, and execution audit logging for E10 intent routing.
Release slicing gate checklist (per phase):
- command contracts and user workflows are documented (
README+ relevantinstructions/*) - validation bundle passes:
make validate,make selftest,make install-test - rollback/remediation notes are explicit for newly introduced runtime controls
- roadmap/checklist/changelog entries are updated before merge
Epic 18 Task 18.1 defines the semantic safe-edit baseline in:
instructions/safe_edit_capability_matrix.md
Current scope includes:
- supported operations:
rename,extract,organize_imports,scoped_replace - operation/backend matrix: preferred LSP/AST path plus guarded text fallback
- deterministic availability checks for language, LSP, and AST readiness
- explicit fallback blocking conditions and reason-code contract for explainability
Task 18.2 implementation baseline:
- adapter module:
scripts/safe_edit_adapters.py - operation planner: deterministic backend choice (
lsp,ast, or guardedtextfallback) - validation helper: changed-reference verification for rename-like symbol updates
Task 18.3 command integration:
- command module:
scripts/safe_edit_command.py - diagnostics:
/safe-edit status --json,/safe-edit doctor --json - planning surface:
/safe-edit plan --operation <rename|extract|organize_imports|scoped_replace> --scope <glob[,glob...]> [--allow-text-fallback] --json
Examples:
/safe-edit status --json
/safe-edit plan --operation rename --scope scripts/*.py --json
/safe-edit plan --operation scoped_replace --scope scripts/*.py --allow-text-fallback --json
/safe-edit doctor --json
Verification notes:
- selftest now covers cross-language rename/reference validation samples (
python,typescript,go,rust). - fallback tests cover explicit-scope gating and unsupported-language failure paths.
- install smoke now exercises
/safe-edit planin addition to status/doctor checks.
Epic 19 Task 19.1 defines checkpoint snapshot lifecycle semantics in:
instructions/checkpoint_snapshot_lifecycle.md
Current baseline includes:
- snapshot schema for step state, context digest, command outcomes, and integrity metadata.
- deterministic trigger boundaries (
step_boundary,error_boundary,timer,manual) with coalescing behavior. - retention/rotation defaults (bounded history per run plus terminal snapshot preservation).
- optional history compression policy with checksum continuity requirements.
Task 19.2 implementation baseline:
- manager module:
scripts/checkpoint_snapshot_manager.py - persistence semantics: atomic writes to
checkpoints/<run_id>/history/<snapshot_id>.jsonandcheckpoints/<run_id>/latest.json - runtime integration:
/start-workand/start-work recovernow persist checkpoint snapshots after state writes - lifecycle controls: list/show/prune APIs with integrity verification and bounded retention defaults
Task 19.3 visibility tooling:
- command module:
scripts/checkpoint_command.py - command surface:
/checkpoint list|show|prune|doctor - doctor integration: unified
/doctor run --jsonnow includes checkpoint health checks
Examples:
/checkpoint list --json
/checkpoint show --snapshot latest --json
/checkpoint prune --max-per-run 50 --max-age-days 14 --json
/checkpoint doctor --json
Task 19.4 verification notes:
- selftest verifies atomic checkpoint writes and deterministic corruption/integrity-failure reason codes.
- retention tests verify bounded per-run history and gzip rotation for older snapshots.
- install smoke now exercises
/checkpoint list|show|prune|doctoralongside/start-workrecovery flows.
Epic 20 Task 20.1 defines execution budget guardrail policy in:
instructions/execution_budget_model.md
Current baseline includes:
- budget dimensions for wall-clock duration, tool-call count, and token estimates.
- profile defaults for
conservative,balanced, andextendedexecution envelopes. - deterministic soft/hard threshold semantics and reason-code contract.
- auditable override and emergency-stop behavior with bounded escalation limits.
Task 20.2 runtime integration:
- runtime module:
scripts/execution_budget_runtime.py /start-workand/start-work recovernow emit budget counters, threshold evaluation, and recommendations in JSON reports- hard-limit crossings transition run state to
budget_stoppedwith deterministicbudget_*reason codes /start-work statusand/start-work doctorinclude persisted budget diagnostics
Task 20.3 commands and diagnostics:
- command module:
scripts/budget_command.py - command surface:
/budget status|profile|override|doctor - unified diagnostics:
/doctor run --jsonincludes budget guardrail health checks - runtime tuning path: profile switching plus auditable temporary overrides for high-variance workloads
Examples:
/budget status --json
/budget profile conservative
/budget override --tool-call-count 120 --token-estimate 120000 --reason "large refactor" --json
/budget override --clear --json
/budget doctor --json
Task 20.4 verification notes:
- selftest covers PASS/WARN/FAIL budget threshold evaluation and
budget_stoppedhard-stop behavior in/start-work. - selftest covers override apply/clear paths plus invalid override input rejection with deterministic usage guidance.
- install smoke includes
/budget status,/budget override,/budget doctor, and/budget override --clearchecks.
Epic 22 Task 22.1 defines unified orchestration command semantics in:
instructions/autoflow_command_contract.md
Current baseline includes:
/autoflowsubcommands:start,status,resume,stop,report,dry-run- deterministic validation/error payload rules with stable reason codes and remediation hints
- concise human output plus structured
--jsonschema for automation - lifecycle status model and safety defaults for dry-run, stop, and recovery gating
Task 22.2 adapter baseline:
- adapter module:
scripts/autoflow_adapter.py - primitive composition:
plan,todo_compliance,budget,checkpoint,resume, andloop_guard - deterministic transition matrix for
start|status|resume|stop|report|dry-run - explain path that returns trace entries plus fallback intent/reason when transitions are illegal or resume gating fails
Task 22.3 safety and usability controls:
- command module:
scripts/autoflow_command.py - kill-switch control:
/autoflow stop --reason <text> --jsonsets runtime status tostoppedwith audit metadata - dry-run control:
/autoflow dry-run <plan.md> --jsonpreviews transition decisions without mutating runtime state - migration path from low-level commands to
/autoflow:/start-work <plan.md>->/autoflow start <plan.md>/start-work status --json->/autoflow status --json/start-work deviations --json->/autoflow report --json/resume now --interruption-class <class> --json->/autoflow resume --interruption-class <class> --json
Task 22.4 verification notes:
- selftest validates
/autoflowlifecycle coverage acrossstart -> status/reportwith deterministic payload assertions. - selftest validates
/autoflow resumerecovery gating for non-idempotent steps and explicit approval replay. - install smoke validates
/autoflow dry-run,/autoflow status,/autoflow report, and/autoflow stophappy-path controls.
Runtime storage note:
plan_executionruntime state is persisted to~/.config/opencode/my_opencode/runtime/plan_execution.json.- this avoids invalid top-level keys in
~/.config/opencode/opencode.jsonand prevents OpenCode startup config parsing errors.
Epic 23 Task 23.1 defines pre-merge risk scoring semantics in:
instructions/pr_review_rubric.md
Current baseline includes:
- deterministic risk categories for
security,data_loss,migration_impact,test_coverage, anddocs_changelog. - explicit severity (
S0-S3) and confidence (C0-C3) scales with conservative blocker thresholds. - required evidence contract for every finding (
file_refs, rationale, and remediation), plus hard-evidence gating for blocker recommendations. - low-noise recommendation mapping (
approve,needs_review,changes_requested,block) with deterministic tie-break behavior.
Task 23.2 analyzer baseline:
- analyzer module:
scripts/pr_review_analyzer.py - parses unified git diffs (
git diff --unified=0) into file/line evidence and classifies changed areas. - emits rubric-aligned findings with deterministic severity/confidence and
file_refs. - detects missing release evidence (
tests,README,CHANGELOG) and folds gaps into recommendation scoring.
Examples:
python3 ~/.config/opencode/my_opencode/scripts/pr_review_analyzer.py analyze --base main --head HEAD --json
python3 ~/.config/opencode/my_opencode/scripts/pr_review_analyzer.py analyze --diff-file /tmp/pr.diff --json
Task 23.3 command integration:
- command module:
scripts/pr_review_command.py - command surface:
/pr-review,/pr-review-json,/pr-review-checklist,/pr-review-doctor - doctor integration: unified
/doctor run --jsonincludespr-reviewsubsystem readiness
Warning vs blocker triage flow:
block: at least oneS3finding withC2+confidence and hard evidence; do not merge until fixed.changes_requested: repeatedS2findings with concrete remediation and missing evidence.needs_review: medium-risk findings or uncertain evidence requiring reviewer attention.approve: no meaningful risk findings beyond informational noise.
Examples:
/pr-review --base main --head HEAD --json
/pr-review checklist --base main --head HEAD --json
/pr-review doctor --json
Task 23.4 verification notes:
- selftest validates blocker detection for hard-evidence security findings and missing-evidence recommendation behavior.
- selftest validates false-positive control for docs-only diffs (
recommendation=approve, no findings). - install smoke validates
/pr-review,/pr-review checklist, and/pr-review doctorcommand paths.
Task 24.1 release policy contract notes:
- release preconditions now require clean git state plus passing
make validate,make selftest, andmake install-testevidence before publish readiness. - semantic-version gating now defines deterministic patch/minor/major validation and breaking-change mismatch blocking.
- rollback policy now defines partial-failure handling with explicit reason codes and follow-up guidance.
Task 24.2 release assistant engine notes:
- backend module:
scripts/release_train_engine.pywithstatus,prepare,draft,publish, anddoctorcommand flows. prepareemits deterministicreason_codesand remediation for clean-tree, branch, validation, changelog, and semver gating checks.draftcomposes release-note entries from git history since the latest (or provided) tag.publishenforces readiness and explicit confirmation, with dry-run and rollback action metadata.
Task 24.3 command integration notes:
- command module:
scripts/release_train_command.py - command surface:
/release-train,/release-train-json,/release-train-prepare,/release-train-draft,/release-train-doctor - doctor integration: unified
/doctor run --jsonnow includesrelease-trainsubsystem readiness checks. - release-check integration:
make release-check VERSION=x.y.znow invokes release-train preflight gating.
Examples:
/release-train status --json
/release-train prepare --version 0.3.0 --json
/release-train draft --head HEAD --json
/release-train doctor --json
Task 24.4 verification notes:
- selftest validates breaking-change/changelog mismatch blocking with
version_mismatch_breaking_changereason codes. - selftest validates publish behavior split between
--dry-runpass and confirmation-required blocking for live publish. - install smoke validates
/release-trainstatus, prepare, draft, and doctor command paths.
Task 25.1 hotfix policy contract notes:
- hotfix activation now requires incident id, declared scope, declared impact, and recorded operator context.
- mandatory guardrails define non-skippable checks for git hygiene,
make validate, rollback checkpoint, and timeline completeness. - reduced validation profile allows targeted tests during incident response but requires deferred full-suite follow-up with ownership.
- post-incident closure now requires follow-up issue linkage, deferred validation plan, and timeline export artifacts.
Task 25.2 hotfix runtime notes:
- backend module:
scripts/hotfix_runtime.pywithstart,checkpoint,mark-patch,validate,close,status, anddoctorflows. - runtime profile now persists constrained budget and tool-permission defaults for incident handling.
- rollback checkpoint and patch/validation events are captured in append-only timeline records.
- closure now enforces follow-up issue linkage and deferred validation ownership metadata.
Task 25.3 hotfix command integration notes:
- command module:
scripts/hotfix_command.py - command surface:
/hotfix,/hotfix-json,/hotfix-start,/hotfix-status,/hotfix-close,/hotfix-remind,/hotfix-doctor - doctor integration: unified
/doctor run --jsonnow includeshotfixsubsystem readiness checks. - install/self-check integration: installer smoke now exercises hotfix start, checkpoint, validate, status, remind, close, and doctor paths.
Examples:
/hotfix start --incident-id INC-42 --scope patch --impact sev2 --json
/hotfix status --json
/hotfix close --outcome resolved --followup-issue bd-123 --deferred-validation-owner oncall --deferred-validation-due 2026-03-01 --json
/hotfix remind --json
/hotfix doctor --json
Task 25.4 hotfix verification notes:
- selftest now validates mandatory guardrail enforcement for dirty-worktree incident start blocking (
reason_code=dirty_worktree). - selftest now validates rollback incident flow end-to-end (
scope=rollback) includingrollback_appliedtimeline events and closure withoutcome=rolled_back. - install smoke now validates both failure and success closure paths for
/hotfix closeto ensure follow-up metadata remains mandatory.
Task 26.1 health model contract notes:
- policy contract:
instructions/health_score_policy_contract.md - indicator model covers validation health, git/release hygiene, policy drift, automation reliability, and operational freshness.
- weighted scoring now defines deterministic penalties and status thresholds (
healthy,degraded,critical). - drift alert suppression now defines per-reason suppression keys, 24h default windows, and critical bypass behavior.
Task 26.2 health collector backend notes:
- backend module:
scripts/health_score_collector.py - collector now aggregates repo/runtime health signals across validation targets, git hygiene, policy drift, automation reliability, and freshness debt.
- scoring now applies weighted penalties with forced-status escalation rules from the Epic 26 contract.
- runtime persistence now writes latest and append-only history snapshots plus suppression-window state for repeated drift alerts.
Task 26.3 health command integration notes:
- command module:
scripts/health_command.py - command surface:
/health status|trend|drift|doctor - JSON export paths: trend and drift output are CLI-friendly JSON payloads for dashboards/CI ingestion.
- remediation guidance now includes score-bucket defaults (
healthy,degraded,critical) when indicator-specific actions are missing.
Examples:
/health status --force-refresh --json
/health trend --limit 10 --json
/health drift --json
/health doctor --json
Task 26.4 health verification notes:
- selftest now validates score determinism by repeating
/health status --force-refresh --jsonon unchanged repository signals. - selftest now validates drift precision by injecting budget profile drift and asserting
policy_drift_detectedattribution underruntime_policy_drift. - install smoke now validates drift force-refresh behavior under controlled profile drift in temporary config state.
Task 27.1 knowledge capture contract notes:
- policy contract:
instructions/knowledge_capture_policy_contract.md - entry taxonomy now defines
pattern,pitfall,checklist, andrule_candidatecapture types. - confidence scoring now uses deterministic factor weights (
evidence_quality,repeatability,scope_clarity,freshness) for publish eligibility. - approval quality gates now require evidence links, confidence thresholds, and reviewer metadata before publication.
Task 27.2 knowledge pipeline backend notes:
- backend module:
scripts/knowledge_capture_pipeline.py - extraction pipeline now collects merged-PR signals from git history and task digest signals from JSON digest artifacts.
- draft generation now groups signals by objective key (
E##-T##) and emits evidence-linked draft entries with deterministic confidence scoring. - lifecycle transitions now enforce review/publish/archive quality gates with explicit failure reason codes and approval metadata.
Task 27.3 learn command and integration notes:
- command module:
scripts/learn_command.py - command surface:
/learn capture|review|publish|search|doctorwith JSON-friendly outputs for automation. - publish/search outputs now include
rule_injector_candidatesandautoflow_guidanceso published patterns can be reused by rule workflows and/autoflowplanning docs. - maintenance workflow: use
/learn search --status published --jsonto inspect stale or low-confidence entries, then archive or refresh entries before they drive automation.
Examples:
/learn capture --limit 20 --json
/learn review --entry-id kc-e27-t2 --summary "reviewed guidance" --confidence 90 --risk medium --json
/learn publish --entry-id kc-e27-t2 --approved-by oncall --json
/learn search --query release --json
/learn doctor --json
Task 27.4 learn verification notes:
- selftest now validates extraction quality thresholds by asserting
/learn reviewrejects low-confidence drafts. - selftest now validates publish permissions by enforcing high-risk dual-approval gates before
/learn publishcan succeed. - install smoke now validates the same high-risk publish guardrail by expecting single-approval failure and second-approval success.
Task 28.1 autopilot contract notes:
- policy contract:
instructions/autopilot_command_contract.md - command surface now defines
/autopilot start|go|status|pause|resume|stop|reportwith JSON output requirements. - objective schema now supports dual completion modes:
completion-mode=promise(default, requires<promise>DONE</promise>) andcompletion-mode=objective(done-criteria gates). /autopilot startand/autopilot goinfer missing fields for context-first usage and default to promise-based continuous operation.- safety defaults now require dry-run preview before first stateful cycle and enforce budget/scope guardrails with explicit reason codes.
Task 28.2 autopilot loop backend notes:
- backend module:
scripts/autopilot_runtime.py - runtime now validates objective schema and materializes bounded execution cycles from
done-criteria. - cycle execution now applies budget guardrails per cycle and writes mandatory checkpoint snapshots for initialization and each cycle evaluation.
- loop payloads now emit deterministic progress counts, blocker reason codes, and next-action recommendations (including budget hard-stop guidance).
Task 28.3 autopilot control-integration notes:
- integration module:
scripts/autopilot_integration.py /autoflowbridge reuse now maps autopilot run states into deterministic autoflow transition evaluations.- control diagnostics now combine todo-enforcement, resume eligibility, and checkpoint-count signals for operator visibility.
- confidence-drop behavior now enforces explicit manual handoff mode (
reason_code=confidence_drop_requires_handoff) before autonomous progression resumes.
Task 28.4 autopilot command UX/workflow notes:
- command module:
scripts/autopilot_command.py - alias set in
opencode.json:/autopilot,/autopilot-go,/continue-work,/autopilot-status,/autopilot-report,/autopilot-pause,/autopilot-resume,/autopilot-stop,/autopilot-doctor - objective-mode alias is available as
/autopilot-objectivewhen you want completion from done-criteria gates instead of promise token. - canonical flow is
/autopilot*; Ralph compatibility aliases were removed to simplify command injection paths. - unified workflow controls now expose
start|go|status|pause|resume|stop|report|doctorwith deterministic JSON payloads and reason codes. - status/report/go payloads now include gateway bridge telemetry via
gateway_loop_stateandgateway_orphan_cleanup. - legacy
/start-work*slash commands are removed from active command surface to avoid redundant orchestration paths. - resume path now supports
--touched-paths <csv>to enforce objective scope boundaries before cycle execution.
Autopilot gateway telemetry fields (--json):
| Field | Type | Meaning |
|---|---|---|
gateway_runtime_mode |
string |
Active routing mode for autopilot controls: plugin_gateway when gateway plugin is enabled and hook-complete, otherwise python_command_bridge. |
gateway_runtime_reason_code |
string |
Routing decision reason (gateway_plugin_ready, gateway_plugin_disabled, gateway_plugin_runtime_unavailable, gateway_plugin_not_ready). |
gateway_plugin_enabled |
boolean |
Whether gateway-core file plugin is currently enabled in layered config. |
gateway_bun_available |
boolean |
Whether bun is currently available for host-side file plugin runtime support. |
gateway_missing_hook_capabilities |
string[] |
Missing required dist hook capabilities when plugin mode cannot be selected. |
gateway_loop_state |
`object | null` |
gateway_loop_state_reason_code |
string |
Loop state selection reason (loop_state_available, bridge_state_ignored_in_plugin_mode). |
gateway_orphan_cleanup.attempted |
boolean |
Always true when status snapshot runs cleanup check. |
gateway_orphan_cleanup.changed |
boolean |
true when stale/invalid active loop was deactivated and state file was updated. |
gateway_orphan_cleanup.reason |
string |
Cleanup outcome reason: state_missing, not_active, within_age_limit, invalid_started_at, or stale_loop_deactivated. |
gateway_orphan_cleanup.state_path |
`string | null` |
# Help/control subcommands (no execution loop)
/autopilot help
/autopilot status --json
# Execution runner (start-or-resume bounded cycles)
/autopilot-go --goal "continue active docs request" --max-cycles 10 --json
# Quick-fix objective (single-script scope)
/autopilot start --goal "patch failing smoke check" --scope "scripts/install.sh" --done-criteria "install-test passes" --max-budget conservative --json
/autopilot status --json
/autopilot report --json
# Context-first one-shot iteration (start-or-resume and run bounded cycles)
/autopilot go --goal "continue active docs request" --max-cycles 10 --json
/autopilot-go-verbose --goal "continue active docs request" --max-cycles 10 --json
/continue-work "finish cheatsheet updates and validations"
# Canonical command surface
/autopilot-go --goal "finish docs checklist end-to-end"
/autopilot-stop --reason "manual"
# Objective-gate completion mode (alternative to promise mode)
/autopilot-objective --goal "close all docs checklists" --scope "docs/**" --done-criteria "all docs updated;checks green" --max-budget balanced
# Feature objective (multi-step implementation)
/autopilot start --goal "ship command UX polish" --scope "scripts/*.py, README.md" --done-criteria "code complete;docs updated;validation green" --max-budget balanced --json
/autopilot pause --json
/autopilot resume --confidence 0.9 --tool-calls 1 --token-estimate 120 --json
# Release objective (high signal, high control)
/autopilot start --goal "prepare release candidate" --scope "CHANGELOG.md, README.md, scripts/**" --done-criteria "release checks pass;notes updated" --max-budget conservative --json
/autopilot stop --reason "manual release hold" --json
# Troubleshooting for paused/stopped runs
/autopilot doctor --json
/autopilot report --json- troubleshooting guide:
- quote multi-word flag values (
--goal,--scope,--done-criteria,--completion-promise) using"...". - unquoted multi-word values are parsed as extra positional tokens and may fall back to usage output.
/autopilot startinitializes a dry-run-backed objective state;/autopilot-goexecutes bounded cycles./autopilot-go --max-cycles <n>sets an upper bound, not a guaranteed count; runs may finish earlier when completion gates are met.- compact output is enabled by default for
/autopilot-go,/autopilot-objective, and/continue-work; use/autopilot-go-verbosefor full cycle payloads. - go-style aliases print a debug command line before JSON payloads for traceability.
/autopilotwithout a subcommand defaults to go-style execution with inferred fields.autopilot_runtime_missing: initialize objective with/autopilot start ....confidence_drop_requires_handoff: operator review required before calling/autopilot resume.budget_*: reduce scope or lower cycle load, then resume with conservative increments.scope_violation_detected: remove out-of-scope targets or tighten--touched-pathsto declared objective scope.autopilot_stop_requested: inspect/autopilot reportand start a fresh run when ready.
- quote multi-word flag values (
Task 28.5 autopilot verification notes:
- selftest now validates scope-bounded cycle execution (
scope_violation_detected) and budget hard-stop behavior for/autopilot resume. - selftest now validates pause/resume/stop transitions through repeated
/autopilot statuschecks after each lifecycle control action. - install smoke now exercises
/autopilotobjective lifecycle with both in-scope resume and explicit out-of-scope failure scenario (|| trueguard) before stop/doctor checks.
@mohak34/opencode-notifier@latest- desktop and sound alerts for completion, errors, and permission prompts.
github:kdcokenny/opencode-worktree- git worktree automation with terminal spawning for isolated agent sessions.github:JRedeker/opencode-morph-fast-apply- high-speed Morph Fast Apply edits for large or scattered code changes.
These two can fail to auto-resolve on some setups and are disabled by default. Enable them only when you want to test them.
instructions/shell_strategy.md- non-interactive shell strategy rules to avoid hangs and improve autonomous execution.instructions/release_train_policy_contract.md- release preflight, semver gating, reason-code, and rollback contract for upcoming/release-trainflows.instructions/hotfix_mode_policy_contract.md- incident hotfix activation, mandatory safety checks, reduced validation limits, and follow-up audit contract.instructions/health_score_policy_contract.md- repo health indicator model, weighted thresholds, and drift suppression-window contract.instructions/knowledge_capture_policy_contract.md- reusable-learning entry schema, confidence scoring, approval quality gates, and search metadata contract.instructions/autopilot_command_contract.md- objective runner command surface, lifecycle transitions, required fields, and dry-run-first safety contract.
These are not managed by opencode.json plugins, but they pair well with this setup.
- Repo:
nickjvandyke/opencode.nvim - Best for editor-native OpenCode workflows (selection-aware prompts, statusline, and provider controls)
Minimal lazy.nvim setup:
{
"nickjvandyke/opencode.nvim",
config = function()
vim.o.autoread = true
vim.keymap.set({ "n", "x" }, "<leader>oa", function()
require("opencode").ask("@this: ", { submit = true })
end, { desc = "Ask opencode" })
vim.keymap.set({ "n", "x" }, "<leader>os", function()
require("opencode").select()
end, { desc = "Select opencode action" })
end,
}Quick verify inside Neovim:
:checkhealth opencodeUse OpenCode-native setup and diagnostics:
/nvim status
/nvim help
/nvim install minimal --link-init
/nvim install power --link-init
/nvim doctor
/nvim doctor --json
/nvim uninstall --unlink-init
Autocomplete-friendly shortcuts:
/nvim-help
/nvim-status
/nvim-install-minimal
/nvim-install-power
/nvim-doctor-json
Profiles:
minimal: two keymaps (<leader>oa,<leader>os) for fast ask/select loops.power: adds draft ask and health shortcuts for heavier editor-driven workflows.
Installed integration file path:
~/.config/nvim/lua/my_opencode/opencode.lua
When --link-init is used, the command appends:
require("my_opencode.opencode")to~/.config/nvim/init.lua.
- Repo:
btriapitsyn/openchamber - Best for visual session management, remote/browser access, and mobile continuation
Install and run:
npm install -g @openchamber/web
openchamber --port 3000Useful commands:
openchamber status
openchamber serve --daemon --port 3111
openchamber stop --port 3111opencode.nvim: recommended when your main loop is Neovim and you want context-rich editor prompts.OpenChamber: recommended when you want a richer visual layer over OpenCode sessions and remote access.- Keep both optional; core repo behavior remains terminal-first and fully functional without them.
Recommended baseline stack:
direnvfor per-project environment auto-loading (.envrc).gh-dashfor terminal-native GitHub issue/PR/check workflow.ripgrep-all(rga) for broad content search beyond plain source files.pre-commit+lefthookfor fast local hooks aligned with CI checks.
Use these directly in OpenCode:
/devtools status
/devtools help
/devtools install all
/devtools doctor
/devtools doctor --json
/devtools hooks-install
Autocomplete-friendly shortcuts:
/devtools-help
/devtools-install
/devtools-doctor-json
First-time shell setup for direnv (zsh):
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrcProject setup for direnv:
cp .envrc.example .envrc
direnv allowNotes:
- This repo ships
lefthook.ymland.pre-commit-config.yaml. gh-dashis installed as a GitHub CLI extension (gh extension install dlvhdr/gh-dash).- For Node-only repositories, Husky is also a valid alternative to Lefthook.
Run this from anywhere:
curl -fsSL https://raw.githubusercontent.com/dmoliveira/my_opencode/main/install.sh | bashCI/non-interactive mode:
curl -fsSL https://raw.githubusercontent.com/dmoliveira/my_opencode/main/install.sh | bash -s -- --non-interactiveRun guided setup/reconfigure wizard:
curl -fsSL https://raw.githubusercontent.com/dmoliveira/my_opencode/main/install.sh | bash -s -- --wizardRun wizard on an existing install:
~/.config/opencode/my_opencode/install.sh --wizard --reconfigureThis will:
- clone or update this repo into
~/.config/opencode/my_opencode - link
~/.config/opencode/opencode.jsonto this repo config - enable
/mcpcommand backend automatically - run a post-install self-check (
/mcp status,/plugin status,/notify status,/digest show,/session list --json,/session doctor --json,/telemetry status,/post-session status,/policy status,/config status,/bg status,/refactor-lite profile --scope scripts/*.py --dry-run --json,/safe-edit status --json,/stack status,/browser status,/doctor run,/plugin doctor)
git clone https://github.com/dmoliveira/my_opencode.git ~/.config/opencode/my_opencode
ln -sfn ~/.config/opencode/my_opencode/opencode.json ~/.config/opencode/opencode.json
chmod +x ~/.config/opencode/my_opencode/install.sh ~/.config/opencode/my_opencode/scripts/mcp_command.py
chmod +x ~/.config/opencode/my_opencode/scripts/plugin_command.py
chmod +x ~/.config/opencode/my_opencode/scripts/notify_command.py ~/.config/opencode/my_opencode/scripts/session_digest.py ~/.config/opencode/my_opencode/scripts/session_command.py ~/.config/opencode/my_opencode/scripts/opencode_session.sh ~/.config/opencode/my_opencode/scripts/telemetry_command.py ~/.config/opencode/my_opencode/scripts/post_session_command.py ~/.config/opencode/my_opencode/scripts/policy_command.py ~/.config/opencode/my_opencode/scripts/doctor_command.py ~/.config/opencode/my_opencode/scripts/config_command.py ~/.config/opencode/my_opencode/scripts/stack_profile_command.py ~/.config/opencode/my_opencode/scripts/browser_command.py ~/.config/opencode/my_opencode/scripts/start_work_command.py ~/.config/opencode/my_opencode/scripts/install_wizard.py ~/.config/opencode/my_opencode/scripts/nvim_integration_command.py
chmod +x ~/.config/opencode/my_opencode/scripts/devtools_command.py
chmod +x ~/.config/opencode/my_opencode/scripts/background_task_manager.py
chmod +x ~/.config/opencode/my_opencode/scripts/todo_command.py ~/.config/opencode/my_opencode/scripts/resume_command.py ~/.config/opencode/my_opencode/scripts/safe_edit_command.pyThe wizard lets each user decide what they want now and reconfigure later.
- Select plugin profile (
lean,stable,experimental, or custom plugin-by-plugin). - Select MCP, policy, telemetry, and post-session defaults.
- Select browser automation provider (
playwrightrecommended stable-first,agent-browseroptional). - Optionally install/uninstall ecosystem integrations (
opencode.nvim,OpenChamber). - When
opencode.nvimis selected, wizard bootstraps a minimal integration profile at~/.config/nvim/lua/my_opencode/opencode.lua. - Stable-first recommendation: keep
playwrightunless you specifically rely onagent-browserworkflows. - Re-run any time to change choices:
~/.config/opencode/my_opencode/install.sh --wizard --reconfigure. - Wizard state is stored in
~/.config/opencode/my_opencode-install-state.json.
Use these directly in OpenCode:
/stack status
/stack help
/stack apply focus
/stack apply research
/stack apply quiet-ci
Autocomplete-friendly shortcuts:
/stack-help
/stack-focus
/stack-research
/stack-quiet-ci
Profiles:
focus: notify focus, telemetry off, post-session disabled, policy strictresearch: notify all, telemetry local, post-session enabled withmake selftest, policy balancedquiet-ci: notify quiet + no complete event, telemetry off, post-session manualmake validate, policy strict
Use these directly in OpenCode:
/config status
/config layers
/config layers --json
/config backup
/config backup --name pre-upgrade
/config list
/config restore <backup-id>
Autocomplete-friendly shortcuts:
/config-help
/config-backup
/config-list
/config-layers
/config-layers-json
/config snapshots all opencode*.json files under ~/.config/opencode/ into ~/.config/opencode/my_opencode-backups/.
/config layers shows effective layered config precedence and selected write path.
/mcp, /plugin, /notify, /telemetry, /post-session, /policy, and /stack now resolve configuration with stable layered precedence:
OPENCODE_CONFIG_PATH(runtime override, highest priority).opencode/my_opencode.jsonc(project override).opencode/my_opencode.json~/.config/opencode/my_opencode.jsonc(user override)~/.config/opencode/my_opencode.json~/.config/opencode/opencode.jsonc(legacy user override)~/.config/opencode/opencode.json(legacy user override)- bundled
opencode.jsonfrom this repo (base)
Notes:
- Merge behavior is deep for objects and replace-on-write for arrays.
- JSONC files support comments and trailing commas.
- Writes target the highest-precedence existing config path (or
~/.config/opencode/opencode.jsonwhen no override exists). - Legacy per-command files remain supported for compatibility and env-var override use.
Use these directly in OpenCode:
/doctor run
/doctor run --json
/doctor help
Autocomplete-friendly shortcuts:
/doctor-json
/doctor-help
/doctor runs diagnostics across mcp, plugin, notify, digest, telemetry, post-session, policy, bg, and optional refactor-lite checks in one pass.
Use these directly in OpenCode:
/refactor-lite <target>
/refactor-lite <target> --scope scripts/*.py --dry-run --json
/refactor-lite <target> --scope scripts/*.py --run-selftest --json
Autocomplete-friendly shortcuts:
/refactor-lite-help
/refactor-lite-dry-run <target> --scope scripts/*.py
/refactor-lite backend behavior:
- runs deterministic preflight analysis (target search + file map)
- defaults to
--strategy safeguardrails - executes verification hooks on non-dry runs (
make validate, optionalmake selftest)
Strategies:
safe(default): blocks ambiguous broad targets unless scope is narrowed.balanced: broader analysis with the same verification expectations.aggressive: explicit opt-in for broad target analysis when ambiguity is acceptable.
Recommended flow:
- Start with
--dry-run --jsonand inspectpreflight.file_map. - Narrow with
--scopeuntil safe mode is deterministic. - Run without
--dry-runto enforce verification hooks.
Epic 4 starts with a minimal hook framework in scripts/hook_framework.py.
- Supported events:
PreToolUse,PostToolUse,Stop - Config section:
hooks.enabled,hooks.disabled,hooks.order - Deterministic ordering for each event:
- explicit
hooks.order - numeric
priority(ascending) - hook id (lexicographic)
- explicit
This baseline intentionally ships without default active hooks. Epic 4.2 adds concrete hook implementations.
Use these directly in OpenCode:
/hooks status
/hooks enable
/hooks disable
/hooks disable-hook truncate-safety
/hooks enable-hook truncate-safety
/hooks doctor
/hooks doctor --json
/hooks run continuation-reminder --json '{"checklist":["update docs","run tests"]}'
/hooks run truncate-safety --json '{"text":"...large output...","max_lines":120,"max_chars":8000}'
/hooks run error-hints --json '{"command":"git status","exit_code":128,"stderr":"fatal: not a git repository"}'
Autocomplete-friendly shortcut:
/hooks-help
/hooks-enable
/hooks-disable
/hooks-status
/hooks-doctor
/hooks-doctor-json
Hook behavior:
continuation-remindertriggers when checklist items remain unfinished.truncate-safetyclips oversized output and returns warnings with limits used.error-hintsmaps common failures (missing command/path, permission, git context, timeout) to actionable hints.
Governance controls:
- global toggle in config:
hooks.enabled - per-hook opt-out list:
hooks.disabled - telemetry-safe audit log:
~/.config/opencode/hooks/actions.jsonl - audit log records only metadata (hook id, category, triggered, exit status), not raw command output
Epic 5 starts with a schema contract in scripts/model_routing_schema.py and docs in
instructions/model_routing_schema.md.
Baseline categories:
quickdeepvisualwriting
Each category includes model, temperature, reasoning, verbosity, and description.
Fallback behavior is deterministic:
- unknown category ->
default_category - unavailable model ->
default_category
Fallback explanation contract (Epic 12 Task 12.1):
instructions/model_fallback_explanation_model.md- trace stages:
requested -> attempted -> selected - output levels:
compactandverbose - redaction policy for sensitive provider details
Resolution precedence (Task 5.2):
system_defaults- selected category defaults
- explicit user overrides
- model availability fallback (category -> system default)
Use:
/model-routing status
/model-routing set-category deep
/model-routing resolve --category deep --override-model openai/gpt-5.3-codex --json
/model-routing trace --json
/model-routing resolve now emits a structured fallback trace (requested -> attempted -> selected) and persists the latest trace for /model-routing trace debug introspection.
Routing command surface (Epic 12 Task 12.3):
/routing status
/routing explain --category deep --available-models openai/gpt-5-mini --json
Troubleshooting unexpected model selection:
- run
/routing explain --jsonand inspectfallback_reason - confirm
attempted_countis non-zero and reviewresolution_trace.attempted - verify available model set passed to resolve commands matches runtime availability
Model-profile aliases:
/model-profile status
/model-profile set visual
/model-profile resolve --category writing
Practical routing examples:
- Fast repo hygiene (
git status, light checks):quick - Architecture/debug planning and complex refactors:
deep - UI polish and design-heavy implementation notes:
visual - Changelogs, release notes, and long-form docs:
writing
Integration points:
/stack apply <profile>now sets a routing category (focus/research -> deep,quiet-ci -> quick).- install wizard supports
--model-profile <quick|deep|visual|writing>.
Use:
/browser status
/browser profile playwright
/browser profile agent-browser
/browser doctor --json
Provider trade-offs:
playwright: stable-first default and broad compatibility.agent-browser: optional path when your workflow depends on agent-browser tooling.
Recommended defaults:
- start with
playwright - switch to
agent-browseronly when you need those capabilities - run
/browser doctor --jsonafter changes to confirm dependency readiness
Wizard support:
install_wizard.pysupports--browser-profile <playwright|agent-browser>- interactive wizard includes the same provider choice during fresh setup and reconfigure
Epic 8 Task 8.2 adds a deterministic keyword detector engine:
- schema + precedence rules:
scripts/keyword_mode_schema.py - command wrapper:
scripts/keyword_mode_command.py - dictionary contract:
instructions/keyword_execution_modes.md
Use:
/keyword-mode status
/keyword-mode detect --prompt "safe-apply deep-analyze review this migration" --json
/keyword-mode apply --prompt "parallel-research deep-analyze inspect API usage" --json
/keyword-mode disable-keyword ulw
/keyword-mode enable-keyword ulw
/keyword-mode disable
/keyword-mode enable
/keyword-mode doctor --json
Detector behavior:
- case-insensitive keyword token matching (
ulw,deep-analyze,parallel-research,safe-apply) - deterministic precedence for conflicts (
safe-apply>deep-analyze>parallel-research>ulw) - prompt-level opt-out support (
no-keyword-modeandno-<keyword>tokens) - persisted runtime context via
keyword_modesconfig section (active_modes,effective_flags)
Examples:
- basic:
/keyword-mode apply --prompt "safe-apply review this migration" --json - intermediate:
/keyword-mode disable-keyword ulwthen/keyword-mode detect --prompt "ulw deep-analyze audit" --json - override path:
/keyword-mode detect --prompt "no-keyword-mode safe-apply deep-analyze" --json
Anti-patterns:
- avoid mixing contradictory intent keywords casually (
ulw+deep-analyze) unless you expect precedence conflict resolution. - avoid relying on partial words (
deeporsafe) because matching is exact-token only. - avoid forgetting local opt-outs in copied prompts;
no-keyword-modeintentionally disables all activation for that request.
Epic 10 introduces an intent-mapping detector for common command families:
- schema + scoring engine:
scripts/auto_slash_schema.py - command wrapper:
scripts/auto_slash_command.py - contract guide:
instructions/auto_slash_detector.md
Use:
/auto-slash status --json
/auto-slash preview --prompt "run doctor diagnostics" --json
/auto-slash execute --prompt "run doctor diagnostics" --json
/auto-slash execute --prompt "run doctor diagnostics" --force --json
/auto-slash disable-command devtools
/auto-slash audit --limit 10 --json
/auto-slash doctor --json
Detector behavior:
- maps natural-language prompts to
/doctor,/stack,/nvim, or/devtools - enforces confidence + ambiguity thresholds before selecting a command
- defaults to preview-first execution (
executerequires--force) - keeps per-command enable/disable controls in layered config
- appends forced execution events to runtime audit log for traceability
Examples:
- basic:
/auto-slash preview --prompt "please run doctor diagnostics" --json - intermediate:
/auto-slash preview --prompt "switch to focus mode" --json - safety path:
/auto-slash execute --prompt "run doctor diagnostics" --jsonthen rerun with--force
Limitations:
- intentionally limited command set to reduce misfire risk
- does not auto-dispatch when prompts already include explicit slash commands
- low-confidence or ambiguous prompts return explicit no-op reasons
Epic 9 introduces a rules engine for conditional instruction injection:
- schema contract:
instructions/conditional_rules_schema.md - team pack examples:
instructions/rules_team_pack_examples.md - engine implementation:
scripts/rules_engine.py - command wrapper:
scripts/rules_command.py
Use:
/rules status
/rules explain scripts/selftest.py --json
/rules disable-id style-python
/rules enable-id style-python
/rules doctor --json
Rules are discovered from:
- user scope:
~/.config/opencode/rules/**/*.md - project scope:
.opencode/rules/**/*.md
Precedence is deterministic: priority desc, then scope (project before user), then lexical rule id.
Recommended workflow:
- create project rules under
.opencode/rules/ - run
/rules statusafter edits to validate discovery - use
/rules explain <path> --jsonto verify effective rule stack before relying on behavior
Epic 14 Task 14.1 defines the baseline plan format and execution-state rules for the upcoming /start-work <plan> command:
- contract spec:
instructions/plan_artifact_contract.md - validation/workflow guide:
instructions/plan_execution_workflows.md - backend command:
scripts/start_work_command.py - format scope: markdown checklist + YAML metadata frontmatter
- validation scope: deterministic preflight failures with line-level remediation hints
- state model scope:
pending/in_progress/done/skippedwith strict transition semantics
Use:
/start-work path/to/plan.md --json
/start-work-bg path/to/plan.md
/bg run --id <job-id>
/start-work status --json
/start-work deviations --json
/start-work-doctor-json
Integration notes:
- use
/start-work-bgwhen you want queued, reviewable execution via the background subsystem before running/bg run /digest runnow includes aplan_executionrecap block (status, plan id, step counts, deviation count)/doctor runincludesstart-workhealth diagnostics for execution-state visibility
Epic 15 Task 15.1 defines the baseline compliance contract for enforced todo execution:
- compliance spec:
instructions/todo_compliance_model.md - required states:
pending,in_progress,done,skipped - enforcement: one active item at a time with deterministic transition validation
- bypass path: explicit metadata + audit event requirements for controlled exceptions
Epic 15 Task 15.2 implements the enforcement backend:
- engine module:
scripts/todo_enforcement.py /start-worknow validates todo transitions before state mutation and blocks completion when required items remain unchecked- compliance violations now emit deterministic remediation prompts and persisted audit events
Use:
/todo status --json
/todo enforce --json
Compliant workflow pattern:
- run
/start-work path/to/plan.md --json - inspect
/todo status --jsonfor current state counts - gate handoff/closure with
/todo enforce --json
Epic 17 Task 17.1 defines the baseline policy contract for safe auto-resume behavior:
- policy spec:
instructions/resume_policy_model.md - interruption classes:
tool_failure,timeout,context_reset,process_crash - eligibility gate: checkpoint availability + idempotency + artifact readiness + attempt budget
- safety controls: class-specific cool-down windows and escalation after max attempts
Epic 17 Task 17.2 implements the recovery backend:
- engine module:
scripts/recovery_engine.py - backend path:
/start-work recover --interruption-class <tool_failure|timeout|context_reset|process_crash> --json - approval gate: non-idempotent pending steps require explicit
--approve-step <ordinal> - audit trail: persisted
resume_decisionandresume_transitionevents under runtimeresume.trail
Epic 17 Task 17.3 adds operator-facing resume controls:
- command module:
scripts/resume_command.py - status surface:
/resume status --jsonwith explicitreason_code+ human-readablereason - execution control:
/resume now --interruption-class <class> --json - safety toggle:
/resume disable --jsonto block resume attempts until re-enabled in runtime state - actionable guidance:
resume_hints.next_actionsdescribes the next safe recovery command for the current reason code
Use:
/resume status --json
/resume now --interruption-class tool_failure --json
/resume now --interruption-class tool_failure --approve-step 2 --json
/resume disable --json
Recovery playbooks:
resume_blocked_cooldown: wait for cooldown and rerun/resume status --jsonuntil eligible.resume_non_idempotent_step: explicitly approve only the needed step with--approve-step <ordinal>.resume_attempt_limit_reached: escalate to manual review and restart from/start-work <plan.md>after inspection.resume_disabled: keep disabled during high-risk runs; re-enable by updating runtimeplan_execution.resume.enabledtotrue.
Digest integration:
plan_execution.resume_hintsincludes the latest resume eligibility state, reason code, and suggested next actions.- use
/digest showafter interrupted runs to get lightweight recovery cues without loading full runtime state.
Verification notes:
- selftest now covers all interruption classes (
tool_failure,timeout,context_reset,process_crash) plus cooldown and disable safeguards. - install smoke includes interrupted-flow replay with expected non-idempotent block and explicit approval retry.
Epic 11 Task 11.1 defines the baseline policy schema for context-window resilience:
- schema contract:
instructions/context_resilience_policy_schema.md - tuning guide:
instructions/context_resilience_tuning.md - pruning engine:
scripts/context_resilience.py - command diagnostics:
scripts/context_resilience_command.py
Initial schema covers:
- truncation modes (
default,aggressive) - protected tools/messages to preserve critical evidence
- pruning/recovery notification levels (
quiet,normal,verbose)
Engine behavior currently includes:
- duplicate message pruning for repeated non-protected context entries
- superseded write pruning (older writes to same target path)
- stale error purging once newer successful command outcomes exist beyond threshold
- preservation of protected artifacts and latest command outcomes as critical evidence
- recovery planning with automatic resume hints, safe fallback steps, and pruning diagnostics
Use:
/resilience status --json
/resilience doctor --json
Use these directly in OpenCode:
/bg start -- python3 scripts/selftest.py
/bg status
/bg status <job-id>
/bg list
/bg list --status running
/bg read <job-id>
/bg cancel <job-id>
/bg cleanup
/bg doctor --json
/bg status --json
Autocomplete-friendly shortcuts:
/bg-help
/bg-list
/bg-running
/bg-doctor-json
/bg-status-json
/bg uses ~/.config/opencode/my_opencode/bg/ by default with:
jobs.jsonas authoritative stateruns/<job-id>.logfor combined stdout/stderrruns/<job-id>.meta.jsonfor execution metadata
Examples:
- Basic async start + read:
/bg start -- make validatethen/bg list --status runningand/bg read <job-id> - Intermediate queue workflow:
/bg enqueue -- make selftest,/bg enqueue -- make install-test, then/bg run --max-jobs 1 - Failure/recovery:
/bg start -- python3 -c "import time; time.sleep(5)" --timeout-seconds 1, inspect with/bg doctor --json, then/bg cleanup
Notification behavior:
- Background terminal states emit optional alerts through the existing notify stack (
notifyconfig event/channel rules). - Set
MY_OPENCODE_BG_NOTIFICATIONS_ENABLED=0to suppress background notifications without changing global notify settings.
Use these directly in OpenCode:
/mcp status
/mcp help
/mcp doctor
/mcp doctor --json
/mcp profile minimal
/mcp profile research
/mcp profile context7
/mcp profile ghgrep
/mcp enable context7
/mcp disable context7
/mcp enable gh_grep
/mcp disable gh_grep
/mcp enable all
/mcp disable all
MCP autocomplete-friendly shortcuts:
/mcp-help
/mcp-doctor
/mcp-doctor-json
/mcp-profile-minimal
/mcp-profile-research
/mcp-profile-context7
/mcp-profile-ghgrep
Use these directly in OpenCode:
/plugin status
/plugin help
/plugin doctor
/plugin doctor --json
/setup-keys
/plugin profile lean
/plugin profile stable
/plugin profile experimental
/plugin enable notifier
/plugin disable notifier
/plugin enable all
/plugin disable all
Autocomplete-friendly shortcuts:
/plugin-help
/plugin-enable-notifier
/plugin-enable-morph
/plugin-enable-worktree
/plugin-profile-lean
/plugin-profile-stable
/plugin-profile-experimental
/plugin-doctor-json
Global command helper shortcuts:
/complete
/complete auto
/complete autopilot
/ac resume
/complete-families
/complete-doctor
/complete <prefix> returns ranked slash command suggestions with descriptions.
/ac is a short alias for /complete.
Supported plugin names: notifier, morph, worktree.
all applies only to the stable set: notifier.
Migration note: supermemory and wakatime were removed from this repo. If either still exists in a layered config override, remove those plugin entries manually or run /plugin profile lean.
/plugin doctor checks the current plugin setup and reports missing prerequisites before you enable additional plugins.
/plugin doctor --json (or /plugin-doctor-json) prints machine-readable diagnostics for automation.
/setup-keys prints exact environment/file snippets for missing API keys.
Profiles:
lean->notifierstable->notifierexperimental->stable+morph,worktree
For Morph Fast Apply, set MORPH_API_KEY in your shell before enabling morph.
Use these directly in OpenCode:
/notify status
/notify help
/notify doctor
/notify doctor --json
/notify profile all
/notify profile quiet
/notify profile focus
/notify profile sound-only
/notify profile visual-only
/notify enable all
/notify disable all
/notify enable sound
/notify disable visual
/notify disable complete
/notify enable permission
/notify channel question sound off
/notify channel error visual on
Autocomplete-friendly shortcuts:
/notify-help
/notify-doctor
/notify-doctor-json
/notify-profile-all
/notify-profile-focus
/notify-sound-only
/notify-visual-only
/notify writes preferences into layered config under notify (or OPENCODE_NOTIFICATIONS_PATH when explicitly set):
- global:
enabled - channel:
sound.enabled,visual.enabled - event:
events.<type> - per-event channel:
channels.<type>.sound|visual
Use these directly in OpenCode:
/digest run --reason manual
/digest run --reason manual --run-post
/digest show
/digest doctor
/digest doctor --json
Autocomplete-friendly shortcuts:
/digest-run
/digest-run-post
/digest-show
/digest-doctor
/digest-doctor-json
The digest command writes to ~/.config/opencode/digests/last-session.json by default.
For automatic digest-on-exit behavior (including Ctrl+C), launch OpenCode through:
~/.config/opencode/my_opencode/scripts/opencode_session.shOptional environment variables:
MY_OPENCODE_DIGEST_PATHcustom output pathMY_OPENCODE_DIGEST_HOOKcommand to run after digest is writtenDIGEST_REASON_ON_EXITcustom reason label (defaultexit)
When --run-post is used, digest also evaluates post_session config and stores hook results in the digest JSON.
Use these directly in OpenCode:
/post-session status
/post-session enable
/post-session disable
/post-session set command make test
/post-session set timeout 120000
/post-session set run-on exit,manual
Autocomplete-friendly shortcuts:
/post-session-help
/post-session-enable
/post-session writes to layered config under post_session (or MY_OPENCODE_SESSION_CONFIG_PATH when explicitly set):
post_session.enabledpost_session.commandpost_session.timeout_mspost_session.run_on(exit,manual,idle)
Typical flow:
- Configure command with
/post-session set command <your-test-or-lint-command> - Enable with
/post-session enable - Use wrapper
opencode_session.shso command runs automatically on exit/Ctrl+C - Optionally run now with
/digest run --reason manual --run-post
Use these directly in OpenCode:
/policy status
/policy help
/policy profile strict
/policy profile balanced
/policy profile fast
Autocomplete-friendly shortcuts:
/policy-help
/policy-profile-strict
/policy-profile-balanced
/policy-profile-fast
/policy writes profile metadata to layered config under policy and applies notification posture under notify (legacy path env overrides remain supported).
Profiles:
strict: visual alerts for high-risk events, minimal noisebalanced: visual for all events, sound on risk-heavy eventsfast: all channels and events enabled for immediate feedback
Use these directly in OpenCode:
/quality status
/quality profile fast
/quality profile strict
/quality profile off
/quality doctor
Autocomplete-friendly shortcuts:
/quality-status
/quality-profile-fast
/quality-profile-strict
/quality-profile-off
/quality-doctor
/quality writes profile metadata to layered config under quality with toggles for TS lint/typecheck/tests and Python selftest.
Profiles:
off: disable quality checks for local rapid iterationfast: lint+typecheck+selftest, skip heavier test passesstrict: run full quality gates (including TS tests)
Use these directly in OpenCode:
/gateway status
/gateway enable
/gateway disable
/gateway doctor
Shortcuts:
/gateway-status
/gateway-enable
/gateway-disable
/gateway-doctor
Notes:
/gateway enableadds local file plugin entry forgateway-coreinto your config plugin list./gateway enablenow runs a safety preflight (bun + dist + required hook capabilities) and auto-reverts to disabled when preflight fails.- use
/gateway enable --forceonly if you intentionally want to bypass the preflight safeguard. install.shnow auto-prefersplugin_gatewaymode whenbunis available, and falls back topython_command_bridgewhen not available./gateway statusand/gateway doctorrun orphan cleanup before reporting runtime loop state./gateway doctor --jsonnow includeshook_diagnostics, plugin entry dedupe telemetry, and process/runtime pressure diagnostics; it still fails when gateway is enabled without a valid built hook surface.- set
MY_OPENCODE_GATEWAY_EVENT_AUDIT=1to write hook dispatch diagnostics to.opencode/gateway-events.jsonl(override path withMY_OPENCODE_GATEWAY_EVENT_AUDIT_PATH). - trigger-only context warnings now include a Nerd Font marker (
σ°© Context Guard:) so pressure events stand out without adding steady-state noise. - context guard markers now support dual fallback mode (
σ°© Context Guard [Context Guard]:) and configurable verbosity (minimal,normal,debug) in gateway hook config. - context and compaction safeguards now apply across providers (not Anthropic-only), using a configurable default context limit for non-Anthropic providers.
- global multi-session pressure warnings now trigger via
global-process-pressurewhen concurrent--continuesessions/process counts or RSS exceed thresholds. - critical global RSS pressure (
>= 10GBby default) now emits a critical guard event and auto-pauses continuation for the current session. - critical response now supports a configurable escalation ladder (window + pause/escalation event thresholds) before stronger repeated-critical messaging.
- critical events can trigger local desktop notifications (best effort on macOS/Linux), with audit reason codes for sent/failed notification attempts.
/gateway status --jsonnow reportsguard_event_countersincluding session-correlated pressure observations (session_pressure_attribution, non-causal) and critical trigger timestamps./gateway doctor --jsonnow exposesremediation_commandswhen critical pressure signals are detected./gateway tune memory --jsonnow suggests a balanced memory profile based on current pressure/counter telemetry.pressure-escalation-guardnow blocks non-essential reviewer/verifier/explore/librarian/general task escalations while high continuation pressure is active (override via blocker/critical prompt patterns).- gateway event audit now supports bounded rotation via
MY_OPENCODE_GATEWAY_EVENT_AUDIT_MAX_BYTESandMY_OPENCODE_GATEWAY_EVENT_AUDIT_MAX_BACKUPS. - see
docs/memory-incident-playbook.mdfor a fast detect/stabilize/recover/verify incident flow.
Gateway event audit baseline (recommended before memory tuning):
MY_OPENCODE_GATEWAY_EVENT_AUDIT=1 /gateway status --json
MY_OPENCODE_GATEWAY_EVENT_AUDIT=1 /gateway doctor --json- Keep a normal 20-30 minute coding session and compare
process_pressureplusruntime_stalenessfrom/gateway status --jsonbefore/after. - Review
.opencode/gateway-events.jsonlfor recurringcontext-window-monitorandpreemptive-compactionevents to confirm cadence is controlled but recurring.
Gateway orphan cleanup report fields (--json):
| Field | Type | Meaning |
|---|---|---|
orphan_cleanup.attempted |
boolean |
true when cleanup check was evaluated. |
orphan_cleanup.changed |
boolean |
true when active orphan loop was deactivated. |
orphan_cleanup.reason |
string |
Cleanup result reason (state_missing, not_active, within_age_limit, invalid_started_at, stale_loop_deactivated). |
orphan_cleanup.state_path |
`string | null` |
Gateway hook diagnostics fields (--json):
| Field | Type | Meaning |
|---|---|---|
hook_diagnostics.source_hooks_exist |
boolean |
Source hook modules exist for autopilot-loop, continuation, and safety. |
hook_diagnostics.dist_hooks_exist |
boolean |
Built dist hook modules exist for autopilot-loop, continuation, and safety. |
hook_diagnostics.dist_exposes_tool_execute_before |
boolean |
Built plugin exports slash-command interception handler. |
hook_diagnostics.dist_exposes_chat_message |
boolean |
Built plugin exports chat-message lifecycle handler. |
hook_diagnostics.dist_continuation_handles_session_idle |
boolean |
Continuation hook handles idle-cycle progression logic. |
Use these directly in OpenCode:
/telemetry status
/telemetry help
/telemetry doctor
/telemetry doctor --json
/telemetry profile off
/telemetry profile local
/telemetry profile errors-only
/telemetry set endpoint http://localhost:3000/opencode/events
/telemetry set timeout 1500
/telemetry enable error
/telemetry disable question
Autocomplete-friendly shortcuts:
/telemetry-help
/telemetry-doctor
/telemetry-doctor-json
/telemetry-profile-off
/telemetry-profile-local
/telemetry writes to layered config under telemetry (or OPENCODE_TELEMETRY_PATH when explicitly set) and supports:
- global on/off (
enabled) - endpoint URL (
endpoint) - timeout (
timeout_ms) - per-event toggles (
events.complete|error|permission|question)
For your LangGraph setup, default endpoint target is http://localhost:3000/opencode/events.
opencode.json- global OpenCode config (linked to default path)scripts/mcp_command.py- backend script for/mcpscripts/plugin_command.py- backend script for/pluginscripts/notify_command.py- backend script for/notifyscripts/session_digest.py- backend script for/digestscripts/session_command.py- backend script for/sessionscripts/opencode_session.sh- optional wrapper to run digest on process exitscripts/telemetry_command.py- backend script for/telemetryscripts/post_session_command.py- backend script for/post-sessionscripts/policy_command.py- backend script for/policyscripts/doctor_command.py- backend script for/doctorscripts/config_command.py- backend script for/configscripts/stack_profile_command.py- backend script for/stackscripts/browser_command.py- backend script for/browserscripts/start_work_command.py- backend script for/start-workscripts/autoflow_adapter.py- orchestration adapter for/autoflowtransition and explain planningscripts/autoflow_command.py- unified/autoflowcommand surface with dry-run and kill-switch controlsscripts/budget_command.py- backend script for/budgetscripts/release_train_engine.py- release-train backend engine for preflight, draft, and publish gatingscripts/release_train_command.py-/release-traincommand surface and doctor/checklist integrationscripts/hotfix_runtime.py- incident hotfix runtime profile with checkpoint and timeline capturescripts/todo_command.py- backend script for/todoscripts/resume_command.py- backend script for/resumescripts/safe_edit_adapters.py- semantic safe-edit adapter and validation helpersscripts/safe_edit_command.py-/safe-editcommand surface for semantic adapter planning and diagnosticsscripts/todo_enforcement.py- shared todo compliance enforcement helpersscripts/install_wizard.py- interactive install/reconfigure wizardscripts/nvim_integration_command.py- backend script for/nvimscripts/devtools_command.py- backend script for/devtoolsscripts/config_layering.py- shared layered config + JSONC loader for command scriptsinstall.sh- one-step installer/updaterMakefile- common maintenance commands (make help).pre-commit-config.yaml- pre-commit hook definitionslefthook.yml- fast git hook runner config.envrc.example- direnv template for local environment variables.github/workflows/ci.yml- CI checks and installer smoke test
make help
make validate
make selftest
make doctor
make doctor-json
make devtools-status
make hooks-install
make install-test
make release-check
make release VERSION=0.1.1Tip: for local branch testing, installer accepts REPO_REF.
Happy shipping! π