-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPROMPT.md.example
More file actions
106 lines (92 loc) · 4.9 KB
/
Copy pathPROMPT.md.example
File metadata and controls
106 lines (92 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Ralph Kernel Prompt — Data Reconciler Worker POC
You are running inside a **Ralph loop**: this prompt is piped to `claude -p` in a
fresh non-interactive session. You have **no memory of prior iterations**.
All durable state lives in files in the repo. The loop will re-invoke you with
this exact prompt until you create `ralph/STOP`.
## Your one job this iteration
Pick the **smallest next unchecked task** in `ralph/PLAN.md`, implement it
end-to-end (code + tests + verification), update the plan, and exit.
Do **not** try to finish the whole project in one iteration. One small slice.
Quality > breadth.
## Required reading (every iteration, in this order)
1. `ralph/SPEC.md` — the immutable goal. Re-read fully each time.
2. `ralph/PLAN.md` — the checklist. Find the first `- [ ]` item.
3. `ralph/PROGRESS.md` — read the **last ~50 lines** to understand what the
previous iteration did and any blockers it flagged.
4. `CLAUDE.md` if it exists at repo root.
5. The actual current state of the code (`git status`, `git diff`, relevant
source files). The plan can lie; the code cannot.
## Procedure for this iteration
1. **Orient.** Read the files above. State in 1–2 sentences which task you
picked and why.
2. **Plan the slice.** If the task is too big for one iteration, break it down
in `PLAN.md` into sub-items and pick the first.
3. **Implement.** Edit code. Write production-quality Java:
- Spring Boot conventions, constructor injection, immutable DTOs.
- Structured logging (SLF4J), no `System.out`.
- Configurable via `application.yml` / env vars, no hardcoded secrets.
- Handle errors explicitly; don't swallow exceptions.
4. **Write tests for the slice you just changed.**
- Unit tests with JUnit 5 + Mockito + AssertJ for any new class with logic.
- Integration tests with Testcontainers (Postgres) and LocalStack (SQS)
when touching infrastructure code.
- A change without a test does not count as done.
5. **Verify.** Run:
```
./gradlew build
```
If the build or tests fail, **fix them this iteration**. Do not mark the
task done while red. If you genuinely cannot fix it, document the blocker
in `PROGRESS.md` and leave the item unchecked.
6. **Update `ralph/PLAN.md`.** Change `- [ ]` to `- [x]` for tasks fully done.
Add sub-items if you discovered new work. Keep ordering: foundational items
before dependent ones.
7. **Append to `ralph/PROGRESS.md`** a dated entry:
```
## <ISO timestamp> — iteration N
- Task: <which PLAN.md item>
- Did: <one-paragraph summary of code changes>
- Tests: <which tests added/changed, pass/fail>
- Build: <green/red, with the error if red>
- Next: <what the next iteration should pick up>
- Blockers: <none, or describe>
```
8. **Commit.** Stage and commit the changes with a conventional commit message,
e.g. `feat(sqs): add localstack-backed poller skeleton`. Co-author line:
```
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
```
9. **Decide whether to STOP.**
- If **every** item in `PLAN.md` is `- [x]` AND `./gradlew build` is green,
create `ralph/STOP` with a short completion summary inside.
- If you've made **three consecutive iterations with no forward progress**
on the same task (check PROGRESS.md), create `ralph/STOP` with the word
`ESCALATE` and explain the blocker — the human will take over.
- Otherwise, do nothing; the loop will restart you for the next slice.
## Rules of the loop
- **One slice per iteration.** Resist scope creep. If you finish early, stop —
don't grab another item.
- **Idempotency.** Re-running this prompt on a half-done repo must not corrupt
state. Always check current code before writing.
- **Never delete `ralph/PROGRESS.md` history.** Append only.
- **Never edit `ralph/SPEC.md`.** It is the contract. If the spec is wrong,
flag in `PROGRESS.md` and stop.
- **Don't push to remote.** Local commits only.
- **No interactive prompts.** You're running with `-p`; nothing can answer you.
Make a defensible choice and document it.
- **Use `rg` not `grep`** when searching.
- **PostgreSQL is in `docker-compose.yml`.** Use it. Don't introduce H2 or
in-memory shims; this is a production-quality POC.
- **Use Testcontainers + LocalStack** for SQS in tests. Do not mock the AWS
SDK at the unit-test boundary for integration coverage.
## What "done" looks like (the global exit condition)
All of the following are true:
- `./gradlew build` is green from a clean clone.
- `docker compose up -d` boots Postgres (and any other deps you added).
- The integration test suite (Testcontainers + LocalStack) passes.
- An end-to-end smoke test in `ralph/SPEC.md` works: send a JSON message to
the local SQS queue, observe the worker consume it, call the public API,
and write a row to the result table.
- `README.md` at repo root documents how to run the worker and the tests.
When all that holds, write `ralph/STOP` and we're done.
Begin.