Claude自主开发工作流 是 AI Skill Hub 本期精选Agent工作流之一。已获得 9.1k 颗 GitHub Star,综合评分 8.2 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
基于Claude的开源自主AI开发循环系统,支持智能退出检测。自动化处理代码生成、测试验证全流程,适合寻求AI辅助开发、自动化工作流的开发者和团队使用。
Claude自主开发工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
基于Claude的开源自主AI开发循环系统,支持智能退出检测。自动化处理代码生成、测试验证全流程,适合寻求AI辅助开发、自动化工作流的开发者和团队使用。
Claude自主开发工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
# 克隆仓库 git clone https://github.com/frankbria/ralph-claude-code cd ralph-claude-code # 查看安装说明 cat README.md # 按 README 完成环境依赖安装后即可使用
# 查看帮助 ralph-claude-code --help # 基本运行 ralph-claude-code [options] <input> # 详细使用说明请查阅文档 # https://github.com/frankbria/ralph-claude-code
# ralph-claude-code 配置说明 # 查看配置选项 ralph-claude-code --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export RALPH_CLAUDE_CODE_CONFIG="/path/to/config.yml"
Autonomous AI development loop with intelligent exit detection and rate limiting
Ralph is an implementation of the Geoffrey Huntley's technique for Claude Code that enables continuous autonomous development cycles he named after Ralph Wiggum. It enables continuous autonomous development cycles where Claude Code iteratively improves your project until completion, with built-in safeguards to prevent infinite loops and API overuse.
Install once, use everywhere - Ralph becomes a global command available in any directory.
--resume flag for context preservation (no session hijacking)--output-format, --allowed-tools, --no-continueralph-enable wizard.ralphrc configuration file for project settings--live flag for real-time Claude Code visibilityralph.log rotates at 10MB, keeping 4 archived files--dry-run) to simulate loops without API callsralph-stats analytics command (JSON Lines per-loop metrics)--notify) for key loop events (macOS/Linux/terminal-bell)--backup) with --rollback restoreralph-import --github-issue plus metadata filters (labels, title, assignee, milestone, state) with first/interactive/priority selection and --dry-run previewralph-enable wizard for existing projects with task import.ralphrc for project-specific settings and tool permissions--live flag--sandbox docker (resource limits, network policy, secure credential handoff)--sandbox e2b (file sync, session recovery, cost tracking with --sandbox-max-cost)Ralph can convert existing PRDs, specifications, or requirement documents into the proper Ralph format using Claude Code.
gh) installed: brew install gh or sudo apt install gh (see https://cli.github.com)gh auth loginjq installed (used to parse issue JSON)ralph --process-queue ralph-queue process
npm install -g @anthropic-ai/claude-code (or use npx — set CLAUDE_CODE_CMD in .ralphrc)timeout command (execution timeouts)brew install coreutils (provides gtimeout)See TESTING.md for the comprehensive testing guide.
If you want to run the test suite:
```bash
npm install npm test && npm run test:e2e # All 784 tests must pass ```
Install Ralph globally on your system:
git clone https://github.com/frankbria/ralph-claude-code.git
cd ralph-claude-code
./install.sh
This adds ralph, ralph-monitor, ralph-setup, ralph-import, ralph-queue, ralph-migrate, ralph-enable, and ralph-enable-ci commands to your PATH.
Note: You only need to do this once per system. After installation, you can delete the cloned repository if desired.
Once Ralph is installed and your project is initialized:
```bash
To completely remove Ralph from your system:
```bash
./uninstall.sh
```bash
Run Claude Code inside an isolated Docker container instead of directly on your machine (Issue #74). Ralph's loop, rate limiting, and monitoring stay on the host; only Claude's execution — the part that edits files and runs commands autonomously — is containerized. The project directory is bind-mounted read-write at /workspace, so changes land on the host directly and ralph-monitor works unchanged.
```bash
docker build -t ralph-sandbox . ```
pip install e2b # official E2B Python SDK (the transport)
export E2B_API_KEY="e2b_..." # or: store in ~/.ralph/e2b_api_key (chmod 600)
npm install -g bats bats-support bats-assert
```bash
Ralph uses the timeout command for execution timeouts. On macOS, you need to install GNU coreutils:
```bash
brew install coreutils
gtimeout --version ```
Ralph automatically detects and uses gtimeout on macOS. No additional configuration is required after installation.
./install.sh # Install Ralph globally
./uninstall.sh # Remove Ralph from system (dedicated script)
./install.sh uninstall # Alternative: Remove Ralph from system
./install.sh --help # Show installation help
ralph-migrate # Migrate existing project to .ralph/ structure
Ralph has two phases: one-time installation and per-project setup.
INSTALL ONCE USE MANY TIMES
+-----------------+ +----------------------+
| ./install.sh | -> | ralph-setup project1 |
| | | ralph-enable |
| Adds global | | ralph-import prd.md |
| commands | | ... |
+-----------------+ +----------------------+
```bash
```bash
ralph --sandbox docker # Default image, 4g RAM, 2 CPUs, bridge network
ralph --sandbox docker --sandbox-image node:20 # Any image with `claude` on PATH
ralph --sandbox docker --sandbox-memory 8g --sandbox-cpus 4
ralph --sandbox docker --sandbox-network none # Full network isolation (blocks the Claude API —
# only for images with their own auth/proxy setup)
ralph --monitor --sandbox docker # Works with tmux monitoring
Equivalent .ralphrc settings: SANDBOX_PROVIDER, SANDBOX_DOCKER_IMAGE, SANDBOX_DOCKER_MEMORY, SANDBOX_DOCKER_CPUS, SANDBOX_DOCKER_NETWORK (CLI flags override).
```bash ralph --sandbox e2b # base template; claude CLI auto-bootstrapped ralph --sandbox e2b --sandbox-template my-template # custom template with claude preinstalled ralph --sandbox e2b --sandbox-timeout 7200 # 2h session timeout (expired sandboxes auto-recreate) ralph --sandbox e2b --sandbox-max-cost 5.00 --sandbox-cost-alert 2.00 # budget controls ralph --sandbox e2b --sandbox-keep-alive # leave it running; reuse with --sandbox-id <id> ralph --monitor --sandbox e2b # works with tmux monitoring (cost shown in the dashboard)
ralph --status
Rate limiting supports two independent limits — both reset hourly:
| Setting | Default | Description |
|---------|---------|-------------|
| `MAX_CALLS_PER_HOUR` | `100` | Max Claude invocations per hour |
| `MAX_TOKENS_PER_HOUR` | `0` (disabled) | Max cumulative tokens per hour |
Token tracking extracts `input_tokens + output_tokens` from each Claude response. A single call can consume 100k+ tokens, so `MAX_TOKENS_PER_HOUR` provides cost control that `MAX_CALLS_PER_HOUR` alone cannot.
The circuit breaker automatically:
- Detects API errors and rate limit issues with advanced two-stage filtering
- Opens circuit after 3 loops with no progress or 5 loops with same errors
- Eliminates false positives from JSON fields containing "error"
- Accurately detects stuck loops with multi-line error matching
- Gradually recovers with half-open monitoring state
- **Auto-recovers** after cooldown period (default: 30 minutes) — OPEN → HALF_OPEN → CLOSED
- Provides detailed error tracking and logging with state history
**Auto-recovery options:**bash
```bash
- [ ] Frontend integration # does NOT block exit - [ ] SMS notifications # does NOT block exit ```
Unchecked items under Optional, Future, Future Enhancements, or Nice to Have headings (and their subsections) are ignored by the completion check. Customize the section names with OPTIONAL_SECTIONS in .ralphrc (comma-separated, case-insensitive). This resolves the deadlock where Claude treats low-priority items as skippable while Ralph waits for them.
Each Ralph project can have a .ralphrc configuration file:
```bash
PROJECT_NAME="my-project" PROJECT_TYPE="typescript"
#RALPH_SHELL_INIT_FILE="~/.zshrc"
MAX_CALLS_PER_HOUR=100 CLAUDE_TIMEOUT_MINUTES=15 CLAUDE_OUTPUT_FORMAT="json"
ralph --monitor --verbose --timeout 30 ```
ralph [OPTIONS]
-h, --help Show help message
-c, --calls NUM Set max calls per hour (default: 100)
-p, --prompt FILE Set prompt file (default: .ralph/PROMPT.md)
-s, --status Show current status and exit
-m, --monitor Start with tmux session and live monitor
-v, --verbose Show detailed progress updates during execution
-l, --live Enable live streaming output (real-time Claude Code visibility)
-t, --timeout MIN Set Claude Code execution timeout in minutes (1-120, default: 15)
--dry-run Simulate loop execution without making actual Claude API calls
-n, --notify Enable desktop notifications for key events
-b, --backup Enable automatic git backup branch before each loop (requires git)
--rollback [BRANCH] Roll back to a backup branch (lists available branches if none given)
--show-tool-args Show tool arguments (commands, file paths) in live streaming output
--output-format FORMAT Set output format: json (default) or text
--allowed-tools TOOLS Set allowed Claude tools (default: granular git subcommands + npm/pytest)
--no-continue Disable session continuity (start fresh each loop)
--session-expiry HOURS Set session expiration time in hours (default: 24)
--reset-circuit Reset the circuit breaker
--circuit-status Show circuit breaker status
--auto-reset-circuit Auto-reset circuit breaker on startup (bypasses cooldown)
--reset-session Reset session state manually
--queue-status Show the issue queue and exit
--process-queue Process pending queued issues sequentially (--halt-on-failure to stop on first failure)
--resume-queue Resume processing the remaining pending issues
--queue-next Print the id of the next ready queued issue
--queue-clear Remove all items from the queue
--queue-remove <id|N> Remove one item from the queue
Full reference: every flag is documented in depth, with examples and .ralphrc patterns, in docs/CLI_OPTIONS.md.
ralph-import api-spec.json backend-service
CLAUDE_CODE_CMD="claude"
When Claude's 5-hour usage limit is reached, Ralph: 1. Detects the limit using three-layer verification (timeout guard → structural JSON → filtered text fallback) 2. Prompts you to choose: - Option 1: Wait 60 minutes for the limit to reset (with countdown timer) - Option 2: Exit gracefully 3. Unattended mode: Auto-waits on prompt timeout (30s) instead of exiting 4. Prevents false positives from echoed file content mentioning "5-hour limit"
npm test
gh auth loginRalph 是专为 Claude Code 设计的自主开发辅助工具。它能够通过自动化循环,根据用户提供的项目需求,驱动 Claude Code 进行持续的代码编写与迭代,旨在提升 AI 辅助开发的自动化程度与效率。
Ralph 支持自主开发循环(Autonomous Development Loop),能够根据项目需求持续执行任务。其核心亮点在于智能退出检测机制,通过双重条件(完成指标与显式 EXIT_SIGNAL)确���任务安全结束。此外,它具备完善的速率限制(Rate Limiting)和熔断机制(Circuit Breaker),可防止因错误导致的无限循环,并支持通过语义理解进行响应分析,确保 Session 的上下文连续性。
使用 Ralph 前,您需要在项目根目录下准备好 `.ralph/specs/requirements.md` 文件,用于存放详细的技术规格说明。您也可以利用 Ralph 提供的功能,将现有的 PRD、规格说明书或需求文档通过 Claude Code 自动转换为标准的 Ralph 格式。
安装过程分为一次性全局安装与项目初始化两个阶段。首先,通过克隆仓库并运行 `./install.sh` 脚本进行全局安装,这会将 `ralph`、`ralph-monitor` 等一系列命令添加到您的系统 PATH 中。安装完成后,您可以删除克隆的仓库。后续针对每个新项目,只需运行 `ralph-setup` 进行初始化即可。
Ralph 的使用遵循“一次安装,多次使用”的逻辑。安装完成后,通过 `ralph-setup` 初始化项目,并使用 `ralph-import` 导入需求文档。在运行过程中,您可以使用 `ralph --status` 命令实时查看当前的 API 调用次数与 Token 使用量。系统内置了每小时重置的速率限制机制,帮助您更好地管理 Claude 的使用额��。
每个 Ralph 项目都可以通过根目录下的 `.ralphrc` 配置文件进行个性化设置,包括项目名称(PROJECT_NAME)和项目类型(PROJECT_TYPE)等。此外,您还可以通过环境变量自定义 `CLAUDE_CODE_CMD` 等关键参数。针对 Claude API 的 5 小时使用限制,Ralph 提供了三层验证机制,并在触发限制时允许用户选择等待重置或优雅退出。
Ralph 提供了强大的导入功能,支持将 JSON 格式的 API 规范(API spec)直接转换为后端服务的开发需求。通过 `ralph-import` 命令,您可以实现从 API 定义到代码实现的自动化衔接,极大简化了基于 API 文档的开发流程。
创新的AI工作流自动化方案,具有实际开发价值。智能退出检测设计合理,社区关注度高,维护活跃。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,Claude自主开发工作流 在Agent工作流赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | ralph-claude-code |
| 原始描述 | 开源AI工作流:Autonomous AI development loop for Claude Code with intelligent exit detection。⭐9.1k · Shell |
| Topics | AI工作流自主开发Claude集成Shell脚本开发自动化 |
| GitHub | https://github.com/frankbria/ralph-claude-code |
| License | MIT |
| 语言 | Shell |
收录时间:2026-05-13 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端