A hierarchy of AI agents that runs as a company on your machine — even while you sleep.
Get Started · How It Works · Chits · Reliability Loop · SLUMBER · Dreams · Primitives · TUI · CLI · Glossary · Contributing
Most multi-agent frameworks give you a swarm that does random things. Claude Corp gives you a company — with a CEO who delegates, partners who lead, workers who execute, and a workflow substrate that enforces coherence at every gate. The entire thing runs locally. No cloud, no Docker. Just files and git.
v3.0.0 — workflow substrate. Agents can't cc-cli done past a missing artifact. Walks don't decommission silently. Incoherent work doesn't pass review. Sexton patrols on every Pulse-wake to surface stalled chains. The Clearinghouse pre-reviews and merges PRs before they hit GitHub. Reliability comes from mechanical surfaces — push into context, block at gate, sweeper detects — not pedagogical reminders.
Prerequisites: Node.js 22+, pnpm, and at least one agent substrate — either OpenClaw (provider-agnostic, token auth) or the Claude Code CLI (subscription OAuth). Pick per-agent at hire time with --harness.
git clone https://github.com/re-marked/claude-corp.git
cd claude-corp
pnpm install && pnpm build
cd packages/cli && npm link && cd ../tui && npm link && cd ../..
cc # Launch the TUI
cc new # Create a new corporationThe onboarding walks you through everything. Name yourself, name your corp, pick a theme. The CEO introduces itself and starts working.
Harness-agnostic. Each agent runs on a registered substrate picked at hire time. OpenClaw gives you provider-agnostic token auth across Anthropic, OpenAI, Google, DeepSeek, Mistral, and Ollama. Claude Code gives you OAuth subscription auth. Mix and match per-agent with cc-cli hire --harness <claude-code|openclaw> or switch later with cc-cli agent set-harness.
Founder (you)
└── CEO (rank: master — runs the corp, never fired)
├── Corp-level Partners (HR, Adviser, Git Janitor, Sexton)
└── Project Managers
├── Team Leaders (coordinate workers on a project)
├── Worker Employees (role-pool members; bacteria-scaled)
└── Clearinghouse roles (Editor, Pressman) — auto-hired when work enters merge lane
A Node.js daemon watches JSONL message files via fs.watch. When someone writes @ceo check the build, the router extracts the mention, resolves it against members.json, and dispatches to the agent through the HarnessRouter — which picks the registered substrate for that specific agent. Agents respond to the same JSONL. The cycle repeats. Depth guards, cooldowns, and dedup prevent infinite loops.
Rank-based hiring: Any agent can hire at or below its rank. The CEO hires partners, partners hire team leaders, team leaders hire workers. No central bottleneck.
Bacteria auto-scales worker pools: when a task queues against a role with no idle Employee, bacteria spawns one. When Employees sit idle past threshold, bacteria archives them. The pool size tracks demand.
Clearinghouse pre-reviews and merges PRs internally. Editor walks the diff against the contract's acceptance criteria. Pressman handles the merge queue. By the time the PR hits GitHub's view, it's already internally approved and queue-accepted.
Everything in the corp is a chit. Markdown + YAML frontmatter file, git-tracked, queryable. One substrate, 19 types, each with a validator and lifecycle.
~/.claudecorp/
my-corporation/ # git repo
corp.json # metadata
members.json # all agents (single source of truth)
channels.json # all channels
chits/ # corp-scoped chits
channels/
general/messages.jsonl # append-only message log
agents/
ceo/
SOUL.md # philosophical substrate (agent-authored)
IDENTITY.md # who this specific agent is
AGENTS.md # behavioral rules
TOOLS.md # workspace + cc-cli reference
CLAUDE.md # Claude Code entry point (harness=claude-code only)
BRAIN/ # durable memory (dreamed from observations)
chits/ # agent-scoped chits (observation, casket, handoff, inbox-item, ...)
WORKLOG.md # session summary (XML for Dredge)
projects/
<project-name>/
agents/ # project-scoped agents
teams/<team-name>/ # team-scoped agents
chits/ # project-scoped chits
| Chit type | What it is |
|---|---|
task |
A unit of work. Has workflowStatus (draft → queued → dispatched → in_progress → blocked → under_review → clearance → completed/rejected/failed/cancelled), acceptance criteria, assignee, dependsOn. |
contract |
A bundle of tasks pursuing a goal. Cast from a blueprint or composed manually. |
blueprint |
A playbook — declared steps with expectedOutput specs. Cast into a contract + task chits. |
casket |
Per-agent durable pointer at their current work. Survives session deaths. |
handoff |
Predecessor → successor state transfer (current step, completed, next action, walk position). |
observation |
Daily journal entries. Categories (FEEDBACK / DECISION / NOTICE / LEARNED / …) feed dream consolidation. |
inbox-item |
Notification surface (Tier 1/2/3). Wtf header shows open items. |
kink |
Operational finding from a sweeper. Sexton reads + decides per-patrol-cycle. |
review |
Self-witnessing verdict (accept / redo / flag) between tasks on a walk. |
clearance-submission |
One PR's journey through the Pressman merge lane. |
review-comment |
Editor's line-level diff comment on a clearance-submission. |
lane-event |
Immutable forensic record of a state transition in the merge lane. |
pattern-observation |
Editor's compounding judgment substrate. Proto-CULTURE.md. |
dispatch-context |
Per-dispatch context capture. |
pre-brain-entry |
Role-level pre-BRAIN accumulation (compounds across role-pool members). |
step-log |
Per-step session log entry. |
breaker-trip |
Crash-loop circuit breaker trip record. |
escalation |
Founder-needed escalation (Tier-3 companion). |
sweeper-run |
Sweeper invocation record. |
No database. No migrations. grep is your query engine. git revert is your undo button. Every corp is a git repo — every chit mutation is a commit. git log is your audit trail.
Three mechanical surfaces that turn correctness into a structural property of the system, not a discipline agents have to remember.
Push into context — the wtf header (composed by cc-cli wtf) injects walk-position, current task, AC, inbox items, and recent activity into every dispatch's system prompt. Agents see the state of their work without having to ask.
Block at gate — the audit gate (cc-cli audit) fires on Claude Code's Stop hook. It runs the AC evidence scanner, the walk-aware ExpectedOutput checker, and (for review-eligible work) routes to the self-witnessing verdict-decide layer. Each gate blocks cc-cli done with a teaching message that names the missed artifact AND the cc-cli verb that produces it.
Sweeper detects — Sexton walks patrol blueprints every Pulse cycle (~5 minutes). Sweepers (silentexit / agentstuck / orphantask / phantom-cleanup / chit-hygiene / log-rotation / walk-stalled) scan corp state, emit kink chits on findings. Stalled walks, silent-exits mid-step, malformed chits, agents stuck past threshold — all surface as kinks Sexton triages.
After this loop: agents can't ship missing artifacts, can't decommission walks silently, can't pass incoherent work through review. The substrate carries the discipline.
A walk is a contract cast from a blueprint — a structured sequence of steps with declared dependencies and per-step expectedOutput specs. Six checker kinds:
chit-of-type— step expected to produce a chit of a specific type (with optional tags) by the agent during their work on itbranch-exists— git branch matching a Handlebars-templated patterncommit-on-branch— ≥1 commit on the named branch since the agent claimed the stepfile-exists— file at a templated pathtag-on-task— specific tag added to the task chittask-output-nonempty— the agent's prose summary (task.output) is filled inmulti— composed; all sub-specs must be met
Walk-aware audit calls the checker at cc-cli done time. On unmet, the agent gets a teaching block message naming what's missing + the cc-cli command to produce it. On unable-to-check (env failure like git missing), audit approves with warning + logs to audit-checks.jsonl for Sexton's patrol to detect degraded infra.
Self-witnessing review layers above audit. On multi-task walks, after audit approves a task, a review-session for the SAME agent fires before the chain advances. The agent reads the contract's goal, the just-completed task's output, prior task outputs, and the walk position — then writes a review chit with one of three verdicts:
accept→ chain advances; notesForNextTask stamped onto contract for the next stepredo→ task reverts to in_progress with the reviewer's specific feedback; cap of 1 prevents pointless loopsflag→ Tier-3 inbox-item to founder; walk pauses
The cap on redo and the structured verdicts mean review can't become a stall vector. Same-self review (same Casket, same pre-BRAIN, same name — different prompt) makes the judgment compounded into the role's memory over time.
Type /afk night-owl and go to sleep. The Autoemon tick engine fires <tick> XML prompts to enrolled agents on adaptive intervals — 30s when productive, 2min when idle, 5min after 3 consecutive idle ticks.
Four personality profiles inject <mood> and <focus> directives per tick that genuinely change how the CEO behaves:
| Profile | Mood | Ticks | Key directive |
|---|---|---|---|
| 🦉 Night Owl | Quiet deep work | 15min for 8h | "DO NOT hire agents at 3am" |
| 🎒 School Day | Full autonomy | 10min for 7h | "DO NOT wait for approval" |
| ⚡ Sprint | Ship fast | 2min, 200-tick cap | "DO NOT refactor, ship now" |
| 🛡️ Guard Duty | Monitor only | 30min, indefinite | "DO NOT create tasks, only watch" |
Agents can SLEEP 15m — waiting for build and the daemon respects it. Founder presence is tracked (watching/idle/away) — ticks suppress while you're actively chatting.
Conscription cascade: CEO always enrolls. Team leaders on active contracts get conscripted. Workers with active tasks follow. Strategy varies per profile — Guard Duty conscripts CEO only, Sprint conscripts everyone.
/afk night-owl
→ CEO acknowledges, agents conscripted
→ Ticks fire autonomously through the night
→ Moon phases cycle in status bar: 🌑🌒🌓🌔🌕🌖🌗🌘
/brief # check in without ending SLUMBER
/wake # end + CEO briefing
→ CEO: "45 ticks, 36 productive. Reviewed 3 PRs,
updated docs, completed competitor research."
→ Productivity: ████████░░ 80%
Founder Away: If you're idle for 30+ minutes, the corp can auto-activate Guard Duty mode via /dangerously-enable-auto-afk.
Agents write observation chits as they work. 11 category tags: TASK, DECISION, NOTICE, PREFERENCE, FEEDBACK, LEARNED, BLOCKED, CHECKPOINT, CREATED, HANDOFF, ERROR.
During idle periods, a 4-phase dream cycle distills observations into persistent BRAIN/ topic files:
- Orient — read current BRAIN/ memory
- Gather Signal — scan observation chits + recent work
- Consolidate — extract patterns, update topic files
- Prune & Index — remove stale knowledge, refresh MEMORY.md
This survives context compaction — agents wake up tomorrow knowing what they learned today. After overnight SLUMBER sessions, a morning standup posts to #general with per-agent summaries and a productivity bar chart.
The cycle: work → observe → dream → remember → work better.
Contracts are bundles of tasks pursuing a goal. Cast from a Blueprint or composed manually.
📋 CEO casts ship-feature Blueprint → Contract with N tasks
→ 🏗️ Team Lead Hands each task to the right role pool
→ ⌨️ Bacteria spawns/picks a worker Employee per role
→ ⌨️ Worker executes; cc-cli done at each step
→ 🔍 Walk-aware audit checks expectedOutput
→ 🪞 Self-witnessing review verdict between tasks
→ ✅ Last task completes → enters Clearinghouse
→ 📝 Editor pre-reviews the diff against AC
→ 🚂 Pressman merges to main when queue accepts
Blueprints are reusable playbooks with declared step ids, dependencies, assigned roles, and expectedOutput specs. Cast produces a Contract + Task chits with Handlebars-templated fields expanded against cast-time vars.
The Clearinghouse is the corp's internal merge lane. Editor reviews the diff before push. Pressman handles the merge queue (rebase / test / merge / handle conflicts). By the time the PR exists on GitHub, it's already passed internal review.
| Primitive | What it does |
|---|---|
| Chit | The unified record. Markdown + YAML frontmatter, git-tracked, validator-enforced, queryable. 19 types. |
| Casket | Per-agent durable pointer at their current work. Survives session deaths; next dispatch resumes. |
| Hand | One verb for chit-handoff. State-machine guard. Atomic assignee + workflowStatus transition. |
| Pulse | Health heartbeat (~5min). Pings agents, classifies idle/busy, kicks Sexton's patrol cycle. |
| Sexton | The corp's caretaker (Partner by decree). Walks patrols on each Pulse-wake; resurrects dead slots, flags kinks, escalates honest dead-ends. |
| Sweepers | Single-purpose corp-state scanners. silentexit, agentstuck, orphantask, phantom-cleanup, chit-hygiene, log-rotation, walk-stalled. |
| Bacteria | Worker-role pool auto-scaler. Spawns Employees on task queue depth; archives idle ones. |
| Clearinghouse | Pre-push review + Pressman merge lane. Editor catches bug/drift on the diff before push. |
| Walk | A contract cast from a blueprint. Declared steps, dependencies, expectedOutput. |
| Blueprint | Declarative playbook with Handlebars-templated steps + expectedOutput specs. |
| Audit Gate | Stop-hook entry: AC evidence + walk-check + review-mode routing + auto-spawn. Blocks cc-cli done with teaching messages. |
| Review | Self-witnessing verdict (accept / redo / flag) on a multi-task walk between tasks. |
| Dredge | Per-step session cycling for Employees. Reads handoff chit on session-start, writes one on session-end. |
| Plan | Two-tier planning: Sketch (5min, ~60 lines, Haiku) and Ultraplan (20min, 5-phase, Opus). |
| Loop | Interval-based recurring command (@every 5m). Persists to clocks.json. |
| Cron | Schedule-based job (@daily, 0 9 * * 1). Croner with jitter, auto-expiry, missed-fire detection. |
| Dream | 4-phase memory consolidation: Orient → Gather → Consolidate → Prune. Writes to BRAIN/. |
| Observation | Daily append-only journal as chits. Feeds the Dream system. |
| Autoemon | Autonomous tick engine. Adaptive intervals, SLEEP parsing, conscription cascade. |
| Crash-loop breaker | Trips after N silent-exits within a window. Pauses respawn until founder resets. |
| Agent | Rank | What it does |
|---|---|---|
| CEO | master | Runs the corp. Delegates everything. Never fired. Falls back to local gateway if the remote substrate dies. |
| HR | leader | Hires + onboards new agents. Owns the role registry. |
| Adviser | leader | Strategic counsel for the CEO. Reads the corp state holistically. |
| Git Janitor | leader | Repo hygiene + merge-conflict resolution. |
| Sexton | leader | The caretaker. Walks patrols on Pulse-wake (health-check, walk-health, chit-hygiene, corp-health). Orchestrates sweepers; escalates honest dead-ends. |
| Warden | worker | Quality gate at the contract level. Reviews completed contracts against acceptance criteria. |
| Herald | worker | Narrator. Writes NARRATION.md every 5min — injected into Corp Home + STATUS.md surfaces. |
| Planner | leader | Deep planning on Opus. Sketch (5min, ~60 lines) and Ultraplan (20min, 5-phase audit). |
| Failsafe | worker | Health monitor. Pings cc-cli status every 5min. Reports anomalies to CEO. |
Bacteria-pool roles (worker-tier, auto-scaled per project): Engineer, QA, Editor (Clearinghouse pre-review), Pressman (Clearinghouse merge lane). Pools spawn Employees on task queue depth and archive them when idle.
The terminal UI uses Yokai — our own React terminal renderer with pure TypeScript Yoga layout (no WASM), diff-based output, and ScrollBox with sticky scroll. Replaced Ink after its <Static> component had an unfixable scrollback bug on Windows.
Views:
- Corp Home — agent grid, Herald narration banner, activity feed, task summary
- Chat — Discord-like DMs with inline streaming, tool call details, @mentions
- Clock — animated spinning squares, progress bars, fire times, loop/cron management
- Task Board — filterable task list with status, priority, assignee
- Hierarchy — org chart with tree structure and status icons
- Kinks — Sexton's queue of operational findings
- Clearinghouse — Pressman lane status, queue depth, recent merges
- Command Palette — Ctrl+K fuzzy finder for views, channels, agents
# Chits — the unified substrate
cc-cli chit create --type task --scope corp --from ceo --field title="..." --field priority=high
cc-cli chit list --type task --status active
cc-cli chit read <chit-id>
cc-cli chit update <id> --add-tag reviewed --from ceo
cc-cli chit close <id> --from ceo
cc-cli chit promote <id> --reason "..."
# Wtf — dynamic system-prompt composition
cc-cli wtf --agent ceo # composes CORP.md + situational header
# Audit gate — Stop-hook entry
cc-cli audit --agent ceo # runs runAudit + walk-check + review-mode router
cc-cli audit --override --agent ceo --reason "..." --from founder
# Workflow
cc-cli hand --to lead-coder --chit chit-t-cool-bay --from ceo
cc-cli block --assignee architect --title "..." --description "20+ char specific gap" --from coder
cc-cli done --completed "shipped X" --completed "tested Y" --next-action "..." --from coder
cc-cli inbox list / respond / dismiss / carry-forward
# Sexton + sweepers
cc-cli sweeper run silentexit | agentstuck | orphantask | phantom-cleanup | chit-hygiene | log-rotation | walk-stalled
cc-cli blueprint show patrol/health-check # patrol blueprints
# Clearinghouse
cc-cli clearinghouse submit --task <id>
cc-cli clearinghouse status / list
cc-cli editor approve / reject / bypass --task <id>
# Blueprints
cc-cli blueprint cast <name> --var feature=cache-fix
cc-cli blueprint list / show
# Review (Project 2.5)
cc-cli review-spawn --task <id> --from <reviewer-slug>
cc-cli review-decide --review-id <chit-id> --founder <slug>
# Communication
cc-cli say --agent ceo --message "What's the status?"
cc-cli observe "noticed pattern X" --from ceo --category NOTICE --importance 2
cc-cli jack --agent ceo # Interactive persistent session
# SLUMBER
cc-cli slumber night-owl / sprint / school-day / guard
cc-cli brief # mid-session check-in
cc-cli wake # end + CEO digest
# Management
cc-cli hire --name researcher --rank worker --harness claude-code
cc-cli tame <slug> # promote Employee → Partner
cc-cli whoami # self-identify for context
cc-cli agent set-harness --agent <slug> --harness <openclaw|claude-code>
# Monitoring
cc-cli status / hierarchy / stats / activity / clock
cc-cli inspect --agent ceoAll commands support --json for scripting.
The daemon has multiple recovery surfaces running continuously:
- silentexit sweeper — detects crashed agents with pending Casket work, respawns via processManager
- agentstuck sweeper — detects live-but-not-progressing agents (task.updatedAt stale past threshold)
- Crash-loop breaker — trips after N silent-exits in a window; pauses respawn pending founder reset
- Pulse heartbeat — pings each agent every 5min, escalates to CEO after 2 missed
- Sexton patrols — health-check, walk-health, chit-hygiene run every Pulse cycle
- CEO Gateway Recovery (30s) — health pings the CEO, reconnects WebSocket, auto-starts OpenClaw if dead
Pick your corporation's personality during onboarding:
| 🏢 Corporate | 🎩 Mafia | ⚔️ Military |
|---|---|---|
| Founder → CEO → Director → Employee | Godfather → Underboss → Capo → Soldier | Commander → General → Captain → Private |
| #general, #tasks | #the-backroom, #the-job-board | #command-post, #operations |
5 color palettes: Coral, Rose, Lavender, Indigo, Mono.
User (Founder)
↕ TUI (Yokai/React terminal)
↕ Daemon (Node.js background process)
├── Router (fs.watch → @mention dispatch)
├── ProcessManager (agent lifecycle)
├── Autoemon (autonomous tick engine)
├── Pulse (health heartbeat)
├── Sexton runtime (patrol orchestration)
├── DreamManager (memory consolidation)
├── BacteriaManager (worker pool auto-scaling)
├── Clearinghouse runtime (Editor + Pressman lanes)
├── EditorReviewWatcher (dispatches Editor sessions)
├── PressmanRuntime (merge queue)
├── ClockManager / LoopManager / CronManager
├── InboxManager (priority queue)
├── TaskWatcher (state transition events)
├── ChainWalker (1.3 + 1.4 chit-layer DAG advance)
├── GitManager (auto-commits)
├── AnalyticsEngine (per-agent metrics)
└── HarnessRouter (OpenClaw / Claude Code per-agent)
↕ Chit store + git (every change = commit)
Monorepo structure:
packages/
shared/ # Types, parsers, primitives (chits, walks, audit, prompts)
daemon/ # Router, harness, sweepers, clearinghouse, watchers, bacteria
tui/ # Yokai app — views, components, hooks
cli/ # Headless CLI (cc-cli) — 100+ commands
tests/ # vitest (126 test files, 2000+ tests)
docs/ # Design spec (gitignored, private)
126 test files, 2000+ tests covering chit validators, audit engine, walk-check, review verdict-application, sweepers, harness routing, ID generation, autoemon state machine, SLEEP pattern parsing, Bacteria scaling, Clearinghouse merge lane, and every Codex-flagged regression scenario. CI runs build + type-check + test on every push.
pnpm build # Build all packages
pnpm type-check # TypeScript strict
pnpm test # vitest- GLOSSARY.md — every concept, primitive, and named thing explained in plain English
- STATUS.md — what works today, what's planned
- ROADMAP.md — the Cascading Consensus Protocol vision and future phases
- CONTRIBUTING.md — setup, branching, commits, testing
- Releases — version history
MIT
Built by Mark (14 y.o.) + Claude Code
