Skip to content

ralphariumlab/ralpharium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Ralpharium

Ralpharium

The Ralph Loop, made observable.

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.

X / Twitter ย  npm ย  Website

License Python 3.11+ Node 18+ Local-first No cloud required Zero npm deps

CA: 0x7280415E32a94Bc7adaa00d480Ee4E7fB6e73F0e


โšก Quickstart

npx ralpharium init     # scaffold the four Ralph artifacts in your repo
npx ralpharium start    # boot the daemon, opens dashboard at localhost:3000

Two 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.


๐Ÿฉป Requirements

What Why Check
Node Node 18+ comes with npx node -v
Python 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.


๐Ÿฉ What is it?

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.

What you get

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.

๐Ÿ“บ Inside an iteration

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
Loading
# 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".

๐Ÿ‘ฅ The 8 agents

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.


๐Ÿ†š How Ralpharium upgrades vanilla Ralph Loop

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.

๐Ÿ“ The four files

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.


๐Ÿ› ๏ธ Commands

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)

๐Ÿ—๏ธ Architecture

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.


๐Ÿ›ก๏ธ Safety checklist for your first real run

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 in PROMPT.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 --version etc., do one interactive run first
  • Watch /ram during the first run โ€” event stream shows process output, exit codes, blackboard updates live

๐Ÿ—บ๏ธ Roadmap

Built in the open. Every milestone is real work โ€” no vapor.

โœ… Shipped

  • Foundations โ€” daemon, JSONL store, plan parser, RAM page, WebSocket
  • 8 agents made observable โ€” roster, drill-down grid, thrash detector, live broadcasts, localStorage cache

๐Ÿšง Next (in progress)

  • ๐Ÿ’ฐ 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

๐Ÿ”ฎ Soon

  • ๐Ÿ’พ Daemon crash recovery โ€” replay iterations.jsonl on 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

โญ North star

  • ๐Ÿชž Self-spec'ing loops ยท ๐ŸŒ multi-repo orchestration ยท ๐Ÿ‘๏ธ visual diff approval ยท ๐Ÿ›’ public agent marketplace

๐Ÿค Contributing

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 repo

File issues at the GitHub issue tracker. Found a bug? Have a wild idea? Open a PR.


๐Ÿงฌ Credit

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.


๐Ÿ“œ License

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

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors