@eventmodelers/cli 1.0.153 → 1.0.154

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 (57) hide show
  1. package/README.md +35 -1
  2. package/cli.js +51 -8
  3. package/package.json +1 -1
  4. package/shared/build-kit/lib/adapters/pocketbase-realtime-adapter.js +46 -20
  5. package/shared/build-kit/lib/ralph.js +31 -8
  6. package/shared/skills/connect/SKILL.md +1 -1
  7. package/shared/skills/learn-eventmodelers-api/SKILL.md +10 -4
  8. package/shared/skills/ui-contract/SKILL.md +151 -0
  9. package/shared/skills/update-slice-status/SKILL.md +3 -1
  10. package/stacks/axon/templates/.claude/skills/build-state-change/SKILL.md +6 -0
  11. package/stacks/axon/templates/.claude/skills/build-state-view/SKILL.md +6 -0
  12. package/stacks/axon/templates/build-kit/CLAUDE.md +1 -1
  13. package/stacks/axon/templates/build-kit/lib/backend-prompt.md +2 -2
  14. package/stacks/blank/templates/.claude/skills/build-state-change/SKILL.md +12 -0
  15. package/stacks/blank/templates/.claude/skills/build-state-view/SKILL.md +12 -0
  16. package/stacks/blank/templates/build-kit/CLAUDE.md +8 -1
  17. package/stacks/blank/templates/build-kit/lib/backend-prompt.md +2 -2
  18. package/stacks/classic/templates/.claude/skills/build-state-change/SKILL.md +6 -0
  19. package/stacks/classic/templates/.claude/skills/build-state-view/SKILL.md +6 -0
  20. package/stacks/classic/templates/build-kit/lib/backend-prompt.md +2 -2
  21. package/stacks/kurrent/templates/.claude/skills/build-state-change/SKILL.md +6 -0
  22. package/stacks/kurrent/templates/.claude/skills/build-state-view/SKILL.md +6 -0
  23. package/stacks/kurrent/templates/build-kit/CLAUDE.md +1 -1
  24. package/stacks/kurrent/templates/build-kit/lib/backend-prompt.md +2 -2
  25. package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +1 -1
  26. package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +1 -1
  27. package/stacks/modeling-kit/templates/kit/CLAUDE.md +4 -4
  28. package/stacks/node/templates/.claude/skills/build-state-change/SKILL.md +8 -0
  29. package/stacks/node/templates/.claude/skills/build-state-change/references/ui-contract-from-openapi.md +17 -0
  30. package/stacks/node/templates/.claude/skills/build-state-view/SKILL.md +8 -0
  31. package/stacks/node/templates/build-kit/CLAUDE.md +1 -1
  32. package/stacks/node/templates/build-kit/lib/backend-prompt.md +2 -2
  33. package/stacks/opencqrs/templates/.claude/skills/build-state-change/SKILL.md +6 -0
  34. package/stacks/opencqrs/templates/.claude/skills/build-state-view/SKILL.md +6 -0
  35. package/stacks/opencqrs/templates/build-kit/CLAUDE.md +1 -1
  36. package/stacks/opencqrs/templates/build-kit/lib/backend-prompt.md +2 -2
  37. package/stacks/react/templates/.claude/skills/build-state-change/SKILL.md +5 -0
  38. package/stacks/react/templates/.claude/skills/build-state-view/SKILL.md +5 -0
  39. package/stacks/react/templates/build-kit/lib/AGENT.md +1 -1
  40. package/stacks/react/templates/build-kit/lib/backend-prompt.md +11 -11
  41. package/stacks/react/templates/build-kit/lib/kit.json +3 -0
  42. package/stacks/react/templates/build-kit/lib/prompt.md +2 -2
  43. package/stacks/supabase/templates/.claude/skills/build-state-change/SKILL.md +8 -0
  44. package/stacks/supabase/templates/.claude/skills/build-state-change/references/ui-contract-from-openapi.md +17 -0
  45. package/stacks/supabase/templates/.claude/skills/build-state-view/SKILL.md +8 -0
  46. package/stacks/supabase/templates/build-kit/CLAUDE.md +1 -1
  47. package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +2 -2
  48. package/stacks/supabase-react/templates/.claude/skills/build-state-change/SKILL.md +10 -1
  49. package/stacks/supabase-react/templates/.claude/skills/build-state-view/SKILL.md +4 -0
  50. package/stacks/supabase-react/templates/build-kit/lib/AGENT.md +1 -1
  51. package/stacks/supabase-react/templates/build-kit/lib/backend-prompt.md +11 -11
  52. package/stacks/supabase-react/templates/build-kit/lib/kit.json +3 -0
  53. package/stacks/supabase-react/templates/build-kit/lib/prompt.md +2 -2
  54. package/stacks/umadb/templates/.claude/skills/build-state-change/SKILL.md +6 -0
  55. package/stacks/umadb/templates/.claude/skills/build-state-view/SKILL.md +6 -0
  56. package/stacks/umadb/templates/build-kit/CLAUDE.md +1 -1
  57. package/stacks/umadb/templates/build-kit/lib/backend-prompt.md +2 -2
@@ -44,4 +44,4 @@ These files are always up to date — read them directly before invoking any ski
44
44
  - The `boardId` and `organizationId` from each payload provide full context — pass them to skills.
45
45
  - Node events use `node:created`, `node:changed`, `node:deleted` — always POST to `/api/org/:orgId/boards/:boardId/nodes/events`.
46
46
  - Slice metadata (title, status) lives on the SLICE_BORDER node under `meta.sliceStatus` and `meta.title`.
47
- - `/update-slice-status` rejects moving a slice into a status it's already in — this is a concurrency guard, not a bug. It means another agent already claimed the slice. Treat it as `ALREADY_IN_STATUS`, skip that slice, and move on to the next `Planned` one instead of erroring out.
47
+ - `/update-slice-status` rejects moving a slice into a status it's already in — this is a concurrency guard, not a bug. It means another agent already claimed the slice. Treat it as `ALREADY_IN_STATUS`, skip that slice, and move on to the next `Handover` one instead of erroring out.
@@ -9,28 +9,28 @@ The structure defined in the Project-Skills is relevant.
9
9
  You work within **exactly ONE context at a time** — the one named in `.build-kit/.slices/current_context.json` (the runner picks it).
10
10
 
11
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 runner moves `current_context.json` on to the next context with planned work between iterations — never change it yourself.
12
+ - **NEVER** read, scan, or build slices from any other context directory, even if it has "Handover" slices, and even if the current context has no work left.
13
+ - A "Handover" slice in a *different* context is **NOT yours to build**. Ignore it completely.
14
+ - If the current context has no "Handover" slice, you are **done for this iteration** — reply `<promise>NO_TASKS</promise>` and stop. Do not go looking elsewhere. The runner moves `current_context.json` on to the next context with Handover work between iterations — never change it yourself.
15
15
 
16
16
  ## Your Task
17
17
 
18
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.
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 "handover" is a task.
20
20
  2. Read the progress log at `progress.txt` **if it exists** (check Codebase Patterns section first) — it is absent until the first slice is built, which is not an error; create it when you write your first entry
21
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:**
22
+ 5. Pick the **highest priority** slice where status is **exactly** "Handover" (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 "Handover" 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 "Handover" in the current context, reply with:**
24
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>`.
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 "Handover", and try claiming that one instead. Repeat until a claim succeeds or no "Handover" slice remains, in which case reply `<promise>NO_TASKS</promise>`.
26
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
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
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
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.
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 "handover" 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
31
  10. The slice in the json is always true, the code follows what is defined in the json
32
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
33
+ 12. Build against the backend slice's published UI contract (see the `ui-contract` skill, "How the UI build kit looks the contract up") — the build-state-view / build-state-change skills say how to apply it
34
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
35
  14. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge (update first)
36
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).
@@ -107,12 +107,12 @@ A Slice is not complete if specifications are missing or can't be executed.
107
107
 
108
108
  ## Stop Condition
109
109
 
110
- **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.
110
+ **After completing ONE slice, always stop — regardless of whether more slices are in Handover.** The ralph loop will invoke you again for the next slice. Never chain multiple slices in one iteration.
111
111
 
112
112
  If the slice was completed and committed successfully, reply with:
113
113
  <promise>DONE</promise>
114
114
 
115
- If no slice has status "Planned" in the current context, reply with:
115
+ If no slice has status "Handover" in the current context, reply with:
116
116
  <promise>NO_TASKS</promise>
117
117
  (Do NOT switch to another context to find work — stop here.)
118
118
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "pickupStatus": "Handover"
3
+ }
@@ -44,13 +44,13 @@ Run `/load-slice sliceId=<payload.sliceId>` to fetch full slice details (title,
44
44
 
45
45
  Inspect the `sliceStatus` in the payload:
46
46
 
47
- #### `Planned` — build the slice
47
+ #### `Handover` — build the slice
48
48
 
49
49
  This is the build trigger. Setting `InProgress` and building are one atomic step:
50
50
 
51
51
  1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
52
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.
53
+ **Claim conflict**: if this call reports the slice is already in `InProgress` (or any status other than `Handover`), 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
54
 
55
55
  2. Run `/load-slice sliceId=<payload.sliceId>` to fetch the full slice, then read the slice definition from `.build-kit/.slices/<contextSlug>/<sliceFolder>/slice.json`. The runner keeps a `slice.json` fresh from a summary endpoint, so a file holding only `id`, `title`, `status` and `sliceType` is that stub, not an empty slice — never conclude a slice has no elements from it. Only if the full fetch itself returns no commands/events/read models/fields is the slice actually empty.
56
56
 
@@ -424,6 +424,14 @@ import {api as {SliceName}Api} from './slices/{context}/{SliceName}/routes';
424
424
 
425
425
  ---
426
426
 
427
+ ## UI Contract
428
+
429
+ Once the command endpoint is built, invoke the `ui-contract` skill (write contract, `POST`): it publishes
430
+ the endpoint's contract as the `## UI Contract` section of the slice's feedback-lane markdown node, which the slice export then carries in `slice.json` `notes[]`. Do not restate the format here — the skill owns it
431
+ (a build kit may override it).
432
+
433
+ **Source for this stack:** derive the contract from the handler's `@openapi` block, using `references/ui-contract-from-openapi.md`.
434
+
427
435
  ## Files to create
428
436
 
429
437
  ```
@@ -0,0 +1,17 @@
1
+ # UI Contract — derive from the `@openapi` block
2
+
3
+ Used by the `ui-contract` skill. This stack's `routes.ts` carries an `@openapi` JSDoc block above every
4
+ handler (guarded by the `openapi-annotation` commit check), so derive the contract from it mechanically
5
+ instead of re-reading handler logic.
6
+
7
+ | Contract key | OpenAPI source |
8
+ |---|---|
9
+ | `method` | the verb key under the path (`get` / `post`) |
10
+ | `path` | the path key, verbatim (`{param}` style) |
11
+ | `pathParams` / `queryParams` | `parameters[]` with `in: path` / `in: query` → `name`, `schema` (`optional` = not `required`) |
12
+ | `body` (write) | `requestBody…schema.properties` |
13
+ | `response.fields` (read) | the `200` response schema `properties` (follow a `$ref` to `components.schemas`); `Single` vs `List` = object vs `type: array` |
14
+ | `response.status` (write) | the success response code |
15
+ | `errors[]` | every non-2xx response: `status` = the key, `code` / `when` = its description / `error` example |
16
+ | `type` | `string`+`uuid` → `UUID`, `integer`/`int32` → `Int`, `int64` → `Long`, `number`/`double` → `Double`, `number` → `Decimal`, `boolean` → `Boolean`, `date` / `date-time` → `Date` / `DateTime`, `object` → `Custom`, else `String` |
17
+ | `example` | the schema's `example`, nothing invented |
@@ -459,6 +459,14 @@ import {api as {SliceName}Api} from './slices/{context}/{SliceName}/routes';
459
459
 
460
460
  ---
461
461
 
462
+ ## UI Contract
463
+
464
+ Once the read endpoint is built, invoke the `ui-contract` skill (read contract, `GET`): it publishes
465
+ the endpoint's contract as the `## UI Contract` section of the slice's feedback-lane markdown node, which the slice export then carries in `slice.json` `notes[]`. Do not restate the format here — the skill owns it
466
+ (a build kit may override it).
467
+
468
+ **Source for this stack:** derive the contract from the handler's `@openapi` block, using `../build-state-change/references/ui-contract-from-openapi.md`.
469
+
462
470
  ## Files to create / modify
463
471
 
464
472
  ```
@@ -51,7 +51,7 @@ When asked to build a slice, always follow this flow:
51
51
  3. Invoke the matching skill and follow its instructions completely. Do not deviate.
52
52
  4. **Verify against slice.json**: After the skill completes, check that every command field, event field, and specification in slice.json appears in the implementation. No invented fields — if it is not in slice.json, it must not be in the code. This applies even when the slice was previously `Done` and reappears as `Planned` — never dismiss a mismatch as "already implemented" or harmless drift; diff slice.json against the code field by field and update the code to match every change.
53
53
  5. Run quality checks (`npm run build`, then the slice tests only).
54
- 6. If checks pass, commit with `feat: [Slice Name]` and set slice status to `Done`.
54
+ 6. If checks pass, commit with `feat: [Slice Name]` and set slice status to `Done`. For STATE_VIEW/STATE_CHANGE slices when `handover` is enabled the status to set is `Handover`, not `Done` — see the `ui-contract` skill, Step 4.
55
55
 
56
56
  After you are done, automatically run the tests for the slice that was edited.
57
57
 
@@ -32,12 +32,12 @@ You work within **exactly ONE context at a time** — the one named in `.build-k
32
32
  10. The slice in the json is always true, the code follows what is defined in the json
33
33
  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
34
34
  fulfills the slice.json. There must be no specification in json, that has no equivalent in code.
35
- 12. make sure to write the ui-prompt.md as defined if defined in the skill
35
+ 12. Invoke the `ui-contract` skill for STATE_VIEW / STATE_CHANGE slices (publishes the UI Contract section to the slice's feedback-lane markdown node)
36
36
  13. Run quality checks ( npm run build, npm run test ) - Attention - it´s enough to run the tests for the slice. Do not run all tests.
37
37
  14. even if the slice is fully implemented, run your test-analyzer skill and provide the code-slice.json file as defined in the skill
38
38
  15. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
39
39
  first )
40
- 16. 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).
40
+ 16. 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). For STATE_VIEW/STATE_CHANGE slices when `handover` is enabled the status to set is `Handover`, not `Done` — see the `ui-contract` skill, Step 4.
41
41
  17. Append your progress to `progress.txt` after each step in the iteration.
42
42
  18. 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.
43
43
  19. Finish the iteration.
@@ -54,6 +54,15 @@ Extract:
54
54
  a Slice" step 6) — the built, mocked component still needs a real endpoint before it's done,
55
55
  so don't flip it to `Done`.
56
56
  - `description` — implementation hints (validation rules, business constraints).
57
+ - **UI contract (write)** — the backend slice's published `POST` contract: look it up as described in
58
+ the `ui-contract` skill ("How the UI build kit looks the contract up" — the `## UI Contract` entry in
59
+ `slice.json` `notes[]`; parse only its `ui-contract` block). When present it **overrides
60
+ `apiEndpoint`** and fixes everything the component must honour: `path` (+ `pathParams`), the exact
61
+ `body` fields, the success `response`, and `errors[]` (status + code) — surface each error code as a
62
+ distinct user-facing state through `onError`, not one generic failure. When absent, the backend slice
63
+ isn't built or re-fetched yet: fall back to `apiEndpoint` / `fields[]` as above and note the assumption
64
+ in `progress.txt`. If contract and `command.fields[]` disagree, the contract wins for the request and
65
+ you record the mismatch in `progress.txt`.
57
66
  - **events[]** — informational only (what the backend is expected to emit); this stack does not
58
67
  act on them directly.
59
68
  - **screens[]** — the actor `SCREEN` element(s) that trigger this command, if any. Empty when the
@@ -286,7 +295,7 @@ how many pages this app needs — not one page per slice.
286
295
  After writing the hook/component (and context/page, if any), confirm:
287
296
  - Every prop matches a `command.fields[]` entry exactly (name + type) — no invented or missing
288
297
  fields.
289
- - The `postCommand` call uses `command.apiEndpoint` verbatim — or, when it was missing at build
298
+ - The `postCommand` call uses the UI contract's `path` and `body` when one was found, else `command.apiEndpoint` verbatim — or, when it was missing at build
290
299
  time, the provisional `/api/mock/...` path noted in a comment (Step 1).
291
300
  - At least one numbered sample exists under this slice's `samples/` folder, shaped exactly like
292
301
  this component's props.
@@ -66,6 +66,10 @@ Extract:
66
66
  a Slice" step 6) — the built, mocked component still needs a real table/view before it's done,
67
67
  so don't flip it to `Done`.
68
68
  - `description` — implementation hints (filtering rules, sort order, business meaning).
69
+ - **No UI contract for reads** — the backend's `ui-contract` skill publishes a `GET` contract, but this
70
+ stack reads the table/view directly (RLS-protected) and never calls a read endpoint, so that
71
+ contract does not apply here. `readmodel.apiEndpoint` (table/view name) and `fields[]` stay the
72
+ source. (Only the write side, `build-state-change`, consumes a contract.)
69
73
  - **screens[]** — the actor `SCREEN` element(s) that display this data, if any (see Step 2).
70
74
  - **specifications[]** — GWT scenarios/storyline; treat as acceptance criteria (e.g. "given no
71
75
  active reservation, show an empty state").
@@ -44,4 +44,4 @@ These files are always up to date — read them directly before invoking any ski
44
44
  - The `boardId` and `organizationId` from each payload provide full context — pass them to skills.
45
45
  - Node events use `node:created`, `node:changed`, `node:deleted` — always POST to `/api/org/:orgId/boards/:boardId/nodes/events`.
46
46
  - Slice metadata (title, status) lives on the SLICE_BORDER node under `meta.sliceStatus` and `meta.title`.
47
- - `/update-slice-status` rejects moving a slice into a status it's already in — this is a concurrency guard, not a bug. It means another agent already claimed the slice. Treat it as `ALREADY_IN_STATUS`, skip that slice, and move on to the next `Planned` one instead of erroring out.
47
+ - `/update-slice-status` rejects moving a slice into a status it's already in — this is a concurrency guard, not a bug. It means another agent already claimed the slice. Treat it as `ALREADY_IN_STATUS`, skip that slice, and move on to the next `Handover` one instead of erroring out.
@@ -9,28 +9,28 @@ The structure defined in the Project-Skills is relevant.
9
9
  You work within **exactly ONE context at a time** — the one named in `.build-kit/.slices/current_context.json` (the runner picks it).
10
10
 
11
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 runner moves `current_context.json` on to the next context with planned work between iterations — never change it yourself.
12
+ - **NEVER** read, scan, or build slices from any other context directory, even if it has "Handover" slices, and even if the current context has no work left.
13
+ - A "Handover" slice in a *different* context is **NOT yours to build**. Ignore it completely.
14
+ - If the current context has no "Handover" slice, you are **done for this iteration** — reply `<promise>NO_TASKS</promise>` and stop. Do not go looking elsewhere. The runner moves `current_context.json` on to the next context with Handover work between iterations — never change it yourself.
15
15
 
16
16
  ## Your Task
17
17
 
18
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.
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 "handover" is a task.
20
20
  2. Read the progress log at `progress.txt` **if it exists** (check Codebase Patterns section first) — it is absent until the first slice is built, which is not an error; create it when you write your first entry
21
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:**
22
+ 5. Pick the **highest priority** slice where status is **exactly** "Handover" (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 "Handover" 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 "Handover" in the current context, reply with:**
24
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>`.
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 "Handover", and try claiming that one instead. Repeat until a claim succeeds or no "Handover" slice remains, in which case reply `<promise>NO_TASKS</promise>`.
26
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
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
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
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.
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 "handover" 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
31
  10. The slice in the json is always true, the code follows what is defined in the json
32
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
33
+ 12. Build against the backend slice's published UI contract (see the `ui-contract` skill, "How the UI build kit looks the contract up") — the build-state-view / build-state-change skills say how to apply it
34
34
  13. Run quality checks — `npm run build` (typecheck + build) and `npm run lint`. No test runner is configured in this stack yet; if a slice's specifications demand behavioral tests, flag it via `request-feedback` instead of inventing a test setup ad hoc.
35
35
  14. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge (update first)
36
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).
@@ -107,12 +107,12 @@ A Slice is not complete if specifications are missing or can't be executed.
107
107
 
108
108
  ## Stop Condition
109
109
 
110
- **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.
110
+ **After completing ONE slice, always stop — regardless of whether more slices are in Handover.** The ralph loop will invoke you again for the next slice. Never chain multiple slices in one iteration.
111
111
 
112
112
  If the slice was completed and committed successfully, reply with:
113
113
  <promise>DONE</promise>
114
114
 
115
- If no slice has status "Planned" in the current context, reply with:
115
+ If no slice has status "Handover" in the current context, reply with:
116
116
  <promise>NO_TASKS</promise>
117
117
  (Do NOT switch to another context to find work — stop here.)
118
118
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "pickupStatus": "Handover"
3
+ }
@@ -44,13 +44,13 @@ Run `/load-slice sliceId=<payload.sliceId>` to fetch full slice details (title,
44
44
 
45
45
  Inspect the `sliceStatus` in the payload:
46
46
 
47
- #### `Planned` — build the slice
47
+ #### `Handover` — build the slice
48
48
 
49
49
  This is the build trigger. Setting `InProgress` and building are one atomic step:
50
50
 
51
51
  1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
52
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.
53
+ **Claim conflict**: if this call reports the slice is already in `InProgress` (or any status other than `Handover`), 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
54
 
55
55
  2. Run `/load-slice sliceId=<payload.sliceId>` to fetch the full slice, then read the slice definition from `.build-kit/.slices/<contextSlug>/<sliceFolder>/slice.json`. The runner keeps a `slice.json` fresh from a summary endpoint, so a file holding only `id`, `title`, `status` and `sliceType` is that stub, not an empty slice — never conclude a slice has no elements from it. Only if the full fetch itself returns no commands/events/read models/fields is the slice actually empty.
56
56
 
@@ -364,6 +364,12 @@ Do **not** try to also assert read-model state in this same test — that half b
364
364
  immediately after the command isn't an EVENT, don't force a test — leave it undocumented rather than
365
365
  fabricating an assertion.
366
366
 
367
+ ## UI Contract
368
+
369
+ Once the command endpoint is built, invoke the `ui-contract` skill (write contract, `POST`): it publishes
370
+ the endpoint's contract as the `## UI Contract` section of the slice's feedback-lane markdown node, which the slice export then carries in `slice.json` `notes[]`. Do not restate the format here — the skill owns it
371
+ (a build kit may override it).
372
+
367
373
  ## Final Verification
368
374
 
369
375
  Before considering the slice done:
@@ -328,6 +328,12 @@ its own Testcontainers test — implementing `SliceEventListener` correctly (Ste
328
328
  `on(event)`/`handle(query)` directly (Step 4) is sufficient; `EventDispatcher` will deliver real
329
329
  events to it in production exactly as it does for the already-verified slices.
330
330
 
331
+ ## UI Contract
332
+
333
+ Once the read endpoint is built, invoke the `ui-contract` skill (read contract, `GET`): it publishes
334
+ the endpoint's contract as the `## UI Contract` section of the slice's feedback-lane markdown node, which the slice export then carries in `slice.json` `notes[]`. Do not restate the format here — the skill owns it
335
+ (a build kit may override it).
336
+
331
337
  ## Final Verification: Does the Implementation Match slice.json?
332
338
 
333
339
  Before marking this slice as `Done`, verify the implementation against slice.json:
@@ -61,7 +61,7 @@ When asked to build a slice, always follow this flow:
61
61
  3. Invoke the matching skill and follow its instructions completely. Do not deviate.
62
62
  4. **Verify against slice.json**: After the skill completes, check that every command field, event field, and specification in slice.json appears in the implementation. No invented fields — if it is not in slice.json, it must not be in the code. This applies even when the slice was previously `Done` and reappears as `Planned` — never dismiss a mismatch as "already implemented" or harmless drift; diff slice.json against the code field by field and update the code to match every change.
63
63
  5. Run quality checks (`./mvnw compile -q`, then the slice tests only).
64
- 6. If checks pass, commit with `feat: [Slice Name]` and set slice status to `Done`.
64
+ 6. If checks pass, commit with `feat: [Slice Name]` and set slice status to `Done`. For STATE_VIEW/STATE_CHANGE slices when `handover` is enabled the status to set is `Handover`, not `Done` — see the `ui-contract` skill, Step 4.
65
65
 
66
66
  After you are done, automatically run the tests for the slice that was edited.
67
67
 
@@ -36,14 +36,14 @@ You work within **exactly ONE context at a time** — the one named in `.build-k
36
36
  10. The slice in the json is always true, the code follows what is defined in the json
37
37
  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
38
38
  fulfills the slice.json. There must be no specification in json, that has no equivalent in code.
39
- 12. make sure to write the ui-prompt.md as defined if defined in the skill
39
+ 12. Invoke the `ui-contract` skill for STATE_VIEW / STATE_CHANGE slices (publishes the UI Contract section to the slice's feedback-lane markdown node)
40
40
  13. Run quality checks — it is enough to run the tests for the slice only, not all tests:
41
41
  - Compile: `./mvnw compile -q`
42
42
  - Test: `./mvnw test -Dtest="<SliceName>*" -q`
43
43
  If the tests for the slice are not yet named predictably, run `./mvnw test -q` and check for failures.
44
44
  15. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
45
45
  first )
46
- 16. 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).
46
+ 16. 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). For STATE_VIEW/STATE_CHANGE slices when `handover` is enabled the status to set is `Handover`, not `Done` — see the `ui-contract` skill, Step 4.
47
47
  17. Append your progress to `progress.txt` after each step in the iteration.
48
48
  18. 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.
49
49
  19. Finish the iteration.