tr-plugin-meta-harness 0.0.0-stage → 0.5.26

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 (94) hide show
  1. package/DESIGN.md +86 -0
  2. package/README.md +310 -2
  3. package/capability/BRICK.md +59 -0
  4. package/capability/index.mjs +675 -0
  5. package/cli.mjs +524 -0
  6. package/package.json +32 -4
  7. package/plugin.json +1714 -0
  8. package/skills/meta-harness/SKILL.md +75 -0
  9. package/src/adapters/dsh.mjs +446 -0
  10. package/src/adoption.mjs +102 -0
  11. package/src/agent-user.mjs +194 -0
  12. package/src/alerts.mjs +229 -0
  13. package/src/cascade.mjs +185 -0
  14. package/src/chat.mjs +80 -0
  15. package/src/codex-models.mjs +54 -0
  16. package/src/compat-harness.mjs +114 -0
  17. package/src/control.mjs +145 -0
  18. package/src/coordinator.mjs +307 -0
  19. package/src/dispatch-request.mjs +76 -0
  20. package/src/dispatch.mjs +119 -0
  21. package/src/documentation-authority.mjs +57 -0
  22. package/src/documentation.mjs +240 -0
  23. package/src/executor.mjs +161 -0
  24. package/src/gate-adapters/agy.mjs +155 -0
  25. package/src/gate-adapters/claude.mjs +303 -0
  26. package/src/gate-adapters/cline.mjs +111 -0
  27. package/src/gate-adapters/codex.mjs +164 -0
  28. package/src/gate-adapters/cursor.mjs +164 -0
  29. package/src/gate-adapters/devin.mjs +116 -0
  30. package/src/gate-adapters/dsh.mjs +284 -0
  31. package/src/gate-adapters/grok.mjs +112 -0
  32. package/src/gate-adapters/hermes.mjs +217 -0
  33. package/src/gate-adapters/hook-files.mjs +156 -0
  34. package/src/gate-adapters/index.mjs +131 -0
  35. package/src/gate-adapters/openclaw-plugin/gate-client.js +205 -0
  36. package/src/gate-adapters/openclaw-plugin/index.js +25 -0
  37. package/src/gate-adapters/openclaw-plugin/openclaw.plugin.json +9 -0
  38. package/src/gate-adapters/openclaw-plugin/package.json +15 -0
  39. package/src/gate-adapters/openclaw.mjs +288 -0
  40. package/src/gate-adapters/pi.mjs +146 -0
  41. package/src/gate.mjs +18 -0
  42. package/src/harness-updates.mjs +170 -0
  43. package/src/included-usage.mjs +344 -0
  44. package/src/jobs.mjs +135 -0
  45. package/src/json-reply.mjs +22 -0
  46. package/src/learner.mjs +120 -0
  47. package/src/maintenance.mjs +18 -0
  48. package/src/mcp-server.mjs +228 -0
  49. package/src/model-catalog.mjs +195 -0
  50. package/src/model-selection.mjs +67 -0
  51. package/src/paths.mjs +23 -0
  52. package/src/pool.mjs +69 -0
  53. package/src/process-manager.mjs +246 -0
  54. package/src/process-worker.mjs +18 -0
  55. package/src/reasoning.mjs +231 -0
  56. package/src/remote-operation.mjs +76 -0
  57. package/src/review.mjs +241 -0
  58. package/src/reviews.mjs +25 -0
  59. package/src/router-benchmark-corpus.mjs +16 -0
  60. package/src/router-benchmark.mjs +208 -0
  61. package/src/router.mjs +334 -0
  62. package/src/runtime.mjs +58 -0
  63. package/src/session/claude.mjs +358 -0
  64. package/src/session/codex.mjs +501 -0
  65. package/src/session/result.mjs +90 -0
  66. package/src/session/resume.mjs +393 -0
  67. package/src/session/run.mjs +258 -0
  68. package/src/session-jobs.mjs +77 -0
  69. package/src/setup.mjs +38 -0
  70. package/src/ssss-store.mjs +20 -0
  71. package/src/telemetry.mjs +267 -0
  72. package/src/termination.mjs +28 -0
  73. package/src/threads.mjs +150 -0
  74. package/src/tracker.mjs +133 -0
  75. package/src/usage-queue.mjs +137 -0
  76. package/src/verify-ssss.mjs +102 -0
  77. package/src/worker.mjs +1104 -0
  78. package/src/worktree.mjs +244 -0
  79. package/ui/chunks/adapter-docs-freshness.md +16 -0
  80. package/ui/chunks/chat-handoff.md +26 -0
  81. package/ui/chunks/fleet-maintenance.md +21 -0
  82. package/ui/chunks/harness-inventory.md +21 -0
  83. package/ui/chunks/included-access.md +18 -0
  84. package/ui/chunks/included-usage-verification.md +15 -0
  85. package/ui/chunks/independent-review.md +17 -0
  86. package/ui/chunks/managed-execution.md +20 -0
  87. package/ui/chunks/official-documentation.md +18 -0
  88. package/ui/chunks/quota-recovery.md +21 -0
  89. package/ui/chunks/review-routing-decision.md +16 -0
  90. package/ui/chunks/route-work.md +18 -0
  91. package/ui/chunks/routing-evidence.md +18 -0
  92. package/ui/chunks/run-ledger.md +18 -0
  93. package/ui/chunks/session-controls.md +16 -0
  94. package/ui/home.js +198 -0
package/DESIGN.md ADDED
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: Metaharness
3
+ description: A clear handoff from Total Recall's brain selection to the operator's chosen Chat harness.
4
+ colors:
5
+ canvas: '#0c1427'
6
+ background: '{colors.canvas}'
7
+ surface: '#1e293b'
8
+ text: '#f1f5f9'
9
+ muted: '#94a3b8'
10
+ signal: '#38bdf8'
11
+ primary: '#3b82f6'
12
+ line: '#334155'
13
+ success: '#10b981'
14
+ warning: '#f59e0b'
15
+ danger: '#ef4444'
16
+ typography:
17
+ title:
18
+ fontFamily: system-ui, sans-serif
19
+ fontSize: 18px
20
+ fontWeight: 650
21
+ lineHeight: 1.2
22
+ body:
23
+ fontFamily: system-ui, sans-serif
24
+ fontSize: 14px
25
+ lineHeight: 1.5
26
+ label:
27
+ fontFamily: ui-monospace, monospace
28
+ fontSize: 11px
29
+ fontWeight: 600
30
+ letterSpacing: 0.08em
31
+ rounded:
32
+ frame: 8px
33
+ spacing:
34
+ inset: 16px
35
+ row: 12px
36
+ components:
37
+ chat-handoff:
38
+ backgroundColor: '{colors.canvas}'
39
+ textColor: '{colors.text}'
40
+ typography: '{typography.body}'
41
+ rounded: '{rounded.frame}'
42
+ padding: '{spacing.inset}'
43
+ ---
44
+
45
+ ## Overview
46
+
47
+ Metaharness works like a dispatch board. Readers should understand the selected
48
+ harness, the brain scope and the next action from a quick scan.
49
+
50
+ ## Colors
51
+
52
+ Use the deep navy {colors.canvas} under pale {colors.text}. Reserve blue
53
+ {colors.signal} for the route between the brain selection and its destination.
54
+ Use status colors for verified outcomes from the host.
55
+
56
+ ## Typography
57
+
58
+ Use the quiet, compact {typography.label} for handoff stages. Use
59
+ {typography.title} for the section heading and {typography.body} for instructions.
60
+
61
+ ## Layout
62
+
63
+ Give the heading and route a full-width row at narrow drawer sizes. Stack route
64
+ stages when their labels would wrap. In a wider drawer, use one route line.
65
+
66
+ ## Elevation & Depth
67
+
68
+ Separate the saved route from its controls with a single border. Keep the
69
+ workflow blocks flat so their order stays clear when combined in a drawer.
70
+
71
+ ## Shapes
72
+
73
+ Use compact rounded frames and controls. Label the route stages with text.
74
+
75
+ ## Components
76
+
77
+ The Chat handoff block explains the route. The native Home shows the saved
78
+ harness, registered choices and the optional destination. The bottom drawer
79
+ supplies brain selection and the launch and copy controls. Each operational
80
+ block describes one separate workflow and its observed owner data.
81
+
82
+ ## Do's and Don'ts
83
+
84
+ Show the route in reading order. Keep operational state sourced from Metaharness.
85
+ Keep the handoff marker still and show clear focus and loading states. Use text
86
+ to distinguish saved configuration, draft behavior and unavailable reads.
package/README.md CHANGED
@@ -1,3 +1,311 @@
1
- # Temporary Holding Version
1
+ # Metaharness
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ## Quick start
4
+
5
+ Run these commands with the installed Total Recall CLI. Check candidate retrieval and routing on the local checkout.
6
+
7
+ ### First workflow
8
+
9
+ ```sh
10
+ total-recall meta-harness catalog --json
11
+ ```
12
+
13
+ Read supported adapter IDs and the available permission categories from the catalog.
14
+
15
+ [Local CLI screenshot](docs/projects/in-progress/METAHARNESS_QUICKSTART/quickstart.png) · [Project tracker](docs/projects/in-progress/METAHARNESS_QUICKSTART/METAHARNESS_QUICKSTART_PROJECT_TRACKER.md)
16
+
17
+ ### Practical workflow
18
+
19
+ Start `total-recall meta-harness orchestrate "<task>" --execute --json` with the calling harness's native background function. The tracked command exits with the completed orchestration result. Executed routes and coordination runs also return the final result by default. Use `--background` to explicitly detach and get a job ID. `watch <job-id> --json` is available for an on-demand status check.
20
+
21
+ Run `total-recall meta-harness router-benchmark --json` from a Total Recall source checkout, or use `--core-root /path/to/total-recall` when running from another repository. Read the retrieval metrics, labels and readiness scenarios in the result. Omit `--save` to avoid creating a report record. This benchmark does not execute an agent or call a provider.
22
+
23
+ Catalog entries describe adapters. Local binaries, authentication, quotas, and a completed run are separate evidence. Dispatch or route with `--execute` can create worktrees, invoke metered coding agents, and affect the destination repository.
24
+
25
+ When Metaharness runs as root on Linux, Claude runs as a dedicated non-root Unix
26
+ account with `--permission-mode bypassPermissions`. The operator must provision
27
+ that account with a readable, writable home, install the Linux `acl` package, and
28
+ select it on that node:
29
+
30
+ ```sh
31
+ total-recall meta-harness agent-user <name>
32
+ total-recall meta-harness agent-user --json
33
+ total-recall meta-harness agent-user --clear
34
+ ```
35
+
36
+ Managed agents cannot change this setting. Dispatch refuses an unset user, uid 0,
37
+ an unusable home or a failed ACL grant. ACLs give the account write access to its
38
+ checkout, read access to git metadata, bootstrap files and executables, and
39
+ execute-only access to ancestor directories. Git common directories and `.git`
40
+ entries, including nested repositories, receive read-only protection after all
41
+ other grants. Agent-owned metadata and metadata symlinks are refused. Before
42
+ root runs git after the agent, the harness checks the recorded metadata's type,
43
+ identity, root ownership and exact pointer bytes, and rejects newly created nested
44
+ git metadata. A refused commit preserves the checkout for recovery. Ownership is
45
+ never changed. Git trusts only this checkout through the child process's runtime
46
+ `safe.directory` setting. HOME, USER and LOGNAME select the account; Claude still
47
+ receives its subscription token from Total Recall Auth.
48
+
49
+ Claude's MCP server gets access only to this job's inbox/events under the root
50
+ brain, plus plugin source and Node. `ask`, replies and `operator` approvals use
51
+ those files. `rules` approvals call `total-recall decision run`, which cannot read
52
+ root's brain or Auth store as the agent user, so they deny on failure. MCP alert
53
+ delivery also requires root's Auth access and may fail; questions and approvals
54
+ remain visible through `watch`. No brain or secret-store ACL is granted to work
55
+ around these limits. Other platforms and non-root launches retain their existing
56
+ identity and configuration.
57
+
58
+ `total-recall meta-harness router-benchmark --json` evaluates the real host
59
+ `shortlistActions -> queryCliSemanticIndex` and owner `routeTask` separately.
60
+ It reads the complete installed composable CLI library; no plugin tasks or
61
+ provider calls run. `--k 20 --repeats 3 --catalog-samples 24` are defaults.
62
+ Use `--core-root /absolute/core` to select one verified Total Recall source for both
63
+ catalog CLI and retrieval imports. The library runs as `node <root>/bin/total-recall.mjs`;
64
+ an installed runner cannot override the selection. `TR_PACKAGE_ROOT` remains the
65
+ default host and may also be needed by the owner CLI storage imports at startup.
66
+
67
+ Independent semantic, ambiguous, multi-step and unavailable cases are separate
68
+ from mechanically generated catalog-description probes. Harness cases exercise
69
+ real routing against controlled ready/inactive/quota scenarios, not live readiness.
70
+ JSON includes corpus data/version/hash, catalog fingerprint/hash, source hashes,
71
+ timestamps, individual rankings, recall@k, MRR, top-one accuracy, label coverage,
72
+ candidate reduction and typed-question UTF-8 bytes. Question bytes are a payload
73
+ size measurement, not actual provider prompt usage or token savings. Multiple
74
+ expected groups require all steps; alternatives within a group are interchangeable.
75
+ Absent labels lower coverage and remain in recall denominators.
76
+
77
+ First-call latency excludes module loading and OS cold-cache guarantees; warm
78
+ latency covers subsequent corpus passes. Catalog queries include all declared
79
+ CLI/API/MCP/nested-router capabilities; actionable shortlist measurements are
80
+ separate and exclude unsupported/inactive declarations. Missing installed surfaces
81
+ are explicit coverage gaps. Real-core declaration fixtures are correctness tests,
82
+ separate from live catalog measurements. Retrieval has no abstention or
83
+ activation-enforcement contract: refusal correctness, live execution quality,
84
+ costs and tokens stay null. Scenario refusal correctness belongs to the harness layer.
85
+
86
+ Use `--corpus cases.json` for schema-1 `{id,version,cases}` (plus `schemaVersion:1`),
87
+ with capability cases `{id,layer:"capability",surface:"cli",intent,groups:[[label]],provenance}`;
88
+ surface may also be `api`, `mcp`, or `router`. Harness cases use `layer:"harness"`,
89
+ `scenario:"ready"|"inactive"|"quota"` and `expected:["codex","claude"]` (empty
90
+ means refuse). Labels use declared IDs such as `plugin:auth:cli:status`. Legacy CLI aliases
91
+ resolve from declaration identities, never from router responses.
92
+ `--catalog-samples 0` disables generated probes.
93
+
94
+ `--min-recall`, `--min-mrr`, `--max-p95-ms` fail with exit 1 when unmet.
95
+ `--baseline report.json --max-recall-drop 0` rejects recall regression against a
96
+ matching corpus/catalog/configuration; source hashes may differ for before/after.
97
+ `--allow-catalog-change` permits changed catalogs only with the same fixed corpus
98
+ and compatible resolved label mappings. Use `--catalog-samples 0` or a fixed
99
+ external corpus to compare changing catalogs; dynamic probes remain catalog specific.
100
+ Invalid input or unavailable catalog also fails. `--save` explicitly persists the
101
+ report through the validated owner SSSS ledger and native events; normal routing
102
+ receipts are untouched. Without it the result is returned only on stdout.
103
+
104
+ Built-in and validated custom adapters share one plugin. Use `dispatch` or
105
+ `route --execute` for agent work. `runtime <agent> ...` accepts supported maintenance
106
+ commands such as `codex login status`, `hermes gateway status`, and `dsh models`.
107
+ Manage gateway services through their owning plugins. `cli-agents` is an alias
108
+ for `meta-harness`.
109
+
110
+ `total-recall cli-agents setup` connects all nine native instruction surfaces.
111
+ The declared setup operation also runs during daemon-owned plugin refresh.
112
+ Every dispatched agent receives freshly assembled Total Recall task context and
113
+ a preflight receipt. The configured context budget is honored. Complete CLI,
114
+ plugin and composed-command inventories are supplied in a private temporary
115
+ reference file, keeping their full metadata out of the inline prompt. That file
116
+ is removed after execution. Setup failure or an unready context stops dispatch.
117
+
118
+ `docs-refresh`, `docs-ensure`, `docs-status`, `docs-read` and `docs-search` manage
119
+ downloaded official documentation rather than a list of links. Content is hashed,
120
+ bounded and refreshed after 24 hours. Maintenance uses the existing Total Recall
121
+ daemon's plugin task, attempting every stale adapter per run. Failed pages remain
122
+ visible as failures and cannot certify complete coverage; successful cached
123
+ content remains readable. `setup --node <recorded-node>` selects maintenance
124
+ placement for `maintenance`, `maintenance --models` and `alerts check` without
125
+ creating a second scheduler. `maintenance --harnesses` runs daily on the same node and updates each installed
126
+ harness with that harness's own update command; `--dry-run` reports what is waiting and changes
127
+ nothing. Hermes is asked first, because its update restarts the gateway; pi, cline, openclaw and DSH wait
128
+ while a copy is running. The Hermes and Cursor gates run through a launcher outside the Total Recall
129
+ package, so an update of Total Recall cannot leave their fail-closed hooks without a command. Each maintenance step reports its failures. A failed
130
+ setup or gate install does not prevent documentation refresh for other harnesses.
131
+
132
+ Standalone Total Recall owner for CLI-agent discovery and explicit mesh command execution. Install with `total-recall plugin install <path-or-private-git-url>`. Installation rebuilds the plugin inventory, CLI library and connected instruction surfaces. No model account is created or selected automatically.
133
+
134
+ ```sh
135
+ total-recall cli-agents catalog --json
136
+ total-recall cli-agents nodes --json
137
+ total-recall cli-agents inspect --node <recorded-node> --json
138
+ total-recall cli-agents run-command --stdin --json < request.json
139
+ ```
140
+
141
+ Check adoption without launching a model:
142
+
143
+ ```sh
144
+ total-recall meta-harness adoption --json
145
+ total-recall meta-harness adoption --node <recorded-node> --json
146
+ total-recall meta-harness adoption --all --json
147
+ ```
148
+
149
+ The report separates native login and hook configuration from recent hook
150
+ decisions and completed managed runs. Its run evidence is historical; use the
151
+ timestamps and last attempt to see whether an agent has since stopped working.
152
+ Native hook activity alone does not prove that an agent was launched through
153
+ Metaharness. A fleet report lists offline nodes, missing CLI access, and
154
+ installed versions that cannot provide adoption evidence.
155
+
156
+ `request.json` selects one installed plugin operation, its literal arguments, a node and an agent:
157
+
158
+ ```json
159
+ {
160
+ "pluginId": "git-sentinel",
161
+ "subcommand": "status",
162
+ "args": [],
163
+ "execution": {
164
+ "agent": "codex",
165
+ "node": "local",
166
+ "permissions": { "read": true, "write": false, "send": false, "destructive": false }
167
+ }
168
+ }
169
+ ```
170
+
171
+ For remote nodes, supply `execution.cwd` as an explicit absolute workspace. `agent: "direct"` runs the actual installed Total Recall CLI without a model. A remote agent task enters the destination's installed Metaharness and records its receipt there. Remote access comes from recorded mesh entities and verified SSH configuration; unavailable nodes or binaries produce errors. Secrets are never accepted in an agent prompt. Existing account metadata is inspected without printing credentials or substituting provider API keys.
172
+
173
+ The four permissions are strict boolean **command-effect admission controls**. They allow or deny the selected plugin command before dispatch. They are not a network policy or an OS sandbox for every action a model might propose. Supported adapter write modes are scoped through the vendor CLI; vendor approval and sandbox defaults stay enabled. The host's authenticated authorization still applies.
174
+
175
+ The foreground `dispatch --stdin` request accepts `timeoutMs` from 1 to 540000, defaulting to 300000. Use the managed process or background execution commands for longer jobs. A Claude write request can include explicit `allowedTools` rules such as `["Bash(git status *)"]`. Native permission denials surface as failed dispatch receipts. Agent turn completion and command verification are separate fields.
176
+
177
+ A native login probe reads account metadata. A headless request can still fail if the provider rejects that login. Signed-out and expired Claude subscription sessions produce a failed receipt with `failureKind: "auth"`. Renew the subscription sign-in on the dispatch node and retry a scoped dispatch to verify execution. See [Claude Code authentication](https://code.claude.com/docs/en/iam#renew-an-expiring-login).
178
+
179
+ ### Included usage
180
+
181
+ Run `total-recall meta-harness included-enforce` to limit this node's managed dispatches to included usage. Use `included-status --probe --json` to see the Claude billing bindings and read current Codex allowance without an agent turn. Codex uses the built-in ChatGPT route and requires the signed-in plan to report no paid credit.
182
+
183
+ To approve OpenRouter on this node, run `total-recall meta-harness openrouter-bind <harness> <auth-key-name> --model <openrouter-model-id> --json`. Then select that harness by name when dispatching. Automatic routing continues to choose from the included subscription pool.
184
+
185
+ Run `total-recall harness dispatch codex "Run pwd and report the output" --json` to see the final reply and `toolResults`. Codex, Claude, DSH, Pi, Hermes and OpenClaw report native tool outcomes, available exit codes and bounded output. OpenClaw reports `toolEvidenceError` if its gateway cannot return the run's tool results. For background jobs, run `total-recall meta-harness process logs <job-id> --json` and read `toolResults` in the completion record. Adoption receipts retain the outcomes without the output text.
186
+
187
+ For Claude Max, sign in on the execution host with `claude auth login --claudeai`. Check that Usage credits are off in the account's Usage settings. Pass `{"organization":"<orgId from claude auth status>","usageCreditsEnabled":false}` to `included-bind-claude-plan --stdin`. Metaharness prefers the bound plan and checks the native login on every turn. Keep Usage credits off on that account. Claude manages that switch and enforces the plan limits. [Claude's subscription and SDK billing](https://support.claude.com/en/articles/15036540-use-the-claude-agent-sdk-with-your-claude-plan)
188
+
189
+ Before using `included-bind-claude --stdin`, verify the Max credit grant, key hint and organization in Claude Console. Supply `keyName` (the Total Recall Auth entry), `organization`, the masked `keyHint`, `expiresAt`, `creditSource: "claude-max"`, `paidBalanceCents: 0` and false values for `autoReload`, `paymentMethod` and `invoiced`. The binding expires with the observed grant. Reverify after a key or billing change.
190
+
191
+ `usage-queue --json` lists deferred jobs. Use `usage-retry <id>` after the reported reset to run a replayable job through the same policy, or `usage-cancel <id>` to cancel it. Review a job marked `needsReview` in the original workspace before resubmitting it. A queued result has `queued: true` and a `queueId` and has not succeeded.
192
+
193
+ A completed model turn is distinct from a completed plugin operation. `commandExecutionVerified` requires a successful native shell result. Direct CLI execution returns the CLI process's exit receipt. Muse preserves its actual headless JSONL log and documented process exit status. Verify accounts, provider delivery and mutations through the real runtime.
194
+
195
+ ## Primary contracts checked 2026-10-14
196
+
197
+ | Adapter | Contract |
198
+ | --- | --- |
199
+ | Claude Code | [Headless](https://code.claude.com/docs/en/headless) |
200
+ | Codex | [Non-interactive mode](https://developers.openai.com/codex/noninteractive) |
201
+ | Antigravity | [Headless CLI](https://antigravity.google/docs/cli/headless/) |
202
+ | Cursor | [CLI parameters](https://docs.cursor.com/en/cli/reference/parameters) |
203
+ | DSH | [Official CLI source](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/cli/README.md) |
204
+ | Grok | [Headless scripting](https://docs.x.ai/build/cli/headless-scripting) |
205
+ | Muse | [Headless and CI](https://dev.meta.ai/docs/muse-code/extending) |
206
+ | Pi | [Official CLI reference](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/cli.md) |
207
+ | Hermes | [Official command reference](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/reference/cli-commands.md) |
208
+
209
+ Cursor discovery uses `cursor-agent`; an ambiguous `agent` binary is not assumed to be Cursor. Missing installations are listed as unavailable. Unknown authentication requires explicit agent selection and remains unverified until a real run. Tests exercise literal stdin, bounded child-process cleanup, command admission, recorded SSH access, account checks and completed-result parsing. Run suites on the configured sanctioned test node.
210
+
211
+ ## Isolated task workflows
212
+
213
+ ```sh
214
+ total-recall meta-harness route "describe the task" --json
215
+ total-recall meta-harness route "describe the task" --execute --gate --background --json
216
+ total-recall meta-harness coordinate "describe the task" --mode pipeline --execute --gate --background --json
217
+ total-recall meta-harness review --staged --author <author-harness> --json
218
+ ```
219
+
220
+ Pipeline stages use isolated branches and independent verification. Council
221
+ assessments run concurrently; race candidates require a passing deterministic
222
+ gate. Failed stages stop subsequent work and clean failed checkouts. Deliverable
223
+ branches remain available for review and are never merged automatically. Empty
224
+ diffs return `NO_DIFF`; unreadable reviews never become approvals. Unknown login
225
+ state requires explicit `--allow-unknown-auth`.
226
+
227
+ Single-agent remote commands use recorded mesh access and an explicit absolute
228
+ workspace. Coordinated isolated work and gates reject unsupported remote placement;
229
+ remote worktree/gate transport remains an acceptance gap.
230
+
231
+ All agent dispatch paths, including agent-mediated plugin commands, append native
232
+ SSSS execution receipts. Actual process exit and finish metadata are distinct from
233
+ verification results; unavailable model metadata remains null. Thread operations
234
+ include list, show, create, update, close and delete, using native SSSS state.
235
+
236
+ Every review result is stored in an append-only SSSS ledger beside the thread
237
+ store. It retains the selected diff, commit, reviewer, verdict and disposition,
238
+ including failed reviews and `NO_DIFF`. `reviews --json` reads the ledger.
239
+ Deleting a thread does not remove its reviews. A failed ledger write returns
240
+ `ok: false` with `reviewStoreError` and the completed result.
241
+
242
+ `learn` reports scorecards, walls and proposals from run receipts. Routing reads
243
+ these receipts directly. The memory emit option has been removed.
244
+
245
+ `threads cleanup-fixtures --dry-run` previews the one-time cleanup of exact test
246
+ fixture titles. `threads cleanup-fixtures` applies it and stores the removed IDs,
247
+ titles, statuses, source test files and retained IDs in the same SSSS operation.
248
+ Real end-to-end job threads stay in place, including failed attempts.
249
+
250
+ Custom adapter declarations preserve scoped credentials, optional authentication
251
+ probes and HTTPS documentation URLs. IDs and paths reject traversal and symbolic
252
+ links. Credentials reach only the declaring runner through the auth store. A
253
+ changed documentation URL invalidates old cache freshness.
254
+
255
+ ## Hooks in each harness
256
+
257
+ This plugin owns the adapter for each harness: how a hook call is read, how an answer is written, and where the hook is installed. Total Recall core owns the decision. It warns by default. `total-recall preflight mode` shows or changes that, and shows whether a warning can reach the agent in each harness.
258
+
259
+ `total-recall preflight install --all` installs the hook for every harness present, and maintenance repeats it. `preflight verify` reports `not wired` for Cline, which runs hooks only from plugin code that has not been built. OpenClaw also runs hooks only from plugin code, so this plugin ships one in `src/gate-adapters/openclaw-plugin/`. The installer copies it to `~/.openclaw/total-recall-gate`, registers it through OpenClaw's own CLI, and reloads it in the running gateway. A written file is not proof that a harness runs it, so check `preflight report` for decisions from a real session.
260
+
261
+ Codex skips a new hook until you trust it in `/hooks`. Native subagents are never gated.
262
+
263
+ See `docs/guides/preflight-gate.md` in Total Recall for the full table.
264
+
265
+ ## Verification status
266
+
267
+ The active five-file suite and evidence live in
268
+ `docs/projects/in-progress/META_HARNESS_UNIFICATION/`. Completion requires current
269
+ owner/core suites, plugin/scaffold validation, real dashboard inspection and
270
+ recorded acceptance evidence. Fixture tests do not certify live accounts, remote
271
+ execution or recurring maintenance. The operator requires completing verification
272
+ before Metaharness runs task work.
273
+
274
+ Cloudroom setup material remains under `cloudroom/`. Its plugin implementation
275
+ follows this foundation and requires its own current audit and plan.
276
+
277
+ ### Installed and standalone verification
278
+
279
+ Use the installed plugin for CLI execution and maintenance. The repository has a pure planning capability under `capability/`. The current manifest does not declare it for vendoring. See the [Metaharness tracker](docs/projects/in-progress/META_HARNESS_UNIFICATION/META_HARNESS_UNIFICATION_PROJECT_TRACKER.md) for current package, execution and hook acceptance.
280
+
281
+ ## Default Chat
282
+
283
+ Open **Metaharness** from the dashboard's Plugins folder to select and save a
284
+ default harness. The Chat drawer uses that default with the selected brains.
285
+ Customize the native Home in `DESIGN.md`. The owner blocks in `ui/chunks/`
286
+ cover execution, routing, usage, documentation, maintenance and run evidence.
287
+
288
+ `total-recall meta-harness chat-default codex --json` sets the host's default
289
+ Chat harness. Choose an adapter from the catalog or from the choices returned
290
+ by `total-recall meta-harness chat-target --json`. The default applies to every
291
+ brain selection.
292
+
293
+ For example, `total-recall meta-harness chat-target --brains global,project:docs --json`
294
+ returns the chosen harness and draft context for those two brain IDs. A Codex
295
+ target opens a native draft that the operator can review before sending. Other
296
+ harnesses can use an explicit HTTPS launch URL configured with `--url` and
297
+ copyable context. Use a launch URL without embedded credentials, a query, or a
298
+ fragment. Omitting `--url` selects the adapter's built-in handoff, if available.
299
+
300
+ ## Using this from an agent
301
+
302
+ Send work here to run it in another agent harness, or to find out which harness should take it. Native subagents are separate and never need this.
303
+
304
+ ```bash
305
+ total-recall meta-harness route "<task>" --json
306
+ total-recall meta-harness route "<task>" --execute --json
307
+ total-recall meta-harness status
308
+ total-recall meta-harness docs-search --agent <agent> --query "<terms>"
309
+ ```
310
+
311
+ Raw commands this plugin owns: direct harness runs such as `codex exec`, `claude -p`, `agy -p` and `dsh --profile headless`. It also declares the router, so the gate points agents at `route` once per task.
@@ -0,0 +1,59 @@
1
+ # Metaharness Capability Brick
2
+
3
+ A zero-dependency, host-free pure ES module providing universal agent harness discovery, two-stage complexity classification, cost-vs-frontier routing, gate cascade evaluation, and execution envelope construction.
4
+
5
+ ## Why This Brick Exists
6
+
7
+ Modern software engineering with autonomous AI harnesses suffers from two structural traps:
8
+ 1. **The Correction Penalty**: Sub-frontier models on complex architectural tasks burn more tokens retrying than frontier models take in a single shot.
9
+ 2. **Confirmation Bias**: An agent that writes flawed code often passes its own validation review unless evaluated by a separate model family.
10
+
11
+ This brick encapsulates the core deterministic intelligence needed to route, coordinate, and score agent harnesses without binding your application to any host runtime or secrets store.
12
+
13
+ ## Installation / Vendoring
14
+
15
+ When vendoring into another repository using Total Recall:
16
+ ```bash
17
+ total-recall plugin vendor meta-harness
18
+ ```
19
+
20
+ Or import the capability directly in any standard ES module environment:
21
+ ```javascript
22
+ import {
23
+ createMetaHarness,
24
+ ADAPTER_CATALOG,
25
+ classifyTaskComplexity,
26
+ selectOptimalHarness,
27
+ evaluateGateCascade,
28
+ computeEmpiricalScorecard
29
+ } from './capability/index.mjs';
30
+ ```
31
+
32
+ ## Core API
33
+
34
+ ### `classifyTaskComplexity(taskDescription, options)`
35
+ Analyzes instructions for architectural indicators, security keywords, blast radius, and length:
36
+ ```javascript
37
+ const complexity = classifyTaskComplexity("Refactor auth system to WebAuthn with test verification");
38
+ // Returns: { score: 95, tier: 'frontier', isFrontierRecommended: true, factors: [...] }
39
+ ```
40
+
41
+ ### `selectOptimalHarness(taskDescription, availableHarnesses, quotaStatus)`
42
+ Computes cost-vs-quality utility across available CLI runners:
43
+ ```javascript
44
+ const selection = selectOptimalHarness("Fix typo in README.md", ['agy', 'dsh', 'ollama']);
45
+ // Returns: { selected: 'ollama', complexity: { tier: 'local' }, candidates: [...] }
46
+ ```
47
+
48
+ ### `evaluateGateCascade(currentHarness, gateResults)`
49
+ FrugalGPT gate cascade: keeps cheap models on simple tasks, escalating only upon verified failure:
50
+ ```javascript
51
+ const cascade = evaluateGateCascade('ollama', { testsPassed: false, linterPassed: true });
52
+ // Returns: { escalationRequired: true, recommendedHarness: 'dsh', reason: '...' }
53
+ ```
54
+
55
+ ### `computeEmpiricalScorecard(historyRuns)`
56
+ Aggregates pass rates, failure frequencies, and average latencies across runs:
57
+ ```javascript
58
+ const scorecard = computeEmpiricalScorecard(runs);
59
+ ```