@jaimevalasek/aioson 1.30.2 → 1.36.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 (158) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +19 -6
  3. package/docs/en/1-understand/ecosystem-map.md +45 -29
  4. package/docs/en/1-understand/glossary.md +5 -5
  5. package/docs/en/1-understand/what-is-aioson.md +5 -5
  6. package/docs/en/2-start/existing-project.md +7 -7
  7. package/docs/en/2-start/first-project.md +32 -38
  8. package/docs/en/2-start/initial-decisions.md +18 -17
  9. package/docs/en/3-recipes/README.md +2 -2
  10. package/docs/en/3-recipes/continuity-between-sessions.md +2 -2
  11. package/docs/en/3-recipes/from-idea-to-prd-via-briefing.md +5 -2
  12. package/docs/en/3-recipes/full-feature-with-sheldon.md +327 -338
  13. package/docs/en/4-agents/README.md +28 -14
  14. package/docs/en/4-agents/discovery-design-doc.md +20 -8
  15. package/docs/en/4-agents/forge-run.md +3 -2
  16. package/docs/en/5-reference/cli-reference.md +51 -48
  17. package/docs/en/5-reference/executable-verification.md +10 -7
  18. package/docs/en/5-reference/parallel.md +2 -0
  19. package/docs/en/5-reference/qa-browser.md +2 -2
  20. package/docs/en/README.md +3 -3
  21. package/docs/pt/1-entender/glossario.md +4 -4
  22. package/docs/pt/1-entender/mapa-do-ecossistema.md +32 -21
  23. package/docs/pt/2-comecar/decisoes-iniciais.md +16 -16
  24. package/docs/pt/2-comecar/primeiro-projeto.md +1 -1
  25. package/docs/pt/3-receitas/README.md +1 -1
  26. package/docs/pt/3-receitas/app-saas-do-zero.md +35 -122
  27. package/docs/pt/3-receitas/feature-completa-com-sheldon.md +289 -338
  28. package/docs/pt/4-agentes/analyst.md +9 -5
  29. package/docs/pt/4-agentes/architect.md +9 -5
  30. package/docs/pt/4-agentes/dev.md +19 -7
  31. package/docs/pt/4-agentes/discovery-design-doc.md +25 -23
  32. package/docs/pt/4-agentes/orchestrator.md +164 -118
  33. package/docs/pt/4-agentes/pentester.md +5 -5
  34. package/docs/pt/4-agentes/pm.md +15 -7
  35. package/docs/pt/4-agentes/sheldon.md +166 -99
  36. package/docs/pt/4-agentes/ux-ui.md +7 -4
  37. package/docs/pt/5-referencia/agent-chain-continuity.md +14 -5
  38. package/docs/pt/5-referencia/comandos-cli.md +1 -1
  39. package/docs/pt/5-referencia/harness-retro.md +2 -1
  40. package/docs/pt/5-referencia/sdd-automation-scripts.md +6 -6
  41. package/docs/pt/5-referencia/sdd-framework.md +53 -16
  42. package/docs/pt/5-referencia/sdd-planos-e-estrutura.md +27 -15
  43. package/docs/pt/README.md +4 -4
  44. package/docs/pt/agentes.md +48 -50
  45. package/package.json +2 -2
  46. package/src/artifact-kinds.js +110 -0
  47. package/src/cli.js +82 -42
  48. package/src/commands/agent-epilogue.js +251 -186
  49. package/src/commands/agents.js +104 -48
  50. package/src/commands/audit-code.js +344 -0
  51. package/src/commands/classify.js +75 -13
  52. package/src/commands/feature-close.js +43 -18
  53. package/src/commands/harness-check.js +259 -175
  54. package/src/commands/harness-retro-promote.js +387 -0
  55. package/src/commands/live.js +24 -0
  56. package/src/commands/prototype-check.js +163 -0
  57. package/src/commands/review-feature.js +189 -0
  58. package/src/commands/runtime.js +81 -66
  59. package/src/commands/sync-agents-copy.js +115 -0
  60. package/src/commands/verification-plan.js +116 -0
  61. package/src/commands/verify-artifact.js +530 -0
  62. package/src/commands/verify-implementation.js +428 -0
  63. package/src/commands/workflow-execute.js +309 -309
  64. package/src/commands/workflow-next.js +361 -19
  65. package/src/commands/workflow-plan.js +5 -5
  66. package/src/constants.js +4 -0
  67. package/src/gateway-pointer-merge.js +7 -1
  68. package/src/handoff-contract.js +267 -172
  69. package/src/harness/contract-integrity-gate.js +172 -0
  70. package/src/harness/contract-integrity.js +111 -0
  71. package/src/harness/contract-schema.js +377 -332
  72. package/src/harness/detect-runtime-feature.js +90 -0
  73. package/src/harness/static-criteria.js +192 -0
  74. package/src/i18n/messages/en.js +8 -4
  75. package/src/i18n/messages/es.js +8 -4
  76. package/src/i18n/messages/fr.js +8 -4
  77. package/src/i18n/messages/pt-BR.js +8 -4
  78. package/src/install-wizard.js +8 -8
  79. package/src/installer.js +13 -6
  80. package/src/lib/retro/retro-render.js +10 -1
  81. package/src/lib/retro/retro-sources.js +45 -27
  82. package/src/lib/retro/verification-reports.js +230 -0
  83. package/src/parser.js +6 -0
  84. package/src/preflight-engine.js +12 -12
  85. package/src/runtime-store.js +13 -9
  86. package/src/verification/evidence-bundle.js +251 -0
  87. package/src/verification/ledger-store.js +221 -0
  88. package/src/verification/path-policy.js +74 -0
  89. package/src/verification/policy-engine.js +95 -0
  90. package/src/verification/prompt-package.js +314 -0
  91. package/src/verification/redaction.js +77 -0
  92. package/src/verification/report-parser.js +132 -0
  93. package/src/verification/report-store.js +97 -0
  94. package/src/verification/result.js +16 -0
  95. package/src/verification/runners/index.js +319 -0
  96. package/src/verification/runtime-telemetry.js +144 -0
  97. package/src/verification/schema.js +276 -0
  98. package/src/verification/source-discovery.js +153 -0
  99. package/src/verification-policy.js +398 -0
  100. package/src/version.js +52 -1
  101. package/template/.aioson/agents/analyst.md +9 -6
  102. package/template/.aioson/agents/architect.md +34 -5
  103. package/template/.aioson/agents/briefing-refiner.md +25 -0
  104. package/template/.aioson/agents/briefing.md +69 -12
  105. package/template/.aioson/agents/committer.md +2 -1
  106. package/template/.aioson/agents/copywriter.md +30 -21
  107. package/template/.aioson/agents/design-hybrid-forge.md +28 -15
  108. package/template/.aioson/agents/dev.md +28 -10
  109. package/template/.aioson/agents/deyvin.md +3 -2
  110. package/template/.aioson/agents/discover.md +12 -3
  111. package/template/.aioson/agents/discovery-design-doc.md +7 -2
  112. package/template/.aioson/agents/genome.md +19 -10
  113. package/template/.aioson/agents/neo.md +30 -30
  114. package/template/.aioson/agents/orache.md +20 -11
  115. package/template/.aioson/agents/orchestrator.md +84 -7
  116. package/template/.aioson/agents/pm.md +8 -8
  117. package/template/.aioson/agents/product.md +15 -11
  118. package/template/.aioson/agents/profiler-enricher.md +20 -11
  119. package/template/.aioson/agents/profiler-forge.md +20 -11
  120. package/template/.aioson/agents/profiler-researcher.md +20 -11
  121. package/template/.aioson/agents/qa.md +87 -17
  122. package/template/.aioson/agents/scope-check.md +19 -5
  123. package/template/.aioson/agents/setup.md +12 -1
  124. package/template/.aioson/agents/sheldon.md +92 -9
  125. package/template/.aioson/agents/site-forge.md +11 -2
  126. package/template/.aioson/agents/squad.md +20 -5
  127. package/template/.aioson/agents/ux-ui.md +4 -2
  128. package/template/.aioson/agents/validator.md +33 -1
  129. package/template/.aioson/config/verification.json +61 -0
  130. package/template/.aioson/config.md +13 -9
  131. package/template/.aioson/docs/LAYERS.md +2 -2
  132. package/template/.aioson/docs/autopilot-handoff.md +10 -10
  133. package/template/.aioson/docs/dev/execution-discipline.md +41 -0
  134. package/template/.aioson/docs/dev/phase-loop.md +47 -0
  135. package/template/.aioson/docs/feature-expansion-taxonomy.md +31 -3
  136. package/template/.aioson/docs/presets/workflow.config.full-merged.json +15 -0
  137. package/template/.aioson/docs/presets/workflow.config.lean.json +15 -0
  138. package/template/.aioson/docs/product/prd-contract.md +12 -12
  139. package/template/.aioson/docs/prototype-contract.md +98 -0
  140. package/template/.aioson/docs/reference-identity.md +94 -0
  141. package/template/.aioson/docs/sheldon/harness-contract.md +155 -28
  142. package/template/.aioson/docs/verification-config.md +82 -0
  143. package/template/.aioson/docs/verify-artifact-gates.md +91 -0
  144. package/template/.aioson/docs/workflow-lean-lane.md +129 -0
  145. package/template/.aioson/skills/design/interface-design/references/intent-and-domain.md +2 -0
  146. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +16 -14
  147. package/template/.aioson/skills/process/aioson-spec-driven/references/approval-gates.md +2 -2
  148. package/template/.aioson/skills/process/aioson-spec-driven/references/classification-map.md +4 -4
  149. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +15 -15
  150. package/template/.aioson/skills/process/briefing-expansion-scout/SKILL.md +25 -3
  151. package/template/.aioson/skills/process/design-hybrid-forge/SKILL.md +5 -3
  152. package/template/.aioson/skills/process/design-hybrid-forge/references/external-source-ingestion.md +89 -0
  153. package/template/.aioson/skills/process/product-scope-expansion/SKILL.md +29 -2
  154. package/template/.aioson/skills/process/prototype-forge/SKILL.md +98 -0
  155. package/template/.aioson/skills/process/reference-identity-extract/SKILL.md +164 -0
  156. package/template/.aioson/skills/process/sheldon-expansion-audit/SKILL.md +23 -2
  157. package/template/.aioson/skills/static/multi-agent-patterns.md +5 -5
  158. package/template/CLAUDE.md +15 -11
@@ -1,338 +1,327 @@
1
- # Recipe: Full feature with `@sheldon` (canonical trail)
2
-
3
- > **Who this is for:** medium-to-high complexity features where wrong early decisions are costly.
4
- > **Time to run:** 2 to 8 hours (varies with scope), spread across 1–4 sessions.
5
- > **What you'll have at the end:** a feature implemented, tested, security-audited, and reviewed end-to-end every decision traceable on disk.
6
- > **Status:** this is the trail the AIOSON creator uses by default for SMALL/MEDIUM projects with significant implementation.
7
-
8
- ---
9
-
10
- ## The trail in one line
11
-
12
- ```
13
- /aioson:agent:product → @sheldon → @analyst → @architect → @ux-ui → @pm → @orchestrator → @scope-check → @dev
14
-
15
- (@qa ↔ @dev) ← autonomous loop
16
-
17
- optional: @tester → (@qa ↔ @dev) ← extra coverage
18
-
19
- optional: @pentester ↔ @dev ← security
20
-
21
- @qa (final general review)
22
- ```
23
-
24
- **Why order matters:** each agent reads the artifacts left by the previous one. Skipping an agent means the next one improvises — and improvisation on big decisions becomes rework.
25
-
26
- ---
27
-
28
- ## Scenario
29
-
30
- You are building a meaningful feature — typical examples: **subscription billing with Stripe**, **seller dashboard in a marketplace**, **order cancellation with time-window rules**. Something that mixes backend + UI + business rules + external integration.
31
-
32
- If the feature is trivial (simple CRUD without business logic), skip to the [Landing page recipe](./landing-page.md) or [SaaS app from scratch](./saas-app-from-scratch.md). This trail is a cannon; don't use it to shoot sparrows.
33
-
34
- ## Prerequisites
35
-
36
- - Project with `aioson init/install` already run
37
- - `project.context.md` populated (`@setup` already done)
38
- - Classification **SMALL** or **MEDIUM**
39
- - AI client open in the project
40
-
41
- ---
42
-
43
- ## Step 1 — `@product` defines the PRD
44
-
45
- ```
46
- You > @product
47
-
48
- @product > Let's define a feature. What's the slug?
49
- You > billing-subscription
50
-
51
- @product > In one sentence, the problem?
52
- You > Customer wants to subscribe to monthly/annual plan and manage payment
53
-
54
- @product > [guided questions: ACs, out-of-scope, dependencies, SLA limits]
55
- @product > PRD created at .aioson/context/prd.md (copy at features/billing-subscription/spec.md).
56
- @product > Next: @sheldon to validate and enrich before going technical.
57
- ```
58
-
59
- **What was left on disk:** `prd.md` with clear sections (problem, scope, ACs, out-of-scope).
60
-
61
- > **Variation:** if you already have material in `/plans/` or an approved briefing, `@product` detects it and offers to use it as a base. See [External plans for @product](./external-plans-for-product.md) and [From idea to PRD via @briefing](./from-idea-to-prd-via-briefing.md).
62
-
63
- ---
64
-
65
- ## Step 2 — `@sheldon` enriches the PRD (critical step)
66
-
67
- This is the step most people skip — and where AIOSON gains depth.
68
-
69
- ```
70
- You > @sheldon
71
-
72
- @sheldon > Reading prd.md... scanning .aioson/context/architecture.md, dependencies, plans/.
73
- @sheldon > Detected 4 gaps:
74
- 1. PRD does not cover plan downgrade (only upgrade)
75
- 2. No decision on proportional billing (proration)
76
- 3. Stripe webhook has no retry/idempotency policy
77
- 4. No ACs for billing failure after 3 attempts (dunning)
78
-
79
- @sheldon > Do you have external sources? [URL, local file, "no"]
80
- You > docs.stripe.com/billing/subscriptions/upgrade-downgrade
81
-
82
- @sheldon > [searches, reads, cites]
83
- @sheldon > Recommendation:
84
- - Enrich PRD in-place (gaps 1, 2 are product decisions)
85
- - Create phased plan at .aioson/plans/billing-subscription/ for
86
- phased implementation of webhook+dunning (gaps 3, 4)
87
-
88
- @sheldon > Applying enrichment... prd.md updated.
89
- @sheldon > Phased plan: .aioson/plans/billing-subscription/{phase-1.md, phase-2.md, harness-contract.json}
90
- @sheldon > Next: @analyst.
91
- ```
92
-
93
- **Why run `@sheldon`:**
94
- - It reads the **actual project code** and cross-references it with the PRD it sees what's missing.
95
- - It can fetch **external sources** (Stripe docs, RFCs, technical posts) and **cite them**.
96
- - It decides between **enriching in-place** (editing `prd.md`) or **creating a phased plan** when scope is too large for a single implementation.
97
-
98
- **Can run multiple times:** if the first pass left gaps, invoke `@sheldon` again. It detects existing `sheldon-enrichment.md` and offers a new enrichment round without starting over.
99
-
100
- > **When NOT to run `@sheldon`:** trivial features (basic CRUD) or MICRO. The enrichment effort does not pay off.
101
-
102
- ---
103
-
104
- ## Step 3 — `@analyst` maps the domain
105
-
106
- ```
107
- You > @analyst
108
-
109
- @analyst > Reading enriched prd.md + codebase.
110
- @analyst > Entities: Subscription, Plan, Invoice, PaymentMethod, DunningAttempt.
111
- Already exist in code: Customer, Order. Will extend.
112
- @analyst > Domain map saved to architecture.md (domain section).
113
- @analyst > Next: @architect.
114
- ```
115
-
116
- ## Step 4 — `@architect` decides the technical structure
117
-
118
- ```
119
- You > @architect
120
-
121
- @architect > Decisions:
122
- - Stripe Customer Portal for self-service (reduces custom UI)
123
- - Webhook handler on dedicated route with idempotency key
124
- - Daily dunning cron (3 attempts, 1d/3d/7d intervals)
125
- - Migration: subscriptions table with FK on customers
126
- @architect > Decisions saved to architecture.md (decisions section).
127
- @architect > Next: @ux-ui.
128
- ```
129
-
130
- ## Step 5 `@ux-ui` designs the UI
131
-
132
- ```
133
- You > @ux-ui
134
-
135
- @ux-ui > Reading architecture and PRD. Stack confirmed: React + current design skill.
136
- @ux-ui > Components:
137
- - PlanSelector (3 cards: Free, Pro, Enterprise)
138
- - BillingPortal (link to Stripe Portal)
139
- - InvoiceList
140
- - DunningBanner (failed billing alert)
141
- @ux-ui > Specs saved to design-doc.md. Next: @pm.
142
- ```
143
-
144
- > In **SMALL** projects without `@ux-ui` in the flow, skip this step.
145
-
146
- ## Step 6 `@pm` breaks down into user stories
147
-
148
- ```
149
- You > @pm
150
-
151
- @pm > 7 user stories identified, grouped into 3 epics.
152
- Each with verifiable ACs (e.g., "POST /subscriptions/upgrade
153
- returns 200 and sets proration_amount > 0").
154
- @pm > tasks.md saved.
155
- @pm > Next: @orchestrator.
156
- ```
157
-
158
- ## Step 7`@orchestrator` defines parallel lanes
159
-
160
- ```
161
- You > @orchestrator
162
-
163
- @orchestrator > Identified 3 parallelizable lanes:
164
- - lane-backend.md (routes + webhook + cron)
165
- - lane-ui.md (4 components + integration)
166
- - lane-migration.md (DB schema + test seeds)
167
- @orchestrator > Dependency: lane-ui depends on lane-backend for the API contract.
168
- @orchestrator > parallel/ saved. harness-contract.json created.
169
- @orchestrator > Next: @dev (can work lanes in separate sessions).
170
- ```
171
-
172
- > In **SMALL** projects, skip `@orchestrator` no parallel lanes worth the overhead.
173
-
174
- ## Step 8 `@dev` implements
175
-
176
- ```
177
- You > @dev
178
-
179
- @dev > Reading full plan. Starting with lane-backend (no dependencies).
180
- @dev > [implements] Lane-backend done. dev-state.md updated.
181
- @dev > Next: run @qa for this lane before moving to lane-ui.
182
- ```
183
-
184
- > `@dev` is **resumable**. If the session drops midway, next session `@deyvin` reads `dev-state.md` and continues exactly where it left off. See [Continuity between sessions](./continuity-between-sessions.md).
185
-
186
- ## Step 9 — `@qa ↔ @dev` loop (autonomous, cap 2)
187
-
188
- ```
189
- You > @qa
190
-
191
- @qa > 18 ACs identified. Writing tests...
192
- @qa > Failure on AC-12 (proration calculation).
193
- Iteration 1/2 — passing to @dev autonomously.
194
- @dev > [fixes calculation, renames misleading variable]
195
- @qa > Re-running... 18/18 OK.
196
- @qa > test-plan.md and qa-report.md saved.
197
- ```
198
-
199
- **Cap 2** means: the autonomous loop runs at most 2 iterations. If it still fails, `@qa` stops and calls you for human review — prevents infinite loops.
200
-
201
- ---
202
-
203
- ## Step 10 (optional) — `@tester` for systematic coverage
204
-
205
- When to activate:
206
- - You know the feature will have high load and want **more coverage** than just the PRD ACs.
207
- - You suspect **edge cases** that `@qa` didn't cover (timezones, concurrency, locales).
208
- - The project is legacy and the feature touches untested code.
209
-
210
- ```
211
- You > @tester
212
-
213
- @tester > Reading qa-report. Current coverage: 78%. Quality tier: MEDIUM.
214
- @tester > Identified 3 zones with test smell:
215
- - Tests coupled to brittle fixtures (3 tests)
216
- - 2 tests only verify "no throw" (don't check behavior)
217
- - Missing proration coverage on edge dates (29th–31st of month)
218
- @tester > Additional test plan saved to test-inventory.md.
219
- @tester > Next: run @qa again to implement missing tests.
220
- ```
221
-
222
- After `@tester`, **run `@qa` again** — the `@qa ↔ @dev` loop repeats on the new tests.
223
-
224
- ## Step 11 (optional) — `@pentester ↔ @dev` for security
225
-
226
- When to activate:
227
- - Feature touches sensitive data (payment, PII, auth).
228
- - Going to production.
229
- - There is a regulatory requirement.
230
-
231
- ```
232
- You > @pentester
233
-
234
- @pentester > Mapping attack surfaces (OWASP + supply chain + tooling).
235
- @pentester > Findings:
236
- - HIGH: Stripe webhook without signature validation in dev mode
237
- - MEDIUM: /billing/portal route without rate-limit
238
- - LOW: log includes customer email in plaintext
239
-
240
- @pentester > Iteration 1 passing to @dev to fix.
241
- @dev > [fixes signature validation, adds rate-limit, redacts log]
242
- @pentester > Re-scan: HIGH=0, MEDIUM=0, LOW=1 (accepted as low risk).
243
- @pentester > security-findings-billing-subscription.json saved.
244
- ```
245
-
246
- ## Step 12 Final `@qa`, general review
247
-
248
- After everything (tester and pentester), run `@qa` one more time:
249
-
250
- ```
251
- You > @qa
252
-
253
- @qa > General review post-pentester and post-tester.
254
- @qa > 18 original ACs + 9 additional tests (from @tester) + 3 security
255
- regression tests (from @pentester). Total: 30 tests. All passing.
256
- @qa > Verdict: feature ready. @validator recommended before closing.
257
- ```
258
-
259
- Optional: run `@validator` to check the success contract, and `@committer` for the final commit.
260
-
261
- ---
262
-
263
- ## What was left on disk (full audit trail)
264
-
265
- ```
266
- .aioson/context/
267
- ├── prd.md ← @product
268
- ├── sheldon-enrichment.md ← @sheldon (multiple rounds)
269
- ├── architecture.md ← @analyst + @architect
270
- ├── design-doc.md ← @ux-ui
271
- ├── tasks.md ← @pm
272
- ├── parallel/
273
- ├── lane-backend.md ← @orchestrator
274
- ├── lane-ui.md
275
- │ └── lane-migration.md
276
- ├── dev-state.md ← @dev (updated each session)
277
- ├── test-plan.md ← @qa
278
- ├── qa-report-billing-subscription.md @qa
279
- ├── test-inventory.md ← @tester
280
- ├── security-findings-billing-subscription.json ← @pentester
281
- └── features/billing-subscription/
282
- ├── spec.md
283
- └── done/ ← archived by feature:close
284
-
285
- .aioson/plans/billing-subscription/
286
- ├── phase-1.md ← @sheldon (phased plan)
287
- ├── phase-2.md
288
- ├── harness-contract.json ← success contract
289
- └── progress.json ← current status
290
- ```
291
-
292
- Six months from now, anyone (or any AI) reads these files and understands **everything**: what was planned, why, what was implemented, what was discarded.
293
-
294
- ---
295
-
296
- ## Trail variations
297
-
298
- ### MICRO (small scope)
299
- `@product → @dev → @qa`. Skip `@sheldon`, `@analyst`, `@architect`, `@ux-ui`, `@pm`, `@orchestrator`. The Constitution Article II (*Right-Sized Process*) protects you from unnecessary ceremony.
300
-
301
- ### SMALL without UI
302
- `@product → @sheldon → @analyst → @scope-check → @architect → @dev → @qa`. Skip `@ux-ui`, `@pm`, `@orchestrator`.
303
-
304
- ### Full MEDIUM
305
- The complete trail above.
306
-
307
- ### When you are only implementing Lane 1 today
308
- Go through `@orchestrator`, then invoke `@dev` only for `lane-backend.md`. Pause before `@qa`. Next session: `@deyvin` picks up on the pending lane.
309
-
310
- ---
311
-
312
- ## Troubleshooting
313
-
314
- | Problem | Solution |
315
- |---|---|
316
- | `@sheldon` complains the PRD is vague | Go back to `@product` and refine. `@sheldon` does not invent what is not clear. |
317
- | `@orchestrator` creates only 1 lane | Your feature is probably SMALL in disguise. Skip parallel lanes. |
318
- | `@qa @dev` loop hit cap 2 | There is a design defect. Return to `@architect` or `@product` before writing more code. |
319
- | `@pentester` HIGH finding won't clear | Don't force it. Document as accepted risk or defer the feature. |
320
- | Session dropped mid-`@dev` | `@deyvin` picks up. See [Continuity between sessions](./continuity-between-sessions.md). |
321
-
322
- ---
323
-
324
- ## When NOT to use this trail
325
-
326
- - **Isolated bug fix**go straight to `@dev` (with bug ID reference) and `@qa`.
327
- - **Refactor without behavior change** — use [Large refactor](./large-refactor.md).
328
- - **MICRO feature without new business logic** — overhead not worth it.
329
-
330
- ---
331
-
332
- ## Next step
333
-
334
- - [SDD: plans and structure](../5-reference/sdd-planos-e-estrutura.md) — deep dive into the structure `@pm` and `@orchestrator` create
335
- - [From idea to PRD via @briefing](./from-idea-to-prd-via-briefing.md) — when the idea is still vague
336
- - [External plans for @product](./external-plans-for-product.md) — when you already planned in another chat
337
- - [Continuity between sessions](./continuity-between-sessions.md) — to resume the trail in another session
338
- - [Ecosystem map](../1-understand/ecosystem-map.md) — view all agents
1
+ # Recipe: Full feature with `@sheldon` (canonical SMALL trail)
2
+
3
+ > **Who this is for:** SMALL features where wrong early decisions are costly.
4
+ > **Time to run:** 1–4 hours, spread across 1–2 sessions.
5
+ > **What you'll have at the end:** a feature implemented, tested, and reviewed — spec + code + tests traceable on disk.
6
+ > **Status:** this is the DEFAULT lean lane for SMALL projects (v1.35.0+).
7
+
8
+ ---
9
+
10
+ ## The trail in one line
11
+
12
+ ```
13
+ @product → @sheldon → @dev → @qa
14
+ ```
15
+
16
+ `@sheldon` is the **single spec authority** for SMALL: in one pass it produces requirements + spec (Gates A/B/C approved) + design-doc + readiness + implementation-plan + harness-contract, then hands directly to `@dev`.
17
+
18
+ > **MEDIUM?** Use the maestro variant: `@product → @orchestrator → @dev → @pentester → @qa` — `@orchestrator` fans out `@analyst`/`@architect`/`@pm` (+ `@ux-ui` for UI-heavy) as sub-agents, consolidates the gated spec package, then hands to `@dev`. See [MEDIUM maestro variant](#medium-maestro-variant).
19
+
20
+ **Why order matters:** each agent reads the artifacts left by the previous one. Skipping the spec authority means `@dev` improvises — improvisation on big decisions becomes rework.
21
+
22
+ ---
23
+
24
+ ## Scenario
25
+
26
+ You are building a meaningful SMALL feature — typical examples: **subscription billing with Stripe**, **seller dashboard in a marketplace**, **order cancellation with time-window rules**. Something that mixes backend + business rules + optional UI.
27
+
28
+ If the feature is truly trivial (simple CRUD, no business logic), skip this trail — go straight to `@product → @dev → @qa` (MICRO). This trail is a cannon; don't use it to shoot sparrows.
29
+
30
+ ## Prerequisites
31
+
32
+ - Project with `aioson init/install` already run
33
+ - `project.context.md` populated (`@setup` already done)
34
+ - Classification **SMALL**
35
+ - AI client open in the project
36
+
37
+ ---
38
+
39
+ ## Step 1 `@product` defines the PRD
40
+
41
+ ```
42
+ You > @product
43
+
44
+ @product > Let's define a feature. What's the slug?
45
+ You > billing-subscription
46
+
47
+ @product > In one sentence, the problem?
48
+ You > Customer wants to subscribe to monthly/annual plan and manage payment
49
+
50
+ @product > [guided questions: ACs, out-of-scope, dependencies, SLA limits]
51
+ @product > PRD created at .aioson/context/prd.md (copy at features/billing-subscription/spec.md).
52
+ @product > Next: @sheldon to close the spec and produce the implementation package.
53
+ ```
54
+
55
+ **What was left on disk:** `prd.md` with clear sections (problem, scope, ACs, out-of-scope).
56
+
57
+ > **Variation:** if you already have material in `/plans/` or an approved briefing, `@product` detects it and offers to use it as a base. See [External plans for @product](./external-plans-for-product.md) and [From idea to PRD via @briefing](./from-idea-to-prd-via-briefing.md).
58
+
59
+ ---
60
+
61
+ ## Step 2 `@sheldon` closes the spec (single spec authority)
62
+
63
+ This is the step that replaces the old multi-hop chain (`@analyst → @scope-check → @architect → ...`). `@sheldon` does it all in one pass.
64
+
65
+ ```
66
+ You > @sheldon
67
+
68
+ @sheldon > Reading prd.md... scanning architecture.md, dependencies, plans/.
69
+ @sheldon > Detected 4 gaps:
70
+ 1. PRD does not cover plan downgrade (only upgrade)
71
+ 2. No decision on proportional billing (proration)
72
+ 3. Stripe webhook has no retry/idempotency policy
73
+ 4. No ACs for billing failure after 3 attempts (dunning)
74
+
75
+ @sheldon > Do you have external sources? [URL, local file, "no"]
76
+ You > docs.stripe.com/billing/subscriptions/upgrade-downgrade
77
+
78
+ @sheldon > [researches, reads, cites]
79
+ @sheldon > Closing spec producing single-spec-authority package:
80
+ requirements-billing-subscription.md (gaps resolved, ACs hardened)
81
+ ✓ design-doc-billing-subscription.md (technical structure + reuse decisions)
82
+ readiness-billing-subscription.md (Gate B: ready_with_warnings → cleared)
83
+ implementation-plan.md (3 phases, file-disjoint waves)
84
+ harness-contract.json (RG-smoke criteria + verification commands)
85
+
86
+ @sheldon > Gates A/B/C: approved.
87
+ @sheldon > Next: @dev — implementation-plan.md is the input.
88
+ ```
89
+
90
+ **What `@sheldon` produces in one pass:**
91
+ - Closes all PRD gaps (with web research when needed)
92
+ - Creates the design-doc + readiness verdict (Gate B)
93
+ - Writes the phased implementation-plan
94
+ - Authors the harness-contract with binary success criteria + `verification` commands
95
+ - Signs off Gates A/B/C before handing to `@dev`
96
+
97
+ **Can run multiple times:** if the first pass left gaps, invoke `@sheldon` again. It detects existing artifacts and offers a new round without starting over.
98
+
99
+ > **When NOT to run `@sheldon`:** trivial features (basic CRUD) or MICRO. The spec effort does not pay off.
100
+
101
+ ---
102
+
103
+ ## Step 3 — `@dev` implements (phase loop)
104
+
105
+ ```
106
+ You > @dev
107
+
108
+ @dev > Reading implementation-plan.md. 3 phases detected. Starting Phase 1.
109
+
110
+ ── Phase 1/3: DB migrations + webhook handler ──
111
+ @dev > [implements]
112
+ @dev > aioson harness:check OK. Verification sub-agent: pass.
113
+ @dev > Compacting context for Phase 2...
114
+
115
+ ── Phase 2/3: billing routes + dunning cron ──
116
+ @dev > [implements]
117
+ @dev > aioson harness:check → OK. Verification sub-agent: pass.
118
+ @dev > Compacting context for Phase 3...
119
+
120
+ ── Phase 3/3: UI components ──
121
+ @dev > [implements]
122
+ @dev > aioson harness:check OK.
123
+ @dev > dev-state.md updated. All phases complete. Next: @qa.
124
+ ```
125
+
126
+ **The `@dev` phase loop:**
127
+ - Implements phase-by-phase, **auto-continues between phases** (no "continue?" prompts)
128
+ - Runs `aioson harness:check` after each phase (deterministic exit-code check)
129
+ - Runs a light per-phase verification sub-agent; fixes in-phase if needed
130
+ - Compacts context between phases to maintain a clean context window
131
+ - The expensive full **Runtime smoke** runs **once at end-of-feature** (inside `@qa`), never per phase
132
+
133
+ > `@dev` is **resumable**. If the session drops midway, next session `@deyvin` reads `dev-state.md` and continues exactly where it left off. See [Continuity between sessions](./continuity-between-sessions.md).
134
+
135
+ ---
136
+
137
+ ## Step 4 `@qa` + Runtime smoke gate
138
+
139
+ ```
140
+ You > @qa
141
+
142
+ @qa > 18 ACs identified. Writing tests...
143
+ @qa > Failure on AC-12 (proration calculation).
144
+ Iteration 1/2 passing to @dev autonomously.
145
+ @dev > [fixes calculation, renames misleading variable]
146
+ @qa > Re-running... 18/18 OK.
147
+ @qa > Runtime smoke gate: build + migrations (applied to real DB) + boot + Core happy-path...
148
+ @qa > Runtime smoke: PASS.
149
+ @qa > test-plan.md and qa-report.md saved. Feature ready.
150
+ ```
151
+
152
+ **`@qa` owns Gate D:** the feature does NOT close until the Runtime smoke gate passes — build + migrations applied to a real DB + boot + Core happy-path on the REAL stack. Passing unit tests + `tsc` is the floor, not "done."
153
+
154
+ **Cap 2 autonomous loop:** `@qa ↔ @dev` runs at most 2 iterations automatically. If it still fails, `@qa` stops and calls you for human review — prevents infinite loops.
155
+
156
+ ---
157
+
158
+ ## Optional stepssecurity and coverage
159
+
160
+ ### Optional: `@pentester ↔ @dev` for security-sensitive features
161
+
162
+ When to activate:
163
+ - Feature touches sensitive data (payment, PII, auth)
164
+ - Going to production
165
+ - There is a regulatory requirement
166
+
167
+ ```
168
+ You > @pentester
169
+
170
+ @pentester > Mapping attack surfaces (OWASP + supply chain + tooling).
171
+ @pentester > Findings:
172
+ - HIGH: Stripe webhook without signature validation in dev mode
173
+ - MEDIUM: /billing/portal route without rate-limit
174
+ - LOW: log includes customer email in plaintext
175
+
176
+ @pentester > Iteration 1 — passing to @dev to fix.
177
+ @dev > [fixes signature validation, adds rate-limit, redacts log]
178
+ @pentester > Re-scan: HIGH=0, MEDIUM=0, LOW=1 (accepted as low risk).
179
+ @pentester > security-findings-billing-subscription.json saved.
180
+ ```
181
+
182
+ > **Note:** in MEDIUM, `@pentester` is inline (not optional — it runs between `@dev` and `@qa`).
183
+
184
+ ### Optional: `@tester` for systematic coverage
185
+
186
+ When to activate:
187
+ - High-load feature needing coverage beyond PRD ACs
188
+ - Suspected edge cases (timezones, concurrency, locales)
189
+ - Legacy code touched by the feature
190
+
191
+ ```
192
+ You > @tester
193
+
194
+ @tester > Reading qa-report. Current coverage: 78%. Quality tier: MEDIUM.
195
+ @tester > Identified 3 zones with test smell:
196
+ - Tests coupled to brittle fixtures (3 tests)
197
+ - 2 tests only verify "no throw" (don't check behavior)
198
+ - Missing proration coverage on edge dates (29th–31st of month)
199
+ @tester > Additional test plan saved to test-inventory.md.
200
+ @tester > Next: run @qa again to implement missing tests.
201
+ ```
202
+
203
+ After `@tester`, **run `@qa` again** the `@qa ↔ @dev` loop repeats on the new tests.
204
+
205
+ ### Optional: `@validator` — contract verification in fresh context
206
+
207
+ When to activate: a `harness-contract.json` exists and you want a binary verdict before closing.
208
+
209
+ ```
210
+ You > @validator
211
+
212
+ @validator > Running harness:check first... 18/18 criteria pass.
213
+ @validator > LLM-judging non-executable criteria (2 criteria)...
214
+ @validator > Verdict: all criteria met. Feature ready for feature:close.
215
+ ```
216
+
217
+ `@validator` always runs in a **fresh, isolated context** never inline in the implementing session.
218
+
219
+ ---
220
+
221
+ ## Opt-in detours — when to add more spec agents
222
+
223
+ The SMALL lean trail (`@product → @sheldon → @dev → @qa`) is the default. The agents below are **NOT default hops** — none are deleted; invoke them explicitly when the need arises, or use the MEDIUM trail which fans them out automatically.
224
+
225
+ | Agent | When to invoke explicitly |
226
+ |---|---|
227
+ | **`@analyst`** | Deep brownfield domain mapping, complex entity relationships |
228
+ | **`@architect`** | Sensitive technical decision requiring a dedicated review (microservices boundary, library choice) |
229
+ | **`@pm`** | Large feature needing formal user stories + backlog management |
230
+ | **`@ux-ui`** | UI-heavy feature needing a formal design system spec before `@dev` |
231
+ | **`@discovery-design-doc`** | Exploratory mode (vague idea → clarity checkpoint); or an explicit pre-dev design contract |
232
+ | **`@scope-check`** | Explicit drift audit (intent vs plan vs diff) — `spec:analyze` also runs automatically at the `@dev`/`@qa` done gate |
233
+
234
+ ---
235
+
236
+ ## MEDIUM maestro variant
237
+
238
+ **Trail:** `@product @orchestrator @dev @pentester → @qa`
239
+
240
+ `@orchestrator` is the **single spec authority** for MEDIUM (horizontal / fan-out): it spawns `@analyst` + `@architect` + `@pm` (+ `@ux-ui` when UI-heavy) as sub-agents, then **consolidates / verifies / redoes** their output into one gated spec package, then hands to `@dev`. Optionally `@sheldon` hardens the PRD as a pre-step.
241
+
242
+ ```
243
+ You > @orchestrator
244
+
245
+ @orchestrator > Starting MEDIUM spec phase. Fanning out sub-agents...
246
+ [spawns @analyst maps domain: Subscription, Plan, Invoice, PaymentMethod]
247
+ [spawns @architect → structures modules: webhook handler, dunning cron, migrations]
248
+ [spawns @pm implementation plan + user stories]
249
+ @orchestrator > Consolidating output... verifying cross-agent consistency...
250
+ @orchestrator > Gated spec package ready:
251
+ - requirements.md (consolidated + ACs hardened)
252
+ - architecture.md (decisions)
253
+ - tasks.md (user stories + implementation plan)
254
+ - harness-contract.json (RG-smoke criteria + verifications)
255
+ @orchestrator > Gates A/B/C: approved. Next: @dev.
256
+ ```
257
+
258
+ After `@orchestrator`, `@dev` runs the same phase loop as SMALL. `@pentester` then runs inline (not optional in MEDIUM), and `@qa` closes with the Runtime smoke gate.
259
+
260
+ ---
261
+
262
+ ## What was left on disk (SMALL audit trail)
263
+
264
+ ```
265
+ .aioson/context/
266
+ ├── prd.md ← @product
267
+ ├── requirements-billing-subscription.md ← @sheldon (closed gaps, ACs)
268
+ ├── design-doc-billing-subscription.md ← @sheldon (technical structure)
269
+ ├── readiness-billing-subscription.md ← @sheldon (Gate B)
270
+ ├── implementation-plan.md ← @sheldon (phases + waves)
271
+ ├── dev-state.md ← @dev (phase log, updated each session)
272
+ ├── test-plan.md ← @qa
273
+ ├── qa-report-billing-subscription.md ← @qa
274
+ ├── test-inventory.md ← @tester (optional)
275
+ ├── security-findings-billing-subscription.json ← @pentester (optional)
276
+ └── features/billing-subscription/
277
+ ├── spec.md
278
+ └── done/ archived by feature:close
279
+
280
+ .aioson/plans/billing-subscription/
281
+ ├── harness-contract.json ← @sheldon (success contract)
282
+ └── progress.json ← current status
283
+ ```
284
+
285
+ Six months from now, anyone (or any AI) reads these files and understands **everything**: what was planned, why, what was implemented, what was discarded.
286
+
287
+ ---
288
+
289
+ ## Trail variations
290
+
291
+ ### MICRO (no spec phase)
292
+ `@product @dev @qa`. Skip everything else. The Constitution's Article II (*Right-Sized Process*) protects you from unnecessary ceremony.
293
+
294
+ ### SMALL lean (this trail — default)
295
+ `@product → @sheldon → @dev → @qa`. `@sheldon` is the single spec authority. Add opt-in detours (`@analyst`, `@architect`, `@ux-ui`, etc.) when explicitly needed.
296
+
297
+ ### MEDIUM maestro
298
+ `@product @orchestrator → @dev → @pentester → @qa`. `@orchestrator` fans out `@analyst`/`@architect`/`@pm`/`@ux-ui` as sub-agents automatically. `@pentester` is inline (not opt-in).
299
+
300
+ ---
301
+
302
+ ## Troubleshooting
303
+
304
+ | Problem | Solution |
305
+ |---|---|
306
+ | `@sheldon` complains the PRD is vague | Go back to `@product` and refine. `@sheldon` does not invent what is not clear. |
307
+ | `@dev` phase loop stalls mid-phase | `@deyvin` picks up via `dev-state.md`. See [Continuity between sessions](./continuity-between-sessions.md). |
308
+ | `@qa @dev` loop hit cap 2 | There is a design defect. Return to `@sheldon` or `@product` before writing more code. |
309
+ | `@pentester` HIGH finding won't clear | Don't force it. Document as accepted risk or defer the feature. |
310
+ | `@orchestrator` creates only 1 lane | Your feature is probably SMALL in disguise. Use the `@sheldon` trail instead. |
311
+ | Session dropped mid-`@dev` | `@deyvin` picks up. See [Continuity between sessions](./continuity-between-sessions.md). |
312
+
313
+ ---
314
+
315
+ ## When NOT to use this trail
316
+
317
+ - **Isolated bug fix** go straight to `@dev` (with bug ID reference) and `@qa`.
318
+ - **Refactor without behavior change** use [Large refactor](./large-refactor.md).
319
+ - **MICRO feature without new business logic** overhead not worth it.
320
+
321
+ ---
322
+
323
+ ## Next step
324
+
325
+ - [From idea to PRD via @briefing](./from-idea-to-prd-via-briefing.md) — when the idea is still vague
326
+ - [Continuity between sessions](./continuity-between-sessions.md) — to resume the trail in another session
327
+ - [Ecosystem map](../1-understand/ecosystem-map.md) — view all agents