@jaybeeuu/agent-cortex 1.41.1 → 1.43.0

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 (115) hide show
  1. package/.agents/skills/style-versioning/SKILL.md +73 -2
  2. package/.github/workflows/ci.yml +52 -32
  3. package/AGENTS.md +23 -2
  4. package/CHANGELOG.md +189 -0
  5. package/README.md +125 -73
  6. package/agents/README.md +17 -4
  7. package/agents/ralph-plan/agent.md +7 -3
  8. package/agents/ralph-plan.agent.md +7 -3
  9. package/bin/agent-cortex.mjs +48 -30
  10. package/bin/installers/pi.mjs +885 -237
  11. package/claude-extras/scripts/statusline-command.sh +0 -0
  12. package/docs/claude-hooks.md +5 -4
  13. package/docs/commit-signing.md +231 -0
  14. package/docs/ideas/ban-content-assertion-tests.md +3 -1
  15. package/docs/ideas/dedicated-review-tests-skill.md +71 -0
  16. package/docs/ideas/enable-signed-commit-enforcement-changesets-bot-commits-must-be-signed.md +10 -1
  17. package/docs/ideas/extension-manifests.md +5 -0
  18. package/docs/ideas/unify-the-ticket-and-task-decomposition-workflows.md +71 -0
  19. package/docs/research/disable-model-invocation.md +103 -0
  20. package/docs/research/skill-design-research.md +2 -2
  21. package/docs/skills/skill-anatomy.md +5 -1
  22. package/docs/technical-direction/harness-config.md +25 -1
  23. package/docs/technical-direction/migration-execution-labels.md +17 -9
  24. package/extensions/agent-modes/discover.test.ts +19 -0
  25. package/extensions/agent-modes/discover.ts +25 -3
  26. package/extensions/session-start/README.md +38 -0
  27. package/extensions/session-start/index.test.ts +122 -0
  28. package/extensions/session-start/index.ts +27 -0
  29. package/extensions/session-start/package.json +19 -0
  30. package/extensions/session-start/tsconfig.json +12 -0
  31. package/extensions/subagent/README.md +1 -1
  32. package/extensions/subagent/agents.test.ts +176 -0
  33. package/extensions/subagent/agents.ts +102 -11
  34. package/extensions/subagent/index.ts +2 -1
  35. package/extensions/subagent/package.json +1 -1
  36. package/lib/cli.mjs +35 -9
  37. package/package.json +10 -6
  38. package/pi/settings.json +1 -7
  39. package/plugin.json +1 -1
  40. package/pnpm-workspace.yaml +6 -0
  41. package/scripts/check-changeset.mjs +42 -0
  42. package/scripts/install-instructions.sh +0 -0
  43. package/scripts/lib/release-gates.mjs +61 -0
  44. package/scripts/lib/verify-worker-tree.mjs +107 -0
  45. package/scripts/resolve-publish-command.mjs +17 -0
  46. package/scripts/sync-plugin-version.sh +0 -0
  47. package/skills/engineering/grill-with-docs/SKILL.md +3 -2
  48. package/skills/engineering/improve-codebase-architecture/REFERENCE.md +5 -0
  49. package/skills/engineering/improve-codebase-architecture/SKILL.md +2 -1
  50. package/skills/planning/create-task/SKILL.md +8 -3
  51. package/skills/planning/create-task/scripts/create-chores.ts +4 -1
  52. package/skills/planning/prd-to-tasks/REFERENCE.md +2 -2
  53. package/skills/planning/prd-to-tasks/SKILL.md +9 -4
  54. package/skills/planning/request-refactor-plan/FORMAT.md +5 -0
  55. package/skills/planning/request-refactor-plan/SKILL.md +3 -2
  56. package/skills/planning/spec-to-tickets/REFERENCE.md +82 -0
  57. package/skills/planning/spec-to-tickets/SKILL.md +143 -0
  58. package/skills/planning/write-a-prd/FORMAT.md +6 -0
  59. package/skills/planning/write-a-prd/SKILL.md +9 -6
  60. package/skills/planning/write-a-ticket/EXAMPLES.md +133 -0
  61. package/skills/planning/write-a-ticket/SKILL.md +77 -59
  62. package/skills/productivity/bd-tool/SKILL.md +27 -2
  63. package/skills/productivity/grill-me/SKILL.md +11 -0
  64. package/skills/review/review-security/scripts/install-gitleaks.sh +0 -0
  65. package/skills/workflow/git-workflow/SKILL.md +35 -1
  66. package/skills/workflow/plan/SKILL.md +20 -8
  67. package/skills/workflow/ralph/REFERENCE.md +20 -2
  68. package/skills/workflow/ralph/SKILL.md +4 -1
  69. package/skills/workflow/run-pipeline-stage/SKILL.md +17 -5
  70. package/skills/workflow/run-pipeline-stage/playbooks/code.md +2 -0
  71. package/skills/workflow/run-pipeline-stage/playbooks/document.md +3 -0
  72. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +2 -0
  73. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +11 -0
  74. package/skills/workflow/using-agent-skills/SKILL.md +1 -0
  75. package/test/cli.test.mjs +26 -29
  76. package/test/create-chores.test.mjs +12 -0
  77. package/test/fake-bd.test.mjs +72 -0
  78. package/test/helpers/fake-bd.mjs +26 -6
  79. package/test/helpers/fake-pi.mjs +132 -0
  80. package/test/pi-installer.test.mjs +345 -286
  81. package/test/pi-register.test.mjs +342 -0
  82. package/test/pi-sweep.test.mjs +619 -0
  83. package/test/release-gates.test.mjs +190 -0
  84. package/test/verify-worker-tree.test.mjs +120 -0
  85. package/token-map.README.md +7 -6
  86. package/token-map.json +6 -5
  87. package/extensions/agent-guardrails/node_modules/.bin/pi +0 -21
  88. package/extensions/agent-guardrails/node_modules/.bin/tsc +0 -21
  89. package/extensions/agent-guardrails/node_modules/.bin/tsserver +0 -21
  90. package/extensions/agent-guardrails/node_modules/.bin/tsx +0 -21
  91. package/extensions/agent-modes/node_modules/.bin/pi +0 -21
  92. package/extensions/agent-modes/node_modules/.bin/tsc +0 -21
  93. package/extensions/agent-modes/node_modules/.bin/tsserver +0 -21
  94. package/extensions/agent-modes/node_modules/.bin/tsx +0 -21
  95. package/extensions/session-start.ts +0 -44
  96. package/extensions/skill-stats/node_modules/.bin/pi +0 -21
  97. package/extensions/skill-stats/node_modules/.bin/tsc +0 -21
  98. package/extensions/skill-stats/node_modules/.bin/tsserver +0 -21
  99. package/extensions/skill-stats/node_modules/.bin/tsx +0 -21
  100. package/extensions/subagent/node_modules/.bin/pi +0 -21
  101. package/extensions/subagent/node_modules/.bin/pi-ai +0 -21
  102. package/extensions/subagent/node_modules/.bin/tsc +0 -21
  103. package/extensions/subagent/node_modules/.bin/tsserver +0 -21
  104. package/extensions/subagent/node_modules/.bin/tsx +0 -21
  105. package/lib/pi-packages.mjs +0 -169
  106. package/skills/planning/create-task/scripts/node_modules/.bin/tsc +0 -21
  107. package/skills/planning/create-task/scripts/node_modules/.bin/tsserver +0 -21
  108. package/skills/planning/create-task/scripts/node_modules/.bin/tsx +0 -21
  109. package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsc +0 -21
  110. package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsserver +0 -21
  111. package/skills/productivity/validate-agent-dir/scripts/node_modules/.bin/tsx +0 -21
  112. package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsc +0 -21
  113. package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsserver +0 -21
  114. package/skills/workflow/run-pipeline-stage/scripts/node_modules/.bin/tsx +0 -21
  115. package/test/pi-packages.test.mjs +0 -295
@@ -7,7 +7,7 @@ Body templates used in the Phase 3 and Phase 4 workflow steps of `SKILL.md`.
7
7
  Passed as the `--description` when creating an epic bead:
8
8
 
9
9
  ```bash
10
- bd create "<Phase Title>" --type epic --description "<epic body below>"
10
+ bd create "<Phase Title>" --type epic --description "<epic body below>" --validate
11
11
  ```
12
12
 
13
13
  ```markdown
@@ -23,7 +23,7 @@ A concise description of this phase. Scope and goal, not implementation details.
23
23
 
24
24
  End-to-end behaviour for this phase. What a demo would show.
25
25
 
26
- ## Acceptance criteria
26
+ ## Success Criteria
27
27
 
28
28
  - [ ] Criterion 1
29
29
  - [ ] Criterion 2
@@ -50,17 +50,21 @@ execute. The epic bead is the source of truth — no intermediate plan file.
50
50
  complete through all integration layers, demoable or verifiable on its own, and
51
51
  covering a specific set of user stories.
52
52
  5. For each phase define its **title**, **user stories covered**, **what to build**
53
- (end-to-end behaviour, not layer-by-layer), and **acceptance criteria**.
53
+ (end-to-end behaviour, not layer-by-layer), and **success criteria** — the epic's required
54
+ `## Success Criteria`. The interview is complete only when every phase has agreed criteria;
55
+ never invent them.
54
56
  6. Present the proposed phases and ask about granularity, merges or splits, and which
55
57
  phases can run in parallel. Iterate until the user approves.
56
58
 
57
59
  ### Phase 3 — Create epics (one per phase)
58
60
 
59
61
  7. Create epics in dependency order (blockers first) so you can reference real bead IDs,
60
- using the epic body template in [REFERENCE.md](./REFERENCE.md):
62
+ using the epic body template in [REFERENCE.md](./REFERENCE.md). The body must carry
63
+ `## Success Criteria`; `--validate` rejects it otherwise:
61
64
 
62
65
  ```bash
63
- bd create "<Phase Title>" --type epic --description "<epic body from REFERENCE.md>"
66
+ bd create "<Phase Title>" --type epic --description "<epic body from REFERENCE.md>" --validate
67
+ bd lint <epic-id>
64
68
  ```
65
69
 
66
70
  8. Tag each epic with a priority (`p3` default; adjust for p4/p5), and `workflow:ralph`
@@ -127,7 +131,7 @@ Epic: "Phase 2 — Dashboard" (#127) — AFK (blocked by #123)
127
131
  - [ ] Phase 1 complete: PRD confirmed, codebase explored, architectural decisions captured.
128
132
  - [ ] Phase 2 complete: phases drafted and approved by the user.
129
133
  - [ ] Phase 3 complete: epics created in dependency order and tagged (priority, plus
130
- `workflow:ralph` under ralph-plan/ralph).
134
+ `workflow:ralph` under ralph-plan/ralph), and `bd lint` clean.
131
135
  - [ ] Phase 4 complete: tasks created via `create-task`; epics carry the aggregate
132
136
  `implementation-type` tag.
133
137
  - [ ] Phase 5 complete: full bead tree presented and confirmed.
@@ -137,6 +141,7 @@ Epic: "Phase 2 — Dashboard" (#127) — AFK (blocked by #123)
137
141
  - [ ] Every phase is a vertical slice covering all layers, not a horizontal layer.
138
142
  - [ ] Every task is independently grabbable by a single agent.
139
143
  - [ ] All epics are tagged with a priority (and `workflow:ralph` when under ralph).
144
+ - [ ] Epics created with `--validate`; `bd lint` reports no missing sections for the created tree.
140
145
  - [ ] All tasks are classified AFK/HITL via `create-task`.
141
146
  - [ ] Parent epics carry the aggregate `implementation-type` tag.
142
147
  - [ ] No intermediate plan file was created — epics are the source of truth.
@@ -10,6 +10,11 @@ The problem that the developer is facing, from the developer's perspective.
10
10
 
11
11
  The solution to the problem, from the developer's perspective.
12
12
 
13
+ ## Acceptance Criteria
14
+
15
+ - [ ] <criterion 1>
16
+ - [ ] <criterion 2>
17
+
13
18
  ## Commits
14
19
 
15
20
  A long, detailed implementation plan in plain English, broken into the tiniest commits possible. Each commit should leave the codebase in a working state.
@@ -32,7 +32,7 @@ description: Create a detailed refactor plan via user interview, split into tiny
32
32
  - **description**: the refactor plan formatted with the template in `FORMAT.md`
33
33
  - **priority**: P2
34
34
 
35
- Always invoke `create-task` — never `bd create` directly. `create-task` classifies the bead and expands AFK tasks into pipeline stage beads for ralph.
35
+ Always invoke `create-task` — never `bd create` directly. `create-task` classifies the bead and expands AFK tasks into pipeline stage beads for ralph. The description must include the template's `## Acceptance Criteria` — the plan's definition of done, agreed in the interview rather than invented — or `create-task`'s `--validate` gate rejects it.
36
36
 
37
37
  ## Red Flags
38
38
 
@@ -81,4 +81,5 @@ Output: a P2 bead filed via `create-task` whose description follows the `FORMAT.
81
81
  - [ ] Test coverage assessed; testing plan recorded when coverage is insufficient.
82
82
  - [ ] Commit plan written with every commit leaving the codebase working.
83
83
  - [ ] Decision Document contains decisions only — no file paths or code snippets.
84
- - [ ] Bead filed via `create-task` with concise title, `FORMAT.md`-formatted description, priority P2.
84
+ - [ ] Bead filed via `create-task` with concise title, `FORMAT.md`-formatted description, priority P2.
85
+ - [ ] Description carries agreed `## Acceptance Criteria`; the bead was created with `--validate` and lints clean.
@@ -0,0 +1,82 @@
1
+ # Spec to Tickets — Reference
2
+
3
+ Supporting formats for `spec-to-tickets`. Load this when writing the map, drafting tickets,
4
+ or creating them.
5
+
6
+ ## Ticket map format
7
+
8
+ Written to `.agent-cortex/tickets/<spec-slug>-map.md` at Phase 3 step 8. `.agent-cortex/*`
9
+ is gitignored, so the map is a local review artefact — not a committed plan file.
10
+
11
+ ```markdown
12
+ # <Spec title> — ticket map
13
+
14
+ - **Source:** <link or path to the PRD/RFC/spec>
15
+ - **Tracker:** <Jira | GitLab | GitHub | beads>
16
+ - **Status:** draft | agreed | created
17
+
18
+ ## Shared decisions
19
+
20
+ - <schema/API/auth decision every ticket relies on, with a link>
21
+
22
+ ## Tickets
23
+
24
+ | # | Title | Intent | Touches | Depends on | Ticket ID |
25
+ |---|---|---|---|---|---|
26
+ | T1 | Add grease sampling to the monitor | Read grease levels alongside oil on each poll | `src/monitor/` | — | — |
27
+ | T2 | Surface grease readings in the dashboard | Show grease next to oil on the status panel | `src/web/` | T1 | — |
28
+
29
+ ## Ordering
30
+
31
+ T1 -> T2, T3 (T2 and T3 can run in parallel)
32
+
33
+ ## Out of scope
34
+
35
+ - <work the spec mentions that these tickets deliberately exclude>
36
+ ```
37
+
38
+ Set `Status` to `agreed` at Phase 3, and fill `Ticket ID` as each ticket is created in Phase 6.
39
+
40
+ ## Ticket draft format
41
+
42
+ Written to `.agent-cortex/tickets/<spec-slug>/<NN>-<ticket-slug>.md` at Phase 4 step 10 —
43
+ one file per ticket, numbered in dependency order. Drafts are the review artefact for
44
+ Phase 5 and the source of the created ticket body.
45
+
46
+ ```markdown
47
+ # <Ticket title>
48
+
49
+ - **Map ref:** T1
50
+ - **Depends on:** T2, T3
51
+ - **Ticket ID:** — (filled at creation)
52
+
53
+ ---
54
+
55
+ <body from write-a-ticket>
56
+ ```
57
+
58
+ Fill `Ticket ID` at Phase 6. Upload the body verbatim; record `Depends on` in the tracker's
59
+ own link or dependency field when it has one.
60
+
61
+ ## Tracker adapters
62
+
63
+ The tracker and mechanism are chosen in Phase 1 step 2. These are illustrative examples,
64
+ not a fixed contract — confirm the real command or tool with the human before creating.
65
+
66
+ | Tracker | Example creation mechanism |
67
+ |---|---|
68
+ | GitHub | `gh issue create --title "<title>" --body-file <draft-body.md> --label <label>` |
69
+ | GitLab | `glab issue create --title "<title>" --description "<body>"` |
70
+ | Jira | the configured Jira CLI or MCP tool for issue creation |
71
+ | beads | `bd create "<title>" --description "<body>" --validate` |
72
+
73
+ Keep the approved draft verbatim — do not reformat it for the tracker. After creation,
74
+ copy the returned ID into the map's `Ticket ID` column, the draft's `Ticket ID` field, and
75
+ downstream `Depends on` cells.
76
+
77
+ ## Worked run
78
+
79
+ Input: an approved RFC with eight numbered requirements and a target GitLab project.
80
+ Output: `.agent-cortex/tickets/checkout-v2-map.md` agreed in chat, eight drafts under
81
+ `.agent-cortex/tickets/checkout-v2/` reviewed as a set, then eight GitLab issues created in
82
+ dependency order with real IDs backfilled into the map and the drafts.
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: spec-to-tickets
3
+ description: Turn a PRD, RFC, or spec into an agreed map of tickets, then draft each ticket body with the human in dependency order. Use when the user says "break this spec into tickets", "turn this RFC into tickets", or "map out the work".
4
+ argument-hint: "The spec to decompose (path or link) and the target tracker"
5
+ ---
6
+
7
+ # Spec to Tickets
8
+
9
+ Turn one spec into a reviewed graph of tickets. The map is agreed before any body is
10
+ written, the drafts are reviewed as a set, and only then are tickets created.
11
+
12
+ ## When to use
13
+
14
+ - A PRD, RFC, ADR, or spec is approved and needs to become tickets in a tracker.
15
+ - The user says "break this spec into tickets", "turn this RFC into tickets", or "map out the work".
16
+ - A large change needs a dependency graph before anyone starts implementing.
17
+
18
+ ## When NOT to use
19
+
20
+ - A single ticket — use `write-a-ticket` directly.
21
+ - Decomposition into beads for the ralph/bd loop — use `prd-to-tasks`.
22
+ - No spec exists yet — use `write-a-prd` or `grill-with-docs` first.
23
+
24
+ ## Philosophy / rationale
25
+
26
+ - **Agree the graph before the bodies.** Granularity decisions invalidate bodies, so the human approves titles, edges, and scope first. Bodies are cheap to write once the graph is right.
27
+ - **Draft everything, then create once.** Drafts are reviewable artefacts; tickets in a tracker are not. The human reads the whole set before anything is uploaded.
28
+ - **One ticket at a time, then all at once.** Draft each body with the human so decisions stay in the open; review the finished set together so the boundary between tickets is visible.
29
+ - **Less is more.** Tickets stay scannable; the detail lives in the spec the ticket links to.
30
+
31
+ ## Workflow
32
+
33
+ ### Phase 1 — Ingest the spec
34
+
35
+ 1. Confirm the spec is in context (file, link, or paste). If it is missing, stop and ask for it.
36
+ 2. Identify the tracker and how tickets are created there — Jira, GitLab, GitHub, or beads, via CLI, MCP, or manual paste. Ask when unclear; the mechanism only affects Phase 6.
37
+ 3. Explore the code the spec touches, enough to name the components each ticket will change. You cannot slice work you have not looked at.
38
+ 4. Record the durable decisions that apply across every ticket — schema shape, API conventions, auth, shared models — so bodies link to them instead of repeating them.
39
+
40
+ ### Phase 2 — Draft the ticket map
41
+
42
+ 5. Slice the spec into tickets. Each ticket is a coherent unit of change one engineer can pick up and finish — not a layer, not a phase, not a week of work. Prefer more, thinner tickets.
43
+ 6. For each ticket record a verb-first title, a one-line intent, the components it touches, and its `depends-on` edges.
44
+ 7. Order the graph so dependencies come first, and mark the tickets that can run in parallel.
45
+
46
+ ### Phase 3 — Agree the map
47
+
48
+ 8. Write the map to `.agent-cortex/tickets/<spec-slug>-map.md` in the format from [REFERENCE.md](./REFERENCE.md), then present it. The map carries titles, intents, touchpoints, and edges — no bodies.
49
+ 9. Walk the graph with the human: granularity (merge or split), ordering, parallelism, and what is out of scope entirely. Iterate until they approve. Draft no body before this gate passes.
50
+
51
+ ### Phase 4 — Draft every body
52
+
53
+ 10. Walk the graph in dependency order. For each ticket, draft the body with `write-a-ticket` together with the human, and write it to `.agent-cortex/tickets/<spec-slug>/<NN>-<ticket-slug>.md` in the draft format from [REFERENCE.md](./REFERENCE.md). Create nothing yet.
54
+ 11. Settle every open question as you draft: resolve it, split a blocking spike ticket, or send the human to find the answer. A question stays open only if the human explicitly agrees — and then it is recorded under `Open questions` with an owner. Ship nothing unresolved that the human has not agreed to.
55
+
56
+ ### Phase 5 — Review the drafts
57
+
58
+ 12. Present the whole draft set for one read-through: titles, bodies, and edges together, so the boundary between tickets is visible.
59
+ 13. Iterate until the human approves the set. Nothing is created before this gate passes.
60
+
61
+ ### Phase 6 — Create and backfill
62
+
63
+ 14. Create each ticket through the agreed mechanism, using its approved draft verbatim. [REFERENCE.md](./REFERENCE.md) lists adapter examples.
64
+ 15. Backfill the real ID into the map, the draft file, and downstream tickets' dependency references.
65
+
66
+ ### Phase 7 — Report
67
+
68
+ 16. Present the created tickets with their IDs, edges, and any spikes, and note which can start immediately.
69
+
70
+ Workflow at a glance:
71
+
72
+ ```
73
+ [Spec: PRD/RFC/ADR]
74
+ |
75
+ v
76
+ [P1: Ingest + explore code]
77
+ |
78
+ v
79
+ [P2: Draft the ticket map]
80
+ |
81
+ v
82
+ [P3: Agree the map] --(revise)--> [P2: Draft the ticket map]
83
+ |
84
+ (approved)
85
+ v
86
+ [P4: Draft every body] --(open)--> [Resolve / spike / ask]
87
+ |
88
+ (drafted)
89
+ v
90
+ [P5: Review the draft set] --(revise)--> [P4: Draft every body]
91
+ |
92
+ (approved)
93
+ v
94
+ [P6: Create + backfill IDs]
95
+ |
96
+ v
97
+ [P7: Report the graph]
98
+ ```
99
+
100
+ ## Red Flags
101
+
102
+ - **Drafting bodies before the map is agreed.** A granularity change rewrites bodies; agree the graph first.
103
+ - **Creating before the draft set is reviewed.** Drafts are the review artefact; upload only what the human has read.
104
+ - **Layer tickets.** "All the database work" is not a unit of change — every ticket should be independently useful.
105
+ - **Carrying an unagreed open question into a body.** Resolve it, split a spike, or get the human's explicit agreement to leave it open.
106
+ - **A missing `depends-on` edge.** Ordering is the point of the map; an unmodelled dependency surfaces later as a blocked engineer.
107
+ - **Fat tickets.** If a ticket is a week of work, split it.
108
+
109
+ ## Common Rationalizations
110
+
111
+ | Rationalization | Rebuttal |
112
+ |---|---|
113
+ | "I'll create all the tickets, then refine" | Granularity is agreed first and drafts are reviewed before creation; tickets edited in the tracker leave the map stale. |
114
+ | "The map is obvious — skip writing it down" | The map is the review artefact. The human approves a graph, not a scroll of bodies. |
115
+ | "I'll note the open question in the ticket" | Only with the human's explicit agreement. Otherwise resolve it or spike it — an unagreed question is a blocked implementer. |
116
+ | "One big ticket is simpler to track" | Big tickets hide scope and block parallel work. |
117
+
118
+ ## Cross-skill references
119
+
120
+ - **`write-a-ticket`** — invoked for every body; owns the ticket quality bar.
121
+ - **`write-a-prd`** — use first when no spec exists.
122
+ - **`prd-to-tasks`** — use when the output is beads for the ralph/bd loop, not external tickets.
123
+ - **`style-comms`** — invoke when drafting the map's titles and intents.
124
+
125
+ ## Phase-gate checklist
126
+
127
+ - [ ] Phase 1 complete: spec in context, tracker identified, code explored, shared decisions recorded.
128
+ - [ ] Phase 2 complete: map drafted with titles, intents, touchpoints, and edges.
129
+ - [ ] Phase 3 complete: map written to `.agent-cortex/tickets/` and approved by the human.
130
+ - [ ] Phase 4 complete: every body drafted with `write-a-ticket` and written to the draft directory.
131
+ - [ ] Phase 5 complete: the draft set was reviewed and approved as a whole.
132
+ - [ ] Phase 6 complete: all tickets created and IDs backfilled into the map and the drafts.
133
+ - [ ] Phase 7 complete: graph reported with IDs, edges, and spikes.
134
+
135
+ ## Verification checklist
136
+
137
+ - [ ] No body was drafted before the map was approved.
138
+ - [ ] Every ticket is a coherent unit of change, not a layer or a phase.
139
+ - [ ] Every dependency is modelled as a `depends-on` edge in the map.
140
+ - [ ] Every draft exists under `.agent-cortex/tickets/<spec-slug>/` and was approved before creation.
141
+ - [ ] Every open question shipped was explicitly agreed by the human and has an owner.
142
+ - [ ] Real ticket IDs were backfilled into the map, the drafts, and downstream dependencies.
143
+ - [ ] The map file exists at `.agent-cortex/tickets/<spec-slug>-map.md`.
@@ -23,6 +23,12 @@ A LONG, numbered list of user stories. Each user story should be in the format o
23
23
 
24
24
  This list of user stories should be extremely extensive and cover all aspects of the feature.
25
25
 
26
+ ## Success Criteria
27
+
28
+ The high-level, verifiable outcomes that mean this feature succeeded. This is the epic's
29
+ `## Success Criteria` (required by `bd create --validate`) — distinct from the per-task
30
+ acceptance criteria that `prd-to-tasks` derives later.
31
+
26
32
  ## Implementation Decisions
27
33
 
28
34
  A list of implementation decisions that were made. This can include:
@@ -14,18 +14,18 @@ description: Create a PRD through user interview, codebase exploration, and modu
14
14
  ## When NOT to use
15
15
 
16
16
  - The idea is not ready to build yet — use `record-idea` to capture it to the backlog.
17
- - The output targets a human team's external tracker — use `write-a-ticket`.
18
- - A PRD already exists and needs breaking into tasks — use `prd-to-tasks`.
17
+ - The output targets a human team's external tracker — use `write-a-ticket` for one ticket, or `spec-to-tickets` to break a spec into many.
18
+ - A PRD already exists and needs breaking down — use `prd-to-tasks` for beads, or `spec-to-tickets` for external tickets.
19
19
  - The scope is a refactor needing a safe incremental plan — use `request-refactor-plan`.
20
20
 
21
21
  ## Workflow
22
22
 
23
23
  1. **Gather the problem statement.** Ask the user for a long, detailed description of the problem and any potential solution ideas. Ask one question at a time.
24
24
  2. **Explore the codebase.** Verify the user's assertions against the repo's current state. Explore instead of asking when the answer lives in code.
25
- 3. **Interview relentlessly.** Walk down each branch of the design tree, resolving dependencies between decisions one by one, until the user's understanding and yours are identical. Every open question at this point becomes ambiguity in the PRD.
25
+ 3. **Interview relentlessly.** Walk down each branch of the design tree, resolving dependencies between decisions one by one, until the user's understanding and yours are identical. The epic's required sections — `## Success Criteria` in particular — are the interview's target: it is complete only when there is enough agreed detail to fill every required section. Never invent an answer; surface it as an assumption and confirm it with the user.
26
26
  4. **Sketch the modules.** List the major modules to build or modify, actively looking for deep modules — ones that encapsulate rich behaviour behind a simple, stable interface testable in isolation. Confirm the list with the user, plus which modules they want tests written for.
27
- 5. **Write the PRD.** Render the template in `FORMAT.md` (Problem Statement, Solution, User Stories, Implementation Decisions, Testing Decisions, Out of Scope, Further Notes). Make the user-story list extremely extensive so it covers all aspects of the feature.
28
- 6. **File the bead.** Create the epic with `bd create "<title>" --type epic --priority P1 --body-file -`, piping the rendered PRD to stdin, then run the `classify-bead` classifier (`node <this-skill-dir>/../classify-bead/scripts/classify-bead.mjs <epic-id>`, run from the target project's cwd) to label it AFK or HITL. Escalate to the `classify-bead` subagent only when the classifier reports `escalate: true`.
27
+ 5. **Write the PRD.** Render the template in `FORMAT.md` (Problem Statement, Solution, User Stories, Success Criteria, Implementation Decisions, Testing Decisions, Out of Scope, Further Notes). Make the user-story list extremely extensive so it covers all aspects of the feature.
28
+ 6. **File the bead.** Create the epic with `bd create "<title>" --type epic --priority P1 --body-file - --validate`, piping the rendered PRD to stdin, then run the `classify-bead` classifier (`node <this-skill-dir>/../classify-bead/scripts/classify-bead.mjs <epic-id>`, run from the target project's cwd) to label it AFK or HITL. Escalate to the `classify-bead` subagent only when the classifier reports `escalate: true`. Finally run `bd lint <epic-id>` and fix any missing sections before reporting.
29
29
 
30
30
  Run the steps in order. Skip a step only when the user confirms it is unnecessary (e.g. the codebase is already explored).
31
31
 
@@ -52,12 +52,13 @@ Run the steps in order. Skip a step only when the user confirms it is unnecessar
52
52
 
53
53
  - [ ] Gate 1 — shared understanding: every design-tree branch resolved and the user confirms the summary.
54
54
  - [ ] Gate 2 — modules agreed: the module list and test expectations match the user's model of the solution.
55
- - [ ] Gate 3 — PRD filed: the epic bead contains the rendered template and carries an implementation-type label.
55
+ - [ ] Gate 3 — PRD filed: the epic bead contains the rendered template, carries an implementation-type label, and lints clean.
56
56
 
57
57
  ## Cross-skill references
58
58
 
59
59
  - Use `record-idea` when the idea is not yet ready to build.
60
60
  - Use `write-a-ticket` when the spec targets an external tracker rather than a bead.
61
+ - Use `spec-to-tickets` when an approved PRD/RFC must become a map of external tickets.
61
62
  - Run `prd-to-tasks` on the filed epic to break the PRD into an executable backlog.
62
63
  - Run the `classify-bead` classifier on the new epic — the repo labels every new bead AFK or HITL. Its `scripts/` directory sits next to this skill's directory in every harness, so `<this-skill-dir>/../classify-bead/scripts/classify-bead.mjs` resolves it. Escalate to its rubric subagent only when the classifier reports `escalate: true`.
63
64
 
@@ -69,6 +70,8 @@ Output: an epic bead whose description is the rendered PRD — problem, solution
69
70
  ## Verification checklist
70
71
 
71
72
  - [ ] Template in `FORMAT.md` rendered fully, with no placeholder sections.
73
+ - [ ] `## Success Criteria` present and the epic created with `--validate`.
74
+ - [ ] `bd lint <epic-id>` reports no missing sections.
72
75
  - [ ] Every user story follows "As an <actor>, I want <feature>, so that <benefit>".
73
76
  - [ ] Codebase assertions verified against the repo before writing.
74
77
  - [ ] Implementation Decisions contains no file paths or code snippets.
@@ -0,0 +1,133 @@
1
+ # Write a Ticket — Examples
2
+
3
+ Worked before/after rewrites for the `write-a-ticket` skill.
4
+
5
+ ## A whole ticket: padded vs tight
6
+
7
+ The padded version is the failure mode this skill exists to prevent: it explains the RFC,
8
+ prescribes an implementation, says nothing about scope, and leaves a question open. The
9
+ tight version points at the source material, states the behaviour, draws the boundary, and
10
+ gives an entry point.
11
+
12
+ ### Padded
13
+
14
+ ```markdown
15
+ ## Context
16
+
17
+ We are moving our billing stack to a new provider. The current provider has had several
18
+ outages this year, which has affected customer trust. The Q3 billing review evaluated
19
+ Stripe, Paddle, and Chargebee; Paddle was chosen because of EU data residency. The
20
+ meeting notes are attached. There was also discussion about whether to migrate in one go
21
+ or incrementally, and about how to handle existing subscriptions.
22
+
23
+ ## Description
24
+
25
+ We need to migrate to Paddle. This involves adding the Paddle SDK, creating a webhook
26
+ handler, migrating the subscription records, updating the pricing page, and changing the
27
+ retry logic. Step 1: install the SDK. Step 2: add a webhook handler that verifies the
28
+ signature. Step 3: write a migration script …
29
+
30
+ ## In scope
31
+
32
+ - The migration
33
+
34
+ ## Acceptance criteria
35
+
36
+ - [ ] The migration works correctly
37
+ - [ ] The feature is tested
38
+ - [ ] Payments still work
39
+
40
+ ## Open questions
41
+
42
+ - Do we migrate annual subscriptions too, or only monthly?
43
+ ```
44
+
45
+ ### Tight
46
+
47
+ ```markdown
48
+ ## Context
49
+
50
+ Part of the billing migration epic (BILL-412). Approach and provider decision in
51
+ RFC-018 §2; retry policy in ADR-014. Depends on the Paddle webhook receiver (BILL-420).
52
+
53
+ ## Description
54
+
55
+ When a Paddle webhook fails with a transient error, the handler retries with the shared
56
+ backoff policy. Non-transient failures are logged and acknowledged without retry. The
57
+ existing provider path is unchanged.
58
+
59
+ ## In scope
60
+
61
+ - Retry of transient Paddle webhook failures with the shared backoff policy.
62
+ - Provider selection in the payment factory.
63
+ - Structured logging of terminal webhook failures.
64
+
65
+ ## Out of scope
66
+
67
+ - Subscription record migration (BILL-421).
68
+ - Pricing-page changes (BILL-422).
69
+ - Provider cutover and production enablement.
70
+
71
+ ## Acceptance criteria
72
+
73
+ - [ ] A webhook returning 503 is retried up to 3 times with exponential backoff.
74
+ - [ ] A webhook returning 422 is not retried and is logged with the payload.
75
+ - [ ] The retry counter is per webhook event, not per process.
76
+ - [ ] The existing Stripe retry specs pass unchanged.
77
+
78
+ ## Testing approach
79
+
80
+ Integration spec in `test/webhooks/retry.spec.ts` against the Paddle sandbox, asserting
81
+ the 503-then-200 path and the terminal 422 path.
82
+
83
+ ## Technical notes
84
+
85
+ - **Entry point:** `src/payments/paddle.ts:41` (`handleWebhook`, `shouldRetry`)
86
+ - `retry()` from `@acme/retry-utils`; follow `src/payments/stripe.ts` for the handler shape.
87
+ - `handleWebhook` becomes async — update its call site in `src/payments/index.ts:12`.
88
+ ```
89
+
90
+ The tight version is shorter, answers the reviewer's questions, and still leaves the
91
+ implementation to the implementer.
92
+
93
+ ## Description: states the goal vs explains the RFC
94
+
95
+ | Instead of… | Write… |
96
+ | "We need to migrate to Paddle. The provider was chosen after a review of Stripe, Paddle and Chargebee, and there was discussion about whether to migrate incrementally. This ticket covers the retry logic, which is important because outages cost us customers. Step 1: …" | "When a Paddle webhook fails with a transient error, the handler retries with the shared backoff policy. Non-transient failures are logged and acknowledged without retry." |
97
+
98
+ The Description states what the ticket does and the behaviour it produces. It leads into the
99
+ scope bullets — the RFC link and the deliberation stay in Context or the source document.
100
+
101
+ ## Padded context vs linked context
102
+
103
+ | Instead of… | Write… |
104
+ | "We are moving to a new billing provider because the current one has outages. The provider was chosen in the Q3 billing review (attached meeting notes, see thread in #billing where we discussed Stripe vs Paddle vs Chargebee; conclusion was Paddle due to EU data residency). This ticket tracks the work agreed there." | "Part of the billing migration epic (BILL-412). Approach in RFC-018 §2. Depends on the Paddle webhook receiver (BILL-420)." |
105
+
106
+ Context is a pointer block: parent, where the approach lives, what it depends on. It does
107
+ not recap the deliberation.
108
+
109
+ ## Vague vs verifiable acceptance criteria
110
+
111
+ | Instead of… | Write… |
112
+ | "The export works correctly" | "Given a workspace with 1,000 issues, the CSV export returns all rows with no truncation" |
113
+ | "The feature is tested" | "Unit tests cover the retry path for transient HTTP 503 responses" |
114
+ | "The migration runs" | "The migration completes without errors on a staging copy of the production database" |
115
+
116
+ ## Technical notes: entry point vs full inventory
117
+
118
+ | Instead of… | Write… |
119
+ | "Step 1: install the SDK via `pnpm add @acme/paddle`. Step 2: add a webhook handler that verifies the signature and … (10 more steps)" | "- **Entry point:** `src/payments/paddle.ts:41` (`handleWebhook`, `shouldRetry`)" |
120
+ | "Files to change: `paddle.ts`, `index.ts`, `stripe.ts`, `retry.ts`, `types.ts`, `webhook.ts`, `config.ts`" | "- **Entry point:** `src/payments/paddle.ts:41` (`handleWebhook`, `shouldRetry`)<br>- Follow `src/payments/stripe.ts` for the handler shape." |
121
+
122
+ Technical notes lead with the entry point and then give only the facts that change how the
123
+ work is done — a signature, a library, a convention. They are neither an inventory of every
124
+ file touched nor a step-by-step guide; either of those means the ticket has become the code.
125
+
126
+ ## Open questions: agreed vs smuggled
127
+
128
+ An open question is legitimate when the human has agreed to it: it goes under
129
+ `Open questions` with the owner of the answer. A question the human has not agreed to is a
130
+ red flag wherever it appears — resolve it, spike it, or ask.
131
+
132
+ | Instead of… | Write… |
133
+ | A question buried in `Technical notes` or a `Notes` section, with no owner and no agreement | "## Open questions<br>- Do annual subscriptions migrate too? (owner: Priya)" |