aesop / monitor
CLAUDE.md2 starsChanged 31 days agoMITView on GitHub
Purpose: Continuous background signal collector and refinement proposer — watches fleet machinery health deterministically (Node.js, no LLM), emits cycle snapshots, and proposes rule changes via append-only PROPOSALS.md. GOAL IS FIXED: improve machinery, never mission; if monitor thinks goal should change, it writes to PROPOSALS.md and stops. Each cycle: 1. Check single-instance guard: read .monitor-heartbeat; if <300s old, skip cycle. 2. Load config from env (AESOP_ROOT, BRAIN_ROOT, SCRIPTS_ROOT, TEMP_ROOT, AESOP_EXTENDED_SIGNALS) or aesop.config.json; fallback to safe defaults. 3. Deterministically collect signals (read-only…
In this repository21 other files it gives its agents.
- auth/CLAUDE.mdCLAUDE.md
- bin/CLAUDE.mdCLAUDE.md
- chat/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- daemons/CLAUDE.mdCLAUDE.md
- dash/CLAUDE.mdCLAUDE.md
- driver/CLAUDE.mdCLAUDE.md
- hooks/CLAUDE.mdCLAUDE.md
- mcp/CLAUDE.mdCLAUDE.md
- scan/CLAUDE.mdCLAUDE.md
- skills/CLAUDE.mdCLAUDE.md
- state_store/CLAUDE.mdCLAUDE.md
- stdio/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- tools/CLAUDE.mdCLAUDE.md
- ui/CLAUDE.mdCLAUDE.md
- buildsystemSkill
- dashboardSkill
- fleetSkill
- healthcheckSkill
- powerSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Check single-instance guard: read .monitor-heartbeat.
- Very specific: line 29
Update .monitor-heartbeat (epoch timestamp) and .signal-state.json.
- Distinctive: line 32
Robustness: Treat missing files/dirs as empty.
- Very specific: line 67
Single-writer discipline: Only monitor writes BRIEF.md, SIGNALS.json, ACTIONS.log, .monitor-heartbeat, .signal-state.json.
- Very specific: line 70
Node.js only: No Python, no LLM, no cloud calls.
≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
monitor/ — Orchestration monitor
Purpose: Continuous background signal collector and refinement proposer — watches fleet machinery health deterministically (Node.js, no LLM), emits cycle snapshots, and proposes rule changes via append-only PROPOSALS.md. GOAL IS FIXED: improve machinery, never mission; if monitor thinks goal should change, it writes to PROPOSALS.md and stops.
Universal rules (every domain)
- Feature branch only, never main; every push gated by
python tools/secret_scan.py --stagedexit 0. - Tests never pollute cwd or global git config; temp dirs only; dummy secrets are runtime-concatenated, never literal.
- In worktrees use ABSOLUTE paths under the worktree for every write.
- Domain docs stay minimal-but-complete; update this file in the same PR as code it describes.
Files & Ownership
- collect-signals.mjs — Deterministic signal collector (Node.js built-ins only, no Python/LLM); runs each cycle deterministically + idempotently; emits BRIEF.md + SIGNALS.json; updates .monitor-heartbeat (epoch) and .signal-state.json.
- BRIEF.md — Human-readable cycle snapshot; overwritten each cycle; runtime/gitignored. Format: heartbeat status, git state, memory freshness, logs, isolation violations, agent stalls, main CI status, extended signals checks (if enabled), security alerts, respawn watch, cost tracking, unreviewed prompts.
- SIGNALS.json — Machine-readable signal metrics (same keys as BRIEF); JSON structure; overwritten each cycle; runtime/gitignored.
- PROPOSALS.md — Append-only inbox for user-approval rule changes (config, policy, deletions); never edited by monitor after emission; gitignored.
- ACTIONS.log — Append-only log of AUTO tier actions taken (heartbeat updates, log rotation, junk quarantine); runtime/gitignored.
- .monitor-heartbeat — Epoch timestamp (line 1 only) for single-instance liveness guard; if <300s old, skip cycle; runtime/gitignored.
- .signal-state.json — Sidecar state (cycleCount, last-seen hashes, etc.); runtime/gitignored.
Deterministic Collector Cycle (Node.js only)
Each cycle:
- Check single-instance guard: read .monitor-heartbeat; if <300s old, skip cycle.
- Load config from env (AESOP_ROOT, BRAIN_ROOT, SCRIPTS_ROOT, TEMP_ROOT, AESOP_EXTENDED_SIGNALS) or aesop.config.json; fallback to safe defaults.
- Deterministically collect signals (read-only filesystem ops, no calls to external services or LLMs).
- Emit BRIEF.md (human format) and SIGNALS.json (machine format); both overwritten, idempotent.
- Apply AUTO tier actions (heartbeat write, log rotation, quarantine).
- Update .monitor-heartbeat (epoch timestamp) and .signal-state.json.
- Append any AUTO actions to ACTIONS.log (timestamped).
Robustness: Treat missing files/dirs as empty; never crash; config errors fallback to safe defaults.
Signal Contract
Signal keys collected (15 total): heartbeats (watchdog, monitor, other loops), git (branches, unpushed, dirty), memory (stale files >30d), logs (rotation triggers), junk (script sprawl), strayRepo (scripts outside ~/scripts), alerts (SECURITY-ALERTS.log), respawnWatch (agent respawn loops), unreviewedPrompts (new spawns), isolationViolations (FIXED GOAL drift), main_ci (main-full workflow status via gh run list), agentStalls (silent-hang detection via stall_check.py), and others per governance.
Output formats:
- BRIEF.md: Human-readable notes, status lines, warnings; overwritten each cycle.
- SIGNALS.json: Flat JSON object with signal key → {value, timestamp, details}; overwritten each cycle.
Extended signals (opt-in, default OFF): junk, strayRepo, respawnWatch, unreviewedPrompts checks; skip-step if disabled.
- Config key:
monitor.extended_signals(boolean, defaultfalse) in aesop.config.json (check monitor section). - Env override:
AESOP_EXTENDED_SIGNALS('true'or'1'string to enable). - Precedence: env var > config file > default (false).
- Behavior when disabled: emit
{"skipped": true}for each extended check in SIGNALS.json; BRIEF.md notes "extended (off)" for those sections; directories are not walked.
Action Tiers & Idempotency
AUTO (apply immediately, log to ACTIONS.log):
- Heartbeat checks (read-only).
- Log rotation (invoke rotate_logs.py if available; fail-open if unavailable).
- Heartbeat write (.monitor-heartbeat epoch update).
- Junk script quarantine (move old .py/.mjs from temp dirs to monitor/quarantine/ + MANIFEST.tsv; only when extended_signals is ON).
PROPOSE (write to PROPOSALS.md, await user approval):
- Rule/config/policy changes.
- Deletions or quarantines outside monitor/quarantine/.
- Orchestration behavior changes.
Idempotency rule: Proposal emission keyed on signal key (e.g., 'respawn-watch-breach'); only emitted once per cycle if not already present in PROPOSALS.md (check: **Signal:** <key> line exists). Safe to run repeatedly; append-only preserves audit trail.
Invariants & Gotchas
- Goal is FIXED: Improve machinery (heartbeat health, cost, security), never mission (project scope, architecture direction). Cardinal Rule enforcement only.
- Single-instance guard: .monitor-heartbeat <300s old = skip cycle. Prevents concurrent collectors.
- Single-writer discipline: Only monitor writes BRIEF.md, SIGNALS.json, ACTIONS.log, .monitor-heartbeat, .signal-state.json. External tools read-only.
- Config sourcing: Env vars (AESOP_ROOT, BRAIN_ROOT, SCRIPTS_ROOT, TEMP_ROOT, AESOP_EXTENDED_SIGNALS, heartbeat thresholds from config) override aesop.config.json (monitor section: log_max_lines, log_max_kb, extended_signals, heartbeat_thresholds). Safe defaults if missing.
- Robustness to missing files: Missing logs/dirs are treated as empty; no crash; graceful degradation.
- Node.js only: No Python, no LLM, no cloud calls; deterministic + cheap. Any orchestration-level actions (Python scripts, LLM review, etc.) are run by external agents, not the collector.
- CHARTER.md governs behavior: Define new signals by proposing via PROPOSALS.md; never edit CHARTER or collect-signals.mjs directly.
- agentStalls is FAIL-CLOSED (GAP 3): "graceful degradation" above applies to missing inputs, never to a check that did not run. Every failure path of
checkAgentStalls()(tool absent, unspawnablepython, timeout, kill signal, nonzero exit, non-JSON or non-array stdout, unexpected throw) routes through the singledegradedStallSignal(reason)helper and emits{available:false, state:'UNKNOWN', degraded:true, count:null, reason}.countis null, never 0 — the old{available:false, count:0}shape made a broken detector indistinguishable from "no agents are stalled", and BRIEF.md's neutralNOT-AVAILABLE:line hid it. A check that ran emitsstate:'OK'|'STALLED'withdegraded:falseand a numericcount; BRIEF.md now flags the degraded case as a DEGRADED/UNKNOWN warning. Consumers must key onstate/degraded, not oncount(falsycountno longer means healthy). Regression suite:tests/monitor-stall-failclosed.test.mjs(static guard against theavailable:false, count:0literal returning, plus a behavioral run with an emptied PATH sopythoncannot resolve). - Runtime lane liveness lives in tools/, not the collector: the deterministic gate for "a lane the orchestrator believes is live has gone silent" is
tools/lane_liveness.py --check(exit 1 names the lanes to TaskStop + relaunch, exit 2 = undetermined). It is deliberately NOT wired into the cycle: it walks every registered worktree, so on a long-lived box the standing verdict is dominated by abandoned trees and would drown BRIEF.md. Run it on demand, or with--claimsnarrowed to the lanes actually dispatched. - Watchdog heartbeat path mirrors the daemon (cd784554d044): the only writer is
daemons/backup-fleet.sh, which writes$CONDUCTOR_ROOT/state/.watchdog-heartbeat.resolveWatchdogHeartbeat()applies the same rule (CONDUCTOR_ROOT env, else siblingconductor3only when AESOP_ROOT's basename isaesop, else unresolved). It is neverSTATE_DIR.checkWatchdogGap()reports a MISSING, UNREADABLE, or UNRESOLVED beat as a gap in BRIEF.md andheartbeats.watchdogGapin SIGNALS.json; a gap is never "fresh". Regression suite: thewatchdog heartbeat:cases intests/collect-signals.test.mjs.
Dropped (reason)
- Detailed 11-signal-check list names/numbers (governance reference; see CHARTER.md for check definitions and extended-signal details).
- End-of-day wipe-survival sweep (separate orchestration flow, not core deterministic collector).
- Mirror refresh cadence and asset sync (orchestration-level; not collector responsibility).
- Prompt semantic review (LLM-based; runs as separate agent, not in deterministic collector).
Map of all domains: /CLAUDE.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

