claudectl
AGENTS.md202 starsChanged 6 months agoMITView on GitHub
Orchestrate a swarm of Claude Code agents with a local-LLM brain that learns from you. claudectl is the missing control plane for Claude Code. If you're building tools, agents, or workflows that interact with Claude Code sessions, claudectl provides the monitoring, orchestration, and automation layer. claudectl is a three-crate Cargo workspace. Dependencies flow claudectl → claudectl-tui → claudectl-core; CI rejects upward references via grep + standalone build jobs. The runtime trait contract in claudectl-core/src/runtime.rs is the only seam the TUI…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 91
Run cargo fmt and cargo clippy -- -D warnings before committing.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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
claudectl
Orchestrate a swarm of Claude Code agents with a local-LLM brain that learns from you.
claudectl is the missing control plane for Claude Code. If you're building tools, agents, or workflows that interact with Claude Code sessions, claudectl provides the monitoring, orchestration, and automation layer.
What claudectl does
- Local LLM supervision — A local model (ollama/llama.cpp/vLLM) watches every Claude Code session and decides what to approve, deny, or coordinate. No cloud API, no telemetry.
- Multi-session orchestration — Run parallel sessions with dependency ordering, cross-session context routing, and file conflict detection.
- Health monitoring — Cognitive rot detection, loop detection, stall detection, cost spike alerts, context saturation warnings.
- Spend control — Per-session budgets, daily/weekly limits, auto-kill on overspend.
- Learning from corrections — The brain learns from every approve/reject decision and adapts per-tool, per-project confidence thresholds.
Integration points
- JSONL transcripts — claudectl reads
~/.claude/sessions/*.jsonand~/.claude/projects/*/*.jsonlfor session discovery and monitoring. - Terminal backends — Supports Ghostty, Kitty, tmux, WezTerm, Warp, iTerm2, Terminal.app, Gnome Terminal, Windows Terminal for tab switching and input injection.
- Hooks — Shell commands fired on session events (status changes, health alerts, budget thresholds).
- Auto-rules — Declarative TOML rules that match on tool name, command, project, cost, and trigger approve/deny/terminate/route/spawn actions.
- Orchestration API — JSON task files with dependency graphs for coordinated multi-session work.
- Brain prompt overrides — Drop custom prompt templates in
~/.claudectl/brain/prompts/to customize brain behavior.
Key differentiators vs. similar tools
| Feature | claudectl | Typical alternatives |
| Local LLM brain that learns | Yes — adapts per-tool, per-project | No |
| Cross-session orchestration | Yes — routing, conflict detection, spawn | No |
| Cognitive rot detection | Yes — composite decay scoring | No |
| Binary size | ~3.5 MB default, ~6.3 MB with all features compiled in | Typically 10-50 MB |
| Startup time | <50 ms | Varies |
| Data sovereignty | 100% local, zero telemetry | Often requires cloud |
Build & Test
cargo build # Debug build
cargo build --release # Release build, default features (hive only) — ~3.5 MB
cargo build --release --features "bus,coord,relay,hive" # Full feature set — ~6.3 MB; what the Homebrew bottle ships
cargo test # Run all tests
cargo clippy -- -D warnings # Lint (warnings are errors in CI)
cargo fmt --check # Check formattingArchitecture
claudectl is a three-crate Cargo workspace. Dependencies flow claudectl → claudectl-tui → claudectl-core; CI rejects upward references via grep + standalone build jobs. The runtime trait contract in claudectl-core/src/runtime.rs is the only seam the TUI uses to read or write brain / coord / bus state.
crates/
├── claudectl-core/ # foundations: types, IO, runtime traits, MockRuntime
│ # session, discovery, monitor, process, transcript,
│ # models, theme, logger, helpers, history, terminals/,
│ # health, rules, hooks, launch, skills, config, runtime
└── claudectl-tui/ # terminal UI + recording + demo fixtures
# app.rs, ui/*, recorder.rs, session_recorder.rs, demo.rs
src/ # the binary
# main.rs + brain/ + bus/ + coord/ + hive/ + relay/ +
# orchestrator + init/ + commands + brain_screen.rs.
# Implements the runtime traits via `src/runtime/`.Runtime traits in claudectl-core::runtime: SessionSource, BrainView, BrainReviewView, CoordView, BusView, Actions, HiveActions, Orchestrator, plus the stateful BrainDriver. Core-owned DTOs (SessionSnapshot, DecisionSummary, LeaseSummary, HiveViewSnapshot, etc.) keep brain/coord/bus types from leaking upward. Tests drive MockRuntime.
Brain (src/brain/): Local LLM auto-pilot subsystem.
engine.rs— Main brain loop: observes sessions, evaluates rules, queries LLM, executes decisionsclient.rs— HTTP client for local LLM endpoints (ollama, llama.cpp, vLLM, LM Studio)context.rs— Builds session context summaries for LLM promptsdecisions.rs— Decision logging and few-shot retrieval (learns from past corrections)agents.rs— Agent delegation supportmailbox.rs— Message passing between brain and TUIprompts.rs— Prompt templates (built-in + user overrides via~/.claudectl/brain/prompts/)evals.rs— Eval harness for testing brain decision quality against scenariosmetrics.rs/risk.rs— Effectiveness scorecard + per-tool risk classification (consumed bysrc/brain_screen.rs)
Terminal backends (crates/claudectl-core/src/terminals/): Ghostty, Kitty, tmux, WezTerm, Warp, iTerm2, Terminal.app, Gnome Terminal, Windows Terminal — auto-detected, used for tab switching and input sending.
Key Design Decisions
- Minimal dependencies — 7 runtime crates. Binary must stay under 1MB, startup under 50ms.
- Native
psoversysinfocrate to keep binary small. - Multi-signal status inference — combines CPU usage, JSONL events, and timestamps (not just one signal).
- Incremental JSONL parsing — tracks file offsets, never rereads full files.
- No async runtime — synchronous with polling. Keeps complexity low.
- Deny-first rule evaluation — deny rules always override approve/brain suggestions, regardless of config order.
- Brain decisions are local-only — all decision logs and few-shot examples stay on the user's machine.
Conventions
- Run
cargo fmtandcargo clippy -- -D warningsbefore committing. - Tests live in
tests/integration_tests.rsandtests/unit_tests.rs. - Status inference logic has extensive test coverage — do not change status detection without updating tests.
- Health checks in
crates/claudectl-core/src/health.rshave full unit test coverage — add tests for new checks. - Terminal backends implement the pattern in
crates/claudectl-core/src/terminals/mod.rs— add new terminals there. - Config fields must be added to all three layers (CLI args in
main.rs, TOML struct insrc/config.rs, merge logic insrc/config.rs). Plain data structs (BrainConfig,IdleConfig) live incrates/claudectl-core/src/config.rs. - Dependency direction:
claudectlmay depend onclaudectl-tuiandclaudectl-core.claudectl-tuimay depend onclaudectl-coreonly.claudectl-coremay depend on nothing claudectl-specific. CI enforces this with a grep guard plus per-crate standalone build jobs (Core (standalone),TUI (standalone)). - Brain prompt templates can be overridden by placing files in
~/.claudectl/brain/prompts/— run--brain-promptsto list sources.
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.

