@matt82198/aesop 0.1.0-beta.3 → 0.1.0-beta.5

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 (234) hide show
  1. package/CHANGELOG.md +79 -95
  2. package/CLAUDE-TEMPLATE.md +115 -0
  3. package/README.md +126 -245
  4. package/aesop.config.example.json +34 -26
  5. package/bin/CLAUDE.md +67 -0
  6. package/bin/cli.js +593 -36
  7. package/daemons/CLAUDE.md +36 -0
  8. package/daemons/backup-fleet.sh +92 -21
  9. package/daemons/run-watchdog.sh +95 -12
  10. package/dash/CLAUDE.md +32 -0
  11. package/dash/dash-extra.mjs +194 -21
  12. package/dash/watchdog-gui.sh +23 -6
  13. package/docs/BEHAVIORAL-PR-REVIEW.md +86 -0
  14. package/docs/CHECKPOINTING.md +100 -0
  15. package/docs/DISPATCH-MODEL.md +11 -7
  16. package/docs/FORENSICS.md +204 -0
  17. package/docs/GOVERNANCE.md +4 -2
  18. package/docs/HOOK-INSTALL.md +307 -0
  19. package/docs/HOW-THE-LOOP-WORKS.md +175 -0
  20. package/docs/MEMORY-TEMPLATE.md +61 -0
  21. package/docs/README.md +44 -0
  22. package/docs/RELEASING.md +159 -0
  23. package/docs/RELIABILITY.md +61 -0
  24. package/docs/RESTORE.md +397 -0
  25. package/docs/SCRIPTS-POLICY.md +97 -0
  26. package/docs/archive/README.md +3 -0
  27. package/docs/archive/spikes/tiered-cognition/ACTIVATION.md +125 -0
  28. package/docs/archive/spikes/tiered-cognition/DESIGN.md +287 -0
  29. package/docs/archive/spikes/tiered-cognition/FINDINGS.md +113 -0
  30. package/docs/archive/spikes/tiered-cognition/README.md +27 -0
  31. package/docs/archive/spikes/tiered-cognition/aesop-cognition.example.md +32 -0
  32. package/docs/archive/spikes/tiered-cognition/force-model-policy.merged.mjs +673 -0
  33. package/docs/archive/spikes/tiered-cognition/strip-tools-hook.mjs +434 -0
  34. package/docs/case-study-portfolio.md +61 -0
  35. package/docs/self-stats-data.json +11 -0
  36. package/docs/templates/FLEET-OPS-ANALYSIS.example.md +27 -0
  37. package/docs/templates/FLEET-OPS-RECOMMENDATIONS.example.md +24 -0
  38. package/docs/templates/PROPOSALS-LOG.example.md +64 -0
  39. package/hooks/CLAUDE.md +61 -0
  40. package/hooks/claude/force-model-policy.mjs +159 -0
  41. package/hooks/pre-push-policy.sh +753 -0
  42. package/mcp/CLAUDE.md +213 -0
  43. package/mcp/package.json +26 -0
  44. package/mcp/server.mjs +543 -0
  45. package/monitor/.signal-state.json +3 -0
  46. package/monitor/ACTIONS.log +1 -0
  47. package/monitor/BRIEF.md +24 -0
  48. package/monitor/CHARTER.md +75 -88
  49. package/monitor/CLAUDE.md +40 -0
  50. package/monitor/SIGNALS.json +54 -0
  51. package/monitor/collect-signals.mjs +613 -61
  52. package/package.json +15 -3
  53. package/scan/fleet-scan.example.mjs +292 -0
  54. package/skills/CLAUDE.md +3 -0
  55. package/skills/healthcheck/SKILL.md +44 -0
  56. package/skills/power/SKILL.md +161 -0
  57. package/state_store/CLAUDE.md +39 -0
  58. package/state_store/__init__.py +24 -0
  59. package/state_store/__pycache__/__init__.cpython-314.pyc +0 -0
  60. package/state_store/__pycache__/api.cpython-314.pyc +0 -0
  61. package/state_store/__pycache__/export.cpython-314.pyc +0 -0
  62. package/state_store/__pycache__/ingest.cpython-314.pyc +0 -0
  63. package/state_store/__pycache__/projections.cpython-314.pyc +0 -0
  64. package/state_store/__pycache__/store.cpython-314.pyc +0 -0
  65. package/state_store/api.py +35 -0
  66. package/state_store/export.py +19 -0
  67. package/state_store/ingest.py +24 -0
  68. package/state_store/projections.py +52 -0
  69. package/state_store/store.py +102 -0
  70. package/tools/CLAUDE.md +72 -0
  71. package/tools/__pycache__/alert_bridge.cpython-314.pyc +0 -0
  72. package/tools/__pycache__/buildlog.cpython-314.pyc +0 -0
  73. package/tools/__pycache__/ci_merge_wait.cpython-314.pyc +0 -0
  74. package/tools/__pycache__/ensure_state.cpython-314.pyc +0 -0
  75. package/tools/__pycache__/eod_sweep.cpython-314.pyc +0 -0
  76. package/tools/__pycache__/fleet_ledger.cpython-314.pyc +0 -0
  77. package/tools/__pycache__/fleet_prompt_extractor.cpython-314.pyc +0 -0
  78. package/tools/__pycache__/healthcheck.cpython-314.pyc +0 -0
  79. package/tools/__pycache__/heartbeat.cpython-314.pyc +0 -0
  80. package/tools/__pycache__/inbox_drain.cpython-314.pyc +0 -0
  81. package/tools/__pycache__/launch_tui.cpython-314.pyc +0 -0
  82. package/tools/__pycache__/metrics_gate.cpython-314.pyc +0 -0
  83. package/tools/__pycache__/orchestrator_status.cpython-314.pyc +0 -0
  84. package/tools/__pycache__/power_selftest.cpython-314.pyc +0 -0
  85. package/tools/__pycache__/prepublish_scan.cpython-314.pyc +0 -0
  86. package/tools/__pycache__/rotate_logs.cpython-314.pyc +0 -0
  87. package/tools/__pycache__/scanner_selftest.cpython-314.pyc +0 -0
  88. package/tools/__pycache__/secret_scan.cpython-314.pyc +0 -0
  89. package/tools/__pycache__/self_stats.cpython-314.pyc +0 -0
  90. package/tools/__pycache__/session_usage_summary.cpython-314.pyc +0 -0
  91. package/tools/__pycache__/stall_check.cpython-314.pyc +0 -0
  92. package/tools/__pycache__/transcript_replay.cpython-314.pyc +0 -0
  93. package/tools/__pycache__/transcript_timeline.cpython-314.pyc +0 -0
  94. package/tools/__pycache__/verify_dash.cpython-314.pyc +0 -0
  95. package/tools/__pycache__/verify_submit_encoding.cpython-314.pyc +0 -0
  96. package/tools/agent-forensics.sh +186 -0
  97. package/tools/alert_bridge.py +449 -0
  98. package/tools/buildlog.py +182 -0
  99. package/tools/ci_merge_wait.py +317 -0
  100. package/tools/ensure_state.py +94 -0
  101. package/tools/eod_sweep.py +239 -0
  102. package/tools/fleet_ledger.py +272 -0
  103. package/tools/fleet_prompt_extractor.py +134 -0
  104. package/tools/healthcheck.py +296 -0
  105. package/tools/heartbeat.py +131 -0
  106. package/tools/inbox_drain.py +249 -0
  107. package/tools/launch_tui.py +51 -3
  108. package/tools/lock.mjs +211 -0
  109. package/tools/metrics_gate.py +205 -0
  110. package/tools/orchestrator_status.py +99 -0
  111. package/tools/power_selftest.py +386 -0
  112. package/tools/prepublish_scan.py +84 -0
  113. package/tools/proposals.mjs +248 -0
  114. package/tools/reconstitute.sh +467 -0
  115. package/tools/rotate_logs.py +228 -0
  116. package/tools/scanner_selftest.py +303 -0
  117. package/tools/secret_scan.py +138 -31
  118. package/tools/self_stats.py +509 -0
  119. package/tools/session_usage_summary.py +198 -0
  120. package/tools/stall_check.py +172 -0
  121. package/tools/svg_to_png.mjs +50 -0
  122. package/tools/transcript_replay.py +236 -0
  123. package/tools/transcript_timeline.py +184 -0
  124. package/tools/verify_dash.py +513 -0
  125. package/tools/verify_submit_encoding.py +202 -0
  126. package/ui/CLAUDE.md +125 -0
  127. package/ui/__pycache__/agents.cpython-314.pyc +0 -0
  128. package/ui/__pycache__/collectors.cpython-314.pyc +0 -0
  129. package/ui/__pycache__/config.cpython-314.pyc +0 -0
  130. package/ui/__pycache__/cost.cpython-314.pyc +0 -0
  131. package/ui/__pycache__/csrf.cpython-314.pyc +0 -0
  132. package/ui/__pycache__/handler.cpython-314.pyc +0 -0
  133. package/ui/__pycache__/render.cpython-314.pyc +0 -0
  134. package/ui/__pycache__/serve.cpython-314.pyc +0 -0
  135. package/ui/__pycache__/sse.cpython-314.pyc +0 -0
  136. package/ui/agents.py +183 -0
  137. package/ui/api/__init__.py +84 -0
  138. package/ui/api/__pycache__/__init__.cpython-314.pyc +0 -0
  139. package/ui/api/__pycache__/submit.cpython-314.pyc +0 -0
  140. package/ui/api/__pycache__/tracker.cpython-314.pyc +0 -0
  141. package/ui/api/submit.py +97 -0
  142. package/ui/api/tracker.py +116 -0
  143. package/ui/collectors.py +735 -0
  144. package/ui/config.py +123 -0
  145. package/ui/cost.py +260 -0
  146. package/ui/csrf.py +144 -0
  147. package/ui/handler.py +676 -0
  148. package/ui/render.py +49 -0
  149. package/ui/serve.py +68 -796
  150. package/ui/sse.py +183 -0
  151. package/ui/web/.gitattributes +13 -0
  152. package/ui/web/dist/assets/index-2LZDQirC.js +9 -0
  153. package/ui/web/dist/assets/index-D4M1qyOv.css +1 -0
  154. package/ui/web/dist/index.html +14 -0
  155. package/ui/web/index.html +13 -0
  156. package/ui/web/package-lock.json +2225 -0
  157. package/ui/web/package.json +26 -0
  158. package/ui/web/src/App.test.tsx +74 -0
  159. package/ui/web/src/App.tsx +142 -0
  160. package/ui/web/src/CONTRIBUTING-UI.md +49 -0
  161. package/ui/web/src/components/AgentRow.css +187 -0
  162. package/ui/web/src/components/AgentRow.test.tsx +209 -0
  163. package/ui/web/src/components/AgentRow.tsx +207 -0
  164. package/ui/web/src/components/AgentsPanel.css +108 -0
  165. package/ui/web/src/components/AgentsPanel.test.tsx +41 -0
  166. package/ui/web/src/components/AgentsPanel.tsx +58 -0
  167. package/ui/web/src/components/AlertsPanel.css +88 -0
  168. package/ui/web/src/components/AlertsPanel.test.tsx +51 -0
  169. package/ui/web/src/components/AlertsPanel.tsx +67 -0
  170. package/ui/web/src/components/BacklogPanel.test.tsx +126 -0
  171. package/ui/web/src/components/BacklogPanel.tsx +122 -0
  172. package/ui/web/src/components/CostChart.css +110 -0
  173. package/ui/web/src/components/CostChart.test.tsx +144 -0
  174. package/ui/web/src/components/CostChart.tsx +152 -0
  175. package/ui/web/src/components/CostTable.css +93 -0
  176. package/ui/web/src/components/CostTable.test.tsx +165 -0
  177. package/ui/web/src/components/CostTable.tsx +94 -0
  178. package/ui/web/src/components/EventsFeed.css +68 -0
  179. package/ui/web/src/components/EventsFeed.test.tsx +36 -0
  180. package/ui/web/src/components/EventsFeed.tsx +31 -0
  181. package/ui/web/src/components/HealthHeader.css +137 -0
  182. package/ui/web/src/components/HealthHeader.test.tsx +278 -0
  183. package/ui/web/src/components/HealthHeader.tsx +281 -0
  184. package/ui/web/src/components/InboxForm.css +135 -0
  185. package/ui/web/src/components/InboxForm.test.tsx +208 -0
  186. package/ui/web/src/components/InboxForm.tsx +116 -0
  187. package/ui/web/src/components/MessagesTail.module.css +144 -0
  188. package/ui/web/src/components/MessagesTail.test.tsx +176 -0
  189. package/ui/web/src/components/MessagesTail.tsx +94 -0
  190. package/ui/web/src/components/ReposPanel.css +90 -0
  191. package/ui/web/src/components/ReposPanel.test.tsx +45 -0
  192. package/ui/web/src/components/ReposPanel.tsx +67 -0
  193. package/ui/web/src/components/Scorecard.css +106 -0
  194. package/ui/web/src/components/Scorecard.test.tsx +117 -0
  195. package/ui/web/src/components/Scorecard.tsx +85 -0
  196. package/ui/web/src/components/Timeline.module.css +151 -0
  197. package/ui/web/src/components/Timeline.test.tsx +215 -0
  198. package/ui/web/src/components/Timeline.tsx +99 -0
  199. package/ui/web/src/components/TrackerBoard.test.tsx +121 -0
  200. package/ui/web/src/components/TrackerBoard.tsx +107 -0
  201. package/ui/web/src/components/TrackerCard.test.tsx +180 -0
  202. package/ui/web/src/components/TrackerCard.tsx +160 -0
  203. package/ui/web/src/components/TrackerForm.test.tsx +189 -0
  204. package/ui/web/src/components/TrackerForm.tsx +144 -0
  205. package/ui/web/src/lib/api.ts +218 -0
  206. package/ui/web/src/lib/format.test.ts +89 -0
  207. package/ui/web/src/lib/format.ts +103 -0
  208. package/ui/web/src/lib/sanitizeUrl.test.ts +84 -0
  209. package/ui/web/src/lib/sanitizeUrl.ts +38 -0
  210. package/ui/web/src/lib/types.ts +230 -0
  211. package/ui/web/src/lib/useHashRoute.test.ts +60 -0
  212. package/ui/web/src/lib/useHashRoute.ts +23 -0
  213. package/ui/web/src/lib/useSSE.ts +175 -0
  214. package/ui/web/src/main.tsx +10 -0
  215. package/ui/web/src/styles/global.css +179 -0
  216. package/ui/web/src/styles/theme.css +184 -0
  217. package/ui/web/src/styles/work.css +572 -0
  218. package/ui/web/src/test/fixtures.ts +385 -0
  219. package/ui/web/src/test/setup.ts +49 -0
  220. package/ui/web/src/views/Activity.module.css +43 -0
  221. package/ui/web/src/views/Activity.test.tsx +89 -0
  222. package/ui/web/src/views/Activity.tsx +31 -0
  223. package/ui/web/src/views/Cost.css +87 -0
  224. package/ui/web/src/views/Cost.test.tsx +142 -0
  225. package/ui/web/src/views/Cost.tsx +54 -0
  226. package/ui/web/src/views/Overview.css +51 -0
  227. package/ui/web/src/views/Overview.test.tsx +76 -0
  228. package/ui/web/src/views/Overview.tsx +46 -0
  229. package/ui/web/src/views/Work.test.tsx +82 -0
  230. package/ui/web/src/views/Work.tsx +79 -0
  231. package/ui/web/src/vite-env.d.ts +10 -0
  232. package/ui/web/tsconfig.json +22 -0
  233. package/ui/web/vite.config.ts +25 -0
  234. package/ui/web/vitest.config.ts +12 -0
@@ -0,0 +1,175 @@
1
+ # How the Wave Loop Works (The Fast, Cheap Way)
2
+
3
+ **TL;DR**: Aesop's `/buildsystem` runs one cycle per wave: rank backlog → fan out parallel Haiku agents → watchdog catches hangs → verify + merge → close with audits. The result: **lower cost (Haiku is ~1/3 the cost of Sonnet) and faster wall-clock from running agents in parallel** through parallelism and cheap subagents, while the orchestrator stays busy planning next work.
4
+
5
+ ---
6
+
7
+ ## The Wave Cycle at a Glance
8
+
9
+ A **wave** is one complete delivery loop:
10
+
11
+ ```
12
+ 1. Rank Backlog (~10 min)
13
+
14
+ 2. Fan Out (spawn 5–8 parallel Haiku agents, ~80 min)
15
+
16
+ 3. Watchdog (catch stalls, respawn as needed)
17
+
18
+ 4. Verify + Merge (orchestrator reviews outputs, merges PRs, ~30 min)
19
+
20
+ 5. Close: Audit + Ideation + Fleet Ops (~20 min)
21
+
22
+ 6. NEXT WAVE: feed the backlog with findings
23
+ ```
24
+
25
+ **Wallclock time per wave**: 2–3 hours. **Token spend**: ~$0.03. **What ships**: 5–8 small, tested features/fixes.
26
+
27
+ ---
28
+
29
+ ## 1. Rank Backlog (10 min)
30
+
31
+ Before spawning agents, you decide what to build. Use these lenses:
32
+
33
+ - **Priority**: P1 blockers first, P2 quality/UX, P3 tech debt
34
+ - **Sizing**: fit each item to a Haiku agent (scoped <5 min reasoning)
35
+ - **Ownership**: assign one agent type per item (backend-dev for APIs, frontend-dev for UI, test-bot for test fixes)
36
+
37
+ **Example backlog after ranking**:
38
+ ```
39
+ P1: Fix auth timeout (backend-dev)
40
+ P1: Add verify-dash UTF-8 check (frontend-dev)
41
+ P2: Refactor config loader (backend-dev)
42
+ P3: Simplify hook test suite (test-bot)
43
+ P3: Document wave cycle (docs-agent)
44
+ ```
45
+
46
+ **Productivity win**: Ranked backlog prevents "what should I build next?" tax. Agents don't guess — they execute known work.
47
+
48
+ ---
49
+
50
+ ## 2. Fan Out (80 min, all in parallel)
51
+
52
+ The orchestrator spawns 5–8 Haiku agents **in one command**, one per backlog item. Each agent:
53
+
54
+ - Gets a **scoped brief** (what to build, acceptance criteria)
55
+ - **Works in its own worktree** (no conflicts, safe parallelism)
56
+ - **Commits + pushes** when done
57
+ - **Opens a PR** with a summary
58
+
59
+ Example spawn:
60
+ ```
61
+ → Haiku-1 (auth): "fix timeout, add tests, commit & PR"
62
+ → Haiku-2 (UI): "add UTF-8 check to /submit, update test"
63
+ → Haiku-3 (refactor): "simplify config, preserve API"
64
+ → Haiku-4 (tests): "prune old hooks, keep coverage >90%"
65
+ → Haiku-5 (docs): "write HOW-THE-LOOP-WORKS.md"
66
+ ```
67
+
68
+ **Productivity win**: the agents run concurrently instead of one at a time, and each Haiku costs 1/3 of Sonnet (1/5 of Opus) — so the fleet is both faster in wall-clock and far cheaper than one expensive agent working serially.
69
+
70
+ ---
71
+
72
+ ## 3. Watchdog (Continuous, 80 min)
73
+
74
+ While agents work, a background watchdog:
75
+
76
+ - **Polls every 10s**: checks agent heartbeats and PR status
77
+ - **Respawns hung agents**: if >200s idle, TaskStop + relaunch (max 3 auto-retries)
78
+ - **Escalates hangs**: after 3 retries, mark BLOCKED and surface to you
79
+
80
+ **No human waiting**. The watchdog runs autonomously.
81
+
82
+ ---
83
+
84
+ ## 4. Verify + Merge (30 min)
85
+
86
+ Once all 5 agents finish (or hit 3-retry cap), the orchestrator:
87
+
88
+ 1. **Reviews each PR** (code review, test coverage, no known-broken state)
89
+ 2. **Approves + merges** (or routes back to agent for fixes)
90
+ 3. **Runs integration tests** (do the merged features work together?)
91
+ 4. **Updates main** (all work lands together, not one-at-a-time)
92
+
93
+ **Example merge sequence**:
94
+ ```
95
+ ✓ Haiku-1 PR #95: auth timeout fix (APPROVED)
96
+ ✓ Haiku-2 PR #96: UTF-8 check (APPROVED)
97
+ ✓ Haiku-3 PR #97: config refactor (APPROVED)
98
+ ✓ Haiku-4 PR #98: test prune (APPROVED)
99
+ ✓ Haiku-5 PR #99: docs (APPROVED)
100
+ → Merge all 5 → run integration tests → green ✓
101
+ ```
102
+
103
+ **Productivity win**: Batch PR reviews (all at once) + single merge transaction = faster feedback loops, fewer context-switches.
104
+
105
+ ---
106
+
107
+ ## 5. Close (20 min): Audit + Ideation + Fleet Ops
108
+
109
+ Before the next wave, close this one:
110
+
111
+ - **Audit**: Did all 5 agents follow rules? (branch discipline, secret-scan gate, test coverage)
112
+ - **Ideation**: What went well? What bottlenecked? Any tech-debt findings to backlog?
113
+ - **Fleet ops**: Rotate logs (BUILDLOG.md archives), update MEMORY.md with learnings, clean up worktrees
114
+
115
+ **Example findings**:
116
+ ```
117
+ ✓ 5/5 agents followed rules
118
+ ✓ All PRs had tests
119
+ → Config refactor revealed opportunity: auto-gen schemas (P3, backlog for wave 12)
120
+ → UTF-8 check is cheap; suggest expanding to other endpoints (P2)
121
+ → One agent took 95 min (slightly over 80); consider smaller tasks next wave
122
+ ```
123
+
124
+ **Productivity win**: Intentional retrospective prevents repeating mistakes. Backlog feeds into the next wave's ranking, so you build on learnings, not starting fresh each time.
125
+
126
+ ---
127
+
128
+ ## Why It's Fast & Cheap
129
+
130
+ | Metric | Aesop Wave | All-Opus Equivalent |
131
+ |--------|-----------|-------------------|
132
+ | **Agents** | 5 Haiku + 1 Opus orchestrator | 6 Opus |
133
+ | **Time** | ~2–3 hours (parallel) | ~12+ hours (serial) |
134
+ | **Cost** | ~$0.03 | ~$0.18 |
135
+ | **Test coverage** | Required per agent | Often skipped in time-crunch |
136
+ | **Outputs** | All PRs merged, all tests green | Might be 1–2 half-finished features |
137
+
138
+ **Key levers**:
139
+ 1. **Parallelism**: agents work concurrently instead of one-at-a-time (measured example: wave-10's 5-agent fleet finished in ~293s of wall-clock vs ~897s if run serially — about 3x)
140
+ 2. **Cheap subagents**: Haiku is 1/3 the cost of Sonnet and 1/5 the cost of Opus (exact on both input and output); running many in parallel keeps spend low
141
+ 3. **Orchestrator stays lean**: reads only STATE.md + BUILDLOG.md + git one-liners (no re-reading entire codebase)
142
+ 4. **No idle time**: while agents work, orchestrator plans next phase (never blocking on agents)
143
+
144
+ ---
145
+
146
+ ## When the Loop Stalls (Retry Cap & Escalation)
147
+
148
+ If an agent hangs 3 times on the same task:
149
+
150
+ 1. **Auto-retry 1–3**: Watchdog relaunches agent (same prompt, no changes)
151
+ 2. **On 4th hang**: Mark BLOCKED in BUILDLOG.md, surface to you
152
+ 3. **You decide**: Break the task smaller, escalate to Sonnet, or park it and move on
153
+
154
+ **Why a cap?** Infinite retries waste tokens and hide real problems (task too big, external dependency broken, etc.). 3 retries = 6 min of agent time; if still stuck, it's a human decision.
155
+
156
+ ---
157
+
158
+ ## About /buildsystem and /power Skills
159
+
160
+ **Important**: The `/buildsystem` and `/power` skills are **orchestrator-brain skills** installed to `~/.claude/skills/`, not files inside the aesop template. They are invoked via Claude Code as slash commands.
161
+
162
+ - **Location**: `~/.claude/skills/buildsystem/` and `~/.claude/skills/power/` on your workstation.
163
+ - **Template copy**: The aesop repo contains skill definitions in `skills/` for reference and setup (copy these to `~/.claude/skills/` on first use).
164
+ - **Invocation**: In Claude Code, type `/power` to prime your orchestrator brain, or `/buildsystem` to start a wave cycle.
165
+
166
+ See [skills/power/SKILL.md](../skills/power/SKILL.md) for detailed setup instructions.
167
+
168
+ ## Next Steps
169
+
170
+ 1. Run `/buildsystem` to start a wave (orchestrator handles the flow)
171
+ 2. Monitor via the TUI dashboard (`bash dash/watchdog-gui.sh`)
172
+ 3. After merge, review findings to feed the next backlog
173
+ 4. Rinse, repeat
174
+
175
+ For deep dives on cost/dispatch patterns, see [DISPATCH-MODEL.md](DISPATCH-MODEL.md). For reliability guarantees, see [RELIABILITY.md](RELIABILITY.md).
@@ -0,0 +1,61 @@
1
+ # Memory Index Template
2
+
3
+ This is the canonical index of team facts. Each fact is **one file, one truth**.
4
+
5
+ ## Format
6
+
7
+ ### Index line
8
+ ```
9
+ - [Title](file.md) — [1-line hook]
10
+ ```
11
+
12
+ ### Fact frontmatter
13
+ Every memory file opens with:
14
+ ```
15
+ ---
16
+ name: [Fact name]
17
+ description: [One sentence]
18
+ type: [user|feedback|project|reference]
19
+ ---
20
+ ```
21
+
22
+ **Types**: `user` (who you are), `feedback` (decisions/learnings), `project` (repo-specific), `reference` (how-tos/patterns).
23
+
24
+ ## Examples
25
+
26
+ ### Memory file: `~/.claude/memory/dispatch-principles.md`
27
+
28
+ ```
29
+ ---
30
+ name: Dispatch cost lever
31
+ description: Why Haiku subagents are the single most important cost optimization.
32
+ type: reference
33
+ ---
34
+
35
+ Subagents are ALWAYS Haiku (1/3 Sonnet cost). This is the cost lever.
36
+ Six to eight Haiku agents in parallel cost ~25% of all-Opus fleet...
37
+ [Full context here]
38
+ ```
39
+
40
+ ### Memory file: `~/.claude/memory/team-goals.md`
41
+
42
+ ```
43
+ ---
44
+ name: 2026 Q2 goals
45
+ description: Ship [feature] by end of June, maintain <200ms latency on [metric].
46
+ type: feedback
47
+ ---
48
+
49
+ Primary goal: [...]
50
+ Secondary goal: [...]
51
+ Constraints: [...]
52
+ ```
53
+
54
+ ### Index entry (in MEMORY.md)
55
+
56
+ ```
57
+ - [Dispatch principles](memory/dispatch-principles.md) — Haiku is 1/3 cost, default subagent tier
58
+ - [Team goals](memory/team-goals.md) — Q2 2026 roadmap and constraints
59
+ ```
60
+
61
+ Create new facts by adding a file and an index line. The orchestrator reads the index at session start.
package/docs/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Aesop Documentation Index
2
+
3
+ Aesop is a fable-fleet orchestration harness for Claude Code. It runs fast, cheap delivery waves: parallel Haiku agents, lower cost via Haiku-first dispatch and faster wall-clock via parallel agents.
4
+
5
+ **New to Aesop?** Start here: [HOW-THE-LOOP-WORKS.md](HOW-THE-LOOP-WORKS.md) — a walkthrough of one wave cycle and why it's productive.
6
+
7
+ For deeper governance + operational rules, see the reference docs below.
8
+
9
+ ---
10
+
11
+ ## Quick Start
12
+
13
+ - [HOW-THE-LOOP-WORKS.md](HOW-THE-LOOP-WORKS.md) — Concrete walkthrough of one `/buildsystem` wave (rank → fan out → verify → merge → close)
14
+
15
+ ## Core Governance & Rules (Reference)
16
+
17
+ - [CARDINAL-RULES.md](CARDINAL-RULES.md) — Foundational operational principles (dispatch model, cost, subagent discipline, retry caps)
18
+ - [RELIABILITY.md](RELIABILITY.md) — Reliability core: never wait, inputs always produce outputs, pride bar for completion
19
+ - [CHECKPOINTING.md](CHECKPOINTING.md) — Durable STATE.md/BUILDLOG.md lifecycle, recovery on resume, log rotation patterns
20
+ - [SCRIPTS-POLICY.md](SCRIPTS-POLICY.md) — Local-only execution, shared script library, task-local vs. reusable heuristics
21
+ - [DISPATCH-MODEL.md](DISPATCH-MODEL.md) — Fable/Haiku orchestration patterns and cost calculations
22
+ - [GOVERNANCE.md](GOVERNANCE.md) — Single-instance loops, single-writer files, heartbeat protocol, security gates
23
+
24
+ ## The Five Pillars
25
+
26
+ ### 1. Onboarding Templates
27
+ - [MEMORY-TEMPLATE.md](MEMORY-TEMPLATE.md) — Canonical index format and structure for team memory & facts
28
+
29
+ ### 2. Policy Hooks
30
+ - [HOOK-INSTALL.md](HOOK-INSTALL.md) — Install and customize `hooks/pre-push-policy.sh` (branch/secret enforcement at push time)
31
+
32
+ ### 3. Behavioral PRs
33
+ - [BEHAVIORAL-PR-REVIEW.md](BEHAVIORAL-PR-REVIEW.md) — Checklist for reviewing PRs that modify rules, policies, or orchestration behavior
34
+
35
+ ### 4. Forensics (Git-Bisectable Agent Debugging)
36
+ - [FORENSICS.md](FORENSICS.md) — Reconstruct agent failures using `tools/agent-forensics.sh`; make agent behavior git-debuggable
37
+
38
+ ### 5. Restore (Cross-Machine Reconstitution)
39
+ - [RESTORE.md](RESTORE.md) — Reconstitute Aesop & fleet on a new machine from git + watchdog backups after a wipe
40
+
41
+ ## Operational Guides
42
+
43
+ - [PUBLISHING.md](PUBLISHING.md) — Release Aesop to npm using GitHub Actions with OIDC trusted publishing
44
+ - [av-resilience.md](av-resilience.md) — Antivirus & behavioral-engine resilience patterns for reliable agent execution
@@ -0,0 +1,159 @@
1
+ # Releasing Aesop
2
+
3
+ This document covers the release process for Aesop: version bumping, git tagging, GitHub release creation, and npm publishing with beta dist-tag support.
4
+
5
+ ## Release Types
6
+
7
+ Aesop follows semantic versioning: `MAJOR.MINOR.PATCH[-PRERELEASE]`
8
+
9
+ - **Stable (0.1.0)**: Core orchestration engine stable; backward-compatible API
10
+ - **Beta (0.1.0-beta.N)**: Pre-release builds; may have breaking changes; uses `@beta` npm dist-tag
11
+ - **Patch (0.1.0-beta.N+M)**: Fixes within a beta series; increments local version only
12
+
13
+ ## Full Release Workflow
14
+
15
+ ### 1. Version Bump (`npm version`)
16
+
17
+ ```bash
18
+ # From repo root, on a `release/*` or `docs/*` branch (never main)
19
+ npm version minor # for 0.1.0 → 0.2.0 (stable)
20
+ npm version prerelease # for 0.1.0 → 0.1.1-rc.0 (next beta)
21
+ npm version patch # for 0.1.0-beta.4 → 0.1.0-beta.5 (current beta)
22
+ ```
23
+
24
+ This command:
25
+ - Updates `package.json` version field
26
+ - Creates a git commit `"v<version>"` (only if git is clean)
27
+ - Creates an annotated git tag `v<version>`
28
+ - Does NOT push (safe for local preview)
29
+
30
+ **Pre-check**: Ensure:
31
+ - `package.json` files in repo (root + `ui/web/`) are in sync
32
+ - No uncommitted changes (git status clean)
33
+ - `dist/` is up-to-date (npm run build if needed)
34
+
35
+ ### 2. Verify the Tag Locally
36
+
37
+ ```bash
38
+ # Check the tag was created and points to the right commit
39
+ git tag -l | tail -5
40
+ git show v0.1.0-beta.5
41
+ ```
42
+
43
+ ### 3. Push to Git Remote
44
+
45
+ ```bash
46
+ # Push the branch and the new tag
47
+ git push origin docs/wave15-currency
48
+ git push origin v0.1.0-beta.5
49
+ ```
50
+
51
+ This makes the tag available for GitHub release creation.
52
+
53
+ ### 4. Create GitHub Release
54
+
55
+ GitHub Actions CI automatically creates a release from the tag when pushed. Or manually via GitHub web UI:
56
+
57
+ 1. Go to [Releases](https://github.com/matt82198/aesop/releases)
58
+ 2. Click "Create a new release"
59
+ 3. Select `v0.1.0-beta.5` from the tag dropdown
60
+ 4. Title: `Aesop 0.1.0-beta.5`
61
+ 5. Body (auto-generated or manual):
62
+ ```markdown
63
+ ## What's New
64
+ - State-sourced SQLite backing store (Wave-15)
65
+ - Self-building stats via tools/self_stats.py
66
+ - MCP fleet server integration
67
+ - Alert webhook bridge
68
+ - Onboarding wizard (interactive scaffolder)
69
+ - Healthcheck skill for liveness probes
70
+
71
+ ## Install
72
+ ```bash
73
+ npm install @matt82198/aesop@beta
74
+ ```
75
+
76
+ See [CHANGELOG.md](CHANGELOG.md) for the full list.
77
+ ```
78
+ 6. **For beta releases**: Check "This is a pre-release"
79
+ 7. Click "Publish release"
80
+
81
+ ### 5. Publish to npm
82
+
83
+ ```bash
84
+ # Login (if not already authenticated)
85
+ npm login
86
+
87
+ # For stable releases (0.1.0)
88
+ npm publish --access public
89
+
90
+ # For beta releases (0.1.0-beta.5)
91
+ npm publish --access public --tag beta
92
+
93
+ # Verify the tag was set
94
+ npm view @matt82198/aesop@0.1.0-beta.5 | grep dist-tags
95
+ # Should output:
96
+ # 'dist-tags': { latest: '0.1.0', beta: '0.1.0-beta.5' }
97
+ ```
98
+
99
+ **Pre-check before publish**:
100
+ - `npm run test:all` passes (all test suites green)
101
+ - `npm run build` succeeds in ui/web/
102
+ - `dist/` is committed and up-to-date
103
+ - Changelog is current (CHANGELOG.md updated)
104
+ - No local uncommitted changes
105
+
106
+ ## Verification Checklist
107
+
108
+ After publishing, verify the release is live:
109
+
110
+ ```bash
111
+ # Check npm registry
112
+ npm view @matt82198/aesop@latest # Should show latest stable
113
+ npm view @matt82198/aesop@beta # Should show latest beta
114
+
115
+ # Install in a test dir and verify
116
+ mkdir /tmp/aesop-test && cd /tmp/aesop-test
117
+ npm install @matt82198/aesop@beta
118
+ node -e "console.log(require('./package.json').dependencies)"
119
+ ```
120
+
121
+ ## Rollback (if needed)
122
+
123
+ If a release has a critical bug:
124
+
125
+ 1. **npm**: Deprecate the bad version
126
+ ```bash
127
+ npm deprecate @matt82198/aesop@0.1.0-beta.5 "Critical bug; use @beta instead"
128
+ ```
129
+
130
+ 2. **GitHub**: Delete the release from the web UI (Releases → click release → Delete)
131
+
132
+ 3. **Git**: Delete the tag locally and remotely
133
+ ```bash
134
+ git tag -d v0.1.0-beta.5
135
+ git push origin :refs/tags/v0.1.0-beta.5
136
+ ```
137
+
138
+ 4. **Branch**: Reset the version bump commit (if desired)
139
+ ```bash
140
+ git reset --soft HEAD~1
141
+ # Edit package.json back to previous version
142
+ git add package.json
143
+ git commit -m "Revert: v0.1.0-beta.5 (critical bug)"
144
+ git push origin <branch>
145
+ ```
146
+
147
+ ## Notes
148
+
149
+ - **The `@latest` dist-tag** is reserved for stable releases (no prerelease suffix). Beta releases stay under `@beta`.
150
+ - **Semver gaps**: If beta.4 was skipped, beta.5 jumps directly. No backfilling needed.
151
+ - **Prereleases don't block stable**: Users on `npm install @matt82198/aesop` get the latest stable, not the latest beta.
152
+ - **Local version suffix**: If you need to publish a local build for testing, use `0.1.0-beta.5+local.1` (won't be published to npm, only for local installs).
153
+
154
+ ## References
155
+
156
+ - [npm version](https://docs.npmjs.com/cli/v8/commands/npm-version)
157
+ - [npm publish](https://docs.npmjs.com/cli/v8/commands/npm-publish)
158
+ - [npm dist-tags](https://docs.npmjs.com/cli/v8/commands/npm-dist-tag)
159
+ - [Semantic Versioning](https://semver.org/)
@@ -0,0 +1,61 @@
1
+ # Reliability & Core Obligations
2
+
3
+ **TL;DR**: Three rules for shipping production work: (1) orchestrator never idles (spawn next task while agents run), (2) every action produces observable output (silence = failure), (3) pride bar — verify end-to-end before marking done. Together: reliable, visible, trustworthy automation.
4
+
5
+ ---
6
+
7
+ ## NEVER WAIT: Keep the orchestrator busy
8
+
9
+ The orchestrator must never go idle while background work is in flight. Every moment waiting on agents or builds is spent producing forward progress:
10
+
11
+ - Dispatch the next unblocked work unit
12
+ - Extend planning documentation (roadmaps, next phases)
13
+ - Stage ideas and observations to memory
14
+ - Queue important facts via the inbox pattern
15
+ - Always offer the user an actionable idea for what to do next
16
+
17
+ **Key principle**: "Waiting on X" is never a complete status — it must come with "meanwhile, doing/proposing Y." Never burn cycles re-reading state that scoped agents will report anyway.
18
+
19
+ ## Inputs ALWAYS produce outputs
20
+
21
+ Every dispatched agent, loop cycle, tool run, and workflow MUST emit an observable output:
22
+ - A brief summary
23
+ - A log line
24
+ - A heartbeat signal
25
+ - Or an explicit `FAILED` or `EMPTY` marker
26
+
27
+ **Silence is never acceptable.** No output = failure, and the watchdog treats it as a hang. Never swallow a result; never let a task end without reporting something.
28
+
29
+ ## The pride bar: never ship until you would be proud to deliver it
30
+
31
+ "An agent returned a brief" and "tests pass" are checkpoints, not completion.
32
+
33
+ **Done means:**
34
+ - Verified end-to-end (not just isolated tests)
35
+ - Briefs cross-checked against reality
36
+ - Test artifacts cleaned up
37
+ - Loose ends closed or explicitly logged as pending decisions
38
+ - Nothing known-broken shipped silently
39
+
40
+ If you would hesitate to hand it over under your own name, it is not done — keep going. Shipping something you're not proud of erodes team trust and creates technical debt that costs more to fix later.
41
+
42
+ ## Why these matter
43
+
44
+ **Cache persistence.** Consistent outputs and reliable checkpoints mean the prompt cache stays warm and effective. Broken shortcuts kill cache hit rates and waste tokens.
45
+
46
+ **Team trust.** Silence erodes confidence in agent-driven work. Observable outputs, explicit failures, and the pride bar rebuild and maintain trust.
47
+
48
+ **Cost containment.** Retries, debug loops, and rollbacks all cost tokens. Getting it right the first time (through upfront verification and deliberate finishing) is cheaper than fixing broken work later.
49
+
50
+ ## Implementation checklist
51
+
52
+ - Daemons emit heartbeats every cycle (even on error)
53
+ - Logs are append-only; every action logged with timestamp
54
+ - If a subagent stalls >200s, watchdog respawns it
55
+ - Orchestrator briefs the user with findings while delegating to subagents (never idle)
56
+ - Before marking work done, verify end-to-end and cross-check briefs against reality
57
+ - On task completion, ask: "Would I be proud to deliver this under my name?"
58
+
59
+ ---
60
+
61
+ These three principles together form the **reliability core**: keep working (never wait), always report (inputs → outputs), and never compromise on quality (pride bar). They enable scaling from 1 orchestrator to dozens of parallel subagents without losing control, visibility, or production readiness.