ralph-ui 0.1.5

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +404 -0
  3. package/bin/ralph-ui.js +1115 -0
  4. package/package.json +130 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Darío Vallés
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,404 @@
1
+ # Ralph UI
2
+
3
+ **A modern application for orchestrating autonomous AI coding agents using the Ralph Wiggum Loop technique. Access via browser from any device on your network.**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Rust](https://img.shields.io/badge/Rust-1.75+-orange.svg)](https://www.rust-lang.org/)
7
+ [![React](https://img.shields.io/badge/React-19+-61DAFB.svg)](https://reactjs.org/)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6.svg)](https://www.typescriptlang.org/)
9
+
10
+ ---
11
+
12
+ ## What is Ralph UI?
13
+
14
+ Ralph UI provides a beautiful, intuitive interface for the **Ralph Wiggum Loop** - an autonomous AI development technique that enables AI agents to work continuously on software development tasks using the filesystem and git history as long-term memory.
15
+
16
+ ### Key Features
17
+
18
+ - **Browser Access** - Access from any device on your network via HTTP/WebSocket
19
+ - **Remote Terminal Access** - Access from phones, tablets, or any device via your network or tunnels
20
+ - **Mission Control** - Bird's-eye view of all projects and active agents
21
+ - **Multi-Project Support** - Manage multiple projects with VS Code-style project switching
22
+ - **Multi-Agent Orchestration** - Run multiple AI agents in parallel with complete isolation
23
+ - **Real-Time Monitoring** - Watch your agents work with live terminal output and status updates
24
+ - **AI-Powered PRD Creation** - Interactive chat interface for creating PRDs with AI assistance
25
+ - **Git Integration** - Automatic worktree management, branching, and PR creation
26
+ - **Cost Tracking** - Monitor token usage and costs across all agents
27
+ - **Session Persistence** - Pause, resume, and recover sessions at any time
28
+ - **PRD Management** - Create PRDs from templates with quality scoring and one-click execution
29
+
30
+ ---
31
+
32
+ ## Technology Stack
33
+
34
+ **Frontend:**
35
+ - React 19 with TypeScript
36
+ - Tailwind CSS + shadcn/ui
37
+ - Zustand for state management
38
+ - xterm.js for terminal emulation
39
+
40
+ **Backend:**
41
+ - Rust with Axum HTTP/WebSocket server
42
+ - File-based JSON storage in `.ralph-ui/`
43
+ - git2-rs for git operations
44
+ - tokio for async I/O
45
+ - portable-pty for terminal emulation
46
+
47
+ **Development:**
48
+ - Bun for fast package management
49
+ - Vite for blazing-fast builds
50
+ - Vitest for unit testing, markdown E2E tests with LLM browser automation
51
+
52
+ ---
53
+
54
+ ## Quick Start (NPX)
55
+
56
+ The fastest way to run Ralph UI - no cloning or building required:
57
+
58
+ ```bash
59
+ # Run Ralph UI instantly
60
+ npx ralph-ui
61
+
62
+ # Or with custom port
63
+ npx ralph-ui --port 8080
64
+ ```
65
+
66
+ The binary is downloaded once and cached in `~/.ralph-ui/bin/`.
67
+
68
+ **Supported platforms:** macOS (Intel/Apple Silicon), Linux (x64/arm64), Windows
69
+
70
+ ---
71
+
72
+ ## Getting Started
73
+
74
+ ### Prerequisites
75
+
76
+ - **Rust:** 1.75+ (install from [rustup.rs](https://rustup.rs))
77
+ - **Bun:** 1.2+ (recommended) or Node.js 18+
78
+
79
+ ### Installation
80
+
81
+ **Option 1: NPX (Recommended)**
82
+
83
+ ```bash
84
+ npx ralph-ui
85
+ ```
86
+
87
+ That's it! The server starts on port 3420. Open `http://localhost:3420` and enter the auth token.
88
+
89
+ **Option 2: From Source (Development)**
90
+
91
+ ```bash
92
+ # Clone the repository
93
+ git clone https://github.com/dario-valles/Ralph-UI.git
94
+ cd Ralph-UI
95
+
96
+ # Install dependencies
97
+ bun install
98
+
99
+ # Start the backend server (Terminal 1)
100
+ bun run server:dev
101
+
102
+ # Start the frontend dev server (Terminal 2)
103
+ bun run dev
104
+
105
+ # Open http://localhost:1420 in your browser
106
+ # Enter the auth token displayed by the server
107
+ ```
108
+
109
+ **Testing & Building**
110
+
111
+ ```bash
112
+ bun run test # Frontend tests
113
+ bun run cargo:test # Backend tests
114
+ bun run cargo:build # Backend binary
115
+ bun run build # Frontend assets
116
+ ```
117
+
118
+ See [QUICK_START.md](./QUICK_START.md) for detailed setup instructions.
119
+
120
+ ---
121
+
122
+ ## Documentation
123
+
124
+ - **[Quick Start Guide](./QUICK_START.md)** - Developer setup and getting started
125
+ - **[Project Structure](./PROJECT_STRUCTURE.md)** - File organization and architecture
126
+ - **[CLAUDE.md](./CLAUDE.md)** - Detailed development instructions and commands
127
+
128
+ ---
129
+
130
+ ## What is the Ralph Wiggum Loop?
131
+
132
+ The Ralph Wiggum Loop (named after the beloved Simpsons character) is an autonomous AI development technique where:
133
+
134
+ 1. **Infinite Iteration:** AI agents run in loops until all tasks are complete
135
+ 2. **Filesystem Memory:** Progress persists in files and git history, not LLM context
136
+ 3. **Fresh Context:** When context fills up, a new agent starts with fresh memory
137
+ 4. **Autonomous Operation:** Agents can work for hours without human intervention
138
+
139
+ Originally coined by Geoffrey Huntley, this technique represents a paradigm shift in AI-assisted development, with community members reporting 14+ hour autonomous sessions successfully upgrading entire codebases.
140
+
141
+ ---
142
+
143
+ ## Supported AI Agents
144
+
145
+ Ralph UI supports 7 production-ready AI coding agents with full session management and token optimization:
146
+
147
+ - **Claude Code** (Anthropic's official CLI) - Fully integrated with session resumption
148
+ - **OpenCode** (Open source alternative) - Fully integrated with resume support
149
+ - **Cursor Agent** - Integrated with session resume capability
150
+ - **Codex CLI** (OpenAI) - Integrated with session resume support
151
+ - **Qwen Code** (Alibaba) - Integrated with Claude-compatible API
152
+ - **Droid** (Factory AI) - Integrated with CLI session management
153
+ - **gemini-cli** (Google) - Integrated with Gemini models
154
+
155
+ ### Alternative API Providers for Claude
156
+
157
+ For Claude Code, Ralph UI supports alternative API providers that offer Claude-compatible endpoints:
158
+
159
+ - **Anthropic (Direct)** - Default provider using official Anthropic API
160
+ - **Z.AI** - Claude-compatible API with alternative pricing
161
+ - **MiniMax** - Claude-compatible API service
162
+ - **MiniMax (China)** - China-specific endpoint for MiniMax service
163
+
164
+ **Provider Configuration:**
165
+ - Configure providers in Settings → API Providers
166
+ - Add API tokens for each provider you want to use
167
+ - Test connections directly from the UI
168
+ - Set a default provider for all Claude operations
169
+
170
+ **Usage:**
171
+ - When selecting agents, choose "Claude (Z.AI)" or "Claude (MiniMax)" from the dropdown
172
+ - The agent/model selector displays available providers once configured
173
+ - All Claude features work identically across providers
174
+ - Environment variables are automatically set when spawning agents
175
+
176
+ **Benefits:**
177
+ - Access Claude models through alternative providers
178
+ - Potential cost savings depending on provider pricing
179
+ - Geographic optimization (e.g., MiniMax China for Asia-Pacific users)
180
+ - Easy provider switching without code changes
181
+
182
+ ### Session Resumption for Token Savings
183
+
184
+ Ralph UI uses native CLI session resumption to avoid re-sending full conversation history on each message, providing **67-90% token savings** depending on conversation length.
185
+
186
+ **How it works:**
187
+ 1. **First message:** Full prompt sent, agent's session ID captured from output
188
+ 2. **Subsequent messages:** Session ID passed via resume flag, history omitted from prompt
189
+ 3. **The CLI agent** maintains its own context, so history isn't needed
190
+
191
+ **Supported agents with resume flags:**
192
+ - Claude Code (`--resume <session-id>`)
193
+ - Cursor Agent (`--resume=<chat-id>`)
194
+ - Codex CLI (`codex resume <session-id>`)
195
+ - Qwen Code (`--continue`)
196
+ - OpenCode (`--session <session-id>`)
197
+ - Droid (`--session-id <session-id>`)
198
+ - gemini-cli (check documentation for resume support)
199
+
200
+ **Token savings by conversation length:**
201
+
202
+ | Messages | Without Resume | With Resume | Savings |
203
+ |----------|----------------|-------------|---------|
204
+ | 5 | 15 exchanges | 5 exchanges | 67% |
205
+ | 10 | 55 exchanges | 10 exchanges| 82% |
206
+ | 20 | 210 exchanges | 20 exchanges| 90% |
207
+
208
+ ---
209
+
210
+ ## Advanced Features
211
+
212
+ ### Dry-Run Mode
213
+ Preview execution without spawning agents or creating branches. Toggle in the PRD Execution dialog to validate your PRD and configuration before committing resources.
214
+
215
+ ### @filename Syntax
216
+ Reference file contents in prompts using `@filename` syntax:
217
+ ```
218
+ Check @README.md for project context
219
+ Look at @src/main.rs for the entry point
220
+ ```
221
+ Files are automatically injected into agent prompts.
222
+
223
+ ### Progress File Tracking
224
+ Sessions persist progress to `.ralph-ui/` directories within each project for recovery after interruptions. Tracks task state changes with timestamps.
225
+
226
+ ### Graceful Shutdown
227
+ Signal handlers (SIGINT, SIGTERM, SIGHUP) ensure clean shutdown:
228
+ - Stops all running agents
229
+ - Cleans up worktrees
230
+ - Preserves committed branches
231
+
232
+ ### Server Commands
233
+
234
+ ```bash
235
+ bun run server # Production server (port 3420)
236
+ bun run server:dev # Development mode (faster builds)
237
+ bun run server:dev:token # Dev mode with fixed token (persists across restarts)
238
+ ```
239
+
240
+ ### Feature Availability
241
+
242
+ | Feature | Status |
243
+ |---------|--------|
244
+ | All UI features | ✓ |
245
+ | Real-time events (WebSocket) | ✓ |
246
+ | Live terminal output (WebSocket PTY) | ✓ |
247
+ | File watching | ✓ |
248
+ | Directory browser | ✓ |
249
+
250
+ See [CLAUDE.md](./CLAUDE.md) for detailed server documentation including authentication, endpoints, and architecture.
251
+
252
+ ---
253
+
254
+ ## Remote Terminal Access
255
+
256
+ Ralph UI runs as an HTTP/WebSocket server, accessible from any device on your network or remotely via tunnels.
257
+
258
+ ### Local Network Access
259
+
260
+ ```bash
261
+ # Start server (binds to all interfaces by default)
262
+ npx ralph-ui
263
+
264
+ # Or specify port
265
+ npx ralph-ui --port 8080
266
+ ```
267
+
268
+ Access from any device: `http://<your-ip>:3420`
269
+ - Find your IP: `ipconfig getifaddr en0` (macOS) or `hostname -I` (Linux)
270
+ - Enter the auth token shown in the terminal
271
+
272
+ ### Remote Access via Tunnels
273
+
274
+ For access outside your network:
275
+
276
+ ```bash
277
+ # Using ngrok
278
+ ngrok http 3420
279
+
280
+ # Using Cloudflare Tunnel
281
+ cloudflared tunnel --url http://localhost:3420
282
+
283
+ # Using Tailscale (recommended for persistent access)
284
+ # Install Tailscale, then access via your Tailscale IP
285
+ ```
286
+
287
+ ### Security Notes
288
+
289
+ - Always use a strong `--token` for remote access
290
+ - Consider HTTPS proxy for public tunnels
291
+ - The default token is regenerated on each restart; use `--token` for persistence
292
+
293
+ ---
294
+
295
+ ## Architecture
296
+
297
+ ```
298
+ ┌─────────────────────────────────────────────────────────┐
299
+ │ Ralph UI │
300
+ ├─────────────────────────────────────────────────────────┤
301
+ │ Frontend (React + TypeScript) │
302
+ │ - Mission Control with multi-project overview │
303
+ │ - Task list with dependency tracking │
304
+ │ - Agent monitor with live terminal output │
305
+ │ - PRD creation with AI chat interface │
306
+ │ - Git timeline and PR management │
307
+ ├─────────────────────────────────────────────────────────┤
308
+ │ Backend (Rust + Axum) │
309
+ │ - HTTP/WebSocket server │
310
+ │ - Task engine (PRD parsing, state tracking) │
311
+ │ - Git manager (worktrees, branches, commits) │
312
+ │ - Agent manager (spawn, monitor, kill, PTY) │
313
+ │ - File storage (.ralph-ui/ JSON files) │
314
+ ├─────────────────────────────────────────────────────────┤
315
+ │ External Integrations │
316
+ │ - Claude Code CLI, OpenCode CLI │
317
+ │ - GitHub API (Issues, PRs) │
318
+ └─────────────────────────────────────────────────────────┘
319
+ ```
320
+
321
+ ---
322
+
323
+ ## Deployment
324
+
325
+ ### Docker
326
+
327
+ ```dockerfile
328
+ FROM rust:latest AS builder
329
+ WORKDIR /app
330
+ COPY server .
331
+ RUN cargo build --release
332
+
333
+ FROM debian:bookworm-slim
334
+ COPY --from=builder /app/target/release/ralph-ui /usr/local/bin/
335
+ EXPOSE 3420
336
+ CMD ["ralph-ui", "--bind", "0.0.0.0"]
337
+ ```
338
+
339
+ ### Binary
340
+
341
+ ```bash
342
+ # Build release binary (14MB)
343
+ bun run cargo:build
344
+
345
+ # Run directly
346
+ ./server/target/release/ralph-ui --port 3420 --bind 0.0.0.0
347
+ ```
348
+
349
+ ---
350
+
351
+ ## Related Projects
352
+
353
+ - **[ralph-tui](https://github.com/subsy/ralph-tui)** - Terminal UI implementation (TypeScript/Bun)
354
+ - **[ralphy](https://github.com/michaelshimeles/ralphy)** - Bash automation tool for Ralph Loop
355
+ - **[ralph](https://github.com/snarktank/ralph)** - Autonomous AI agent loop CLI
356
+
357
+ Ralph UI aims to provide the most comprehensive graphical interface for the Ralph ecosystem.
358
+
359
+ ---
360
+
361
+ ## Contributing
362
+
363
+ We welcome contributions! This project is in active development.
364
+
365
+ ### How to Contribute
366
+
367
+ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
368
+
369
+ 1. Check the [Project Structure](./PROJECT_STRUCTURE.md) to understand the codebase
370
+ 2. Look for issues tagged with `good-first-issue` or `help-wanted`
371
+ 3. Fork the repository and create a feature branch
372
+ 4. Make your changes with tests
373
+ 5. Submit a pull request with a clear description
374
+
375
+ ---
376
+
377
+ ## Performance Targets
378
+
379
+ | Metric | Target |
380
+ |--------|--------|
381
+ | Binary Size | ~14 MB |
382
+ | Startup Time | < 1s |
383
+ | Memory Usage | < 100 MB idle, < 300 MB with 5 agents |
384
+ | UI Responsiveness | < 100ms for all interactions |
385
+
386
+ ---
387
+
388
+ ## License
389
+
390
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
391
+
392
+ ---
393
+
394
+ ## Acknowledgments
395
+
396
+ - **Geoffrey Huntley** for pioneering the Ralph Wiggum Loop technique
397
+ - **Anthropic** for Claude Code and official Ralph Wiggum plugin
398
+ - **ralph-tui team** for inspiration and architectural patterns
399
+
400
+ ---
401
+
402
+ **Built with Rust, Axum, React, and TypeScript**
403
+
404
+ *Making autonomous AI development accessible, transparent, and delightful.*