codex-ralph 0.2.0 → 0.3.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/README.md CHANGED
@@ -5,7 +5,7 @@ Minimal Ralph Wiggum Loop runner that feeds a sprint requirement into Codex, one
5
5
  ## Quick start
6
6
 
7
7
  ```bash
8
- npx ralph-loop --sprint=path/to/Sprint_0001.md --max-iterations=1
8
+ npx codex-ralph --sprint=path/to/Sprint_0001.md --max-iterations=1
9
9
  ```
10
10
 
11
11
  ## Sprint format (Markdown)
@@ -21,5 +21,10 @@ Description: Free-form task details.
21
21
 
22
22
  - Reads the sprint file, finds the first unchecked item, and passes it to Codex.
23
23
  - Derives a parallel notes file alongside the sprint (for example `Sprint_0001.md` -> `SprintNotes_0001.md`) and includes its path in the prompt.
24
+ - The agent prompt references sprint/notes files (not PRD/progress files).
25
+ - Uses the Sprint notes file for progress logging and reusable Codebase Patterns.
26
+ - The loop may provide a working branch; the agent should switch if specified.
27
+ - Runs quality checks only when required by `AGENTS.md` or repo docs.
24
28
  - Marks items complete only when all steps are satisfied.
25
- - Uses conventional commits for each completed requirement.
29
+ - Uses conventional commits for each completed requirement (no story ID requirement).
30
+ - If no local `AGENTS.md` exists up the tree, use `./.codex/AGENTS.md`. In monorepos, prefer package-level AGENTS.md for package-specific knowledge.
package/agent/prompt.md CHANGED
@@ -1,18 +1,95 @@
1
- # Ralph Loop (Codex) Sprint Executor
1
+ # Ralph Agent Instructions
2
2
 
3
- You are running inside a loop. Each iteration must do **exactly one** sprint requirement from the sprint file provided below, in order.
3
+ You are an autonomous coding agent working on a software project.
4
4
 
5
- Process:
6
- 1. Open the sprint file path provided below.
7
- 2. Find the first item that is unchecked.
8
- 3. Implement that requirement fully.
9
- 4. Update the sprint item to checked only when all its steps are satisfied.
10
- 5. Commit your changes with a **conventional commit** message.
5
+ ## Your Task
11
6
 
12
- If you cannot complete the requirement, leave it unchecked and record the blocker in the Sprint notes file.
7
+ 1. Read the sprint file provided by the loop (for example `Sprint_0001.md`)
8
+ 2. Read the Sprint notes file provided by the loop (for example `SprintNotes_0001.md`) and check the Codebase Patterns section first
9
+ 3. Ensure you're on the working branch specified by the loop (if provided). If not, check it out or create from main.
10
+ 4. Implement the single requirement provided by the loop
11
+ 5. Do not select additional work beyond the provided requirement
12
+ 6. Run quality checks (e.g., typecheck, lint, test - use whatever your project requires)
13
+ 7. Update AGENTS.md files if you discover reusable patterns (see below)
14
+ 8. If checks pass, commit ALL changes with a **conventional commit** message
15
+ 9. Update the sprint file to mark the requirement complete (checkbox)
16
+ 10. Append your progress to the Sprint notes file
13
17
 
14
- After each iteration, update the Sprint notes file with what you did, including details or nuances that will help the next iteration.
18
+ ## Progress Report Format
15
19
 
16
- When **all** items are checked, output:
20
+ APPEND to the Sprint notes file (never replace, always append):
21
+ ```
22
+ ## [Date/Time] - [Requirement short title]
23
+ - What was implemented
24
+ - Files changed
25
+ - **Learnings for future iterations:**
26
+ - Patterns discovered (e.g., "this codebase uses X for Y")
27
+ - Gotchas encountered (e.g., "don't forget to update Z when changing W")
28
+ - Useful context (e.g., "the evaluation panel is in component X")
29
+ ---
30
+ ```
17
31
 
18
- <promise>DONE</promise>
32
+ The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
33
+
34
+ ## Consolidate Patterns
35
+
36
+ If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of the Sprint notes file (create it if it doesn't exist). This section should consolidate the most important learnings:
37
+
38
+ ```
39
+ ## Codebase Patterns
40
+ - Example: Use `sql<number>` template for aggregations
41
+ - Example: Always use `IF NOT EXISTS` for migrations
42
+ - Example: Export types from actions.ts for UI components
43
+ ```
44
+
45
+ Only add patterns that are **general and reusable**, not story-specific details.
46
+
47
+ ## Update AGENTS.md Files
48
+
49
+ Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files:
50
+
51
+ 1. **Identify directories with edited files** - Look at which directories you modified
52
+ 2. **Check for existing AGENTS.md** - Look for AGENTS.md in those directories or parent directories. If none is found all the way up, use `./.codex/AGENTS.md`.
53
+ 3. **Monorepos** - If working under `./packages/<name>` (or similar), prefer placing AGENTS.md in that package if the knowledge is package-specific.
54
+ 4. **Add valuable learnings** - If you discovered something future developers/agents should know:
55
+ - API patterns or conventions specific to that module
56
+ - Gotchas or non-obvious requirements
57
+ - Dependencies between files
58
+ - Testing approaches for that area
59
+ - Configuration or environment requirements
60
+
61
+ **Examples of good AGENTS.md additions:**
62
+ - "When modifying X, also update Y to keep them in sync"
63
+ - "This module uses pattern Z for all API calls"
64
+ - "Tests require the dev server running on PORT 3000"
65
+ - "Field names must match the template exactly"
66
+
67
+ **Do NOT add:**
68
+ - Story-specific implementation details
69
+ - Temporary debugging notes
70
+ - Information already in progress.txt
71
+
72
+ Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work in that directory.
73
+
74
+ ## Quality Requirements
75
+
76
+ - Follow quality checks as specified in `AGENTS.md` or repo docs
77
+ - Do NOT commit broken code
78
+ - Keep changes focused and minimal
79
+ - Follow existing code patterns
80
+
81
+ ## Stop Condition
82
+
83
+ After completing a requirement, check if ALL sprint items are checked.
84
+
85
+ If ALL requirements are complete, reply with:
86
+ <promise>COMPLETE</promise>
87
+
88
+ If there are still unchecked requirements, end your response normally (another iteration will pick up the next one).
89
+
90
+ ## Important
91
+
92
+ - Work on ONE requirement per iteration
93
+ - Commit frequently
94
+ - Keep CI green
95
+ - Read the Codebase Patterns section in the Sprint notes file before starting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-ralph",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Ralph Loop sprint runner for Codex.",
5
5
  "bin": {
6
6
  "ralph-loop": "agent/ralph-loop.sh"