opencode-codeops 1.4.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 (102) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +21 -0
  3. package/README.md +171 -0
  4. package/_shared/auto-design.md +129 -0
  5. package/_shared/layout-convention.md +198 -0
  6. package/_shared/quality-profile.md +134 -0
  7. package/_shared/recommendation-hardening.md +166 -0
  8. package/_shared/scope-expansion-control.md +176 -0
  9. package/_shared/spec-first-ordering.md +79 -0
  10. package/_shared/zero-ambiguity-gate.md +311 -0
  11. package/agent-templates/codebase-scout.md +17 -0
  12. package/agent-templates/concurrency-auditor.md +5 -0
  13. package/agent-templates/design-challenger.md +26 -0
  14. package/agent-templates/financial-integrity-auditor.md +5 -0
  15. package/agent-templates/perf-auditor.md +23 -0
  16. package/agent-templates/phase-reviewer.md +54 -0
  17. package/agent-templates/plan-task-executor-opus.md +46 -0
  18. package/agent-templates/plan-task-executor.md +43 -0
  19. package/agent-templates/preflight-auditor.md +45 -0
  20. package/agent-templates/security-auditor.md +42 -0
  21. package/agent-templates/semantics-reviewer.md +5 -0
  22. package/agent-templates/spec-test-author.md +29 -0
  23. package/agents/concurrency-auditor.md +15 -0
  24. package/agents/correctness-reviewer.md +66 -0
  25. package/agents/demanding-executor.md +58 -0
  26. package/agents/design-challenger.md +38 -0
  27. package/agents/executor.md +55 -0
  28. package/agents/explorer.md +29 -0
  29. package/agents/financial-integrity-auditor.md +15 -0
  30. package/agents/performance-auditor.md +35 -0
  31. package/agents/preflight-auditor.md +57 -0
  32. package/agents/security-auditor.md +54 -0
  33. package/agents/semantics-reviewer.md +15 -0
  34. package/agents/spec-test-author.md +41 -0
  35. package/bin/codeops-worktree +244 -0
  36. package/bin/index.mjs +106 -0
  37. package/bin/install-agents.mjs +453 -0
  38. package/bin/install-skills.mjs +466 -0
  39. package/bin/lib/opencode-install.mjs +185 -0
  40. package/install.sh +55 -0
  41. package/package.json +73 -0
  42. package/plugin/index.ts +181 -0
  43. package/references/domains/compiler-and-language.md +28 -0
  44. package/references/domains/data-and-migration.md +22 -0
  45. package/references/domains/distributed-and-concurrent.md +26 -0
  46. package/references/domains/financial-system.md +28 -0
  47. package/references/domains/selection.md +19 -0
  48. package/references/domains/web-application.md +23 -0
  49. package/schemas/codeops-config.schema.json +56 -0
  50. package/scripts/check-version.mjs +163 -0
  51. package/scripts/codeops-migrate.sh +355 -0
  52. package/scripts/codeops-roadmap-compact.sh +232 -0
  53. package/scripts/codeops-roadmap-sync.sh +275 -0
  54. package/scripts/codeops_outcomes.py +155 -0
  55. package/scripts/codeops_plan.py +239 -0
  56. package/scripts/codeops_plan_migrate.py +318 -0
  57. package/scripts/codeops_worktree_snapshot.py +99 -0
  58. package/scripts/install_agents.py +288 -0
  59. package/scripts/release.mjs +533 -0
  60. package/skills/analyze-project/SKILL.md +28 -0
  61. package/skills/clean-comments/SKILL.md +22 -0
  62. package/skills/exec-plan/SKILL.md +267 -0
  63. package/skills/exec-plan/commit-modes.md +113 -0
  64. package/skills/exec-plan/execution-protocol.md +471 -0
  65. package/skills/git-commit/SKILL.md +35 -0
  66. package/skills/github-issues/SKILL.md +38 -0
  67. package/skills/grill-me/SKILL.md +342 -0
  68. package/skills/make-plan/SKILL.md +282 -0
  69. package/skills/make-plan/quality-checklist.md +96 -0
  70. package/skills/make-plan/templates.md +535 -0
  71. package/skills/make-plan/zero-ambiguity-gate.md +19 -0
  72. package/skills/make-requirements/SKILL.md +268 -0
  73. package/skills/make-requirements/discovery-phases.md +255 -0
  74. package/skills/make-requirements/review-and-add.md +73 -0
  75. package/skills/make-requirements/templates.md +296 -0
  76. package/skills/make-requirements/zero-ambiguity-gate.md +18 -0
  77. package/skills/outcome-review/SKILL.md +34 -0
  78. package/skills/preflight/SKILL.md +310 -0
  79. package/skills/preflight/dimensions.md +181 -0
  80. package/skills/preflight/report-format.md +300 -0
  81. package/skills/retro-requirements/SKILL.md +218 -0
  82. package/skills/retro-requirements/confidence-classification.md +45 -0
  83. package/skills/retro-requirements/phases.md +609 -0
  84. package/skills/retro-requirements/triage-gate.md +135 -0
  85. package/skills/roadmap/SKILL.md +381 -0
  86. package/skills/roadmap/stage-hooks.md +80 -0
  87. package/skills/roadmap/template.md +200 -0
  88. package/skills/setup-codeops/SKILL.md +94 -0
  89. package/skills/setup-codeops/migration.md +106 -0
  90. package/skills/setup-codeops/scaffold.md +99 -0
  91. package/skills/setup-routing/SKILL.md +102 -0
  92. package/skills/setup-routing/routing.md +44 -0
  93. package/skills/techdocs/SKILL.md +199 -0
  94. package/skills/techdocs/authoring-and-update.md +178 -0
  95. package/skills/techdocs/templates.md +655 -0
  96. package/skills/techdocs/vitepress-setup.md +143 -0
  97. package/skills/upgrade-plan/SKILL.md +75 -0
  98. package/skills/upgrade-plan/content-quality-gate.md +35 -0
  99. package/skills/upgrade-plan/upgrade-checklists.md +107 -0
  100. package/standards/coding-standards-full.md +124 -0
  101. package/standards/coding-standards.md +64 -0
  102. package/standards/output-style.md +17 -0
@@ -0,0 +1,609 @@
1
+ # Phases 0โ€“9: Detailed Instructions & Output Templates
2
+
3
+ Read the relevant section before executing each phase. All output is written to
4
+ **the resolved `_retro/` dir** โ€” the layout-aware path defined ONCE in SKILL.md's
5
+ resolution block (never re-derive it here). Confidence classification (Phases 4+) is detailed in
6
+ `confidence-classification.md`; the Phase 8B gate is in `triage-gate.md`.
7
+
8
+ In every template below, replace `[Date]` with the current date and `[Name]`
9
+ with the project name. Each output file opens with a short banner naming the
10
+ phase that generated it.
11
+
12
+ ---
13
+
14
+ ## Phase 0: Reconnaissance
15
+
16
+ **Goal:** Establish what the project IS before reading any source code.
17
+
18
+ ### 0.1 Manifest Analysis
19
+
20
+ Read all manifest/config files at the project root and extract:
21
+
22
+ | File | Extract |
23
+ |------|---------|
24
+ | `package.json` / `Cargo.toml` / `go.mod` / `pyproject.toml` / `*.csproj` / `build.gradle` | Name, version, dependencies, scripts, language |
25
+ | `docker-compose.yml` / `Dockerfile` | Services, infrastructure, deployment model |
26
+ | `tsconfig.json` / `webpack.config.*` / `vite.config.*` / `.babelrc` | Build toolchain |
27
+ | `.env.example` / `.env.template` | Environment variables (configuration surface) |
28
+ | `README.md` / `CHANGELOG.md` | Project description, history, documentation |
29
+ | the project's AGENTS.md (or detected project conventions) | Existing project configuration (if available) |
30
+ | `Makefile` / `justfile` / `Taskfile.yml` | Build/task commands |
31
+ | `.github/workflows/*` / `.gitlab-ci.yml` | CI/CD pipeline |
32
+
33
+ ### 0.2 Directory Structure Mapping
34
+
35
+ List the project tree (top-level first, then selective recursion):
36
+
37
+ - Identify each top-level directory's purpose
38
+ - Count files and estimate lines of code per module
39
+ - Classify the project type (web app, API, library, CLI, mobile, etc.)
40
+ - Detect monorepo structure (multiple packages/services)
41
+
42
+ ### 0.3 Output: `00-project-profile.md`
43
+
44
+ ```markdown
45
+ # Project Profile: [Name]
46
+
47
+ > Generated by retro-requirements โ€” Phase 0: Reconnaissance
48
+ > Date: [Date] ยท Source: [Project root path]
49
+
50
+ ## Identity
51
+ - **Name:** [Project name]
52
+ - **Type:** [web-app / api / library / cli / mobile / monorepo / etc.]
53
+ - **Description:** [From README or inferred from code]
54
+ - **Version:** [Current version]
55
+
56
+ ## Technology Stack
57
+ | Layer | Technology | Evidence |
58
+ |-------|-----------|----------|
59
+ | Language(s) | [e.g., TypeScript] | [e.g., tsconfig.json, .ts files] |
60
+ | Framework(s) | [e.g., Express, React] | [package.json dependency] |
61
+ | Database(s) | [e.g., PostgreSQL] | [docker-compose, migrations] |
62
+ | Build Tool | [e.g., tsc, webpack] | [build script] |
63
+ | Test Framework | [e.g., Vitest, Jest] | [test script, config file] |
64
+ | Package Manager | [e.g., yarn, npm, cargo] | [lockfile present] |
65
+
66
+ ## Scale Estimate
67
+ - **Total Files / Estimated LOC / Modules / Dependencies:** [counts]
68
+
69
+ ## Directory Structure
70
+ [Annotated tree with the purpose of each top-level directory]
71
+
72
+ ## Key Configuration
73
+ ### Environment Variables
74
+ [Extracted from .env.example or config files]
75
+ ### Scripts/Commands
76
+ [Extracted from package.json scripts, Makefile, etc.]
77
+
78
+ ## Existing Documentation
79
+ [List of docs found: README, CHANGELOG, wiki, docs/, etc.]
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Phase 1: Structural Analysis
85
+
86
+ **Goal:** Understand the architecture โ€” how the code is organized into layers,
87
+ modules, and components.
88
+
89
+ ### 1.1 Entry Point Identification
90
+ Find and read all entry points: main app entry (`src/index.ts`, `main.go`,
91
+ `app.py`), route/endpoint registrations, CLI command registrations, event/message
92
+ handlers, scheduled tasks / cron jobs.
93
+
94
+ ### 1.2 Layer Identification
95
+ Map architectural layers by reading directory structures and key files:
96
+
97
+ | Pattern to Look For | Indicates |
98
+ |---------------------|-----------|
99
+ | `routes/`, `controllers/`, `handlers/` | API/HTTP layer |
100
+ | `services/`, `domain/`, `core/` | Business logic layer |
101
+ | `models/`, `entities/`, `schemas/` | Data model layer |
102
+ | `repositories/`, `dal/`, `db/` | Data access layer |
103
+ | `middleware/`, `interceptors/` | Cross-cutting middleware |
104
+ | `utils/`, `helpers/`, `lib/` | Shared utilities |
105
+ | `config/`, `settings/` | Configuration management |
106
+ | `tests/`, `__tests__/`, `spec/` | Test organization |
107
+ | `types/`, `interfaces/`, `contracts/` | Type definitions |
108
+ | `views/`, `pages/`, `components/` | UI layer (if applicable) |
109
+ | `migrations/`, `seeds/` | Database lifecycle |
110
+ | `plugins/`, `extensions/`, `modules/` | Plugin architecture |
111
+
112
+ ### 1.3 Module Dependency Mapping
113
+ For each module/layer, trace what it imports, what imports it, and the dependency
114
+ direction (should be unidirectional: controllers โ†’ services โ†’ repositories).
115
+
116
+ ### 1.4 Pattern Recognition
117
+ Identify recurring patterns and the evidence for each: MVC/MV*, layered
118
+ architecture, DDD (bounded contexts, aggregates, value objects), event-driven,
119
+ plugin architecture, microservices, monolith, CQRS, repository pattern.
120
+
121
+ ### 1.5 Output: `01-architecture-analysis.md`
122
+
123
+ ```markdown
124
+ # Architecture Analysis: [Name]
125
+
126
+ > Generated by retro-requirements โ€” Phase 1: Structural Analysis ยท Date: [Date]
127
+
128
+ ## Architecture Style
129
+ [e.g., "Layered monolith with MVC" or "Event-driven microservices"]
130
+
131
+ ## Layer Map
132
+ | Layer | Directory | Purpose | Key Files |
133
+ |-------|-----------|---------|-----------|
134
+
135
+ ## Entry Points
136
+ | Entry Point | File | Purpose |
137
+ |-------------|------|---------|
138
+
139
+ ## Module Dependency Graph
140
+ [Text-based dependency diagram]
141
+
142
+ ## Patterns Identified
143
+ | Pattern | Where | Evidence |
144
+ |---------|-------|----------|
145
+
146
+ ## Architecture Decisions (Inferred)
147
+ | Decision | Observed Choice | Likely Rationale |
148
+ |----------|----------------|------------------|
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Phase 2: Data Model Extraction
154
+
155
+ **Goal:** Reconstruct the complete domain model โ€” entities, relationships,
156
+ constraints, and lifecycle.
157
+
158
+ ### 2.1 Entity Discovery
159
+ Find data models in: ORM definitions (Sequelize, TypeORM, Prisma, SQLAlchemy,
160
+ ActiveRecord, GORM, โ€ฆ); migration files; schema definitions (GraphQL, JSON
161
+ Schema, Protobuf); domain classes/interfaces; seed/fixture files.
162
+
163
+ ### 2.2 For Each Entity, Extract
164
+ - **Fields/Properties:** name, type, constraints (required, unique, default, max length)
165
+ - **Relationships:** foreign keys, join tables, embedded documents
166
+ - **Lifecycle:** creation, modification, soft-delete, archive, state transitions
167
+ - **Validation:** server-side validation rules, custom validators
168
+ - **Indexes:** performance-critical queries (inferred)
169
+ - **Enums/Constants:** finite value sets (status codes, roles, types)
170
+
171
+ ### 2.3 Output: `02-domain-model.md`
172
+
173
+ ```markdown
174
+ # Domain Model: [Name]
175
+
176
+ > Generated by retro-requirements โ€” Phase 2: Data Model Extraction ยท Date: [Date]
177
+
178
+ ## Entity Inventory
179
+ | # | Entity | Description | Fields | Relationships |
180
+ |---|--------|-------------|--------|---------------|
181
+
182
+ ## Entity Details
183
+ ### [Entity Name]
184
+ **Description:** [What this entity represents in the domain]
185
+ **Fields:**
186
+ | Field | Type | Constraints | Description |
187
+ |-------|------|-------------|-------------|
188
+ **Relationships:** Has many / Belongs to โ€ฆ (via [field])
189
+ **Lifecycle:** Created when โ€ฆ ยท Modified when โ€ฆ ยท Deleted [soft/hard] when โ€ฆ
190
+ **Validation Rules:** [Rule 1, Rule 2, โ€ฆ]
191
+
192
+ ## Entity Relationship Map
193
+ [Text-based ERD showing all relationships]
194
+
195
+ ## Enums & Constants
196
+ | Name | Values | Used By |
197
+ |------|--------|---------|
198
+
199
+ ## Data Invariants
200
+ [Business rules about data integrity extracted from validation code]
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Phase 3: API & Interface Surface
206
+
207
+ **Goal:** Catalog every way the outside world interacts with the system.
208
+
209
+ - **3.1 HTTP/REST endpoints:** method + path, request/query/path params, response
210
+ format & status codes, auth/authorization requirements, rate limiting.
211
+ - **3.2 CLI commands:** name and subcommands, arguments and flags, output format, exit codes.
212
+ - **3.3 Public library API:** signature with types, purpose/behavior, error conditions.
213
+ - **3.4 Event interfaces:** published events (trigger, payload), consumed events
214
+ (handler, side effects), WebSocket channels/topics.
215
+
216
+ ### 3.5 Output: `03-api-surface.md`
217
+
218
+ ```markdown
219
+ # API & Interface Surface: [Name]
220
+
221
+ > Generated by retro-requirements โ€” Phase 3: API & Interface Surface ยท Date: [Date]
222
+
223
+ ## HTTP Endpoints
224
+ | Method | Path | Auth | Description | Request | Response |
225
+ |--------|------|------|-------------|---------|----------|
226
+
227
+ ## Endpoint Details
228
+ ### [GROUP: Resource Name]
229
+ #### [METHOD] [Path]
230
+ **Purpose / Authentication / Authorization / Request / Response**
231
+ **Business Rules:** [Rules extracted from the handler code]
232
+
233
+ ## CLI Commands (if applicable)
234
+ | Command | Description | Arguments |
235
+ |---------|-------------|-----------|
236
+
237
+ ## Events (if applicable)
238
+ | Event | Trigger | Payload | Consumers |
239
+ |-------|---------|---------|-----------|
240
+
241
+ ## Public API (if library)
242
+ | Export | Type | Description |
243
+ |--------|------|-------------|
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Phase 4: Behavior Catalog โ€” Feature Extraction
249
+
250
+ **Goal:** Translate code-level implementation into requirement-level feature
251
+ descriptions. This is the most important and most difficult phase.
252
+
253
+ ### 4.1 Approach
254
+ For each module/service from Phase 1: read the implementation; extract WHAT it
255
+ does (not HOW); write it as a requirement statement; identify edge cases handled
256
+ in the code (error branches, validation failures); note multi-step workflows.
257
+
258
+ ### 4.2 Feature Statement Format
259
+ ```
260
+ [CATEGORY]-[NUMBER]: [Actor] can [action] [conditions/constraints]
261
+ - Triggers: [What initiates this]
262
+ - Result: [What changes in the system]
263
+ - Edge cases: [What the code handles]
264
+ - Related: [Other features this connects to]
265
+ - Confidence: [โœ… Confirmed | โš ๏ธ Inferred | ๐Ÿ”ด Suspicious]
266
+ ```
267
+
268
+ **Every feature MUST carry a confidence level** โ€” see
269
+ `confidence-classification.md`. This is the safeguard against the code-as-truth
270
+ tautology and the source of the Phase 8B triage items.
271
+
272
+ ### 4.3 Feature Categories
273
+ Organize by domain area, not by code module: User Management; Core Domain (the
274
+ main business functionality); Data Management (CRUD, import/export, bulk);
275
+ Workflow (multi-step, approvals, state machines); Notifications; Administration;
276
+ Reporting.
277
+
278
+ ### 4.4 Output: `04-behavior-catalog.md`
279
+
280
+ ```markdown
281
+ # Behavior Catalog: [Name]
282
+
283
+ > Generated by retro-requirements โ€” Phase 4: Feature Extraction ยท Date: [Date]
284
+
285
+ ## Feature Summary
286
+ | # | Category | Features | Complexity |
287
+ |---|----------|----------|------------|
288
+
289
+ ## [Category]: [Name]
290
+ ### [CAT]-01: [Feature Title]
291
+ **Statement:** [Actor] can [action] [conditions]
292
+ **Triggers / Result**
293
+ **Edge Cases:** [extracted from error-handling code]
294
+ **Evidence:** [source file(s) where this behavior lives]
295
+ **Confidence:** [โœ… / โš ๏ธ / ๐Ÿ”ด โ€” with one-line justification]
296
+
297
+ ## Workflows (Multi-Step Processes)
298
+ ### Workflow: [Name]
299
+ **Steps:** 1. โ€ฆ โ†’ triggers 2. โ€ฆ โ†’ if [condition] then [3a] else [3b]
300
+ **Actors Involved / State Transitions**
301
+ ```
302
+
303
+ ---
304
+
305
+ ## Phase 5: Business Rules & Validation Logic
306
+
307
+ **Goal:** Extract the domain rules encoded in the code but often undocumented.
308
+
309
+ ### 5.1 Where to Find Business Rules
310
+ | Location | Type of Rule |
311
+ |----------|-------------|
312
+ | Validation middleware/decorators | Input constraints (format, range, required) |
313
+ | Service-layer if/else branches | Domain logic (eligibility, permissions, limits) |
314
+ | Database constraints | Data integrity (unique, foreign key, check) |
315
+ | Authorization checks | Access control (who can do what) |
316
+ | State-machine transitions | Lifecycle rules (valid transitions) |
317
+ | Scheduled jobs / cron | Time-based rules (expiry, cleanup, reminders) |
318
+ | Configuration / feature flags | Conditional behavior |
319
+
320
+ ### 5.2 Rule Classification
321
+ For each rule capture: **Rule ID** `BR-[category]-[number]`; **Statement** (plain
322
+ English, "A user cannot X unless Y"); **Type** (Validation / Authorization /
323
+ Domain / Lifecycle / Temporal); **Enforcement** (where in code); **Consequence**
324
+ (what happens on violation); and a **Confidence** level (โœ…/โš ๏ธ/๐Ÿ”ด).
325
+
326
+ ### 5.3 Output: `05-business-rules.md`
327
+
328
+ ```markdown
329
+ # Business Rules: [Name]
330
+
331
+ > Generated by retro-requirements โ€” Phase 5: Business Rules Extraction ยท Date: [Date]
332
+
333
+ ## Rule Summary
334
+ | Type | Count | Examples |
335
+ |------|-------|----------|
336
+ | Validation / Authorization / Domain / Lifecycle / Temporal | โ€ฆ | โ€ฆ |
337
+
338
+ ## Validation Rules
339
+ ### BR-VAL-01: [Title]
340
+ **Statement / Enforcement / Violation Response / Confidence**
341
+
342
+ ## Authorization Rules
343
+ ### BR-AUTH-01: [Title]
344
+ **Statement / Enforcement / Roles Involved / Confidence**
345
+
346
+ ## Domain Logic Rules
347
+ ### BR-DOM-01: [Title]
348
+ **Statement / Enforcement / Edge Cases / Confidence**
349
+
350
+ ## Lifecycle Rules
351
+ ### BR-LIFE-01: [Title]
352
+ **Statement / Valid Transitions / Invalid Transitions / Confidence**
353
+
354
+ ## Temporal Rules
355
+ ### BR-TIME-01: [Title]
356
+ **Statement / Schedule / Effect / Confidence**
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Phase 6: Cross-Cutting Concerns
362
+
363
+ **Goal:** Document system-wide patterns that span all modules.
364
+
365
+ Analyze: **Authentication** (login flow, tokens, sessions, OAuth/OIDC);
366
+ **Authorization** (RBAC/ABAC, permission checks, role hierarchies); **Error
367
+ Handling** (global handler, codes, response format); **Logging** (logger, levels,
368
+ structured logging, audit trail); **Caching** (strategy, invalidation, TTLs);
369
+ **Configuration** (loading, env-specific settings, feature flags); **Validation**
370
+ (framework, sanitization, schema); **i18n**; **Security** (CORS, CSP, rate
371
+ limiting, sanitization, encryption); **Observability** (metrics, tracing, health
372
+ checks). Also capture the **observed testing strategy** (framework, structure,
373
+ coverage areas, patterns) โ€” reference your project's coding/testing standards
374
+ (AGENTS.md) when judging quality.
375
+
376
+ ### 6.2 Output: `06-cross-cutting.md`
377
+
378
+ ```markdown
379
+ # Cross-Cutting Concerns: [Name]
380
+
381
+ > Generated by retro-requirements โ€” Phase 6: Cross-Cutting Concerns ยท Date: [Date]
382
+
383
+ ## Authentication โ€” Strategy + Implementation (login, tokens, expiry)
384
+ ## Authorization โ€” Model (RBAC/ABAC/Custom), Roles, Enforcement
385
+ ## Error Handling โ€” Strategy + error response format
386
+ ## Logging & Audit โ€” Framework + what is logged
387
+ ## Caching โ€” Strategy, TTLs, invalidation, technology
388
+ ## Configuration Management โ€” Sources + environment handling
389
+ ## Security Measures โ€” CORS, rate limiting, sanitization, encryption
390
+ ## Testing Strategy (Observed) โ€” Framework, structure, coverage, patterns
391
+ ```
392
+
393
+ ---
394
+
395
+ ## Phase 7: Integrations & External Dependencies
396
+
397
+ **Goal:** Map every external system the code communicates with.
398
+
399
+ Look for: HTTP client calls (`fetch`, `axios`, `reqwest`, `http.Client`);
400
+ database connections/queries; message-queue producers/consumers (RabbitMQ, Kafka,
401
+ SQS); email (SMTP, SendGrid, SES); file storage (S3, GCS, local FS); payment
402
+ providers (Stripe, PayPal); auth providers (Auth0, Keycloak, Google OAuth);
403
+ monitoring/analytics; third-party APIs.
404
+
405
+ ### 7.2 Output: `07-integrations.md`
406
+
407
+ ```markdown
408
+ # Integrations: [Name]
409
+
410
+ > Generated by retro-requirements โ€” Phase 7: Integrations ยท Date: [Date]
411
+
412
+ ## Integration Map
413
+ | # | System | Protocol | Direction | Purpose | Config |
414
+ |---|--------|----------|-----------|---------|--------|
415
+
416
+ ## Integration Details
417
+ ### [System Name]
418
+ **Type / Protocol / Purpose / Configuration (env vars, connection strings)**
419
+ **Error Handling:** [retry, circuit breaker, fallback]
420
+ **Data Flow:** Outbound [what is sent] ยท Inbound [what is received]
421
+ ```
422
+
423
+ ---
424
+
425
+ ## Phase 8: Gaps, Debt & Observations
426
+
427
+ **Goal:** Document what's missing, broken, or incomplete โ€” critical for honest
428
+ requirements.
429
+
430
+ ### 8.1 What to Look For
431
+ | Signal | Indicates |
432
+ |--------|-----------|
433
+ | `TODO`, `FIXME`, `HACK`, `XXX` comments | Known incomplete work |
434
+ | Empty catch blocks | Missing error handling |
435
+ | Commented-out code | Abandoned features or workarounds |
436
+ | Missing tests for modules | Untested functionality |
437
+ | Hardcoded values | Missing configuration |
438
+ | Debug print/log statements | Debugging artifacts |
439
+ | Disabled lint rules | Code-quality workarounds |
440
+ | Unused imports / dead code | Refactoring debt |
441
+ | Missing input validation | Security gaps |
442
+ | No retry/circuit-breaker on external calls | Reliability gaps |
443
+
444
+ ### 8.2 Output: `08-gaps-and-debt.md`
445
+
446
+ ```markdown
447
+ # Gaps & Technical Debt: [Name]
448
+
449
+ > Generated by retro-requirements โ€” Phase 8: Gaps & Debt ยท Date: [Date]
450
+
451
+ ## Summary
452
+ | Category | Count | Severity |
453
+ |----------|-------|----------|
454
+ | Missing Features / Technical Debt / Security Gaps / Test Coverage Gaps | โ€ฆ | โ€ฆ |
455
+
456
+ ## Missing Features (Should Exist But Don't)
457
+ | # | Gap | Expected Behavior | Impact |
458
+
459
+ ## Technical Debt
460
+ | # | Issue | Location | Recommended Fix |
461
+
462
+ ## Security Gaps
463
+ | # | Gap | Risk | Recommendation |
464
+
465
+ ## Test Coverage Gaps
466
+ | # | Module/Feature | Current Coverage | Needed |
467
+
468
+ ## TODO/FIXME Inventory
469
+ | # | Comment | File | Line | Context |
470
+
471
+ ## Known Bugs
472
+ [Populated by Phase 8B: items the user decided are bugs (option A) land here.]
473
+ ```
474
+
475
+ ---
476
+
477
+ ## Phase 8B: Bug-or-Feature Triage Gate
478
+
479
+ **๐Ÿšจ HARD, NON-NEGOTIABLE GATE โ€” must pass before Phase 9.** The full protocol,
480
+ register format, gate rules, persistence, and a worked example are in
481
+ **`triage-gate.md`**. Do not start Phase 9 until the register reads
482
+ `โœ… GATE PASSED`.
483
+
484
+ ---
485
+
486
+ ## Phase 9: Synthesis โ€” The Reconstruction Brief
487
+
488
+ **Goal:** Combine all phase outputs into a single document the make-requirements
489
+ skill can consume.
490
+
491
+ **๐Ÿšจ PREREQUISITE:** Phase 8B MUST have passed. If the triage register has any
492
+ unresolved items, STOP and complete Phase 8B first.
493
+
494
+ ### 9.1 Process
495
+ 1. Verify the triage register shows `โœ… GATE PASSED`.
496
+ 2. Review all phase outputs (`00`โ€“`08`).
497
+ 3. Translate code-level observations into requirement-level statements.
498
+ 4. Organize by domain area (not by code structure).
499
+ 5. Apply triage decisions โ€” (A) Bug items are EXCLUDED; (C) Unsure items are
500
+ included with โš ๏ธ flags and listed under Open Questions.
501
+ 6. Write the brief in the make-requirements input format.
502
+ 7. Include confidence levels โ€” the Feature Catalog and Business Rules tables MUST
503
+ carry the Confidence column from the Phase 4/5 annotations.
504
+
505
+ ### 9.2 Output: `09-reconstruction-brief.md`
506
+
507
+ ```markdown
508
+ # Reconstruction Brief: [Name]
509
+
510
+ > Generated by retro-requirements โ€” Phase 9: Synthesis
511
+ > Date: [Date] ยท Source Codebase: [Path]
512
+ >
513
+ > Usage: feed this document to the make-requirements skill as analysis-notes
514
+ > input โ€” "I have analysis notes in <resolved _retro dir>/09-reconstruction-brief.md".
515
+
516
+ ## Project Identity
517
+ **Name / Type / Description** (as if pitching it to someone who's never seen it)
518
+ **Problem Statement** (inferred from behavior) ยท **Target Users** (from auth/roles/UI)
519
+
520
+ ## Technology Decisions (Confirmed from Codebase)
521
+ | Decision | Choice | Confidence |
522
+ |----------|--------|------------|
523
+
524
+ ## Stakeholders / User Types
525
+ | # | Role | Description | Key Capabilities |
526
+
527
+ ## Domain Model
528
+ ### Core Entities
529
+ | Entity | Description | Key Fields | Relationships |
530
+ ### Entity Relationships
531
+ [Text-based ERD or descriptions]
532
+
533
+ ## Feature Catalog
534
+ ### [Domain Area]: [Name]
535
+ | # | Feature | Description | Complexity | Confidence |
536
+ |---|---------|-------------|------------|------------|
537
+
538
+ ## Business Rules
539
+ | # | Rule | Type | Description | Confidence |
540
+ |---|------|------|-------------|------------|
541
+
542
+ ## Workflows
543
+ ### [Workflow Name] โ€” Actors + numbered Steps โ†’ Outcomes
544
+
545
+ ## Integration Points
546
+ | # | System | Purpose | Protocol |
547
+
548
+ ## Cross-Cutting Requirements
549
+ | Concern | Current Implementation | Requirement Level |
550
+ | Auth / Authz / Error Handling / Logging / Caching / Security | โ€ฆ | โ€ฆ |
551
+
552
+ ## Non-Functional Characteristics
553
+ | Characteristic | Observed | Requirement |
554
+ | Performance / Scalability / Reliability / Accessibility | โ€ฆ | โ€ฆ |
555
+
556
+ ## Known Gaps & Improvement Opportunities
557
+ | # | Gap | Description | Recommendation |
558
+
559
+ ## Open Questions for Discovery
560
+ Questions the code alone can't answer โ€” explored during make-requirements:
561
+ 1. [e.g., "Is feature X intentional or a bug?" โ€” every (C) Unsure triage item lands here]
562
+ 2. [e.g., "What is the expected behavior when Y?"]
563
+ 3. [e.g., "Are there planned features not yet implemented? What are the performance targets?"]
564
+ ```
565
+
566
+ After completion, the next step is to feed the brief to the make-requirements
567
+ skill: *"I have analysis notes in
568
+ <resolved _retro dir>/09-reconstruction-brief.md"*.
569
+
570
+ ---
571
+
572
+ ## Progress Tracking: `_progress.md`
573
+
574
+ ```markdown
575
+ # Retro Requirements Progress
576
+
577
+ > Project: [Name] ยท Started: [Date] ยท Last Updated: [Date]
578
+
579
+ ## Phase Status
580
+ | Phase | Status | Files Analyzed | Notes |
581
+ |-------|--------|---------------|-------|
582
+ | 0: Reconnaissance | โœ… Complete | [N] | โ€” |
583
+ | 1: Structural Analysis | โœ… Complete | [N] | โ€” |
584
+ | 2: Domain Model | ๐Ÿ”„ In Progress | [N/M] | Completed: โ€ฆ Remaining: โ€ฆ |
585
+ | 3โ€“9 | โฌœ Not Started | โ€” | โ€” |
586
+
587
+ ## Module Coverage
588
+ | Module | Phase 2 | Phase 4 | Phase 5 | Notes |
589
+ |--------|---------|---------|---------|-------|
590
+ ```
591
+
592
+ Commit the `_retro/` files after each completed phase to prevent data loss across
593
+ sessions, e.g. `docs(retro): complete Phase X โ€” [phase name]`.
594
+
595
+ ---
596
+
597
+ ## Adapting to Project Type (full mapping)
598
+
599
+ | Project Type | Phase Focus | Extra Attention |
600
+ |---|---|---|
601
+ | Web App (full-stack) | All phases equally | UI components, routing, state management, SSR |
602
+ | API / Backend | Phases 2โ€“5 heavy | Endpoint contracts, auth, data validation |
603
+ | Library / SDK | Phase 3 heavy | Public API surface, backward compatibility, docs |
604
+ | CLI Tool | Phase 3 heavy | Command structure, output format, exit codes, config |
605
+ | Mobile App | Phase 4 heavy | Navigation, offline support, push notifications |
606
+ | Microservices | Phase 7 heavy | Service boundaries, inter-service comms, data ownership |
607
+ | Monorepo | Run per-package | Shared packages, cross-package dependencies |
608
+ | Data Pipeline | Phases 5, 7 heavy | Data flow, transformation rules, scheduling |
609
+ | Infrastructure | Phases 0, 7 heavy | Service definitions, networking, secrets management |