woda/laravel-ralph
Composer 安装命令:
composer require woda/laravel-ralph
包简介
Claude Code agent loop runner for Laravel
README 文档
README
Claude Code agent loop runner for Laravel. Runs Claude CLI iteratively in a GNU screen session, tracking progress, detecting completion, and logging everything.
Requirements
- PHP 8.2+
- Laravel 11 or 12
- Node.js
- Claude CLI (
claudein PATH) - GNU
screen(not needed with--once)
Installation
composer require woda/laravel-ralph
Setup
php artisan ralph:init
Configures .claude/settings.json with sandbox permissions so Claude doesn't hang waiting for bash approval.
Usage
# Interactive — choose from open GitHub issues, PRDs, or enter a prompt manually php artisan ralph:start # Work on a GitHub issue php artisan ralph:start --issue=42 # Inline prompt php artisan ralph:start --prompt="Refactor the payment service" # Prompt from file php artisan ralph:start --prompt=prompts/task.md # Single iteration, foreground (no screen) php artisan ralph:start --once --prompt="Fix the failing tests"
Options
| Flag | Description |
|---|---|
name |
Session name (argument, optional) |
--issue=N |
Work on a GitHub issue |
--prompt=TEXT|FILE |
Inline prompt or path to prompt file |
--iterations=N |
Max iterations (default: 30) |
--model=MODEL |
Override Claude model |
--budget=USD |
Max spend per Claude invocation |
--fresh |
Don't resume — each iteration is independent |
--resume |
Resume a previous session |
--attach |
Auto-attach to screen after start |
--once |
Single iteration in foreground |
Managing Sessions
# List running sessions php artisan ralph:status php artisan ralph:status --json php artisan ralph:status --clean # Remove dead entries # Attach to a session php artisan ralph:attach php artisan ralph:attach my-feature # Kill a session php artisan ralph:kill my-feature php artisan ralph:kill --all --force # View logs php artisan ralph:logs php artisan ralph:logs --tail php artisan ralph:logs --lines=100 php artisan ralph:logs --all # List all log files
Configuration
php artisan vendor:publish --tag=ralph-config
config/ralph.php
'loop' => [ 'default_iterations' => env('RALPH_LOOP_ITERATIONS', 30), 'permission_mode' => env('RALPH_PERMISSION_MODE', 'acceptEdits'), 'model' => env('RALPH_MODEL'), 'completion_marker' => '<promise>COMPLETE</promise>', 'max_consecutive_failures' => env('RALPH_MAX_CONSECUTIVE_FAILURES', 3), ], 'prompt' => [ 'default_file' => env('RALPH_PROMPT_FILE'), 'prd_path' => 'prd/backlog', 'suffix' => 'Focus on one task at a time. Run tests after changes. ...', 'continuation' => 'Continue working. Check the PRD and progress files ...', ], 'screen' => [ 'prefix' => 'ralph', 'shell' => env('RALPH_SCREEN_SHELL', 'zsh'), ], 'tracking' => [ 'file' => env('RALPH_TRACKING_FILE', '.live-agents'), ], 'logging' => [ 'directory' => storage_path('ralph-logs'), 'non_json_warn_threshold' => 50, ], 'script_path' => null,
Prompt Customization
Ralph appends prompt.suffix to every initial prompt and uses prompt.continuation as the prompt for iterations 2+. There is no base system prompt — Ralph passes your content directly to claude -p and relies on Claude's defaults and your project's CLAUDE.md.
PRD Mode
Place PRDs at prd/backlog/{name}/project.md. Optionally add a progress.md alongside it. Ralph discovers these in the interactive menu and passes them as @file references to Claude.
How It Works
- You provide a prompt (issue, PRD, file, or text).
- Ralph writes the prompt to a temp file, appends the configured suffix.
- A Node.js loop runner (
ralph-loop.cjs) spawnsclaude -pwith--output-format stream-json. - On iteration 1, a new session is created. On iterations 2+, the session is resumed with the continuation prompt.
- Each iteration's output is scanned for the completion marker (
<promise>COMPLETE</promise>). - The loop stops when: the marker is detected (exit 0), max iterations reached (exit 2), or consecutive failures exceed the threshold (exit 1).
All of this runs inside a GNU screen session so you can detach and reattach freely.
License
MIT
woda/laravel-ralph 适用场景与选型建议
woda/laravel-ralph 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 283 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Agent」 「loop」 「claude」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 woda/laravel-ralph 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 woda/laravel-ralph 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 woda/laravel-ralph 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lightweight library that provides regular PHP methods is a non-blocking implementation.
Iteration tools for PHP
Custom laravel monolog logger for datadog logs management, both api and agent ways
The Message Submission Agent Diagnostics tool (msadiag) facilitates testing the compatibility of third party message submission agents.
Run Laravel commands every N seconds (60 by default)
Port of olmelabs/EdiEngine to PHP 7.2+
统计信息
- 总下载量: 283
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-21