@matt82198/aesop 0.1.0 → 0.3.1

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 (130) hide show
  1. package/CHANGELOG.md +117 -2
  2. package/README.md +59 -218
  3. package/bin/cli.js +168 -41
  4. package/daemons/run-watchdog.sh +16 -4
  5. package/daemons/selfheal.sh +231 -0
  6. package/docs/ANY-REPO.md +427 -0
  7. package/docs/CONTRIBUTING.md +72 -0
  8. package/docs/DEMO.md +334 -0
  9. package/docs/HOOK-INSTALL.md +15 -56
  10. package/docs/INSTALL.md +74 -4
  11. package/docs/PORTING.md +166 -0
  12. package/docs/README.md +33 -3
  13. package/docs/TEAM-STATE.md +372 -0
  14. package/docs/reproduce.md +33 -3
  15. package/driver/CLAUDE.md +150 -0
  16. package/driver/README.md +383 -0
  17. package/driver/aesop.config.example.json +80 -0
  18. package/driver/agent_driver.py +355 -0
  19. package/driver/backend_config.py +253 -0
  20. package/driver/claude_code_driver.py +198 -0
  21. package/driver/codex_driver.py +673 -0
  22. package/driver/openai_compatible_driver.py +249 -0
  23. package/driver/openai_transport.py +179 -0
  24. package/driver/verification_policy.py +75 -0
  25. package/driver/wave_bridge.py +254 -0
  26. package/driver/wave_loop.py +1408 -0
  27. package/driver/wave_scheduler.py +890 -0
  28. package/hooks/pre-push-policy.sh +131 -33
  29. package/mcp/server.mjs +320 -4
  30. package/monitor/collect-signals.mjs +69 -0
  31. package/package.json +22 -14
  32. package/skills/CLAUDE.md +132 -2
  33. package/skills/buildsystem/SKILL.md +330 -0
  34. package/skills/buildsystem/wave-flat-dispatch.template.mjs +658 -0
  35. package/skills/fleet/SKILL.md +113 -0
  36. package/skills/power/SKILL.md +246 -131
  37. package/state_store/__init__.py +4 -2
  38. package/state_store/api.py +19 -4
  39. package/state_store/coordination.py +209 -0
  40. package/state_store/identity.py +51 -0
  41. package/state_store/projections.py +63 -0
  42. package/state_store/read_api.py +156 -0
  43. package/state_store/store.py +185 -73
  44. package/state_store/write_api.py +462 -0
  45. package/templates/wave-presets/data.json +65 -0
  46. package/templates/wave-presets/library.json +65 -0
  47. package/templates/wave-presets/saas.json +64 -0
  48. package/tools/audit_report.py +388 -0
  49. package/tools/bench_runner.py +100 -3
  50. package/tools/ci_merge_wait.py +256 -35
  51. package/tools/ci_workflow_lint.py +430 -0
  52. package/tools/claudemd_drift.py +394 -0
  53. package/tools/claudemd_lint.py +359 -0
  54. package/tools/common.py +39 -3
  55. package/tools/cost_ceiling.py +166 -43
  56. package/tools/cost_econ.py +480 -0
  57. package/tools/cost_projection.py +559 -0
  58. package/tools/crossos_drift.py +394 -0
  59. package/tools/defect_escape.py +252 -0
  60. package/tools/doctor.js +1 -1
  61. package/tools/eod_sweep.py +188 -26
  62. package/tools/fleet.js +260 -0
  63. package/tools/fleet_ledger.py +209 -7
  64. package/tools/git_identity_check.py +315 -0
  65. package/tools/health-score.js +40 -0
  66. package/tools/health_score.py +361 -0
  67. package/tools/metrics_gate.py +13 -4
  68. package/tools/mutation_test.py +523 -0
  69. package/tools/portability_check.py +206 -0
  70. package/tools/proposals.mjs +47 -2
  71. package/tools/reconcile.py +7 -4
  72. package/tools/reproduce.js +405 -0
  73. package/tools/secret_scan.py +207 -65
  74. package/tools/self_stats.py +20 -0
  75. package/tools/stall_check.py +247 -16
  76. package/tools/stateapi_lint.py +325 -0
  77. package/tools/test_battery.py +173 -0
  78. package/tools/transcript_digest.py +380 -0
  79. package/tools/verify_activity_filter.py +437 -0
  80. package/tools/verify_agent_inspector.py +2 -0
  81. package/tools/verify_cost_panel.py +345 -0
  82. package/tools/verify_dash.py +2 -0
  83. package/tools/verify_dispatch_panel.py +301 -0
  84. package/tools/verify_failure_drilldown.py +188 -0
  85. package/tools/verify_prboard.py +2 -0
  86. package/tools/verify_scorecards.py +281 -0
  87. package/tools/verify_submit_encoding.py +2 -0
  88. package/tools/verify_ui_trio.py +409 -0
  89. package/tools/verify_wave_telemetry.py +268 -0
  90. package/tools/wave_backlog_analyzer.py +490 -0
  91. package/tools/wave_ledger_hook.py +150 -0
  92. package/tools/wave_preflight.py +779 -0
  93. package/tools/wave_resume.py +215 -0
  94. package/tools/wave_templates.py +340 -0
  95. package/ui/agents.py +68 -14
  96. package/ui/collectors.py +81 -55
  97. package/ui/config.py +7 -2
  98. package/ui/cost.py +231 -12
  99. package/ui/handler.py +383 -55
  100. package/ui/quality_scorecard.py +232 -0
  101. package/ui/sse.py +3 -3
  102. package/ui/wave_audit_tail.py +213 -0
  103. package/ui/wave_dispatch.py +280 -0
  104. package/ui/wave_failure.py +288 -0
  105. package/ui/wave_gantt.py +152 -0
  106. package/ui/wave_reasoning_tail.py +176 -0
  107. package/ui/wave_telemetry.py +383 -0
  108. package/ui/web/dist/assets/index-CNQxaiOW.css +1 -0
  109. package/ui/web/dist/assets/index-CP68RIh3.js +9 -0
  110. package/ui/web/dist/index.html +2 -2
  111. package/bin/CLAUDE.md +0 -76
  112. package/daemons/CLAUDE.md +0 -36
  113. package/dash/CLAUDE.md +0 -32
  114. package/docs/archive/README.md +0 -3
  115. package/docs/archive/spikes/tiered-cognition/ACTIVATION.md +0 -125
  116. package/docs/archive/spikes/tiered-cognition/DESIGN.md +0 -287
  117. package/docs/archive/spikes/tiered-cognition/FINDINGS.md +0 -113
  118. package/docs/archive/spikes/tiered-cognition/README.md +0 -27
  119. package/docs/archive/spikes/tiered-cognition/aesop-cognition.example.md +0 -32
  120. package/docs/archive/spikes/tiered-cognition/force-model-policy.merged.mjs +0 -673
  121. package/docs/archive/spikes/tiered-cognition/strip-tools-hook.mjs +0 -434
  122. package/hooks/CLAUDE.md +0 -89
  123. package/mcp/CLAUDE.md +0 -213
  124. package/monitor/CLAUDE.md +0 -40
  125. package/scan/CLAUDE.md +0 -30
  126. package/state_store/CLAUDE.md +0 -39
  127. package/tools/CLAUDE.md +0 -79
  128. package/ui/CLAUDE.md +0 -127
  129. package/ui/web/dist/assets/index-0qQYnvMC.js +0 -9
  130. package/ui/web/dist/assets/index-BdIlFieV.css +0 -1
@@ -1,113 +0,0 @@
1
- # Tiered Cognition/Execution — Wave-11 Spike Findings
2
-
3
- **Verdict: GO (conditional)** — mechanism is buildable with today's harness
4
- primitives, the courier round-trip works with full fidelity on a real task,
5
- and the prototype hook passes its self-test. Three conditions must be closed
6
- in wave 12 before activation (below).
7
-
8
- ## What was proven
9
-
10
- 1. **Hook prototype works.** `strip-tools-hook.mjs --self-test`:
11
- **27/27 PASS** (Node v24.16.0). Covers: sonnet/opus/fable dispatches
12
- stripped via the `aesop-cognition` shim rewrite; haiku and
13
- haiku-frontmatter dispatches untouched; blank-model specialist resolution
14
- via agent-catalog frontmatter; escape token honored + audited to
15
- `state/TIER-POLICY-ESCAPES.log`; legacy `[[ALLOW-NON-HAIKU]]`
16
- grandfathered; fork pass-through; call-time deny of Write/Bash under a
17
- sonnet transcript with a redirect-to-work-order reason; allow under haiku;
18
- fail-open on malformed payloads and missing transcripts.
19
- 2. **Courier round-trip works end-to-end on a real change.** A cognition-
20
- authored WORK-ORDER (unified diff + 3 verify steps, DESIGN.md §4) was
21
- applied by a **live Haiku executor sub-dispatch** (the existing model
22
- policy routed it to Haiku with no special handling — the two policies
23
- compose). Result: `status: APPLIED`, all verifies green, byte-exact
24
- application (UTF-8 em-dashes and LF endings survived the
25
- prompt → Write → git-apply path), zero collateral edits, honest typed
26
- brief returned.
27
- 3. **`git apply` is a sufficient fidelity gate.** Because the executor applies
28
- the diff mechanically and the diff carries byte-exact context, any drift
29
- the courier introduces fails the apply loudly instead of corrupting the
30
- file. The verify list then provides positive evidence, not just absence of
31
- error.
32
-
33
- ## Round-trip overhead observed
34
-
35
- | Metric | Value |
36
- |---|---|
37
- | Wall-clock, dispatch → EXEC-BRIEF | **33.9 s** |
38
- | Executor tokens (Haiku) | 33,932 |
39
- | Executor tool uses | 6 (branch check, patch write, apply, 3 verifies) |
40
- | Cognition-side cost | authoring the work-order (one message) + reading a ~200-word brief |
41
-
42
- Interpretation: ~30–60 s and a few-cent Haiku bill per coherent change-set is
43
- acceptable **iff work-orders stay batched** (whole patch + command plan per
44
- round trip). At line-by-line granularity the architecture would be unusable —
45
- batching is a hard rule, not an optimization.
46
-
47
- ## Fidelity risks / what breaks (honest list)
48
-
49
- 1. **Hook composition (must fix before activation).** The live
50
- `force-haiku-subagents.mjs` and this hook both emit `updatedInput` on the
51
- same `Agent|Task` matcher; merge order is undefined. **Condition 1: merge
52
- tier policy into the model-policy hook as one file.** Not fixable by
53
- ordering config alone — one decision point is the correct design anyway.
54
- 2. **Layer-2 tier detection is transcript-sniffed and unverified in-harness.**
55
- The hook payload doesn't name the session model; the prototype infers it
56
- from `transcript_path` JSONL (`message.model` of the last assistant
57
- entry). This works on fixture transcripts, but sidechain/subagent
58
- transcript layout in the current harness build was NOT exercised live
59
- (this spike's session is escape-token-exempt, so a live negative test
60
- wasn't possible without wiring the hook in — out of spike scope).
61
- **Condition 2: validate the sniffer against real subagent transcripts
62
- before trusting Layer 2; treat Layer 1 as the primary control.**
63
- 3. **Specialist prompt loss under the shim rewrite.** Rewriting
64
- `subagent_type` → `aesop-cognition` drops the specialist's system prompt;
65
- the role survives only as a contract-header line. Cognition quality for
66
- typed specialists will degrade until per-specialist cognition variants are
67
- generated (DESIGN §5.2). **Condition 3 for full fleet rollout; not a
68
- blocker for a Fable/Opus-orchestrator-only first phase.**
69
- 4. **Main-thread carve-out undecided.** Uniform Layer-2 denial would break the
70
- orchestrator's legitimate short git one-liners. Needs a read-only Bash
71
- allowlist or a top-session exemption (DESIGN §2.3). Decide at rollout.
72
- 5. **Fail-open stance.** Every failure path passes (consistent with the model
73
- policy hook). A malformed transcript therefore silently disables Layer 2 —
74
- same shape as the known `proposals-lock fail-open` issue. Acceptable for a
75
- guardrail whose primary layer is dispatch-time, but worth a revisit when
76
- Layer 2 is trusted.
77
- 6. **Executor honesty is prompt-enforced, not mechanical.** The brief schema
78
- and "verbatim errors" rule live in the dispatch prompt. A lazy executor
79
- could still fabricate a green brief; mitigation is the existing
80
- owner-verifies rule (the owning tier re-runs/reads the cheap verify
81
- evidence, as done in this spike) plus `git apply`'s mechanical honesty.
82
- 7. **Escape-token smuggling** applies to `[[ALLOW-TIER-TOOLS]]` exactly as to
83
- the model policy's token: prompts are untrusted text. Same mitigation
84
- inherited: never silent, always audited to state log.
85
-
86
- ## GO / NO-GO
87
-
88
- **GO** for wave-12 rollout, phased:
89
-
90
- 1. **Phase A (cheap, high value):** merge tier policy into
91
- `force-haiku-subagents.mjs` (Condition 1); install `aesop-cognition.md` +
92
- an `aesop-executor` Haiku agent def embedding the courier honesty rules;
93
- teach `/buildsystem` dispatch prompts the WORK-ORDER/EXEC-BRIEF schema.
94
- Apply stripping to **opus/fable dispatches only** first (no specialist
95
- prompt loss — Condition 3 deferred safely).
96
- 2. **Phase B:** generate per-specialist cognition variants; extend stripping
97
- to sonnet specialists; measure fix-item throughput vs. the current
98
- Sonnet-hands-on baseline for one wave before making it default.
99
- 3. **Phase C:** wire Layer-2 backstop after validating transcript sniffing on
100
- real sidechains (Condition 2) and deciding the main-thread carve-out.
101
-
102
- Top risk if rolled out as-is without the conditions: **the dual-hook
103
- `updatedInput` collision (risk 1)** — it could silently drop the model
104
- rewrite or the tool strip depending on harness ordering, i.e. a policy hole
105
- that looks green.
106
-
107
- ## Spike inventory (all inert)
108
-
109
- - `docs/spikes/tiered-cognition/DESIGN.md` — mechanism + schemas + executed worked example
110
- - `docs/spikes/tiered-cognition/strip-tools-hook.mjs` — prototype hook, self-test 27/27 PASS
111
- - `docs/spikes/tiered-cognition/aesop-cognition.example.md` — shim agent def (NOT installed)
112
- - `docs/README.md` — one real change, applied by the Haiku executor round-trip
113
- - Nothing wired into `~/.claude/settings.json`, live hooks, or `/buildsystem`.
@@ -1,27 +0,0 @@
1
- # Tiered Cognition/Execution — spike + staged wave-12 artifact
2
-
3
- > **STATUS: CANCELLED 2026-07-14** after A/B testing measured 4.6x weighted cost for identical quality (see MEMORY.md wave-11 entry). Kept for reference; do not activate. Nothing in this directory is wired into `~/.claude/settings.json` or `~/.claude/hooks/`. The live model-policy hook (`force-haiku-subagents.mjs`) is untouched and still governs the fleet.
4
-
5
- ## Contents
6
-
7
- | File | Status | What |
8
- |---|---|---|
9
- | `DESIGN.md` | wave-11 spike | Architecture, hook mechanism, WORK-ORDER/EXEC-BRIEF schemas, executed round-trip |
10
- | `FINDINGS.md` | wave-11 spike | GO (conditional) verdict, risks, phased rollout plan |
11
- | `strip-tools-hook.mjs` | wave-11 prototype | Tier policy alone (superseded by the merged file below) |
12
- | `aesop-cognition.example.md` | example, not installed | Message-only shim agent definition the merged hook rewrites to |
13
- | **`force-model-policy.merged.mjs`** | **wave-12 STAGED CANDIDATE** | Model policy + tier policy merged into ONE hook — the single `updatedInput` owner for the `Agent\|Task` matcher. Self-test: 51/51 PASS (`node force-model-policy.merged.mjs --self-test`) |
14
- | `ACTIVATION.md` | wave-12 runbook | Exact swap-in steps (backup, copy, verify, restart) and rollback |
15
-
16
- ## Why the merged file exists
17
-
18
- FINDINGS.md risk 1 (top risk): the live `force-haiku-subagents.mjs` and the
19
- spike's `strip-tools-hook.mjs` both emit `updatedInput` on the same
20
- `Agent|Task` matcher, with undefined merge order — either rewrite could be
21
- silently dropped. `force-model-policy.merged.mjs` resolves this by computing
22
- the final model (model policy) first, deriving the cognition tier from that
23
- final model, and emitting BOTH rewrites in a single `updatedInput`.
24
-
25
- It is a drop-in replacement candidate for
26
- `~/.claude/hooks/force-haiku-subagents.mjs`. Activation is a deliberate,
27
- user-decided step — follow `ACTIVATION.md` when that decision is made.
@@ -1,32 +0,0 @@
1
- ---
2
- name: aesop-cognition
3
- description: Cognition-tier shim — pure reasoning, no I/O. Receives a COGNITION CONTRACT header naming the role it adopts; emits WORK-ORDER v1 artifacts and dispatches Haiku executors for every real-world action. NOT INSTALLED — wave-11 spike example; copy to ~/.claude/agents/ only at wave-12 rollout.
4
- tools: Agent, SendMessage, TaskStop, Monitor
5
- ---
6
-
7
- You are a cognition-tier agent in Aesop's tiered cognition/execution
8
- architecture. You reason; Haiku acts. You have NO file, exec, or retrieval
9
- tools — do not attempt Read/Write/Edit/Bash/Glob/Grep/WebFetch; they are not
10
- available to you by design, not by accident.
11
-
12
- Operating rules:
13
-
14
- 1. **Adopt the role** named in the `[COGNITION CONTRACT v1]` header of your
15
- prompt (e.g. 'typescript-pro'). Apply that expertise to reasoning and
16
- design, not to direct action.
17
- 2. **All real-world effects go through WORK-ORDER v1** (schema:
18
- docs/spikes/tiered-cognition/DESIGN.md §3). Emit a complete, batched
19
- work-order — a unified diff and/or explicit command list plus verify
20
- steps — never a vague instruction like "fix the tests".
21
- 3. **Dispatch a Haiku executor** (general-purpose agent; the model policy
22
- lands it on Haiku) with the executor contract + your work-order, or return
23
- the work-order to your caller if the caller owns execution.
24
- 4. **Need facts?** Dispatch a Haiku courier with precise questions ("return
25
- lines 40-80 of X", "run the test suite, return the last 20 lines") and
26
- reason over the brief it returns. Never ask for whole-file dumps you
27
- don't need.
28
- 5. **Read the EXEC-BRIEF honestly.** status FAILED/PARTIAL means your
29
- work-order was wrong or the world differs from your model of it — revise
30
- the work-order; never instruct the executor to force it through.
31
- 6. **Batch.** One work-order per coherent change-set; round-trips are the
32
- cost center of this architecture.