A local-first control plane for autonomous AI coding loops โ Claude ยท Codex ยท Aider ยท any shell command โ with 8 specialized agents in shared memory, a live dashboard, and replayable iteration history.
CA: 0x7280415E32a94Bc7adaa00d480Ee4E7fB6e73F0e
npx ralpharium init # scaffold the four Ralph artifacts in your repo
npx ralpharium start # boot the daemon, opens dashboard at localhost:3000Two commands. No accounts, no API keys, no cloud calls. Real Claude / Codex / Aider iterations need those CLIs installed and authenticated separately โ Ralpharium just orchestrates them locally.
| What | Why | Check | |
|---|---|---|---|
| Node 18+ | comes with npx |
node -v |
|
| Python 3.11+ | the daemon is FastAPI | python --version |
If Python is missing, grab it from python.org (Windows / macOS), brew install python@3.12, or sudo apt install python3.12 python3-pip. Already installed but Ralpharium can't find it? Set RALPH_PYTHON to the full path.
FastAPI and uvicorn auto-install on first run โ you don't have to do anything.
Ralpharium is a local-first dashboard and runner that turns the Ralph Wiggum technique (a bash loop that pipes a prompt file to an AI CLI on repeat) into an observable, controllable system.
You point it at a repo, pick a runner, click Start. It runs the AI in a tight cycle, gates each pass on tests + lint, and shows you exactly what changed โ every iteration, every commit, every failure โ without anything leaving your machine.
Not a replacement for Claude / Codex / Aider. It runs them. The runner is the AI; Ralpharium provides the context, validation, observation, and stop conditions around it.
| Surface | What lives there | |
|---|---|---|
| ๐๏ธ | /dashboard |
Operator console โ iteration timeline, plan health, validation backpressure, spec coverage, guardrails, runtime panel. Start / pause / panic-stop. |
| ๐ฌ | /ram |
Live debug view โ 8 agents grid with drill-down, blackboard slots, event ring buffer, hex viewer of the shared-memory segment, scratchpad, checkpoints, runner process monitor. |
| ๐๏ธ | /tech |
Architecture diagrams + design notes. |
| ๐ | Continuous-loop runner | Stop conditions: max iterations, on failure, no commit, dirty tree. |
| ๐ | .ralph/iterations.jsonl |
Append-only replayable history of every loop pass. |
| โ๏ธ | ralpharium CLI |
Init, environment checks, page launchers. |
A single iteration = one full pass of the 8-agent cycle. The daemon orchestrates it; the dashboard streams every step over WebSocket.
flowchart LR
A[1. Pre-flight<br/>Planner + Researcher] --> B[2. Build phase<br/>Builder runs runner]
B --> C[3. Backpressure<br/>Reviewer + Debugger]
C --> D[4. Post-loop<br/>Magpie + Tagger]
D --> E[5. Persist<br/>iterations.jsonl]
E --> F{Stop conditions?}
F -->|met| G[Stop]
F -->|clean| A
| # | Phase | Agents | What happens |
|---|---|---|---|
| 1 | Pre-flight | planner + researcher |
Planner reads IMPLEMENTATION_PLAN.md and picks the next unchecked task. Researcher scans the repo (branch, dirty state, spec count) and writes context to the shared blackboard. |
| 2 | Build | builder |
Spawns your runner (claude -p "$(cat PROMPT.md)") with cwd=your repo. Stdout streams line-by-line into the RAM event log. Blackboard slots update in real time. |
| 3 | Backpressure | reviewer + debugger |
Reviewer runs validation gates (npm test / lint / typecheck / build) auto-detected from package.json. If anything fails, Debugger classifies the failure. |
| 4 | Post-loop | magpie + tagger |
If the iteration produced a commit, Magpie collects the artifacts. Tagger classifies the iteration (feature / fix / refactor / docs). |
| 5 | Persist | โ | Full record appended to .ralph/iterations.jsonl. WebSocket broadcasts a fresh snapshot โ every open tab updates without refresh. |
| 6 | Loop or stop | โ | Stop conditions: max iterations, panic, dirty tree, no commit, validation failed. Thrash detector pauses on "same files modified with same error 3+ times". |
| Agent | Phase | Role |
|---|---|---|
๐งพ spec_writer |
phase-1 | Turn rough requirements into specs/*.md the runner can read |
๐ researcher |
phase-1 | Investigate the repo before plan/build โ surface relevant code, prior decisions |
๐บ๏ธ planner |
build | Pick the next task from IMPLEMENTATION_PLAN.md and frame the iteration prompt |
๐จ builder |
build | Execute the runner subprocess (Claude / Codex / Aider) โ the hands of the loop |
๐งช reviewer |
backpressure | Run validation gates โ tests, lint, typecheck, build โ surface what broke |
๐ debugger |
backpressure | When validation fails, classify the failure so the next iteration has a real chance |
๐ชถ magpie |
post-loop | Collect notable artifacts โ commits, diffs, scratchpad notes |
๐ท๏ธ tagger |
post-loop | Classify the iteration โ feature / fix / refactor / docs |
Each owns a slot in a 64KB multiprocessing.shared_memory segment. Click any agent card on /ram to see its full prompt + decision history.
Ralph Loop by @ghuntley is a methodology, not a tool: run Claude in a bash while loop, treat it as a capable-but-naive executor, steer with engineered context. It works โ but it has real pain points:
| Pain point in vanilla Ralph Loop | Ralpharium's upgrade |
|---|---|
| ๐ณ๏ธ Black box โ only bash stdout streaming past | ๐ Glass box โ live blackboard, hex view, event ring buffer, per-agent drill-down with prompt + decision history, replayable JSONL on disk |
| ๐ชต One monolithic prompt โ plan, code, validate, classify all in one call | ๐ฅ 8 specialized agents โ each owns a phase, individually observable, with its own state and history |
๐พ .md files re-read from disk every iteration |
๐ง 64KB shared memory โ agents pass structured work through multiprocessing.shared_memory. Fewer disk hits, instant cross-agent visibility |
| ๐ Manual Ctrl-C only | ๐ฆ Real stop conditions โ stop_on_failure, stop_if_no_commit, stop_if_dirty_before_run, max_iterations, plus a thrash detector |
๐ No replay โ past iterations live in git log at best |
๐๏ธ Append-only .ralph/iterations.jsonl โ every iteration's mode, status, files changed, validation result, command output, commit SHA, failure reason |
| ๐ Single shell session โ locked to one terminal | ๐ REST + WebSocket API โ any tool can POST /api/iterations. Multiple tabs and external clients see the same state. |
| File | Role |
|---|---|
PROMPT.md |
Per-iteration instruction โ re-read at the start of every iteration |
AGENTS.md |
Operational rules โ build/test commands, scope limits, commit hygiene |
IMPLEMENTATION_PLAN.md |
Persistent task list โ parsed into done / pending / blocked / stale. Drift warnings raised automatically |
specs/*.md |
Source-of-truth specs โ each mapped against plan tasks and recent commits โ covered / partial / drifting / ignored |
npx ralpharium init scaffolds all four with sensible starter content.
| Command | What it does |
|---|---|
npx ralpharium init |
Scaffold PROMPT.md, AGENTS.md, IMPLEMENTATION_PLAN.md, specs/, .ralph/ |
npx ralpharium start |
Boot daemon + open home page at localhost:3000 |
npx ralpharium dashboard |
Boot daemon + open the dashboard |
npx ralpharium ram |
Boot daemon + open the live RAM debug page |
npx ralpharium tech |
Boot daemon + open the architecture page |
npx ralpharium check |
Diagnose Python + dependencies + Ralph files |
npx ralpharium smoke |
Run backend smoke test (no HTTP) |
Flags: --port=N (default 3000) ยท --no-open (skip auto-opening browser).
Environment variables:
| Variable | Purpose |
|---|---|
RALPH_REPO_PATH |
Override which repo to watch (default: cwd) |
RALPH_DATA_DIR |
Where iterations.jsonl lives (default: <repo>/.ralph) |
RALPH_RUNNER |
codex / claude / aider / custom (default: claude) |
RALPH_RUNNER_CMD |
Shell command run each iteration |
RALPH_PYTHON |
Full path to a Python 3.11+ interpreter |
PORT |
Server port (default: 3000) |
| Layer | Tech |
|---|---|
| Backend | Python 3.11+ FastAPI ยท Uvicorn ยท single process ยท WebSocket + REST |
| Shared memory | OS-level multiprocessing.shared_memory (64KB) ยท live JSON blackboard the 8 agents read & write |
| Frontend | Vanilla JS + CSS ยท no framework, no build step, no bundler ยท static files served by the daemon |
| Persistence | Append-only JSONL at .ralph/iterations.jsonl ยท replayable, greppable, gitignorable |
| CLI | Tiny Node launcher (bin/ralph-studio.js) that spawns the Python daemon |
Zero dependencies in the npm package itself. The whole thing fits in 22 files and 250 KB.
Before clicking Start on a real codebase:
- Commit or stash your own changes โ a dirty tree is a footgun
- Start with
max_iterations = 1โ validate one full pass before letting it loop - Use a throwaway repo for the first real run โ never give a brand-new prompt to production code
- Enable
stop_on_failureโ first failures usually surface a misunderstanding worth fixing inPROMPT.md - Enable
stop_if_no_commitโ iterations that don't commit usually mean the runner did nothing - Enable
stop_if_dirty_before_runโ refuse to start on uncommitted changes - Confirm the runner CLI is authenticated โ
claude --versionetc., do one interactive run first - Watch
/ramduring the first run โ event stream shows process output, exit codes, blackboard updates live
Built in the open. Every milestone is real work โ no vapor.
- Foundations โ daemon, JSONL store, plan parser, RAM page, WebSocket
- 8 agents made observable โ roster, drill-down grid, thrash detector, live broadcasts, localStorage cache
- ๐ฐ Cost telemetry per iteration โ parse runner stdout for tokens, surface
$/iteration/$/session - ๐ณ Git-worktree-per-iteration sandbox โ no edits land on main until validation passes; auto-rollback on failure
- ๐ฌ Bidirectional question channel โ agent writes a question, loop pauses, you reply, loop resumes
- โฑ๏ธ Time + token budgets โ kill runaway iterations after N seconds or M tokens
- ๐พ Daemon crash recovery โ replay
iterations.jsonlon boot - ๐ฅ Multi-client presence โ two devs watching the same loop see each other's cursors
- ๐ Replay on a different model โ re-run a past iteration on Sonnet vs Opus and diff
- ๐ฏ Real per-agent LLM calls โ phase 1 synthesizes agent activity from lifecycle; phase 3 = each agent is a real LLM call with its own system prompt
- ๐ช Self-spec'ing loops ยท ๐ multi-repo orchestration ยท ๐๏ธ visual diff approval ยท ๐ public agent marketplace
Open source, MIT, PRs welcome. The whole code base is < 5K LoC across backend/, frontend/, bin/. No build step, no framework โ read the source, change a line, see the result.
https://github.com/ralphariumlab/ralpharium
cd Ralpharium
npm start # spawns the daemon against this repoFile issues at the GitHub issue tracker. Found a bug? Have a wild idea? Open a PR.
Built on the Ralph Wiggum technique by @ghuntley. The methodology is theirs โ Ralpharium is the observable substrate.
"Let Ralph Ralph." โ the philosophy that started it all.
MIT. Do whatever. Just don't sue if Ralph Ralphs.
Built for the people who want their AI to keep working while they sleep โ without setting their codebase on fire.
ralpharium.xyz ยท npm ยท @Ralphaxyz