@eventmodelers/cli 1.0.44 → 1.0.46

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 (108) hide show
  1. package/README.md +4 -1
  2. package/cli.js +53 -1
  3. package/package.json +2 -2
  4. package/shared/build-kit/lib/checks/README.md +59 -0
  5. package/shared/build-kit/lib/ralph.js +110 -28
  6. package/shared/build-kit/lib/util/find-slice.cjs +59 -0
  7. package/shared/build-kit/ralph-claude.js +6 -2
  8. package/stacks/blank/templates/build-kit/lib/backend-prompt.md +106 -102
  9. package/stacks/blank/templates/build-kit/lib/prompt.md +102 -106
  10. package/stacks/kurrent/templates/.claude/skills/build-automation/SKILL.md +422 -0
  11. package/stacks/kurrent/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +19 -0
  12. package/stacks/kurrent/templates/.claude/skills/build-automation/references/idempotent-dispatch-patterns.md +65 -0
  13. package/stacks/kurrent/templates/.claude/skills/build-state-change/SKILL.md +418 -0
  14. package/stacks/kurrent/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +41 -0
  15. package/stacks/kurrent/templates/.claude/skills/build-state-change/references/integration-test-patterns.md +64 -0
  16. package/stacks/kurrent/templates/.claude/skills/build-state-view/SKILL.md +391 -0
  17. package/stacks/kurrent/templates/build-kit/CLAUDE.md +122 -0
  18. package/stacks/kurrent/templates/build-kit/lib/AGENT.md +73 -0
  19. package/stacks/kurrent/templates/build-kit/lib/backend-prompt.md +169 -0
  20. package/stacks/kurrent/templates/build-kit/lib/prompt.md +128 -0
  21. package/stacks/kurrent/templates/root/README.md +46 -0
  22. package/stacks/kurrent/templates/root/docker-compose.yml +45 -0
  23. package/stacks/kurrent/templates/root/mvnw +259 -0
  24. package/stacks/kurrent/templates/root/mvnw.cmd +149 -0
  25. package/stacks/kurrent/templates/root/pom.xml +152 -0
  26. package/stacks/kurrent/templates/root/src/main/java/com/example/quickstart/QuickstartApplication.java +12 -0
  27. package/stacks/kurrent/templates/root/src/main/java/com/example/quickstart/common/EventStore.java +91 -0
  28. package/stacks/kurrent/templates/root/src/main/java/com/example/quickstart/config/KurrentConfiguration.java +42 -0
  29. package/stacks/kurrent/templates/root/src/main/resources/application.properties +14 -0
  30. package/stacks/kurrent/templates/root/src/main/resources/static/index.html +11 -0
  31. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-core-rules/SKILL.md +4 -2
  32. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +1 -1
  33. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +1 -1
  34. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +2 -0
  35. package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +1 -1
  36. package/stacks/node/templates/build-kit/CLAUDE.md +22 -0
  37. package/stacks/node/templates/build-kit/lib/check-commit-scope.cjs +123 -0
  38. package/stacks/node/templates/build-kit/lib/checks/00-blocked-paths.cjs +28 -0
  39. package/stacks/node/templates/build-kit/lib/checks/10-slice-scope.cjs +29 -0
  40. package/stacks/node/templates/build-kit/lib/checks/20-append-only-migrations.cjs +20 -0
  41. package/stacks/node/templates/build-kit/lib/checks/30-test-file-present.cjs +44 -0
  42. package/stacks/node/templates/build-kit/lib/checks/40-no-invented-fields.cjs +92 -0
  43. package/stacks/node/templates/build-kit/lib/checks/50-spec-coverage.cjs +50 -0
  44. package/stacks/node/templates/build-kit/lib/checks/90-tsc-build.cjs +22 -0
  45. package/stacks/node/templates/root/.githooks/pre-commit +11 -0
  46. package/stacks/node/templates/root/README.md +67 -0
  47. package/stacks/node/templates/root/package.json +2 -1
  48. package/stacks/node/templates/root/setup-env.sh +7 -1
  49. package/stacks/opencqrs/templates/.claude/skills/build-automation/SKILL.md +434 -0
  50. package/stacks/opencqrs/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +19 -0
  51. package/stacks/opencqrs/templates/.claude/skills/build-automation/references/idempotent-dispatch-patterns.md +62 -0
  52. package/stacks/opencqrs/templates/.claude/skills/build-state-change/SKILL.md +413 -0
  53. package/stacks/opencqrs/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +46 -0
  54. package/stacks/opencqrs/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +145 -0
  55. package/stacks/opencqrs/templates/.claude/skills/build-state-change/references/test-fixture-patterns.md +85 -0
  56. package/stacks/opencqrs/templates/.claude/skills/build-state-view/SKILL.md +354 -0
  57. package/stacks/opencqrs/templates/build-kit/CLAUDE.md +101 -0
  58. package/stacks/opencqrs/templates/build-kit/lib/AGENT.md +58 -0
  59. package/stacks/opencqrs/templates/build-kit/lib/backend-prompt.md +169 -0
  60. package/stacks/opencqrs/templates/build-kit/lib/prompt.md +128 -0
  61. package/stacks/opencqrs/templates/root/README.md +42 -0
  62. package/stacks/opencqrs/templates/root/docker-compose.yml +37 -0
  63. package/stacks/opencqrs/templates/root/mvnw +259 -0
  64. package/stacks/opencqrs/templates/root/mvnw.cmd +149 -0
  65. package/stacks/opencqrs/templates/root/pom.xml +139 -0
  66. package/stacks/opencqrs/templates/root/src/main/java/com/example/quickstart/QuickstartApplication.java +12 -0
  67. package/stacks/opencqrs/templates/root/src/main/java/com/example/quickstart/config/CqrsConfiguration.java +74 -0
  68. package/stacks/opencqrs/templates/root/src/main/resources/application.properties +23 -0
  69. package/stacks/opencqrs/templates/root/src/main/resources/schema.sql +19 -0
  70. package/stacks/opencqrs/templates/root/src/main/resources/static/index.html +11 -0
  71. package/stacks/supabase/templates/build-kit/CLAUDE.md +25 -0
  72. package/stacks/supabase/templates/build-kit/lib/check-commit-scope.cjs +126 -0
  73. package/stacks/supabase/templates/build-kit/lib/checks/00-blocked-paths.cjs +28 -0
  74. package/stacks/supabase/templates/build-kit/lib/checks/10-slice-scope.cjs +34 -0
  75. package/stacks/supabase/templates/build-kit/lib/checks/20-append-only-migrations.cjs +21 -0
  76. package/stacks/supabase/templates/build-kit/lib/checks/30-test-file-present.cjs +44 -0
  77. package/stacks/supabase/templates/build-kit/lib/checks/40-no-invented-fields.cjs +92 -0
  78. package/stacks/supabase/templates/build-kit/lib/checks/50-spec-coverage.cjs +50 -0
  79. package/stacks/supabase/templates/build-kit/lib/checks/90-tsc-build.cjs +22 -0
  80. package/stacks/supabase/templates/root/.githooks/pre-commit +11 -0
  81. package/stacks/supabase/templates/root/package.json +2 -1
  82. package/stacks/supabase/templates/root/setup-env.sh +7 -1
  83. package/stacks/umadb/templates/.claude/skills/build-automation/SKILL.md +313 -0
  84. package/stacks/umadb/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +42 -0
  85. package/stacks/umadb/templates/.claude/skills/build-state-change/SKILL.md +376 -0
  86. package/stacks/umadb/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +42 -0
  87. package/stacks/umadb/templates/.claude/skills/build-state-change/references/umadb-query-patterns.md +78 -0
  88. package/stacks/umadb/templates/.claude/skills/build-state-view/SKILL.md +338 -0
  89. package/stacks/umadb/templates/build-kit/CLAUDE.md +94 -0
  90. package/stacks/umadb/templates/build-kit/lib/AGENT.md +47 -0
  91. package/stacks/umadb/templates/build-kit/lib/backend-prompt.md +169 -0
  92. package/stacks/umadb/templates/build-kit/lib/prompt.md +128 -0
  93. package/stacks/umadb/templates/root/.mvn/wrapper/maven-wrapper.properties +19 -0
  94. package/stacks/umadb/templates/root/README.md +48 -0
  95. package/stacks/umadb/templates/root/docker-compose.yml +29 -0
  96. package/stacks/umadb/templates/root/mvnw +259 -0
  97. package/stacks/umadb/templates/root/mvnw.cmd +149 -0
  98. package/stacks/umadb/templates/root/pom.xml +151 -0
  99. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/QuickstartApplication.java +12 -0
  100. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/config/UmaDbConfig.java +39 -0
  101. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/DecisionModelLoader.java +76 -0
  102. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/EventCodec.java +40 -0
  103. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/EventDispatcher.java +100 -0
  104. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/OptimisticConcurrencyException.java +14 -0
  105. package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/SliceEventListener.java +23 -0
  106. package/stacks/umadb/templates/root/src/main/resources/application.properties +17 -0
  107. package/stacks/umadb/templates/root/src/test/java/io/umadb/quickstart/testsupport/InMemoryUmaDbClient.java +135 -0
  108. package/stacks/umadb/templates/root/src/test/resources/application.properties +8 -0
@@ -1,135 +1,139 @@
1
- # Agent Task Instructions
1
+ # Ralph Agent Instructions
2
+
3
+ You are an autonomous coding agent working on a software project. You apply your skills to build software slices. You only work on one slice at a time.
4
+
5
+ The structure defined in the Project-Skills is relevant.
6
+
7
+ ## Context Boundary (READ FIRST — NON-NEGOTIABLE)
8
+
9
+ You work within **exactly ONE context at a time** — the one named in `.build-kit/.slices/current_context.json`.
10
+
11
+ - **ONLY** look for and build slices inside `.build-kit/.slices/<currentContext>/`.
12
+ - **NEVER** read, scan, or build slices from any other context directory, even if it has "Planned" slices, and even if the current context has no work left.
13
+ - A "Planned" slice in a *different* context is **NOT yours to build**. Ignore it completely.
14
+ - If the current context has no "Planned" slice, you are **done for this iteration** — reply `<promise>NO_TASKS</promise>` and stop. Do not go looking elsewhere. The context is only ever changed on the board, never by you.
15
+
16
+ ## Your Task
17
+
18
+ 0. Do not read the entire code base. Focus on the tasks in this description.
19
+ 1. Read `.build-kit/.slices/current_context.json` to find the active context name, then read `.build-kit/.slices/<contextName>/index.json`. Every item in status "planned" is a task.
20
+ 2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
21
+ 3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
22
+ 5. Pick the **highest priority** slice where status is **exactly** "Planned" (case insensitive). This becomes your PRD. Set the status "InProgress" in the index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
23
+ **IMPORTANT: Only work on slices with status "Planned" in the CURRENT context. Never pick up a slice that is "InProgress", "Done", "Blocked", "Created", or any other status — even if it looks incomplete. If no slice has status "Planned" in the current context, reply with:**
24
+ <promise>NO_TASKS</promise> and stop immediately. Do not work on other slices and do not switch to another context.
25
+ **Claim conflict**: the board rejects the status update if the slice is already in the target status — this is expected: another agent claimed it first, racing you for the same slice. This is NOT an error. Do not stop, do not retry the same slice. Re-read `index.json` (or re-fetch via `load-slice`), pick the next-highest-priority slice still "Planned", and try claiming that one instead. Repeat until a claim succeeds or no "Planned" slice remains, in which case reply `<promise>NO_TASKS</promise>`.
26
+ 6. Pick the slice definition from `.build-kit/.slices/<contextName>/<folder>/slice.json` as defined in the prd. Never work on more than one slice per iteration.
27
+ 7. A slice can define additional prompts as codegen/backendPrompt. Any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
28
+ 7. Determine the slice type and invoke the matching skill as defined in the **Building a Slice** section of `.build-kit/CLAUDE.md`. Do NOT implement manually.
29
+ 8. Write a short progress one liner after each step to progress.txt
30
+ 9. Analyze and Implement that single slice, making use of the skills in the skills directory plus your previously collected knowledge. Make a TODO list for what needs to be done, and adjust the implementation according to the JSON definition. Carefully inspect events, fields and compare against the implemented slice. JSON is the desired state. ATTENTION: a "planned" task can also be just added specifications. So always look at the slice itself, but also the specifications. If specifications were added in json which are not on code, you need to add them in code.
31
+ 10. The slice in the json is always true, the code follows what is defined in the json
32
+ 11. Slice is only 'Done' if business logic is implemented as defined in the JSON, APIs are implemented, all scenarios in JSON are implemented in code and it fulfills the slice.json. There must be no specification in json that has no equivalent in code.
33
+ 12. Make sure to write the ui-prompt.md as defined if defined in the skill
34
+ 13. Run quality checks — TODO: your stack's build command, TODO: your stack's test command (slice-scoped only; do not run all tests).
35
+ 14. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge (update first)
36
+ 15. Update the PRD to set `status: Done` for the completed story in index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
37
+ 16. Append your progress to `progress.txt` after each step in the iteration.
38
+ 17. Append your new learnings to `.build-kit/AGENTS.md` in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
39
+ 18. Finish the iteration.
2
40
 
3
- You are an autonomous agent reacting to slice status change events on an Eventmodelers board.
4
-
5
- ## Your Loop
41
+ ## Escalating Ambiguity
6
42
 
7
- 1. Read `AGENT.md` to load accumulated learnings before doing anything else.
8
- 2. Read `.build-kit/tasks.json`.
9
- 3. If `tasks.json` is empty or missing, reply with:
10
- <promise>IDLE</promise>
11
- and stop.
12
- 4. Pick the **oldest task** (earliest `createdAt`).
13
- 5. Execute the task see the Execution section below.
14
- 6. After execution, remove that task from the array and write `.build-kit/tasks.json` back.
15
- 7. Append a progress entry to `progress.txt` (create if missing).
16
- 8. Update `AGENT.md` with any new reusable learnings discovered this iteration.
17
- 9. Reply normally so the next iteration can pick up the next task.
43
+ **If the slice's requirements are genuinely ambiguous, contradictory, or missing a decision you need
44
+ in order to proceed — do not guess, and do not build anyway.** Invoke `/request-feedback` with the
45
+ specific question; it posts the question as a comment on the slice and marks it `Blocked` on the
46
+ board (overriding the `InProgress` set in step 5), then stop this iteration without finishing the
47
+ build — reply `<promise>DONE</promise>` as if the iteration's work was to raise the question, not to
48
+ implement the slice. This is an escalation path, not a routine step — read the slice.json and the
49
+ matching build skill's own instructions fully first; most slices are fully specified and need none of
50
+ this.
18
51
 
19
- ## Execution
52
+ ## Progress Report Format
20
53
 
21
- Each task has a single `payload` of type `SliceChangedPayload`:
54
+ APPEND to progress.txt (never replace, always append):
22
55
 
23
56
  ```
24
- {
25
- event: "slice:changed"
26
- organizationId: string | null
27
- boardId: string
28
- sliceId: string ← SLICE_BORDER node UUID
29
- sliceTitle: string | null
30
- sliceStatus: string | null ← e.g. "InProgress", "Done", "Blocked"
31
- timestamp: number
32
- }
57
+ ## [Date/Time] - [Slice]
58
+
59
+ - What was implemented
60
+ - Files changed
61
+ - **Learnings for future iterations:**
62
+ - Patterns discovered (e.g., "this codebase uses X for Y")
63
+ - Gotchas encountered (e.g., "don't forget to update Z when changing W")
64
+ - Useful context (e.g., "the evaluation panel is in component X")
65
+ ---
33
66
  ```
34
67
 
35
- ### Step 1 Load credentials
36
-
37
- Run `/connect` to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL` from `.eventmodelers/config.json`.
38
-
39
- ### Step 2 — Load the slice
40
-
41
- Run `/load-slice sliceId=<payload.sliceId>` to fetch full slice details (title, status, raw node record).
42
-
43
- ### Step 3 — Act on the change
44
-
45
- Inspect the `sliceStatus` in the payload:
46
-
47
- #### `Planned` — build the slice
48
-
49
- This is the build trigger. Setting `InProgress` and building are one atomic step:
50
-
51
- 1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
52
-
53
- **Claim conflict**: if this call reports the slice is already in `InProgress` (or any status other than `Planned`), another agent already claimed it first — this is expected, not an error. Log it in `progress.txt`, drop this task without building, and continue the loop (the next task will naturally cover the next slice). Do not retry.
54
-
55
- 2. Read the slice definition from `.build-kit/.slices/<contextSlug>/<sliceFolder>/slice.json` (written by `/load-slice`).
68
+ The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
56
69
 
57
- 3. Determine the **slice type** from the slice.json:
58
- - **Translation** — `sliceType === "TRANSLATION"` → read `description` and `notes` from slice.json for hints; default to `/build-automation` if nothing else is specified
59
- - **Automation** — `processors` array is non-empty → invoke `/build-automation`
60
- - **State-view** — `projections` or `queries` array is non-empty → invoke `/build-state-view`
61
- - **State-change** — default (has `commands` / `events`) → invoke `/build-state-change`
70
+ ## Consolidate Patterns
62
71
 
63
- 4. Invoke the matching skill and follow its instructions **completely**. Do NOT implement the slice manually.
72
+ If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of progress.txt (create it if it doesn't exist).
64
73
 
65
- 5. **Verify against slice.json**: cross-check the implementation — every command field, event field, and specification in slice.json must appear in the code. No invented fields — if it is not in slice.json, it must not be in the code.
66
-
67
- 6. Run quality checks (TODO: your stack's build + test commands — slice-scoped tests only, not the full suite).
68
-
69
- 7. If checks pass, commit all changes with message: `feat: [Slice Name]`.
74
+ ```
75
+ ## Codebase Patterns
76
+ - TODO: an example of a your stack-specific reusable pattern once you have one
77
+ ```
70
78
 
71
- 8. Call `/update-slice-status` to set the slice to `Done` on the board.
79
+ Only add patterns that are **general and reusable**, not story-specific details.
72
80
 
73
- #### `InProgress`
74
- Another agent is already building this slice. Log it and skip — do not build.
81
+ ## Update AGENTS.md Files
75
82
 
76
- #### `Done`
77
- Summarize what was completed and update `progress.txt`.
83
+ Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files — API patterns/conventions, gotchas, dependencies between files, testing approaches, configuration/environment requirements.
78
84
 
79
- #### `Blocked`
80
- Log the blocker in `progress.txt`.
85
+ **Do NOT add:**
81
86
 
82
- #### `Review`
83
- Fetch slice details and prepare a review summary in `progress.txt`.
87
+ - Slice specific implementation details
88
+ - Story-specific implementation details
89
+ - Temporary debugging notes
90
+ - Information already in progress.txt
91
+ - Task-specific learnings
84
92
 
85
- #### Any other status (`Created`, etc.)
86
- Load the slice and log the state transition in `progress.txt`. No build action.
93
+ Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
87
94
 
88
- Use the skills available in `.claude/skills/` to interact with the board.
95
+ ## Quality Requirements
89
96
 
90
- ## Updating tasks.json
97
+ - ALL commits must pass this project's quality checks (typecheck/compile, lint, test)
98
+ - TODO: your stack's build command
99
+ - TODO: your stack's test command
100
+ - Do NOT commit broken code
101
+ - Keep changes focused and minimal
102
+ - Follow existing code patterns
91
103
 
92
- After completing a task, remove it from the array and write the updated array back to `.build-kit/tasks.json`. If the array is now empty, write `[]`.
104
+ ## Skills
93
105
 
94
- ## Escalating Ambiguity
106
+ Use the provided skills in the skills folder as guidance.
107
+ Update skill definitions if you find an improvement you can make.
95
108
 
96
- **If the slice's requirements are genuinely ambiguous, contradictory, or missing a decision you need
97
- in order to proceed — do not guess, and do not build anyway.** Invoke `/request-feedback` with the
98
- specific question; it posts the question as a comment on the slice and marks it `Blocked` on the
99
- board (overriding the `InProgress` set earlier), then stop this iteration without finishing the
100
- build — reply `<promise>DONE</promise>` as if the iteration's work was to raise the question, not to
101
- implement the slice. This is an escalation path, not a routine step — read the slice.json and the
102
- matching build skill's own instructions fully first; most slices are fully specified and need none of
103
- this.
109
+ ## Specifications
104
110
 
105
- ## Progress Report Format
111
+ For every specification added to the Slice, you need to implement one executable Specification in Code.
106
112
 
107
- APPEND to `progress.txt` (never replace):
108
- ```
109
- ## [ISO timestamp] — Task [task.id]
113
+ A Slice is not complete if specifications are missing or can't be executed.
110
114
 
111
- Slice: [sliceTitle] ([sliceId])
112
- Status change: [sliceStatus]
115
+ ## Stop Condition
113
116
 
114
- Action taken:
115
- - [what was done in response to the slice change]
117
+ **After completing ONE slice, always stop — regardless of whether more slices are Planned.** The ralph loop will invoke you again for the next slice. Never chain multiple slices in one iteration.
116
118
 
117
- Learnings:
118
- - [any patterns, gotchas, or reusable knowledge discovered]
119
- ---
120
- ```
119
+ If the slice was completed and committed successfully, reply with:
120
+ <promise>DONE</promise>
121
121
 
122
- ## Stop Condition
122
+ If no slice has status "Planned" in the current context, reply with:
123
+ <promise>NO_TASKS</promise>
124
+ (Do NOT switch to another context to find work — stop here.)
123
125
 
124
- If `.build-kit/tasks.json` is empty (`[]`) or does not exist, reply with:
125
- <promise>IDLE</promise>
126
+ If ALL slices in the current context are Done, reply with:
127
+ <promise>COMPLETE</promise>
126
128
 
127
- ## Updating AGENT.md
129
+ ## Important
128
130
 
129
- After completing a task, add any **reusable** learnings to `AGENT.md` patterns, gotchas, API quirks, or skill behaviour that future iterations should know. Only add things that are general and applicable beyond this single task. Do not duplicate what is already there.
131
+ - If `.build-kit/.eventmodelers/config.json` is absent, skip all platform communication (MCP calls, `update-slice-status`, board sync) and continue working locally.
132
+ - Work on ONE slice per iteration
133
+ - Commit frequently
134
+ - update progress.txt frequently
135
+ - Read the Codebase Patterns section in progress.txt before starting
130
136
 
131
- ## Important
137
+ ## When an iteration completes
132
138
 
133
- - Process **one task per iteration**.
134
- - Read `AGENT.md` first — it contains patterns from previous iterations.
135
- - Always start with `/connect` if credentials are not yet loaded.
139
+ Use all the key learnings from the progress.txt and update the `.build-kit/AGENTS.md` file with those learnings.
@@ -1,139 +1,135 @@
1
- # Ralph Agent Instructions
2
-
3
- You are an autonomous coding agent working on a software project. You apply your skills to build software slices. You only work on one slice at a time.
4
-
5
- The structure defined in the Project-Skills is relevant.
6
-
7
- ## Context Boundary (READ FIRST — NON-NEGOTIABLE)
8
-
9
- You work within **exactly ONE context at a time** — the one named in `.build-kit/.slices/current_context.json`.
10
-
11
- - **ONLY** look for and build slices inside `.build-kit/.slices/<currentContext>/`.
12
- - **NEVER** read, scan, or build slices from any other context directory, even if it has "Planned" slices, and even if the current context has no work left.
13
- - A "Planned" slice in a *different* context is **NOT yours to build**. Ignore it completely.
14
- - If the current context has no "Planned" slice, you are **done for this iteration** — reply `<promise>NO_TASKS</promise>` and stop. Do not go looking elsewhere. The context is only ever changed on the board, never by you.
15
-
16
- ## Your Task
17
-
18
- 0. Do not read the entire code base. Focus on the tasks in this description.
19
- 1. Read `.build-kit/.slices/current_context.json` to find the active context name, then read `.build-kit/.slices/<contextName>/index.json`. Every item in status "planned" is a task.
20
- 2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
21
- 3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
22
- 5. Pick the **highest priority** slice where status is **exactly** "Planned" (case insensitive). This becomes your PRD. Set the status "InProgress" in the index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
23
- **IMPORTANT: Only work on slices with status "Planned" in the CURRENT context. Never pick up a slice that is "InProgress", "Done", "Blocked", "Created", or any other status — even if it looks incomplete. If no slice has status "Planned" in the current context, reply with:**
24
- <promise>NO_TASKS</promise> and stop immediately. Do not work on other slices and do not switch to another context.
25
- **Claim conflict**: the board rejects the status update if the slice is already in the target status — this is expected: another agent claimed it first, racing you for the same slice. This is NOT an error. Do not stop, do not retry the same slice. Re-read `index.json` (or re-fetch via `load-slice`), pick the next-highest-priority slice still "Planned", and try claiming that one instead. Repeat until a claim succeeds or no "Planned" slice remains, in which case reply `<promise>NO_TASKS</promise>`.
26
- 6. Pick the slice definition from `.build-kit/.slices/<contextName>/<folder>/slice.json` as defined in the prd. Never work on more than one slice per iteration.
27
- 7. A slice can define additional prompts as codegen/backendPrompt. Any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
28
- 7. Determine the slice type and invoke the matching skill as defined in the **Building a Slice** section of `.build-kit/CLAUDE.md`. Do NOT implement manually.
29
- 8. Write a short progress one liner after each step to progress.txt
30
- 9. Analyze and Implement that single slice, making use of the skills in the skills directory plus your previously collected knowledge. Make a TODO list for what needs to be done, and adjust the implementation according to the JSON definition. Carefully inspect events, fields and compare against the implemented slice. JSON is the desired state. ATTENTION: a "planned" task can also be just added specifications. So always look at the slice itself, but also the specifications. If specifications were added in json which are not on code, you need to add them in code.
31
- 10. The slice in the json is always true, the code follows what is defined in the json
32
- 11. Slice is only 'Done' if business logic is implemented as defined in the JSON, APIs are implemented, all scenarios in JSON are implemented in code and it fulfills the slice.json. There must be no specification in json that has no equivalent in code.
33
- 12. Make sure to write the ui-prompt.md as defined if defined in the skill
34
- 13. Run quality checks — TODO: your stack's build command, TODO: your stack's test command (slice-scoped only; do not run all tests).
35
- 14. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge (update first)
36
- 15. Update the PRD to set `status: Done` for the completed story in index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
37
- 16. Append your progress to `progress.txt` after each step in the iteration.
38
- 17. Append your new learnings to `.build-kit/AGENTS.md` in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
39
- 18. Finish the iteration.
1
+ # Agent Task Instructions
40
2
 
41
- ## Escalating Ambiguity
3
+ You are an autonomous agent reacting to slice status change events on an Eventmodelers board.
42
4
 
43
- **If the slice's requirements are genuinely ambiguous, contradictory, or missing a decision you need
44
- in order to proceed — do not guess, and do not build anyway.** Invoke `/request-feedback` with the
45
- specific question; it posts the question as a comment on the slice and marks it `Blocked` on the
46
- board (overriding the `InProgress` set in step 5), then stop this iteration without finishing the
47
- build — reply `<promise>DONE</promise>` as if the iteration's work was to raise the question, not to
48
- implement the slice. This is an escalation path, not a routine step — read the slice.json and the
49
- matching build skill's own instructions fully first; most slices are fully specified and need none of
50
- this.
5
+ ## Your Loop
51
6
 
52
- ## Progress Report Format
7
+ 1. Read `AGENT.md` to load accumulated learnings before doing anything else.
8
+ 2. Read `.build-kit/tasks.json`.
9
+ 3. If `tasks.json` is empty or missing, reply with:
10
+ <promise>IDLE</promise>
11
+ and stop.
12
+ 4. Pick the **oldest task** (earliest `createdAt`).
13
+ 5. Execute the task — see the Execution section below.
14
+ 6. After execution, remove that task from the array and write `.build-kit/tasks.json` back.
15
+ 7. Append a progress entry to `progress.txt` (create if missing).
16
+ 8. Update `AGENT.md` with any new reusable learnings discovered this iteration.
17
+ 9. Reply normally so the next iteration can pick up the next task.
53
18
 
54
- APPEND to progress.txt (never replace, always append):
19
+ ## Execution
20
+
21
+ Each task has a single `payload` of type `SliceChangedPayload`:
55
22
 
56
23
  ```
57
- ## [Date/Time] - [Slice]
58
-
59
- - What was implemented
60
- - Files changed
61
- - **Learnings for future iterations:**
62
- - Patterns discovered (e.g., "this codebase uses X for Y")
63
- - Gotchas encountered (e.g., "don't forget to update Z when changing W")
64
- - Useful context (e.g., "the evaluation panel is in component X")
65
- ---
24
+ {
25
+ event: "slice:changed"
26
+ organizationId: string | null
27
+ boardId: string
28
+ sliceId: string ← SLICE_BORDER node UUID
29
+ sliceTitle: string | null
30
+ sliceStatus: string | null ← e.g. "InProgress", "Done", "Blocked"
31
+ timestamp: number
32
+ }
66
33
  ```
67
34
 
68
- The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
35
+ ### Step 1 Load credentials
69
36
 
70
- ## Consolidate Patterns
37
+ Run `/connect` to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL` from `.eventmodelers/config.json`.
71
38
 
72
- If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of progress.txt (create it if it doesn't exist).
39
+ ### Step 2 Load the slice
73
40
 
74
- ```
75
- ## Codebase Patterns
76
- - TODO: an example of a your stack-specific reusable pattern once you have one
77
- ```
41
+ Run `/load-slice sliceId=<payload.sliceId>` to fetch full slice details (title, status, raw node record).
78
42
 
79
- Only add patterns that are **general and reusable**, not story-specific details.
43
+ ### Step 3 Act on the change
80
44
 
81
- ## Update AGENTS.md Files
45
+ Inspect the `sliceStatus` in the payload:
82
46
 
83
- Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files API patterns/conventions, gotchas, dependencies between files, testing approaches, configuration/environment requirements.
47
+ #### `Planned`build the slice
84
48
 
85
- **Do NOT add:**
49
+ This is the build trigger. Setting `InProgress` and building are one atomic step:
86
50
 
87
- - Slice specific implementation details
88
- - Story-specific implementation details
89
- - Temporary debugging notes
90
- - Information already in progress.txt
91
- - Task-specific learnings
51
+ 1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
92
52
 
93
- Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
53
+ **Claim conflict**: if this call reports the slice is already in `InProgress` (or any status other than `Planned`), another agent already claimed it first — this is expected, not an error. Log it in `progress.txt`, drop this task without building, and continue the loop (the next task will naturally cover the next slice). Do not retry.
94
54
 
95
- ## Quality Requirements
55
+ 2. Read the slice definition from `.build-kit/.slices/<contextSlug>/<sliceFolder>/slice.json` (written by `/load-slice`).
96
56
 
97
- - ALL commits must pass this project's quality checks (typecheck/compile, lint, test)
98
- - TODO: your stack's build command
99
- - TODO: your stack's test command
100
- - Do NOT commit broken code
101
- - Keep changes focused and minimal
102
- - Follow existing code patterns
57
+ 3. Determine the **slice type** from the slice.json:
58
+ - **Translation** `sliceType === "TRANSLATION"` → read `description` and `notes` from slice.json for hints; default to `/build-automation` if nothing else is specified
59
+ - **Automation** `processors` array is non-empty → invoke `/build-automation`
60
+ - **State-view** `projections` or `queries` array is non-empty → invoke `/build-state-view`
61
+ - **State-change** default (has `commands` / `events`) → invoke `/build-state-change`
103
62
 
104
- ## Skills
63
+ 4. Invoke the matching skill and follow its instructions **completely**. Do NOT implement the slice manually.
105
64
 
106
- Use the provided skills in the skills folder as guidance.
107
- Update skill definitions if you find an improvement you can make.
65
+ 5. **Verify against slice.json**: cross-check the implementation every command field, event field, and specification in slice.json must appear in the code. No invented fields — if it is not in slice.json, it must not be in the code.
108
66
 
109
- ## Specifications
67
+ 6. Run quality checks (TODO: your stack's build + test commands — slice-scoped tests only, not the full suite).
110
68
 
111
- For every specification added to the Slice, you need to implement one executable Specification in Code.
69
+ 7. If checks pass, commit all changes with message: `feat: [Slice Name]`.
112
70
 
113
- A Slice is not complete if specifications are missing or can't be executed.
71
+ 8. Call `/update-slice-status` to set the slice to `Done` on the board.
114
72
 
115
- ## Stop Condition
73
+ #### `InProgress`
74
+ Another agent is already building this slice. Log it and skip — do not build.
116
75
 
117
- **After completing ONE slice, always stop — regardless of whether more slices are Planned.** The ralph loop will invoke you again for the next slice. Never chain multiple slices in one iteration.
76
+ #### `Done`
77
+ Summarize what was completed and update `progress.txt`.
118
78
 
119
- If the slice was completed and committed successfully, reply with:
120
- <promise>DONE</promise>
79
+ #### `Blocked`
80
+ Log the blocker in `progress.txt`.
121
81
 
122
- If no slice has status "Planned" in the current context, reply with:
123
- <promise>NO_TASKS</promise>
124
- (Do NOT switch to another context to find work — stop here.)
82
+ #### `Review`
83
+ Fetch slice details and prepare a review summary in `progress.txt`.
125
84
 
126
- If ALL slices in the current context are Done, reply with:
127
- <promise>COMPLETE</promise>
85
+ #### Any other status (`Created`, etc.)
86
+ Load the slice and log the state transition in `progress.txt`. No build action.
128
87
 
129
- ## Important
88
+ Use the skills available in `.claude/skills/` to interact with the board.
89
+
90
+ ## Updating tasks.json
130
91
 
131
- - If `.build-kit/.eventmodelers/config.json` is absent, skip all platform communication (MCP calls, `update-slice-status`, board sync) and continue working locally.
132
- - Work on ONE slice per iteration
133
- - Commit frequently
134
- - update progress.txt frequently
135
- - Read the Codebase Patterns section in progress.txt before starting
92
+ After completing a task, remove it from the array and write the updated array back to `.build-kit/tasks.json`. If the array is now empty, write `[]`.
136
93
 
137
- ## When an iteration completes
94
+ ## Escalating Ambiguity
95
+
96
+ **If the slice's requirements are genuinely ambiguous, contradictory, or missing a decision you need
97
+ in order to proceed — do not guess, and do not build anyway.** Invoke `/request-feedback` with the
98
+ specific question; it posts the question as a comment on the slice and marks it `Blocked` on the
99
+ board (overriding the `InProgress` set earlier), then stop this iteration without finishing the
100
+ build — reply `<promise>DONE</promise>` as if the iteration's work was to raise the question, not to
101
+ implement the slice. This is an escalation path, not a routine step — read the slice.json and the
102
+ matching build skill's own instructions fully first; most slices are fully specified and need none of
103
+ this.
104
+
105
+ ## Progress Report Format
106
+
107
+ APPEND to `progress.txt` (never replace):
108
+ ```
109
+ ## [ISO timestamp] — Task [task.id]
110
+
111
+ Slice: [sliceTitle] ([sliceId])
112
+ Status change: [sliceStatus]
113
+
114
+ Action taken:
115
+ - [what was done in response to the slice change]
116
+
117
+ Learnings:
118
+ - [any patterns, gotchas, or reusable knowledge discovered]
119
+ ---
120
+ ```
121
+
122
+ ## Stop Condition
123
+
124
+ If `.build-kit/tasks.json` is empty (`[]`) or does not exist, reply with:
125
+ <promise>IDLE</promise>
126
+
127
+ ## Updating AGENT.md
128
+
129
+ After completing a task, add any **reusable** learnings to `AGENT.md` — patterns, gotchas, API quirks, or skill behaviour that future iterations should know. Only add things that are general and applicable beyond this single task. Do not duplicate what is already there.
130
+
131
+ ## Important
138
132
 
139
- Use all the key learnings from the progress.txt and update the `.build-kit/AGENTS.md` file with those learnings.
133
+ - Process **one task per iteration**.
134
+ - Read `AGENT.md` first — it contains patterns from previous iterations.
135
+ - Always start with `/connect` if credentials are not yet loaded.