@matt82198/aesop 0.1.0-beta.2 → 0.1.0-beta.4

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 (108) hide show
  1. package/CHANGELOG.md +37 -94
  2. package/CLAUDE-TEMPLATE.md +115 -0
  3. package/README.md +89 -264
  4. package/aesop.config.example.json +27 -26
  5. package/bin/CLAUDE.md +39 -0
  6. package/bin/cli.js +368 -24
  7. package/daemons/CLAUDE.md +33 -0
  8. package/daemons/backup-fleet.sh +92 -21
  9. package/daemons/run-watchdog.sh +90 -10
  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/RELIABILITY.md +61 -0
  23. package/docs/RESTORE.md +397 -0
  24. package/docs/SCRIPTS-POLICY.md +97 -0
  25. package/docs/spikes/tiered-cognition/ACTIVATION.md +125 -0
  26. package/docs/spikes/tiered-cognition/DESIGN.md +287 -0
  27. package/docs/spikes/tiered-cognition/FINDINGS.md +113 -0
  28. package/docs/spikes/tiered-cognition/README.md +29 -0
  29. package/docs/spikes/tiered-cognition/aesop-cognition.example.md +32 -0
  30. package/docs/spikes/tiered-cognition/force-model-policy.merged.mjs +673 -0
  31. package/docs/spikes/tiered-cognition/strip-tools-hook.mjs +434 -0
  32. package/hooks/CLAUDE.md +38 -0
  33. package/hooks/claude/force-model-policy.mjs +159 -0
  34. package/hooks/pre-push-policy.sh +753 -0
  35. package/monitor/.signal-state.json +3 -0
  36. package/monitor/ACTIONS.log +1 -0
  37. package/monitor/BRIEF.md +24 -0
  38. package/monitor/CHARTER.md +29 -8
  39. package/monitor/CLAUDE.md +40 -0
  40. package/monitor/SIGNALS.json +54 -0
  41. package/monitor/collect-signals.mjs +529 -62
  42. package/package.json +12 -3
  43. package/skills/CLAUDE.md +3 -0
  44. package/skills/power/SKILL.md +161 -0
  45. package/tools/CLAUDE.md +191 -0
  46. package/tools/__pycache__/buildlog.cpython-314.pyc +0 -0
  47. package/tools/__pycache__/ci_merge_wait.cpython-314.pyc +0 -0
  48. package/tools/__pycache__/ensure_state.cpython-314.pyc +0 -0
  49. package/tools/__pycache__/eod_sweep.cpython-314.pyc +0 -0
  50. package/tools/__pycache__/fleet_ledger.cpython-314.pyc +0 -0
  51. package/tools/__pycache__/heartbeat.cpython-314.pyc +0 -0
  52. package/tools/__pycache__/inbox_drain.cpython-314.pyc +0 -0
  53. package/tools/__pycache__/launch_tui.cpython-314.pyc +0 -0
  54. package/tools/__pycache__/orchestrator_status.cpython-314.pyc +0 -0
  55. package/tools/__pycache__/power_selftest.cpython-314.pyc +0 -0
  56. package/tools/__pycache__/prepublish_scan.cpython-314.pyc +0 -0
  57. package/tools/__pycache__/rotate_logs.cpython-314.pyc +0 -0
  58. package/tools/__pycache__/scanner_selftest.cpython-314.pyc +0 -0
  59. package/tools/__pycache__/secret_scan.cpython-314.pyc +0 -0
  60. package/tools/__pycache__/stall_check.cpython-314.pyc +0 -0
  61. package/tools/__pycache__/verify_dash.cpython-314.pyc +0 -0
  62. package/tools/__pycache__/verify_submit_encoding.cpython-314.pyc +0 -0
  63. package/tools/agent-forensics.sh +186 -0
  64. package/tools/buildlog.py +182 -0
  65. package/tools/ci_merge_wait.py +204 -0
  66. package/tools/ensure_state.py +94 -0
  67. package/tools/eod_sweep.py +239 -0
  68. package/tools/fleet_ledger.py +272 -0
  69. package/tools/heartbeat.py +131 -0
  70. package/tools/inbox_drain.py +249 -0
  71. package/tools/launch_tui.py +51 -3
  72. package/tools/lock.mjs +211 -0
  73. package/tools/metrics_gate.py +205 -0
  74. package/tools/orchestrator_status.py +99 -0
  75. package/tools/power_selftest.py +386 -0
  76. package/tools/prepublish_scan.py +84 -0
  77. package/tools/proposals.mjs +248 -0
  78. package/tools/reconstitute.sh +467 -0
  79. package/tools/rotate_logs.py +228 -0
  80. package/tools/scanner_selftest.py +303 -0
  81. package/tools/secret_scan.py +131 -31
  82. package/tools/stall_check.py +172 -0
  83. package/tools/verify_dash.py +694 -0
  84. package/tools/verify_submit_encoding.py +194 -0
  85. package/ui/CLAUDE.md +109 -0
  86. package/ui/__pycache__/agents.cpython-314.pyc +0 -0
  87. package/ui/__pycache__/collectors.cpython-314.pyc +0 -0
  88. package/ui/__pycache__/config.cpython-314.pyc +0 -0
  89. package/ui/__pycache__/csrf.cpython-314.pyc +0 -0
  90. package/ui/__pycache__/handler.cpython-314.pyc +0 -0
  91. package/ui/__pycache__/render.cpython-314.pyc +0 -0
  92. package/ui/__pycache__/serve.cpython-314.pyc +0 -0
  93. package/ui/__pycache__/sse.cpython-314.pyc +0 -0
  94. package/ui/agents.py +179 -0
  95. package/ui/api/__init__.py +84 -0
  96. package/ui/api/__pycache__/__init__.cpython-314.pyc +0 -0
  97. package/ui/api/__pycache__/submit.cpython-314.pyc +0 -0
  98. package/ui/api/__pycache__/tracker.cpython-314.pyc +0 -0
  99. package/ui/api/submit.py +58 -0
  100. package/ui/api/tracker.py +116 -0
  101. package/ui/collectors.py +586 -0
  102. package/ui/config.py +114 -0
  103. package/ui/csrf.py +140 -0
  104. package/ui/handler.py +426 -0
  105. package/ui/render.py +29 -0
  106. package/ui/serve.py +68 -796
  107. package/ui/sse.py +168 -0
  108. package/ui/templates/dashboard.html +1202 -0
package/CHANGELOG.md CHANGED
@@ -5,110 +5,53 @@ All notable changes to Aesop are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.0-beta.4] - 2026-07-14
9
+
10
+ ### Added (Wave-13)
11
+ - UI correctness hardening: a11y improvements, contrast fixes, dead marquee removal, monitor-status class.
12
+ - Dashboard UX: accessibility fixes, keyboard navigation improvements.
13
+ - npm packaging fixes: dependency alignment, build optimization.
14
+ - Docs currency: dead-link sweep, reference updates, HOW-THE-LOOP-WORKS clarifications.
15
+ - Test/CI wiring: doc-drift and domain-map test verification.
16
+ - Machinery gates: secret-scan enforcement, pre-push hook gating.
17
+
8
18
  ## [Unreleased]
9
19
 
10
20
  ### Added
21
+ - **Stall Detection** (wave-12): `tools/stall_check.py` silent-hang detection for the agent watchdog.
22
+ - **CI-Gated Merge Helper** (wave-12): `tools/ci_merge_wait.py` awaits CI success before merge.
23
+
24
+ ### Fixed
25
+ - **Wave-12 Stability**: Swallowed failures now loud; `sse.reset_state()` locked for concurrent test isolation; tracker writes in tempdir; symlink/path-injection guards in rotate-logs.
26
+ - **Wave-11 Security**: Dangling symlink inbox rejection; real handler exercise over HTTP; staged merge tier + model policy hook.
11
27
 
12
- #### Dashboard Integrations
13
- - **`dash/dash-extra.mjs`**: Fleet agent detector scans transcripts for running agents, enables web dashboard agent panel. Detects agents in last 12 minutes, color-codes by alert severity, outputs JSON for REST endpoint or TUI text for terminal.
14
- - **`tools/secret_scan.py`**: Pre-push secret/credential detection gate with comprehensive pattern library (PEM keys, AWS/GitHub/Slack/OpenAI tokens, .env patterns, credential filenames). Supports `--staged`, `--history`, and direct path scanning. Pragma escape hatch for allow-pattern-docs. Exit 1 blocks push on findings.
28
+ ## [Wave-10] - 2026-07-10
29
+
30
+ ### Added
31
+ - **UI API Package** (`ui/api/`): Extracted mutation-gate helpers (`validate_mutation()`, `append_to_inbox()`, tracker CRUD handlers) from monolithic handler.py for direct unit testing.
32
+ - **Work-item Tracker**: 4-lane kanban (proposed | ranked | in-progress | done) with full CRUD API and SSE updates, priority chips (P0-P3), expandable item details.
33
+ - **Orchestrator Status Panel**: Real-time activity, phase, age display with stale detection (>30m).
34
+ - **Dashboard ASCII Banner**: Animated audit-phase indicator (tortoise + magnifying glass).
35
+ - **UI Module Refactoring**: Split monolithic `serve.py` → focused modules (`config.py`, `csrf.py`, `render.py`, `handler.py`, `collectors.py`, `agents.py`, `sse.py`).
15
36
 
16
37
  ### Improved
17
- - Web dashboard now properly detects and displays running subagents via `dash-extra.mjs`
18
- - Secret-scan gate now active in watchdog cycle; blocks any push with unscanned credentials
38
+ - **Security**: CSRF on /api/tracker create; XSS whitelist for pr_link (http/https only, blocks javascript:); fail-closed lock with PID liveness.
39
+ - **Stability**: SSE exception handling; timezone-aware datetime; stale lock timestamp spoofing prevention.
19
40
 
20
- ## [1.0.0] - 2026-07-11
41
+ ## [Wave-9] - 2026-06-30
21
42
 
22
43
  ### Added
44
+ - **UI Module Split**: Monolithic `serve.py` refactored into composable modules for maintainability and direct testing (config, csrf, render, handler, collectors, agents, sse).
45
+ - **Real Handler Tests**: Seam tests exercising render, collectors, agents without full HTTP coupling (wave-10 P0 foundation).
23
46
 
24
- #### Web Dashboard (Primary Interface)
25
- - Modern, responsive HTML dashboard replacing terminal UI
26
- - Real-time fleet monitoring with 3-second refresh cycles
27
- - Heartbeat liveness detection for daemon health
28
- - Security alerts panel with unreviewed event tracking
29
- - Inbox integration for direct orchestrator communication
30
- - Agent tracking with status and runtime hints
31
- - **Agent detail expansion**: Click agent rows to view full dispatch prompts, dispatcher, model, and message counts
32
- - **GET /agent endpoint**: RESTful query for agent metadata and full dispatch details
33
- - Repository synchronization status display
34
- - Recent events log with the latest 8 backup operations
35
- - Transcript integration showing main-thread conversation history
36
- - Configurable port (default 8770) via environment variables
37
- - Zero external dependencies (Python 3.10+ stdlib only)
38
-
39
- #### Orchestration Engine
40
- - Fable-fleet dispatch model (orchestrator + Haiku subagents)
41
- - Cost-optimized multi-agent coordination
42
- - Durable git-committed state (STATE.md, BUILDLOG.md)
43
- - Autonomous watchdog daemon with 150-second cycle
44
- - Secret-scan gate on every push (configurable via `tools/secret_scan.py`)
45
- - Heartbeat-based liveness detection (300s watchdog, 3600s monitor)
46
- - Append-only BUILDLOG for recovery and audit trails
47
-
48
- #### Refinement Monitor
49
- - Standing orchestration health monitor (Haiku loop)
50
- - Dual-action tier system (AUTO for immediate, PROPOSE for staged)
51
- - Signal collection and drift detection
52
- - Automated health checks and rule-friction analysis
53
- - Extensible signal collectors via `monitor/collect-signals.mjs`
54
-
55
- #### State Machine & Durability
56
- - Filesystem-first checkpoint design
57
- - Git-committed STATE.md and BUILDLOG.md
58
- - Recovery from machine wipes and interruptions
59
- - Single-writer control file discipline
60
- - Idempotent restart semantics
61
-
62
- #### Security & Observability
63
- - Configurable secret-scan gate (blocks pushes on policy violation)
64
- - Observable machinery (every agent run logged, every cost tracked)
65
- - Security alert collection and triaging
66
- - AV-resilience patterns for Windows environments
67
- - Support for dot-directory backup discovery
68
-
69
- #### Documentation
70
- - Cardinal Rules guide (10 principles for cost-optimized orchestration)
71
- - Dispatch Model documentation (cost analysis, parallel patterns)
72
- - State Machine guide (durability and recovery)
73
- - AV-Resilience guide (Windows security software compatibility)
74
- - Quickstart walkthrough and setup guide
75
- - Architecture deep-dives for extend points
76
-
77
- #### TUI Dashboard (Legacy Alternative)
78
- - Terminal-based dashboard via `dash/watchdog-gui.sh`
79
- - Real-time fleet status display
80
- - Agent activity tracking
81
- - Alert visualization
82
- - Optional jq dependency for JSON parsing
83
-
84
- ### Configuration
85
-
86
- #### aesop.config.json Schema
87
- ```json
88
- {
89
- "aesop_root": "/path/to/aesop",
90
- "state_root": "/path/to/state",
91
- "scan_root": "/path/to/scan",
92
- "transcripts_root": "/path/to/transcripts",
93
- "repos": [
94
- {
95
- "path": "/path/to/repo",
96
- "name": "repo-name"
97
- }
98
- ],
99
- "watchdog_cycle_secs": 150,
100
- "monitor_cycle_secs": 300,
101
- "heartbeat_stale_threshold_secs": 300
102
- }
103
- ```
104
-
105
- ### Development & Extension
106
-
107
- - Plugin architecture for custom signal collectors
108
- - Hook points for watchdog customization
109
- - Dashboard extensibility via JavaScript injection
110
- - Secret-scan policy implementation examples
111
- - Support for Haiku-per-domain decomposition
47
+ ## [0.1.0-beta.3] - 2026-07-12
48
+
49
+ ### Added
50
+ - Hardened rule documentation (CARDINAL-RULES, DISPATCH-MODEL, GOVERNANCE.md).
51
+ - Real orchestration monitor with 10 standing health checks (replaced stub).
52
+
53
+ ### Improved
54
+ - Production observability infrastructure.
112
55
 
113
56
  ---
114
57
 
@@ -0,0 +1,115 @@
1
+ # {{PROJECT_NAME}} — Multi-Agent Orchestration Brain
2
+
3
+ **What**: {{PROJECT_NAME}} is a {{DOMAIN_LIST}} system orchestrated through cost-optimized multi-agent dispatch.
4
+ This is the team's durable brain: cardinal rules, domain map, and memory indexed here.
5
+
6
+ ## Cardinal Rules (how we work reliably at scale)
7
+
8
+ These six rules keep our fleet fast, cheap, and unbreakable:
9
+
10
+ 1. **Subagents are always Haiku** (cost optimization at scale). Orchestrator (Opus/Sonnet) on main thread only.
11
+ 2. **Orchestrator is durable**: STATE.md + BUILDLOG.md committed to git; survive wipes and interruptions.
12
+ 3. **State gates everything**: No decision without git commit + push. Diff = behavior record.
13
+ 4. **Secret-scan gates every push**: `tools/secret_scan.py` blocks credentials. No override, no exceptions.
14
+ 5. **Idempotent + append-only**: Safe to restart mid-cycle. BUILDLOG.md never rewrites, only appends.
15
+ 6. **Observable machinery**: Every agent dispatch logged. Every cost tracked. Every security event audited.
16
+
17
+ Read `docs/CARDINAL-RULES.md` for the full 10 rules and rationale. Single-writer discipline and heartbeat patterns are in `docs/GOVERNANCE.md`.
18
+
19
+ ## Domain Map (our system structure)
20
+
21
+ Each domain maps to one Haiku subagent. Orchestrator dispatch = tiny, scoped, cheap.
22
+
23
+ {{DOMAINS}}
24
+
25
+ ## Team Memory Structure
26
+
27
+ Facts live in `~/.claude/MEMORY.md` (index) and individual files in `~/.claude/memory/`.
28
+
29
+ **Fact format**:
30
+ ```
31
+ ---
32
+ name: [Title]
33
+ description: [1-line hook]
34
+ type: [user|feedback|project|reference]
35
+ ---
36
+ [Content]
37
+ ```
38
+
39
+ **Types**:
40
+ - `user` — who you are, team composition
41
+ - `feedback` — decisions, learnings, constraints
42
+ - `project` — repo-specific, {{PROJECT_NAME}} setup
43
+ - `reference` — patterns, how-tos, runbooks
44
+
45
+ See `docs/MEMORY-TEMPLATE.md` for full indexing format.
46
+
47
+ ## Initial Setup Checklist
48
+
49
+ 1. **Brain directory** (your private persistent memory):
50
+ ```bash
51
+ mkdir -p ~/.claude/memory
52
+ # Edit ~/.claude/CLAUDE.md with your domains and team info
53
+ # Edit ~/.claude/MEMORY.md with your facts
54
+ ```
55
+
56
+ 2. **Configuration**:
57
+ ```bash
58
+ cp aesop.config.example.json aesop.config.json
59
+ # Edit paths, repos, cycle times per your setup
60
+ ```
61
+
62
+ 3. **Directory structure**:
63
+ ```bash
64
+ mkdir -p ~/{{PROJECT_NAME}}/state
65
+ mkdir -p ~/.heartbeats
66
+ ```
67
+
68
+ 4. **Test the watchdog**:
69
+ ```bash
70
+ export AESOP_ROOT=$HOME/{{PROJECT_NAME}}
71
+ bash $AESOP_ROOT/daemons/run-watchdog.sh --once
72
+ ```
73
+
74
+ 5. **Launch the dashboard**:
75
+ ```bash
76
+ python $AESOP_ROOT/ui/serve.py
77
+ # Opens http://localhost:8770
78
+ ```
79
+
80
+ 6. **(Optional) Arm the monitor**:
81
+ ```bash
82
+ # In your Claude Code orchestrator loop, run:
83
+ export AESOP_ROOT=$HOME/{{PROJECT_NAME}}
84
+ node $AESOP_ROOT/monitor/collect-signals.mjs
85
+ ```
86
+
87
+ ## Repo Map
88
+
89
+ Your tracked repositories (from aesop.config.json):
90
+
91
+ {{REPO_LIST}}
92
+
93
+ Each repo in the list will be discovered by the watchdog, backed up to `backup/wip-*` branches, and secret-scanned before push.
94
+
95
+ ## Key Files & Paths
96
+
97
+ - **This file**: `~/.claude/CLAUDE.md` — your team brain
98
+ - **Memory index**: `~/.claude/MEMORY.md` — indexed facts
99
+ - **Memory directory**: `~/.claude/memory/` — individual fact files
100
+ - **Orchestrator config**: `~/{{PROJECT_NAME}}/aesop.config.json` (git-ignored)
101
+ - **Durable state**: `~/{{PROJECT_NAME}}/state/` — STATE.md, BUILDLOG.md (committed)
102
+ - **Watchdog heartbeat**: `~/.heartbeats/.watchdog-heartbeat` (epoch timestamp)
103
+ - **Monitor heartbeat**: `~/.heartbeats/.monitor-heartbeat` (epoch timestamp)
104
+
105
+ ## See Also
106
+
107
+ - `docs/CARDINAL-RULES.md` — full 10 rules with rationale
108
+ - `docs/DISPATCH-MODEL.md` — cost analysis + parallel patterns
109
+ - `docs/GOVERNANCE.md` — single-writer discipline, inbox, loops
110
+ - `docs/MEMORY-TEMPLATE.md` — memory structure and frontmatter
111
+ - `README.md` — full walkthrough and troubleshooting
112
+
113
+ ---
114
+
115
+ **Onboarding ready.** Your fleet is live when BUILDLOG.md shows the first dispatch.