total-recall-brain 3.41.5 → 3.41.6

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 (131) hide show
  1. package/bin/total-recall.mjs +7 -4
  2. package/frontend/dist/assets/index-4tGQfTa2.js +5605 -0
  3. package/frontend/dist/assets/index-DtwsDyFM.css +1 -0
  4. package/frontend/dist/index.html +2 -2
  5. package/frontend/package.json +11 -0
  6. package/frontend/src/App.tsx +47 -122
  7. package/frontend/src/components/plugins/plugin-frame.ts +1 -0
  8. package/frontend/src/index.css +152 -86
  9. package/frontend/src/pages/HelpPage.tsx +13 -10
  10. package/frontend/src/pages/MemoryPage.tsx +28 -30
  11. package/frontend/src/pages/NetworkPage.tsx +3 -3
  12. package/frontend/src/pages/PluginsPage.tsx +6 -5
  13. package/frontend/src/pages/RulesPage.tsx +16 -12
  14. package/package.json +3 -2
  15. package/scaffold/.agent/skills/total-recall/plugins/code-quality/package-lock.json +8 -8
  16. package/scaffold/.agent/skills/total-recall/plugins/code-quality/package.json +3 -0
  17. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package-lock.json +8 -8
  18. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package.json +3 -0
  19. package/scaffold/.agent/skills/total-recall/plugins/embeddings/package-lock.json +8 -8
  20. package/scaffold/.agent/skills/total-recall/plugins/embeddings/package.json +3 -0
  21. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package-lock.json +8 -8
  22. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package.json +3 -0
  23. package/scaffold/.agent/skills/total-recall/plugins/mesh/package-lock.json +8 -8
  24. package/scaffold/.agent/skills/total-recall/plugins/mesh/package.json +4 -1
  25. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh.mjs +1 -1
  26. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/capability/index.mjs +136 -7
  27. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/cli.mjs +135 -26
  28. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/package-lock.json +8 -8
  29. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/package.json +4 -1
  30. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/plugin.json +228 -9
  31. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/skills/meta-harness/SKILL.md +24 -30
  32. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/alerts.mjs +29 -16
  33. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/cascade.mjs +73 -0
  34. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/coordinator.mjs +182 -365
  35. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/dispatch.mjs +33 -0
  36. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/documentation.mjs +9 -3
  37. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/executor.mjs +4 -4
  38. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/agy.mjs +187 -0
  39. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/claude.mjs +275 -0
  40. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/cline.mjs +132 -0
  41. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/codex.mjs +187 -0
  42. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/cursor.mjs +158 -0
  43. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/devin.mjs +157 -0
  44. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/dsh.mjs +183 -0
  45. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/grok.mjs +132 -0
  46. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/hermes.mjs +173 -0
  47. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/index.mjs +87 -0
  48. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/openclaw.mjs +173 -0
  49. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/pi.mjs +129 -0
  50. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate.mjs +12 -0
  51. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/json-reply.mjs +22 -0
  52. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/learner.mjs +72 -70
  53. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/model-catalog.mjs +195 -0
  54. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/paths.mjs +11 -0
  55. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/pool.mjs +36 -0
  56. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/review.mjs +169 -0
  57. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/router.mjs +136 -346
  58. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/runtime.mjs +1 -1
  59. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/ssss-store.mjs +20 -0
  60. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/telemetry.mjs +43 -0
  61. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/threads.mjs +156 -0
  62. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/worker.mjs +117 -35
  63. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/worktree.mjs +51 -0
  64. package/scaffold/.agent/skills/total-recall/plugins/meta-harness/ui/card.js +398 -57
  65. package/scaffold/.agent/skills/total-recall/plugins/openwiki/cli.mjs +10 -0
  66. package/scaffold/.agent/skills/total-recall/plugins/openwiki/package-lock.json +3 -3
  67. package/scaffold/.agent/skills/total-recall/plugins/openwiki/package.json +3 -0
  68. package/scaffold/.agent/skills/total-recall/plugins/openwiki/plugin.json +42 -190
  69. package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/openwiki.mjs +1 -1
  70. package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/mermaid-diagrams/SKILL.md +44 -0
  71. package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/write-connector/SKILL.md +56 -0
  72. package/scaffold/.agent/skills/total-recall/plugins/security/package-lock.json +8 -8
  73. package/scaffold/.agent/skills/total-recall/plugins/security/package.json +3 -0
  74. package/src/cli/agent.mjs +12 -1
  75. package/src/cli/compact.mjs +2 -2
  76. package/src/cli/connect.mjs +56 -1
  77. package/src/cli/context.mjs +10 -7
  78. package/src/cli/doctor.mjs +5 -2
  79. package/src/cli/harness.mjs +62 -50
  80. package/src/cli/memory-entry.mjs +2 -2
  81. package/src/cli/preflight.mjs +152 -16
  82. package/src/cli/remember.mjs +19 -1
  83. package/src/cli/rules.mjs +54 -12
  84. package/src/cli/startup.mjs +1 -1
  85. package/src/cli/status.mjs +12 -2
  86. package/src/core/claude-hooks.mjs +41 -3
  87. package/src/core/cli-semantic-index.mjs +3 -2
  88. package/src/core/conflict-detector.mjs +23 -12
  89. package/src/core/context-compactor.mjs +2 -0
  90. package/src/core/context-policy.mjs +20 -0
  91. package/src/core/duplicate-guard.mjs +350 -0
  92. package/src/core/meta-harness.mjs +31 -11
  93. package/src/core/preflight-gate.mjs +2 -2
  94. package/src/core/preflight-receipt.mjs +28 -0
  95. package/src/core/scaffold-plugins.mjs +7 -0
  96. package/src/core/stdio-flush.mjs +23 -0
  97. package/src/core/surface.mjs +33 -10
  98. package/src/server/routes/plugins.mjs +2 -2
  99. package/frontend/dist/assets/index-BIQmqDKP.css +0 -1
  100. package/frontend/dist/assets/index-WT3gs-x6.js +0 -5631
  101. package/frontend/src/components/DaemonLogsTab.tsx +0 -54
  102. package/frontend/src/components/ResearchAgendaTab.tsx +0 -712
  103. package/frontend/src/components/TaskQueueTab.tsx +0 -193
  104. package/frontend/src/components/VoiceInput.tsx +0 -112
  105. package/frontend/src/pages/ChatPage.tsx +0 -1059
  106. package/frontend/src/pages/CollabPage.tsx +0 -470
  107. package/frontend/src/pages/DesignDocsPage.tsx +0 -621
  108. package/frontend/src/pages/FilesPage.tsx +0 -393
  109. package/frontend/src/pages/HealthPage.tsx +0 -359
  110. package/frontend/src/pages/InboxPage.tsx +0 -83
  111. package/frontend/src/pages/InstructionsPage.tsx +0 -583
  112. package/frontend/src/pages/IntegrationsPage.tsx +0 -761
  113. package/frontend/src/pages/MeshPage.css +0 -58
  114. package/frontend/src/pages/MeshPage.tsx +0 -1219
  115. package/frontend/src/pages/OkfPage.tsx +0 -535
  116. package/frontend/src/pages/SandboxPage.tsx +0 -113
  117. package/frontend/src/pages/SkillsPage.tsx +0 -1994
  118. package/frontend/src/pages/TasksPage.tsx +0 -427
  119. package/frontend/src/pages/UsagePage.tsx +0 -702
  120. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/README.md +0 -65
  121. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/cli.mjs +0 -76
  122. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/package.json +0 -19
  123. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/plugin.json +0 -266
  124. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/adapters/dsh.mjs +0 -446
  125. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/documentation.mjs +0 -152
  126. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/executor.mjs +0 -71
  127. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/runtime.mjs +0 -36
  128. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/setup.mjs +0 -35
  129. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/worker.mjs +0 -175
  130. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/DESIGN.md +0 -32
  131. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/card.js +0 -575
@@ -130,10 +130,17 @@
130
130
  },
131
131
  {
132
132
  "name": "maintenance",
133
- "description": "Total Recall daemon maintenance: current official documentation and integration surfaces",
133
+ "description": "Daemon maintenance: official documentation and integration surfaces, or the model catalog with --models",
134
134
  "effect": "write",
135
135
  "output": "json",
136
- "args": [],
136
+ "args": [
137
+ {
138
+ "name": "models",
139
+ "flag": "--models",
140
+ "type": "boolean",
141
+ "label": "Refresh the model and benchmark catalog"
142
+ }
143
+ ],
137
144
  "timeout_ms": 600000
138
145
  },
139
146
  {
@@ -259,16 +266,17 @@
259
266
  },
260
267
  {
261
268
  "name": "benchmarks",
262
- "description": "Inspect SWE-bench Pro, Terminal-Bench 2.0, and local empirical pass rates",
269
+ "description": "Sourced model pricing, coding index and leaderboard results, with pass rates measured on this machine",
263
270
  "effect": "read",
264
271
  "output": "json",
265
272
  "args": []
266
273
  },
267
274
  {
268
275
  "name": "route",
269
- "description": "Evaluate task complexity and select optimal harness via two-stage RouteLLM classifier",
270
- "effect": "read",
276
+ "description": "Choose the harness for a task; with --execute, run it on its own branch and escalate on failure",
277
+ "effect": "write",
271
278
  "output": "json",
279
+ "timeout_ms": 600000,
272
280
  "args": [
273
281
  {
274
282
  "name": "task",
@@ -276,6 +284,30 @@
276
284
  "label": "Task description",
277
285
  "required": true,
278
286
  "positional": true
287
+ },
288
+ {
289
+ "name": "execute",
290
+ "flag": "--execute",
291
+ "type": "boolean",
292
+ "label": "Run the task on its own branch"
293
+ },
294
+ {
295
+ "name": "gate",
296
+ "flag": "--gate",
297
+ "type": "boolean",
298
+ "label": "Require the code-quality gate, escalating when it fails"
299
+ },
300
+ {
301
+ "name": "jev",
302
+ "flag": "--jev",
303
+ "type": "boolean",
304
+ "label": "Classify through the decision plugin"
305
+ },
306
+ {
307
+ "name": "tier",
308
+ "flag": "--tier",
309
+ "type": "string",
310
+ "label": "Gate tier: fast | full | remote"
279
311
  }
280
312
  ]
281
313
  },
@@ -297,15 +329,194 @@
297
329
  "flag": "--mode",
298
330
  "type": "string",
299
331
  "label": "pipeline | council | race"
332
+ },
333
+ {
334
+ "name": "execute",
335
+ "flag": "--execute",
336
+ "type": "boolean",
337
+ "label": "Run the agents; without this the plan is only reported"
338
+ },
339
+ {
340
+ "name": "gate",
341
+ "flag": "--gate",
342
+ "type": "boolean",
343
+ "label": "Require the code-quality gate"
344
+ },
345
+ {
346
+ "name": "autoReview",
347
+ "flag": "--auto-review",
348
+ "type": "boolean",
349
+ "label": "Add a cross-model code review"
350
+ },
351
+ {
352
+ "name": "allowSameFamily",
353
+ "flag": "--allow-same-family",
354
+ "type": "boolean",
355
+ "label": "Accept a Verifier from the Implementer's model family"
300
356
  }
301
- ]
357
+ ],
358
+ "timeout_ms": 600000
302
359
  },
303
360
  {
304
361
  "name": "learn",
305
- "description": "Summarize empirical run scorecards and generate memory friction proposals",
362
+ "description": "Summarize run receipts into scorecards and quota walls; --emit writes proposals to memory",
363
+ "effect": "write",
364
+ "output": "json",
365
+ "args": [
366
+ {
367
+ "name": "emit",
368
+ "flag": "--emit",
369
+ "type": "boolean",
370
+ "label": "Write proposals through the memory owner"
371
+ }
372
+ ]
373
+ },
374
+ {
375
+ "name": "alerts",
376
+ "description": "Send operator alerts for quota walls and usage over the threshold",
377
+ "effect": "send",
378
+ "output": "json",
379
+ "args": [
380
+ {
381
+ "name": "action",
382
+ "type": "string",
383
+ "label": "check | test",
384
+ "positional": true
385
+ },
386
+ {
387
+ "name": "threshold",
388
+ "flag": "--threshold",
389
+ "type": "number",
390
+ "label": "Usage percent that triggers an alert"
391
+ },
392
+ {
393
+ "name": "dryRun",
394
+ "flag": "--dry-run",
395
+ "type": "boolean",
396
+ "label": "Report without sending"
397
+ }
398
+ ]
399
+ },
400
+ {
401
+ "name": "decompose",
402
+ "description": "Decompose complex multi-step tasks into specialized Explorer, Architect, Implementer, and Verifier subagent stages",
306
403
  "effect": "read",
307
404
  "output": "json",
308
- "args": []
405
+ "args": [
406
+ {
407
+ "name": "task",
408
+ "type": "string",
409
+ "label": "Task description",
410
+ "required": true,
411
+ "positional": true
412
+ }
413
+ ]
414
+ },
415
+ {
416
+ "name": "orchestrate",
417
+ "description": "Orchestrate multi-step tasks using subagent fan-out, one-way valve context compression, and cross-model verification",
418
+ "effect": "write",
419
+ "output": "json",
420
+ "args": [
421
+ {
422
+ "name": "task",
423
+ "type": "string",
424
+ "label": "Task description",
425
+ "required": true,
426
+ "positional": true
427
+ },
428
+ {
429
+ "name": "orchestrator",
430
+ "flag": "--orchestrator",
431
+ "type": "string",
432
+ "label": "Active orchestrator harness (claude, codex, agy, hermes, cursor)"
433
+ },
434
+ {
435
+ "name": "execute",
436
+ "flag": "--execute",
437
+ "type": "boolean",
438
+ "label": "Execute live stages"
439
+ },
440
+ {
441
+ "name": "autoReview",
442
+ "flag": "--auto-review",
443
+ "type": "boolean",
444
+ "label": "Trigger adversarial code review upon completion"
445
+ },
446
+ {
447
+ "name": "gate",
448
+ "flag": "--gate",
449
+ "type": "boolean",
450
+ "label": "Require the code-quality gate"
451
+ },
452
+ {
453
+ "name": "allowSameFamily",
454
+ "flag": "--allow-same-family",
455
+ "type": "boolean",
456
+ "label": "Accept a Verifier from the Implementer's model family"
457
+ }
458
+ ],
459
+ "timeout_ms": 600000
460
+ },
461
+ {
462
+ "name": "threads",
463
+ "description": "Manage multi-platform agent threads, PR branch tracking, and turn history across all connected platforms",
464
+ "effect": "write",
465
+ "output": "json",
466
+ "args": [
467
+ {
468
+ "name": "action",
469
+ "type": "string",
470
+ "label": "list | show | create | close | delete",
471
+ "required": true,
472
+ "positional": true
473
+ },
474
+ {
475
+ "name": "target",
476
+ "type": "string",
477
+ "label": "Thread ID or title",
478
+ "positional": true
479
+ }
480
+ ]
481
+ },
482
+ {
483
+ "name": "review",
484
+ "description": "Execute automated adversarial cross-model code review on Git diffs, PR branches, or staged changes",
485
+ "effect": "write",
486
+ "output": "json",
487
+ "args": [
488
+ {
489
+ "name": "target",
490
+ "type": "string",
491
+ "label": "Target branch, PR commit, or empty for working-tree",
492
+ "positional": true
493
+ },
494
+ {
495
+ "name": "reviewer",
496
+ "flag": "--reviewer",
497
+ "type": "string",
498
+ "label": "Adversarial reviewer harness"
499
+ },
500
+ {
501
+ "name": "staged",
502
+ "flag": "--staged",
503
+ "type": "boolean",
504
+ "label": "Review staged diffs"
505
+ },
506
+ {
507
+ "name": "author",
508
+ "flag": "--author",
509
+ "type": "string",
510
+ "label": "Harness that wrote the code, excluded with its model family"
511
+ },
512
+ {
513
+ "name": "thread",
514
+ "flag": "--thread",
515
+ "type": "string",
516
+ "label": "Thread to attach the review to"
517
+ }
518
+ ],
519
+ "timeout_ms": 600000
309
520
  }
310
521
  ]
311
522
  },
@@ -314,7 +525,8 @@
314
525
  "command-executor": "src/executor.mjs",
315
526
  "documentation": "src/documentation.mjs",
316
527
  "agent-runtime": "src/runtime.mjs",
317
- "tracker": "src/tracker.mjs"
528
+ "tracker": "src/tracker.mjs",
529
+ "gate-adapters": "src/gate-adapters/index.mjs"
318
530
  },
319
531
  "setup_command": "setup"
320
532
  },
@@ -371,6 +583,13 @@
371
583
  "command": "maintenance",
372
584
  "placement": "selected-node",
373
585
  "timeout_ms": 600000
586
+ },
587
+ {
588
+ "intent": "Automated daily model and benchmark catalog refresh into offline living documents",
589
+ "schedule": "0 3 * * *",
590
+ "command": "maintenance --models",
591
+ "placement": "selected-node",
592
+ "timeout_ms": 300000
374
593
  }
375
594
  ]
376
595
  }
@@ -1,37 +1,31 @@
1
1
  ---
2
2
  name: meta-harness
3
- description: Discover, configure, document, track, route, coordinate, and run coding agent harnesses through Total Recall across mesh nodes.
3
+ description: Discover, route, coordinate, review and run coding agent harnesses through Total Recall across mesh nodes.
4
4
  repo_scoped: false
5
5
  ---
6
6
 
7
7
  # Meta Harness
8
8
 
9
- The Meta Harness plugin coordinates 15+ coding agent runtimes (`agy`, `claude`, `codex`, `grok`, `ollama`, `hermes`, `dsh`, `openclaw`, `aider`, `goose`, `openhands`, `cline`, and IDE runners) across local and remote mesh nodes.
10
-
11
- ## Golden Rules
12
- 1. **Never Hardcode Credential Logic**: All API keys resolve via `total-recall auth secret get <KEY>` using the global encrypted vault.
13
- 2. **Total Recall First**: Every dispatched agent run enforces `total-recall context "<task>"` with `ready:true` and writes a verified preflight receipt.
14
- 3. **Deterministic Complexity Routing**: Use `meta-harness route "<task>"` to classify task complexity and avoid burning frontier quotas on mechanical edits.
15
- 4. **Isolated Verification**: In multi-agent pipelines (`Architect -> Implementer -> Verifier`), the Verifier must execute in an isolated git worktree and employ a distinct model family.
16
-
17
- ## Command Reference
18
-
19
- ### Discovery & Upstream Version Tracking
20
- - `total-recall meta-harness status [--node <id>]`: Check installed binaries, versions, and auth status.
21
- - `total-recall meta-harness tracking [--node <id>]`: Compare installed versions against upstream release tags and changelogs.
22
- - `total-recall meta-harness catalog`: List all built-in and custom declarative adapter contracts.
23
-
24
- ### Smart Routing & Telemetry
25
- - `total-recall meta-harness quota [--node <id>]`: Inspect 5-hour rolling/weekly quotas, credit balances, and free RAM.
26
- - `total-recall meta-harness benchmarks`: View SWE-bench Pro, Terminal-Bench 2.0, and local empirical pass rates.
27
- - `total-recall meta-harness route "<task>"`: Two-stage RouteLLM classifier and gate cascade evaluation.
28
-
29
- ### Multi-Agent Coordination & Mesh Dispatch
30
- - `total-recall meta-harness coordinate "<task>" --mode pipeline`: Run Architect -> Implementer -> Verifier pipeline.
31
- - `total-recall meta-harness coordinate "<task>" --mode council`: Run multi-model consensus review.
32
- - `total-recall meta-harness dispatch <harness> "<prompt>" [--node <id>]`: Dispatch a single task with preflight receipt.
33
-
34
- ### Self-Learning & Adapters
35
- - `total-recall meta-harness learn`: Ingest recent run receipts, update scorecards, and propose memory friction improvements.
36
- - `total-recall meta-harness adapter add <json-or-file>`: Register custom third-party agent harnesses dynamically.
37
- - `total-recall meta-harness adapter list`: View custom registered adapters.
9
+ Coordinates coding agent harnesses across mesh nodes. `cli-agents` is an alias of `meta-harness`. Run `total-recall meta-harness --help` for flags.
10
+
11
+ ## Rules
12
+ 1. **Believe the status words.** `ready` was proved by a login probe. `unverified` has no probe, so only a completed run proves it. `needs_auth`, `blocked` and `exhausted` cannot take work; the reason is in `quotaNote` and in `excluded`.
13
+ 2. **No figure without a source.** `benchmarks` shows only fetched figures with their source and time. A dash means nobody measured it. Adapter quality and cost scores are configured priors, not measurements.
14
+ 3. **Writing happens on a branch.** `route --execute`, `coordinate --execute` and race work in their own worktree on a `meta-harness/...` branch. Nothing merges into your branch; review the branch and merge it yourself.
15
+ 4. **Long runs go to the background.** The host stops plugin commands after 10 minutes, so add `--background` to any multi-stage `--execute` and follow it with `threads list`.
16
+ 5. **Cost.** dsh, hermes and other metered harnesses bill per token, and `route` warns when it picks one. `--jev` also makes a metered call.
17
+
18
+ ## Commands
19
+ - `status`, `inspect --node <id>`, `upstream`, `changelog <agent>`, `catalog`, `nodes`: what is installed, signed in and current.
20
+ - `quota [--node <id>]`: readiness, measured usage and walls, OpenRouter balance, and memory across the fleet.
21
+ - `benchmarks`: pricing, Artificial Analysis indices, SWE-bench Pro, and pass rates from this machine's receipts. Refresh with `maintenance --models`.
22
+ - `route "<task>" [--jev] [--execute [--gate] [--tier fast|full|remote] [--background]]`: pick a harness; with `--execute`, run it and escalate on failure.
23
+ - `coordinate "<task>" --mode pipeline|council|race [--execute] [--gate] [--auto-review] [--allow-same-family] [--background]`: without `--execute` it only reports the plan and its blockers.
24
+ - `decompose "<task>"`: the stages and which ready harness takes each.
25
+ - `review [<git-range>] [--staged] [--author <id>] [--reviewer <id>] [--thread <id>]`: review by another model family. `NO_DIFF` means there was nothing to review.
26
+ - `dispatch --stdin` with JSON `{agent, cwd, prompt, permissions, node, allowUnknownAuth}`: one bootstrapped run with a receipt.
27
+ - `threads list|show|create|close|delete`, `learn [--emit]`, `alerts check|test [--dry-run]`, `adapter list|add|remove`.
28
+ - `docs-status`, `docs-refresh`, `docs-search --query <q>`, `docs-read`, `maintenance`, `setup`, `runtime <agent> <args>`.
29
+
30
+ ## When something fails
31
+ Read `failureKind` on the result. `quota` carries `resetsAt`, and routing avoids that harness until then. `auth` and `not-ready` mean the operator must sign in or install something. These do not count against a harness's pass rate; `agent` and `gate` failures do.
@@ -1,23 +1,36 @@
1
- /**
2
- * Operator Alerts Dispatcher
3
- * Bridges to Total Recall alerts plugin or system notifications.
4
- */
5
-
1
+ /** Operator alerts go through the alerts plugin. A failed send is reported as failed. */
6
2
  import { execFileSync } from 'node:child_process';
3
+ import { readReceipts, activeQuotaWalls } from './learner.mjs';
7
4
 
8
- export async function notifyAlert(alert = {}) {
9
- const { title = 'Meta Harness Notification', message = '', severity = 'info' } = alert;
5
+ const SEVERITY = { info: 'info', warning: 'high', high: 'high', critical: 'critical' };
10
6
 
11
- // Attempt to invoke total-recall alerts if present
7
+ export async function notifyAlert({ title = 'Meta Harness', message = '', severity = 'info', eventId, dryRun = false } = {}) {
8
+ const args = ['alerts', 'send', '--title', title, '--message', message, '--severity', SEVERITY[severity] || 'info', '--source', 'meta-harness'];
9
+ if (eventId) args.push('--event-id', eventId);
10
+ if (dryRun) args.push('--dry-run');
12
11
  try {
13
- const totalRecallBin = process.env.TOTAL_RECALL_BIN || 'total-recall';
14
- execFileSync(totalRecallBin, ['alerts', 'send', '--title', title, '--message', message, '--severity', severity], {
15
- stdio: 'pipe',
16
- timeout: 5000
12
+ execFileSync(process.env.TOTAL_RECALL_BIN || 'total-recall', args, { stdio: 'pipe', timeout: 15000 });
13
+ return { ok: true, title };
14
+ } catch (error) {
15
+ return { ok: false, title, error: String(error.stderr || error.message).slice(0, 300) };
16
+ }
17
+ }
18
+
19
+ /** Alert on quota walls and on measured usage over the threshold. Event ids keep a wall from alerting twice. */
20
+ export async function checkAlerts({ quotas = {}, threshold = 85, dryRun = false } = {}) {
21
+ const walls = activeQuotaWalls(await readReceipts());
22
+ const candidates = Object.entries(walls).map(([harness, wall]) => ({
23
+ title: `Meta Harness: ${harness} is out of quota`,
24
+ message: `${wall.message || 'Quota wall observed.'} Routing avoids ${harness} until ${wall.until}.`,
25
+ severity: 'warning', eventId: `meta-harness-wall-${harness}-${wall.until}`,
26
+ }));
27
+ for (const [id, quota] of Object.entries(quotas)) {
28
+ if (typeof quota?.usagePercent === 'number' && quota.usagePercent > threshold && quota.billingModel !== 'local') candidates.push({
29
+ title: `Meta Harness: ${id} is at ${quota.usagePercent}%`, message: `Measured usage on ${id} is above ${threshold}%.`,
30
+ severity: 'warning', eventId: `meta-harness-usage-${id}-${new Date().toISOString().slice(0, 10)}`,
17
31
  });
18
- return { ok: true, dispatchedVia: 'total-recall-alerts' };
19
- } catch {
20
- // Fallback: console log without crashing
21
- return { ok: true, dispatchedVia: 'fallback-logged', logged: { title, message, severity } };
22
32
  }
33
+ const sent = [];
34
+ for (const alert of candidates) sent.push(await notifyAlert({ ...alert, dryRun }));
35
+ return { ok: sent.every(row => row.ok), threshold, walls, alerts: sent };
23
36
  }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Verification-gated escalation: run the routed harness on its own branch, run the gate,
3
+ * and hand any failure to a stronger harness with the diagnostic.
4
+ */
5
+ import { evaluateGateCascade } from '../capability/index.mjs';
6
+ import { dispatchWithReceipt } from './dispatch.mjs';
7
+ import { notifyAlert } from './alerts.mjs';
8
+ import { recordRunReceipt } from './learner.mjs';
9
+ import { resolvePool } from './pool.mjs';
10
+ import { routeTask } from './router.mjs';
11
+ import { runQualityGate } from './gate.mjs';
12
+ import { isGitRepo, createWorktree, removeWorktree, commitAll, linkDependencies, deleteBranch } from './worktree.mjs';
13
+
14
+ export async function executeRoutedTask(task, options = {}) {
15
+ const cwd = options.cwd || process.cwd();
16
+ if (!isGitRepo(cwd)) throw new Error('Routed execution writes on its own branch, so it must run inside a git repository');
17
+ const route = options.route || await routeTask(task, options);
18
+ if (!route.selected) return { ok: false, route, attempts: [], error: 'No harness can take this task right now.' };
19
+ const pool = options.pool || (await resolvePool(options)).ready.map(h => h.id);
20
+ const maxAttempts = options.maxAttempts || 3;
21
+ const id = `route-${Date.now().toString(36)}`;
22
+ const attempts = [];
23
+ const tried = new Set();
24
+ let harness = route.selected, diagnostic = null, previous = null;
25
+
26
+ for (let index = 1; index <= maxAttempts && harness; index += 1) {
27
+ tried.add(harness);
28
+ const branch = `meta-harness/${id}-${index}-${harness}`;
29
+ const directory = createWorktree(cwd, { branch });
30
+ const attempt = { harness, branch: null, commit: null, gate: null, escalatedFrom: previous };
31
+ attempts.push(attempt);
32
+ try {
33
+ const prompt = `Work only in this checkout. Do not commit; the harness commits your changes.\nTask:\n${task}${diagnostic ? `\n\nA previous attempt by ${previous} failed. Diagnostic:\n${diagnostic}` : ''}`;
34
+ const result = await dispatchWithReceipt({ agent: harness, cwd: directory, contextCwd: cwd, contextTask: task, prompt, permissions: { read: true, write: true }, allowUnknownAuth: true }, { dispatchFn: options.dispatchFn, role: 'Routed', complexityScore: route.complexity?.score, escalatedFrom: previous });
35
+ attempt.ok = result.ok === true;
36
+ attempt.durationMs = result.durationMs;
37
+ attempt.output = result.response || null;
38
+ if (result.ok) {
39
+ attempt.commit = commitAll(directory, `meta-harness: ${task.slice(0, 60)}\n\nAgent: ${harness}`);
40
+ if (attempt.commit) attempt.branch = branch;
41
+ else { attempt.ok = false; attempt.error = 'The agent reported success but changed no files.'; }
42
+ } else {
43
+ attempt.error = result.error;
44
+ attempt.failureKind = result.failureKind;
45
+ }
46
+ if (attempt.ok && options.gate) {
47
+ linkDependencies(cwd, directory);
48
+ attempt.gate = (options.gateFn || runQualityGate)(directory, options.gateOptions);
49
+ // A gate that could not run says nothing about this agent's work, so it does not escalate.
50
+ if (['unavailable', 'unconfigured'].includes(attempt.gate.status)) return { ok: false, route, attempts, error: `The quality gate is ${attempt.gate.status}: ${attempt.gate.summary}` };
51
+ await recordRunReceipt({ harness, role: 'Gate', task, success: attempt.gate.passed, failureKind: attempt.gate.passed ? null : 'gate', error: attempt.gate.passed ? null : attempt.gate.summary, gate: attempt.gate.status });
52
+ attempt.ok = attempt.gate.passed;
53
+ }
54
+ } catch (error) {
55
+ attempt.ok = false;
56
+ attempt.error = String(error.message);
57
+ } finally {
58
+ removeWorktree(cwd, directory);
59
+ // Only the branch this run hands back survives; the attempt record keeps what happened.
60
+ if (!attempt.ok) { deleteBranch(cwd, branch); attempt.branch = null; }
61
+ }
62
+
63
+ if (attempt.ok) return { ok: true, route, gateApplied: Boolean(options.gate), branch: attempt.branch, commit: attempt.commit, harness, attempts };
64
+
65
+ const remaining = pool.filter(item => !tried.has(item));
66
+ const next = remaining.length ? evaluateGateCascade(harness, { testsPassed: false }, remaining) : null;
67
+ diagnostic = attempt.gate?.summary || attempt.error || 'The previous attempt failed.';
68
+ previous = harness;
69
+ harness = next?.recommendedHarness && !tried.has(next.recommendedHarness) ? next.recommendedHarness : null;
70
+ if (harness) await notifyAlert({ title: 'Meta Harness: escalating', message: `${previous} failed on "${task.slice(0, 60)}"; escalating to ${harness}.`, severity: 'warning' });
71
+ }
72
+ return { ok: false, route, gateApplied: Boolean(options.gate), attempts, error: 'No attempt passed.' };
73
+ }