oc-harness-setup 0.3.3 → 0.4.0

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.
Files changed (136) hide show
  1. package/.docs/unwired-routing.md +16 -15
  2. package/AGENTS.md +105 -68
  3. package/CHANGELOG.md +91 -0
  4. package/GLOSSARY.md +46 -0
  5. package/LICENSE +1 -1
  6. package/README.md +48 -60
  7. package/agents/cleaner.md +86 -0
  8. package/agents/critic.md +79 -0
  9. package/agents/historian.md +92 -0
  10. package/agents/maintainer.md +106 -0
  11. package/agents/ops.md +69 -0
  12. package/agents/orchestrator.md +48 -18
  13. package/agents/researcher.md +72 -0
  14. package/agents/verifier.md +84 -0
  15. package/agents/worker.md +87 -0
  16. package/bin/cli.js +349 -133
  17. package/commands/close.md +11 -0
  18. package/commands/evolve.md +11 -0
  19. package/commands/fast.md +11 -0
  20. package/commands/goal.md +11 -0
  21. package/commands/search.md +11 -0
  22. package/commands/swarm.md +11 -0
  23. package/opencode.jsonc +39 -79
  24. package/package.json +13 -6
  25. package/reference/README.md +12 -14
  26. package/reference/canon.md +71 -0
  27. package/reference/context.md +35 -0
  28. package/reference/enforcement.md +6 -0
  29. package/reference/flow.md +19 -0
  30. package/reference/gates.md +23 -0
  31. package/reference/harness.md +15 -0
  32. package/reference/hygiene.md +13 -0
  33. package/reference/memory.md +13 -0
  34. package/reference/models.md +19 -24
  35. package/reference/phases.md +23 -0
  36. package/reference/repos.md +49 -0
  37. package/reference/tools.md +35 -0
  38. package/scripts/harness-doctor.ps1 +83 -0
  39. package/skills/close/SKILL.md +36 -0
  40. package/skills/evolve/SKILL.md +76 -0
  41. package/skills/fast/SKILL.md +36 -0
  42. package/skills/goal/SKILL.md +65 -0
  43. package/skills/search/SKILL.md +68 -0
  44. package/skills/swarm/SKILL.md +69 -0
  45. package/state-seed/lessons.md +22 -0
  46. package/state-seed/template.md +12 -0
  47. package/agents/build.md +0 -20
  48. package/agents/explore.md +0 -26
  49. package/agents/general.md +0 -19
  50. package/agents/plan.md +0 -29
  51. package/agents/reviewer.md +0 -22
  52. package/agents/vault.md +0 -73
  53. package/commands/build.md +0 -7
  54. package/commands/checkpoint.md +0 -7
  55. package/commands/code-simplify.md +0 -7
  56. package/commands/gauntlet.md +0 -7
  57. package/commands/handoff.md +0 -7
  58. package/commands/keeper.md +0 -7
  59. package/commands/kill.md +0 -11
  60. package/commands/plan.md +0 -7
  61. package/commands/retro.md +0 -15
  62. package/commands/review.md +0 -7
  63. package/commands/ship.md +0 -7
  64. package/commands/spec.md +0 -7
  65. package/commands/test.md +0 -7
  66. package/commands/webperf.md +0 -7
  67. package/reference/auto-mandate.md +0 -11
  68. package/reference/backup-convention.md +0 -9
  69. package/reference/clean-mandate.md +0 -13
  70. package/reference/editor-parity.md +0 -7
  71. package/reference/gc-scripts.md +0 -8
  72. package/reference/intent-routing.md +0 -14
  73. package/reference/lifecycle.md +0 -15
  74. package/reference/model-keeper.md +0 -46
  75. package/reference/model-test.md +0 -176
  76. package/reference/oc-source-map.md +0 -162
  77. package/reference/owner-pin.md +0 -31
  78. package/reference/roster.md +0 -15
  79. package/reference/session-scope.md +0 -9
  80. package/reference/session-state.md +0 -13
  81. package/reference/swarm.md +0 -32
  82. package/scripts/backup-config.ps1 +0 -42
  83. package/scripts/gc-branch.ps1 +0 -196
  84. package/scripts/gc-bump.ps1 +0 -198
  85. package/scripts/gc-clean.ps1 +0 -648
  86. package/scripts/gc-commit.ps1 +0 -143
  87. package/scripts/gc-merge.ps1 +0 -272
  88. package/scripts/gc-pr.ps1 +0 -190
  89. package/scripts/gc-push.ps1 +0 -111
  90. package/scripts/gc-read.ps1 +0 -150
  91. package/scripts/gc-rebase.ps1 +0 -162
  92. package/scripts/gc-release.ps1 +0 -225
  93. package/scripts/gc-stage.ps1 +0 -103
  94. package/scripts/gc-status.ps1 +0 -127
  95. package/scripts/gc-sync.ps1 +0 -65
  96. package/scripts/gc.core.ps1 +0 -715
  97. package/scripts/gc.smoke.ps1 +0 -779
  98. package/scripts/interrupt-session.ps1 +0 -65
  99. package/scripts/logbook/README.md +0 -108
  100. package/scripts/logbook/logbook.test.ts +0 -440
  101. package/scripts/logbook/logbook.ts +0 -797
  102. package/scripts/pirep/README.md +0 -147
  103. package/scripts/pirep/pirep.test.ts +0 -735
  104. package/scripts/pirep/pirep.ts +0 -836
  105. package/scripts/testflight/README.md +0 -112
  106. package/scripts/testflight/testflight.test.ts +0 -512
  107. package/scripts/testflight/testflight.ts +0 -806
  108. package/skills/_shared/SOURCES.md +0 -26
  109. package/skills/_shared/references/accessibility-checklist.md +0 -160
  110. package/skills/_shared/references/definition-of-done.md +0 -67
  111. package/skills/_shared/references/observability-checklist.md +0 -92
  112. package/skills/_shared/references/orchestration-patterns.md +0 -155
  113. package/skills/_shared/references/performance-checklist.md +0 -236
  114. package/skills/_shared/references/security-checklist.md +0 -245
  115. package/skills/_shared/references/testing-patterns.md +0 -235
  116. package/skills/api-and-interface-design/SKILL.md +0 -14
  117. package/skills/browser-testing-with-devtools/SKILL.md +0 -303
  118. package/skills/code-simplification/SKILL.md +0 -14
  119. package/skills/creative-writing/SKILL.md +0 -96
  120. package/skills/debugging-and-error-recovery/SKILL.md +0 -15
  121. package/skills/flight-deck/SKILL.md +0 -17
  122. package/skills/frontend-ui-engineering/SKILL.md +0 -16
  123. package/skills/gauntlet/SKILL.md +0 -21
  124. package/skills/git-ceremony/SKILL.md +0 -27
  125. package/skills/grilling/SKILL.md +0 -18
  126. package/skills/observability-and-instrumentation/SKILL.md +0 -18
  127. package/skills/performance-optimization/SKILL.md +0 -16
  128. package/skills/pilot-report/SKILL.md +0 -18
  129. package/skills/planning-and-task-breakdown/SKILL.md +0 -16
  130. package/skills/security-and-hardening/SKILL.md +0 -18
  131. package/skills/source-driven-development/SKILL.md +0 -16
  132. package/skills/spec-driven-development/SKILL.md +0 -26
  133. package/skills/test-driven-development/SKILL.md +0 -18
  134. package/skills/test-flight/SKILL.md +0 -14
  135. package/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
  136. package/skills/writing-for-agents/SKILL.md +0 -89
@@ -0,0 +1,49 @@
1
+ # Repositories
2
+
3
+ ## Lifecycle
4
+
5
+ - Every new repository starts **private**. It is created private, worked in private, and only flipped to **public** when genuinely ready.
6
+ - "Ready" means: a README that explains what it is and how to run it, a license, working install steps, no secrets in tree or history, and no dead links.
7
+ - **Public repositories are the priority set and are held to a higher standard**: clean history, tests that run, a README written for a stranger, and a correct license.
8
+ - Private repositories are personal work, experiments, or candidates waiting to go public. Lower bar, same care with secrets.
9
+
10
+ ## Location
11
+
12
+ - Adopter repo root, defined once here: `<repo-root>/<repo>`. One repository, one checkout; a duplicate is a defect to consolidate.
13
+ - Third-party checkouts live under `<repo-root>/third-party/<repo>`, never beside owned work.
14
+
15
+ ## Commit messages
16
+
17
+ - Conventional Commits always: `type(scope): description`.
18
+ - One line. Never a body. Never a footer, unless the repo requires it.
19
+ - Terse and casual, the way a working dev writes it — never a changelog entry.
20
+ - Never enumerate what changed; the diff already says that.
21
+
22
+ ## Merge speed
23
+
24
+ - Docs-only, single-operator: `git diff --check` plus a link check on changed files, then commit; no PR and no code suite.
25
+ - Code: run the repo's fast check locally, push a branch, open the PR, and merge on green with squash.
26
+ - Fail fast: watch required checks once, read the failed log once.
27
+
28
+ ## Install lines
29
+
30
+ - Public docs reference `@latest` for owned packages, never a pinned version — a pinned install line rots on the next publish.
31
+ - Exception: when compatibility is version-specific (a bridge, a runtime shim), pin, and say why in one line beside the command.
32
+ - Pin deliberately inside workflows, lockfiles and `package.json`. Docs are not lockfiles.
33
+ - A tag can trigger a release workflow; never tag as a side effect of a sync or merge.
34
+
35
+ ## What an agent may do
36
+
37
+ - Prepare, edit, commit, branch, and prove locally.
38
+ - Outward verbs stay with the owner: the agent prepares, the owner pushes, publishes, releases, and merges. Never create a remote or change visibility.
39
+ - Never commit secrets, credentials, or env files, whatever the visibility.
40
+
41
+ ## Deliver, not just commit
42
+
43
+ - A commit is not delivery: install the artifact on the local machine before calling work done, then say what was built and where it landed.
44
+ - A fix that exists only as a commit is unfinished.
45
+
46
+ ## CI policy
47
+
48
+ - CI gates on fast checks only (lint, typecheck, unit tests, a build that finishes in minutes).
49
+ - Heavy bundles and release packaging run locally as delivery steps, never as merge gates.
@@ -0,0 +1,35 @@
1
+ # Host tools
2
+
3
+ A tool is native only when this file lists it: installed, named, and reachable by the agent that needs it. Installing a tool without adding it here is incomplete work.
4
+
5
+ ## Registered
6
+
7
+ | Tool | Purpose | Who uses it |
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`.
23
+
24
+ ## Installing
25
+
26
+ - Installation is `ops` work and the brief names the package. Installing is ingress; the outward gate is unchanged.
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
+ - Remove a row when its tool is uninstalled; a stale row is a dangling reference.
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
+
31
+ ## Considered and rejected
32
+
33
+ - `markdown-link-check` — redundant with `lychee`, which caches and runs offline.
34
+ - 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.
@@ -37,6 +37,11 @@
37
37
  - every skill dir carries a loadable SKILL.md: name+description present,
38
38
  name matches the directory, and no unquoted plain scalar contains ': '
39
39
  (a targeted heuristic, not a full YAML parser)
40
+ - command IDs and skill IDs are 1:1 both ways (valid skill dirs,
41
+ excluding the `_shared` reference bundle, against command basenames;
42
+ an orphan either direction = FAIL)
43
+ - state/template.md exists and carries the fixed session key order
44
+ (id, title, status, goal, next, artifacts, decisions, open)
40
45
 
41
46
  The small DECLARED block at the top is the honest form of the old hardcoded
42
47
  state: each entry names its evidence. Everything else is read from
@@ -86,6 +91,18 @@ Set-StrictMode -Version Latest
86
91
  $OutputEncoding = [System.Text.Encoding]::UTF8
87
92
  [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
88
93
 
94
+ # Windows 10/11 only: this harness grades the Windows config home and shells
95
+ # out to the Windows-only toolchain. Bail as DRIFT (exit 2 — the instrument
96
+ # cannot derive an expectation on this platform), never as a regression.
97
+ if (-not $IsWindows) {
98
+ Write-Error 'harness-doctor supports Windows 10/11 only — macOS and Linux are not supported.'
99
+ exit 2
100
+ }
101
+ if ([string]::IsNullOrWhiteSpace($env:USERPROFILE)) {
102
+ Write-Error 'USERPROFILE is not set — cannot resolve the Windows config home.'
103
+ exit 2
104
+ }
105
+
89
106
  $root = if ($ConfigDir) { $ConfigDir } else { Join-Path $env:USERPROFILE '.config\opencode' }
90
107
 
91
108
  # ---------- declared values (each names its evidence) ----------
@@ -98,6 +115,8 @@ $requiredPaths = @(
98
115
  @{ Name = 'commands'; Path = 'commands'; Kind = 'dir' },
99
116
  @{ Name = 'skills'; Path = 'skills'; Kind = 'dir' },
100
117
  @{ Name = 'reference'; Path = 'reference'; Kind = 'dir' },
118
+ @{ Name = 'state/lessons.md'; Path = 'state/lessons.md'; Kind = 'file' },
119
+ @{ Name = 'state/template.md'; Path = 'state/template.md'; Kind = 'file' },
101
120
  @{ Name = 'Git exclusion policy'; Path = '.gitignore'; Kind = 'file' }
102
121
  )
103
122
 
@@ -246,6 +265,10 @@ function Find-SecretLikeProps {
246
265
 
247
266
  function Get-FrontmatterText {
248
267
  param([string]$Path)
268
+ # A skill directory with no SKILL.md is Law 9/16's seam ('file missing'),
269
+ # not a crash: Get-FrontmatterProblems already reports it, so return $null
270
+ # here and let the laws grade it as FAIL instead of aborting the run.
271
+ if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) { return $null }
249
272
  $lines = @((Get-SafeText -Path $Path) -split "`r?`n")
250
273
  if ($lines.Count -lt 3 -or $lines[0].Trim() -ne '---') { return $null }
251
274
  for ($i = 1; $i -lt $lines.Count; $i++) {
@@ -889,6 +912,66 @@ if ($skillDirs.Count -eq 0 -and $skillLoadProblems.Count -eq 0) {
889
912
  Add-Law 'every skill carries a loadable SKILL.md' 'PASS' "$($skillDirs.Count) skill dirs each carry SKILL.md with name+description and no YAML-breaking plain scalar"
890
913
  }
891
914
 
915
+ # Law 17: command IDs and skill IDs are 1:1 both ways.
916
+ # A command with no skill behind it is a doc pretending to be a tool, and a
917
+ # skill with no command has no entry point — either orphan direction is a
918
+ # FAIL. Skill IDs are the valid skill directories (`_shared` is a reference
919
+ # bundle, not a skill, so it is excluded); command IDs are the command
920
+ # basenames. Frontmatter validity stays Law 16's seam, not this law's.
921
+ $commandIds = @()
922
+ if (Test-Path -LiteralPath $commandsDir -PathType Container) {
923
+ $commandIds = @(Get-ChildItem -LiteralPath $commandsDir -File -Filter '*.md' | ForEach-Object { $_.BaseName } | Sort-Object -Unique)
924
+ }
925
+ $skillDirIds = @()
926
+ if (Test-Path -LiteralPath $skillsRoot -PathType Container) {
927
+ $skillDirIds = @(Get-ChildItem -LiteralPath $skillsRoot -Directory | Where-Object { $_.Name -ne '_shared' } | ForEach-Object { $_.Name } | Sort-Object -Unique)
928
+ }
929
+ if ($commandIds.Count -eq 0 -and $skillDirIds.Count -eq 0) {
930
+ Add-Law 'command IDs and skill IDs are 1:1 both ways' 'FAIL' 'no command files and no skill directories found' 'restore the commands under commands\ and the skill directories under skills\'
931
+ } else {
932
+ $orphanCommands = @($commandIds | Where-Object { $skillDirIds -notcontains $_ })
933
+ $orphanSkills = @($skillDirIds | Where-Object { $commandIds -notcontains $_ })
934
+ if ($orphanCommands.Count -gt 0 -or $orphanSkills.Count -gt 0) {
935
+ $seamReasons = [System.Collections.Generic.List[string]]::new()
936
+ if ($orphanCommands.Count -gt 0) { $seamReasons.Add("orphan commands with no skill: $($orphanCommands -join ', ')") }
937
+ if ($orphanSkills.Count -gt 0) { $seamReasons.Add("orphan skills with no command: $($orphanSkills -join ', ')") }
938
+ Add-Law 'command IDs and skill IDs are 1:1 both ways' 'FAIL' ($seamReasons -join '; ') `
939
+ "reconcile commands\ basenames with skills\ directory names (one entry point per skill, no orphans): $($seamReasons -join '; ')"
940
+ } else {
941
+ Add-Law 'command IDs and skill IDs are 1:1 both ways' 'PASS' "command basenames and skill directories agree as sets ($($commandIds.Count) IDs each way)"
942
+ }
943
+ }
944
+
945
+ # Law 18: state/template.md carries the fixed session key order.
946
+ # The session file is written by historian with keys in exactly this order;
947
+ # the template is the controlled copy, so its order is the derived
948
+ # expectation. Missing file or reordered/missing keys = FAIL.
949
+ $templatePath = Join-Path $root 'state\template.md'
950
+ $fixedKeyOrder = @('id', 'title', 'status', 'goal', 'next', 'artifacts', 'decisions', 'open')
951
+ if (-not (Test-Path -LiteralPath $templatePath -PathType Leaf)) {
952
+ Add-Law 'state template carries the fixed session key order' 'FAIL' 'state/template.md is missing' 'restore state/template.md with the fixed key order (id, title, status, goal, next, artifacts, decisions, open)'
953
+ } else {
954
+ $templateKeys = [System.Collections.Generic.List[string]]::new()
955
+ foreach ($line in ((Get-SafeText -Path $templatePath) -split "`r?`n")) {
956
+ if ($line -match '^\s*(id|title|status|goal|next|artifacts|decisions|open)\s*:') {
957
+ $key = $Matches[1]
958
+ if ($templateKeys -notcontains $key) { $templateKeys.Add($key) }
959
+ }
960
+ }
961
+ $missingKeys = @($fixedKeyOrder | Where-Object { $templateKeys -notcontains $_ })
962
+ $orderHolds = ($missingKeys.Count -eq 0) -and ($templateKeys.Count -eq $fixedKeyOrder.Count) -and (($templateKeys -join ',') -eq ($fixedKeyOrder -join ','))
963
+ if ($orderHolds) {
964
+ Add-Law 'state template carries the fixed session key order' 'PASS' 'state/template.md carries id, title, status, goal, next, artifacts, decisions, open in order'
965
+ } else {
966
+ $templateReasons = [System.Collections.Generic.List[string]]::new()
967
+ if ($missingKeys.Count -gt 0) { $templateReasons.Add("missing keys: $($missingKeys -join ', ')") }
968
+ if ($templateKeys.Count -ne $fixedKeyOrder.Count -and $missingKeys.Count -eq 0) { $templateReasons.Add("unexpected extra keys: $(@($templateKeys | Where-Object { $fixedKeyOrder -notcontains $_ }) -join ', ')") }
969
+ if ($missingKeys.Count -eq 0 -and ($templateKeys -join ',') -ne ($fixedKeyOrder -join ',')) { $templateReasons.Add("order is $($templateKeys -join ', ') — expected $($fixedKeyOrder -join ', ')") }
970
+ Add-Law 'state template carries the fixed session key order' 'FAIL' ($templateReasons -join '; ') `
971
+ "restore the fixed key order (id, title, status, goal, next, artifacts, decisions, open) in state/template.md: $($templateReasons -join '; ')"
972
+ }
973
+ }
974
+
892
975
  # ---------- verdict ----------
893
976
  $failLaws = @($laws | Where-Object { $_.Result -eq 'FAIL' })
894
977
  $driftLaws = @($laws | Where-Object { $_.Result -eq 'DRIFT' })
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: close
3
+ description: Run the end-of-session ceremony when all work has stopped — stopped, green, clean, recorded, said.
4
+ ---
5
+
6
+ # close
7
+
8
+ The end-of-session ceremony; run it only when all work has stopped.
9
+
10
+ ## Procedure
11
+
12
+ 1. Stopped — no subagent, worker, process, watcher, or background command started by this session is still running. Collect or stop every lane before anything else. A blocked lane is not stopped: the session stays `active` and names the blocker. A banked lane is intentionally `parked` with a resume condition.
13
+ 2. Green — run the repo's full gate on the final tree, not the ticket checks; cite command plus output. Close a unit only on a fresh verdict from a seat that did not write it (`verifier`). If red or fail, repair or park; never done over red.
14
+ 3. Clean — `cleaner` deletes only this session's scratch in `%TEMP%\opencode\<session>`: logs, probes, untracked artifacts. Report pre-existing owner dirt by name, never revert it. Prove `git status --short` empty for every repo touched except named pre-existing work. This follows `reference/hygiene.md`.
15
+ 4. Record — `historian` writes state.md in the fixed key order (`id`, `title`, `status`, `goal`, `next`, `artifacts`, `decisions`, `open`) with status `done` or `parked`; `next` is `none` or the resume condition. Rename the session `<status> <work>`.
16
+ 5. Say it — one compact message: outcome, evidence, what remains, status. No essay.
17
+
18
+ ## Status
19
+
20
+ - `done` = every gate green on the final tree, every lane stopped, tree and scratch clean, fresh verdict from a seat that did not write it.
21
+ - `parked` = intentionally banked; stopped and clean, but work remains; name why, the resume condition, and what is unfinished; a red gate is allowed only here and must be named.
22
+ - `active` = work continues or a blocker prevents close. `blocked` is a condition, not a status.
23
+ - `compact` is NOT part of close. Close ends the session; compact only at a phase boundary where a next phase continues. The state file and the done message are the handoff. The final message is compact; the context is not compacted.
24
+
25
+ ## Never
26
+
27
+ - Never close with a live lane.
28
+ - Never close over a red gate as done.
29
+ - Never close on a self-verdict.
30
+ - Never delete pre-existing owner work or another session's scratch.
31
+ - Never mark done when a required check is UNVERIFIED.
32
+ - Never compact at close.
33
+
34
+ ## Done
35
+
36
+ - The ceremony is complete when all five steps ran and nothing is left running.
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: evolve
3
+ description: "Use when the user asks to add a capability, write a skill, adopt an upstream feature, or improve the harness itself — decide the smallest extension, write it in house form, wire it 1:1, verify, and record it."
4
+ ---
5
+
6
+ # evolve
7
+
8
+ The harness grows by one deliberate extension at a time, never a burst.
9
+
10
+ ## When to load
11
+
12
+ - "add a skill for this"
13
+ - "make the harness do X"
14
+ - "adopt this feature/pattern from upstream"
15
+ - "this should be built in"
16
+ - A repeated manual workflow that should become a skill.
17
+
18
+ ## Decision order
19
+
20
+ 1. Existing reference or skill first — if one already covers the job, use it; done when the covering surface is named.
21
+ 2. Repeatable procedure → skill + 1:1 command; done when the procedure clears the bar below.
22
+ 3. New reach class → agent seat; a new craft alone never earns one; done when the reach gap is stated.
23
+ 4. Configuration → `opencode.jsonc` + doctor, no agent; done when the config change and its check are named.
24
+ 5. One-off → do it as a task, add no surface; done when the task ships with proof and nothing new is wired.
25
+
26
+ ## Write the skill
27
+
28
+ - One job, one trigger, one artifact, one proving check; done when all four are named in one line.
29
+ - Frontmatter `name` matching the directory and a `description` stating when to load; done when both parse.
30
+ - Body sections: When to load, Procedure (numbered, each step with its done condition), Done, Never, Examples (Good/Bad); done when every section exists.
31
+ - ≤500 lines; detail behind a reference pointer; done when the line count holds.
32
+ - Add `commands/<id>.md` with `agent: orchestrator`, `subagent: false`, body pointing at `skills/<id>/SKILL.md`; done when the command exists and points.
33
+ - Wire the `AGENTS.md` pointer and the `opencode.jsonc` skill allowlist; done when both name the new skill.
34
+ - Add a reference to `reference/README.md` if it adds one; done when the index matches the tree.
35
+ - Update README/CHANGELOG if public; done when the public surface matches.
36
+ - Do not add count edits: the doctor derives 1:1 dynamically.
37
+
38
+ ## Adopt upstream
39
+
40
+ 1. Name source, version, license before reuse; done when all three are stated.
41
+ 2. License verdict first (digest, quote-only, reject); done when the verdict is stated before any reuse.
42
+ 3. Burden test: does this remove maintenance or add it; done when the one-line verdict holds.
43
+ 4. Digest to house form; never paste unlicensed code; done when the digest is house-shaped and licensed.
44
+ 5. Credit source + pinned revision; pin third-party packs; done when the pin is recorded.
45
+ 6. Promote by ladder: cited note → proposal → reference or skill; done when no rung is skipped.
46
+
47
+ ## Adopt a user improvement request
48
+
49
+ 1. Treat it as a brief: outcome, scope, exclusions, proving check; done when all four are locked.
50
+ 2. A doctrine change is proposed as rule/reason/surface, never applied inline; done when the proposal states all three and stops.
51
+ 3. A local preference goes to the user's config or notes, not the shipped pack; done when the pack stays generic.
52
+ 4. A niche request is rejected in one line and the general form that would earn a place is named; done when the rejection plus the general form are stated.
53
+ 5. Implement through `worker` for code/docs, `maintainer` for harness content; done when the right seat owns the write.
54
+ 6. Verify with a fresh seat; done when the verdict comes from a seat that did not write the work.
55
+
56
+ ## Verify
57
+
58
+ 1. Frontmatter parses; done when the loader accepts it.
59
+ 2. Name matches directory; done when they are identical.
60
+ 3. Command/skill 1:1; done when neither side is orphaned.
61
+ 4. The skill loads in a fresh session and its trigger is discoverable; done when a fresh session fires it.
62
+ 5. Run the doctor and package gate; cite command + output; done when both are green and cited.
63
+ 6. Record CHANGELOG and state; version when shipped; done when the record exists.
64
+
65
+ ## Never
66
+
67
+ - Never add a skill for a one-off.
68
+ - Never a command without a skill or a skill without a command.
69
+ - Never an agent for a new craft.
70
+ - Never paste unlicensed upstream code.
71
+ - Never apply a doctrine change without a proposal.
72
+ - Never widen the pack with a niche skill — generalize or reject.
73
+
74
+ ## Done
75
+
76
+ - The smallest extension is wired, 1:1, loadable, doctor-clean, recorded, and versioned when public.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: fast
3
+ description: Use when a task looks genuinely small and reversible — check the small-task conditions, skip ceremony, ship the artifact with proof.
4
+ ---
5
+
6
+ # fast
7
+
8
+ Take the shortest safe route on a genuinely small task; skip ceremony, keep proof.
9
+
10
+ **When to load**
11
+ - "what is the shortest safe route"
12
+ - "quickly / be quick / fast / no ceremony"
13
+
14
+ 1. Check all small-task conditions hold: one artifact, reversible, no outward act.
15
+ 2. Check no config or permission change and no cross-cutting surface.
16
+ 3. Check the work fits one or two tool calls.
17
+ 4. Treat one missed condition as not small; take the normal route.
18
+ 5. Waive the PLAN block on a small task.
19
+ 6. Waive multi-worker dispatch; do the work inline.
20
+ 7. Waive the full verification pass; run the smallest check that can fail.
21
+ 8. Never waive the deliverable; ship the artifact whole.
22
+ 9. Never waive proof; cite the check command plus output.
23
+ 10. Never waive the rails on an irreversible or outward act.
24
+ 11. Stop and say the task was not small on any budget overrun.
25
+ 12. Report in ≤3 lines: result first, then the proving command.
26
+ 13. Done when the artifact exists, the check is cited, and nothing is left running. The fresh verdict still stands: a seat that did not write the work returns pass or fail, however small the task. Only the ceremony is waived.
27
+
28
+ **Never**
29
+ - Never ship a title-only stub to fit the budget.
30
+ - Never skip proof because the change looks trivial.
31
+ - Never use this posture for an irreversible or outward act.
32
+ - Never improvise past a missing decision; stop instead.
33
+
34
+ **Examples**
35
+ - <example>Good: one-typo fix ships inline with the verify command cited. Bad: dispatching a worker for a typo.</example>
36
+ - <example>Good: three-file request exits fast posture and takes the normal route. Bad: stubbing two files to stay fast.</example>
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: goal
3
+ description: Use when a frozen SPEC must become working code without rescoping — cut tracer-bullet tickets, loop one ticket at a time with TDD to a cited runnable check, then run the repo's full gate green.
4
+ ---
5
+
6
+ # goal
7
+
8
+ End-to-end looper: `to-spec` → `to-tickets` → `implement` → `tdd` → repo gate → fresh verdict.
9
+
10
+ ## When to load
11
+
12
+ - Load on "take this spec to green end to end".
13
+ - Load on "take this ticket to green with TDD".
14
+ - Load on "loop this feature until everything is green".
15
+ - Load when a frozen SPEC must become working code without rescoping.
16
+ - Load when a ticket queue must drain in dependency order.
17
+
18
+ ## Procedure
19
+
20
+ 1. Read the input as one of three: a frozen SPEC, a ticket, or an issue. Name which before touching code.
21
+ 2. If it is not a SPEC, freeze one with `to-spec`: outcome, scope, requirements, acceptance evidence.
22
+ 3. Done when the SPEC names one observable outcome plus evidence per requirement.
23
+ 4. Discover the gates the repo actually has before the first ticket: read `package.json` scripts, `Makefile`, `pyproject.toml`, and CI config. Name the exact full-gate commands and the per-ticket check.
24
+ 5. Seed one known failure per gate once and cite it; a gate that cannot fail is not a gate.
25
+ 6. Cut the SPEC into tracer-bullet tickets with `to-tickets`; order blockers-first.
26
+ 7. Done when every ticket states what it delivers plus its blocking edges.
27
+ 8. Work only the frontier whose blockers are done; pull exactly one ticket per loop.
28
+ 9. Never run two tickets against one artifact at once.
29
+ 10. Build with `implement` through `worker`, testing at the pre-agreed seam with `tdd`: failing test first, then only enough code to pass it.
30
+ 11. Run the ticket check through `worker` or `verifier`, and close only on exit 0 with the command plus output cited.
31
+ 12. Send every closed ticket to `verifier`; a fail revises the work before the next ticket starts.
32
+ 13. Hand the state deltas to `historian` after each ticket so a fresh session resumes at the next frontier ticket.
33
+ 14. A round is one full sweep of the frontier. If a round closes no ticket, stop and escalate: that is no progress, not a slow loop.
34
+ 15. After two failures on one approach, pivot and record the trade.
35
+ 16. After a pivot, three failures on the new approach — five attempts total — stop and escalate the cause plus every attempt.
36
+ 17. When no frontier ticket remains, run the full gate through `worker` on the final tree — every discovered check, not the ticket checks alone.
37
+ 18. "Green" means every gate exits 0 on the final tree and `verifier` ran on that same tree.
38
+ 19. Close only on a `verifier` pass; a fail re-enters repair, and a self-verdict is not a verdict.
39
+
40
+ ## Done
41
+
42
+ - Every ticket closed with a cited runnable check that can fail.
43
+ - The repo's full gate run on the final tree, every command cited with exit 0.
44
+ - Fresh verifier pass from an agent that did not write the work.
45
+ - Failures pivoted at two, escalated after three on the new approach (five attempts total), trades recorded.
46
+ - State written so the next session resumes at the next frontier ticket, or is done.
47
+ - Next frontier ticket named, or `none` with the gate output.
48
+
49
+ ## Delegates to
50
+
51
+ - `to-spec` (vendor): conversation synthesis into a frozen SPEC.
52
+ - `to-tickets` (vendor): SPEC sliced into blocked tracer-bullet tickets.
53
+ - `implement` (vendor): ticket built with typechecks plus test runs.
54
+ - `tdd` (vendor): red-green loop rules, seams, and anti-patterns.
55
+ - Vendor skills above are optional and load only when present locally.
56
+
57
+ ## Never
58
+
59
+ - Never work two tickets against one artifact at once.
60
+ - Never close a ticket on a check that cannot fail.
61
+ - Never repeat a twice-failed approach; pivot, then the new approach gets three attempts.
62
+ - Never close the loop on a self-verdict; the verifier is always fresh context.
63
+ - Never widen a ticket mid-loop; re-cut and re-brief instead.
64
+ - Never call the loop green on ticket checks alone; the full gate runs last.
65
+ - Never absorb an overrun silently; escalate it.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: search
3
+ description: Use when a question turns on a library, API, version, or current fact — research primary sources, cite every load-bearing claim, return a verdict with evidence.
4
+ ---
5
+
6
+ # search
7
+
8
+ All-purpose researcher returning a cited verdict from primary sources.
9
+
10
+ ## When to load
11
+
12
+ - Load on "research this from primary sources with citations".
13
+ - Load on "look this up and prove it" or "verify this claim".
14
+ - Load on "is this API still current" or "what version changed this".
15
+ - Load when a choice turns on a library, API, version, or current fact.
16
+
17
+ ## Procedure
18
+
19
+ 1. Pin the question: decision it supports, product plus version, what counts as answered.
20
+ 2. Done when the decision, the version, and the answer bar are stated back.
21
+ 3. Skip research for ordinary language or standard-library choices.
22
+ 4. Stop at decidable, never at exhaustive.
23
+ 5. Work primary sources only: official docs, specs, source repos, release notes, papers.
24
+ 6. Prefer current versioned docs over blogs and snippets.
25
+ 7. Pin the product version beside every claim it affects.
26
+ - Treat every local reference as dated: state the date it was written or read, and re-verify anything load-bearing before relying on it.
27
+ 8. Follow every load-bearing claim back to the source that owns it.
28
+ 9. Mark each load-bearing claim with an inline numbered marker like [1], [2].
29
+ 10. Never invent a marker number; every marker resolves to exactly one source entry.
30
+ 11. State dead, paywalled, or unreachable sources as such; never cite them as read.
31
+ 12. Separate sourced fact from inference in the evidence section.
32
+ 13. Stamp adopted knowledge with source plus pinned revision or `verified: <date>`.
33
+ 14. Verify locally with the strongest runnable gate before claiming code satisfies a contract.
34
+ 15. Label any claim without executed evidence UNVERIFIED.
35
+ 16. Synthesize as verdict first, then evidence, then sources.
36
+ 17. Keep raw reads out of the return; file the full note at `%TEMP%\opencode\<session-id>\<topic>-notes.md`; promote a finding into `reference/` only by proposal through `evolve`, never directly.
37
+
38
+ ## Done
39
+
40
+ - Verdict names the decision plus its primary-source marker.
41
+ - Every load-bearing claim carries a marker resolving to the source list.
42
+ - Dead or paywalled sources are stated, never silently dropped.
43
+ - Local verification output is cited beside the claim it proves.
44
+ - The finding is filed as a cited note, and any promotion beyond a note is proposed, never applied.
45
+
46
+ ## Delegates to
47
+
48
+ - `research` (vendor): investigation against primary sources plus the Markdown note.
49
+
50
+ ## Canon
51
+
52
+ - Search order lives in `reference/canon.md`.
53
+ - Software, AI, harness, loop, or graph work: the three preferred corpora first — Claude/Anthropic, Karpathy, Pocock.
54
+ - Any other domain: the primary source that owns the domain outranks all three.
55
+ - Tier-1 silence is named; secondary sources are labeled as secondary.
56
+
57
+ ## Never
58
+
59
+ - Never cite a secondary write-up for a load-bearing claim.
60
+ - Never invent a source number or cite a source not read.
61
+ - Never claim code satisfies a contract without a local run.
62
+ - Never return raw dumps; return verdict plus evidence plus sources.
63
+
64
+ ## Examples
65
+
66
+ - <example>Good: verdict cites official docs [2] plus a local `pytest -q` run. Bad: verdict cites a blog summary with no source.</example>
67
+ - <example>Good: dead upstream link reported as dead with the attempted URL. Bad: dead link cited as if read.</example>
68
+ - <example>Good: inference labeled as inference below the sourced facts. Bad: guess presented beside facts with the same marker.</example>
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: swarm
3
+ description: Use when work needs splitting across workers with clean seams — cut disjoint briefs, dispatch them together, integrate behind one fresh verifier.
4
+ ---
5
+
6
+ # swarm
7
+
8
+ Split work across workers with clean seams; integrate behind one fresh verifier.
9
+
10
+ **When to load**
11
+ - "split this across workers with seams"
12
+ - "fan this out"
13
+ - "run these in parallel"
14
+
15
+ ## Before you fan out — the zero test
16
+
17
+ Three questions. All three must be yes, or the split is wrong.
18
+
19
+ - **Zero overlap** — does every worker own a disjoint file set? If any two share a file, a branch, or a PR, they are one worker. Seams that touch are not seams.
20
+ - **Zero risk** — can any worker restart a service, edit shared config, or touch a running process? If yes, serialise that one and fan out around it.
21
+ - **Zero friction** — can each worker return a summary the parent can reconcile without reading raw output? If not, the brief is too vague, not the worker too weak.
22
+ - List live lanes before you cut seams: `opencode api GET /api/session/active`. A lane past its brief is stopped before a new one starts, and two lanes never share a file.
23
+ - **Zero divergence** — every lane works from one frozen brief. A changed brief is a new lane, never an edit to a running one.
24
+ - **Ten lanes, not eleven** — ten live subagents is the ceiling; past ten the work queues. A seam is the gate; ten is the ceiling.
25
+
26
+ Read-only fan-out — research, audits, surveys — is always safe, because reads cannot collide. Write fan-out needs an integration point and a fresh verifier before it closes.
27
+
28
+ 1. Split only for context isolation or genuine breadth; never for speed alone.
29
+ 2. Refuse the split when one context holds the breadth honestly.
30
+ 3. Cut one seam per worker across disjoint file sets.
31
+ 4. Admit a worker only with its own seam, its own artifact, and its own check.
32
+ 5. Grant one write lane per artifact; parallel reads go free.
33
+ 6. Allow parallel writes only across disjoint file sets.
34
+ 7. Hold every parallel write behind one integration point.
35
+ 8. Assign a fresh verifier to each integration point.
36
+ 9. Refuse overlapping write sets; re-cut the seams first.
37
+ 10. Name the integration point in every brief it serves.
38
+ 11. Route network-dependent seams through the researcher; a seam that downloads a named artifact goes to ops.
39
+ 12. Cap the fan-out to the seams the work actually has.
40
+ 13. Send independent seams out together, never staged in waves.
41
+ 14. Brief each worker with objective, output format, tool/source guidance, task boundaries.
42
+ 15. State the objective as one checkable sentence.
43
+ 16. State the output format as summary plus `file:line`.
44
+ 17. Name the allowed tools or sources in the brief.
45
+ 18. Bound the brief to one artifact, one proving check, one return budget.
46
+ 19. Forbid the worker from widening the brief or delegating again.
47
+ 20. Demand the return as a summary plus `file:line` anchors.
48
+ 21. Keep raw reads in the child; never paste bulk context upward.
49
+ 22. Treat a return without anchors as failed; ask once, then re-cut.
50
+ 23. State the cost up front: multi-agent runs cost ~15x single-chat tokens.
51
+ 24. Spend that cost on isolation and review, never on parallel writes to one file.
52
+ 25. Reconcile every return at the integration point before verdict.
53
+ 26. Close on the fresh verifier's verdict, never the author's word.
54
+ 27. Report the cost beside the verdict at close.
55
+ 28. Treat a silent worker as a failed return; re-brief once, then re-cut.
56
+ 29. Record state naming each worker's seam plus its check output.
57
+ 30. Collect or stop every worker before closing.
58
+ 31. Done when seams are disjoint, briefs carry all four fields, and the verdict is cited.
59
+
60
+ **Never**
61
+ - Never put two writers on one artifact.
62
+ - Never dispatch without the four-field brief and the return contract.
63
+ - Never merge parallel writes without a fresh verifier at the integration point.
64
+ - Never spend the 15x token cost on work one context does alone.
65
+
66
+ **Examples**
67
+ - <example>Good: two disjoint packages build in parallel, then merge behind one verifier. Bad: two workers editing one file at once.</example>
68
+ - <example>Good: forty-file sweep returns a summary with `file:line` pointers. Bad: pasting forty files into the parent trace.</example>
69
+ - <example>Good: overlapping seams get re-cut before dispatch. Bad: dispatching overlapping briefs hoping the merge sorts it out.</example>
@@ -0,0 +1,22 @@
1
+ # lessons (seed)
2
+
3
+ Starter lessons installed with the harness. Replace with findings from real sessions; each lesson names its mechanism, its canary, or `instructed`.
4
+
5
+ ## Index
6
+
7
+ - verification: every claim needs a runnable check that can fail (mechanism).
8
+ - memory: one session file per session, fixed key order, never invented ids (mechanism).
9
+ - scope: one ticket, one artifact, one check per pass (instructed).
10
+ - research: load-bearing claims cite primary sources or stay UNVERIFIED (mechanism).
11
+ - cleanup: scratch lives in temp and is swept at pass close (canary: `git status`).
12
+ - growth: one extension at a time (instructed).
13
+
14
+ ## Lessons
15
+
16
+ - Run the proving check on real inputs and cite command plus output; a check that cannot fail proves nothing (mechanism: verifier verdict, canary: red seed per gate).
17
+ - A verdict comes from a seat that did not write the work; a self-verdict is not a verdict (mechanism: fresh verifier per pass).
18
+ - Take the session id from the session-rename return; never invent one, never reuse another session's (mechanism: fixed key order `id`, `title`, `status`, `goal`, `next`, `artifacts`, `decisions`, `open`).
19
+ - Keep commands and skills 1:1; a command with no skill behind it is a doc pretending to be a tool (mechanism: doctor check).
20
+ - Say UNVERIFIED out loud rather than filling a gap with a recalled answer (instructed).
21
+ - Leave no trail: untracked test artifacts, logs, and probe files are deleted in the turn they stop being needed (canary: clean `git status --short` at pass close).
22
+ - Grow the harness by one extension at a time; a niche skill is rejected or generalized, and a new seat needs a new reach class, not a new craft (instructed).
@@ -0,0 +1,12 @@
1
+ <!-- One file per session: state/<session-id>/state.md. Written by historian, id comes from the return of `tools.opencode.session_rename({ title })`. Never invent an id. -->
2
+ <!-- This template is a harness asset. Copy it to %USERPROFILE%\state\<session-id>\state.md, never edit state in the config tree. -->
3
+ # <session-id>
4
+
5
+ id: <session-id>
6
+ title: <status> <work>
7
+ status: <active|parked|done>
8
+ goal: <one line>
9
+ next: <the single next action>
10
+ artifacts: <path — what it is>
11
+ decisions: <gap -> call -> evidence>
12
+ open: <question still unanswered>
package/agents/build.md DELETED
@@ -1,20 +0,0 @@
1
- ---
2
- description: "Background implementer: makes the smallest scoped change, runs the proving check, and returns evidence."
3
- mode: subagent
4
- steps: 40
5
- permissions:
6
- - action: subagent
7
- resource: "*"
8
- effect: deny
9
- - action: question
10
- resource: "*"
11
- effect: deny
12
- ---
13
-
14
- You are the background implementer. Work only inside the parent brief and make the smallest coherent change that satisfies it.
15
-
16
- - Inspect before editing. Preserve existing work and the nearest project instructions.
17
- - Do not widen scope, perform adjacent cleanup, or delegate. Return discoveries and denied paths to the orchestrator.
18
- - Keep one writer per artifact and stop at the first complete solution.
19
- - Run the narrowest check that proves the change. Never weaken a check to manufacture green.
20
- - Return changed files, commands run, and results; add residual risk and anything unverified only when they have real content, omit otherwise.
package/agents/explore.md DELETED
@@ -1,26 +0,0 @@
1
- ---
2
- description: "Background reconnaissance: pinpoint exact files, symbols, constraints, and evidence without changing state."
3
- mode: subagent
4
- steps: 20
5
- permissions:
6
- - action: edit
7
- resource: "*"
8
- effect: deny
9
- - action: shell
10
- resource: "*"
11
- effect: deny
12
- - action: subagent
13
- resource: "*"
14
- effect: deny
15
- - action: question
16
- resource: "*"
17
- effect: deny
18
- ---
19
-
20
- You are a read-only reconnaissance worker. Answer the parent brief with exact targeting evidence; others implement.
21
-
22
- - Name the exact files, symbols, entry points, configs, or URLs involved, with `file:line` or primary-source evidence.
23
- - Search from enough angles to distinguish a real target from a keyword match. Cross-check consequential external claims.
24
- - Separate fact, inference, and unknown. State confidence and what was not verified.
25
- - Return the smallest actionable brief: where to aim, what matters there, constraints, and the next action.
26
- - Never edit, run state-changing commands, delegate, or widen the brief.