@llipe.com/dev-tasks 0.16.1 → 0.16.4

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 (43) hide show
  1. package/.claude/agents/developer.md +45 -31
  2. package/.claude/agents/github-ops.md +2 -2
  3. package/.claude/agents/technical-writer.md +11 -9
  4. package/.claude/agents/verifier.md +15 -0
  5. package/.claude/commands/planner.md +61 -13
  6. package/.claude/commands/product-engineer.md +54 -8
  7. package/.claude/hooks/git-guard.sh +152 -64
  8. package/.claude/skills/git-ops/SKILL.md +6 -6
  9. package/.claude/skills/implement/SKILL.md +12 -8
  10. package/.claude/skills/memo-cli-usage/REFERENCE.md +11 -11
  11. package/.claude/skills/memo-cli-usage/SKILL.md +11 -9
  12. package/.github/agents/developer.agent.md +45 -31
  13. package/.github/agents/github-ops.agent.md +2 -2
  14. package/.github/agents/planner.agent.md +61 -13
  15. package/.github/agents/product-engineer.agent.md +54 -8
  16. package/.github/agents/technical-writer.agent.md +11 -9
  17. package/.github/agents/verifier.agent.md +15 -0
  18. package/.github/instructions/implement.instructions.md +12 -8
  19. package/.github/skills/git-ops/SKILL.md +6 -6
  20. package/.github/skills/memo-cli-usage/REFERENCE.md +11 -11
  21. package/.github/skills/memo-cli-usage/SKILL.md +11 -9
  22. package/.kiro/agents/developer.md +45 -31
  23. package/.kiro/agents/github-ops.md +2 -2
  24. package/.kiro/agents/planner.md +61 -13
  25. package/.kiro/agents/product-engineer.md +54 -8
  26. package/.kiro/agents/technical-writer.md +11 -9
  27. package/.kiro/agents/verifier.md +15 -0
  28. package/.kiro/hooks/scripts/git-guard.sh +96 -10
  29. package/.kiro/skills/git-ops/SKILL.md +6 -6
  30. package/.kiro/skills/memo-cli-usage/REFERENCE.md +11 -11
  31. package/.kiro/skills/memo-cli-usage/SKILL.md +11 -9
  32. package/.kiro/steering/implement.md +12 -8
  33. package/AGENTS.md +7 -5
  34. package/AGENTS.md.template +3 -1
  35. package/CHANGELOG.md +49 -0
  36. package/CLAUDE.md +2 -1
  37. package/CLAUDE.md.template +2 -1
  38. package/TESTING.md +47 -29
  39. package/dist/core/checks/decision-log-format.d.ts +24 -3
  40. package/dist/core/checks/decision-log-format.d.ts.map +1 -1
  41. package/dist/core/checks/decision-log-format.js +43 -3
  42. package/dist/core/checks/decision-log-format.js.map +1 -1
  43. package/package.json +8 -6
@@ -99,9 +99,10 @@ Follow `.github/instructions/implement.instructions.md`:
99
99
  - Run `git rev-parse --abbrev-ref HEAD` to determine the current branch.
100
100
  - If HEAD is the default branch (`main`) or does not match `issue/*` or `story/*` pattern, you **MUST** create a new branch before proceeding, then open the Draft PR immediately after the first commit on that branch. You **MUST NOT** write implementation code, create files, or make commits while on the default branch.
101
101
  - If HEAD is already a valid feature branch (matching `issue/*` or `story/*`), confirm the Draft PR exists and proceed. If the branch has no commits yet, no PR can exist — open it immediately after the first commit.
102
- 5. Execute one sub-task at a time in checklist order. For each behavioral sub-task, follow **test-first**: write/update tests first, verify they fail for the right reason, then implement to make them pass.
103
- 6. After each completed sub-task: mark `[x]` locally and in GitHub, pause for approval if step-gated.
104
- 7. When all sub-tasks are complete:
102
+ 5. **memo intent (when memo is available):** Before writing any implementation code, run the memo-cli Availability Check and write the intent entry (see **memo-cli Integration → Intent Entry**). Record `memo_intent` as `written(<id>)`, `failed(<reason>)`, or `skipped(<reason>)`.
103
+ 6. Execute one sub-task at a time in checklist order. For each behavioral sub-task, follow **test-first**: write/update tests first, verify they fail for the right reason, then implement to make them pass.
104
+ 7. After each completed sub-task: mark `[x]` locally and in GitHub, pause for approval if step-gated.
105
+ 8. When all sub-tasks are complete:
105
106
  - Verify all acceptance criteria.
106
107
 
107
108
  - Run mandatory quality gates and record results (`test`, `lint`, `format:check`, `typecheck`, `audit`; `validate` if available).
@@ -109,6 +110,7 @@ Follow `.github/instructions/implement.instructions.md`:
109
110
  - Invoke `qa-engineer` to run the testing-standard check and the coverage and gap report, and record `coverage_gate`. This runs before the `verifier` audit so the audit can consume the gap report as test evidence.
110
111
  - Invoke `verifier` in `audit` mode against the delivered implementation, and post its human-readable summary to the issue/PR via `github-ops` comment conventions. This step is mandatory and non-skippable; drift findings reported by `verifier` do not block this step or PR/issue completion.
111
112
  - Invoke `technical-writer` for documentation update and drift/stale-doc validation.
113
+ - Write the memo outcome entry (see **memo-cli Integration → Outcome Entry**) and record `memo_outcome` as `written(<id>)`, `failed(<reason>)`, or `skipped(<reason>)`.
112
114
  - Convert PR from Draft to Ready for Review.
113
115
 
114
116
  ---
@@ -173,11 +175,9 @@ When diagnosing a bug, regression, or unclear failure during implementation, you
173
175
 
174
176
  ### Bank Declaration
175
177
 
176
- This agent's bank id is `developer-memory`, stable for the agent's life (PRD §15). Export it before any memo command in the session:
178
+ This agent's bank id is `developer-memory`, stable for the agent's life (PRD §15). Every memo command below names it **literally** with `--bank developer-memory`.
177
179
 
178
- ```bash
179
- export MEMO_BANK=developer-memory
180
- ```
180
+ You **MUST NOT** rely on `export MEMO_BANK=…` from an earlier command, and **MUST NOT** write `--bank $MEMO_BANK`. Agent runtimes run each shell command in a fresh shell, so an exported variable is gone by the next call; an empty `$MEMO_BANK` is dropped by the shell and the flag parser takes the next token as the bank id (`--bank --rationale …` → bank `--rationale`), which memo-cli rejects with `VALIDATION_FAILED`. This is the defect that left consumer banks empty (issue #253).
181
181
 
182
182
  ### Availability Check
183
183
 
@@ -187,18 +187,19 @@ At the start of every execution session, check if memo-cli is configured:
187
187
  which memo && memo setup validate
188
188
  ```
189
189
 
190
- - If `memo` is not found, skip all memo operations silently.
191
- - If `memo` is found but validation fails, ask: "memo-cli is installed but not configured for this repository. Run `memo setup init --repo <repo> --org <org> --domain <domain>` to configure it."
190
+ - If `memo` is not found **and** `memo.config.json` does not exist, skip all memo operations and record `memo_intent: skipped(memo-not-installed)` / `memo_outcome: skipped(memo-not-installed)`.
191
+ - If `memo` is not found **but** `memo.config.json` exists, the repository expects memo: warn the user ("memo-cli is configured for this repository (`memo.config.json`) but the `memo` binary is not on PATH in this session — no memo entries will be written.") and record `skipped(memo-unavailable)` for both fields. Never skip silently in this case.
192
+ - If `memo` is found but validation fails, ask: "memo-cli is installed but not configured for this repository. Run `memo setup init --repo <repo> --org <org> --domain <domain>` to configure it." If the run continues without it, record `skipped(memo-not-configured)`.
192
193
 
193
194
  ### Session Start — Restore Context
194
195
 
195
196
  When memo is available and `memo --version` is `1.3.0` or later, restore context with a single call:
196
197
 
197
198
  ```bash
198
- memo recall "<story or issue description>" --bank $MEMO_BANK --json
199
+ memo recall "<story or issue description>" --bank developer-memory --json
199
200
  ```
200
201
 
201
- `recall` returns one bundle — SELF, POLICIES, SHARED, MINE, LAST SESSION, CONFLICTS — in a single `<4s` call (SELF/MINE/LAST SESSION are omitted when `$MEMO_BANK` is unset or resolves to `kb`). If `memo recall` exits `2` (embeddings failure), surface the warning on stderr and continue the session without recalled context rather than blocking.
202
+ `recall` returns one bundle — SELF, POLICIES, SHARED, MINE, LAST SESSION, CONFLICTS — in a single `<4s` call. If `memo recall` exits `2` (embeddings failure), surface the warning on stderr and continue the session without recalled context rather than blocking.
202
203
 
203
204
  **Fallback — `memo --version` is below `1.3.0`:** run the four-command sequence instead:
204
205
 
@@ -229,45 +230,55 @@ Choose the most specific entry type:
229
230
 
230
231
  ### Intent Entry — Before Starting a Story
231
232
 
232
- Write an intent entry **before beginning implementation** of any story or issue, as an episodic entry scoped to this session in this agent's bank:
233
+ Write an intent entry **before beginning implementation** of any story or issue (Execution Flow step 5), as an episodic entry scoped to this session in this agent's bank:
233
234
 
234
235
  ```bash
235
236
  memo write \
236
237
  --kind episodic \
237
238
  --session ISSUE-<n> \
238
- --bank $MEMO_BANK \
239
+ --bank developer-memory \
239
240
  --rationale "Context: Starting ISSUE-<##> because <trigger/need>. Decision: implement via <approach>, preserving <constraints/non-goals>, with expected files <key files>. Impact: affects <user/module/contract impact> and introduces risks <if any>." \
240
241
  --tags "<domain>,issue-<number>,intent,<impact-tag>[,<boundary-tag>]" \
241
- --entry-type decision \
242
- --source agent \
243
- --story "ISSUE-<number>" \
244
- --on-duplicate consolidate \
245
- --json
242
+ --entry-type decision \
243
+ --source agent \
244
+ --story "ISSUE-<number>" \
245
+ --on-duplicate consolidate \
246
+ --json
246
247
  ```
247
248
 
248
249
  ### Outcome Entry — After Completing a Story
249
250
 
250
- Write an outcome entry as part of the **Completion Gate**, after all tests pass and before converting the PR to Ready for Review, as an episodic entry scoped to this session in this agent's bank:
251
+ Write an outcome entry as part of the **Completion Gate** (Execution Flow step 8), after all tests pass and before converting the PR to Ready for Review, as an episodic entry scoped to this session in this agent's bank. Record what was learned, not only what shipped — a rejected approach, a surprise in the codebase, or a constraint discovered mid-story is the most valuable content of this entry:
251
252
 
252
253
  ```bash
253
254
  memo write \
254
255
  --kind episodic \
255
256
  --session ISSUE-<n> \
256
- --bank $MEMO_BANK \
257
- --rationale "Context: Completed ISSUE-<##> after implementing <scope>. Delivery: shipped <behavior>, deviations <none|details>, AC <x/y> verified. Impact: quality gates test=<pass|fail>; lint=<pass|fail>; format:check=<pass|fail>; typecheck=<pass|fail>; audit=<pass|fail>; docs=<clean|drift-fixed>; migration=<none|details>." \
258
- --tags "<domain>,issue-<number>,outcome,gates-pass[,<impact-tag>][,<boundary-tag>]" \
259
- --entry-type decision \
260
- --source agent \
261
- --commit "$(git rev-parse HEAD)" \
262
- --story "ISSUE-<number>" \
263
- --files "<comma-separated key files modified>" \
264
- --on-duplicate consolidate \
265
- --json
257
+ --bank developer-memory \
258
+ --rationale "Context: Completed ISSUE-<##> after implementing <scope>. Delivery: shipped <behavior>, deviations <none|details>, AC <x/y> verified. Learned: <rejected approaches, surprises, constraints discovered|none>. Impact: quality gates test=<pass|fail>; lint=<pass|fail>; format:check=<pass|fail>; typecheck=<pass|fail>; audit=<pass|fail>; docs=<clean|drift-fixed>; migration=<none|details>." \
259
+ --tags "<domain>,issue-<number>,outcome,gates-pass[,<impact-or-boundary-tag>]" \
260
+ --entry-type decision \
261
+ --source agent \
262
+ --commit "$(git rev-parse HEAD)" \
263
+ --story "ISSUE-<number>" \
264
+ --files "<comma-separated key files modified>" \
265
+ --on-duplicate consolidate \
266
+ --json
266
267
  ```
267
268
 
269
+ memo-cli accepts 2–5 tags per entry and rejects more with `VALIDATION_FAILED`; keep both templates within that limit.
270
+
268
271
  Session sequence numbers (`--seq`) auto-increment per `--session`; do not pass `--seq` explicitly unless replaying a specific position.
269
272
 
270
- ADR and durable-decision entries are **not** written by `developer` — they stay `--kind semantic` in `kb`, authored by `technical-writer` with `--provenance <csv>` (citing the episodic ids that informed the decision) or `--manual`, per PRD K3.
273
+ ### Write Results Are Recorded, Never Swallowed
274
+
275
+ Every `memo write` above returns JSON with the new entry's `id` on success, and a non-zero exit with an error on failure.
276
+
277
+ - On success, record the id: `memo_intent: written(<id>)` / `memo_outcome: written(<id>)`.
278
+ - On failure, read the error, fix the command if the error names a flag or value you supplied, and retry **once**. If it still fails, record `failed(<error code or first line of the error>)` and state it in the closeout summary. A failed memo write does not block the story, but it **MUST NOT** be dropped silently.
279
+ - Both fields are **mandatory** in the closeout payload. Omitting either one marks the story incomplete.
280
+
281
+ ADR and durable-decision entries are **not** written by `developer` — they stay `--kind semantic` in `kb`, authored by `technical-writer` and `product-engineer`, per PRD K3.
271
282
 
272
283
  ### Session Close
273
284
 
@@ -288,7 +299,7 @@ Before marking a Story/Issue done:
288
299
  7. `technical-writer` agent **MUST** have run and produced both a delta report and a drift/stale-doc validation result.
289
300
  8. `/docs` **MUST** be updated to current state.
290
301
  9. `/workstream` **SHOULD** be cleaned (active artifacts retained, obsolete artifacts archived/removed).
291
- 10. If memo-cli is available, an episodic outcome entry **MUST** be written to `$MEMO_BANK` (`memo write --kind episodic --session ISSUE-<n> --bank $MEMO_BANK …`) before PR conversion.
302
+ 10. The memo intent and outcome writes **MUST** have been attempted when memo-cli is available (`memo write --kind episodic --session ISSUE-<n> --bank developer-memory …`, before PR conversion), and `memo_intent` / `memo_outcome` **MUST** be recorded as `written(<id>)`, `failed(<reason>)`, or `skipped(<reason>)`. A `failed` or `skipped` value does not block completion; an omitted field does.
292
303
  11. PR **MUST** be ready, approved, and merged.
293
304
  12. You **MUST NOT** close the GitHub Issue until all conditions above are met.
294
305
  13. For multi-story implementations, you **MUST** run a checklist cross-check between GitHub Issue tasks and `/workstream/tasks-*.md` and report any mismatch resolution.
@@ -349,6 +360,8 @@ workstream_files:
349
360
  - typecheck: PASS | FAIL | NOT RUN
350
361
  - audit: PASS | FAIL | NOT RUN
351
362
  coverage_gate: PASS | FAIL | SKIPPED(<reason>)
363
+ memo_intent: written(<id>) | failed(<reason>) | skipped(<reason>)
364
+ memo_outcome: written(<id>) | failed(<reason>) | skipped(<reason>)
352
365
  checklist_sync: synced | mismatch-fixed | blocked
353
366
  verifier_audit: run | blocked
354
367
  fidelity_verdict: High | Medium | Low | none
@@ -362,6 +375,7 @@ Rules for this payload:
362
375
 
363
376
  - The markers `BEGIN CLOSEOUT PAYLOAD` and `END CLOSEOUT PAYLOAD` **MUST** appear exactly as written.
364
377
  - Every field is required. Use `none`, `NOT RUN`, or `blocked` when a value does not exist.
378
+ - `memo_intent` and `memo_outcome` are always present. `skipped(<reason>)` (memo not installed, not configured, or unavailable in this session) and `failed(<reason>)` (the write was attempted and errored after one retry) are valid values that do not block the merge; `planner` treats an absent field as an incomplete story.
365
379
  - `planner` may treat the story as incomplete if either marker or any required field is missing.
366
380
 
367
381
  Do not dump full files unless explicitly requested.
@@ -45,7 +45,7 @@ Use this table to translate each convention in this file into a `gh` invocation
45
45
  | Update PR | `gh pr edit <number> --title "<title>" --body "<body>"` | `update_pull_request` |
46
46
  | Comment on PR | `gh pr comment <number> --body "<comment>"` | `add_issue_comment` (PRs share issue comments) |
47
47
  | Review a PR | `gh pr review <number> --approve\|--request-changes\|--comment --body "<comment>"` | `create_pull_request_review` |
48
- | Merge PR (integration branch only, planner-authorized) | `gh pr merge <number> --squash --delete-branch` | `merge_pull_request` |
48
+ | Merge PR (integration branch only, planner-authorized) | `gh pr merge <number> --merge --delete-branch` | `merge_pull_request` |
49
49
  | List/audit PRs | `gh pr list --state all --json number,title,body,baseRefName,headRefName,labels --limit 500` | `list_pull_requests` |
50
50
  | Create/list labels | `gh label create "<name>" --color "<hex>" --description "<desc>"` / `gh label list` | `create_label` / `list_labels` |
51
51
  | Create/list milestones | `gh api repos/<owner>/<repo>/milestones -f title="<title>" -f description="<desc>" -f due_on="<ISO date>"` / `gh api repos/<owner>/<repo>/milestones` | (no dedicated MCP tool; use REST) |
@@ -263,7 +263,7 @@ Rules:
263
263
 
264
264
  ## Branch-Type Merge Rules
265
265
 
266
- - Issue and story PRs **MUST** merge by squash with source-branch deletion. The planner merges them into an integration branch; the user merges them into `main`.
266
+ - Issue and story PRs **MUST** merge by merge commit with source-branch deletion (`--merge --delete-branch`), so the per-task commits are preserved. Squash and rebase merges are **NOT** used unless the user explicitly asks for one on a specific PR. The planner merges them into an integration branch; the user merges them into `main`.
267
267
  - Integration PRs **MUST** merge into `main` by merge commit, and only the user may merge them.
268
268
 
269
269
  ---
@@ -51,13 +51,39 @@ If any required input is missing, ask one focused question with a default option
51
51
 
52
52
  ### Bank Declaration
53
53
 
54
- This agent's bank id is `planner-memory`, stable for the agent's life (PRD §15). Export it before any memo command in the session:
54
+ This agent's bank id is `planner-memory`, stable for the agent's life (PRD §15). Name it **literally** in every memo command (`--bank planner-memory`); never rely on an `export MEMO_BANK=…` from an earlier command and never write `--bank $MEMO_BANK` — each shell command runs in a fresh shell, the variable is empty, and memo-cli rejects the resulting bank id (issue #253).
55
+
56
+ ### Availability Check
57
+
58
+ At the start of every run:
55
59
 
56
60
  ```bash
57
- export MEMO_BANK=planner-memory
61
+ which memo && memo setup validate
58
62
  ```
59
63
 
60
- `planner` does not read or write memo entries itself — orchestration-scoped context comes from the task file/GitHub milestone, and each delegated `developer` subagent runs its own `memo recall`/`memo write` sequence scoped to `developer-memory`. This declaration exists for AC parity with the other long-lived agent definitions and for any future orchestration-level use of `--bank $MEMO_BANK`.
64
+ - If `memo` is not found and `memo.config.json` does not exist, skip all memo operations.
65
+ - If `memo` is not found but `memo.config.json` exists, warn the user that the repository expects memo-cli but the binary is not on PATH in this session, and record `memo_run_outcome: skipped(memo-unavailable)`. Never skip silently in this case.
66
+
67
+ ### Responsibilities
68
+
69
+ - **Per story — verify, don't write.** Each delegated `developer` subagent writes its own intent/outcome entries to `developer-memory`. Planner verifies them through the closeout payload's `memo_intent` / `memo_outcome` fields (merge gate 3). An absent field means the story is incomplete; `skipped(<reason>)` or `failed(<reason>)` is reported in the story status table and does not block the merge.
70
+ - **Per run — write one outcome entry.** Before opening the consolidated PR (Phase 5 step 6), write one episodic entry summarizing the run:
71
+
72
+ ```bash
73
+ memo write \
74
+ --kind episodic \
75
+ --session <plan-id> \
76
+ --bank planner-memory \
77
+ --rationale "Context: Ran <plan-id> (<PRD/milestone>, <roadmap phase/wave>). Delivery: <n> stories merged, <n> blocked, integration branch <branch>. Learned: <recurring failures, rework, dependency surprises, gates that caught real problems|none>. Memo coverage: <n>/<n> stories with written intent+outcome; <skipped/failed summary|none>." \
78
+ --tags "<domain>,<plan-id>,run-outcome,<roadmap-phase-tag>" \
79
+ --entry-type decision \
80
+ --source agent \
81
+ --commit "$(git rev-parse HEAD)" \
82
+ --on-duplicate consolidate \
83
+ --json
84
+ ```
85
+
86
+ Record the result as `memo_run_outcome: written(<id>) | failed(<reason>) | skipped(<reason>)` in the planner state file and the consolidated PR body. On failure, fix the command if the error names a flag or value you supplied and retry once; never drop a failure silently.
61
87
 
62
88
  ### Session Close
63
89
 
@@ -102,6 +128,10 @@ Expected return for each issue:
102
128
 
103
129
  Map milestone issues into the same internal story model used by Option A.
104
130
 
131
+ ### Roadmap Read
132
+
133
+ Read `docs/roadmap.md` (the roadmap overview — see **Roadmap Maintenance** below). Identify the PRD and the phase/wave row this run delivers, and state it when confirming the source. If the file is missing, or no row matches this run's scope, say so and ask `product-engineer` (or the user) to add the row before Phase 4; do not invent a row's scope yourself.
134
+
105
135
  Confirm source and story count before Phase 0.5.
106
136
 
107
137
  ---
@@ -330,6 +360,7 @@ Integration target branch: {{ integration_branch }}
330
360
  Test-first: YES — write/update tests before implementation for each behavioral sub-task
331
361
  Test plan: {{ test_plan_path | default: "none — derive tests from acceptance criteria" }}
332
362
  Decision log: {{ decision_log_path }}
363
+ Memo: if memo-cli is available, write the intent entry before coding and the outcome entry before PR conversion, with `--bank developer-memory` named literally; return `memo_intent` and `memo_outcome` in the closeout payload
333
364
 
334
365
  Implement only this story scope.
335
366
  Follow test-first design: for each behavioral sub-task, write tests first, verify they fail, then implement.
@@ -415,7 +446,7 @@ For each completed story PR:
415
446
 
416
447
  1. Verify PR base branch is the integration branch.
417
448
  2. Verify required checks are successful.
418
- 3. Verify delegated closeout payload reports `docs_drift_status` as `clean` or `drift-fixed`.
449
+ 3. Verify delegated closeout payload reports `docs_drift_status` as `clean` or `drift-fixed`, and carries both `memo_intent` and `memo_outcome` fields. An absent memo field marks the story incomplete (retry the closeout once, as for any missing payload field); a `skipped(<reason>)` or `failed(<reason>)` value is recorded in the story status table and does **NOT** block the merge.
419
450
  4. Verify delegated quality gates are all `PASS` (`test`, `lint`, `format:check`, `typecheck`, `audit`).
420
451
  5. Verify the delegated closeout payload reports `coverage_gate` with a value of `PASS`, `FAIL`, or `SKIPPED(<reason>)` carrying a non-empty reason. An omitted field means the QA gate was never reached — treat the story as incomplete. A `FAIL` or `SKIPPED` value does **NOT** block the merge; only omission does.
421
452
  6. Verify the delegated closeout payload reports `verifier_audit: run` — this confirms `developer` invoked the mandatory `verifier` audit for this story. This check is a merge gate on trigger evidence only; the audit's drift findings (`fidelity_verdict`/`highest_drift_impact`/`drift_findings`) **MUST NOT** block the merge.
@@ -423,7 +454,7 @@ For each completed story PR:
423
454
  8. Verify branch is up to date with integration branch (update/rebase if required by policy). Use the `git-ops` skill for rebase and conflict resolution.
424
455
  9. Detect merge conflicts before attempting merge. If conflicts are found, invoke the `git-ops` skill to resolve them.
425
456
  10. **Review the PR** — planner **MUST** review the story PR (verify scope, files, test and quality-gate results) and approve it.
426
- 11. Merge PR into integration branch using one consistent strategy (default: `squash`).
457
+ 11. Merge PR into integration branch using one consistent strategy (default: `merge`, a merge commit with source-branch deletion; never squash or rebase unless the user explicitly asks for it).
427
458
  12. Confirm integration branch is green after merge before moving to next story.
428
459
  13. **Write checkpoint** — update the planner state file (see Phase 0.5 State File Format), mark the completed story as `✅ Merged` with its PR link and branch name, update `Current Position` to the next pending story, update the `Last updated` timestamp, and post a GitHub Issue comment on the plan/milestone issue with the current story status table.
429
460
 
@@ -452,14 +483,18 @@ After all stories are merged into integration:
452
483
  2. Invoke `qa-engineer` at **PRD scope** (all packages affected by the merged stories, all layers) for a coverage and gap rollup. Report a PRD-level `coverage_gate` that aggregates per-story gates. Scope to packages affected by the merged stories, not the entire workspace.
453
484
  3. Invoke `verifier` in `audit` mode for a **PRD-level rollup audit** against the full integrated scope (all merged stories on the integration branch, cross-checked against the source PRD/spec/milestone). This is mandatory and non-skippable — it runs whether or not any story-level drift was previously reported. Post the resulting human-readable summary to the plan/milestone issue via `github-ops` comment conventions. Rollup drift findings **MUST NOT** block the consolidated PR handoff; Unintended/Intended drift routes to `product-engineer`'s `activity-drift-reconciliation` flow.
454
485
  4. Invoke `technical-writer` for a planner-level drift/stale-doc validation pass against integrated changes; unresolved drift **MUST** block handoff.
455
- 5. Open one consolidated PR from integration branch to `main`.
456
- 6. **Do NOT merge.** Notify the user that the consolidated PR is ready for their review.
457
- 7. Wait for the user to approve and merge the PR into `main`.
458
- 8. **Post-integration deploy handoff (conditional).** When the merged scope includes deployable changes and the repository declares environments in `infra/environments.yaml`, planner **MUST** hand the deploy off to `infra-engineer` rather than running any platform write or deploy command itself. This handoff is conditional — it applies only when infrastructure/deploy scope is present; a docs- or test-only integration triggers no deploy. Planner names `infra-engineer` as the owner of the post-integration deploy (dev on merge to `main`, production behind the protected-environment reviewer on the release tag via the `deploy-ops` workflow templates) and never invokes `deploy.sh`, `release.sh`, `flyctl`, `aws`, or `supabase` directly.
459
- 9. Before final handoff, **MUST** ensure the local working branch is the integration branch used for this run:
460
- - Preferred: run `git checkout integration/<plan-id>-<short-description>`.
461
- - Alternative (if checkout is not possible in the current runtime): explicitly verify and report current branch, and provide the exact checkout command the user can run.
462
- 10. Final user response **MUST** include a `PR Directives (User Action Required)` section with:
486
+ 5. **Roadmap update (mandatory).** Update the run's row(s) in `docs/roadmap.md` on the integration branch, so the change ships in the consolidated PR itself: set `Status` (`Done` when every story in the phase/wave merged, otherwise `In progress`), fill `Issues/PRs` with the story issues and the consolidated PR, rewrite `What's missing` to the remaining scope (`—` when none), and set the `Last updated` date. A consolidated PR without this roadmap change is incomplete. See **Roadmap Maintenance** below.
487
+ 6. **memo run outcome.** Write the per-run outcome entry described in **memo-cli Integration → Responsibilities** and record `memo_run_outcome`.
488
+ 7. Open one consolidated PR from integration branch to `main`.
489
+ 8. **Do NOT merge.** Notify the user that the consolidated PR is ready for their review.
490
+ 9. Wait for the user to approve and merge the PR into `main`.
491
+ 10. **Post-integration deploy handoff (conditional).** When the merged scope includes deployable changes and the repository declares environments in `infra/environments.yaml`, planner **MUST** hand the deploy off to `infra-engineer` rather than running any platform write or deploy command itself. This handoff is conditional — it applies only when infrastructure/deploy scope is present; a docs- or test-only integration triggers no deploy. Planner names `infra-engineer` as the owner of the post-integration deploy (dev on merge to `main`, production behind the protected-environment reviewer on the release tag via the `deploy-ops` workflow templates) and never invokes `deploy.sh`, `release.sh`, `flyctl`, `aws`, or `supabase` directly.
492
+ 11. Before final handoff, **MUST** ensure the local working branch is the integration branch used for this run:
493
+
494
+ - Preferred: run `git checkout integration/<plan-id>-<short-description>`.
495
+ - Alternative (if checkout is not possible in the current runtime): explicitly verify and report current branch, and provide the exact checkout command the user can run.
496
+
497
+ 12. Final user response **MUST** include a `PR Directives (User Action Required)` section with:
463
498
 
464
499
  - consolidated PR URL
465
500
  - current CI/check status
@@ -473,6 +508,8 @@ Consolidated PR should include:
473
508
  - Per-story changed files and test results
474
509
  - Manual validation instructions per story
475
510
  - Integration test summary
511
+ - Roadmap row(s) updated in `docs/roadmap.md` (before → after status)
512
+ - Memo coverage: per-story `memo_intent` / `memo_outcome` values and `memo_run_outcome`
476
513
 
477
514
  PR title **MUST** follow Conventional Commits and PR body **MUST** follow `github-ops` conventions.
478
515
 
@@ -480,6 +517,17 @@ Planner **MUST NOT** merge the consolidated PR. Only the user may approve and me
480
517
 
481
518
  ---
482
519
 
520
+ ## Roadmap Maintenance
521
+
522
+ `docs/roadmap.md` is the one-page overview of every PRD's phases or waves: what is done, what is in progress, and what is missing. It is an index over the PRDs, GitHub issues, and merged PRs — when they disagree, they win and the roadmap is corrected.
523
+
524
+ - **Read** it in Phase 0 (see **Roadmap Read**).
525
+ - **Update** the run's row(s) in Phase 5 step 5, in the consolidated PR. Never leave the roadmap claiming `In progress` for a phase this run finished, or `Done` for one it did not.
526
+ - Change only the rows this run touched; rows for other PRDs belong to `product-engineer` and to the planner runs that deliver them.
527
+ - The `verifier` rollup audit (Phase 5 step 3) compares the roadmap against merged work and reports a mismatch as an advisory finding.
528
+
529
+ ---
530
+
483
531
  ## Error Handling
484
532
 
485
533
  | Situation | Action |
@@ -61,17 +61,38 @@ If any required input is missing, you **MUST** ask concise clarifying questions.
61
61
 
62
62
  ---
63
63
 
64
- ## memo-cli Integration (When Available)
64
+ ## Roadmap Maintenance
65
65
 
66
- ### Bank Declaration
66
+ `docs/roadmap.md` is the one-page overview of every PRD's phases or waves: what is done, what is in progress, and what is missing. `product-engineer` owns its rows and structure; `planner` updates the status of the rows a run delivers. It is an index over the PRDs, GitHub issues, and merged PRs — when they disagree, they win and the roadmap is corrected.
67
67
 
68
- This agent's bank id is `product-engineer-memory`, stable for the agent's life (PRD §15). Export it before any memo command in the session:
68
+ - **Read it at session start**, in every mode, before any activity, so a new PRD or issue is placed against what already exists and what is still missing.
69
+ - **Create it** in Init Mode, or the first time a PRD is written in a repository that has none, from the template shape below.
70
+ - **Add rows when a PRD is created or changed** (`activity-refine`): one row per delivery phase or wave the PRD defines, or a single `All` row when it defines none, each `Not started`. A PRD changelog that adds, removes, or re-scopes a phase updates its rows in the same change.
71
+ - **Fill `Issues/PRs` when stories are published** (`activity-publish-github`), and set the row to `In progress` once its first story is being implemented.
72
+ - **Correct it during drift reconciliation** (`activity-drift-reconciliation`) when a `verifier` roadmap-mismatch finding is confirmed.
73
+ - Never mark a row `Done` yourself on the strength of a plan; `Done` requires merged work, and `planner` sets it in the consolidated PR that delivers it.
69
74
 
70
- ```bash
71
- export MEMO_BANK=product-engineer-memory
75
+ Shape (one table, one row per PRD phase or wave, newest PRD first):
76
+
77
+ ```markdown
78
+ # Roadmap
79
+
80
+ Last updated: YYYY-MM-DD
81
+
82
+ | PRD | Phase/Wave | Scope (one line) | Status | Issues/PRs | What's missing |
83
+ | ---------------------------------------- | ---------- | ---------------- | ----------- | ----------- | ---------------- |
84
+ | [prd-<name>](requirements/prd-<name>.md) | 1 | <scope> | Not started | #12, PR #20 | <remaining or —> |
72
85
  ```
73
86
 
74
- `product-engineer` does not write episodic or semantic entries itself (see below), so this declaration exists for AC parity with the other long-lived agent definitions and for any future read-side use of `--bank $MEMO_BANK`.
87
+ `Status` is exactly one of `Not started`, `In progress`, `Done`.
88
+
89
+ ---
90
+
91
+ ## memo-cli Integration (When Available)
92
+
93
+ ### Bank Declaration
94
+
95
+ This agent's bank id is `product-engineer-memory`, stable for the agent's life (PRD §15). The decisions this agent records go to the shared `kb` (see **Decision Write-Back** below), not its private bank. Name the bank **literally** in every memo command (`--bank kb`); never rely on an `export MEMO_BANK=…` from an earlier command and never write `--bank $MEMO_BANK` — each shell command runs in a fresh shell, the variable is empty, and memo-cli rejects the resulting bank id (issue #253).
75
96
 
76
97
  ### Availability Check
77
98
 
@@ -81,7 +102,8 @@ At the start of every session, verify memo-cli is configured:
81
102
  which memo && memo setup validate
82
103
  ```
83
104
 
84
- - If `memo` is not found, skip all memo operations silently.
105
+ - If `memo` is not found and `memo.config.json` does not exist, skip all memo operations.
106
+ - If `memo` is not found but `memo.config.json` exists, warn the user that the repository expects memo-cli but the binary is not on PATH in this session, so no decisions will be recorded in memo. Never skip silently in this case.
85
107
  - If `memo` is found but validation fails, ask: "memo-cli is installed but not configured for this repository. Run `memo setup init --repo <repo> --org <org> --domain <domain>` to configure it."
86
108
 
87
109
  ### Session Start — Restore Context
@@ -125,7 +147,31 @@ Before making design choices in `activity-refine`, `activity-generate-spec`, or
125
147
  memo search "<specific topic, technology, or module>" --json
126
148
  ```
127
149
 
128
- **product-engineer does NOT write to memo.** All writes are delegated to `technical-writer` (ADRs and doc changes) and `developer` (intent/outcome entries).
150
+ ### Decision Write-Back — After Each Grilling Exit Gate
151
+
152
+ The decisions made with the user during refinement and specification are the most durable knowledge the workflow produces; they **MUST** reach memo, not only `workstream/decisions-<feature>.md`.
153
+
154
+ When `activity-grill`'s exit gate is satisfied (the WHAT phase in `activity-refine`, the HOW phase in `activity-generate-spec`, or Issue Mode refinement), write **one `kb` entry per user-answered decision row** recorded in that phase. Skip self-resolved rows (`Accepted rec.` is `n/a`): they restate knowledge that already exists. Do not batch several decisions into one entry.
155
+
156
+ ```bash
157
+ memo write \
158
+ --kind semantic \
159
+ --bank kb \
160
+ --manual \
161
+ --rationale "<feature>#D-NN (<WHAT|HOW>): <question in one sentence>. Decided: <answer>. Why: <reason given or the accepted recommendation's reasoning>. Rejected: <alternatives considered|none>." \
162
+ --tags "<domain>,<feature>,decision,<phase-lowercase>,<feature>-d-NN" \
163
+ --entry-type decision \
164
+ --story "<issue-or-feature-id-if-known>" \
165
+ --files "workstream/decisions-<feature>.md" \
166
+ --on-duplicate consolidate \
167
+ --json
168
+ ```
169
+
170
+ - `--manual` is correct here: the decision was made by the user in conversation, so it has no episodic provenance, and memo-cli rejects an agent-sourced semantic entry without one.
171
+ - A row that supersedes an earlier decision is written as a new entry naming the superseded ID in its rationale; `--on-duplicate consolidate` merges near-duplicates.
172
+ - **Write results are recorded, never swallowed.** Report the written ids (or `skipped(<reason>)`) in the phase's completion summary. On failure, fix the command if the error names a flag or value you supplied and retry once; then report `failed(<error>)`. A failed write never blocks the phase.
173
+
174
+ `technical-writer` still owns ADR and doc-change entries, and `developer` owns per-story intent/outcome entries.
129
175
 
130
176
  ### Session Close
131
177
 
@@ -323,13 +323,9 @@ Ensure:
323
323
 
324
324
  ### Bank Declaration
325
325
 
326
- This agent's bank id is `technical-writer-memory`, stable for the agent's life (PRD §15). Export it before any memo command in the session:
326
+ This agent's bank id is `technical-writer-memory`, stable for the agent's life (PRD §15). Name banks **literally** in every memo command (`--bank kb`, `--bank technical-writer-memory`); never rely on an `export MEMO_BANK=…` from an earlier command and never write `--bank $MEMO_BANK` — each shell command runs in a fresh shell, the variable is empty, and memo-cli rejects the resulting bank id (issue #253).
327
327
 
328
- ```bash
329
- export MEMO_BANK=technical-writer-memory
330
- ```
331
-
332
- ADR and decision entries this agent writes stay `--kind semantic` in `kb` (never in `$MEMO_BANK`) — see **Write Template** below.
328
+ ADR and decision entries this agent writes stay `--kind semantic` in `kb` (never in its private bank) — see **Write Template** below.
333
329
 
334
330
  ### Availability Check
335
331
 
@@ -339,7 +335,8 @@ At the start of every run, check if memo-cli is configured:
339
335
  which memo && memo setup validate
340
336
  ```
341
337
 
342
- - If `memo` is not found, skip all memo operations silently.
338
+ - If `memo` is not found and `memo.config.json` does not exist, skip all memo operations.
339
+ - If `memo` is not found but `memo.config.json` exists, warn the user that the repository expects memo-cli but the binary is not on PATH in this session, and report `memo: skipped(memo-unavailable)` in the run summary. Never skip silently in this case.
343
340
  - If `memo` is found but validation fails (missing `memo.config.json` or env vars), **STOP** and ask: "memo-cli is installed but not configured for this repository. Run `memo setup init --repo <repo> --org <org> --domain <domain>` to configure it, then re-run."
344
341
 
345
342
  ### Read Before Write
@@ -380,7 +377,7 @@ memo write \
380
377
  --tags "<domain-tag>,<entry-nature-tag>,<story-ref-if-known>" \
381
378
  --entry-type <decision|structure|integration_point> \
382
379
  --source agent \
383
- --provenance "<csv of episodic entry ids this decision consolidates, if any>" \
380
+ --provenance "<csv of episodic entry ids this decision consolidates>" \
384
381
  --commit "$(git rev-parse HEAD)" \
385
382
  --story "<issue-or-story-id-if-known>" \
386
383
  --files "<path/to/doc.md>,<path/to/adr.md>" \
@@ -388,7 +385,12 @@ memo write \
388
385
  --json
389
386
  ```
390
387
 
391
- ADR and durable-decision entries are always `--kind semantic` in `kb`, never in `$MEMO_BANK` — this agent is the one long-lived agent that writes to the shared `kb`, not a private bank. Per PRD K3, a `semantic` entry with `--source agent` **MUST** carry `--provenance <csv>` (the episodic entry ids — typically `developer`'s intent/outcome entries — that informed the decision) unless `--manual` is passed instead (human-authored, no episodic origin).
388
+ ADR and durable-decision entries are always `--kind semantic` in `kb`, never in a private bank. Per PRD K3, memo-cli **rejects** a `semantic` entry with `--source agent` and no provenance (`VALIDATION_FAILED`), so choose exactly one form:
389
+
390
+ - **Provenance known:** find the episodic ids that informed the decision — typically `developer`'s intent/outcome entries for the story — with `memo list --bank developer-memory --session ISSUE-<n> --json`, and pass them as `--source agent --provenance "<id1>,<id2>"`.
391
+ - **No episodic ids found:** drop both `--source agent` and `--provenance`, and pass `--manual` instead. Never pass an empty `--provenance ""`.
392
+
393
+ **Write results are recorded, never swallowed.** On success, the JSON response carries the entry `id`; list every written id in the run summary. On failure, fix the command if the error names a flag or value you supplied and retry once; if it still fails, report `memo: failed(<error>)` in the run summary. A failed write does not block the documentation run, but it **MUST NOT** be dropped silently.
392
394
 
393
395
  **Rationale quality rule:** Answer three questions in one coherent paragraph: (1) what changed and why it was needed, (2) what was decided or documented, (3) what it affects downstream. Never use bullet points inside `--rationale`.
394
396
 
@@ -245,6 +245,21 @@ new category. Never hold a PR on it.
245
245
  | Test-harness setup | `qa-engineer` |
246
246
  | Tooling setup | `housekeeping` |
247
247
 
248
+ ## Roadmap-Mismatch Finding
249
+
250
+ `docs/roadmap.md` is the one-page index of every PRD's phases or waves and their status. It goes stale silently unless something compares it with what actually merged, so that comparison lives here as a finding.
251
+
252
+ **Trigger** (PRD-level rollup audits, and story audits whose story completes a phase or wave). Report the finding when any of these hold:
253
+
254
+ 1. The audited work completes a PRD phase or wave, and its roadmap row is not `Done` in the delivered tree.
255
+ 2. A roadmap row is `Done`, but the audited scope shows that phase's stories unmerged or its acceptance criteria unmet.
256
+ 3. The audited PRD defines a phase or wave with no roadmap row, or `docs/roadmap.md` is missing while `docs/requirements/` holds a PRD.
257
+ 4. A row's `Issues/PRs` or `What's missing` contradicts the audited issues and PRs.
258
+
259
+ **Not a finding:** rows for PRDs outside the audited scope; a row left `In progress` while some of its stories are still open.
260
+
261
+ **The finding is advisory.** Like every other drift item it is **non-blocking to PR readiness and to issue completion**, and it routes to `product-engineer`'s `activity-drift-reconciliation` flow, which corrects the row. Classify it with the existing impact/intent vocabulary. Never hold a PR on it.
262
+
248
263
  ## Failure Triage Workflow (Randomized Tests)
249
264
 
250
265
  When a randomized or fuzz test fails, follow this sequence:
@@ -77,6 +77,7 @@ fix(web): stop double-submitting the checkout form
77
77
  - PR title **MUST** follow Conventional Commits (e.g., `feat: implement issue 37`).
78
78
  - PR description **MUST** include `Closes #<issue-number>`.
79
79
  5. You **MUST** ensure the task list in the GitHub Issue matches the local `/workstream/tasks-*.md` file.
80
+ 6. **memo intent (when memo-cli is available):** Before the first implementation sub-task, you **MUST** run the memo-cli Availability Check and write the episodic intent entry defined in the `developer` agent contract (**memo-cli Integration → Intent Entry**), naming the bank literally (`--bank developer-memory`, never `--bank $MEMO_BANK`). Record `memo_intent` as `written(<id>)`, `failed(<reason>)`, or `skipped(<reason>)` — a failed write is retried once and then reported, never dropped silently.
80
81
 
81
82
  If `github-ops` delegation is unavailable in the current runtime, you **MUST** apply `github-ops` conventions directly and explicitly note that fallback in your status output.
82
83
 
@@ -143,14 +144,17 @@ When `workstream/decisions-<feature>.md` exists and was read per step 2 above:
143
144
  5. `technical-writer` validation **MUST** include a drift/stale-doc check report, and completion **MUST NOT** proceed while unresolved drift remains.
144
145
  6. A `qa-engineer` pass **MUST** have run and `coverage_gate` **MUST** be recorded as `PASS`, `FAIL`, or `SKIPPED(<reason>)`. The reason **MUST** be non-empty when skipped; an omitted field is treated as incomplete. A `FAIL` or `SKIPPED` value does not block completion — only omission does.
145
146
  7. A `verifier` audit in `audit` mode **MUST** have run against the delivered implementation, with its human-readable summary posted to the issue/PR. This gate is mandatory and non-skippable — it **MUST NOT** be skipped regardless of drift findings, and drift findings reported by this audit **MUST NOT** block completion. This condition is satisfied once the audit has run and been posted; any resulting drift is handled by `product-engineer`'s `activity-drift-reconciliation` flow after this gate, not before it.
146
- 8. The PR **MUST** be converted from draft to ready for review.
147
- 9. The PR **MUST** be approved by the appropriate reviewer per the merge authority policy in `github-ops`:
148
- - PRs targeting an **integration branch**: `planner` reviews and approves.
149
- - PRs targeting **`main`**: the **user** reviews and approves.
150
- 10. The PR **MUST** be merged by the authorized party (planner for integration branches, user for `main`).
151
- 11. You **MUST NOT** close the GitHub Issue until the PR is approved **AND** merged.
152
- 12. You **MUST NOT** close the issue while the PR is still in draft or pending review.
153
- 13. You **MUST** notify the user when the PR is ready for review — explicitly inform them so they can review and merge.
147
+ 8. **memo outcome (when memo-cli is available):** Before the PR is converted to ready for review, you **MUST** write the episodic outcome entry defined in the `developer` agent contract (**memo-cli Integration → Outcome Entry**) and record `memo_outcome` as `written(<id>)`, `failed(<reason>)`, or `skipped(<reason>)`. A `failed` or `skipped` value does not block completion — only an omitted field does.
148
+ 9. The PR **MUST** be converted from draft to ready for review.
149
+ 10. The PR **MUST** be approved by the appropriate reviewer per the merge authority policy in `github-ops`:
150
+
151
+ - PRs targeting an **integration branch**: `planner` reviews and approves.
152
+ - PRs targeting **`main`**: the **user** reviews and approves.
153
+
154
+ 11. The PR **MUST** be merged by the authorized party (planner for integration branches, user for `main`).
155
+ 12. You **MUST NOT** close the GitHub Issue until the PR is approved **AND** merged.
156
+ 13. You **MUST NOT** close the issue while the PR is still in draft or pending review.
157
+ 14. You **MUST** notify the user when the PR is ready for review — explicitly inform them so they can review and merge.
154
158
 
155
159
  ---
156
160
 
@@ -91,13 +91,13 @@ Before merging any PR or branch, verify:
91
91
 
92
92
  Choose the appropriate strategy based on context:
93
93
 
94
- | Strategy | When to Use | Command |
95
- | ---------------- | ----------------------------------------------------------------------------------- | ------------------------------------------- |
96
- | **Squash merge** | Issue/story PRs → integration (planner) or `main` (user); delete the source branch. | `gh pr merge <pr> --squash --delete-branch` |
97
- | **Merge commit** | Integration PRs → `main` (user); preserve the story history. | `gh pr merge <pr> --merge` |
98
- | **Rebase merge** | Not part of the issue/story/integration policy; use only when explicitly approved. | `gh pr merge <pr> --rebase` |
94
+ | Strategy | When to Use | Command |
95
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
96
+ | **Merge commit** | **Default for every PR.** Issue/story PRs → integration (planner) or `main` (user), and integration PRs → `main` (user). Preserves every commit. | `gh pr merge <pr> --merge --delete-branch` |
97
+ | **Squash merge** | Not part of the policy; use only when the user explicitly asks for a single-commit history on a specific PR. | `gh pr merge <pr> --squash --delete-branch` |
98
+ | **Rebase merge** | Not part of the policy; use only when the user explicitly approves it on a specific PR. | `gh pr merge <pr> --rebase` |
99
99
 
100
- **Default**: Issue/story PRs use squash with branch deletion; integration PRs use a merge commit. Planner handles integration targets, and the user handles `main`.
100
+ **Default**: Every PR merges by merge commit, so the per-task Conventional Commits survive to `main`. Issue/story PRs also delete the source branch. Planner handles integration targets, and the user handles `main`. Never squash or rebase unless the user asks for it on a specific PR.
101
101
 
102
102
  ### 6. Resolve Merge Conflicts
103
103