@eventmodelers/cli 1.0.163 → 2.0.1

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 (98) hide show
  1. package/README.md +22 -27
  2. package/RELEASE_NOTES.md +20 -2
  3. package/cli.js +461 -225
  4. package/lib/adapters/spec-kitty-adapter.js +3 -7
  5. package/lib/global-agent-id.js +45 -0
  6. package/lib/modeling-local-ai.js +4 -2
  7. package/package.json +1 -1
  8. package/shared/build-kit/README.md +4 -19
  9. package/shared/build-kit/lib/agent-lock.js +75 -0
  10. package/shared/build-kit/lib/agent-name.js +27 -0
  11. package/shared/build-kit/lib/event-prune.js +58 -0
  12. package/shared/build-kit/lib/events-view.js +121 -0
  13. package/shared/build-kit/lib/local-ai-agent.js +14 -26
  14. package/shared/build-kit/lib/mcp-register.js +17 -1
  15. package/shared/build-kit/lib/prompt-journal.js +191 -0
  16. package/shared/build-kit/lib/prompt-replay.js +35 -0
  17. package/shared/build-kit/lib/ralph.js +201 -156
  18. package/shared/build-kit/lib/slice-curation.js +40 -0
  19. package/shared/build-kit/lib/slice-events.js +93 -0
  20. package/shared/build-kit/lib/slice-git.js +86 -0
  21. package/shared/build-kit/lib/slice-learnings.js +197 -0
  22. package/shared/build-kit/lib/slice-projection.js +101 -0
  23. package/shared/build-kit/lib/slice-run.js +181 -0
  24. package/shared/build-kit/lib/slice-state.js +182 -0
  25. package/shared/build-kit/lib/slice-tasks.js +35 -0
  26. package/shared/build-kit/ralph-claude.js +4 -2
  27. package/shared/build-kit/ralph-exec.js +4 -2
  28. package/shared/build-kit/ralph-local-ai.js +5 -3
  29. package/shared/skills/learn-eventmodelers-api/SKILL.md +13 -0
  30. package/shared/skills/request-feedback/SKILL.md +1 -2
  31. package/shared/skills/ui-contract/SKILL.md +5 -3
  32. package/stacks/axon/templates/build-kit/CLAUDE.md +3 -3
  33. package/stacks/axon/templates/build-kit/lib/AGENT.md +6 -7
  34. package/stacks/axon/templates/build-kit/lib/backend-prompt.md +20 -42
  35. package/stacks/axon/templates/build-kit/lib/prompt.md +18 -41
  36. package/stacks/blank/templates/build-kit/CLAUDE.md +3 -3
  37. package/stacks/blank/templates/build-kit/lib/AGENT.md +6 -7
  38. package/stacks/blank/templates/build-kit/lib/backend-prompt.md +20 -37
  39. package/stacks/blank/templates/build-kit/lib/prompt.md +19 -42
  40. package/stacks/classic/templates/.claude/skills/build-automation/SKILL.md +1 -1
  41. package/stacks/classic/templates/.claude/skills/build-state-change/SKILL.md +1 -1
  42. package/stacks/classic/templates/.claude/skills/build-state-view/SKILL.md +2 -2
  43. package/stacks/classic/templates/.claude/skills/record-evidence/SKILL.md +2 -2
  44. package/stacks/classic/templates/build-kit/CLAUDE.md +3 -3
  45. package/stacks/classic/templates/build-kit/lib/AGENT.md +6 -7
  46. package/stacks/classic/templates/build-kit/lib/backend-prompt.md +20 -38
  47. package/stacks/classic/templates/build-kit/lib/prompt.md +19 -42
  48. package/stacks/kurrent/templates/build-kit/CLAUDE.md +3 -4
  49. package/stacks/kurrent/templates/build-kit/lib/AGENT.md +6 -7
  50. package/stacks/kurrent/templates/build-kit/lib/backend-prompt.md +20 -42
  51. package/stacks/kurrent/templates/build-kit/lib/prompt.md +18 -41
  52. package/stacks/modeling-kit/templates/.claude/skills/detect-model-drift/SKILL.md +1 -1
  53. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-core-rules/SKILL.md +2 -0
  54. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +7 -3
  55. package/stacks/modeling-kit/templates/.claude/skills/wdyt/SKILL.md +1 -1
  56. package/stacks/modeling-kit/templates/kit/CLAUDE-STANDALONE.md +3 -4
  57. package/stacks/modeling-kit/templates/kit/CLAUDE.md +9 -24
  58. package/stacks/modeling-kit/templates/kit/README.md +1 -1
  59. package/stacks/modeling-kit/templates/kit/lib/config.js +1 -1
  60. package/stacks/node/templates/build-kit/CLAUDE.md +3 -3
  61. package/stacks/node/templates/build-kit/lib/AGENT.md +6 -7
  62. package/stacks/node/templates/build-kit/lib/backend-prompt.md +20 -42
  63. package/stacks/node/templates/build-kit/lib/prompt.md +18 -41
  64. package/stacks/opencqrs/templates/build-kit/CLAUDE.md +3 -4
  65. package/stacks/opencqrs/templates/build-kit/lib/AGENT.md +6 -7
  66. package/stacks/opencqrs/templates/build-kit/lib/backend-prompt.md +20 -42
  67. package/stacks/opencqrs/templates/build-kit/lib/prompt.md +18 -41
  68. package/stacks/react/templates/.claude/skills/build-state-change/SKILL.md +1 -1
  69. package/stacks/react/templates/.claude/skills/build-state-view/SKILL.md +1 -1
  70. package/stacks/react/templates/build-kit/CLAUDE.md +3 -3
  71. package/stacks/react/templates/build-kit/lib/AGENT.md +6 -7
  72. package/stacks/react/templates/build-kit/lib/backend-prompt.md +20 -37
  73. package/stacks/react/templates/build-kit/lib/prompt.md +19 -42
  74. package/stacks/supabase/templates/build-kit/CLAUDE.md +3 -3
  75. package/stacks/supabase/templates/build-kit/lib/AGENT.md +6 -7
  76. package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +20 -42
  77. package/stacks/supabase/templates/build-kit/lib/prompt.md +18 -41
  78. package/stacks/supabase-react/templates/.claude/skills/build-state-change/SKILL.md +2 -2
  79. package/stacks/supabase-react/templates/.claude/skills/build-state-view/SKILL.md +2 -2
  80. package/stacks/supabase-react/templates/build-kit/CLAUDE.md +3 -3
  81. package/stacks/supabase-react/templates/build-kit/lib/AGENT.md +6 -7
  82. package/stacks/supabase-react/templates/build-kit/lib/backend-prompt.md +20 -37
  83. package/stacks/supabase-react/templates/build-kit/lib/prompt.md +19 -42
  84. package/stacks/umadb/templates/build-kit/CLAUDE.md +3 -3
  85. package/stacks/umadb/templates/build-kit/lib/AGENT.md +6 -7
  86. package/stacks/umadb/templates/build-kit/lib/backend-prompt.md +20 -42
  87. package/stacks/umadb/templates/build-kit/lib/prompt.md +18 -41
  88. package/shared/bridge/spec-kitty/bridge-spec-kitty-specify/SKILL.md +0 -125
  89. package/shared/bridge/spec-kitty/bridge-spec-kitty-tasks/SKILL.md +0 -95
  90. package/shared/build-kit/lib/agent.sh +0 -20
  91. package/shared/build-kit/ralph.sh +0 -111
  92. package/shared/build-kit/realtime-agent.js +0 -20
  93. package/stacks/bridge/templates/bridge/lib/AGENT.md +0 -47
  94. package/stacks/bridge/templates/bridge/lib/prompt.md +0 -111
  95. package/stacks/bridge/templates/bridge/ralph-claude.js +0 -50
  96. package/stacks/bridge/templates/bridge/ralph-hook.js +0 -103
  97. package/stacks/bridge/templates/bridge/ralph-local-ai.js +0 -43
  98. package/stacks/bridge/templates/bridge/ralph-static.js +0 -90
@@ -1,12 +1,11 @@
1
- # Agent Learnings
1
+ # Agent Reference
2
2
 
3
- Patterns and gotchas discovered during task processing. Update this file whenever you encounter something reusable.
3
+ What task processing relies on: the shape of a task and the API facts the skills use. A reusable learning is recorded with `npx @eventmodelers/cli learn "<one terse line>"`, not added here.
4
4
 
5
- ## tasks.json
5
+ ## Tasks
6
6
 
7
- - Tasks are objects with `id`, `createdAt`, and `payload` (a `SliceChangedPayload`).
8
- - After completing a task, remove it from the array entirely — do not add a status field.
9
- - Write `[]` to `tasks.json` if the last task is completed.
7
+ - A task is a slice change the run loop queued: an `id` and a `payload` (a `SliceChangedPayload`). The task request names it.
8
+ - You never read or write a queue file: the run loop completes the task when your turn ends.
10
9
 
11
10
  ## SliceChangedPayload fields
12
11
 
@@ -44,4 +43,4 @@ These files are always up to date — read them directly before invoking any ski
44
43
  - The `boardId` and `organizationId` from each payload provide full context — pass them to skills.
45
44
  - Node events use `node:created`, `node:changed`, `node:deleted` — always POST to `/api/org/:orgId/boards/:boardId/nodes/events`.
46
45
  - 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.
46
+ - `/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. This applies to queued tasks only: when the task request names the slice to build, the run loop owns its status — never call `/update-slice-status` there.
@@ -17,16 +17,15 @@ You work within **exactly ONE context at a time** — the one named in `.build-k
17
17
 
18
18
  0. Do not read the entire code base. Focus on the tasks in this description.
19
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` **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
20
+ 2. Read `.build-kit/AGENTS.md` **if it exists** — the project's accumulated learnings, generated from what earlier builds recorded. If the slice's `slice.json` has a `lastAttempt`, an earlier attempt at it failed: read its `reason`, `lastReply`, `branch` and `changed`, and do not repeat what failed.
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. Your slice is the one the task request names (the run loop picked the highest priority slice with status "Planned"); it becomes your PRD. The run loop has already claimed it — its status is "InProgress" in index.json and on the board. Build that slice and do not call `update-slice-status`: the run loop owns the slice's status on the board.
23
+ **IMPORTANT: Only work on the slice named in the task request. Never switch to another slice, whatever its status. If the task request names no slice and no slice has status "Planned" 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>`.
26
25
  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
26
+ 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.
28
27
  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
28
+ 8. Record each learning the moment you have it (see **Recording Learnings**), not at the end.
30
29
  9. Analyze and Implement that single slice, make use of the skills in the skills directory, but also your previsously collected
31
30
  knowledge. Make a list TODO list for what needs to be done. Also make sure to 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.
32
31
  10. The slice in the json is always true, the code follows what is defined in the json
@@ -37,48 +36,27 @@ You work within **exactly ONE context at a time** — the one named in `.build-k
37
36
  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
37
  15. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
39
38
  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). 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
- 17. Append your progress to `progress.txt` after each step in the iteration.
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.
39
+ 16. Record the outcome with `npx @eventmodelers/cli slice-status Done` — not by editing index.json, and do not call `update-slice-status`: the run loop pushes the status to the board when your turn ends. For STATE_VIEW/STATE_CHANGE slices when `handover` is enabled the status to record is `Handover`, not `Done` — see the `ui-contract` skill, Step 4. A slice you could not finish needs no status: leave it as it is and the run loop discards the attempt.
40
+ 17. Record any reusable learning you have not recorded yet (see **Recording Learnings**).
41
+ 18. If an entry in `.build-kit/AGENTS.md` turned out wrong or obsolete, retract it (see **Recording Learnings**).
43
42
  19. Finish the iteration.
44
43
 
45
44
  ## Escalating Ambiguity
46
45
 
47
- **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line in `progress.txt` and as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
46
+ **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
48
47
 
49
- ## Progress Report Format
48
+ ## Recording Learnings
50
49
 
51
- APPEND to progress.txt (never replace, always append):
50
+ `.build-kit/AGENTS.md` is generated from the learnings recorded so far — read it at the start of every session, never edit it by hand. Record a learning the moment you have it:
52
51
 
53
52
  ```
54
- ## [Date/Time] - [Slice]
55
-
56
- - What was implemented
57
- - Files changed
58
- - **Learnings for future iterations:**
59
- - Patterns discovered (e.g., "this codebase uses X for Y")
60
- - Gotchas encountered (e.g., "don't forget to update Z when changing W")
61
- - Useful context (e.g., "the evaluation panel is in component X")
62
- ---
53
+ npx @eventmodelers/cli learn "<one terse line>" --topic "<topic>"
63
54
  ```
64
55
 
65
- The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase
66
- better.
67
-
68
- ## Consolidate Patterns
69
-
70
- If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section
71
- at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most important
72
- learnings:
73
-
74
- ```
75
- ## Codebase Patterns
76
- - Example: Use `sql<number>` template for aggregations
77
- - Example: Always use `IF NOT EXISTS` for migrations
78
- - Example: Export types from actions.ts for UI components
79
- ```
80
-
81
- Only add patterns that are **general and reusable**, not story-specific details.
56
+ - Only what is genuinely reusable: codebase patterns, gotchas, commands that work or don't, conventions — and, after a failed approach, what was tried and why it failed. Not slice-specific details, and nothing the code or git log already says.
57
+ - One learning per call, one line each. A learning that is already in `.build-kit/AGENTS.md` is skipped for you.
58
+ - `--scope system` for what is true of the modeled domain (a business rule, a naming convention of the model); `repo` (the default) for the codebase and its tooling. `--tag <tag>` labels it (repeatable).
59
+ - One in `.build-kit/AGENTS.md` that turned out wrong or obsolete: `npx @eventmodelers/cli learnings --ids` lists each with its id, `npx @eventmodelers/cli learn --retract <id>` removes it.
82
60
 
83
61
  ## Update AGENTS.md Files
84
62
 
@@ -104,7 +82,7 @@ Before committing, check if any edited files have learnings worth preserving in
104
82
  - Slice specific implementation details
105
83
  - Story-specific implementation details
106
84
  - Temporary debugging notes
107
- - Information already in progress.txt
85
+ - Information already recorded as a learning in `.build-kit/AGENTS.md`
108
86
  - Task speecific learnings like "- Timesheet approval requires: submitted=true, reverted=false, approved=false, declined=false"
109
87
 
110
88
  Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
@@ -148,9 +126,9 @@ If ALL slices in the current context are Done, reply with:
148
126
  - If no `.eventmodelers/config.json` exists anywhere (project root or an ancestor directory, or `~/.eventmodelers/config.json` — the one inside `.build-kit/` is only an optional override, so its absence means nothing), skip all platform communication (MCP calls, `update-slice-status`, board sync) and continue working locally.
149
127
  - Work on ONE slice per iteration
150
128
  - Commit frequently
151
- - update progress.txt frequently
152
- - Read the Codebase Patterns section in progress.txt before starting
129
+ - Record learnings as you go with `learn`
130
+ - Read `.build-kit/AGENTS.md` before starting
153
131
 
154
132
  ## When an iteration completes
155
133
 
156
- Use all the key learnings from the progress.txt and update the `.build-kit/AGENTS.md` file with those learnings.
134
+ Make sure every reusable learning is recorded with `learn`; `.build-kit/AGENTS.md` is generated from them — never edit it by hand.
@@ -4,17 +4,11 @@ You are an autonomous agent reacting to slice status change events on an Eventmo
4
4
 
5
5
  ## Your Loop
6
6
 
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.
7
+ 1. Read `AGENT.md` and, if it exists, `.build-kit/AGENTS.md` to load accumulated knowledge before doing anything else.
8
+ 2. The task request at the end of this prompt names your task: its id and the slice change that queued it (`sliceId`, `sliceTitle`, `sliceStatus`, …). It is the oldest one waiting — the run loop picked it for you.
9
+ 3. Execute the task — see the Execution section below.
10
+ 4. Record any reusable learning with `npx @eventmodelers/cli learn "<one terse line>" --topic <topic>` (see **Recording Learnings**).
11
+ 5. Reply normally. The run loop completes the task when your turn ends and hands you the next one in a fresh turn — you never read or write a queue file.
18
12
 
19
13
  ## Execution
20
14
 
@@ -48,11 +42,11 @@ Inspect the `sliceStatus` in the payload:
48
42
 
49
43
  This is the build trigger. Setting `InProgress` and building are one atomic step:
50
44
 
51
- **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line in `progress.txt` and as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
45
+ **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
52
46
 
53
47
  1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
54
48
 
55
- **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.
49
+ **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. Say so in your reply, drop this task without building, and continue the loop (the next task will naturally cover the next slice). Do not retry.
56
50
 
57
51
  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.
58
52
 
@@ -74,48 +68,31 @@ This is the build trigger. Setting `InProgress` and building are one atomic step
74
68
  Another agent is already building this slice. Log it and skip — do not build.
75
69
 
76
70
  #### `Done`
77
- Summarize what was completed and update `progress.txt`.
71
+ Summarize what was completed in your reply.
78
72
 
79
73
  #### `Blocked`
80
- Log the blocker in `progress.txt`.
74
+ State the blocker in your reply.
81
75
 
82
76
  #### `Review`
83
- Fetch slice details and prepare a review summary in `progress.txt`.
77
+ Fetch slice details and prepare a review summary in your reply.
84
78
 
85
79
  #### Any other status (`Created`, etc.)
86
- Load the slice and log the state transition in `progress.txt`. No build action.
80
+ Load the slice and note the state transition in your reply. No build action.
87
81
 
88
82
  Use the skills available in `.claude/skills/` to interact with the board.
89
83
 
90
- ## Updating tasks.json
84
+ ## Recording Learnings
91
85
 
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 `[]`.
86
+ `.build-kit/AGENTS.md` is generated from the learnings recorded so far — read it at the start of every session, never edit it by hand. Record a learning the moment you have it:
93
87
 
94
- ## Progress Report Format
95
-
96
- APPEND to `progress.txt` (never replace):
97
88
  ```
98
- ## [ISO timestamp] — Task [task.id]
99
-
100
- Slice: [sliceTitle] ([sliceId])
101
- Status change: [sliceStatus]
102
-
103
- Action taken:
104
- - [what was done in response to the slice change]
105
-
106
- Learnings:
107
- - [any patterns, gotchas, or reusable knowledge discovered]
108
- ---
89
+ npx @eventmodelers/cli learn "<one terse line>" --topic "<topic>"
109
90
  ```
110
91
 
111
- ## Stop Condition
112
-
113
- If `.build-kit/tasks.json` is empty (`[]`) or does not exist, reply with:
114
- <promise>IDLE</promise>
115
-
116
- ## Updating AGENT.md
117
-
118
- 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.
92
+ - Only what is genuinely reusable: codebase patterns, gotchas, commands that work or don't, conventions — and, after a failed approach, what was tried and why it failed. Not slice-specific details, and nothing the code or git log already says.
93
+ - One learning per call, one line each. A learning that is already in `.build-kit/AGENTS.md` is skipped for you.
94
+ - `--scope system` for what is true of the modeled domain (a business rule, a naming convention of the model); `repo` (the default) for the codebase and its tooling. `--tag <tag>` labels it (repeatable).
95
+ - One in `.build-kit/AGENTS.md` that turned out wrong or obsolete: `npx @eventmodelers/cli learnings --ids` lists each with its id, `npx @eventmodelers/cli learn --retract <id>` removes it.
119
96
 
120
97
  ## Important
121
98
 
@@ -51,10 +51,9 @@ Ignore case for files and slices in prompts. "CartItems" slice is the same as "c
51
51
  Do not change test files unless explicitly instructed, or the change brings the test in line with slice.json (e.g. step 4's field/spec diff): `src/test/java/**/*Test.java`.
52
52
 
53
53
  At the start of every session, read `.build-kit/AGENTS.md` if it exists to load accumulated project
54
- learnings.
54
+ learnings. It is generated from the learnings recorded so far — record a new one with `npx @eventmodelers/cli learn "<one terse line>" --topic <topic>`, never by editing the file.
55
55
 
56
- When starting to work on a slice, invoke the `update-slice-status` skill with `InProgress` status before
57
- doing anything else.
56
+ When working from a queued task, invoke the `update-slice-status` skill with `InProgress` status before doing anything else. When the task request names the slice to build (a run-loop build), the run loop has already set it to `InProgress` and pushes the final status itself — do not call `update-slice-status`; record the outcome with `npx @eventmodelers/cli slice-status <status>`.
58
57
 
59
58
  ## Building a Slice
60
59
 
@@ -62,7 +61,7 @@ doing anything else.
62
61
  **ALL fields, event names, command names, and business rules MUST come exclusively from slice.json. Do NOT
63
62
  invent, assume, or guess any field or logic not present in the slice definition.**
64
63
 
65
- **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line in `progress.txt` and as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
64
+ **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
66
65
 
67
66
  When asked to build a slice, always follow this flow:
68
67
 
@@ -1,12 +1,11 @@
1
- # Agent Learnings
1
+ # Agent Reference
2
2
 
3
- Patterns and gotchas discovered during task processing. Update this file whenever you encounter something reusable.
3
+ What task processing relies on: the shape of a task and the API facts the skills use. A reusable learning is recorded with `npx @eventmodelers/cli learn "<one terse line>"`, not added here.
4
4
 
5
- ## tasks.json
5
+ ## Tasks
6
6
 
7
- - Tasks are objects with `id`, `createdAt`, and `payload` (a `SliceChangedPayload`).
8
- - After completing a task, remove it from the array entirely — do not add a status field.
9
- - Write `[]` to `tasks.json` if the last task is completed.
7
+ - A task is a slice change the run loop queued: an `id` and a `payload` (a `SliceChangedPayload`). The task request names it.
8
+ - You never read or write a queue file: the run loop completes the task when your turn ends.
10
9
 
11
10
  ## SliceChangedPayload fields
12
11
 
@@ -44,7 +43,7 @@ These files are always up to date — read them directly before invoking any ski
44
43
  - The `boardId` and `organizationId` from each payload provide full context — pass them to skills.
45
44
  - Node events use `node:created`, `node:changed`, `node:deleted` — always POST to `/api/org/:orgId/boards/:boardId/nodes/events`.
46
45
  - 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.
46
+ - `/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. This applies to queued tasks only: when the task request names the slice to build, the run loop owns its status — never call `/update-slice-status` there.
48
47
 
49
48
  ## OpenCQRS-specific
50
49
 
@@ -17,20 +17,19 @@ You work within **exactly ONE context at a time** — the one named in `.build-k
17
17
 
18
18
  0. Do not read the entire code base. Focus on the tasks in this description.
19
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` **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
20
+ 2. Read `.build-kit/AGENTS.md` **if it exists** — the project's accumulated learnings, generated from what earlier builds recorded. If the slice's `slice.json` has a `lastAttempt`, an earlier attempt at it failed: read its `reason`, `lastReply`, `branch` and `changed`, and do not repeat what failed.
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. Your slice is the one the task request names (the run loop picked the highest priority slice with status "Planned"); it becomes your PRD. The run loop has already claimed it — its status is "InProgress" in index.json and on the board. Build that slice and do not call `update-slice-status`: the run loop owns the slice's status on the board.
23
+ **IMPORTANT: Only work on the slice named in the task request. Never switch to another slice, whatever its status. If the task request names no slice and no slice has status "Planned" 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>`.
26
25
  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
26
+ 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.
28
27
  7. Define the slice type and load the matching skill:
29
28
  - Write slice (has commands, no processors) → `build-state-change`
30
29
  - Read slice (has readModel / information flow) → `build-state-view`
31
30
  - Translation slice (`sliceType === "TRANSLATION"`) → read `description` and `notes` from slice.json for hints; default to `build-automation` if nothing else is specified
32
31
  - Automation slice (processors-array is not empty) → `build-automation`
33
- 8. Write a short progress one liner after each step to progress.txt
32
+ 8. Record each learning the moment you have it (see **Recording Learnings**), not at the end.
34
33
  9. Analyze and Implement that single slice, make use of the skills in the skills directory, but also your previsously collected
35
34
  knowledge. Make a list TODO list for what needs to be done. Also make sure to 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.
36
35
  10. The slice in the json is always true, the code follows what is defined in the json
@@ -43,48 +42,27 @@ You work within **exactly ONE context at a time** — the one named in `.build-k
43
42
  If the tests for the slice are not yet named predictably, run `./mvnw test -q` and check for failures.
44
43
  15. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
45
44
  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). 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
- 17. Append your progress to `progress.txt` after each step in the iteration.
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.
45
+ 16. Record the outcome with `npx @eventmodelers/cli slice-status Done` — not by editing index.json, and do not call `update-slice-status`: the run loop pushes the status to the board when your turn ends. For STATE_VIEW/STATE_CHANGE slices when `handover` is enabled the status to record is `Handover`, not `Done` — see the `ui-contract` skill, Step 4. A slice you could not finish needs no status: leave it as it is and the run loop discards the attempt.
46
+ 17. Record any reusable learning you have not recorded yet (see **Recording Learnings**).
47
+ 18. If an entry in `.build-kit/AGENTS.md` turned out wrong or obsolete, retract it (see **Recording Learnings**).
49
48
  19. Finish the iteration.
50
49
 
51
50
  ## Escalating Ambiguity
52
51
 
53
- **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line in `progress.txt` and as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
52
+ **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
54
53
 
55
- ## Progress Report Format
54
+ ## Recording Learnings
56
55
 
57
- APPEND to progress.txt (never replace, always append):
56
+ `.build-kit/AGENTS.md` is generated from the learnings recorded so far — read it at the start of every session, never edit it by hand. Record a learning the moment you have it:
58
57
 
59
58
  ```
60
- ## [Date/Time] - [Slice]
61
-
62
- - What was implemented
63
- - Files changed
64
- - **Learnings for future iterations:**
65
- - Patterns discovered (e.g., "this codebase uses X for Y")
66
- - Gotchas encountered (e.g., "don't forget to update Z when changing W")
67
- - Useful context (e.g., "the evaluation panel is in component X")
68
- ---
59
+ npx @eventmodelers/cli learn "<one terse line>" --topic "<topic>"
69
60
  ```
70
61
 
71
- The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase
72
- better.
73
-
74
- ## Consolidate Patterns
75
-
76
- If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns`
77
- section at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most
78
- important learnings:
79
-
80
- ```
81
- ## Codebase Patterns
82
- - Example: Register every new event's type string in CqrsConfiguration.eventTypeResolver() as part of the slice
83
- - Example: Automations must catch CommandSubjectAlreadyExistsException/CommandSubjectDoesNotExistException locally
84
- - Example: Export write-model records as package-private unless another slice legitimately needs them
85
- ```
86
-
87
- Only add patterns that are **general and reusable**, not story-specific details.
62
+ - Only what is genuinely reusable: codebase patterns, gotchas, commands that work or don't, conventions — and, after a failed approach, what was tried and why it failed. Not slice-specific details, and nothing the code or git log already says.
63
+ - One learning per call, one line each. A learning that is already in `.build-kit/AGENTS.md` is skipped for you.
64
+ - `--scope system` for what is true of the modeled domain (a business rule, a naming convention of the model); `repo` (the default) for the codebase and its tooling. `--tag <tag>` labels it (repeatable).
65
+ - One in `.build-kit/AGENTS.md` that turned out wrong or obsolete: `npx @eventmodelers/cli learnings --ids` lists each with its id, `npx @eventmodelers/cli learn --retract <id>` removes it.
88
66
 
89
67
  ## Update AGENTS.md Files
90
68
 
@@ -110,7 +88,7 @@ Before committing, check if any edited files have learnings worth preserving in
110
88
  - Slice specific implementation details
111
89
  - Story-specific implementation details
112
90
  - Temporary debugging notes
113
- - Information already in progress.txt
91
+ - Information already recorded as a learning in `.build-kit/AGENTS.md`
114
92
  - Task specific learnings
115
93
 
116
94
  Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
@@ -154,9 +132,9 @@ If ALL slices in the current context are Done, reply with:
154
132
  - If no `.eventmodelers/config.json` exists anywhere (project root or an ancestor directory, or `~/.eventmodelers/config.json` — the one inside `.build-kit/` is only an optional override, so its absence means nothing), skip all platform communication (MCP calls, `update-slice-status`, board sync) and continue working locally.
155
133
  - Work on ONE slice per iteration
156
134
  - Commit frequently
157
- - update progress.txt frequently
158
- - Read the Codebase Patterns section in progress.txt before starting
135
+ - Record learnings as you go with `learn`
136
+ - Read `.build-kit/AGENTS.md` before starting
159
137
 
160
138
  ## When an iteration completes
161
139
 
162
- Use all the key learnings from the progress.txt and update the `.build-kit/AGENTS.md` file with those learnings.
140
+ Make sure every reusable learning is recorded with `learn`; `.build-kit/AGENTS.md` is generated from them — never edit it by hand.
@@ -4,17 +4,11 @@ You are an autonomous agent reacting to slice status change events on an Eventmo
4
4
 
5
5
  ## Your Loop
6
6
 
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.
7
+ 1. Read `AGENT.md` and, if it exists, `.build-kit/AGENTS.md` to load accumulated knowledge before doing anything else.
8
+ 2. The task request at the end of this prompt names your task: its id and the slice change that queued it (`sliceId`, `sliceTitle`, `sliceStatus`, …). It is the oldest one waiting — the run loop picked it for you.
9
+ 3. Execute the task — see the Execution section below.
10
+ 4. Record any reusable learning with `npx @eventmodelers/cli learn "<one terse line>" --topic <topic>` (see **Recording Learnings**).
11
+ 5. Reply normally. The run loop completes the task when your turn ends and hands you the next one in a fresh turn — you never read or write a queue file.
18
12
 
19
13
  ## Execution
20
14
 
@@ -48,11 +42,11 @@ Inspect the `sliceStatus` in the payload:
48
42
 
49
43
  This is the build trigger. Setting `InProgress` and building are one atomic step:
50
44
 
51
- **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line in `progress.txt` and as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
45
+ **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
52
46
 
53
47
  1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
54
48
 
55
- **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.
49
+ **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. Say so in your reply, drop this task without building, and continue the loop (the next task will naturally cover the next slice). Do not retry.
56
50
 
57
51
  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.
58
52
 
@@ -78,48 +72,31 @@ This is the build trigger. Setting `InProgress` and building are one atomic step
78
72
  Another agent is already building this slice. Log it and skip — do not build.
79
73
 
80
74
  #### `Done`
81
- Summarize what was completed and update `progress.txt`.
75
+ Summarize what was completed in your reply.
82
76
 
83
77
  #### `Blocked`
84
- Log the blocker in `progress.txt`.
78
+ State the blocker in your reply.
85
79
 
86
80
  #### `Review`
87
- Fetch slice details and prepare a review summary in `progress.txt`.
81
+ Fetch slice details and prepare a review summary in your reply.
88
82
 
89
83
  #### Any other status (`Created`, etc.)
90
- Load the slice and log the state transition in `progress.txt`. No build action.
84
+ Load the slice and note the state transition in your reply. No build action.
91
85
 
92
86
  Use the skills available in `.claude/skills/` to interact with the board.
93
87
 
94
- ## Updating tasks.json
88
+ ## Recording Learnings
95
89
 
96
- 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 `[]`.
90
+ `.build-kit/AGENTS.md` is generated from the learnings recorded so far — read it at the start of every session, never edit it by hand. Record a learning the moment you have it:
97
91
 
98
- ## Progress Report Format
99
-
100
- APPEND to `progress.txt` (never replace):
101
92
  ```
102
- ## [ISO timestamp] — Task [task.id]
103
-
104
- Slice: [sliceTitle] ([sliceId])
105
- Status change: [sliceStatus]
106
-
107
- Action taken:
108
- - [what was done in response to the slice change]
109
-
110
- Learnings:
111
- - [any patterns, gotchas, or reusable knowledge discovered]
112
- ---
93
+ npx @eventmodelers/cli learn "<one terse line>" --topic "<topic>"
113
94
  ```
114
95
 
115
- ## Stop Condition
116
-
117
- If `.build-kit/tasks.json` is empty (`[]`) or does not exist, reply with:
118
- <promise>IDLE</promise>
119
-
120
- ## Updating AGENT.md
121
-
122
- 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.
96
+ - Only what is genuinely reusable: codebase patterns, gotchas, commands that work or don't, conventions — and, after a failed approach, what was tried and why it failed. Not slice-specific details, and nothing the code or git log already says.
97
+ - One learning per call, one line each. A learning that is already in `.build-kit/AGENTS.md` is skipped for you.
98
+ - `--scope system` for what is true of the modeled domain (a business rule, a naming convention of the model); `repo` (the default) for the codebase and its tooling. `--tag <tag>` labels it (repeatable).
99
+ - One in `.build-kit/AGENTS.md` that turned out wrong or obsolete: `npx @eventmodelers/cli learnings --ids` lists each with its id, `npx @eventmodelers/cli learn --retract <id>` removes it.
123
100
 
124
101
  ## Important
125
102
 
@@ -33,7 +33,7 @@ From the slice definition, extract:
33
33
  - **UI contract** — the backend slice's published write (`POST`) contract: look it up as described in the
34
34
  `ui-contract` skill ("How the UI build kit looks the contract up": the `## UI Contract` entry in
35
35
  `slice.json` `notes[]`, parse only its `ui-contract` block — an OpenAPI operation). It fixes the request: the path (+ path `parameters`), the exact `requestBody` properties, the 2xx `responses` entry, and every non-2xx response (status + description) — surface each error code as its own user-facing state, not one generic failure. When absent, the backend slice isn't
36
- built or re-fetched yet: build against `slice.json` and note the assumption in `progress.txt`.
36
+ built or re-fetched yet: build against `slice.json` and note the assumption as a code comment.
37
37
 
38
38
  > **Comments & description**: each element carries a `comments: string[]` array (board comments) and a `description` field — use them as implementation hints, and resolve consumed comments via `POST <BASE_URL>/api/org/<ORG_ID>/boards/<BOARD_ID>/nodes/<nodeId>/comments/<commentId>/resolve`.
39
39
 
@@ -32,7 +32,7 @@ From the slice definition, extract:
32
32
  - **UI contract** — the backend slice's published read (`GET`) contract: look it up as described in the
33
33
  `ui-contract` skill ("How the UI build kit looks the contract up": the `## UI Contract` entry in
34
34
  `slice.json` `notes[]`, parse only its `ui-contract` block — an OpenAPI operation). It fixes the request: the path (+ path/query `parameters`), the exact 2xx response schema (object = `Single`, `type: array` = `List`), and every non-2xx response — render each error status as a distinct state. When absent, the backend slice isn't
35
- built or re-fetched yet: build against `slice.json` and note the assumption in `progress.txt`.
35
+ built or re-fetched yet: build against `slice.json` and note the assumption as a code comment.
36
36
 
37
37
  > **Comments & description**: each element carries a `comments: string[]` array (board comments) and a `description` field — use them as implementation hints, and resolve consumed comments via `POST <BASE_URL>/api/org/<ORG_ID>/boards/<BOARD_ID>/nodes/<nodeId>/comments/<commentId>/resolve`.
38
38
 
@@ -23,16 +23,16 @@ TODO — any other guardrails worth stating up front (e.g. ignore routes files u
23
23
  asked, ignore tests unless asked, slice names are case-insensitive) — copy the ones
24
24
  that still apply from an existing stack's build-kit/CLAUDE.md.
25
25
 
26
- At the start of every session, read `.build-kit/AGENTS.md` if it exists to load accumulated project learnings.
26
+ At the start of every session, read `.build-kit/AGENTS.md` if it exists to load accumulated project learnings. It is generated from the learnings recorded so far — record a new one with `npx @eventmodelers/cli learn "<one terse line>" --topic <topic>`, never by editing the file.
27
27
 
28
- When starting to work on a slice, invoke the `update-slice-status` skill with `InProgress` status before doing anything else.
28
+ When working from a queued task, invoke the `update-slice-status` skill with `InProgress` status before doing anything else. When the task request names the slice to build (a run-loop build), the run loop has already set it to `InProgress` and pushes the final status itself — do not call `update-slice-status`; record the outcome with `npx @eventmodelers/cli slice-status <status>`.
29
29
 
30
30
  ## Building a Slice
31
31
 
32
32
  **CRITICAL: You MUST always use the provided skills to build slices. NEVER implement a slice manually.**
33
33
  **ALL fields, event names, command names, and business rules MUST come exclusively from slice.json. Do NOT invent, assume, or guess any field or logic not present in the slice definition.**
34
34
 
35
- **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line in `progress.txt` and as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
35
+ **Default: make a reasonable assumption and build the slice.** If a detail is unclear or missing (an example value, a field type, a status mapping, a referenced event that isn't modeled yet, ...), pick the most sensible interpretation from `slice.json`, its specifications and the surrounding model, build it, and record each assumption in one line as a code comment. Ambiguity alone is never a reason to stop. **Only if the slice literally cannot be built** — nothing runnable can be produced even with sensible assumptions — invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked`. That must be the absolute exception; a `Blocked` slice should mean "impossible without a human", never "the agent preferred to ask".
36
36
 
37
37
  When asked to build a slice, always follow this flow:
38
38
 
@@ -1,12 +1,11 @@
1
- # Agent Learnings
1
+ # Agent Reference
2
2
 
3
- Patterns and gotchas discovered during task processing. Update this file whenever you encounter something reusable.
3
+ What task processing relies on: the shape of a task and the API facts the skills use. A reusable learning is recorded with `npx @eventmodelers/cli learn "<one terse line>"`, not added here.
4
4
 
5
- ## tasks.json
5
+ ## Tasks
6
6
 
7
- - Tasks are objects with `id`, `createdAt`, and `payload` (a `SliceChangedPayload`).
8
- - After completing a task, remove it from the array entirely — do not add a status field.
9
- - Write `[]` to `tasks.json` if the last task is completed.
7
+ - A task is a slice change the run loop queued: an `id` and a `payload` (a `SliceChangedPayload`). The task request names it.
8
+ - You never read or write a queue file: the run loop completes the task when your turn ends.
10
9
 
11
10
  ## SliceChangedPayload fields
12
11
 
@@ -44,4 +43,4 @@ These files are always up to date — read them directly before invoking any ski
44
43
  - The `boardId` and `organizationId` from each payload provide full context — pass them to skills.
45
44
  - Node events use `node:created`, `node:changed`, `node:deleted` — always POST to `/api/org/:orgId/boards/:boardId/nodes/events`.
46
45
  - 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 `Handover` one instead of erroring out.
46
+ - `/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. This applies to queued tasks only: when the task request names the slice to build, the run loop owns its status — never call `/update-slice-status` there.