@neriros/ralphy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 neriros
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # Ralphy
2
+
3
+ An iterative AI task execution framework. Ralphy orchestrates multi-phase autonomous work using Claude or Codex engines, with built-in state management, progress tracking, and cost safeguards.
4
+
5
+ ## How It Works
6
+
7
+ Ralphy breaks down complex tasks into structured phases:
8
+
9
+ ```mermaid
10
+ graph LR
11
+ R[Research] --> P[Plan] --> E[Exec] --> V[Review] --> D[Done]
12
+ V -->|issues found| E
13
+ ```
14
+
15
+ Each phase runs in a loop — the engine iterates until the phase's completion criteria are met, then auto-advances to the next phase. A `STEERING.md` file lets you guide the agent mid-flight.
16
+
17
+ ## Installation
18
+
19
+ ### npm (global)
20
+
21
+ ```bash
22
+ npm install -g ralphy
23
+ # or
24
+ bunx ralphy
25
+ ```
26
+
27
+ Requires [Bun](https://bun.sh) as the runtime.
28
+
29
+ ### Local (per-project)
30
+
31
+ ```bash
32
+ bun install
33
+ make install # Install to ./.ralph
34
+ make install ~ # Install to ~/.ralph
35
+ make install /path/to # Install to /path/to/.ralph
36
+ ```
37
+
38
+ This builds the CLI and MCP server, copies them to `.ralph/bin/`, sets up phase definitions and templates, configures `.mcp.json`, and adds a `ralph` script to `package.json`. The `.ralph/` directory is gitignored by default.
39
+
40
+ ### Prerequisites
41
+
42
+ - [Bun](https://bun.sh)
43
+ - [Claude CLI](https://docs.anthropic.com/en/docs/claude-cli) (for the Claude engine)
44
+ - `jq` (for installation)
45
+
46
+ ## Usage
47
+
48
+ ### Create and Run a Task
49
+
50
+ ```bash
51
+ ralph task --name fix-auth --prompt "Fix the JWT validation bug" --claude opus --max-iterations 10
52
+ ```
53
+
54
+ The engine defaults to Claude Opus.
55
+
56
+ ### Interactive Mode
57
+
58
+ ```bash
59
+ ralph task --name fix-auth --prompt "Fix the JWT validation bug" --interactive
60
+ ```
61
+
62
+ Runs the research and plan phases interactively (with direct terminal I/O), then switches to automated execution for the remaining phases. Useful when you want to guide early discovery and let the agent execute autonomously.
63
+
64
+ ### Resume a Task
65
+
66
+ ```bash
67
+ ralph task --name fix-auth
68
+ ```
69
+
70
+ If the task already exists, it resumes from where it left off.
71
+
72
+ ### Check Status
73
+
74
+ ```bash
75
+ ralph list # Table of all tasks
76
+ ralph status --name fix-auth # Detailed view of one task
77
+ ```
78
+
79
+ ### Manual Phase Control
80
+
81
+ ```bash
82
+ ralph advance --name fix-auth # Advance to next phase
83
+ ralph set-phase --name fix-auth --phase exec # Jump to a specific phase
84
+ ```
85
+
86
+ ## CLI Options
87
+
88
+ | Option | Description |
89
+ | ---------------------- | -------------------------------------------------------- |
90
+ | `--name <name>` | Task name (required for most commands) |
91
+ | `--prompt <text>` | Task description |
92
+ | `--prompt-file <path>` | Read prompt from a file |
93
+ | `--claude [model]` | Use Claude engine (haiku/sonnet/opus) |
94
+ | `--codex` | Use Codex engine |
95
+ | `--model <model>` | Set model (haiku/sonnet/opus) |
96
+ | `--no-execute` | Stop after research + plan phases |
97
+ | `--interactive` | Run research + plan interactively, then automate |
98
+ | `--max-iterations <N>` | Stop after N iterations (0 = unlimited) |
99
+ | `--max-cost <N>` | Stop when cost exceeds $N |
100
+ | `--max-runtime <N>` | Stop after N minutes |
101
+ | `--max-failures <N>` | Stop after N consecutive identical failures (default: 5) |
102
+ | `--unlimited` | Set max iterations to 0 (unlimited, default) |
103
+ | `--delay <N>` | Seconds to wait between iterations |
104
+ | `--log` | Log raw JSON stream output |
105
+ | `--verbose` | Verbose output |
106
+
107
+ ## Phases
108
+
109
+ | Phase | Purpose | Output |
110
+ | ------------ | -------------------------------------------- | ------------------------ |
111
+ | **Research** | Study the codebase and gather context | `RESEARCH.md` |
112
+ | **Plan** | Design the implementation approach | `PLAN.md`, `PROGRESS.md` |
113
+ | **Exec** | Implement items from the progress checklist | Code changes |
114
+ | **Review** | Verify the work, loop back to exec if needed | Updated `PROGRESS.md` |
115
+ | **Done** | Terminal phase — task is complete | — |
116
+
117
+ ## Task Files
118
+
119
+ Each task lives in `.ralph/tasks/<name>/` and contains:
120
+
121
+ | File | Purpose |
122
+ | ---------------- | ------------------------------------------------ |
123
+ | `state.json` | Task state, usage stats, and history |
124
+ | `STEERING.md` | Your guidance to the agent (editable anytime) |
125
+ | `RESEARCH.md` | Agent's research findings |
126
+ | `PLAN.md` | Agent's implementation plan |
127
+ | `PROGRESS.md` | Checklist tracking execution progress |
128
+ | `INTERACTIVE.md` | Context saved from interactive session (if used) |
129
+ | `STOP` | Create this file to signal the loop to stop |
130
+
131
+ ## MCP Server
132
+
133
+ Ralphy includes an MCP server that exposes task management tools to Claude agents. It's automatically configured during installation. Available tools:
134
+
135
+ - `ralph_list_tasks` — List tasks with status and progress
136
+ - `ralph_get_task` — Get task details
137
+ - `ralph_create_task` / `ralph_run_task` — Create and run tasks
138
+ - `ralph_read_document` — Read task documents
139
+ - `ralph_advance_phase` — Advance or set phase
140
+ - `ralph_update_steering` — Update STEERING.md
141
+ - `ralph_finish_interactive` — Complete interactive session and hand off to automated phases
142
+ - `ralph_list_checklists` / `ralph_apply_checklist` — Manage verification checklists
143
+
144
+ ## Project Structure
145
+
146
+ ```
147
+ ralphy/
148
+ ├── apps/
149
+ │ ├── cli/ # CLI application
150
+ │ └── mcp/ # MCP server
151
+ ├── packages/
152
+ │ ├── core/ # State management, loop, progress
153
+ │ ├── context/ # Storage abstraction
154
+ │ ├── engine/ # Claude/Codex engine spawning
155
+ │ ├── output/ # Terminal formatting
156
+ │ ├── phases/ # Phase definitions and checklists
157
+ │ └── types/ # Zod schemas and types
158
+ └── Makefile
159
+ ```
160
+
161
+ ## Development
162
+
163
+ ```bash
164
+ bun install
165
+ bunx nx run-many -t lint,typecheck,test,build # Run checks
166
+ bunx nx run cli:build # Build CLI only
167
+ ```
@@ -0,0 +1,5 @@
1
+ # Deploy
2
+
3
+ - [ ] **Check deployment status** — use Vercel MCP or CI dashboard to confirm the deploy succeeded.
4
+ - [ ] **Read build logs on failure** — identify the error, fix locally, re-run static + test checklists, commit, push again.
5
+ - [ ] **Smoke test the deployed URL** — verify the deployed version loads and the affected feature works.
@@ -0,0 +1,6 @@
1
+ # Static Analysis
2
+
3
+ - [ ] **Lint** — run the project linter (see `CLAUDE.md` for command). Zero errors, zero warnings.
4
+ - [ ] **Typecheck** — run the type checker. Zero errors.
5
+ - [ ] **Build** — run a production build to catch anything lint/typecheck miss (import resolution, SSR issues, etc.).
6
+ - [ ] **Format** — run the formatter. Zero errors.
@@ -0,0 +1,5 @@
1
+ # Tests
2
+
3
+ - [ ] **Unit tests** — run tests for affected libraries/modules. If tests don't exist for new code, create them.
4
+ - [ ] **Integration tests** _(if applicable)_ — run if your changes touch API routes, database queries, or cross-module boundaries.
5
+ - [ ] **E2E tests** _(if applicable)_ — run if your changes affect user-facing flows (see `CLAUDE.md` for e2e command).