oc-harness-setup 0.3.3 → 0.4.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 +16 -15
- package/AGENTS.md +105 -68
- package/CHANGELOG.md +107 -0
- package/GLOSSARY.md +46 -0
- package/LICENSE +1 -1
- package/README.md +49 -60
- package/agents/cleaner.md +86 -0
- package/agents/critic.md +79 -0
- package/agents/historian.md +92 -0
- package/agents/maintainer.md +106 -0
- package/agents/ops.md +69 -0
- package/agents/orchestrator.md +48 -18
- package/agents/researcher.md +72 -0
- package/agents/verifier.md +84 -0
- package/agents/worker.md +87 -0
- package/bin/cli.js +360 -133
- package/commands/close.md +11 -0
- package/commands/evolve.md +11 -0
- package/commands/fast.md +11 -0
- package/commands/goal.md +11 -0
- package/commands/search.md +11 -0
- package/commands/swarm.md +11 -0
- package/opencode.jsonc +39 -79
- package/package.json +13 -6
- package/reference/README.md +12 -14
- package/reference/canon.md +71 -0
- package/reference/context.md +35 -0
- package/reference/enforcement.md +6 -0
- package/reference/flow.md +19 -0
- package/reference/gates.md +23 -0
- package/reference/harness.md +15 -0
- package/reference/hygiene.md +13 -0
- package/reference/memory.md +13 -0
- package/reference/models.md +19 -24
- package/reference/phases.md +23 -0
- package/reference/repos.md +49 -0
- package/reference/tools.md +35 -0
- package/scripts/harness-doctor.ps1 +83 -0
- package/skills/close/SKILL.md +36 -0
- package/skills/evolve/SKILL.md +76 -0
- package/skills/fast/SKILL.md +36 -0
- package/skills/goal/SKILL.md +65 -0
- package/skills/search/SKILL.md +68 -0
- package/skills/swarm/SKILL.md +69 -0
- package/state-seed/lessons.md +22 -0
- package/state-seed/template.md +12 -0
- package/agents/build.md +0 -20
- package/agents/explore.md +0 -26
- package/agents/general.md +0 -19
- package/agents/plan.md +0 -29
- package/agents/reviewer.md +0 -22
- package/agents/vault.md +0 -73
- package/commands/build.md +0 -7
- package/commands/checkpoint.md +0 -7
- package/commands/code-simplify.md +0 -7
- package/commands/gauntlet.md +0 -7
- package/commands/handoff.md +0 -7
- package/commands/keeper.md +0 -7
- package/commands/kill.md +0 -11
- package/commands/plan.md +0 -7
- package/commands/retro.md +0 -15
- package/commands/review.md +0 -7
- package/commands/ship.md +0 -7
- package/commands/spec.md +0 -7
- package/commands/test.md +0 -7
- package/commands/webperf.md +0 -7
- package/reference/auto-mandate.md +0 -11
- package/reference/backup-convention.md +0 -9
- package/reference/clean-mandate.md +0 -13
- package/reference/editor-parity.md +0 -7
- package/reference/gc-scripts.md +0 -8
- package/reference/intent-routing.md +0 -14
- package/reference/lifecycle.md +0 -15
- package/reference/model-keeper.md +0 -46
- package/reference/model-test.md +0 -176
- package/reference/oc-source-map.md +0 -162
- package/reference/owner-pin.md +0 -31
- package/reference/roster.md +0 -15
- package/reference/session-scope.md +0 -9
- package/reference/session-state.md +0 -13
- package/reference/swarm.md +0 -32
- package/scripts/backup-config.ps1 +0 -42
- package/scripts/gc-branch.ps1 +0 -196
- package/scripts/gc-bump.ps1 +0 -198
- package/scripts/gc-clean.ps1 +0 -648
- package/scripts/gc-commit.ps1 +0 -143
- package/scripts/gc-merge.ps1 +0 -272
- package/scripts/gc-pr.ps1 +0 -190
- package/scripts/gc-push.ps1 +0 -111
- package/scripts/gc-read.ps1 +0 -150
- package/scripts/gc-rebase.ps1 +0 -162
- package/scripts/gc-release.ps1 +0 -225
- package/scripts/gc-stage.ps1 +0 -103
- package/scripts/gc-status.ps1 +0 -127
- package/scripts/gc-sync.ps1 +0 -65
- package/scripts/gc.core.ps1 +0 -715
- package/scripts/gc.smoke.ps1 +0 -779
- package/scripts/interrupt-session.ps1 +0 -65
- package/scripts/logbook/README.md +0 -108
- package/scripts/logbook/logbook.test.ts +0 -440
- package/scripts/logbook/logbook.ts +0 -797
- package/scripts/pirep/README.md +0 -147
- package/scripts/pirep/pirep.test.ts +0 -735
- package/scripts/pirep/pirep.ts +0 -836
- package/scripts/testflight/README.md +0 -112
- package/scripts/testflight/testflight.test.ts +0 -512
- package/scripts/testflight/testflight.ts +0 -806
- package/skills/_shared/SOURCES.md +0 -26
- package/skills/_shared/references/accessibility-checklist.md +0 -160
- package/skills/_shared/references/definition-of-done.md +0 -67
- package/skills/_shared/references/observability-checklist.md +0 -92
- package/skills/_shared/references/orchestration-patterns.md +0 -155
- package/skills/_shared/references/performance-checklist.md +0 -236
- package/skills/_shared/references/security-checklist.md +0 -245
- package/skills/_shared/references/testing-patterns.md +0 -235
- package/skills/api-and-interface-design/SKILL.md +0 -14
- package/skills/browser-testing-with-devtools/SKILL.md +0 -303
- package/skills/code-simplification/SKILL.md +0 -14
- package/skills/creative-writing/SKILL.md +0 -96
- package/skills/debugging-and-error-recovery/SKILL.md +0 -15
- package/skills/flight-deck/SKILL.md +0 -17
- package/skills/frontend-ui-engineering/SKILL.md +0 -16
- package/skills/gauntlet/SKILL.md +0 -21
- package/skills/git-ceremony/SKILL.md +0 -27
- package/skills/grilling/SKILL.md +0 -18
- package/skills/observability-and-instrumentation/SKILL.md +0 -18
- package/skills/performance-optimization/SKILL.md +0 -16
- package/skills/pilot-report/SKILL.md +0 -18
- package/skills/planning-and-task-breakdown/SKILL.md +0 -16
- package/skills/security-and-hardening/SKILL.md +0 -18
- package/skills/source-driven-development/SKILL.md +0 -16
- package/skills/spec-driven-development/SKILL.md +0 -26
- package/skills/test-driven-development/SKILL.md +0 -18
- package/skills/test-flight/SKILL.md +0 -14
- package/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/skills/writing-for-agents/SKILL.md +0 -89
|
@@ -1,162 +0,0 @@
|
|
|
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".
|
package/reference/owner-pin.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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.
|
package/reference/roster.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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.
|
|
@@ -1,9 +0,0 @@
|
|
|
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.
|
|
@@ -1,13 +0,0 @@
|
|
|
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.
|
package/reference/swarm.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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.
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
package/scripts/gc-branch.ps1
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
#Requires -Version 7.0
|
|
2
|
-
<#
|
|
3
|
-
.SYNOPSIS
|
|
4
|
-
Start a unit of work from truth: sync the default branch, then create <type>/<slug>.
|
|
5
|
-
|
|
6
|
-
.DESCRIPTION
|
|
7
|
-
git-ceremony §1-§2 as a script. Fetches origin, fast-forwards the default
|
|
8
|
-
branch (never manufactures a merge, refuses to branch from a stale or
|
|
9
|
-
diverged default), validates the branch name, and creates the branch from the
|
|
10
|
-
synced default HEAD. Idempotent: already on the branch is a no-op; -Reuse
|
|
11
|
-
switches to an existing branch instead of failing.
|
|
12
|
-
|
|
13
|
-
Dynamic content in (type + slug), fixed ceremony out. Repo rules win: if the
|
|
14
|
-
repo documents its own convention, follow that instead of this script.
|
|
15
|
-
|
|
16
|
-
.PARAMETER Type
|
|
17
|
-
One of: feat, fix, chore, docs, refactor, test, perf, hotfix, wt.
|
|
18
|
-
.PARAMETER Slug
|
|
19
|
-
Kebab-case 2-5 words, letters/digits only; describes the change, not the
|
|
20
|
-
author or the date.
|
|
21
|
-
.PARAMETER Branch
|
|
22
|
-
Full <type>/<slug> name; alternative to passing Type + Slug.
|
|
23
|
-
.PARAMETER Reuse
|
|
24
|
-
Switch to the branch when it already exists instead of failing.
|
|
25
|
-
.PARAMETER Delete
|
|
26
|
-
Delete a branch instead of creating one: local delete, plus remote when
|
|
27
|
-
-DeleteRemote is given. Never the default branch, never the current branch,
|
|
28
|
-
never with a dirty tree; an unmerged branch is refused without -Force
|
|
29
|
-
(squash-merged branches legitimately need -Force — the commit lives in the
|
|
30
|
-
default branch, not in branch ancestry).
|
|
31
|
-
.PARAMETER DeleteRemote
|
|
32
|
-
With -Delete: also delete <branch> on the remote (origin by default,
|
|
33
|
-
verified to exist first — never a blind push --delete).
|
|
34
|
-
.PARAMETER Force
|
|
35
|
-
With -Delete: allow deleting an unmerged branch (its commits are not in the
|
|
36
|
-
default branch's history — loud warning).
|
|
37
|
-
.PARAMETER SkipSync
|
|
38
|
-
Skip fetch + fast-forward of the default branch. Only when you just synced;
|
|
39
|
-
the ceremony default is to sync.
|
|
40
|
-
.PARAMETER RepoRoot
|
|
41
|
-
Repository path (defaults to the current directory). Every git call is pinned
|
|
42
|
-
with git -C, so the ambient shell cwd never matters (worktree rails, §10).
|
|
43
|
-
.PARAMETER Detailed
|
|
44
|
-
Restore the step narration, ok/info lines, and raw git/gh relay the terse
|
|
45
|
-
default hides. Never affects the RESULT line, warnings, failures, or the
|
|
46
|
-
security/remediation lines.
|
|
47
|
-
.PARAMETER Quiet
|
|
48
|
-
Accepted for compatibility and now a no-op: the default is already terse.
|
|
49
|
-
-Quiet forces the gate closed and so wins if passed with -Detailed.
|
|
50
|
-
|
|
51
|
-
.EXAMPLE
|
|
52
|
-
pwsh -File scripts\gc-branch.ps1 -Type feat -Slug token-refresh
|
|
53
|
-
|
|
54
|
-
.EXAMPLE
|
|
55
|
-
pwsh -File scripts\gc-branch.ps1 -Branch 'fix/login-timeout' -Reuse
|
|
56
|
-
|
|
57
|
-
.EXAMPLE
|
|
58
|
-
pwsh -File scripts\gc-branch.ps1 -Delete 'feat/token-refresh' -DeleteRemote -Force
|
|
59
|
-
#>
|
|
60
|
-
param(
|
|
61
|
-
[string]$Type,
|
|
62
|
-
[string]$Slug,
|
|
63
|
-
[string]$Branch,
|
|
64
|
-
[string]$Delete,
|
|
65
|
-
[switch]$DeleteRemote,
|
|
66
|
-
[switch]$Force,
|
|
67
|
-
[switch]$Reuse,
|
|
68
|
-
[switch]$SkipSync,
|
|
69
|
-
[string]$RepoRoot = (Get-Location).Path,
|
|
70
|
-
[switch]$Detailed,
|
|
71
|
-
[switch]$Quiet
|
|
72
|
-
)
|
|
73
|
-
Set-StrictMode -Version Latest
|
|
74
|
-
$ErrorActionPreference = 'Stop'
|
|
75
|
-
. (Join-Path $PSScriptRoot 'gc.core.ps1')
|
|
76
|
-
if ($Detailed) { $script:GcQuiet = $false }
|
|
77
|
-
if ($Quiet) { $script:GcQuiet = $true }
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
$root = Resolve-GcRoot -Path $RepoRoot
|
|
81
|
-
Write-GcInfo "repo: $root"
|
|
82
|
-
$default = Get-GcDefaultBranch -Root $root
|
|
83
|
-
Write-GcInfo "default branch: $default"
|
|
84
|
-
$cur = try { Get-GcCurrentBranch -Root $root } catch { $null }
|
|
85
|
-
|
|
86
|
-
# -------- delete verb ---------------------------------------------------
|
|
87
|
-
if ($Delete) {
|
|
88
|
-
$del = $Delete
|
|
89
|
-
Assert-GcRefValue -Name '-Delete' -Value $del
|
|
90
|
-
if ($del -eq $default) {
|
|
91
|
-
throw [GcException]::new("never delete the default branch ($default)", $script:GcExitPre)
|
|
92
|
-
}
|
|
93
|
-
if ($del -eq $cur) {
|
|
94
|
-
throw [GcException]::new("cannot delete the current branch — switch away first (gc-branch -Reuse <branch>)", $script:GcExitPre)
|
|
95
|
-
}
|
|
96
|
-
$localExists = Test-GcRef -Root $root -Ref "refs/heads/$del"
|
|
97
|
-
$remote = $null
|
|
98
|
-
if ($DeleteRemote) {
|
|
99
|
-
try { $remote = Get-GcRemote -Root $root } catch { throw [GcException]::new("no remote — cannot delete $del remotely", $script:GcExitPre) }
|
|
100
|
-
}
|
|
101
|
-
$remoteExists = $false
|
|
102
|
-
if ($remote) { $remoteExists = [bool]@(Get-GcGit -Root $root -Argv @('ls-remote','--heads',$remote,$del)) }
|
|
103
|
-
if (-not $localExists -and -not $remoteExists) {
|
|
104
|
-
throw [GcException]::new("branch '$del' does not exist (local or $remote)", $script:GcExitPre)
|
|
105
|
-
}
|
|
106
|
-
if (-not (Test-GcCleanTree -Root $root)) {
|
|
107
|
-
throw [GcException]::new('tree is dirty — commit or stash before deleting a branch', $script:GcExitPre)
|
|
108
|
-
}
|
|
109
|
-
$deletedLocal = $false; $deletedRemote = $false
|
|
110
|
-
$localShaBefore = $null
|
|
111
|
-
if ($localExists) {
|
|
112
|
-
$merged = $false
|
|
113
|
-
try { Get-GcGit -Root $root -Argv @('merge-base','--is-ancestor',$del,$default) | Out-Null; $merged = $true } catch { }
|
|
114
|
-
if (-not $merged -and -not $Force) {
|
|
115
|
-
throw [GcException]::new("branch '$del' is unmerged into $default — deletion discards its commits; pass -Force to delete anyway (squash-merged branches legitimately need -Force: the commit lives in $default, not in branch ancestry)", $script:GcExitPre)
|
|
116
|
-
}
|
|
117
|
-
if (-not $merged -and $Force) { Write-GcWarn "deleting unmerged branch '$del' with -Force — its commits are NOT in $default's history" }
|
|
118
|
-
$localShaBefore = (Get-GcGit -Root $root -Argv @('rev-parse',$del) | Select-Object -First 1).Trim()
|
|
119
|
-
Invoke-GcGit -Root $root -Argv @('branch', $(if ($merged) { '-d' } else { '-D' }), $del)
|
|
120
|
-
$deletedLocal = $true
|
|
121
|
-
}
|
|
122
|
-
if ($remote -and $remoteExists) {
|
|
123
|
-
# remote gate mirrors the local one (adv-L1): fetch, then oid-compare
|
|
124
|
-
# when local existed, and the merged/-Force gate when remote-only.
|
|
125
|
-
Invoke-GcGit -Root $root -Argv @('fetch',$remote)
|
|
126
|
-
$remoteFetched = Test-GcRef -Root $root -Ref "refs/remotes/$remote/$del"
|
|
127
|
-
if ($remoteFetched) {
|
|
128
|
-
if ($localShaBefore) {
|
|
129
|
-
$remoteSha = (Get-GcGit -Root $root -Argv @('rev-parse',"$remote/$del") | Select-Object -First 1).Trim()
|
|
130
|
-
if ($remoteSha -ne $localShaBefore) {
|
|
131
|
-
throw [GcException]::new("remote $del ($remoteSha) differs from local ($localShaBefore) — verify before deleting", $script:GcExitPre)
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
$remoteMerged = $false
|
|
135
|
-
try { Get-GcGit -Root $root -Argv @('merge-base','--is-ancestor',"$remote/$del",$default) | Out-Null; $remoteMerged = $true } catch { }
|
|
136
|
-
if (-not $remoteMerged -and -not $Force) {
|
|
137
|
-
throw [GcException]::new("remote branch '$del' is unmerged into $default — pass -Force to delete it", $script:GcExitPre)
|
|
138
|
-
}
|
|
139
|
-
if (-not $remoteMerged -and $Force) { Write-GcWarn "deleting unmerged remote branch '$del' with -Force" }
|
|
140
|
-
}
|
|
141
|
-
Invoke-GcGit -Root $root -Argv @('push',$remote,'--delete',$del)
|
|
142
|
-
$deletedRemote = $true
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
Write-GcOk "deleted $del (local=$deletedLocal remote=$deletedRemote)"
|
|
146
|
-
Write-GcResult -Props @{ branch = $del; deleted_local = $deletedLocal; deleted_remote = $deletedRemote; force = [bool]$Force; action = 'deleted' }
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
$name = if ($Branch) { $Branch }
|
|
150
|
-
elseif ($Type -and $Slug) { "$Type/$Slug" }
|
|
151
|
-
else { throw [GcException]::new('give -Branch ''<type>/<slug>'' or -Type + -Slug', $script:GcExitPre) }
|
|
152
|
-
if (-not (Test-GcBranchName -Branch $name)) {
|
|
153
|
-
throw [GcException]::new("branch name rejected: $name", $script:GcExitPre)
|
|
154
|
-
}
|
|
155
|
-
if ($cur -eq $name) {
|
|
156
|
-
Write-GcOk "already on $name"
|
|
157
|
-
Write-GcResult -Props @{ branch = $name; action = 'no-op' }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
$exists = Test-GcRef -Root $root -Ref "refs/heads/$name"
|
|
161
|
-
if (-not $exists -and $Reuse) {
|
|
162
|
-
throw [GcException]::new("branch '$name' does not exist — -Reuse cannot create it; never reuse a merged branch name (§2); gc-branch a fresh <type>/<slug>", $script:GcExitPre)
|
|
163
|
-
}
|
|
164
|
-
if ($exists -and -not $Reuse) {
|
|
165
|
-
throw [GcException]::new("branch '$name' exists — pass -Reuse to switch to it", $script:GcExitPre)
|
|
166
|
-
}
|
|
167
|
-
if ($exists) {
|
|
168
|
-
Invoke-GcGit -Root $root -Argv @('switch',$name)
|
|
169
|
-
Write-GcOk "switched to existing $name"
|
|
170
|
-
Write-GcResult -Props @{ branch = $name; action = 'reused' }
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (-not $SkipSync) {
|
|
174
|
-
$null = Sync-GcDefaultBranch -Root $root -Default $default -CurrentBranch $cur
|
|
175
|
-
} else {
|
|
176
|
-
Write-GcInfo 'sync skipped (-SkipSync)'
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (Test-GcRef -Root $root -Ref "refs/heads/$default") {
|
|
180
|
-
Invoke-GcGit -Root $root -Argv @('switch','-c',$name,$default)
|
|
181
|
-
} else {
|
|
182
|
-
# unborn default (fresh repo, zero commits): create from current HEAD
|
|
183
|
-
Invoke-GcGit -Root $root -Argv @('switch','-c',$name)
|
|
184
|
-
Write-GcWarn "default branch '$default' is unborn — created $name from the current unborn HEAD"
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
$sha = (Get-GcGit -Root $root -Argv @('rev-parse','--short',"$name") | Select-Object -First 1).Trim()
|
|
188
|
-
Write-GcOk "created $name from $default @ $sha"
|
|
189
|
-
Write-GcResult -Props @{ branch = $name; base = $default; base_sha = $sha; action = 'created' }
|
|
190
|
-
} catch [GcException] {
|
|
191
|
-
Write-GcFail $_.Exception.Message
|
|
192
|
-
Write-GcResult -Code $_.Exception.Code -Props @{ message = $_.Exception.Message }
|
|
193
|
-
} catch {
|
|
194
|
-
Write-GcFail "unexpected: $($_.Exception.Message)"
|
|
195
|
-
Write-GcResult -Code $script:GcExitFail -Props @{ message = $_.Exception.Message }
|
|
196
|
-
}
|