ralph-loop 0.1.0__tar.gz

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 (69) hide show
  1. ralph_loop-0.1.0/.github/workflows/ci.yml +47 -0
  2. ralph_loop-0.1.0/.gitignore +41 -0
  3. ralph_loop-0.1.0/LICENSE +21 -0
  4. ralph_loop-0.1.0/PKG-INFO +126 -0
  5. ralph_loop-0.1.0/README.md +101 -0
  6. ralph_loop-0.1.0/docs/README.md +42 -0
  7. ralph_loop-0.1.0/docs/TECH-SPEC.md +556 -0
  8. ralph_loop-0.1.0/docs/commands/history.md +98 -0
  9. ralph_loop-0.1.0/docs/commands/index.md +76 -0
  10. ralph_loop-0.1.0/docs/commands/init.md +70 -0
  11. ralph_loop-0.1.0/docs/commands/reset.md +83 -0
  12. ralph_loop-0.1.0/docs/commands/run.md +112 -0
  13. ralph_loop-0.1.0/docs/commands/status.md +80 -0
  14. ralph_loop-0.1.0/docs/concepts/guardrails.md +89 -0
  15. ralph_loop-0.1.0/docs/concepts/handoff.md +78 -0
  16. ralph_loop-0.1.0/docs/concepts/index.md +54 -0
  17. ralph_loop-0.1.0/docs/concepts/rotations.md +70 -0
  18. ralph_loop-0.1.0/docs/concepts/status-signals.md +97 -0
  19. ralph_loop-0.1.0/docs/concepts/verification.md +76 -0
  20. ralph_loop-0.1.0/docs/examples/add-feature.md +107 -0
  21. ralph_loop-0.1.0/docs/examples/fix-bug.md +126 -0
  22. ralph_loop-0.1.0/docs/examples/index.md +47 -0
  23. ralph_loop-0.1.0/docs/examples/refactor.md +121 -0
  24. ralph_loop-0.1.0/docs/getting-started.md +104 -0
  25. ralph_loop-0.1.0/docs/how-it-works.md +90 -0
  26. ralph_loop-0.1.0/docs/troubleshooting/claude-errors.md +123 -0
  27. ralph_loop-0.1.0/docs/troubleshooting/index.md +85 -0
  28. ralph_loop-0.1.0/docs/troubleshooting/max-iterations.md +119 -0
  29. ralph_loop-0.1.0/docs/troubleshooting/not-finishing.md +143 -0
  30. ralph_loop-0.1.0/docs/troubleshooting/ralph-stuck.md +120 -0
  31. ralph_loop-0.1.0/docs/writing-prompts.md +179 -0
  32. ralph_loop-0.1.0/pyproject.toml +67 -0
  33. ralph_loop-0.1.0/src/ralph/__init__.py +3 -0
  34. ralph_loop-0.1.0/src/ralph/__main__.py +6 -0
  35. ralph_loop-0.1.0/src/ralph/cli.py +26 -0
  36. ralph_loop-0.1.0/src/ralph/commands/__init__.py +1 -0
  37. ralph_loop-0.1.0/src/ralph/commands/history.py +112 -0
  38. ralph_loop-0.1.0/src/ralph/commands/init.py +69 -0
  39. ralph_loop-0.1.0/src/ralph/commands/reset.py +70 -0
  40. ralph_loop-0.1.0/src/ralph/commands/run.py +129 -0
  41. ralph_loop-0.1.0/src/ralph/commands/status.py +58 -0
  42. ralph_loop-0.1.0/src/ralph/core/__init__.py +1 -0
  43. ralph_loop-0.1.0/src/ralph/core/claude.py +73 -0
  44. ralph_loop-0.1.0/src/ralph/core/ignore.py +50 -0
  45. ralph_loop-0.1.0/src/ralph/core/loop.py +269 -0
  46. ralph_loop-0.1.0/src/ralph/core/prompt.py +80 -0
  47. ralph_loop-0.1.0/src/ralph/core/snapshot.py +94 -0
  48. ralph_loop-0.1.0/src/ralph/core/state.py +202 -0
  49. ralph_loop-0.1.0/src/ralph/output/__init__.py +1 -0
  50. ralph_loop-0.1.0/src/ralph/output/colors.py +69 -0
  51. ralph_loop-0.1.0/src/ralph/output/console.py +379 -0
  52. ralph_loop-0.1.0/tests/__init__.py +1 -0
  53. ralph_loop-0.1.0/tests/conftest.py +156 -0
  54. ralph_loop-0.1.0/tests/test_commands/__init__.py +1 -0
  55. ralph_loop-0.1.0/tests/test_commands/test_history.py +107 -0
  56. ralph_loop-0.1.0/tests/test_commands/test_init.py +94 -0
  57. ralph_loop-0.1.0/tests/test_commands/test_reset.py +112 -0
  58. ralph_loop-0.1.0/tests/test_commands/test_run.py +180 -0
  59. ralph_loop-0.1.0/tests/test_commands/test_status.py +77 -0
  60. ralph_loop-0.1.0/tests/test_core/__init__.py +1 -0
  61. ralph_loop-0.1.0/tests/test_core/test_claude.py +118 -0
  62. ralph_loop-0.1.0/tests/test_core/test_ignore.py +85 -0
  63. ralph_loop-0.1.0/tests/test_core/test_loop.py +156 -0
  64. ralph_loop-0.1.0/tests/test_core/test_prompt.py +88 -0
  65. ralph_loop-0.1.0/tests/test_core/test_snapshot.py +149 -0
  66. ralph_loop-0.1.0/tests/test_core/test_state.py +139 -0
  67. ralph_loop-0.1.0/tests/test_output/__init__.py +1 -0
  68. ralph_loop-0.1.0/tests/test_output/test_colors.py +73 -0
  69. ralph_loop-0.1.0/tests/test_output/test_console.py +302 -0
@@ -0,0 +1,47 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ python-version: ["3.10", "3.11", "3.12"]
16
+
17
+ runs-on: ${{ matrix.os }}
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install -e ".[dev]"
30
+
31
+ - name: Type check
32
+ run: mypy src/
33
+
34
+ - name: Lint
35
+ run: ruff check src/
36
+
37
+ - name: Format check
38
+ run: ruff format --check src/
39
+
40
+ - name: Test
41
+ run: pytest --cov --cov-report=xml
42
+
43
+ - name: Upload coverage
44
+ uses: codecov/codecov-action@v4
45
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
46
+ with:
47
+ file: coverage.xml
@@ -0,0 +1,41 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+
9
+ # Virtual environments
10
+ .venv/
11
+ venv/
12
+ env/
13
+
14
+ # Testing & coverage
15
+ .coverage
16
+ .pytest_cache/
17
+ htmlcov/
18
+
19
+ # Type checking & linting
20
+ .mypy_cache/
21
+ .ruff_cache/
22
+
23
+ # Ralph local state
24
+ .ralph/
25
+
26
+ # IDE
27
+ .idea/
28
+ .vscode/
29
+ *.swp
30
+ *.swo
31
+
32
+ # OS
33
+ .DS_Store
34
+
35
+ # Development artifacts
36
+ PROMPT.md
37
+ PROMPT-*.md
38
+
39
+ # AI Stuff
40
+ CLAUDE.md
41
+ AGENTS.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ilja Weber <info@ilja-weber.de>
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.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: ralph-loop
3
+ Version: 0.1.0
4
+ Summary: Autonomous development loop with context rotation
5
+ Author-email: Ilja Weber <info@ilja-weber.de>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: pathspec>=0.12.0
18
+ Requires-Dist: typer>=0.12.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: mypy>=1.8; extra == 'dev'
21
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
22
+ Requires-Dist: pytest>=8.0; extra == 'dev'
23
+ Requires-Dist: ruff>=0.2; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Ralph
27
+
28
+ Stop cleaning up after your AI coding agent.
29
+
30
+ Ralph supervises Claude Code (and other agents soon) to actually finish what they start.
31
+ When Claude loses track, declares "done" prematurely, or forgets earlier decisions -- Ralph catches it.
32
+
33
+ ## Who This Is For
34
+
35
+ - You use Claude Code or similar AI coding tools
36
+ - You're building real projects, not just experimenting
37
+ - You've been frustrated by half-finished AI output
38
+ - You want better results, even if it costs more tokens
39
+
40
+ ## Quick Start
41
+
42
+ 1. **Install and initialize**
43
+ ```bash
44
+ pip install ralph-loop
45
+ ralph init
46
+ ```
47
+
48
+ 2. **Describe what you want built** (in PROMPT.md)
49
+ ```markdown
50
+ # Goal
51
+ Add a contact form that emails submissions to me.
52
+
53
+ # Success Criteria
54
+ - [ ] Form has name, email, message fields
55
+ - [ ] Validates email format before sending
56
+ - [ ] Shows success message after submission
57
+ - [ ] Emails go to contact@mysite.com
58
+ ```
59
+
60
+ 3. **Let Ralph supervise the build**
61
+ ```bash
62
+ ralph run
63
+ ```
64
+ Ralph keeps Claude working until all criteria are actually met. Verified 3 times to make sure nothing was missed.
65
+
66
+ ## How It Works
67
+
68
+ Claude Code is powerful, but on bigger tasks it can:
69
+ - **Lose context** as the conversation grows
70
+ - **Forget decisions** made earlier in the session
71
+ - **Declare "done"** when things clearly aren't
72
+
73
+ Ralph solves this by **breaking big tasks into fresh-context chunks**.
74
+
75
+ After each chunk, Ralph:
76
+ 1. Saves what Claude learned and accomplished (so nothing is lost)
77
+ 2. Starts a fresh session (so context stays clean)
78
+ 3. Hands off the state (so Claude picks up where it left off)
79
+
80
+ When Claude says "done", Ralph doesn't just trust it—it verifies 3 times with fresh eyes. If anything was missed, work continues.
81
+
82
+ **Result:** Tasks that used to fail halfway through now complete reliably.
83
+
84
+ ## The Tradeoff
85
+
86
+ Ralph uses more tokens than running Claude directly. Each rotation is a fresh API call, and verification adds more.
87
+
88
+ **But:** You'll spend less time debugging, less time re-prompting, and less time cleaning up half-finished work. For many tasks, the extra tokens are worth it.
89
+
90
+ ## Commands
91
+
92
+ | Command | Description |
93
+ |---------|-------------|
94
+ | `ralph init` | Initialize Ralph in the current directory |
95
+ | `ralph run` | Supervise Claude until the goal is complete |
96
+ | `ralph status` | Show current progress |
97
+ | `ralph reset` | Start fresh |
98
+ | `ralph history` | View logs from previous sessions |
99
+
100
+ ## Configuration
101
+
102
+ The `.ralph/` directory contains local state and should not be committed:
103
+
104
+ ```
105
+ # .gitignore
106
+ .ralph/
107
+ ```
108
+
109
+ ## Documentation
110
+
111
+ - [Getting Started](./docs/getting-started.md) - Full setup guide
112
+ - [Writing Effective Prompts](./docs/writing-prompts.md) - Get better results
113
+ - [Troubleshooting](./docs/troubleshooting/index.md) - When things go wrong
114
+ - [Full Documentation](./docs/README.md) - Everything else
115
+
116
+ ## Built By
117
+
118
+ Ralph was created by [Ilja Weber](https://linkedin.com/in/ilja-weber-bb7135b5) to solve my own frustrations with AI coding agents declaring "done" too early.
119
+
120
+ Follow for updates:
121
+ - [LinkedIn](https://www.linkedin.com/in/ilja-weber-bb7135b5)
122
+ - [Twitter/X](https://x.com/iwebercodes)
123
+
124
+ ## License
125
+
126
+ MIT
@@ -0,0 +1,101 @@
1
+ # Ralph
2
+
3
+ Stop cleaning up after your AI coding agent.
4
+
5
+ Ralph supervises Claude Code (and other agents soon) to actually finish what they start.
6
+ When Claude loses track, declares "done" prematurely, or forgets earlier decisions -- Ralph catches it.
7
+
8
+ ## Who This Is For
9
+
10
+ - You use Claude Code or similar AI coding tools
11
+ - You're building real projects, not just experimenting
12
+ - You've been frustrated by half-finished AI output
13
+ - You want better results, even if it costs more tokens
14
+
15
+ ## Quick Start
16
+
17
+ 1. **Install and initialize**
18
+ ```bash
19
+ pip install ralph-loop
20
+ ralph init
21
+ ```
22
+
23
+ 2. **Describe what you want built** (in PROMPT.md)
24
+ ```markdown
25
+ # Goal
26
+ Add a contact form that emails submissions to me.
27
+
28
+ # Success Criteria
29
+ - [ ] Form has name, email, message fields
30
+ - [ ] Validates email format before sending
31
+ - [ ] Shows success message after submission
32
+ - [ ] Emails go to contact@mysite.com
33
+ ```
34
+
35
+ 3. **Let Ralph supervise the build**
36
+ ```bash
37
+ ralph run
38
+ ```
39
+ Ralph keeps Claude working until all criteria are actually met. Verified 3 times to make sure nothing was missed.
40
+
41
+ ## How It Works
42
+
43
+ Claude Code is powerful, but on bigger tasks it can:
44
+ - **Lose context** as the conversation grows
45
+ - **Forget decisions** made earlier in the session
46
+ - **Declare "done"** when things clearly aren't
47
+
48
+ Ralph solves this by **breaking big tasks into fresh-context chunks**.
49
+
50
+ After each chunk, Ralph:
51
+ 1. Saves what Claude learned and accomplished (so nothing is lost)
52
+ 2. Starts a fresh session (so context stays clean)
53
+ 3. Hands off the state (so Claude picks up where it left off)
54
+
55
+ When Claude says "done", Ralph doesn't just trust it—it verifies 3 times with fresh eyes. If anything was missed, work continues.
56
+
57
+ **Result:** Tasks that used to fail halfway through now complete reliably.
58
+
59
+ ## The Tradeoff
60
+
61
+ Ralph uses more tokens than running Claude directly. Each rotation is a fresh API call, and verification adds more.
62
+
63
+ **But:** You'll spend less time debugging, less time re-prompting, and less time cleaning up half-finished work. For many tasks, the extra tokens are worth it.
64
+
65
+ ## Commands
66
+
67
+ | Command | Description |
68
+ |---------|-------------|
69
+ | `ralph init` | Initialize Ralph in the current directory |
70
+ | `ralph run` | Supervise Claude until the goal is complete |
71
+ | `ralph status` | Show current progress |
72
+ | `ralph reset` | Start fresh |
73
+ | `ralph history` | View logs from previous sessions |
74
+
75
+ ## Configuration
76
+
77
+ The `.ralph/` directory contains local state and should not be committed:
78
+
79
+ ```
80
+ # .gitignore
81
+ .ralph/
82
+ ```
83
+
84
+ ## Documentation
85
+
86
+ - [Getting Started](./docs/getting-started.md) - Full setup guide
87
+ - [Writing Effective Prompts](./docs/writing-prompts.md) - Get better results
88
+ - [Troubleshooting](./docs/troubleshooting/index.md) - When things go wrong
89
+ - [Full Documentation](./docs/README.md) - Everything else
90
+
91
+ ## Built By
92
+
93
+ Ralph was created by [Ilja Weber](https://linkedin.com/in/ilja-weber-bb7135b5) to solve my own frustrations with AI coding agents declaring "done" too early.
94
+
95
+ Follow for updates:
96
+ - [LinkedIn](https://www.linkedin.com/in/ilja-weber-bb7135b5)
97
+ - [Twitter/X](https://x.com/iwebercodes)
98
+
99
+ ## License
100
+
101
+ MIT
@@ -0,0 +1,42 @@
1
+ # Ralph Documentation
2
+
3
+ Ralph supervises your AI coding agent to actually finish what it starts.
4
+
5
+ ## Quick Navigation
6
+
7
+ **Just getting started?**
8
+ [Get up and running in 5 minutes](./getting-started.md)
9
+
10
+ **Something went wrong?**
11
+ [Troubleshooting guide](./troubleshooting/index.md)
12
+
13
+ **Need examples?**
14
+ [See real PROMPT.md examples](./examples/index.md)
15
+
16
+ **Looking up a command?**
17
+ [Command reference](./commands/index.md)
18
+
19
+ **Want to understand how it works?**
20
+ [How Ralph works](./how-it-works.md)
21
+
22
+ ## In a Hurry?
23
+
24
+ ```bash
25
+ pip install ralph-loop
26
+ ralph init
27
+ # Edit PROMPT.md with your goal
28
+ ralph run
29
+ ```
30
+
31
+ That's it. Ralph will keep Claude working until your goal is complete, verified 3 times.
32
+
33
+ ## What is Ralph?
34
+
35
+ When you give Claude Code a complex task, it can lose context, forget decisions, or declare "done" too early. Ralph fixes this by breaking work into fresh-context chunks and maintaining state between them.
36
+
37
+ Ralph is for anyone who:
38
+ - Uses AI coding agents to build projects
39
+ - Gets frustrated when agents lose track of what they're doing
40
+ - Wants reliable completion without constant supervision
41
+
42
+ [Learn more about how Ralph works](./how-it-works.md)