oc-harness-setup 0.6.0 → 1.0.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/GUIDE.md CHANGED
@@ -1,77 +1,111 @@
1
- <h1 align="center">oc-harness-setup</h1>
2
- <p align="center"><strong>A compact OpenCode starter that runs a real loop, researches before it claims, keeps a ledger, cleans up after itself, and grows the next skill you need.</strong></p>
1
+ <h1 align="center">oc-harness-setup guide</h1>
3
2
 
4
- ## Install
3
+ ## How it works
5
4
 
6
- ```bash
7
- npx --yes oc-harness-setup setup
8
- ```
5
+ `setup` is a one-shot installer, not a runtime. It reads a file manifest, prints it, waits for your `y`, then writes into your OpenCode config directory. It ships no plugin and starts no process: everything it lays down is markdown, JSON, and one doctor script that Node runs.
6
+
7
+ **What lands where.** The config dir receives `opencode.jsonc` (merged, never replaced), `AGENTS.md`, `agents/` (10 seats), `commands/` (6 commands), `skills/` (6 skills), `reference/` (12 on-demand files behind one index), `scripts/harness-doctor.mjs`, `gitignore.template`, and `.docs/`. Your state dir is seeded once with `state/lessons.md` and `state/template.md` and is never overwritten afterwards.
8
+
9
+ **The loop it installs.** Brief → seat → skill → evidence → verify → memory. One routing table in `reference/flow.md` gives each seat its trigger, owned paths, and check. The verifier never authored the work it grades, and no seat certifies its own output.
10
+
11
+ **Consent gate.** The full manifest prints before anything moves: destination, incoming file count, and the policy line naming how many files update in place, how many are kept beside a `.new` copy, how many are added, and how many are skipped as identical. Nothing is written until you type `y`; `--dry-run` prints the same manifest and exits.
9
12
 
10
- First run prints a manifest of everything it will touch and waits for you to type `y`. It then lays the agents, commands, skills, references, doctor gate, and merged base config into your OpenCode config dir, seeds your `state/` dir, and ends on the harness doctor gate.
13
+ **Merge policy.** Your config is merged, not replaced. The pack owns runtime policy — the `permissions[]`/`policies[]` deny block, `default_agent: orchestrator`, and the skill allow entries — while your model, provider, keys, MCP servers, plugins and any other key survive untouched. A key you set that the pack also owns is reported rather than silently overruled.
11
14
 
12
- ## Why this starter
15
+ **Journal and uninstall.** Every written path is recorded in `oc-harness-setup.manifest.json` inside the config dir, with a SHA-256 per file. `setup --uninstall` reads that manifest and removes exactly what it lists, restoring the pre-install originals from its backup path.
13
16
 
14
- - Small on purpose: 9 agents, 6 skills, 12 on-demand references; the primary loads one, the rest wait for a trigger.
15
- - A loop that closes: loop -> worker -> verifier -> historian -> cleaner -> close; no self-verdicts.
16
- - Research that cites: researcher + search + canon; claims arrive sourced or `UNVERIFIED`.
17
- - Memory that survives: historian writes session state; `state/` is seeded and preserved on upgrade.
18
- - Cleanup that ships: cleaner removes this session's scratch; hygiene proves the tree clean.
19
- - Grows with you: `evolve` turns a repeated workflow, a user request, or an upstream feature into a skill, command, reference, seat, or config change — 1:1 and doctor-checked.
20
- - Reversible and fail-closed: manifest first, SHA-256 journal, uninstall restores originals, hard denies last.
17
+ **Doctor gate.** Every setup run ends by running `scripts/harness-doctor.mjs` against the config dir. It grades 18 laws and names the failing law with the fix. A failing doctor exits non-zero, and re-running setup is idempotent, so the recipe is: read the named fix, apply it, run again.
21
18
 
22
- ## What you get
19
+ ## Configuration
23
20
 
24
- - 9 agents with bounded reach: one coordinator, one verdict, and seven specialists that each own exactly one surface.
25
- - 6 skills behind 6 commands: close, evolve, fast, loop, search, and swarm.
26
- - 12 on-demand references behind a single index; load only the file a rule names.
27
- - 18-law doctor gate: every setup run ends on it, and failures name the check and the fix.
28
- - Consent-first install: the full manifest prints before anything moves, and `--dry-run` changes nothing.
29
- - Your settings and state survive: your model, provider, and keys are preserved while the pack owns runtime policy, and your state dir survives upgrades untouched.
30
- - No plugin, no model pins, no credentials.
21
+ Two environment variables, and the config keys the pack owns.
22
+
23
+ | Variable | Default | Effect |
24
+ | --- | --- | --- |
25
+ | `OPENCODE_CONFIG_DIR` | the path the OpenCode CLI reports, else the platform default under your config home | Overrides the config dir. Use it when the CLI cannot report a path. A relative value is rejected because the host echoes it verbatim. |
26
+ | `OPENCODE_CONFIG` | unset | The host's own single-file config pointer, honoured when present so the installer targets the config the host actually reads. |
27
+
28
+ | Key in `opencode.jsonc` | What the pack sets | Why |
29
+ | --- | --- | --- |
30
+ | `default_agent` | `orchestrator` | The routing seat is the entry point; an existing 0.3.x config keeps resolving. |
31
+ | `permissions[]` / `policies[]` | The deny block, last | Hard denies land after your rules so the gate cannot be widened by ordering. |
32
+ | `skill` allow entries | The six shipped skills | Retired skills are pruned; custom skills are left alone. |
33
+
34
+ Everything else in that file is yours. There are no model pins and no credentials anywhere in the pack.
31
35
 
32
36
  ## Commands
33
37
 
38
+ | Command | Arguments | What it returns | Exit |
39
+ | --- | --- | --- | --- |
40
+ | `oc-harness-setup setup` | none (the default when you pass no command) | Prints the manifest, waits for `y`, installs, ends on the doctor gate | `0` on a clean install, `1` when the doctor fails or an argument is unknown |
41
+ | `oc-harness-setup setup --dry-run` | — | The same manifest, and nothing is written | `0` |
42
+ | `oc-harness-setup setup --ci` | — | The manifest only, refusing to mutate | `0` |
43
+ | `oc-harness-setup setup --uninstall` | `--dry-run` / `--ci` also accepted | Removes exactly the manifest-listed files and restores originals; a preview writes nothing | `0`, or `1` on a doctor failure during setup |
44
+ | `oc-harness-setup --version` | — | The package version | `0` |
45
+ | `oc-harness-setup --help` | — | The usage block | `0` |
46
+
47
+ One example, the one worth running before a first install:
48
+
34
49
  ```bash
35
- npx --yes oc-harness-setup setup # full install (default when you pass no args)
36
- npx --yes oc-harness-setup setup --dry-run # print the manifest, touch nothing
37
- npx --yes oc-harness-setup setup --ci # print-only, refuse to mutate
38
- npx --yes oc-harness-setup setup --uninstall # remove exactly the manifest-listed files
39
- npx --yes oc-harness-setup --help # print usage
50
+ npx --yes oc-harness-setup setup --dry-run
40
51
  ```
41
52
 
42
- Set `OPENCODE_CONFIG_DIR` to override the config dir when the OpenCode CLI cannot report a path; otherwise setup uses the path from the CLI first, then the platform default under your config home. Restart OpenCode after install so the new agents, commands, and skills load.
53
+ It prints the destination config dir, the incoming file count split into new and already-identical, and the policy line — then exits without touching the disk. Restart OpenCode after a real install so the new agents, commands and skills load.
43
54
 
44
55
  ## Safe upgrade
45
56
 
46
57
  - Your `opencode.jsonc` settings, providers, MCP servers, plugins, and state survive.
47
58
  - `default_agent` stays `orchestrator`, so an existing 0.3.x config keeps resolving.
48
- - Unmodified 0.3.x agents, commands, skills, references, and scripts are retired.
49
- - Files you edited are archived under `state/archive/legacy-0.3.x/` instead of deleted, and reported.
59
+ - The installer is additive: an unmodified package file updates in place, while a file you edited or own is kept byte-identical and the new version lands beside it as `<name>.new`.
60
+ - Stale pack paths the new distro no longer ships are retired only when still byte-identical to the prior install (journaled, restorable on uninstall); anything you modified moves to `state/archive/legacy-0.3.x/` instead of being deleted, and is reported.
50
61
  - Stale `skill` allow entries for retired skills are pruned; custom skills are left alone.
51
- - The custom `/goal` looper ships as `/loop` (`commands/loop.md` + `skills/loop/SKILL.md`); a fresh install writes neither `commands/goal.md` nor `skills/goal`, and both `/loop` bodies name the host's native `/goal` session-continuation command (OpenCode 2.2.1) so the distinction is explicit.
62
+ - The custom `/goal` looper ships as `/loop` (`commands/loop.md` plus `skills/loop/SKILL.md`); a fresh install writes neither `commands/goal.md` nor `skills/goal`, and both `/loop` bodies name the host's native `/goal` session-continuation command so the distinction is explicit.
52
63
  - An upgrade settles a tracked `/goal` path only when a prior manifest entry lists it with a recorded hash, per file: matching bytes are retired, differing bytes are archived under `state/archive/legacy-0.3.x/`.
53
64
  - A `/goal` path the prior manifest never listed, an entry with no recorded hash, or an install with no prior manifest is left in place — so it can still collide with the native `/goal` name; remove it yourself if it does.
54
- - `setup --dry-run` previews it; `--uninstall` restores the pre-upgrade snapshot.
65
+ - `setup --dry-run` previews all of it; `--uninstall` restores the pre-upgrade snapshot.
55
66
 
56
67
  ## Grow it
57
68
 
58
69
  This starter grows through `evolve`: the smallest deliberate extension — one skill, command, reference, seat, or config change at a time, always 1:1 and doctor-checked. Repeat something twice, and `evolve` is how it earns a place.
59
70
 
60
- ## Requirements
71
+ ## Troubleshooting
72
+
73
+ **Setup refuses to start on a 1.x host.** Deliberate. 1.x uses a different config dialect, so the installer stops before writing anything. Upgrade OpenCode first.
74
+
75
+ **Setup warns on a 2.0 or 2.1 host.** The merged `permissions[]`/`policies[]` deny gate is not proven there, so the install proceeds with a warning rather than a claim. 2.2.0 or newer is the tested floor.
76
+
77
+ **The config dir cannot be found.** The CLI is asked first, then `OPENCODE_CONFIG_DIR`, then the platform default. Set `OPENCODE_CONFIG_DIR` explicitly — a relative value is rejected, so give an absolute path.
78
+
79
+ **The doctor fails.** It names the law and the fix. Apply the fix and re-run `setup`; it is idempotent. Removing `state/template.md`, for example, fails the doctor by name.
80
+
81
+ **The doctor did not run at all.** If `scripts/harness-doctor.mjs` is missing from the config dir, setup warns that the 18 laws are unverified and exits `0`. That is a warning, not a pass.
82
+
83
+ **A file I edited got a `.new` beside it.** By design: your bytes were kept and the new version landed next to them. Merge by hand, then delete the `.new`.
84
+
85
+ **An `apiKey` is rejected by the doctor.** A literal key fails; a pointer to one passes. Keep credentials out of `opencode.jsonc`.
86
+
87
+ **Uninstall left something behind.** Uninstall removes only manifest-listed paths. A file you created after the install, or one the manifest never listed, is not ours to delete and is kept.
88
+
89
+ **`/goal` collides with the host's native command.** A fresh install ships `/loop`, not `/goal`. If an old `/goal` pair predates the manifest, it is left in place — remove it yourself.
90
+
91
+ ## Limitations
61
92
 
62
- - Windows 10/11 only; macOS and Linux are not supported.
63
- - Node.js 22 or newer, the only runtime requirement with zero runtime dependencies.
64
- - OpenCode 2.2.0 or newer (the tested floor). A 2.0/2.1 host warns — the merged `permissions[]`/`policies[]` deny gate is unproven there — and a 1.x host is refused before anything is written (different config dialect).
65
- - PowerShell 7 for the doctor gate; without it the doctor reports skipped, never passed.
93
+ - Windows 10/11 only. macOS and Linux are not supported, and the installer refuses rather than half-working.
94
+ - OpenCode 2.2.0 or newer is the tested floor; 2.0/2.1 warns, 1.x is refused before anything is written.
95
+ - It is an installer, not a manager: there is no `update` command, no daemon, and no runtime. Re-running `setup` is the upgrade path.
96
+ - It cannot verify a law it did not ship. A missing doctor script is reported as unverified, never as green.
97
+ - It never deletes a file it did not install. Leftovers you own stay yours, including a colliding `/goal`.
98
+ - No plugin, no model pins, no credentials: if you want a plugin or a pinned model, that is your config to write.
99
+ - The pack owns runtime policy keys; a key you set that the pack also owns is reported rather than merged both ways.
66
100
 
67
101
  ## Links
68
102
 
69
- - Source: [nathwn12/oc-collections](https://github.com/nathwn12/oc-collections/tree/main/packages/oc-harness-setup) — the npm package remains individually installable.
70
- - [Published package](https://www.npmjs.com/package/oc-harness-setup)
71
- - [Changelog](../CHANGELOG.md)
72
- - [Releases](https://github.com/nathwn12/oc-collections/releases)
73
- - [Issues](https://github.com/nathwn12/oc-collections/issues)
74
- - [License](../LICENSE)
103
+ - Source: <https://github.com/nathwn12/oc-collections/tree/main/packages/oc-harness-setup>
104
+ - Published package: <https://www.npmjs.com/package/oc-harness-setup>
105
+ - Changelog: [CHANGELOG.md](../CHANGELOG.md)
106
+ - Releases: <https://github.com/nathwn12/oc-collections/releases>
107
+ - Issues: <https://github.com/nathwn12/oc-collections/issues>
108
+ - License: [LICENSE](../LICENSE)
75
109
 
76
110
  <!-- nathwn12 house footer: identical in every repo. Do not edit. -->
77
111
  <p align="center">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-harness-setup",
3
- "version": "0.6.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "oc-harness-setup": "bin/cli.js"
@@ -42,7 +42,7 @@
42
42
  "url": "git+https://github.com/nathwn12/oc-collections.git",
43
43
  "directory": "packages/oc-harness-setup"
44
44
  },
45
- "description": "A general OpenCode starter for Windows: 9 agents on a dispatch loop, 6 skills, fresh-verdict research, state memory, cleanup crew, and self-extension tooling - installed by one explicit command.",
45
+ "description": "A general OpenCode starter for Windows: 10 seats on a dispatch loop, 6 skills, fresh-verdict research, lesson memory, leave-no-trail hygiene, and self-extension tooling - installed by one explicit command.",
46
46
  "keywords": [
47
47
  "opencode",
48
48
  "agents",
@@ -4,13 +4,13 @@
4
4
 
5
5
  - `canon.md` — locked research source canon and citation bar.
6
6
  - `context.md` — context budget, delegation detail, mechanisms, worked examples.
7
- - `enforcement.md` — network reach and enforcement examples.
8
- - `flow.md` — which seat fires on which trigger, and when a new seat is earned.
7
+ - `enforcement.md` — hard denies, network reach, enforcement examples.
8
+ - `flow.md` — the one seat routing table, the seat law, `OUT:` definitions, lane overlap.
9
9
  - `gates.md` — the five repo-local gates the harness requires.
10
10
  - `harness.md` — who writes what, what ships, how it versions.
11
- - `hygiene.md` — scratch discipline and clean-pass proof.
12
- - `memory.md` — session and harness memory ownership and format.
13
- - `models.md` — bulk-vs-verdict tiering, binding, and catalog for the doctor check.
14
- - `phases.md` — context moves at phase boundaries.
11
+ - `hygiene.md` — scratch discipline, the close trash sweep, checkout and freshness proof.
12
+ - `memory.md` — graph-first codebase memory, ADRs, lessons; session state is retired.
13
+ - `models.md` — bulk-vs-verdict tiering, binding, and the catalog for the doctor check.
14
+ - `phases.md` — the context move to make at a phase boundary.
15
15
  - `repos.md` — repo lifecycle, location, commits, delivery, CI policy.
16
16
  - `tools.md` — host-tool registry; native only when listed here.
@@ -1,35 +1,33 @@
1
1
  # Context detail
2
- Moved verbatim from AGENTS.md root — read when the working set, delegation detail, mechanisms, or worked examples matter.
2
+ Read when the working set, delegation detail, mechanisms, or worked examples matter.
3
3
 
4
4
  <example>Good: slice names one file plus its check. Good: verify cites command plus output. Bad: two artifacts in one slice.</example>
5
5
 
6
6
  ## Context budget
7
7
  - Root ceiling is 200 lines, target 120. Quality outranks brevity: a decision belongs in the root, detail lives behind a pointer. Cut filler, never a rule.
8
- - Skills stay <500 lines; detail sits behind pointers.
9
- - State is markdown; load index first, detail on demand.
8
+ - Skills stay <500 lines; detail sits behind pointers. Every reference targets 50 lines and hits 80 at worst.
9
+ - State is markdown; load the index first, detail on demand.
10
10
  - Engineer the working set down; never fill the window.
11
- <example>Good: new rule goes behind a pointer. Good: phase ends so context resets. Bad: pasting forty files into the trace.</example>
11
+ <example>Good: a new rule goes behind a pointer. Good: a phase ends so context resets. Bad: pasting forty files into the trace.</example>
12
12
 
13
- <example>Good: new network reach earns an agent. Good: new doc type reuses worker. Bad: adding a coder seat.</example>
13
+ <example>Good: new network reach earns a seat. Good: a new doc type reuses `code-agent`. Bad: adding a seat for a craft.</example>
14
14
 
15
+ ## Lanes
15
16
  - One write lane per artifact; parallel reads freely.
16
- - Ten live lanes is the ceiling; past ten, queue. The seam decides whether a split is valid; the ceiling decides how many run.
17
- - Two agents on one file is a collision, not a review. One writer per artifact, always; a second reader is free.
18
- - Parallel writes only across disjoint file sets behind an integration point with a fresh verifier.
19
- - Every brief carries objective, output format, tool/source guidance, task boundaries.
17
+ - Twenty-four live lanes is the ceiling; past twenty-four, the rest queue. The seam decides whether a split is valid; the ceiling decides how many run.
18
+ - Two seats on one file is a collision, not a review. One writer per artifact, always; a second reader is free.
19
+ - Parallel writes run only across disjoint path sets, behind an integration point with a fresh `verify-agent`.
20
+ - Every brief carries objective, output format, tool/source guidance, task boundaries, a time budget, and the check that proves the end state.
20
21
  - Return a summary plus `file:line`; raw reads stay in the child.
21
- - Cost: multi-agent runs ~15× single-chat tokens — spend them on isolation and review, never on parallel writes to one file.
22
- <example>Good: forty-file sweep returns a summary. Good: two disjoint packages merge behind one verifier. Bad: two workers editing one file.</example>
22
+ - Cost: a multi-agent run spends a multiple of a single chat — spend it on isolation and review, never on parallel writes to one file.
23
+ <example>Good: a forty-file sweep returns a summary. Good: two disjoint packages merge behind one `verify-agent`. Bad: two lanes editing one file.</example>
23
24
 
24
25
  ## Mechanisms
25
- - Need automation? Prefer, in this order: an installed plugin → an installed MCP → an existing CLI or npm tool → a small plugin you write → a small MCP you write.
26
- - A loose script is the last resort: allowed only when none of those five fit, and it must state in its header why the five failed.
27
- - Adding a mechanism is a harness change, not a task step: it gets its own brief and its own proof, never a side effect of finishing something else.
28
- - Whatever no mechanism can reach is an instruction, and is labeled as one — never dressed up as enforcement.
29
- - Installing tooling is ingress — it pulls code in and sends nothing out, so the outward gate is unchanged. Name the package and the reason in the brief.
30
- - Harness and task plumbing may still not add a script: the ladder above holds, and a script stays the last resort.
31
- - Exception: a one-shot ceremony script under the temp session dir is a deliverable, not plumbing; a 2FA click needs a visible terminal, so the script is allowed and is deleted after the run.
32
- - A script the owner asks for is a deliverable, not infrastructure: it is the product, it is never wired into the harness, and it carries a header saying what it is for.
33
- <example>Good: a missing capability becomes a plugin ref in config. Good: an existing CLI does the job and gets used. Bad: a one-off script that nothing proves and nobody owns.</example>
26
+ - Need automation? Prefer, in this order: a tool already installed on the machine → a package you add through the package manager → a small extension to OpenCode → a script you write and prove.
27
+ - A loose script is the last resort: allowed only when none of those fit, and it states in its header why they failed.
28
+ - Adding a mechanism is a harness change, not a task step: its own brief, its own proof, never a side effect of finishing something else.
29
+ - Whatever no mechanism can reach is an instruction, labelled as one — never dressed up as enforcement.
30
+ - Installing tooling is ingress: it pulls code in and sends nothing out, so the outward gate is unchanged. Name the package and the reason in the brief.
31
+ - Exception: a one-shot ceremony script under the temp session dir is a deliverable, not plumbing; it is deleted after the run, and it carries a header saying what it is for.
34
32
 
35
- <example>Good: `pytest -q` cited passing. Good: fresh verifier returns pass plus evidence. Bad: claiming green with no run.</example>
33
+ <example>Good: `pytest -q` cited passing. Good: a fresh `verify-agent` returns pass plus evidence. Bad: claiming green with no run.</example>
@@ -1,6 +1,10 @@
1
1
  # Enforcement detail
2
- Moved verbatim from AGENTS.md root — read when network reach or enforcement examples matter.
2
+ Read when a hard deny, network reach, or an enforced-versus-instructed boundary matters.
3
3
 
4
- - One seat holds the web tools. `ops` may fetch through shell when a brief requires it — the one sanctioned exception. Every other agent's network shell verbs are denied. (by design)
4
+ - `policies` `tool.use` denies are hard: `*.env`, `*.env.*`, `*secrets*`, on read and on edit. They override ask and allow, and they are the only boundary in this pack a mechanism holds.
5
+ - One seat holds open-web reach: `research-agent`. A shell fetch by any other seat is denied; the single sanctioned exception is a brief that names the endpoint and the reason, run by `host-agent`.
6
+ - Outward verbs — push, publish, release, PR, merge, approve — are owner-gated. This pack grants none, so `git-agent` and `release-agent` prepare and prove, and the owner takes the final act.
7
+ - Code Mode (`execute`) carries its own `fetch`, so it is the one route that stays narrow: a seat holds it only when its agent file grants it.
8
+ - The rest is instructed, not enforced: brief-scoped path confinement, unprinted secret values, lane counts, and the no-redirection write rule. Drift there is caught by a check or a review, never by a claim.
5
9
 
6
- <example>Good: `read:*.env` denied with Blocked by configuration policy. Good: worker denied `git push`. Bad: claiming a network boundary when shell is open.</example>
10
+ <example>Good: `read:*.env` denied with Blocked by configuration policy. Good: `code-agent` denied `git push`. Bad: claiming a network boundary when shell is open.</example>
package/reference/flow.md CHANGED
@@ -1,19 +1,39 @@
1
- # Flow — which seat fires on which trigger
2
- - Orient: `historian` reads memory; `ops` reports the live surface when a server, port, or branch is in play.
3
- - Slice: `orchestrator`.
4
- - Build: `worker` writes; `worker` or `verifier` runs the named commands.
5
- - Review: `critic` reads the diff; `verifier` returns pass/fail.
6
- - Commit: `ops` runs git mechanics in product repos; `maintainer` commits the harness; neither pushes.
7
- - Close: `historian` writes state, `cleaner` sweeps scratch, then the `close` ceremony.
8
- - Research: `researcher`; Host: `ops`.
9
- - Extend: `maintainer` + `evolve`.
10
- - A trigger with no seat is a gap: report it, never improvise a seat mid-pass.
11
- - A seat fired outside its trigger is a defect: name the trigger it should have had.
1
+ # Flow — which seat fires, and the only roster
2
+
3
+ > A seat exists only where a seam does. A seam is exactly one of three kinds: **capability** (a reach no other seat holds), **permission** (a blast radius that must not sit in a routine seat), or **independence** (a verdict that must not come from the author). A seat that cannot name its seam in one clause does not exist; its work is a mode inside a seat that has one. New reach earns a seat. New craft never does.
4
+
5
+ ## Seat routing — the only copy
6
+
7
+ | seat | seam | fires when | owns | not this (→ seat) | check |
8
+ |---|---|---|---|---|---|
9
+ | `code-agent` | permission (sole product-repo writer) | product-repo code, doc or packaging change | changed paths | harness change (→ `harness-agent`) | repo check exit cited |
10
+ | `verify-agent` | independence (verdict never from the author) | verdict or outward-text gate needed | findings + pass/fail | authorship of the work (→ owning seat) | cited output on pre-merge ref |
11
+ | `research-agent` | capability (sole open-web reach) | external fact needed | cited synthesis | local-only check (→ `host-agent`) | URL + date cited |
12
+ | `host-agent` | permission (sole host mutator) | host, process or file act | action log | product-repo edit (→ `code-agent`) | recovery path cited |
13
+ | `surface-agent` | independence (live surface from a seat that changed nothing) | live surface needed before diagnosis or close | service/repo table | diagnosis itself (→ owning seat) | commands cited |
14
+ | `harness-agent` | permission (sole harness writer) | harness structure change | files changed | product-repo change (→ `code-agent`) | line count + checks |
15
+ | `git-agent` | permission (sole outward git, non-release) | non-release commit or branch mechanics | commit/branch | release arc (→ `release-agent`) | preflight receipt cited |
16
+ | `secret-agent` | capability (sole secret reader) | secret or env value needed | redacted diff + key inventory | printing a value (→ never) | check cited, no value printed |
17
+ | `release-agent` | permission (irreversible outward) | release tag, publish or install | tag/publish receipt | non-release git (→ `git-agent`) | registry equals tag + scratch run |
18
+ | `memory-agent` | permission (sole lesson-record writer) | lesson or archive write needed | lessons + archive | verdict (→ `verify-agent`) | write cited with path |
19
+
20
+ `OUT:` names the artifact this seat produces, then the paths it may write.
21
+
22
+ A seat that writes no files declares `OUT: <artifact>; none (read-only)`; a verifier diffs the paths part against actual changed paths, and `none (read-only)` is conforming.
23
+
24
+ A brief goes to exactly one owning seat; the narrower seam wins on overlap; a seat finding work outside its seam stops and reports instead of absorbing it.
25
+
26
+ A trigger with no seat is a gap: report it, never improvise a seat mid-pass. A seat fired outside its trigger is a defect: name the trigger it should have had.
12
27
 
13
28
  ## When a new seat is earned
14
- - A chokepoint — one seat's reach is the queue — earns a new seat: one trigger, one reach, one artifact, one check, never a shared file.
15
- - Slowness first gets a cheaper model, then a cleaner seam; only a missing capability earns a seat.
16
- - Friction first gets a mechanism — an installed plugin, MCP or CLI — before any seat.
17
- - Confusion means ownership is unclear: fix this table or name one writer, never add a seat.
18
- - Rot means a fact aged out: `historian` dates and re-verifies it; that is maintenance, not a new seat.
19
- - Overlap or divergence means merge the lanes or re-cut the seam; another seat makes it worse.
29
+ - A chokepoint — one reach is the queue — earns a seat: one trigger, reach, artifact, check.
30
+ - Slowness gets a cheaper model and a cleaner seam first; friction gets a mechanism first.
31
+ - Confusion means fix this table or name one writer; rot means `memory-agent` re-verifies; overlap means merge lanes. Never add a seat for these.
32
+
33
+ ## Deferred
34
+ - `deferred` = a required seat's evidence was forbidden or postponed by the owner: record `UNVERIFIED (owner-deferred): <claim> — resume: <condition>`. It never blocks `done`; `parked` stays only on the owner's explicit order.
35
+ - Ceremony follows the autonomy rule in `AGENTS.md`: reversible work proceeds at full speed; only irreversible acts gate.
36
+
37
+ ## Lane overlap
38
+ - Snapshot live lanes first (`GET /api/session/active`); classify from metadata only, never source or secrets. Disjoint scopes proceed immediately.
39
+ - Overlapping scopes: the older lane continues, the newer parks before it writes, and the disposition is recorded. No two writers on one artifact.
@@ -1,15 +1,13 @@
1
1
  # Harness: who writes what, what ships, how it versions
2
- - Let `maintainer` write harness content, `cleaner` sweep scratch, and `historian` write memory; the outward act stays with the owner.
3
- - Split the two seats by object: `maintainer` changes what the harness is, `cleaner` removes what it left behind — content versus residue.
4
- - Route every harness change to `maintainer`; route every scratch file to `cleaner`.
2
+ - Let `harness-agent` write harness content, `host-agent` sweep scratch, and `memory-agent` write memory; the outward act stays with the owner.
3
+ - Split the seats by object: `harness-agent` changes what the harness is, `host-agent` removes what it left behind — content versus residue.
4
+ - Route every harness change to `harness-agent`; route every scratch file to `host-agent`.
5
5
  - Package publish set: `AGENTS.md`, `README.md`, `GLOSSARY.md`, `agents/`, `skills/`, `commands/`, `reference/`, plus the sanitized `opencode.jsonc` and `state-seed/`; `.docs/` records decisions like unwired routing.
6
6
  - Publish never: live `state/`, personal notes, `tools/`, secrets (`*.env`, `*secrets*`, credential files), or `.git/`.
7
- - Tag package releases as `vMAJOR.MINOR.PATCH`.
8
- - Write one `CHANGELOG.md` line per tag naming what changed and why; create it on the first tag if absent.
7
+ - Tag package releases as `vMAJOR.MINOR.PATCH`, and write one `CHANGELOG.md` line per tag naming what changed and why; create it on the first tag if absent.
9
8
  - Keep `AGENTS.md` to 200 lines hard, 120 target; keep every reference to 50 lines target, 80 hard.
10
9
  - Keep commands and skills 1:1; create no command without a skill and no skill without a command.
11
- - Grant a new agent its seat only for a new reach class, never for a new craft.
12
- - Add each new seat as one roster line, never as a new section.
10
+ - Grant a new seat only for a new reach class, never for a new craft; add it as one table row in `reference/flow.md`, never as a new section.
13
11
  - Write paths with home and temp variables, never a literal home directory; the user repo root is defined once in `reference/repos.md`.
14
- - How it grows: `evolve` decides reference vs skill vs agent vs config; one extension at a time; commands and skills stay 1:1; a new seat needs a new reach class, never a new craft.
12
+ - How it grows: `evolve` decides reference vs skill vs seat vs config; one extension at a time; a new seat needs a new reach class, never a new craft.
15
13
  - Windows 10/11 only: resolve the user via `%USERPROFILE%` and `%TEMP%`, never a literal path or username.
@@ -1,13 +1,32 @@
1
1
  # Hygiene — leave no trail
2
2
  - Send every scratch output to `%TEMP%\opencode\<session-id>\`; write nothing scratch into a repo.
3
- - On Windows treat as trash: agent-created untracked files, `test-results/`, `playwright-report/`, `.vite/`, traces, scratch screenshots, probe scripts, `.dev*.log`, and temp notes past their use.
3
+ - Never write a file through shell redirection or a heredoc; the `edit` action is the one write route, and the brief names the path.
4
+ - Treat as trash: agent-created untracked files, `test-results/`, `playwright-report/`, `.vite/`, traces, scratch screenshots, probe scripts, `.dev*.log`, and temp notes past their use.
4
5
  - Treat as not trash: tracked files, owner-installed `node_modules`, shipped `dist/`, another session's state, and the owner's own files.
5
6
  - Delete each trash file in the same turn it stops being needed; a scratch file outliving its turn is a defect.
6
7
  - Stop the process writing a log before deleting that log.
7
- - Name every deletion in the return, with paths.
8
+ - Name every deletion in the return, with paths. Name another agent's or session's artifacts before deleting any of them; never delete unnamed.
8
9
  - Delete only what this session created. Older scratch belongs to the session that made it: name it in the return, never sweep it.
9
- - Name another agent's or session's artifacts before deleting any of them; never delete unnamed.
10
10
  - Prove the pass clean: `git status --short` empty for every repo touched.
11
- - Prove scratch clean: the temp session dir empty or holding only named evidence for a pass still open.
11
+ - Prove scratch clean: the temp session dir empty, or holding only named evidence for a pass still open.
12
12
  - Report a duplicate clone, a retired prototype, or a stray branch; never delete one unasked.
13
13
  - Treat cleanup as a delivery step, never as a courtesy.
14
+
15
+ ## Trash sweep — runs at every close, no prompt needed
16
+ Delete, then report each class with its byte count:
17
+ 1. `%TEMP%\opencode\<session>\*` — this pass's scratch, staged payloads, receipts, probe output, generated scripts.
18
+ 2. Orphaned `%TEMP%\opencode\*` directories with no live session.
19
+ 3. Lane-written logs, traces, dumps and throwaway artifacts under the session scratch root.
20
+ 4. A stale global install or package cache — **only** where it would pin an old version of an owned package, so the next install proves new bytes.
21
+
22
+ Never delete: repos, checkouts, `state\`, `reference\archive\`, or any owner file. A path outside classes 1–4 is reported, not removed.
23
+
24
+ ## Local checkout at close
25
+ - End on `main`, clean, equal to `origin/main`: `git rev-parse --abbrev-ref HEAD`, `git status --short`, then `git fetch` and `git rev-list --left-right --count main...origin/main` reading `0 0`.
26
+ - Delete local branches already merged into `origin/main` (`git branch --merged origin/main`); keep unmerged ones and name them.
27
+ - A branch earns its place only while in development, on hold, or parked with a named resume condition. Prune the settled one with proof: `git tag archive/<branch>-<sha> <sha>`, then `git branch -D <branch>` — cite the sha and the tag that holds it.
28
+ - Uncommitted work, or a commit that exists nowhere else: report it and leave the clone alone — never force except `--force-with-lease` against a freshly read sha.
29
+ - `git status` clean upstream conceals a dirty working copy: check the clone, not the remote.
30
+
31
+ ## Close receipt — branches
32
+ Three lines, and `none` rather than an omission: **kept** (each branch with its resume condition), **pruned** (each branch with the sha and the ref that preserves it), **untouched** (each repo the pass deliberately stayed out of).
@@ -1,13 +1,25 @@
1
- # Memory — historian writes, orchestrator hands over
2
- - Only `historian` writes memory; `orchestrator` hands it the deltas in the same turn, never later.
3
- - Session files live at explicit dynamic paths: `%USERPROFILE%\state\<session-id>\state.md`, `plan.md`, `handoff.md`; harness assets in `state/`; no literal user or home path.
4
- - Harness memory: `state/` in the config dir holds `lessons.md` and `template.md`.
5
- - Archive: `state/archive/<yyyy-mm>.md` holds superseded lines.
6
- - Write `state.md` in the fixed key order: `id`, `title`, `status`, `goal`, `next`, `artifacts`, `decisions`, `open`.
7
- - Let the user decide what a lesson says; `historian` records, dedupes, and archives it.
8
- - Let `maintainer` own harness definition and `historian` own harness memory; neither writes the other's files.
9
- - Stamp every recorded fact with `verified: YYYY-MM-DD`; after 30 days it is `STALE`, then re-verify or archive it.
10
- - Keep behavioural lessons non-expiring; let facts expire. Local knowledge is not permanently right.
11
- - Archive, never delete: move superseded lines to the monthly archive, then report each move.
12
- - Write a repo-local handoff only when the brief names the exact path.
13
- - Never invent an id; take it from the `session_rename` return.
1
+ # Memory — two files, dated, nothing else
2
+
3
+ ## What persists
4
+ - `state/lessons.md` in the config directory. One dated line per lesson, written by `memory-agent` only; the orchestrator hands over the delta in the same turn, in one write.
5
+ - `state/archive/<yyyy-mm>.md` holds superseded lessons, moved there and then pruned; every move is reported.
6
+ - That is the whole model. There is no database, no index, no per-session store.
7
+
8
+ ## A lesson is one DO and one DON'T
9
+ - DO: the behaviour, the check that proves it, and the artifact that governs it — `verified: YYYY-MM-DD`.
10
+ - DON'T: the mistake, and the red result it produced — same stamp, same citation.
11
+ - Name the governing agent, skill or command. A lesson that mints a new artifact, seat or process is not a lesson; it is a proposal.
12
+ - Behavioural lessons do not expire. Facts about a tool, a version or a path do: after 14 days a fact is `STALE` until re-verified or archived.
13
+ - Recall is grep or read over those two files. It is reference, never instruction.
14
+
15
+ ## Decisions live with the repository
16
+ - Architecture decisions belong in that repository's ADR, beside the code they govern. There is no second decisions file in the harness.
17
+ - An ADR records what was decided and why. It is not a changelog and not a status board.
18
+
19
+ ## Session state is retired
20
+ - No per-session state directory, no `state.md`, no handoff file, no session id written to disk.
21
+ - Never write `%USERPROFILE%\state\<session-id>\*`. What a session knew and did not record in a lesson or an ADR is gone by design.
22
+ - A context move travels as a brief handed to the next seat, never as a file left behind.
23
+
24
+ ## Optional upgrade
25
+ - A user who wants repository-wide semantic lookup can add a graph-backed codebase index later; nothing in this pack depends on one, and no rule here presumes it.
@@ -4,7 +4,7 @@ No model pins ship. Every seat inherits the session model until the user binds o
4
4
 
5
5
  ## Tiers
6
6
 
7
- - **Bulk tier (cheap).** Drafting, workers, research, audits, iteration. Fan out freely; never trade speed for token anxiety here.
7
+ - **Bulk tier (cheap).** Drafting, build lanes, research, audits, iteration. Fan out freely; never trade speed for token anxiety here.
8
8
  - **Verdict tier (costly).** Judgement only: verdicts, reviews, design audits, anything where being wrong is expensive. Never use it for bulk reading or drafting.
9
9
 
10
10
  ## How to bind
@@ -1,23 +1,13 @@
1
- # Phases — Matt Pocock, ask-matt/PHASE-BOUNDARIES.md, ~/.agents/skills, read 2026-10-20
2
- - Decide the context move at a phase boundary, never mid-phase.
3
- - A phase ends when you think "ok, we're done with that".
4
- - Mid-phase: continue, or split leftover work to subagents.
5
- - Never compact mid-phase: it loses the thread.
6
- - Option 1 — Continue: stay in session, no context switch.
7
- - Option 2 — Clear (/clear): empty the window, start from nothing.
8
- - Option 3 — Handoff (/handoff): write a portable file, seed a session anywhere.
9
- - Option 4 — Subagent: send the task to its own window, take back a report.
10
- - Option 5 — Compact (/compact): compress context, seed a fresh session.
11
- - Q1: Can you continue? Next phase needs this phase verbatim, or ~150k fits.
12
- - Rule out Continue first: it costs nothing and loses nothing.
13
- - Q2: Is this context disposable? If yes, /clear.
14
- - Never /clear relevant context: the why never comes back from the diff.
15
- - Q3: Must something travel? New harness, new directory, colleague, forked side task.
16
- - If nothing travels, skip /handoff.
17
- - Q4: Can it run AFK with no steering? If yes, use a subagent.
18
- - Otherwise /compact with an instruction naming the next phase.
19
- - Treat /compact as the default, never the first reach.
20
- - Every non-Continue move turns a primary source into a lossy secondary source.
21
- - Pay lossiness only when staying costs more than it saves.
22
- - Ask the questions in order; the first yes wins.
1
+ # Phases — the context move at a boundary
2
+ - Decide the move at a phase boundary, never mid-phase. A phase ends when the work stops being the same work.
3
+ - Mid-phase: continue, or split the leftover to a lane. Never compact mid-phase: it loses the thread.
4
+ - Four moves: **Continue** (stay, no switch), **Clear** (empty window, start from nothing), **Subagent** (its own window, a report comes back), **Compact** (compress, seed a fresh session).
5
+ - Ask in order, first yes wins:
6
+ 1. Can you continue? The next phase needs this one verbatim, or the window still fits — continue, it costs nothing and loses nothing.
7
+ 2. Is this context disposable? Then clear. Never clear context whose reason never comes back from a diff.
8
+ 3. Can it run unattended with no steering? Then a subagent.
9
+ 4. Otherwise compact, with an instruction naming the next phase.
10
+ - Every move other than Continue turns a primary source into a lossy secondary one. Pay that only when staying costs more than it saves.
11
+ - Nothing travels as a state file: what must survive is written into the next brief, or into a lesson or an ADR. Session state is retired.
12
+ - Treat compact as the default, never the first reach. At close, the single compaction is terminal by design.
23
13
  - Accept taste: the same boundary can go two ways on two days.
@@ -6,30 +6,31 @@ A tool is native only when this file lists it: installed, named, and reachable b
6
6
 
7
7
  | Tool | Purpose | Who uses it |
8
8
  |---|---|---|
9
- | `git` | version control, diffs, history | any shell-bearing agent |
10
- | `node` | run JavaScript, parse JSON, drive npm tooling | `worker`, `ops`, `verifier` |
11
- | `python` | scripts the owner requests, one-off data work | `worker`, `ops` |
12
- | `rg` | recursive regex search when the `grep` tool is too coarse | `worker`, `ops`, `verifier` |
13
- | `jq` | exact JSON querying: config, MCP payloads, manifests | any shell-bearing agent |
14
- | `ast-grep` | structural search and rewrite across code | `worker`, `verifier` |
15
- | `difft` | structural diff for reviewing a large change: `--display inline --exit-code` | `verifier` |
16
- | `lychee` | verify that documentation URLs still resolve: `--no-progress --cache` | `worker` |
17
- | `PSScriptAnalyzer` | lint a PowerShell script written as an owner deliverable | `worker` |
18
- | `Pester` | test that script: `Invoke-Pester -CI` | `worker` |
19
- | `opencode api` | request the local server directly, using stored discovery and auth: `GET /api/session/active` lists live lanes; `POST /api/session/<id>/interrupt?resume=false` stops one; `POST /api/session/<id>/prompt` steers or queues. Body flag is `--data`, never `--body` | `ops` |
20
- | `opencode service status` | prints the running server address | `ops` |
21
-
22
- - `orchestrator` has no shell: it routes `opencode api` work through `ops`.
9
+ | `git` | version control, diffs, history | any shell-bearing seat |
10
+ | `node` | run JavaScript, parse JSON, drive npm tooling | `code-agent`, `host-agent`, `verify-agent` |
11
+ | `python` | scripts the owner requests, one-off data work | `code-agent`, `host-agent` |
12
+ | `rg` | recursive regex search when the `grep` tool is too coarse | `code-agent`, `host-agent`, `verify-agent` |
13
+ | `jq` | exact JSON querying: config, payloads, manifests | any shell-bearing seat |
14
+ | `ast-grep` | structural search and rewrite across code | `code-agent`, `verify-agent` |
15
+ | `difft` | structural diff for reviewing a large change: `--display inline --exit-code` | `verify-agent` |
16
+ | `lychee` | verify that documentation URLs still resolve: `--no-progress --cache` | `code-agent` |
17
+ | `PSScriptAnalyzer` | lint a PowerShell script written as an owner deliverable | `code-agent` |
18
+ | `Pester` | test that script: `Invoke-Pester -CI` | `code-agent` |
19
+ | `opencode api` | request the local server directly, using stored discovery and auth: `GET /api/session/active` lists live lanes; `POST /api/session/<id>/interrupt?resume=false` stops one; `POST /api/session/<id>/prompt` steers or queues. Body flag is `--data`, never `--body` | `host-agent` |
20
+ | `opencode service status` | prints the running server address | `host-agent` |
21
+
22
+ - The default session has no shell: it routes `opencode api` work through `host-agent`.
23
23
 
24
24
  ## Installing
25
25
 
26
- - Installation is `ops` work and the brief names the package. Installing is ingress; the outward gate is unchanged.
26
+ - Installation is `host-agent` work and the brief names the package. Installing is ingress; the outward gate is unchanged.
27
27
  - Add the row here in the same brief that installs it. A tool that is installed but unlisted is not native — a cold session will never reach for it.
28
28
  - Remove a row when its tool is uninstalled; a stale row is a dangling reference.
29
29
  - A tool earns its row by serving a named need. A tool with no named need is not installed, however good it is.
30
+ - This pack ships no server and no extension: a bare install has only OpenCode's built-in tools, and every row above is something the user adds deliberately.
30
31
 
31
32
  ## Considered and rejected
32
33
 
33
34
  - `markdown-link-check` — redundant with `lychee`, which caches and runs offline.
34
35
  - LLM-driven deny hooks — read for reference only; a nondeterministic decision proves the hook exists without being a guard to rely on.
35
- - A second page-driving MCP — rejected where it duplicates the repo's Playwright gate and the installed browser surface.
36
+ - A second page-driving tool — rejected where it duplicates the repo's own browser gate.