oc-harness-setup 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/unwired-routing.md +14 -9
- package/.gitignore +14 -1
- package/AGENTS.md +70 -106
- package/README.md +55 -24
- package/agents/build.md +10 -12
- package/agents/explore.md +14 -8
- package/agents/general.md +7 -9
- package/agents/orchestrator.md +38 -0
- package/agents/plan.md +10 -13
- package/agents/reviewer.md +9 -14
- package/agents/vault.md +44 -35
- package/bin/cli.js +32 -3
- package/commands/build.md +2 -8
- package/commands/checkpoint.md +3 -1
- package/commands/code-simplify.md +3 -9
- package/commands/gauntlet.md +7 -0
- package/commands/handoff.md +3 -1
- package/commands/keeper.md +3 -3
- package/commands/kill.md +11 -0
- package/commands/plan.md +2 -13
- package/commands/retro.md +15 -0
- package/commands/review.md +1 -1
- package/commands/ship.md +3 -27
- package/commands/spec.md +3 -11
- package/commands/test.md +2 -9
- package/commands/webperf.md +7 -0
- package/opencode.jsonc +23 -8
- package/package.json +5 -4
- package/reference/README.md +14 -14
- package/reference/auto-mandate.md +11 -0
- package/reference/backup-convention.md +9 -0
- package/reference/clean-mandate.md +13 -0
- package/reference/editor-parity.md +7 -0
- package/reference/gc-scripts.md +8 -0
- package/reference/intent-routing.md +14 -0
- package/reference/lifecycle.md +15 -0
- package/reference/model-keeper.md +30 -10
- package/reference/model-test.md +11 -6
- package/reference/models.md +25 -14
- package/reference/oc-source-map.md +162 -0
- package/reference/owner-pin.md +31 -0
- package/reference/roster.md +15 -0
- package/reference/session-scope.md +9 -0
- package/reference/session-state.md +13 -0
- package/reference/swarm.md +32 -0
- package/scripts/backup-config.ps1 +42 -0
- package/scripts/gc-branch.ps1 +196 -0
- package/scripts/gc-bump.ps1 +198 -0
- package/scripts/gc-clean.ps1 +648 -0
- package/scripts/gc-commit.ps1 +143 -0
- package/scripts/gc-merge.ps1 +272 -0
- package/scripts/gc-pr.ps1 +190 -0
- package/scripts/gc-push.ps1 +111 -0
- package/scripts/gc-read.ps1 +150 -0
- package/scripts/gc-rebase.ps1 +162 -0
- package/scripts/gc-release.ps1 +225 -0
- package/scripts/gc-stage.ps1 +103 -0
- package/scripts/gc-status.ps1 +127 -0
- package/scripts/gc-sync.ps1 +65 -0
- package/scripts/gc.core.ps1 +715 -0
- package/scripts/gc.smoke.ps1 +779 -0
- package/scripts/harness-doctor.ps1 +11 -9
- package/scripts/interrupt-session.ps1 +65 -0
- package/scripts/logbook/README.md +108 -0
- package/scripts/logbook/logbook.test.ts +440 -0
- package/scripts/logbook/logbook.ts +797 -0
- package/scripts/pirep/README.md +147 -0
- package/scripts/pirep/pirep.test.ts +735 -0
- package/scripts/pirep/pirep.ts +836 -0
- package/scripts/testflight/README.md +112 -0
- package/scripts/testflight/testflight.test.ts +512 -0
- package/scripts/testflight/testflight.ts +806 -0
- package/skills/_shared/SOURCES.md +7 -7
- package/skills/_shared/references/definition-of-done.md +2 -2
- package/skills/_shared/references/orchestration-patterns.md +1 -2
- package/skills/_shared/references/security-checklist.md +2 -2
- package/skills/api-and-interface-design/SKILL.md +7 -360
- package/skills/browser-testing-with-devtools/SKILL.md +303 -0
- package/skills/code-simplification/SKILL.md +7 -364
- package/skills/creative-writing/SKILL.md +1 -1
- package/skills/debugging-and-error-recovery/SKILL.md +8 -309
- package/skills/flight-deck/SKILL.md +17 -0
- package/skills/frontend-ui-engineering/SKILL.md +8 -320
- package/skills/gauntlet/SKILL.md +21 -0
- package/skills/git-ceremony/SKILL.md +16 -318
- package/skills/grilling/SKILL.md +10 -30
- package/skills/observability-and-instrumentation/SKILL.md +9 -229
- package/skills/performance-optimization/SKILL.md +8 -488
- package/skills/pilot-report/SKILL.md +18 -0
- package/skills/planning-and-task-breakdown/SKILL.md +8 -249
- package/skills/security-and-hardening/SKILL.md +9 -490
- package/skills/source-driven-development/SKILL.md +8 -208
- package/skills/spec-driven-development/SKILL.md +15 -234
- package/skills/test-driven-development/SKILL.md +8 -388
- package/skills/test-flight/SKILL.md +14 -0
- package/skills/writing-for-agents/SKILL-MECHANICS.md +3 -3
- package/skills/writing-for-agents/SKILL.md +7 -1
- package/agents/coder.md +0 -19
- package/agents/documenter.md +0 -28
- package/agents/keeper.md +0 -22
- package/agents/master.md +0 -70
- package/agents/researcher.md +0 -21
- package/agents/security-auditor.md +0 -20
- package/agents/test-engineer.md +0 -20
- package/agents/web-performance-auditor.md +0 -19
- package/commands/council.md +0 -24
- package/commands/doctor.md +0 -19
- package/commands/ponytail-audit.md +0 -7
- package/commands/ponytail-debt.md +0 -14
- package/commands/report.md +0 -13
- package/scripts/harness-report.ps1 +0 -695
- package/scripts/panic/panic.ts +0 -240
- package/skills/code-review-and-quality/SKILL.md +0 -396
- package/skills/incremental-implementation/SKILL.md +0 -249
- package/skills/swarm-orchestration/SKILL.md +0 -54
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# gc-* script map
|
|
2
|
+
|
|
3
|
+
Use these wrappers only for the Git action the user requested or the named endpoint requires.
|
|
4
|
+
|
|
5
|
+
- **Verbs:** `gc-status` · `gc-sync` · `gc-branch` · `gc-stage` · `gc-commit` · `gc-push` · `gc-pr` · `gc-merge` · `gc-rebase` · `gc-bump` · `gc-read` — each as `pwsh -NoProfile -File ~/.config/opencode/scripts/gc-<verb>.ps1 -RepoRoot <path>`.
|
|
6
|
+
- **Output:** terse by default — one `RESULT: <json>` line on stdout; FAIL/WARN/security lines always visible; `-Detailed` restores narration; `-Quiet` is a compatibility no-op.
|
|
7
|
+
- **Release exception:** `gc-release -MovingLatest` is available only when repository policy explicitly declares the nonstandard single moving `latest` scheme. Ordinary releases follow repository instructions.
|
|
8
|
+
- **Smoke:** never - operator ruling 2026-09-29: do not run `gc.smoke.ps1`; treat the gc-* wrappers as trusted without a pre-flight gate.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Intent routing
|
|
2
|
+
|
|
3
|
+
Routing belongs to the orchestrator and command frontmatter; this file is only a compact lookup.
|
|
4
|
+
|
|
5
|
+
- Reconnaissance → `explore`
|
|
6
|
+
- Project implementation → `build`
|
|
7
|
+
- Synthesis, operations, requested docs → `general`
|
|
8
|
+
- Independent verification → `reviewer`
|
|
9
|
+
- Global harness or credential-bearing paths → `vault`
|
|
10
|
+
- Planning-only conversation → `plan`
|
|
11
|
+
|
|
12
|
+
Explicit workflows: `/spec` → `spec-driven-development`; `/gauntlet` → `gauntlet`; standalone `--gc` → `git-ceremony`; standalone `--clean` → housekeeper (clean-mandate); direct performance-history questions → `pilot-report`.
|
|
13
|
+
|
|
14
|
+
Domain skills are procedures inside a worker brief, never dispatch authorities. A skill may not widen scope, choose seats, create session state, commit, publish, or advance lifecycle phases unless the user explicitly requested that action.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Lifecycle boundaries
|
|
2
|
+
|
|
3
|
+
Before a consequential action, identify target, owner, blast radius, reversibility, dependencies, and proof.
|
|
4
|
+
|
|
5
|
+
- **Read-only:** inspect and report freely inside scope.
|
|
6
|
+
- **Bounded reversible:** ordinary requested edits and local checks may proceed.
|
|
7
|
+
- **Consequential external:** pushes, messages, remote mutations, installs, or shared-state changes require the request to include them.
|
|
8
|
+
- **Destructive or irreversible:** deletion, force, history rewrite, production mutation, and credential rotation require explicit authorization plus a recovery path.
|
|
9
|
+
- **Secrets and identity:** work by pointer; never render values.
|
|
10
|
+
|
|
11
|
+
One authorization covers the bounded action described. A material target, scope, blast-radius, or reversibility change must be surfaced before proceeding.
|
|
12
|
+
|
|
13
|
+
On failure, stop at the boundary, preserve evidence and rollback state, then recover inside scope or report the exact blocker. Never turn a failed check into permission for cleanup, rewrites, or a weaker check.
|
|
14
|
+
|
|
15
|
+
Use a script when the operation is repetitive, must keep secrets out of model context, or needs deterministic reuse. Otherwise prefer the direct native tool.
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
# Model Keeper
|
|
2
2
|
|
|
3
|
-
The `keeper` maintains the model
|
|
3
|
+
The `keeper` maintains the evidence-based model catalog in `~/.config/opencode/reference/models.md` and
|
|
4
|
+
the provider inventory (an adopter-owned companion file, e.g. `provider-model-inventory.md`, kept by the
|
|
5
|
+
keeper on first pass - **not** shipped with the harness). It does **not**
|
|
6
|
+
route models to agents and must never add, remove, or alter agent `model:` bindings.
|
|
7
|
+
Agent bindings exist per OWNER ORDER 2026-09-26 (`models.md` § Routing); the operator
|
|
8
|
+
owns them, not the keeper.
|
|
4
9
|
|
|
5
10
|
## Keeper pass
|
|
6
11
|
|
|
7
|
-
1. Read
|
|
8
|
-
2. Query
|
|
9
|
-
3. Check official pricing, context sizes, capabilities, and
|
|
10
|
-
4. Diff
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
1. Read `~/.config/opencode/reference/models.md` and the provider inventory.
|
|
13
|
+
2. Query live provider catalogs and list available models and variants.
|
|
14
|
+
3. Check official pricing, context sizes, capabilities, and variants for candidate models.
|
|
15
|
+
4. Diff live evidence against the catalog: additions, removals, renames, price/capability
|
|
16
|
+
changes, and variant changes.
|
|
17
|
+
5. Update the catalog and inventory only. Never add or restore an agent `model:` field,
|
|
18
|
+
change the TUI selection, or select a model on the operator's behalf.
|
|
19
|
+
6. Validate model IDs and values against live catalogs; preserve uncertainty when sources
|
|
20
|
+
disagree. Report sources, verification date, and any unverified claims.
|
|
13
21
|
|
|
14
22
|
## Evidence rules
|
|
15
23
|
|
|
@@ -17,10 +25,22 @@ The `keeper` maintains the model picture: the catalog in `reference/models.md` a
|
|
|
17
25
|
- Official provider pricing is the price authority.
|
|
18
26
|
- Promotions, temporary discounts, free trials, and usage multipliers are not routing evidence.
|
|
19
27
|
- Record cache-read rates, context tiers, and per-model allocations when the source exposes them.
|
|
20
|
-
-
|
|
21
|
-
- Preserve uncertainty when sources disagree; never invent a model ID, price, or variant.
|
|
28
|
+
- Preserve uncertainty; never invent a model ID, price, or variant.
|
|
22
29
|
- Keep secrets by pointer only: never print, paste, log, or commit a key value.
|
|
23
30
|
|
|
24
31
|
## Cadence
|
|
25
32
|
|
|
26
|
-
Refresh after a provider catalog change, an
|
|
33
|
+
Recheck the date at `~/.config/opencode/reference/models.md:3`. Refresh after a provider catalog change, an
|
|
34
|
+
OpenCode update, or the listed review date. No background watcher runs on its own; the
|
|
35
|
+
keeper runs when invoked. A no-change result is valid.
|
|
36
|
+
|
|
37
|
+
Each pass also snapshots `https://opencode.ai/data` (the public usage board) into
|
|
38
|
+
the adopter's model data log (e.g. `model-data-log.md` beside `models.md`, created on first
|
|
39
|
+
pass - **not** shipped with the harness) for the tracked stable lineup: board rank, weekly tokens
|
|
40
|
+
and Δ, weekly retention, cost/session, and the model's Go allowance. Free, promo/
|
|
41
|
+
contributor, experimental, and superseded models are excluded from tracking. Record
|
|
42
|
+
events and claims with date, source, and a verification tag (**VERIFIED** / **UNVERIFIED**).
|
|
43
|
+
A no-change result is valid there too.
|
|
44
|
+
|
|
45
|
+
`~/.config/opencode/reference/model-test.md` is the optional Go-only contender bench for adding evidence to
|
|
46
|
+
the catalog; it does not change agent routing.
|
package/reference/model-test.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Model Test — fixed contender intake (Go only)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **TEMPLATE — unfilled contender bench (Go only).** This is the Go-only bench a new model
|
|
4
|
+
> runs to earn a row in `~/.config/opencode/reference/models.md`; the canonical 3-day recheck procedure is
|
|
5
|
+
> `~/.config/opencode/reference/model-keeper.md`. The `<DATE>` / `<YOUR_MODEL>` slots below are intentional
|
|
6
|
+
> template placeholders — fill them per bench series before citing a run as evidence.
|
|
7
|
+
|
|
8
|
+
How a new OpenCode Go model earns a row in `~/.config/opencode/reference/models.md`. Same bytes in, same
|
|
4
9
|
harness around it, every time — so scores are comparable across models and across months.
|
|
5
10
|
|
|
6
11
|
## 0. Sweep (every recheck, every 3 days)
|
|
@@ -8,7 +13,7 @@ harness around it, every time — so scores are comparable across models and acr
|
|
|
8
13
|
List the live catalog and diff against the ranked table — **all Go IDs are contenders**:
|
|
9
14
|
|
|
10
15
|
```powershell
|
|
11
|
-
opencode models 2>$null | Select-String '
|
|
16
|
+
opencode models 2>$null | Select-String '<provider>/'
|
|
12
17
|
```
|
|
13
18
|
|
|
14
19
|
**Fresh-online rule (standing):** re-pull the model list, prices, caps, and context
|
|
@@ -66,7 +71,7 @@ labeled, never re-scored):
|
|
|
66
71
|
2. Always pair the top rung against one level down on the fixed task.
|
|
67
72
|
3. Keep the highest rung only if it wins clearly (better quality at acceptable cost —
|
|
68
73
|
the Muse xhigh precedent: +3 qual, +73% TPS, −27% wall for +18%). Otherwise drop
|
|
69
|
-
one and live there (the
|
|
74
|
+
one and live there (the verbosity precedent: 7,337 reasoning tokens, -5 quality,
|
|
70
75
|
3× wall, +68% cost — verbosity that loses value to performance).
|
|
71
76
|
4. No two models expose the same rungs — probe, never assume (`<YOUR_MODEL>` exposes none).
|
|
72
77
|
- `steps: 8` ceiling, shell / web / subagents denied, 600 s hard timeout, single run
|
|
@@ -138,10 +143,10 @@ No standing persona panel exists; the objective /60 stays deterministic (DOM-mea
|
|
|
138
143
|
lead-scored). When the top two are within 3 points, the subjective design /40 goes to a
|
|
139
144
|
three-judge panel of existing specialists, each scoring blind from the artifact:
|
|
140
145
|
|
|
141
|
-
- `
|
|
146
|
+
- `reviewer` (security lens) — escape/XSS discipline, inline-script hygiene, autocomplete +
|
|
142
147
|
persistence privacy.
|
|
143
|
-
- `reviewer` — correctness of states, a11y outcomes, focus management, no-dead-link rule.
|
|
144
|
-
- `
|
|
148
|
+
- `reviewer` (correctness lens) — correctness of states, a11y outcomes, focus management, no-dead-link rule.
|
|
149
|
+
- `reviewer` (perf lens) — size budget, render cost, animation discipline,
|
|
145
150
|
reduced-motion honesty.
|
|
146
151
|
|
|
147
152
|
Majority moves the design score; dissent recorded in one line. Judges never touch the
|
package/reference/models.md
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
# OpenCode Model Catalog
|
|
1
|
+
# OpenCode Model Catalog
|
|
2
2
|
|
|
3
|
-
> **Recheck due:
|
|
3
|
+
> **Recheck due: `<date>` - every 3 days.** Procedure: `~/.config/opencode/reference/model-keeper.md`.
|
|
4
4
|
> On recheck, move this date +3 days and re-verify the table below.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
> **TEMPLATE - adopter-owned skeleton.** This file ships EMPTY of measured data by
|
|
7
|
+
> design: seat wiring lives in the adopter's `agents` map (or agent frontmatter) and is
|
|
8
|
+
> NOT shipped with the harness. The installer PRESERVES an existing file. Rows are
|
|
9
|
+
> recorded per `reference/model-keeper.md` - measured routes, prices, variants, and
|
|
10
|
+
> history are adopter evidence, never shipped.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
This is an informational catalog of model IDs, provider availability, variants, and
|
|
13
|
+
measured route windows. It routes nothing itself - seat routing lives in the adopter's
|
|
14
|
+
`agents` map or agent frontmatter. The catalog's only machine-read contract is the table
|
|
15
|
+
below (`scripts/harness-doctor.ps1` parses the `Model (provider/<id>)` header and the
|
|
16
|
+
numbered backticked rows).
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
Rates are USD per MTok, input / output / cache-read / cache-write. Context is
|
|
19
|
+
input / max output. `<...>` slots are placeholders the adopter fills on first
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
record; rows start empty - replace the example rows, never extend the table shape.
|
|
22
|
+
|
|
23
|
+
| # | Model (provider/<id>) | Context | Rate (in/out/read/write) | Variants | Status |
|
|
24
|
+
|---|----------------------|--------:|--------------------------|----------|--------|
|
|
25
|
+
| 1 | `provider/example-model-1` | `<context>` | `<in>/<out>/<read>/<write>` | `<variants>` | `<status>` |
|
|
26
|
+
| 2 | `provider/example-model-2` | `<context>` | `<in>/<out>/<read>/<write>` | `<variants>` | `<status>` |
|
|
27
|
+
|
|
28
|
+
Example rows above are structural placeholders - replace with measured rows recorded
|
|
29
|
+
per `reference/model-keeper.md`. No fallback ladder is shipped: provider errors are
|
|
30
|
+
reported by OpenCode; the catalog never retries, substitutes, or changes the selected
|
|
31
|
+
model.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# oc-source map — OpenCode V2 monorepo (local)
|
|
2
|
+
|
|
3
|
+
**What this is:** the map of the `oc-source` reference — the operator's daily-updated local copy of the OpenCode V2 monorepo at `<OC_SOURCE>`. Where the docs live, which files are authoritative for what, and where to start reading. Written for agents; everything below is local on disk, no web required. Pairs with the `oc-source` entry registered in `opencode.jsonc`.
|
|
4
|
+
|
|
5
|
+
**Rules of use**
|
|
6
|
+
- **Read-only:** never edit that checkout — it is a reference, not a workspace.
|
|
7
|
+
- **Freshness first:** run the recipe below before citing it; prefer this checkout over web docs.
|
|
8
|
+
- **Cite by commit:** `path @ <short-HEAD>` (e.g. `specs/v2/session.md @ 96f23508bed1`).
|
|
9
|
+
- **Confirm load-bearing paths at HEAD:** the tree moves; re-check before betting a decision on a file.
|
|
10
|
+
|
|
11
|
+
## Freshness — run before citing
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
git -C <OC_SOURCE> status --short --branch # expect: ## v2...origin/v2 and a clean tree
|
|
15
|
+
git -C <OC_SOURCE> rev-parse --short HEAD # note the hash for citations
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Last verified: 2026-09-29 · HEAD b29dab3231d4 · clean on `v2...origin/v2`. Bounded recheck: root shape and listed absences below, sampled paths, and `specs/v2/session.md`; the full map was not exhaustively revalidated. Detailed package-map citations remain tied to their historical revision unless rechecked.
|
|
19
|
+
|
|
20
|
+
## Self-update nudge
|
|
21
|
+
|
|
22
|
+
The freshness recipe above already runs first; compare its `git rev-parse --short HEAD` against the "Last verified" anchor:
|
|
23
|
+
|
|
24
|
+
- **HEAD differs from the anchor** → re-anchor on the spot: re-run the bounded recheck — root top-level shape, the `package.json`-absence list (`console`, `containers`, `effect-drizzle-sqlite`, `identity`, `stats`), and `specs/v2/session.md` present — then update all three anchor lines (the "Last verified" block and both `(rechecked … at <hash>)` tags) to the new date/hash. Note any shape changes in the session report.
|
|
25
|
+
- **HEAD commit date older than 2 days** (`git log -1 --date=short`) → surface in the session: "oc-source checkout stale — run `pwsh <OC_SOURCE>\update-all.ps1` to refresh, then re-run the recipe and re-anchor." State plainly: that script runs `git fetch --all --prune --tags` + `git reset --hard` + `git clean -fdx` on **every** git repo under the umbrella directory that contains `<OC_SOURCE>`, not just this checkout.
|
|
26
|
+
|
|
27
|
+
Nothing else: no scheduling, no `AGENTS.md`/owner-pin edits, no command file (a `/oc-refresh` command was explicitly declined). The nudge fires only in sessions that load this map.
|
|
28
|
+
|
|
29
|
+
## 1. Start here — root files, in reading order
|
|
30
|
+
|
|
31
|
+
| Path | What it is | Why read it |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `README.md` | Project identity, install, screenshots, translated copies (`README.*.md`) | Orientation only |
|
|
34
|
+
| `CONTRIBUTING.md` | Contribution guardrails — what PRs get accepted, `bun dev` loop | Before touching code |
|
|
35
|
+
| `AGENTS.md` | Contributor-critical regression guardrails (authoritative per `specs/v2/README.md`) | **Read first** before any change |
|
|
36
|
+
| `specs/v2/README.md` | Authority table + index of the design specs | Pick what to trust |
|
|
37
|
+
| `SECURITY.md` | How to report issues | Optional |
|
|
38
|
+
| `STATS.md` | Historical download numbers, not product info | Skip |
|
|
39
|
+
|
|
40
|
+
**Top-level shape** (rechecked 2026-09-29 at `b29dab3231d4`): `packages/` (34 dirs) · `sdks/vscode` · `services/` (www, files, update) · `specs/v2` · `infra/` (SST infrastructure: `app.ts`, `console.ts`, `lake.ts`, `monitoring.ts`, …) · tooling: `script/`, `patches/`, `nix/`, `github/` · worktrees: `artifacts/`, `perf/`.
|
|
41
|
+
|
|
42
|
+
## 2. Docs — online ↔ local map
|
|
43
|
+
|
|
44
|
+
`https://opencode.ai/v2/llms.txt` is just a **manifest of pages built from this repo**. Every doc page = a Markdown (`mdx`) file under `services/www/src/docs/content/` — the documentation source of truth.
|
|
45
|
+
|
|
46
|
+
| llms.txt URL | Local file |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `/v2/docs/` | `services/www/src/docs/content/index.mdx` |
|
|
49
|
+
| `/v2/docs/config/` · `/agents/` · `/models/` | `…/content/config.mdx` · `agents.mdx` · `models.mdx` |
|
|
50
|
+
| `/v2/docs/<page>/` — skills, themes, commands, plugins, providers, websearch, network, snapshots, compaction, formatters, references, attachments, tools, mcp-servers, permissions, policies, instructions, sharing, warming, troubleshooting, migrate-v1 | `…/content/<page>.mdx` |
|
|
51
|
+
| `/v2/docs/cli/…` — acp, commands, config, keybinds, plugins, providers, theme, tui, web | `…/content/cli/<name>.mdx` |
|
|
52
|
+
| `/v2/docs/build/…` — client/, plugins/, sdk/ groups (nested) | `…/content/build/<path>.mdx` |
|
|
53
|
+
| `/v2/docs/console/…` — budgets, byok, go, inference, models, usage, websearch | `…/content/console/<name>.mdx` |
|
|
54
|
+
| `/v2/docs/api/` | `services/www/src/pages/docs/api` — **generated** from `services/www/openapi.json` |
|
|
55
|
+
|
|
56
|
+
> **Caveat:** the *published* site may be ahead of the checkout. Read the `.mdx` files when docs must match this exact commit.
|
|
57
|
+
|
|
58
|
+
## 3. Specs — authoritative design contracts
|
|
59
|
+
|
|
60
|
+
**`specs/v2/`** — documents explaining V2 behavior that is hard to recover from one source file. `specs/v2/README.md` marks which are current contracts, decision records, or historical.
|
|
61
|
+
|
|
62
|
+
| Document | Job |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `README.md` | Authority table + doc index — read first |
|
|
65
|
+
| `session.md` | Current contract: prompt admission, execution, instructions, compaction, recovery boundaries |
|
|
66
|
+
| `tools.md` | Current contract: tool construction, registration, execution, outcome laws |
|
|
67
|
+
| `event-stream-architecture.md` | Decision record (accepted): one encoded event feed with independent queues |
|
|
68
|
+
| `provider-policy.md` | Decision record (accepted): provider allow/deny + permission checks; Console-managed statements have final authority |
|
|
69
|
+
| `catalog-config-plugin-lifecycle.md` | Historical: the option comparison → replayable Location-scoped catalog transforms (may use obsolete names) |
|
|
70
|
+
|
|
71
|
+
**Authority chain** (from `specs/v2/README.md`):
|
|
72
|
+
|
|
73
|
+
| Concern | Owner |
|
|
74
|
+
|---|---|
|
|
75
|
+
| HTTP operations / transport errors | `packages/protocol/src` (assembled by `packages/server` HttpApi) |
|
|
76
|
+
| Public domain shapes / durable event payloads | `packages/schema/src` |
|
|
77
|
+
| Runtime behavior / persistence | `packages/core/src` |
|
|
78
|
+
| Contributor guardrails | root `AGENTS.md` |
|
|
79
|
+
|
|
80
|
+
## 4. Package map — `packages/` (34 dirs)
|
|
81
|
+
|
|
82
|
+
Each is a `@opencode/<name>` package; start at `src/`.
|
|
83
|
+
|
|
84
|
+
| Package | What it is | Start reading |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `cli` | The CLI binary — commands, config, ACP, framework, node runtime | `src/run`, `src/commands`, `src/acp` |
|
|
87
|
+
| `core` | Runtime behavior, persistence, account, instance, events, codemode | `src/` (largest; read `specs/v2` first) |
|
|
88
|
+
| `protocol` | HTTP endpoint definitions, client, errors, simulation | `src/api.ts`, `src/groups` |
|
|
89
|
+
| `schema` | Domain shapes, durable event payloads, v1 compat | `src/*.ts` (event.ts, session shapes…) |
|
|
90
|
+
| `server` | Effect HttpApi assembly, transport | `src` |
|
|
91
|
+
| `ai` | Agent/AI layer — internal design: `docs/media-design.md` | `src`, `docs/` |
|
|
92
|
+
| `client` | Generated/typed HTTP client | `src` |
|
|
93
|
+
| `sdk` | Public SDK | `src` |
|
|
94
|
+
| `plugin` | Plugin API surface | `src` |
|
|
95
|
+
| `tui` | Terminal UI | `src` |
|
|
96
|
+
| `ui` | Shared UI components | `src` |
|
|
97
|
+
| `theme` | Themes | `src` |
|
|
98
|
+
| `web` | Web app + lander (screenshot: `src/assets/lander/screenshot.png`) | `src/pages`, `src/components` |
|
|
99
|
+
| `app` | App shell | `src` |
|
|
100
|
+
| `desktop` | Desktop app | `src` |
|
|
101
|
+
| `plugin-browser` | OpenCode's desktop browser plugin (own package — not under `desktop`) | `src` |
|
|
102
|
+
| `console` | Cloud console — packages in subdirs `app`, `core`, `function`, `mail`, `resource`, `support` | `app/src` |
|
|
103
|
+
| `session-ui` | Session UI | `src` |
|
|
104
|
+
| `codemode` | Effect-native confined code execution over schema-described tools | `src` |
|
|
105
|
+
| `httpapi-codegen` | Generates clients from the HttpApi | `src` |
|
|
106
|
+
| `simulation` | Simulation/testing harness | `src` |
|
|
107
|
+
| `http-recorder` | Record/replay Effect HTTP+WS traffic as cassettes (for tests) | `src` |
|
|
108
|
+
| `script` | Scripting helpers | `src` |
|
|
109
|
+
| `util` | Shared utilities — internal design: `docs/layer-node.md` | `src`, `docs/` |
|
|
110
|
+
| `effect-drizzle-sqlite` | SQLite adapter (no `package.json` — source dir) | root |
|
|
111
|
+
| `containers`, `identity`, `stats`, `enterprise`, `function`, `latex`, `merman`, `posts`, `storybook` | Misc/infra — inspect when a task touches them | root |
|
|
112
|
+
|
|
113
|
+
> Root `package.json` absent in: `console` (per-subdir packages), `containers`, `effect-drizzle-sqlite`, `identity`, `stats` (rechecked 2026-09-29 at `b29dab3231d4`).
|
|
114
|
+
|
|
115
|
+
## 5. Services & SDKs
|
|
116
|
+
|
|
117
|
+
| Path | What it is |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `services/www` | **The docs site** (Astro) — docs content in `src/docs/content/`, API pages from `openapi.json`, pages in `src/pages/docs` |
|
|
120
|
+
| `services/files` | `@opencode/files` service |
|
|
121
|
+
| `services/update` | `@opencode/update` service |
|
|
122
|
+
| `sdks/vscode` | VS Code extension (`src`, `README.md`, esbuild build) |
|
|
123
|
+
|
|
124
|
+
## 6. Topic → file quick index
|
|
125
|
+
|
|
126
|
+
> "I need to know how X works" → start here.
|
|
127
|
+
|
|
128
|
+
| Topic | Go to |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Anything user-facing about the product | `services/www/src/docs/content/` (docs) or `specs/v2/` (contracts) |
|
|
131
|
+
| Session lifecycle, compaction, recovery | `specs/v2/session.md` + `packages/core/src` |
|
|
132
|
+
| Tools (definition/registration/execution) | `specs/v2/tools.md` + `packages/schema/src` |
|
|
133
|
+
| HTTP API surface / endpoints / errors | `packages/protocol/src` + `services/www/openapi.json` |
|
|
134
|
+
| Domain types / durable events | `packages/schema/src` |
|
|
135
|
+
| Persistence / runtime behavior | `packages/core/src` |
|
|
136
|
+
| CLI commands, ACP, config load | `packages/cli/src` |
|
|
137
|
+
| Agent internals / AI layer | `packages/ai/src` + `packages/ai/docs/` |
|
|
138
|
+
| Plugin API | `packages/plugin/src` (docs: `content/plugins.mdx`) |
|
|
139
|
+
| Desktop browser plugin | `packages/plugin-browser/src` |
|
|
140
|
+
| Providers / models / permissions | docs `content/providers.mdx` + `specs/v2/provider-policy.md` |
|
|
141
|
+
| UI (web/desktop/console) | `packages/web` · `packages/app` · `packages/desktop` · `packages/console` · `packages/ui` |
|
|
142
|
+
| Tests & cassettes | `packages/http-recorder` · `packages/simulation` |
|
|
143
|
+
| Infra / deploys | `infra/*.ts` (SST) + `services/` |
|
|
144
|
+
|
|
145
|
+
## 7. Dev loop (from `CONTRIBUTING.md`)
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
bun install # from repo root
|
|
149
|
+
bun dev [directory] # run V2 CLI + TUI against a directory (`.` = this repo)
|
|
150
|
+
bun run dev:live [directory] # TUI against installed background service
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
For web development, run the backend and app in separate terminals (`bun run dev:web`). UI/core product features require design review before implementation.
|
|
154
|
+
|
|
155
|
+
## 8. Gotchas
|
|
156
|
+
|
|
157
|
+
- **Docs drift:** `services/www/src/docs/content/` is the local truth; the live site may be a newer deploy.
|
|
158
|
+
- **Generated API docs:** `docs/api/` pages derive from `openapi.json` — edit the HttpApi (`packages/protocol`), not generated pages.
|
|
159
|
+
- **Specs are contracts, not history:** `specs/v2/README.md` marks current vs decision vs historical; historical docs may use obsolete names.
|
|
160
|
+
- **No implementation checklists in `specs/v2`** — actionable work belongs in GitHub issues.
|
|
161
|
+
- **Branch/HEAD move:** this checkout is `v2`; the repo default branch + published release may differ. Re-run the freshness recipe before citing.
|
|
162
|
+
- **A deployed surface can postdate this checkout.** `/zen/go/v1/usage` answers 200 in production while `routes/zen/go/v1/` here holds only `chat/completions`, `messages`, `responses`, `models` (2026-09-26). A local grep proves what the *checkout* contains — never that a live endpoint is absent. When a plan depends on a service's shape, probe the deployed surface (a 401-vs-404 difference is evidence) or read the deployed docs before concluding "doesn't exist".
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Owner pin - live state (<title>)
|
|
2
|
+
|
|
3
|
+
> **TEMPLATE - adopter-owned.** The installer PRESERVES an existing file and ships
|
|
4
|
+
> this placeholder only when absent. Every value below is a `<placeholder>` slot;
|
|
5
|
+
> session ids and state paths are volatile and live here and nowhere else -
|
|
6
|
+
> `AGENTS.md` stays a clean guide with nothing hardcoded. Zero personal content
|
|
7
|
+
> ships: fill this file after install, never before.
|
|
8
|
+
|
|
9
|
+
`AGENTS.md` carries the **duty** (principle, one line) and points **here** for the live
|
|
10
|
+
pointers.
|
|
11
|
+
|
|
12
|
+
## Window
|
|
13
|
+
|
|
14
|
+
- opened: `<date>`
|
|
15
|
+
- horizon: `<date>` (**<`n`> days from `<date>`**; supersedes any earlier ceiling)
|
|
16
|
+
|
|
17
|
+
## Next pending (in order)
|
|
18
|
+
|
|
19
|
+
1. `<first pending item>`
|
|
20
|
+
2. `<second pending item>`
|
|
21
|
+
|
|
22
|
+
## Reminder duty
|
|
23
|
+
|
|
24
|
+
- `<active | paused>` - `<rule, e.g. next nudge on the first session opened on or after <date>>`
|
|
25
|
+
- last-nudge file: `<path outside this repo>`
|
|
26
|
+
|
|
27
|
+
## Session map
|
|
28
|
+
|
|
29
|
+
- live session: `<title>` - `<session-id>`
|
|
30
|
+
- **parent / HISTORICAL record:** `<title>` - `<session-id>`
|
|
31
|
+
- **never delete**; it is the design-rationale archive.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Agent roster
|
|
2
|
+
|
|
3
|
+
| Seat | Mode | Purpose |
|
|
4
|
+
|---|---|---|
|
|
5
|
+
| `orchestrator` | primary | User-facing control plane: scope, dispatch, live event reports, fan-in, recovery, final verdict. |
|
|
6
|
+
| `plan` | primary | Planning only; may use one read-only `explore` worker. |
|
|
7
|
+
| `build` | subagent | Project implementation and proving checks. |
|
|
8
|
+
| `explore` | subagent | Read-only reconnaissance and targeting evidence. |
|
|
9
|
+
| `general` | subagent | Bounded synthesis, operations, documentation, and non-product artifacts. |
|
|
10
|
+
| `reviewer` | subagent | Independent read-only verification with a pass/revise/blocked verdict. |
|
|
11
|
+
| `vault` | subagent | Global harness and credential-bearing paths, values by pointer only. |
|
|
12
|
+
|
|
13
|
+
Seats are roles, not singletons. The orchestrator may run multiple instances when their seams are independent. Workers never delegate or widen their briefs.
|
|
14
|
+
|
|
15
|
+
Reviewer lenses are named in the dispatch brief: `correctness`, `security`, `test`, or `performance`. Apply only lenses relevant to the risk; `/ship` deliberately runs correctness, security, and test in parallel.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Session scope
|
|
2
|
+
|
|
3
|
+
One live session owns one task domain. Before dispatching into another repository or shared harness surface, check active sessions through the OpenCode service API when collision is plausible.
|
|
4
|
+
|
|
5
|
+
Read the service registration in-process from `$XDG_STATE_HOME/opencode/service.json`, defaulting to `~/.local/state/opencode/service.json`, with `~/.config/opencode/service.json` as fallback. Keep the password inside the process and Authorization header; never print or log it.
|
|
6
|
+
|
|
7
|
+
If another live session clearly owns the target, do not edit that surface. Report the collision and hand over the finding. If overlap is discovered after dispatch, stop the overlapping worker and preserve the last verified state; do not destructively revert shared work.
|
|
8
|
+
|
|
9
|
+
The user may intentionally combine domains in one session. That explicit request defines the broader scope.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Session state
|
|
2
|
+
|
|
3
|
+
State is optional working memory for long work, compaction, or handoff. Trivial work needs none.
|
|
4
|
+
|
|
5
|
+
Use `~/.opencode/state/sessions/<session-id>/`:
|
|
6
|
+
|
|
7
|
+
- `session.yaml` — goal, plan, done, now, next, blockers, key files, handoff.
|
|
8
|
+
- `events.yaml` — append-only meaningful events.
|
|
9
|
+
- `artifacts/<id>.yaml` — long-form session artifacts when needed.
|
|
10
|
+
|
|
11
|
+
Use two-space YAML, quoted free text, literal blocks for prose, and no secrets. Do not create Markdown in the state directory. The foreground orchestrator owns state; background workers return evidence rather than editing their child session state.
|
|
12
|
+
|
|
13
|
+
`/checkpoint` refreshes the snapshot and appends one event. `/handoff` writes the minimum continuation context. Compact only at a clean milestone after refreshing state.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Orchestration mechanics
|
|
2
|
+
|
|
3
|
+
Use this only when the compact contract in `AGENTS.md` is insufficient.
|
|
4
|
+
|
|
5
|
+
## Dispatch
|
|
6
|
+
|
|
7
|
+
- Orchestrator is the sole hub. Workers return findings or changes to it; they do not spawn the next hop.
|
|
8
|
+
- A brief contains outcome, scope, exclusions, done condition, evidence, and owned artifacts.
|
|
9
|
+
- Split by independent artifact, question, or phase. Parallelize independent work; order dependencies; allow one writer per artifact at a time.
|
|
10
|
+
- Use the fewest workers that expose real parallel seams. No relay, duplicate, decorative, or open-ended workers.
|
|
11
|
+
|
|
12
|
+
## Reporting
|
|
13
|
+
|
|
14
|
+
Report the plan, every dispatch, return, deviation, blocker, reroute, and verification result. Reporting is event-driven. Do not poll, sleep, promise timed heartbeats, or emit “still waiting” filler when nothing changed.
|
|
15
|
+
|
|
16
|
+
## Fan-in
|
|
17
|
+
|
|
18
|
+
- Treat worker output as evidence. Reconcile it against the brief and acceptance evidence.
|
|
19
|
+
- When reports conflict, dispatch one focused check for the disputed fact.
|
|
20
|
+
- A fix goes to one writer; verification goes to a fresh reviewer when risk warrants independence.
|
|
21
|
+
- Adjacent discoveries are deferred findings, not automatic work.
|
|
22
|
+
|
|
23
|
+
## Failure and recovery
|
|
24
|
+
|
|
25
|
+
- Stop a drifting, looping, or unsafe worker; preserve completed in-scope evidence.
|
|
26
|
+
- Independent branches may continue after one branch blocks; dependent branches stop.
|
|
27
|
+
- One retry is reasonable for a provider-stream failure with no output. Repeated empty output is a provider issue to report, not a reason for retry storms.
|
|
28
|
+
- `/kill <target>` interrupts one live session through `~/.config/opencode/scripts/interrupt-session.ps1`. It does not delete the session.
|
|
29
|
+
|
|
30
|
+
## Close
|
|
31
|
+
|
|
32
|
+
Collect or stop every worker. Report only what this close has to show — changed artifacts, checks and what they proved, remaining risk, next required action — each section only when it has real content, omit otherwise. Do not close while background work is still running.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<#
|
|
2
|
+
backup-config.ps1 - copy a config file into ~\.opencode\config-backups with keep-last-5 retention.
|
|
3
|
+
|
|
4
|
+
Usage: scripts\backup-config.ps1 -Path <file>
|
|
5
|
+
|
|
6
|
+
Pure byte copy; file contents are never read or modified. Outputs only the
|
|
7
|
+
created backup path (one line). See reference\backup-convention.md.
|
|
8
|
+
#>
|
|
9
|
+
param(
|
|
10
|
+
[Parameter(Mandatory=$true)][string]$Path
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
$resolved = Resolve-Path -LiteralPath $Path -ErrorAction SilentlyContinue
|
|
14
|
+
if (-not $resolved) {
|
|
15
|
+
throw "backup-config.ps1: file not found: '$Path'"
|
|
16
|
+
}
|
|
17
|
+
if (-not (Test-Path -LiteralPath $resolved -PathType Leaf)) {
|
|
18
|
+
throw "backup-config.ps1: not a file: '$resolved'"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
$destRoot = Join-Path $env:USERPROFILE '.opencode\config-backups'
|
|
22
|
+
New-Item -ItemType Directory -Path $destRoot -Force | Out-Null
|
|
23
|
+
|
|
24
|
+
# Guard: never back up a file that already lives inside the backup root.
|
|
25
|
+
$destRootPrefix = $destRoot.TrimEnd('\') + '\'
|
|
26
|
+
if ($resolved.Path.StartsWith($destRootPrefix, [System.StringComparison]::OrdinalIgnoreCase)) {
|
|
27
|
+
throw "backup-config.ps1: refusing to back up a file inside the backup root: '$destRoot'"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
|
31
|
+
$name = Split-Path -Leaf $resolved
|
|
32
|
+
$dest = Join-Path $destRoot "$stamp-$name.bak"
|
|
33
|
+
|
|
34
|
+
Copy-Item -LiteralPath $resolved -Destination $dest -Force
|
|
35
|
+
|
|
36
|
+
# Timestamp-prefixed names sort lexicographically; keep only the newest 5.
|
|
37
|
+
Get-ChildItem -LiteralPath $destRoot -Filter "*-$name.bak" -File |
|
|
38
|
+
Sort-Object -Property Name -Descending |
|
|
39
|
+
Select-Object -Skip 5 |
|
|
40
|
+
ForEach-Object { Remove-Item -LiteralPath $_.FullName -Force }
|
|
41
|
+
|
|
42
|
+
Write-Output $dest
|