A three-phase autonomous pipeline that inspects any SaaS product, builds a working clone with real cloud infrastructure, and QA-tests everything — no human in the loop.
概览
A three-phase autonomous pipeline that inspects any SaaS product, builds a working clone with real cloud infrastructure, and QA-tests everything — no human in the loop.
README
Note for AI agents: This README is structured as step-by-step instructions you can follow to set up and run the pipeline for a user. Each step includes verification commands. If you’re an agent reading this, start at Setup.
Proof It Works
We pointed Ralph-to-Ralph at resend.com during Ralphthon Seoul 2026 and walked away (see the result: opensend):
| Metric | Result |
|---|---|
| Features built | 52 |
| Lines of code | 24,000+ |
| Unit tests passing | 388 |
| Dashboard pages | 10 |
| API endpoints | 16+ |
| Total time | ~4 hours (fully autonomous) |
| Human intervention | Zero |
The clone sends real emails via AWS SES, verifies real domains, auto-configures DNS via Cloudflare, and deployed itself to AWS App Runner. It placed 2nd at the hackathon.
How It Works
A single watchdog orchestrator (ralph/ralph-watchdog.sh) drives four phases. It auto-restarts failures, tracks token cost against a budget cap, refuses to enter QA until the workspace proves it builds, and detects zero-progress QA stalls. Up to 5 build-QA cycles per feature.
Every loop phase is backed by either Codex (default, reasoning_effort=low — empirically best across all four loops) or Claude. You pick during onboarding; the choice lands in ralph-config.json as inspectAgent / buildAgent / qaAgent / architectureAgent (plus reasoningEffort for codex), and each loop reads its own field at runtime.
| Phase | Agent | What It Does |
|---|---|---|
| 1. Inspect | configurable (default: Codex) + Ever CLI | Browses the target, scrapes docs deterministically (Scrapling + trafilatura), captures screenshots, generates a PRD with 50+ features |
| 1.5. Architecture | configurable (default: Codex) | Turns the PRD into evidence-based decisions — process topology, data model, infra, auth, packaging — recorded in ralph/architecture-decisions.json |
| 2. Build | configurable (default: Codex) | For each feature: vertically slices it into ≤4 testable phases (Phase 2.5), then implements each slice TDD-first, commits and pushes after every slice |
| 3. QA | configurable (default: Codex) + Ever CLI | Per-feature progressive disclosure: Functional → API Contract → Security → Accessibility. Fixes bugs and re-tests until features pass |
Prerequisites
You can install these ahead of time, or onboarding will prompt you when it needs them.
Coding CLI
The agent that drives Inspect, Architecture, Build, and QA. You pick one during onboarding and the choice applies to every loop.
| Tool | Install |
|---|---|
Codex CLI (default — reasoning_effort=low) |
npm install -g @openai/codex |
| Claude Code CLI | npm install -g @anthropic-ai/claude-code |
Codex at low reasoning effort is the empirical best across every loop and is the default. You can override per phase by editing inspectAgent / buildAgent / qaAgent / architectureAgent in ralph-config.json after onboarding — the loop scripts read those fields at runtime via ralph/lib/agent-runner.sh.
Browser Agent
Used by Inspect and QA to drive the target product and your clone.
| Tool | Install |
|---|---|
| Ever CLI (recommended — the loop is tuned for this) | See foreverbrowsing.com |
| Agent Browser | See agent-browser.dev |
| Playwright | npm install -g playwright && playwright install |
Anything else with a CLI works, but the inspect and QA prompts are tuned for Ever CLI — expect rougher edges with other agents.
Cloud CLI
Pick one and authenticate it. Onboarding will ask if it doesn’t find one already installed.
| Provider | Install | Authenticate |
|---|---|---|
| Vercel (default, personal) | npm install -g vercel |
vercel login |
| AWS (team / production) | brew install awscli |
aws configure |
| GCP | Install gcloud | gcloud auth login |
| Azure | Install az | az login |
Want Railway, Fly.io, Render, or self-hosted? Pick “custom” during onboarding and describe your stack — onboarding generates a stack-specific preflight script.
Stack
Onboarding picks one of three first-class stacks based on your answers (language + framework), writes the choice to ralph-config.json, and runs the matching template’s setup script.
| Stack | Language | Framework | Tests | Linter |
|---|---|---|---|---|
| typescript-nextjs (default, most complete) | TypeScript | Next.js + React + Tailwind | Vitest + Playwright | Biome |
| python-fastapi | Python | FastAPI + uvicorn | pytest + httpx | Ruff |
| go-chi | Go | chi router | go test |
go test (no separate linter) |
The TypeScript template ships the most pre-wired tooling — Drizzle for DB, Playwright for E2E, full make test-e2e and make db-push targets. Python and Go templates are minimal scaffolds; the build agent installs database drivers and feature-specific dependencies as the PRD requires them.
After onboarding, .ralph-setup-done records the template name and BUILD_GUIDE.md (in the repo root) has stack-specific build instructions. Templates live in .claude/skills/ralph-to-ralph-onboard/templates/.
Setup
Follow these steps in order. Each step has a verification command — run it before moving to the next step.
Step 1: Clone and install
Step 1 — Fork this repo on GitHub (top-right “Fork” button). This gives you your own copy to push SaaS features into, and lets you pull pipeline improvements from upstream later.
Step 2 — Clone your fork:
git clone https://github.com/YOUR_USERNAME/ralph-to-ralph.git
cd ralph-to-ralph
# Optional: track upstream for future pipeline improvements
git remote add upstream https://github.com/namuh-eng/ralph-to-ralph.git
Then continue:
Verify:
ls ralph-config.json 2>/dev/null || echo "No config yet (expected — created by onboarding)"
ls .ralph-setup-done 2>/dev/null || echo "Stack not set up yet (expected — done by onboarding)"
Step 2: Configure environment
cp .env.example .env
Then set these values in .env:
| Variable | Required | Where to get it |
|---|---|---|
ANTHROPIC_API_KEY |
Yes (if clone has AI features) | console.anthropic.com |
DASHBOARD_KEY |
Yes | Generate with openssl rand -hex 32 |
DATABASE_URL |
Set by onboarding | Auto-configured during onboarding |
CLOUDFLARE_API_TOKEN |
Optional (DNS automation) | Cloudflare dashboard |
CLOUDFLARE_ZONE_ID |
Optional (DNS automation) | Cloudflare dashboard → your domain → Overview |
Verify:
# Check that .env exists and has content
test -f .env && echo ".env exists" || echo "ERROR: .env missing"
grep -c '=' .env # Should show number of configured variables
Step 3: Onboard a target product
Onboarding researches the target product, configures the stack, installs dependencies, and starts the build loop.
Recommended: Onboarding skill inside a coding agent
Open this repo in your coding agent and invoke the onboarding skill:
| Agent | Invoke with |
|---|---|
| Claude Code | /ralph-to-ralph-onboard |
| Codex | $ralph-to-ralph-onboard |
| Other CLIs | Paste the contents of .claude/skills/ralph-to-ralph-onboard/SKILL.md and ask the agent to follow it |
The agent researches the product live, explains what needs to be set up in plain English, walks you through each decision, installs anything missing (browser agent, cloud CLI), and verifies your setup before kicking off the build loop. This is the path we recommend — it adapts to whatever’s already on your machine.
Alternative: Script
./ralph/onboard.sh
A bash script that asks for target URL, clone name, cloud provider, deploy preference, and browser agent — then hands off to Claude for research and config generation. Useful for non-interactive environments. Produces the same ralph-config.json as the skill.
Verify onboarding completed:
# Config exists and has required fields
python3 -c "
import json, sys
c = json.load(open('ralph-config.json'))
required = ['targetUrl', 'targetName', 'language', 'stackProfile']
missing = [k for k in required if k not in c]
if missing:
print(f'FAIL: missing fields: {missing}', file=sys.stderr)
sys.exit(1)
print(f'OK: target={c[\"targetUrl\"]}, lang={c[\"language\"]}, stack={c[\"stackProfile\"]}')
"
# Stack is set up and project compiles
test -f .ralph-setup-done && echo "Stack: $(cat .ralph-setup-done)"
make check && make test
Architecture Reference
Pipeline Flow
./ralph/onboard.sh # Onboard → ralph-config.json
↓
./ralph/ralph-watchdog.sh # Orchestrator (cost cap, build-proof gate)
↓
┌─────────────────────────────────────────────────────┐
│ Phase 1: INSPECT (Claude + Ever CLI) │
│ → Browse target, scrape docs (Scrapling) │
│ → Generate prd.json (50+ features) │
└────────────────────────┬────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ Phase 1.5: ARCHITECTURE (Claude architect) │
│ → PRD → architecture-decisions.json │
│ → Topology, data model, infra, auth, packaging │
└────────────────────────┬────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ Phase 2: BUILD (Claude, one feature at a time) │
│ ├─ Phase 2.5 Structure: vertical slice ≤4 phases │
│ ├─ TDD: tests first, then implement │
│ └─ make check && make test → commit → push │
└────────────────────────┬────────────────────────────┘
↓
┌─────────────────────────────────────────────────────┐
│ Phase 3: QA (Codex + Ever CLI) │
│ → Functional / API Contract / Security / A11y │
│ → Fix and re-test (up to 5 cycles) │
└────────────────────────┬────────────────────────────┘
↓
All features pass? → Deploy
No? → Back to Phase 2
File Map
ralph-to-ralph/
├── ralph/
│ ├── onboard.sh # Onboarding script (alternative to the skill)
│ ├── onboard-prompt.md # Onboarding agent instructions
│ ├── ralph-watchdog.sh # Orchestrator: inspect → architecture → build → QA
│ ├── inspect-ralph.sh # Phase 1 runner
│ ├── build-ralph.sh # Phase 2 runner
│ ├── qa-ralph.sh # Phase 3 runner — assembles prompt from ralph/qa/*.md
│ ├── inspect-prompt.md # Inspect agent instructions
│ ├── inspect-spec.md # Inspection strategy
│ ├── architecture-prompt.md # Architect agent instructions (Phase 1.5)
│ ├── build-prompt.md # Build agent instructions
│ ├── structure-prompt.md # Vertical-slicing instructions (Phase 2.5, invoked by Build)
│ ├── qa/ # Modular QA prompts: base, api, security, a11y, footer
│ ├── pre-setup.md # Pre-configured setup (read by all agents)
│ ├── ever-cli-reference.md # Ever CLI command reference
│ ├── deployment-profiles.json # fast-starter / production-aws / advanced-custom
│ ├── ralph-state.schema.json # Watchdog state schema (validated by `make validate`)
│ ├── ralph-state.template.json # Empty state template
│ └── docs/ # Architecture diagram + supporting docs
├── .claude/skills/
│ └── ralph-to-ralph-onboard/ # Interactive onboarding skill (Claude Code)
│ ├── SKILL.md # Skill definition + flow
│ ├── references/ # Long-form prompt fragments
│ ├── scripts/setup-stack.sh # Generic stack scaffolding script
│ └── templates/ # Stack templates: typescript-nextjs, python-fastapi, go-chi
├── schemas/ # JSON schemas validated by `make validate`
│ ├── ralph-config.schema.json
│ ├── prd-item.schema.json
│ ├── qa-report-entry.schema.json
│ └── architecture-decision.schema.json
├── scripts/
│ ├── start.sh # Thin restart wrapper around the watchdog
│ ├── preflight.sh # Provisions cloud infrastructure
│ ├── generate-demo-keys.sh # Generates API keys for demos
│ ├── validate-schemas.mjs # Validates state files against JSON schemas
│ └── scrape-docs.py # Deterministic doc scraper (Scrapling + trafilatura)
├── src/ # Source code (scaffolded by onboarding)
├── tests/ # Unit tests + factories + watchdog verification
├── tests/e2e/ # E2E tests
├── packages/sdk/ # SDK package (if target product has one)
├── hack/run_silent.sh # Output formatter used by Makefile
├── agent_docs/learnings/ # Long-running notes from past clone runs
├── docker-compose.dev.yml # Local dev stack: Postgres, Redis, Mailpit
├── .env.example # Documented environment variables
├── ralph-config.json # Generated by onboarding (single source of truth)
├── prd.json # Product requirements (generated by Inspect phase)
├── BUILD_GUIDE.md # Stack-specific build instructions (from template)
├── CLAUDE.md # Instructions for Claude agents (Build)
├── AGENTS.md # Instructions for Codex agent (QA)
├── Makefile # Contract targets — real recipes appended by onboarding
└── .ralph-setup-done # Marker file — contains template name
Commands
| Command | What It Does |
|---|---|
make check |
Typecheck + lint/format (composite) |
make test |
Run unit tests |
make test-e2e |
Run E2E tests (needs dev server) |
make all |
check + test |
make fix |
Auto-fix lint/format issues |
make validate |
Validate state files (prd.json, qa-report.json, ralph-config.json, ralph/ralph-state.json) against their JSON schemas |
make dev |
Dev server on port 3015 |
make build |
Production build |
make db-push / db-generate / db-migrate |
Schema sync · generate migration · run migrations |
make typecheck / lint / format / clean |
Granular targets — usually run via make check |
Pass VERBOSE=1 (or use make check-verbose / test-verbose) to see full output instead of the silent-on-success summary.
Agent Roles
| Agent | What It Reads | What It Produces | Phase |
|---|---|---|---|
| Onboarding (Claude) | ralph/onboard-prompt.md, ralph/pre-setup.md, CLAUDE.md |
ralph-config.json, installed deps, rewritten config files |
Pre-loop |
| Inspect (Claude + Ever CLI) | ralph/inspect-prompt.md, ralph/inspect-spec.md, ralph/ever-cli-reference.md |
prd.json, screenshots in ralph/screenshots/inspect/ |
Phase 1 |
| Architect (Claude) | ralph/architecture-prompt.md, prd.json, target-docs/, ralph-config.json |
ralph/architecture-decisions.json, updated build-spec.md |
Phase 1.5 |
| Build (Claude) | ralph/build-prompt.md, ralph/structure-prompt.md, prd.json, build-spec.md, CLAUDE.md |
Source in src/, tests in tests/, SDK in packages/sdk/, structure outlines in .qrspi/{feature-id}/structure.md (when needed) |
Phase 2 (+2.5 Structure inline) |
| QA (Codex + Ever CLI, multi-layer) | AGENTS.md, ralph/qa/{base,api,security,a11y,footer}.md, ralph/ever-cli-reference.md |
Bug fixes, QA screenshots in ralph/screenshots/qa/, qa-report.json |
Phase 3 |
The QA agent uses progressive disclosure — qa-ralph.sh assembles the prompt from the modules above based on feature category (auth, crud, infrastructure, settings, etc.). Not every feature runs all four sub-phases.
What Gets Built
The pipeline produces a fully functional, deployed product — not a mockup.
| Capability | Implementation | When |
|---|---|---|
| Full-stack app | Language + framework from ralph-config.json |
Always |
| REST API | Bearer token auth | Always |
| Database | Postgres (ORM depends on language) | Always |
| Unit + E2E tests | Stack-specific test runner + E2E framework | Always |
| Deployment | Docker + cloud provider | Always (unless skipDeploy: true) |
| Email delivery | AWS SES / SendGrid | If the target sends emails |
| DNS management | Cloudflare API | If the target manages domains |
| File storage | AWS S3 / Cloud Storage | If the target handles uploads |
| SDK package | Language-native SDK | If the target has an SDK |
Customization
Changing the target product
Re-run onboarding. Easiest in your coding agent:
| Agent | Invoke with |
|---|---|
| Claude Code | /ralph-to-ralph-onboard |
| Codex | $ralph-to-ralph-onboard |
For a clean slate (clears ralph-config.json and .ralph-setup-done), use the script form:
./ralph/onboard.sh --reset # Clear previous config
./ralph/onboard.sh # Start fresh
Modifying agent behavior
The pipeline is controlled by prompt files:
| File | Controls |
|---|---|
ralph/onboard-prompt.md |
How the Onboarding agent researches the target and configures the stack |
ralph/inspect-prompt.md |
How the Inspect agent browses, scrapes docs, and writes the PRD |
ralph/architecture-prompt.md |
How the Architect turns the PRD into evidence-based architecture decisions |
ralph/build-prompt.md |
How the Build agent implements features (TDD, package install rules, etc.) |
ralph/structure-prompt.md |
How Build vertically slices large features into ≤4 testable phases |
ralph/qa/{base,api,security,a11y,footer}.md |
How the QA agent tests features — modules assembled per feature category |
ralph/pre-setup.md |
Pre-configured setup context (read by all agents) |
Running phases individually
The watchdog (ralph/ralph-watchdog.sh) is the production entry point — it handles process-level restarts, cost caps, build-proof gating before QA, and stall detection. Run a single phase only when iterating manually:
./ralph/inspect-ralph.sh # Phase 1 only — generate / refresh prd.json
./ralph/build-ralph.sh # Phase 2 only — needs prd.json
./ralph/qa-ralph.sh # Phase 3 only — needs a built clone
These scripts have no process-level restart logic — if they crash, they stay crashed. Fine for short sessions; for unattended end-to-end runs, always use the watchdog.
FAQ
Contributing
We welcome contributions — bug fixes, new features, documentation, or new target product test runs.
- Fork the repository
- Create a feature branch (
git checkout -b my-feature) - Make your changes
- Run
make check && make testto verify - Commit with a clear message
- Open a pull request
If you’re unsure about a change, open an issue first to discuss it.
Team
Ralph-to-Ralph was built by:
- Jaeyun Ha — github.com/jaeyunha
- Ashley Ha — github.com/ashley-ha
Built at Ralphthon Seoul 2026.
Inspiration
Inspired by @GeoffreyHuntley’s “software eats itself” post.
License
Apache License 2.0 — use it, modify it, ship it. Includes an explicit patent grant.
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add namuh-eng/ralph-to-ralph