oc-harness-setup 0.4.0 → 0.4.2
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/AGENTS.md +1 -1
- package/CHANGELOG.md +40 -0
- package/GLOSSARY.md +16 -0
- package/README.md +6 -5
- package/agents/cleaner.md +1 -1
- package/agents/maintainer.md +2 -2
- package/bin/cli.js +84 -13
- package/package.json +1 -1
- package/reference/flow.md +1 -1
- package/reference/models.md +8 -5
- package/scripts/harness-doctor.ps1 +64 -24
- package/skills/goal/SKILL.md +1 -1
- package/skills/search/SKILL.md +1 -1
package/AGENTS.md
CHANGED
|
@@ -41,7 +41,7 @@ Working on this pack is `CONTRIBUTING.md`; this file is the shipped starter cont
|
|
|
41
41
|
- Split only for context isolation or genuine breadth.
|
|
42
42
|
- `reference/context.md`: read for parallel-write, brief, return, and cost detail plus examples.
|
|
43
43
|
- Before fanning out, run the zero test: zero overlap, zero risk, zero friction. Read-only fan-out is always safe; never parallelise a restart, a shared config, or one file.
|
|
44
|
-
- Harness content has one writer: route changes to `maintainer`; scratch
|
|
44
|
+
- Harness content has one writer: route changes to `maintainer`; scratch lives under `%TEMP%\opencode\<session>` and `cleaner` sweeps it at close; outward acts follow the owner gate in § Enforcement.
|
|
45
45
|
- Cost matters only on the expensive tier: fan out freely on the cheap tier and reserve the expensive seat for verdicts. A price gap is a reason to avoid collisions, not fan-out.
|
|
46
46
|
|
|
47
47
|
## Enforcement
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,46 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- README uses the house centered header, public “agents” wording, and Releases/Issues links; no shipped behavior change.
|
|
13
|
+
|
|
14
|
+
## [0.4.2] - 2026-10-20
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Doctor no longer crashes when `opencode.jsonc` has no `permissions` key; the
|
|
19
|
+
dependent laws grade and name the missing block instead of throwing.
|
|
20
|
+
- Secret-name law fails only on a literal value: `{env:...}` / `{file:...}`
|
|
21
|
+
pointers are accepted, so a normal provider `apiKey` no longer fails setup.
|
|
22
|
+
- Model-routing law accepts the catalog shape the reference documents and names
|
|
23
|
+
both accepted shapes when it cannot derive one.
|
|
24
|
+
- Upgrading from an older version drops the retired `oc-flight-deck` plugin entry while keeping every adopter-owned plugin (a same-version re-run keeps one you deliberately re-added); the reference registry is pointed at the
|
|
25
|
+
config dir setup actually resolved.
|
|
26
|
+
- Two agent files said "Read `*.env` ..." under Never; they now say "Never read".
|
|
27
|
+
- `state/template.md` is pack-owned again (adopter edits archived, not kept), so
|
|
28
|
+
a stale template can never fail the key-order law.
|
|
29
|
+
- An edited `state/template.md` is archived before it is replaced, and the install manifest now says so.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Packaging test asserts the tarball ships every path the doctor requires,
|
|
34
|
+
replacing a `npm run check` that could not fail.
|
|
35
|
+
- Docs: models catalog shape, close roles, scratch routing, the `.docs/` install
|
|
36
|
+
claim, and eight missing glossary terms.
|
|
37
|
+
|
|
38
|
+
## [0.4.1] - 2026-10-20
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Explicit Node >=22 startup guard in `bin/cli.js`: older runtimes now
|
|
43
|
+
fail with a clear message instead of a cryptic `import.meta.dirname`
|
|
44
|
+
TypeError.
|
|
45
|
+
- Note: `engines` was already `>=22` in 0.4.0; the floor is unchanged
|
|
46
|
+
and `>=18` was rejected because the CLI requires `import.meta.dirname`.
|
|
47
|
+
|
|
8
48
|
## [0.4.0] - 2026-10-20
|
|
9
49
|
|
|
10
50
|
### Added
|
package/GLOSSARY.md
CHANGED
|
@@ -8,16 +8,22 @@
|
|
|
8
8
|
Not a role, personality, or craft specialty.
|
|
9
9
|
**doctor** — The install-time gate (`scripts/harness-doctor.ps1`) checking the pack's shape laws.
|
|
10
10
|
Not a prose enforcer; it gates what was installed, never how a sentence reads.
|
|
11
|
+
**drift** — A rule or fact that aged out of agreement with the tree, accepted openly.
|
|
12
|
+
Not a regression; only a doctor FAIL is a regression.
|
|
11
13
|
**enforced vs instructed** — The split between a rule backed by a denying mechanism and a rule stated as prose that may drift.
|
|
12
14
|
Not a severity scale; only the enforced side can deny.
|
|
13
15
|
**evolve** — The smallest deliberate extension of the harness: a skill, command, reference, seat, or config change, never a niche one-off.
|
|
14
16
|
Not a niche one-off or a user-local tweak.
|
|
15
17
|
**finding** — An audit result citing a canon source or a contradiction between two starter files.
|
|
16
18
|
Not an opinion or suggestion.
|
|
19
|
+
**gate** — A runnable check that must exit 0 before work is called done.
|
|
20
|
+
Not a review comment or a check that cannot fail.
|
|
17
21
|
**instructed** — A rule stated as prose with no denying mechanism behind it, so drift is accepted openly.
|
|
18
22
|
Not ignored or optional; it still binds, it just cannot deny.
|
|
19
23
|
**integration point** — The place where disjoint parallel work is reconciled before a verdict.
|
|
20
24
|
Not a branch or merge commit.
|
|
25
|
+
**lane** — One dispatched unit of parallel work with its own artifact and check.
|
|
26
|
+
Not a queue or a lock.
|
|
21
27
|
**lessons** — The scar file of operational rules extracted from failures, each recorded once.
|
|
22
28
|
Not a changelog, diary, or summary of what happened.
|
|
23
29
|
**non-rule** — Something the starter deliberately does not do, recorded to stop it being re-added.
|
|
@@ -30,6 +36,8 @@
|
|
|
30
36
|
Not a token budget for the whole run.
|
|
31
37
|
**seam** — An independent unit of work with its own artifact and its own proving check.
|
|
32
38
|
Not a file, step, or task, and not a brief; the brief is the contract around it.
|
|
39
|
+
**seat** — An agent holding one reach class.
|
|
40
|
+
Not a job title or craft specialty.
|
|
33
41
|
**state** — The per-session markdown record under `state/` that lets a fresh session resume.
|
|
34
42
|
Not the vendor's session store, and not YAML.
|
|
35
43
|
**state-seed** — The starter files setup lays down so a fresh install has somewhere to record.
|
|
@@ -38,9 +46,17 @@
|
|
|
38
46
|
Not a quality ranking.
|
|
39
47
|
**ticket** — One frozen slice of a spec stating what it delivers plus its blocking edges.
|
|
40
48
|
Not a seam without a proving check.
|
|
49
|
+
**tier** — The cost band a seat inherits: cheap bulk vs costly verdict.
|
|
50
|
+
Not a model name or a price list.
|
|
51
|
+
**UNVERIFIED** — Said aloud when a claim could not be resolved from a primary source.
|
|
52
|
+
Not a citation; never present a gap as a sourced fact.
|
|
53
|
+
**vendor skill** — An upstream skill that is supply invoked on demand, never a rule.
|
|
54
|
+
Not surface; never outranks a shipped skill.
|
|
41
55
|
**verdict** — A pass/fail on the work from an agent that did not author it, with cited evidence.
|
|
42
56
|
Not a review comment or summary.
|
|
43
57
|
**write lane** — The single worker permitted to write a given artifact at a given time.
|
|
44
58
|
Not a queue or a lock.
|
|
45
59
|
**zero backend** — Nothing runs behind the agent: no scripts, daemons, services, or generated state machinery.
|
|
46
60
|
Not nothing is enforced; mechanisms and judgment still bind.
|
|
61
|
+
**zero test** — The pre-fan-out check of zero overlap, zero risk, zero friction.
|
|
62
|
+
Not a gate that runs after the work; it decides whether to fan out at all.
|
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
**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.**
|
|
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>
|
|
4
3
|
|
|
5
4
|
## Install
|
|
6
5
|
|
|
@@ -12,7 +11,7 @@ First run prints a manifest of everything it will touch and waits for you to typ
|
|
|
12
11
|
|
|
13
12
|
## Why this starter
|
|
14
13
|
|
|
15
|
-
- Small on purpose: 9
|
|
14
|
+
- Small on purpose: 9 agents, 6 skills, 12 on-demand references; the primary loads one, the rest wait for a trigger.
|
|
16
15
|
- A loop that closes: goal -> worker -> verifier -> historian -> cleaner -> close; no self-verdicts.
|
|
17
16
|
- Research that cites: researcher + search + canon; claims arrive sourced or `UNVERIFIED`.
|
|
18
17
|
- Memory that survives: historian writes session state; `state/` is seeded and preserved on upgrade.
|
|
@@ -22,7 +21,7 @@ First run prints a manifest of everything it will touch and waits for you to typ
|
|
|
22
21
|
|
|
23
22
|
## What you get
|
|
24
23
|
|
|
25
|
-
- 9
|
|
24
|
+
- 9 agents with bounded reach: one coordinator, one verdict, and seven specialists that each own exactly one surface.
|
|
26
25
|
- 6 skills behind 6 commands: close, evolve, fast, goal, search, and swarm.
|
|
27
26
|
- 12 on-demand references behind a single index; load only the file a rule names.
|
|
28
27
|
- 18-law doctor gate: every setup run ends on it, and failures name the check and the fix.
|
|
@@ -67,6 +66,8 @@ This starter grows through `evolve`: the smallest deliberate extension — one s
|
|
|
67
66
|
- [Source](https://github.com/nathwn12/oc-harness-setup)
|
|
68
67
|
- [Published package](https://www.npmjs.com/package/oc-harness-setup)
|
|
69
68
|
- [Changelog](https://github.com/nathwn12/oc-harness-setup/blob/main/CHANGELOG.md)
|
|
69
|
+
- [Releases](https://github.com/nathwn12/oc-harness-setup/releases/latest)
|
|
70
|
+
- [Issues](https://github.com/nathwn12/oc-harness-setup/issues)
|
|
70
71
|
- [License](LICENSE)
|
|
71
72
|
|
|
72
73
|
<!-- nathwn12 house footer: identical in every repo. Do not edit. -->
|
package/agents/cleaner.md
CHANGED
|
@@ -72,7 +72,7 @@ Sole purpose: remove what is disposable — scratch, logs, temp, test output, ca
|
|
|
72
72
|
- Never edit source, fix code, stage, commit, push, or re-scope the cleanup.
|
|
73
73
|
- Never delete an untracked file it cannot attribute to this session; name it in the report instead.
|
|
74
74
|
- Never delegate; never write through shell redirection or heredocs.
|
|
75
|
-
-
|
|
75
|
+
- Never read `*.env`, `*.env.*`, or `*secrets*`.
|
|
76
76
|
**Brief it receives**
|
|
77
77
|
- Objective: the repos touched, the session id, the scratch paths expected, and what must be left alone.
|
|
78
78
|
- Output format: `CLEAN` or `DIRTY` plus deletions, byte total, status output, and refusal list.
|
package/agents/maintainer.md
CHANGED
|
@@ -77,7 +77,7 @@ Sole purpose: build and fix the harness — every harness change and improvement
|
|
|
77
77
|
- Builds and fixes every tracked file under `%USERPROFILE%\.config\opencode`: `AGENTS.md`, `agents\`, `skills\`, `commands\`, `reference\`, `README.md`, `GLOSSARY.md`.
|
|
78
78
|
- Owns harness versioning and the sync into the `oc-harness-setup` repo.
|
|
79
79
|
- Keeps commands and skills 1:1; creates no command without a skill and no skill without a command.
|
|
80
|
-
- Enforces the root ceiling: 200 lines hard, 120 target; every reference 50 lines
|
|
80
|
+
- Enforces the root ceiling: 200 lines hard, 120 target; every reference 50 lines target, 80 hard.
|
|
81
81
|
- Writes the publish set only: `AGENTS.md`, `README.md`, `GLOSSARY.md`, `agents\`, `skills\`, `commands\`, `reference\`.
|
|
82
82
|
- Publishes never: `state\`, `OWNER.md`, `tools\`, `opencode.jsonc`, `.git\`, or anything matching a secret pattern.
|
|
83
83
|
- Versions by tag in the setup repo: `harness-vMAJOR.MINOR.PATCH`, with one line in its `CHANGELOG.md` naming what changed and why.
|
|
@@ -92,7 +92,7 @@ Sole purpose: build and fix the harness — every harness change and improvement
|
|
|
92
92
|
- Never force, reset, clean, or rewrite history.
|
|
93
93
|
- Never delegate.
|
|
94
94
|
- Never edit `state\`; that is `historian`.
|
|
95
|
-
-
|
|
95
|
+
- Never read `*.env`, `*.env.*`, or `*secrets*`.
|
|
96
96
|
**Brief it receives**
|
|
97
97
|
- Objective: the harness change asked for, the files in scope, whether the setup repo is in scope, and what must not change.
|
|
98
98
|
- Output format: files changed with `file:line`, root line count, tag or commit, publish-set diff, and refusal list.
|
package/bin/cli.js
CHANGED
|
@@ -22,6 +22,17 @@ import { homedir } from 'node:os';
|
|
|
22
22
|
import path from 'node:path';
|
|
23
23
|
import { createInterface } from 'node:readline/promises';
|
|
24
24
|
|
|
25
|
+
// Node floor: import.meta.dirname needs Node 20.11+; the supported floor is
|
|
26
|
+
// 22 (package.json engines + README + CI). Fail fast with a clear message
|
|
27
|
+
// instead of a cryptic TypeError on older runtimes.
|
|
28
|
+
const NODE_MAJOR = Number(String(process.versions?.node ?? '').split('.')[0]);
|
|
29
|
+
if (!Number.isInteger(NODE_MAJOR) || NODE_MAJOR < 22) {
|
|
30
|
+
console.error(
|
|
31
|
+
`oc-harness-setup requires Node.js 22 or newer (found ${process.versions?.node ?? 'unknown'}). Install Node 22+ and retry.`
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
const PKG_NAME = 'oc-harness-setup';
|
|
26
37
|
const PKG_ROOT = path.resolve(import.meta.dirname, '..');
|
|
27
38
|
const MANIFEST_FILE = 'oc-harness-setup.manifest.json';
|
|
@@ -47,13 +58,15 @@ const DIR_ALIASES = { 'state-seed': 'state' };
|
|
|
47
58
|
// value stays when the adopter does not define the key.
|
|
48
59
|
const INSTALL_OWNED = ['$schema', 'default_agent', 'formatter', 'compaction', 'tool_output', 'media', 'watcher', 'policies'];
|
|
49
60
|
const UNION_KEYS = ['plugins'];
|
|
61
|
+
const DISTRO_PLUGIN_IDS = ['oc-flight-deck'];
|
|
50
62
|
// Adopter-owned files: a shipped skeleton that the adopter genuinely edited
|
|
51
63
|
// MUST survive an upgrade — overwriting it destroys their data. Genuineness
|
|
52
64
|
// is proven against the prior manifest (see stageFiles): a destination that
|
|
53
65
|
// still matches the prior installed hash is unmodified pack content and IS
|
|
54
66
|
// updated, so a stock 0.3.3 AGENTS.md is replaced by the V9 contract while a
|
|
55
|
-
// genuinely adopter-edited one is kept.
|
|
56
|
-
|
|
67
|
+
// genuinely adopter-edited one is kept. The template is a controlled copy
|
|
68
|
+
// graded by the doctor, so adopter edits are archived then overwritten.
|
|
69
|
+
const PRESERVE_IF_EXISTS = new Set(['reference/models.md', 'AGENTS.md', '.gitignore', 'state/lessons.md']);
|
|
57
70
|
// Leak markers — generic shapes, never a concrete machine. They catch the
|
|
58
71
|
// maintainer's workstation leaking into the shipped tree (an absolute
|
|
59
72
|
// user-profile path, a session id). They are linted against the package
|
|
@@ -152,6 +165,25 @@ function tsStamp() {
|
|
|
152
165
|
return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
|
|
153
166
|
}
|
|
154
167
|
|
|
168
|
+
function versionLess(a, b) {
|
|
169
|
+
const pa = String(a).split('.');
|
|
170
|
+
const pb = String(b).split('.');
|
|
171
|
+
const n = Math.max(pa.length, pb.length);
|
|
172
|
+
for (let i = 0; i < n; i++) {
|
|
173
|
+
const sa = i < pa.length ? pa[i] : '0';
|
|
174
|
+
const sb = i < pb.length ? pb[i] : '0';
|
|
175
|
+
const aNum = /^\d+$/.test(sa);
|
|
176
|
+
const bNum = /^\d+$/.test(sb);
|
|
177
|
+
if (aNum && bNum) {
|
|
178
|
+
const diff = Number(sa) - Number(sb);
|
|
179
|
+
if (diff !== 0) return diff < 0;
|
|
180
|
+
} else {
|
|
181
|
+
if (sa !== sb) return sa < sb;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
|
|
155
187
|
function pkgVersion() {
|
|
156
188
|
try {
|
|
157
189
|
return JSON.parse(readFileSync(path.join(PKG_ROOT, 'package.json'), 'utf8')).version || '0.0.0';
|
|
@@ -359,7 +391,11 @@ function stageFiles(files, manifest, prior, configDir) {
|
|
|
359
391
|
// PRESERVE_IF_EXISTS never reach this branch (kept above, never
|
|
360
392
|
// archived). Same archive root and nextFreePath as retireStale.
|
|
361
393
|
const p = priorByPath.get(norm(f.rel));
|
|
362
|
-
|
|
394
|
+
// state/template.md is pack-owned but graded: an existing copy that
|
|
395
|
+
// differs from the shipped bytes is ALWAYS archived before the
|
|
396
|
+
// overwrite, with or without a prior manifest entry.
|
|
397
|
+
const isTemplate = norm(f.rel) === 'state/template.md';
|
|
398
|
+
if ((p && p.hash && destHash !== p.hash) || (isTemplate && destHash !== srcHash)) {
|
|
363
399
|
const dest2 = nextFreePath(path.join(configDir, 'state', 'archive', 'legacy-0.3.x', f.rel));
|
|
364
400
|
mkdirSync(path.dirname(dest2), { recursive: true });
|
|
365
401
|
renameSync(f.dest, dest2);
|
|
@@ -580,7 +616,7 @@ function parseJsonc(text, what) {
|
|
|
580
616
|
}
|
|
581
617
|
}
|
|
582
618
|
|
|
583
|
-
function mergeJsonc(configDir, backupPath, manifest, retiredSkills = new Set()) {
|
|
619
|
+
function mergeJsonc(configDir, backupPath, manifest, retiredSkills = new Set(), prior = null) {
|
|
584
620
|
const distroPath = path.join(PKG_ROOT, 'opencode.jsonc');
|
|
585
621
|
if (!existsSync(distroPath)) {
|
|
586
622
|
log('merge', 'note: this package ships no opencode.jsonc — no merge to do');
|
|
@@ -602,6 +638,8 @@ function mergeJsonc(configDir, backupPath, manifest, retiredSkills = new Set())
|
|
|
602
638
|
const merged = structuredClone(
|
|
603
639
|
parseJsonc(readFileSync(distroPath, 'utf8'), 'the shipped opencode.jsonc (this package build looks broken)')
|
|
604
640
|
);
|
|
641
|
+
const priorIsOlder = !!(prior && prior.version && versionLess(String(prior.version), pkgVersion()));
|
|
642
|
+
const distroRefKeys = new Set(Object.keys(merged.references ?? {}));
|
|
605
643
|
const preserved = [];
|
|
606
644
|
if (sourcePath) {
|
|
607
645
|
const user = parseJsonc(
|
|
@@ -654,9 +692,24 @@ function mergeJsonc(configDir, backupPath, manifest, retiredSkills = new Set())
|
|
|
654
692
|
}
|
|
655
693
|
merged.permissions = [...distroHead, ...userOnly, ...distroTail];
|
|
656
694
|
} else if (UNION_KEYS.includes(k)) {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
: user[k];
|
|
695
|
+
let next;
|
|
696
|
+
if (Array.isArray(user[k])) {
|
|
697
|
+
next = [...new Set([...(Array.isArray(merged[k]) ? merged[k] : []), ...user[k]])];
|
|
698
|
+
} else {
|
|
699
|
+
next = user[k];
|
|
700
|
+
}
|
|
701
|
+
if (k === 'plugins' && priorIsOlder && Array.isArray(next)) {
|
|
702
|
+
const isDistroPlugin = (e) => {
|
|
703
|
+
const raw = Array.isArray(e) ? e[0] : e;
|
|
704
|
+
return DISTRO_PLUGIN_IDS.includes(String(raw ?? '').split('@')[0]);
|
|
705
|
+
};
|
|
706
|
+
for (const d of next.filter(isDistroPlugin)) {
|
|
707
|
+
const raw = Array.isArray(d) ? d[0] : d;
|
|
708
|
+
log('merge', `dropped the retired distro plugin ${String(raw ?? '').split('@')[0]} (this version ships no plugin; your own plugin entries are kept)`);
|
|
709
|
+
}
|
|
710
|
+
next = next.filter((e) => !isDistroPlugin(e));
|
|
711
|
+
}
|
|
712
|
+
merged[k] = next;
|
|
660
713
|
} else if (k === 'references') {
|
|
661
714
|
// Object union: distro keys + user-only keys.
|
|
662
715
|
merged.references = { ...(user.references ?? {}), ...(merged.references ?? {}) };
|
|
@@ -668,6 +721,26 @@ function mergeJsonc(configDir, backupPath, manifest, retiredSkills = new Set())
|
|
|
668
721
|
} else {
|
|
669
722
|
log('merge', 'no existing opencode.jsonc/opencode.json — writing the harness base');
|
|
670
723
|
}
|
|
724
|
+
// Reference registry: point ONLY the distro's keys at the resolved config
|
|
725
|
+
// dir (portable `~` form under home, absolute otherwise; forward slashes).
|
|
726
|
+
// User-only reference keys are never touched.
|
|
727
|
+
if (merged.references && typeof merged.references === 'object' && distroRefKeys.size) {
|
|
728
|
+
const resolved = path.resolve(configDir);
|
|
729
|
+
const home = homedir();
|
|
730
|
+
let portable;
|
|
731
|
+
if (home && (resolved === home || resolved.startsWith(home + path.sep))) {
|
|
732
|
+
const rel = path.relative(home, resolved).split(path.sep).join('/');
|
|
733
|
+
portable = rel ? `~/${rel}` : '~';
|
|
734
|
+
} else {
|
|
735
|
+
portable = resolved.split(path.sep).join('/');
|
|
736
|
+
}
|
|
737
|
+
for (const key of distroRefKeys) {
|
|
738
|
+
const entry = merged.references[key];
|
|
739
|
+
if (entry && typeof entry === 'object' && typeof entry.path === 'string') {
|
|
740
|
+
entry.path = portable;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
671
744
|
// JSON.stringify strips comments, including the marker the doctor's Law 11
|
|
672
745
|
// cites as evidence — reinsert it so the merged file still documents the
|
|
673
746
|
// deny gate (the law grades the rules; the marker keeps its cited evidence).
|
|
@@ -729,7 +802,6 @@ function runDoctor(configDir, probe) {
|
|
|
729
802
|
console.warn('[doctor] WARNING: pwsh (PowerShell 7) was not found — harness-doctor did NOT run, so the 18 laws are UNVERIFIED.');
|
|
730
803
|
console.warn('[doctor] Your config still landed, and the skip is recorded in the manifest. To verify later:');
|
|
731
804
|
console.log(' winget install --id Microsoft.PowerShell --source winget (Windows)');
|
|
732
|
-
console.log(' brew install --cask powershell (macOS)');
|
|
733
805
|
console.log(' then re-run: npx oc-harness-setup setup');
|
|
734
806
|
return { code: 0, skipped: true };
|
|
735
807
|
}
|
|
@@ -763,10 +835,9 @@ function printManifest(configDir, files, backupPath, doctor) {
|
|
|
763
835
|
console.log(' opencode.jsonc merge : distro base (permissions/deny block, policies block, skill allowlist,');
|
|
764
836
|
console.log(' default_agent: "orchestrator", references registry)');
|
|
765
837
|
console.log(' + your keys kept · permissions: harness allows, yours, harness denies last');
|
|
766
|
-
console.log(' state-seed/ -> state/ : shipped seed maps to live state/ (
|
|
767
|
-
console.log(' state/template.md
|
|
768
|
-
console.log(
|
|
769
|
-
console.log(` doctor plan : ${doctor}`);
|
|
838
|
+
console.log(' state-seed/ -> state/ : shipped seed maps to live state/ (state/lessons.md is preserved;');
|
|
839
|
+
console.log(' state/template.md is pack-owned, and an edited copy is archived under state/archive/ then replaced)');
|
|
840
|
+
console.log(` doctor plan : harness-doctor, 18 laws — ${doctor}`);
|
|
770
841
|
console.log('----------------------------------------------------------------------------');
|
|
771
842
|
}
|
|
772
843
|
|
|
@@ -1172,7 +1243,7 @@ async function setup(opts) {
|
|
|
1172
1243
|
carryForwardJournal(manifest, prior);
|
|
1173
1244
|
// An adopter's own plugins[] entries survive the merge via UNION_KEYS; the
|
|
1174
1245
|
// distro ships no plugins of its own, so there is nothing to register here.
|
|
1175
|
-
mergeJsonc(configDir, backup, manifest, retiredSkills);
|
|
1246
|
+
mergeJsonc(configDir, backup, manifest, retiredSkills, prior);
|
|
1176
1247
|
|
|
1177
1248
|
// R6: record the skip in the journal so "all 18 laws unrun" is never silent.
|
|
1178
1249
|
manifest.doctorSkipped = !doctorProbe.usable || !existsSync(path.join(configDir, 'scripts', 'harness-doctor.ps1'));
|
package/package.json
CHANGED
package/reference/flow.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
- Build: `worker` writes; `worker` or `verifier` runs the named commands.
|
|
5
5
|
- Review: `critic` reads the diff; `verifier` returns pass/fail.
|
|
6
6
|
- Commit: `ops` runs git mechanics in product repos; `maintainer` commits the harness; neither pushes.
|
|
7
|
-
- Close: `historian
|
|
7
|
+
- Close: `historian` writes state, `cleaner` sweeps scratch, then the `close` ceremony.
|
|
8
8
|
- Research: `researcher`; Host: `ops`.
|
|
9
9
|
- Extend: `maintainer` + `evolve`.
|
|
10
10
|
- A trigger with no seat is a gap: report it, never improvise a seat mid-pass.
|
package/reference/models.md
CHANGED
|
@@ -15,11 +15,14 @@ No model pins ship. Every seat inherits the session model until the user binds o
|
|
|
15
15
|
|
|
16
16
|
## Catalog
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
- The doctor parses one bullet per model, exactly ``- `<provider>/<model-id>` — <tier>``.
|
|
19
|
+
- Alternatively, a `Model (<provider>/<id>)` line plus `| n | `<id>` |` rows resolves the same way.
|
|
20
|
+
- Example (fenced block is illustrative only; angle-bracket placeholders are not parsed as catalog entries):
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
- `<provider>/<cheap-model>` — bulk tier
|
|
24
|
+
- `<provider>/<verdict-model>` — verdict tier
|
|
25
|
+
```
|
|
23
26
|
|
|
24
27
|
## Rule
|
|
25
28
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
documents it (the record is DISCOVERED by content, never named here)
|
|
23
23
|
- local skill dirs match the fail-closed skill allowlist BOTH directions
|
|
24
24
|
(orphan dir or dangling allow = FAIL), under a skill:* deny
|
|
25
|
-
- no secret-like property
|
|
25
|
+
- no literal secret VALUES under a secret-like property name; a `{env:…}`/`{file:…}` pointer is not a leak
|
|
26
26
|
- the deny set survives --auto (declared gates below, verified derived)
|
|
27
27
|
- hard denies come after same-action allows (denies-last ordering; the
|
|
28
28
|
skill fail-closed allowlist allows-after-deny by design, so the skill
|
|
@@ -229,6 +229,20 @@ function Get-McpServerNames {
|
|
|
229
229
|
return $names
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
function Get-PermissionRules {
|
|
233
|
+
# StrictMode-safe read of the permissions array. A config that omits the
|
|
234
|
+
# key (or carries a non-array) grades as an empty set, so dependent laws
|
|
235
|
+
# FAIL with their named reason instead of throwing a property error.
|
|
236
|
+
param($Config)
|
|
237
|
+
if ($null -eq $Config) { return @() }
|
|
238
|
+
$prop = $Config.PSObject.Properties['permissions']
|
|
239
|
+
if ($null -eq $prop -or $null -eq $prop.Value) { return @() }
|
|
240
|
+
$value = $prop.Value
|
|
241
|
+
if ($value -is [string]) { return @() }
|
|
242
|
+
if ($value -isnot [System.Collections.IEnumerable]) { return @() }
|
|
243
|
+
return @($value)
|
|
244
|
+
}
|
|
245
|
+
|
|
232
246
|
function Get-RegistryMcpNames {
|
|
233
247
|
# First token per line of `opencode mcp list`, minus status markers.
|
|
234
248
|
param([string[]]$Lines)
|
|
@@ -242,15 +256,26 @@ function Get-RegistryMcpNames {
|
|
|
242
256
|
return [System.Collections.Generic.List[string]]::new([string[]](@($names | Sort-Object -Unique)))
|
|
243
257
|
}
|
|
244
258
|
|
|
259
|
+
function Test-SecretPointer {
|
|
260
|
+
# A value that POINTS at a secret is not the secret itself.
|
|
261
|
+
param($Value)
|
|
262
|
+
if ($null -eq $Value) { return $true }
|
|
263
|
+
if ($Value -isnot [string]) { return $false }
|
|
264
|
+
$text = $Value.Trim()
|
|
265
|
+
if ($text -eq '') { return $true }
|
|
266
|
+
return [bool]($text -match '^(\{[A-Za-z][A-Za-z0-9_-]*:[^}]*\}|\$\{[^}]*\}|\$[A-Za-z_][A-Za-z0-9_]*)$')
|
|
267
|
+
}
|
|
268
|
+
|
|
245
269
|
function Find-SecretLikeProps {
|
|
246
|
-
# Property PATHS whose names look secret-like
|
|
270
|
+
# Property PATHS whose names look secret-like, each with a Pointer flag.
|
|
271
|
+
# Values are never returned.
|
|
247
272
|
param($Node, [string]$Path)
|
|
248
|
-
$hits = [System.Collections.Generic.List[
|
|
273
|
+
$hits = [System.Collections.Generic.List[object]]::new()
|
|
249
274
|
if ($null -eq $Node) { return $hits }
|
|
250
275
|
if ($Node -is [System.Management.Automation.PSCustomObject]) {
|
|
251
276
|
foreach ($p in $Node.PSObject.Properties) {
|
|
252
277
|
$np = if ($Path) { "$Path.$($p.Name)" } else { [string]$p.Name }
|
|
253
|
-
if ($p.Name -match $secretNamePattern) { $hits.Add($np) }
|
|
278
|
+
if ($p.Name -match $secretNamePattern) { $hits.Add([pscustomobject]@{ Path = $np; Pointer = (Test-SecretPointer -Value $p.Value) }) }
|
|
254
279
|
foreach ($h in (Find-SecretLikeProps -Node $p.Value -Path $np)) { $hits.Add($h) }
|
|
255
280
|
}
|
|
256
281
|
} elseif ($Node -is [System.Collections.IEnumerable] -and $Node -isnot [string]) {
|
|
@@ -336,10 +361,13 @@ function Get-LiveModelBinding {
|
|
|
336
361
|
|
|
337
362
|
function Get-ModelCatalog {
|
|
338
363
|
# Model ids AND the provider prefix, both read from reference/models.md.
|
|
364
|
+
# Accepts two shapes: `- `provider/model-id`` bullets, or a
|
|
365
|
+
# `Model (provider/<id>)` line plus `| n | `id` |` rows.
|
|
339
366
|
param([string]$Path)
|
|
340
367
|
$ids = [System.Collections.Generic.List[string]]::new()
|
|
368
|
+
$bindings = [System.Collections.Generic.List[string]]::new()
|
|
341
369
|
$provider = ''
|
|
342
|
-
if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) { return [pscustomobject]@{ Ids = $ids; Provider = $provider; Found = $false } }
|
|
370
|
+
if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) { return [pscustomobject]@{ Ids = $ids; Bindings = $bindings; Provider = $provider; Found = $false } }
|
|
343
371
|
$text = Get-SafeText -Path $Path
|
|
344
372
|
$providerMatch = [regex]::Match($text, 'Model \((?<provider>[A-Za-z0-9._-]+)/<id>\)')
|
|
345
373
|
$provider = if ($providerMatch.Success) { $providerMatch.Groups['provider'].Value } else { '' }
|
|
@@ -347,8 +375,10 @@ function Get-ModelCatalog {
|
|
|
347
375
|
if ($providerMatch.Success) {
|
|
348
376
|
foreach ($m in [regex]::Matches($text, [regex]::Escape($provider) + '/([A-Za-z0-9._-]+)')) { $ids.Add($m.Groups[1].Value.Trim()) }
|
|
349
377
|
}
|
|
378
|
+
foreach ($m in [regex]::Matches($text, '(?m)^\s*[-*]\s+`([A-Za-z0-9._-]+/[A-Za-z0-9._-]+)`')) { $bindings.Add($m.Groups[1].Value.Trim()) }
|
|
350
379
|
$ids = [System.Collections.Generic.List[string]]::new([string[]](@($ids | Sort-Object -Unique)))
|
|
351
|
-
|
|
380
|
+
$bindings = [System.Collections.Generic.List[string]]::new([string[]](@($bindings | Sort-Object -Unique)))
|
|
381
|
+
return [pscustomobject]@{ Ids = $ids; Bindings = $bindings; Provider = $provider; Found = $true }
|
|
352
382
|
}
|
|
353
383
|
|
|
354
384
|
function Test-ModelBinding {
|
|
@@ -358,14 +388,20 @@ function Test-ModelBinding {
|
|
|
358
388
|
if ($text.Contains('#')) { $text = $text.Substring(0, $text.IndexOf('#')) }
|
|
359
389
|
$text = $text.Trim()
|
|
360
390
|
if ($text -notmatch '^(?<provider>[A-Za-z0-9._-]+)/(?<id>[^/]+)$') { return "model '$Value' is not a provider/id binding" }
|
|
361
|
-
if ([string]::IsNullOrWhiteSpace($Catalog.Provider)) {
|
|
362
|
-
|
|
391
|
+
if (-not [string]::IsNullOrWhiteSpace($Catalog.Provider)) {
|
|
392
|
+
if ($Matches['provider'] -ne $Catalog.Provider) {
|
|
393
|
+
return "model '$Value' uses provider '$($Matches['provider'])' but the catalog declares '$($Catalog.Provider)'"
|
|
394
|
+
}
|
|
395
|
+
if (@($Catalog.Ids) -notcontains $Matches['id']) { return "model '$Value' does not resolve in reference/models.md" }
|
|
396
|
+
return $null
|
|
363
397
|
}
|
|
364
|
-
|
|
365
|
-
|
|
398
|
+
$catalogBindings = @()
|
|
399
|
+
if ($null -ne $Catalog.Bindings) { $catalogBindings = @($Catalog.Bindings) }
|
|
400
|
+
if ($catalogBindings.Count -gt 0) {
|
|
401
|
+
if ($catalogBindings -contains $text) { return $null }
|
|
402
|
+
return "model '$Value' does not resolve in reference/models.md"
|
|
366
403
|
}
|
|
367
|
-
|
|
368
|
-
return $null
|
|
404
|
+
return 'the model catalog declares neither shape: add `- `provider/model-id`` bullets, or a `Model (provider/<id>)` line plus `| n | `id` |` rows'
|
|
369
405
|
}
|
|
370
406
|
|
|
371
407
|
function Get-UnwiredRoutingDoc {
|
|
@@ -608,7 +644,7 @@ if ($agentFiles.Count -eq 0) {
|
|
|
608
644
|
$binding = Get-LiveModelBinding -FrontmatterText (Get-FrontmatterText -Path $file.FullName)
|
|
609
645
|
if ($null -eq $binding) { continue }
|
|
610
646
|
$liveBindings.Add($file.BaseName)
|
|
611
|
-
if (-not $catalog.Found -or $catalog.Ids.Count -eq 0) {
|
|
647
|
+
if (-not $catalog.Found -or ($catalog.Ids.Count -eq 0 -and $catalog.Bindings.Count -eq 0)) {
|
|
612
648
|
$bindingProblems.Add("$($file.Name): live model '$binding' cannot be resolved because reference/models.md is missing or lists no models")
|
|
613
649
|
continue
|
|
614
650
|
}
|
|
@@ -672,7 +708,7 @@ if (-not $configOk) {
|
|
|
672
708
|
Add-Law 'local skills match the fail-closed allowlist both directions' 'FAIL' $skillDetail `
|
|
673
709
|
"repair the skill directories or their frontmatter under skills\: $skillDetail"
|
|
674
710
|
} else {
|
|
675
|
-
$permissions = @($config
|
|
711
|
+
$permissions = @(Get-PermissionRules -Config $config)
|
|
676
712
|
$skillRules = @($permissions | Where-Object { $_.action -eq 'skill' })
|
|
677
713
|
$wildcardDeny = @($skillRules | Where-Object { $_.resource -eq '*' -and $_.effect -eq 'deny' })
|
|
678
714
|
$allowedSkillIds = @($skillRules | Where-Object { $_.effect -eq 'allow' -and $_.resource -ne '*' } | Select-Object -ExpandProperty resource)
|
|
@@ -690,16 +726,20 @@ if (-not $configOk) {
|
|
|
690
726
|
}
|
|
691
727
|
}
|
|
692
728
|
|
|
693
|
-
# Law 10: no secret-like property
|
|
729
|
+
# Law 10: no literal secret VALUES under a secret-like property name; a `{env:…}`/`{file:…}` pointer is not a leak (paths only).
|
|
694
730
|
if (-not $configOk) {
|
|
695
731
|
Add-ConfigDrift 'no secret-like property names in opencode.jsonc'
|
|
696
732
|
} else {
|
|
697
|
-
$
|
|
698
|
-
|
|
699
|
-
|
|
733
|
+
$secretHits = @(Find-SecretLikeProps -Node $config -Path '')
|
|
734
|
+
$literalHits = @($secretHits | Where-Object { -not $_.Pointer } | ForEach-Object { $_.Path })
|
|
735
|
+
$pointerHits = @($secretHits | Where-Object { $_.Pointer } | ForEach-Object { $_.Path })
|
|
736
|
+
if ($literalHits.Count -gt 0) {
|
|
737
|
+
Add-Law 'no secret-like property names in opencode.jsonc' 'FAIL' "literal secret values at: $($literalHits -join ', ')" `
|
|
738
|
+
"replace each with a pointer (``{env:...}`` or ``{file:...}``) or move it to the secret store: $($literalHits -join ', ')"
|
|
700
739
|
} else {
|
|
701
|
-
|
|
702
|
-
|
|
740
|
+
$passDetail = 'no literal secret values under a secret-like property name'
|
|
741
|
+
if ($pointerHits.Count -gt 0) { $passDetail += " (pointer(s) accepted: $($pointerHits -join ', '))" }
|
|
742
|
+
Add-Law 'no secret-like property names in opencode.jsonc' 'PASS' $passDetail
|
|
703
743
|
}
|
|
704
744
|
}
|
|
705
745
|
|
|
@@ -707,7 +747,7 @@ if (-not $configOk) {
|
|
|
707
747
|
if (-not $configOk) {
|
|
708
748
|
Add-ConfigDrift 'deny set survives --auto'
|
|
709
749
|
} else {
|
|
710
|
-
$permissions = @($config
|
|
750
|
+
$permissions = @(Get-PermissionRules -Config $config)
|
|
711
751
|
if ($null -eq $permissions -or $permissions.Count -eq 0) {
|
|
712
752
|
Add-Law 'deny set survives --auto' 'FAIL' 'permissions block missing; dependent boundary checks cannot be trusted' 'restore the permissions block in opencode.jsonc'
|
|
713
753
|
} else {
|
|
@@ -739,7 +779,7 @@ if (-not $configOk) {
|
|
|
739
779
|
if (-not $configOk) {
|
|
740
780
|
Add-ConfigDrift 'hard denies come after same-action allows'
|
|
741
781
|
} else {
|
|
742
|
-
$permissions = @($config
|
|
782
|
+
$permissions = @(Get-PermissionRules -Config $config)
|
|
743
783
|
if ($null -eq $permissions -or $permissions.Count -eq 0) {
|
|
744
784
|
Add-Law 'hard denies come after same-action allows' 'FAIL' 'permissions block missing; ordering cannot be evaluated' 'restore the permissions block in opencode.jsonc'
|
|
745
785
|
} else {
|
|
@@ -780,7 +820,7 @@ if (-not $configOk) {
|
|
|
780
820
|
if (-not $configOk) {
|
|
781
821
|
Add-ConfigDrift 'no broad shell allows'
|
|
782
822
|
} else {
|
|
783
|
-
$permissions = @($config
|
|
823
|
+
$permissions = @(Get-PermissionRules -Config $config)
|
|
784
824
|
if ($null -eq $permissions -or $permissions.Count -eq 0) {
|
|
785
825
|
Add-Law 'no broad shell allows' 'FAIL' 'permissions block missing; broad allows cannot be evaluated' 'restore the permissions block in opencode.jsonc'
|
|
786
826
|
} else {
|
|
@@ -809,7 +849,7 @@ if (-not $configOk) {
|
|
|
809
849
|
if (-not $configOk) {
|
|
810
850
|
Add-ConfigDrift 'skill allow entries match local skill IDs both directions'
|
|
811
851
|
} else {
|
|
812
|
-
$permissions = @($config
|
|
852
|
+
$permissions = @(Get-PermissionRules -Config $config)
|
|
813
853
|
$allowIds = @($permissions | Where-Object { $_.action -eq 'skill' -and $_.effect -eq 'allow' -and $_.resource -ne '*' } | Select-Object -ExpandProperty resource | Sort-Object -Unique)
|
|
814
854
|
$localIds = @($localSkillIds | Sort-Object -Unique)
|
|
815
855
|
if ($localIds.Count -eq 0 -and $allowIds.Count -eq 0) {
|
package/skills/goal/SKILL.md
CHANGED
|
@@ -52,7 +52,7 @@ End-to-end looper: `to-spec` → `to-tickets` → `implement` → `tdd` → repo
|
|
|
52
52
|
- `to-tickets` (vendor): SPEC sliced into blocked tracer-bullet tickets.
|
|
53
53
|
- `implement` (vendor): ticket built with typechecks plus test runs.
|
|
54
54
|
- `tdd` (vendor): red-green loop rules, seams, and anti-patterns.
|
|
55
|
-
- Vendor skills above are optional
|
|
55
|
+
- Vendor skills above are optional supply: this harness denies non-local skills (`skill *`), so the procedure above stands alone — the named vendor skill is a shortcut, never a dependency.
|
|
56
56
|
|
|
57
57
|
## Never
|
|
58
58
|
|
package/skills/search/SKILL.md
CHANGED
|
@@ -45,7 +45,7 @@ All-purpose researcher returning a cited verdict from primary sources.
|
|
|
45
45
|
|
|
46
46
|
## Delegates to
|
|
47
47
|
|
|
48
|
-
- `research` (vendor): investigation against primary sources plus the Markdown note.
|
|
48
|
+
- `research` (vendor): investigation against primary sources plus the Markdown note. It is optional supply: this harness denies non-local skills (`skill *`), so the procedure above stands alone — the named vendor skill is a shortcut, never a dependency.
|
|
49
49
|
|
|
50
50
|
## Canon
|
|
51
51
|
|