oc-harness-setup 0.1.0 → 0.2.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.
- package/.docs/unwired-routing.md +16 -0
- package/.gitignore +8 -0
- package/AGENTS.md +3 -3
- package/README.md +13 -15
- package/agents/keeper.md +3 -3
- package/agents/master.md +5 -3
- package/bin/cli.js +322 -97
- package/commands/doctor.md +1 -0
- package/commands/keeper.md +1 -1
- package/commands/report.md +13 -0
- package/package.json +3 -1
- package/reference/README.md +1 -1
- package/reference/model-keeper.md +4 -4
- package/reference/model-test.md +3 -3
- package/reference/models.md +20 -0
- package/scripts/harness-doctor.ps1 +27 -7
- package/scripts/harness-report.ps1 +695 -0
- package/reference/models.md.example +0 -21
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Build a redacted harness report with a prefilled issue URL - offer to file it, never auto-file
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
From `~/.config/opencode`, run `pwsh -File scripts\harness-report.ps1` and report what it returns. `$ARGUMENTS` may be empty, `-Json`, `-OutFile <path>`, `-ConfigDir <path>`, or `-SelfTest`.
|
|
6
|
+
|
|
7
|
+
- Redaction is enforced in code, not promised in prose: every field that reaches the body passes one chokepoint in `scripts\harness-report.ps1`. Home and config paths collapse to `~`, the installer's backup path becomes `~/.opencode-backup/<ts>`, session ids become `<session>`, hostnames `<host>`, and usernames `<user>`. Secret-like **values** are redacted in place to `<redacted>` whenever the name keys the redactor (a diagnostic line survives; only the value becomes `<redacted>`). A line is dropped whole only when it cannot be kept safely: a `{file:...}` pointer target, a path into a secret store, or a bare credential literal. Show the exact post-redaction bytes the script printed - never re-render, summarise, or "improve" them, and never re-read the files behind them.
|
|
8
|
+
- TRIAGE every FAIL before offering anything, one line each: **HARNESS-BUG** (the product is wrong - a missing path, a broken law, a frontmatter check that ships broken) versus **LOCAL-DRIFT** (the user's own config or machine - a stale path, a plugin they removed, a CLI they never installed). Real regressions never auto-fix; say which bucket each one falls in and why. DRIFT is neither: it means the instrument could not derive an expectation, so repair the CLI or restore the file first.
|
|
9
|
+
- Print the prefilled URL verbatim, then OFFER to open the issue - the human gate holds EVERY time. Never file, never call `gh`, never open a browser to the URL, and never post to the product repo on your own initiative; the human submits it or it does not happen.
|
|
10
|
+
- PowerShell 7 (`pwsh`) is required for the doctor, so it is required for this report. If `pwsh` is absent, both are skipped: say so plainly, print the doctor-only findings you can see by other means, and do not pretend a report was generated.
|
|
11
|
+
- Never read or print the secret store or `.env`; the reporter's own guard refuses those paths and `-SelfTest` proves the redactor.
|
|
12
|
+
|
|
13
|
+
Close with: verdict (clean / real regression / drift), what the report found, the exact command run, whether anything was filed (normally nothing), and one question - file it, fix locally, or leave it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-harness-setup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"oc-harness-setup": "bin/cli.js"
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"skills",
|
|
13
13
|
"reference",
|
|
14
14
|
"scripts",
|
|
15
|
+
".docs",
|
|
15
16
|
"AGENTS.md",
|
|
17
|
+
".gitignore",
|
|
16
18
|
"opencode.jsonc",
|
|
17
19
|
"README.md",
|
|
18
20
|
"LICENSE"
|
package/reference/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Read these only when the task calls for them:
|
|
|
7
7
|
- `model-keeper.md` — how to refresh the model catalog and the agent model bindings (file-based under `agents\*.md`) from live evidence.
|
|
8
8
|
- `scripts\harness-doctor.ps1` — self-contained harness health check (run `pwsh -File scripts\harness-doctor.ps1` from `~/.config/opencode` after changing the harness).
|
|
9
9
|
|
|
10
|
-
## Gotchas (verified
|
|
10
|
+
## Gotchas (verified 2026-09-20)
|
|
11
11
|
|
|
12
12
|
Two traps were hit in one session and both cost real time. Check them before editing permission globs or running shell.
|
|
13
13
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Model Keeper
|
|
2
2
|
|
|
3
|
-
The `keeper` maintains the model picture: the catalog in `reference/models.md
|
|
3
|
+
The `keeper` maintains the model picture: the catalog in `reference/models.md` and the agent model bindings in the file-based agent definitions under `~/.config/opencode/agents/*.md` (the `model:` frontmatter). `opencode.jsonc` carries global defaults and may mirror bindings; for a given agent, its `agents\*.md` file is authoritative. `/keeper` is the explicit refresh point. The keeper works from live evidence and reports changes, sources, and uncertainty — or a clean no-change result.
|
|
4
4
|
|
|
5
5
|
## Keeper pass
|
|
6
6
|
|
|
7
|
-
1. Read `reference/models.md
|
|
7
|
+
1. Read `reference/models.md`, the agent files in `~/.config/opencode/agents/*.md`, `opencode.jsonc`, and the harness references that describe routing.
|
|
8
8
|
2. Query the live provider catalogs and list the models and variants each one offers.
|
|
9
9
|
3. Check official pricing, context sizes, capabilities, and available variants for the candidate models.
|
|
10
10
|
4. Diff the live picture against the configured bindings and the catalog: additions, removals, renames, price changes, capability changes, and variant changes.
|
|
11
|
-
5. Update `reference/models.md
|
|
11
|
+
5. Update `reference/models.md` and the `model:` bindings in `agents\*.md` together (touching `opencode.jsonc` only when defaults or mirrored bindings change), keeping every configured agent binding in agreement with the catalog. Only the `keeper` writes agent files; one writer per artifact.
|
|
12
12
|
6. Validate: every `model:` frontmatter value parses and resolves against the catalog, agent files still parse with their frontmatter, and `opencode.jsonc` (if touched) stays consistent.
|
|
13
13
|
|
|
14
14
|
## Evidence rules
|
|
@@ -17,7 +17,7 @@ The `keeper` maintains the model picture: the catalog in `reference/models.md.ex
|
|
|
17
17
|
- Official provider pricing is the price authority.
|
|
18
18
|
- Promotions, temporary discounts, free trials, and usage multipliers are not routing evidence.
|
|
19
19
|
- Record cache-read rates, context tiers, and per-model allocations when the source exposes them.
|
|
20
|
-
- Record source URLs and the verification date in `reference/models.md
|
|
20
|
+
- Record source URLs and the verification date in `reference/models.md`.
|
|
21
21
|
- Preserve uncertainty when sources disagree; never invent a model ID, price, or variant.
|
|
22
22
|
- Keep secrets by pointer only: never print, paste, log, or commit a key value.
|
|
23
23
|
|
package/reference/model-test.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Model Test — fixed contender intake (Go only)
|
|
2
2
|
|
|
3
|
-
How a new OpenCode Go model earns a row in `reference/models.md
|
|
3
|
+
How a new OpenCode Go model earns a row in `reference/models.md`. Same bytes in, same
|
|
4
4
|
harness around it, every time — so scores are comparable across models and across months.
|
|
5
5
|
|
|
6
6
|
## 0. Sweep (every recheck, every 3 days)
|
|
@@ -17,7 +17,7 @@ Never rank off a cached snapshot older than the current recheck; if a rate, cap,
|
|
|
17
17
|
disagrees between sources, the live `opencode models` output wins for IDs and the Go
|
|
18
18
|
docs win for prices, and the disagreement is recorded in one line.
|
|
19
19
|
|
|
20
|
-
Any live ID not in `models.md
|
|
20
|
+
Any live ID not in `models.md`, or any ranked ID with a new variant/rung, enters intake below.
|
|
21
21
|
|
|
22
22
|
## 1. Third-party benchmarks first
|
|
23
23
|
|
|
@@ -168,4 +168,4 @@ Decision rule per contender run:
|
|
|
168
168
|
- **Paired-rung upgrade:** if the top rung beats the usable rung on all three axes for
|
|
169
169
|
+<25% cost (the Muse xhigh precedent), the rank holds the top rung, noted in the row.
|
|
170
170
|
|
|
171
|
-
Then move the `models.md
|
|
171
|
+
Then move the `models.md` recheck date +3 days. Never re-score old runs under a new rubric.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# OpenCode Model Catalog — shipped skeleton
|
|
2
|
+
|
|
3
|
+
> **Recheck due: YYYY-MM-DD — every 3 days.** Procedure: `reference/model-test.md`.
|
|
4
|
+
> On recheck, move this date +3 days and re-verify the table below.
|
|
5
|
+
|
|
6
|
+
This catalog ships with no adopted models: the harness is fully unwired by
|
|
7
|
+
decision (see `.docs/unwired-routing.md`). When you wire an agent, add its
|
|
8
|
+
`opencode-go/<id>` row here first — the harness doctor's Law 8 enforces that
|
|
9
|
+
every live `model:` binding resolves against this table.
|
|
10
|
+
|
|
11
|
+
| # | Model (opencode-go/<id>) | Price in / out / cache-read | Monthly cap | Smart evidence | Cheap evidence | Status |
|
|
12
|
+
|---|--------------------------|-----------------------------|-------------|----------------|----------------|--------|
|
|
13
|
+
|
|
14
|
+
## Notes
|
|
15
|
+
|
|
16
|
+
- Columns follow the harness ordering: context gate first, then price, cap, and
|
|
17
|
+
real measured evidence — never vendor claims.
|
|
18
|
+
- The `model:` lines in `agents\*.md` must resolve against this table; the
|
|
19
|
+
harness doctor's Law 8 enforces it.
|
|
20
|
+
- Rank rows by judgment, not a single formula; state the judgment calls.
|
|
@@ -64,12 +64,21 @@
|
|
|
64
64
|
|
|
65
65
|
.EXAMPLE
|
|
66
66
|
pwsh -File scripts\harness-doctor.ps1 -Json
|
|
67
|
+
|
|
68
|
+
.EXAMPLE
|
|
69
|
+
pwsh -File scripts\harness-doctor.ps1 -ConfigDir D:\config\opencode
|
|
70
|
+
|
|
71
|
+
.PARAMETER ConfigDir
|
|
72
|
+
Config directory to grade. The installer passes the resolved config dir
|
|
73
|
+
(OPENCODE_CONFIG_DIR and cross-platform paths included); standalone runs
|
|
74
|
+
without it default to ~\.config\opencode.
|
|
67
75
|
#>
|
|
68
76
|
#Requires -Version 7.0
|
|
69
77
|
[CmdletBinding()]
|
|
70
78
|
param(
|
|
71
79
|
[switch]$Fix,
|
|
72
|
-
[switch]$Json
|
|
80
|
+
[switch]$Json,
|
|
81
|
+
[string]$ConfigDir
|
|
73
82
|
)
|
|
74
83
|
|
|
75
84
|
$ErrorActionPreference = 'Stop'
|
|
@@ -77,7 +86,7 @@ Set-StrictMode -Version Latest
|
|
|
77
86
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
78
87
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
79
88
|
|
|
80
|
-
$root = Join-Path $env:USERPROFILE '.config\opencode'
|
|
89
|
+
$root = if ($ConfigDir) { $ConfigDir } else { Join-Path $env:USERPROFILE '.config\opencode' }
|
|
81
90
|
|
|
82
91
|
# ---------- declared values (each names its evidence) ----------
|
|
83
92
|
# Required layout paths. Evidence: the harness shape itself (opencode.jsonc
|
|
@@ -209,7 +218,7 @@ function Get-RegistryMcpNames {
|
|
|
209
218
|
$text = ([string]$line).Trim().TrimStart([char[]]@([char]0x2713, [char]0x2717, [char]0x00D7, [char]0x2022, [char]0x002D, [char]0x0020))
|
|
210
219
|
if ([string]::IsNullOrWhiteSpace($text)) { continue }
|
|
211
220
|
$name = @($text -split '\s+' | Where-Object { $_ -ne '' })[0]
|
|
212
|
-
if ($name -and $name -notmatch '(?i)^(id|name|server|status)$') { $names.Add([string]$name) }
|
|
221
|
+
if ($name -and $name -notmatch '(?i)^(id|name|server|status|no)$') { $names.Add([string]$name) }
|
|
213
222
|
}
|
|
214
223
|
return [System.Collections.Generic.List[string]]::new([string[]](@($names | Sort-Object -Unique)))
|
|
215
224
|
}
|
|
@@ -513,6 +522,13 @@ if (-not $configOk) {
|
|
|
513
522
|
}
|
|
514
523
|
|
|
515
524
|
# Law 7: configured MCP servers match the registry in BOTH directions.
|
|
525
|
+
# Registered-but-undeclared servers are machine-global: `opencode mcp list`
|
|
526
|
+
# always merges the default global config (OPENCODE_CONFIG_DIR does not
|
|
527
|
+
# override it), so a harness config that declares no mcp at all reports them
|
|
528
|
+
# as a PASS note, not a regression — a fresh install cannot adopt servers it
|
|
529
|
+
# never declared. Any DECLARED server must register: that direction stays
|
|
530
|
+
# fail-closed, and a config that declares at least one server is graded in
|
|
531
|
+
# both directions.
|
|
516
532
|
if (-not $configOk) {
|
|
517
533
|
Add-ConfigDrift 'configured MCP servers match the registry both directions'
|
|
518
534
|
} elseif (-not $cli) {
|
|
@@ -523,18 +539,22 @@ if (-not $configOk) {
|
|
|
523
539
|
Add-Law 'configured MCP servers match the registry both directions' 'DRIFT' "opencode mcp list exited $($mcpRun.Exit)" "re-run `opencode mcp list` by hand: $($mcpRun.Lines -join ' ')"
|
|
524
540
|
} else {
|
|
525
541
|
$mcpNoServers = ((($mcpRun.Lines -join "`n") -match 'No MCP servers configured'))
|
|
526
|
-
$registryNames = @(
|
|
542
|
+
$registryNames = @()
|
|
543
|
+
if (-not $mcpNoServers) { $registryNames = @(Get-RegistryMcpNames -Lines $mcpRun.Lines) }
|
|
527
544
|
$mcpProblems = [System.Collections.Generic.List[string]]::new()
|
|
528
545
|
foreach ($name in $configuredMcp) {
|
|
529
546
|
if ($registryNames -notcontains $name) { $mcpProblems.Add("declared server '$name' is not registered") }
|
|
530
547
|
}
|
|
531
|
-
foreach ($name in $registryNames) {
|
|
532
|
-
if ($configuredMcp -notcontains $name) { $mcpProblems.Add("registered server '$name' is not declared in opencode.jsonc") }
|
|
533
|
-
}
|
|
534
548
|
if ($mcpNoServers -and $configuredMcp.Count -gt 0) { $mcpProblems.Add("declared MCP servers are not registered: $($configuredMcp -join ', ')") }
|
|
549
|
+
$undeclaredRegistrations = @($registryNames | Where-Object { $configuredMcp -notcontains $_ })
|
|
550
|
+
if ($undeclaredRegistrations.Count -gt 0 -and $configuredMcp.Count -gt 0) {
|
|
551
|
+
$mcpProblems.Add("registered servers not declared in opencode.jsonc: $($undeclaredRegistrations -join ', ')")
|
|
552
|
+
}
|
|
535
553
|
if ($mcpProblems.Count -gt 0) {
|
|
536
554
|
Add-Law 'configured MCP servers match the registry both directions' 'FAIL' ($mcpProblems -join '; ') `
|
|
537
555
|
"run from $root (project configs in cwd merge into the registry); then reconcile the mcp block in opencode.jsonc with ``opencode mcp list`` (see <EVIDENCE_ARCHIVE>\.docs\playwright-mcp-browser-tool.md): $($mcpProblems -join '; ')"
|
|
556
|
+
} elseif ($undeclaredRegistrations.Count -gt 0) {
|
|
557
|
+
Add-Law 'configured MCP servers match the registry both directions' 'PASS' "no MCP servers declared in opencode.jsonc; the registry reports machine-global servers it has not adopted: $($undeclaredRegistrations -join ', ') (add an mcp block to adopt them)"
|
|
538
558
|
} else {
|
|
539
559
|
$mcpDetail = if ($registryNames.Count -eq 0) { 'no MCP servers declared or registered' } else { "declared and registered agree: $($registryNames -join ', ')" }
|
|
540
560
|
Add-Law 'configured MCP servers match the registry both directions' 'PASS' $mcpDetail
|