@prateek_ai/agents-maker 1.0.0 → 1.0.2

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 (68) hide show
  1. package/PROMPT_TEMPLATE.md +143 -0
  2. package/README.md +92 -25
  3. package/agents/brain.md +90 -0
  4. package/agents/orchestrator.md +24 -3
  5. package/agents/planpro.md +91 -0
  6. package/bin/cli.js +40 -4
  7. package/claude/agents/architect.md +182 -0
  8. package/claude/agents/brain.md +97 -0
  9. package/claude/agents/code.md +185 -0
  10. package/claude/agents/compress.md +233 -0
  11. package/claude/agents/execute.md +164 -0
  12. package/claude/agents/orchestrate.md +434 -0
  13. package/claude/agents/planpro.md +98 -0
  14. package/claude/agents/review.md +141 -0
  15. package/claude/agents/ui.md +154 -0
  16. package/claude/agents/ux.md +151 -0
  17. package/claude/commands/architect.md +15 -0
  18. package/claude/commands/brain.md +15 -0
  19. package/claude/commands/code.md +15 -0
  20. package/claude/commands/compress.md +15 -0
  21. package/claude/commands/execute.md +15 -0
  22. package/claude/commands/orchestrate.md +15 -0
  23. package/claude/commands/planpro.md +15 -0
  24. package/claude/commands/review.md +15 -0
  25. package/claude/commands/ui.md +15 -0
  26. package/claude/commands/ux.md +15 -0
  27. package/config/agents.yaml +56 -0
  28. package/context_loaders/project_summary.py +5 -0
  29. package/docs/architecture.md +318 -0
  30. package/docs/domains.md +154 -0
  31. package/docs/workflows.md +548 -0
  32. package/examples/generic_project_lifecycle.md +518 -0
  33. package/examples/proof/README.md +138 -0
  34. package/examples/proof/implement-a-python-function-that-parses-an-iso-8/grade.md +14 -0
  35. package/examples/proof/implement-a-python-function-that-parses-an-iso-8/naive_output.md +211 -0
  36. package/examples/proof/implement-a-python-function-that-parses-an-iso-8/naive_prompt.txt +1 -0
  37. package/examples/proof/implement-a-python-function-that-parses-an-iso-8/structured_output.md +210 -0
  38. package/examples/proof/implement-a-python-function-that-parses-an-iso-8/structured_user.txt +35 -0
  39. package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/grade.md +14 -0
  40. package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/naive_output.md +274 -0
  41. package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/naive_prompt.txt +1 -0
  42. package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/structured_output.md +127 -0
  43. package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/structured_user.txt +35 -0
  44. package/package.json +10 -2
  45. package/platforms/antigravity.md +195 -0
  46. package/platforms/claude.md +305 -0
  47. package/platforms/openai.md +333 -0
  48. package/skills/analyze_repo.md +86 -86
  49. package/token_optimization/compressor.py +4 -7
  50. package/tools/_core.py +102 -0
  51. package/tools/compare_prompts.py +196 -0
  52. package/tools/generate_claude_agents.py +162 -0
  53. package/tools/generate_claude_md.py +14 -80
  54. package/tools/generate_platform_configs.py +26 -36
  55. package/tools/generate_prompt.py +79 -79
  56. package/tools/grade_proof.py +118 -0
  57. package/tools/init_project.py +11 -58
  58. package/tools/routing.py +103 -0
  59. package/tools/test_kit.py +392 -363
  60. package/tools/validate_kit.py +15 -43
  61. package/context_loaders/__pycache__/__init__.cpython-314.pyc +0 -0
  62. package/context_loaders/__pycache__/file_chunker.cpython-314.pyc +0 -0
  63. package/context_loaders/__pycache__/project_summary.cpython-314.pyc +0 -0
  64. package/context_loaders/__pycache__/repo_tree.cpython-314.pyc +0 -0
  65. package/token_optimization/__pycache__/compressor.cpython-314.pyc +0 -0
  66. package/tools/__pycache__/domain_utils.cpython-314.pyc +0 -0
  67. package/tools/__pycache__/generate_claude_md.cpython-314.pyc +0 -0
  68. package/tools/__pycache__/validate_kit.cpython-314.pyc +0 -0
@@ -0,0 +1,548 @@
1
+ # Workflows
2
+
3
+ Step-by-step guides for the three primary use cases. Each workflow describes what context to collect, how the Orchestrator routes the request, and which token optimization steps apply.
4
+
5
+ ---
6
+
7
+ ## Workflow 1: Code Assistance
8
+
9
+ **Use for**: implementing a new feature, refactoring existing code, writing tests, fixing a bug, migrating to a new library.
10
+
11
+ ### Steps
12
+
13
+ **1. Collect context**
14
+
15
+ ```bash
16
+ python context_loaders/project_summary.py --path /your/repo
17
+ python context_loaders/repo_tree.py --path /your/repo --filter src/ app/ services/
18
+ ```
19
+
20
+ Paste both outputs as the opening message in your session.
21
+
22
+ **2. State your task**
23
+
24
+ Be specific. Include:
25
+ - What you want (feature, refactor, test, fix).
26
+ - Which files or modules are involved (if known).
27
+ - Any constraints (language version, framework, must not change API surface).
28
+
29
+ Example:
30
+ > Add a `POST /users/{id}/deactivate` endpoint to `services/user_service.py`. It should soft-delete by setting `is_active=False`. Reuse the existing `UserRepository.update()` method. Add unit tests using the project's existing pytest fixtures.
31
+
32
+ **3. Orchestrator routing**
33
+
34
+ The Orchestrator detects routing tags: `code`, possibly `architecture` if a new data model is involved.
35
+
36
+ - If scope is clear → routes directly to **Code Agent**.
37
+ - If a new service or schema is needed → routes to **Architect Agent** first, then **Code Agent**.
38
+
39
+ **4. Token optimization applied**
40
+
41
+ | Step | Policy |
42
+ |---|---|
43
+ | Relevance filter | Selects `user_service.py`, `user_repository.py`, test fixtures, schema files |
44
+ | History summarization | Applied if session > 6 turns |
45
+ | Output style | `detailed_with_code` (patches + explanation) |
46
+
47
+ **5. Review output**
48
+
49
+ The Code Agent returns patch-style diffs or full file replacements. Review for:
50
+ - Correctness against stated constraints.
51
+ - No invented APIs or methods.
52
+ - Tests follow existing fixture patterns.
53
+
54
+ ---
55
+
56
+ ## Workflow 2: Feature Design
57
+
58
+ **Use for**: designing a new API endpoint, planning a new microservice, creating a data model, writing an ADR.
59
+
60
+ ### Steps
61
+
62
+ **1. Collect context**
63
+
64
+ ```bash
65
+ python context_loaders/project_summary.py --path /your/repo
66
+ ```
67
+
68
+ Also collect any relevant existing API specs (e.g., OpenAPI YAML, proto files) and paste as snippets.
69
+
70
+ **2. State your goal**
71
+
72
+ Include:
73
+ - What the feature does and for whom.
74
+ - Integration points with existing services.
75
+ - Any non-functional requirements (latency, consistency, auth).
76
+
77
+ Example:
78
+ > Design a notification service that sends transactional emails and in-app notifications. It should be called by the Order Service and User Service. Events should be queued (we use RabbitMQ). Max latency for email delivery: 30s. No new databases — reuse Postgres.
79
+
80
+ **3. Orchestrator routing**
81
+
82
+ Detects tag: `architecture`. Routes to **Architect Agent**.
83
+
84
+ If the output feeds immediately into implementation, Orchestrator sequences **Architect Agent → Code Agent**.
85
+
86
+ **4. Token optimization applied**
87
+
88
+ | Step | Policy |
89
+ |---|---|
90
+ | Relevance filter | Selects existing service entrypoints, queue config, shared schema files |
91
+ | Output style | `design_brief` (tables, bullet lists, no inline code unless requested) |
92
+
93
+ **5. Review output**
94
+
95
+ The Architect Agent returns:
96
+ - Service responsibility summary.
97
+ - API contract (endpoint list or interface definition).
98
+ - Data flow diagram (text-based).
99
+ - Open questions that need answers before implementation.
100
+
101
+ ---
102
+
103
+ ## Workflow 3: UI/UX Improvement
104
+
105
+ **Use for**: improving a dashboard layout, simplifying an onboarding flow, critiquing a form, improving microcopy.
106
+
107
+ ### Steps
108
+
109
+ **1. Collect context**
110
+
111
+ Paste relevant component files and/or describe the UI in plain text. Include:
112
+ - Component tree or screen list.
113
+ - User persona or primary use case.
114
+ - Any specific pain points you are aware of.
115
+
116
+ ```bash
117
+ python context_loaders/file_chunker.py --path /your/repo --files components/Dashboard.tsx components/Onboarding/
118
+ ```
119
+
120
+ **2. State your goal**
121
+
122
+ Be specific about whether you want:
123
+ - Layout recommendations (→ **UI Agent**).
124
+ - Flow critique / friction removal (→ **UX Agent**).
125
+ - Both (→ Orchestrator sequences **UX Agent → UI Agent**).
126
+
127
+ Example:
128
+ > Our onboarding has 6 steps. Users drop off at step 3 (company info). The persona is a solo developer signing up for a dev tool. Suggest how to reduce steps and improve the copy on the company info screen.
129
+
130
+ **3. Orchestrator routing**
131
+
132
+ - `ux` tag → **UX Agent** for flow critique.
133
+ - `ui` tag → **UI Agent** for component/layout recommendations.
134
+ - Both tags → **UX Agent** first (restructure flow), then **UI Agent** (implement the restructured flow as components).
135
+
136
+ **4. Token optimization applied**
137
+
138
+ | Step | Policy |
139
+ |---|---|
140
+ | Relevance filter | Selects only the specific screen components, not unrelated components |
141
+ | Output style | `concise_bullets` for UX critique; `design_brief` for UI recommendations |
142
+ | Snippet truncation | Component files > 200 lines are truncated to props + render section |
143
+
144
+ **5. Review output**
145
+
146
+ - UX Agent: numbered list of friction points with severity + suggested fix.
147
+ - UI Agent: component hierarchy changes, design token suggestions, layout adjustments.
148
+
149
+ ---
150
+
151
+ ## Workflow 4: Code Review
152
+
153
+ **Use for**: reviewing a PR, auditing a file for quality/security, checking test coverage.
154
+
155
+ ### Steps
156
+
157
+ **1. Collect context**
158
+
159
+ Paste the diff or specific files. For large PRs, use `file_chunker.py` to extract changed files.
160
+
161
+ **2. State scope**
162
+
163
+ Specify what to focus on: security, performance, readability, test coverage, API design, etc.
164
+
165
+ **3. Orchestrator routing**
166
+
167
+ Routes to **Code Agent** with skill `review_code` invoked.
168
+
169
+ **4. Token optimization applied**
170
+
171
+ | Step | Policy |
172
+ |---|---|
173
+ | Output style | `review_checklist` (severity-rated issues in a table) |
174
+ | Max input files | 10 (if PR is larger, filter to highest-risk files first) |
175
+
176
+ ---
177
+
178
+ ## Combining Workflows
179
+
180
+ Workflows can be chained. The Orchestrator handles sequencing automatically based on routing tag priority:
181
+
182
+ ```
183
+ architecture → code → review_code
184
+ ux → ui → review_layout → improve_copy
185
+ ```
186
+
187
+ For a full feature build (design → implement → test → review), simply state the full goal and let the Orchestrator sequence the specialists. Use the `detailed_with_code` output style for these longer sessions.
188
+
189
+ ---
190
+
191
+ ## Universal Generic Project Lifecycle
192
+
193
+ A domain-agnostic workflow that applies to any complex task: software, content, research, analytics, product design, marketing, and operational processes. The same six-phase structure is used for all domains; only the agents selected and output formats vary.
194
+
195
+ For domain-specific details, see [`docs/domains.md`](docs/domains.md).
196
+ For token policies per phase, see [`config/token_policies.yaml`](config/token_policies.yaml) under `workflows.generic_project_lifecycle`.
197
+
198
+ ---
199
+
200
+ ### Phase Overview
201
+
202
+ | # | Phase | Key output artifact | Primary agent(s) |
203
+ |---|---|---|---|
204
+ | 0 | Task Framing & Domain Detection | `task_profile` | Orchestrator |
205
+ | 1 | Requirements & Problem Understanding | `requirements_spec` | Architect/Planner, Orchestrator |
206
+ | 2 | Solution Design | `solution_design` | Architect/Planner, UI/UX agents |
207
+ | 3 | Implementation / Drafting | `work_product` + `build_log` | Execution Agent, Code Agent (software) |
208
+ | 4 | Review, Testing & Refinement | `refinement_report` | Reviewer Agent |
209
+ | 5 | Packaging, Handoff & Next Steps | `handoff_package` | Orchestrator, Execution Agent |
210
+
211
+ Every phase ends with an explicit **approval gate**: the Orchestrator presents a phase summary and asks "Approve / request changes / change direction?" before advancing.
212
+
213
+ ---
214
+
215
+ ### Generic Phase Interface Contracts
216
+
217
+ Each phase has a domain-neutral interface contract: the minimum inputs it requires, the artifact it must produce, and the validation the Orchestrator runs before accepting it. Domain-specific extensions are additive — they never replace these minimums.
218
+
219
+ ---
220
+
221
+ **Phase 0 — Task Framing**
222
+
223
+ | | |
224
+ |---|---|
225
+ | **Preconditions** | Session start; user's opening message available |
226
+ | **Inputs consumed** | User message |
227
+ | **Output produced** | `task_profile` |
228
+ | **Required fields** | `domain`, `domain_confidence`, `task_type`, `goal`, `constraints[]`, `success_criteria`, `primary_agents[]` |
229
+ | **Domain extension fields** | Any domain-specific clarifications captured during framing (e.g., `stack`, `word_count_target`) |
230
+ | **Validation before advance** | All required fields non-empty; `domain_confidence` is `high` or `medium`; user has explicitly approved |
231
+
232
+ ---
233
+
234
+ **Phase 1 — Requirements**
235
+
236
+ | | |
237
+ |---|---|
238
+ | **Preconditions** | Approved `task_profile` |
239
+ | **Inputs consumed** | `task_profile`, any existing docs/specs/code provided by user |
240
+ | **Output produced** | `requirements_spec` |
241
+ | **Required fields** | `goals[]`, `non_goals[]`, `deliverables[]` (each with acceptance criteria), `constraints[]` (each tagged by type), `assumptions[]` |
242
+ | **Domain extension fields** | Domain-specific constraint types (e.g., `[compliance]` for software/ops, `[tone]` for content/marketing) |
243
+ | **Validation before advance** | At least one item in `goals`, `non_goals`, and `deliverables`; all `constraints` have a type tag; user approved |
244
+
245
+ ---
246
+
247
+ **Phase 2 — Solution Design**
248
+
249
+ | | |
250
+ |---|---|
251
+ | **Preconditions** | Approved `requirements_spec` |
252
+ | **Inputs consumed** | `requirements_spec`, existing project context |
253
+ | **Output produced** | `solution_design` |
254
+ | **Required fields** | `context` (problem restatement), `approach` (chosen strategy + rationale), `structure` (domain-specific breakdown), `risks[]` (each with mitigation or open question) |
255
+ | **Domain extension fields** | `structure` content varies by domain (see `artifact_hints.solution_design.structure_label` in `domain_profiles.yaml`) |
256
+ | **Validation before advance** | `structure` covers all `deliverables` from `requirements_spec`; at least one risk listed; user approved |
257
+
258
+ ---
259
+
260
+ **Phase 3 — Implementation**
261
+
262
+ | | |
263
+ |---|---|
264
+ | **Preconditions** | Approved `solution_design` |
265
+ | **Inputs consumed** | `solution_design`, project state, prior approved increments |
266
+ | **Output produced** | Growing `work_product` + `build_log` entries |
267
+ | **Required fields per increment** | `increment_n`, `description`, `status: approved`, work content (code diff / document section / copy asset) |
268
+ | **Domain extension fields** | Increment format varies: diff for software, section heading + body for content, copy asset for marketing |
269
+ | **Validation before advance to Phase 4** | All planned increments in `solution_design.structure` are present in `build_log` as `approved`; user signals implementation complete |
270
+
271
+ ---
272
+
273
+ **Phase 4 — Review**
274
+
275
+ | | |
276
+ |---|---|
277
+ | **Preconditions** | Substantially complete `work_product`; approved `requirements_spec` and `solution_design` for comparison |
278
+ | **Inputs consumed** | `work_product`, `requirements_spec`, `solution_design` |
279
+ | **Output produced** | `refinement_report` |
280
+ | **Required fields** | `verdict` (ready_to_ship / minor_revisions / significant_revisions), `findings[]` (each: severity, area, issue, recommendation), `positive_findings[]` (minimum 2 items) |
281
+ | **Domain extension fields** | Domain-specific review lens (see `reviewer_agent.md` → Review Lens by Domain) |
282
+ | **Validation before advance** | All `critical` and `high` findings resolved; Reviewer Agent emits explicit "ready for handoff" confirmation; user approved |
283
+
284
+ ---
285
+
286
+ **Phase 5 — Handoff**
287
+
288
+ | | |
289
+ |---|---|
290
+ | **Preconditions** | Reviewer Agent confirmation from Phase 4 |
291
+ | **Inputs consumed** | `work_product`, all prior artifacts |
292
+ | **Output produced** | `handoff_package` |
293
+ | **Required fields** | `summary[]` (3-5 bullets), `whats_done[]`, `whats_next.p1[]` (must do), `whats_next.p2[]` (recommended), `whats_next.p3[]` (future) |
294
+ | **Domain extension fields** | Domain-specific delivery instructions (env vars for software, key findings table for research, channel calendar for marketing) — see `artifact_hints.handoff.deliverables_label` in `domain_profiles.yaml` |
295
+ | **Validation before advance** | `whats_done` matches all `build_log` entries; `whats_next.p1` is non-empty; user confirmed |
296
+
297
+ ---
298
+
299
+ ### Phase 0 — Task Framing & Domain Detection
300
+
301
+ **Inputs**: User's opening message (any format — goal, problem statement, rough idea).
302
+
303
+ **Output artifact**: `task_profile`
304
+
305
+ ```
306
+ task_profile:
307
+ domain: <software | content | research | data_analytics | product_design | marketing | ops_process>
308
+ task_type: <greenfield | extension | investigation>
309
+ goal: <one sentence>
310
+ constraints: [list]
311
+ inputs_available: [list of what the user already has]
312
+ success_criteria: <how done looks>
313
+ primary_agents: [list selected for this domain]
314
+ ```
315
+
316
+ **Primary agent**: Orchestrator
317
+ **Supporting agents**: None (Orchestrator works directly with the user here)
318
+
319
+ **Questions the Orchestrator asks** (output style: `qa_brief`):
320
+ 1. What is the primary deliverable?
321
+ 2. Is this greenfield, an extension, or an investigation?
322
+ 3. Who is the end user or reader?
323
+ 4. What hard constraints apply (deadline, stack, length, compliance)?
324
+ 5. What does success look like?
325
+
326
+ **Token optimization**:
327
+ - No file context needed yet.
328
+ - History summarization not triggered (typically 1–3 turns).
329
+ - After `task_profile` is confirmed, Compression Agent emits a session-start state block.
330
+
331
+ **Approval gate**: Orchestrator presents the `task_profile` and asks the user to confirm or correct it before proceeding.
332
+
333
+ ---
334
+
335
+ ### Phase 1 — Requirements & Problem Understanding
336
+
337
+ **Inputs**: Confirmed `task_profile`, any existing documents/specs/code the user provides.
338
+
339
+ **Output artifact**: `requirements_spec`
340
+
341
+ ```
342
+ requirements_spec:
343
+ goals: [list]
344
+ non_goals: [list]
345
+ stakeholders: [list with roles]
346
+ deliverables: [list with acceptance criteria]
347
+ constraints: [{type, description}]
348
+ assumptions: [list of inferred items]
349
+ ```
350
+
351
+ **Primary agent**: Architect/Planner
352
+ **Supporting agents**: Orchestrator (drives clarification loop)
353
+
354
+ **Questions asked** (output style: `requirements_spec`):
355
+ - What must the solution do vs. what is explicitly out of scope?
356
+ - Who are the stakeholders and what does each need?
357
+ - What quality/compliance/style constraints apply?
358
+ - What existing assets, systems, or knowledge can be reused?
359
+
360
+ **Token optimization**:
361
+ - Relevant files filtered in (e.g., existing spec, codebase summary, prior research).
362
+ - `max_input_files: 5`, `max_input_tokens: 14000`.
363
+ - Output style: `requirements_spec`.
364
+
365
+ **Approval gate**: Orchestrator presents the `requirements_spec` in full and asks for approval before solution design begins.
366
+
367
+ ---
368
+
369
+ ### Phase 2 — Solution Design
370
+
371
+ **Inputs**: Approved `requirements_spec`, existing project context.
372
+
373
+ **Output artifact**: `solution_design`
374
+
375
+ Structure (consistent skeleton across all domains):
376
+ - **Context** — problem restated in one paragraph.
377
+ - **Approach** — chosen strategy and rationale.
378
+ - **Structure** — domain-specific breakdown (architecture / outline / methodology / campaign stages).
379
+ - **Risks & Open Questions** — blockers and decisions needed before implementation.
380
+
381
+ **Primary agent**: Architect/Planner
382
+ **Supporting agents**: UI Agent (presentation/interface layer), UX Agent (experience/flow layer)
383
+
384
+ **Domain-specific structure output**:
385
+ | Domain | "Structure" section contains |
386
+ |---|---|
387
+ | `software` | Service map, API contract, data model, ADR |
388
+ | `content` | Document outline (H-tree), style guide, argument map |
389
+ | `research` | Research question hierarchy, methodology, source list, analysis framework |
390
+ | `data_analytics` | Data model, metric definitions, pipeline DAG |
391
+ | `product_design` | Feature brief, user journey, screen flow, component hierarchy |
392
+ | `marketing` | Campaign stages, messaging framework, channel plan |
393
+ | `ops_process` | Process map, RACI matrix, exception-handling table |
394
+
395
+ **Token optimization**:
396
+ - `max_input_files: 5`, `max_input_tokens: 12000`.
397
+ - Output style: `solution_design`.
398
+ - Compression Agent compresses requirements discussion into `requirements_spec` before this phase.
399
+
400
+ **Approval gate**: Full `solution_design` artifact presented. Explicit approval before any implementation begins.
401
+
402
+ ---
403
+
404
+ ### Phase 3 — Implementation / Drafting
405
+
406
+ **Inputs**: Approved `solution_design`, project state.
407
+
408
+ **Output artifact**: `work_product` (growing) + `build_log`
409
+
410
+ Each increment follows this structure (output style: `implementation_slice`):
411
+ ```
412
+ Increment Plan:
413
+ - This slice: <what is being produced now>
414
+ - Depends on: <prior approved increment or design decision>
415
+ - Next slice: <what comes after>
416
+
417
+ [work product content — code diff, document section, research note, copy asset]
418
+
419
+ Approve this increment / request changes / change direction?
420
+ ```
421
+
422
+ **Primary agent**: Code Agent (software), Execution Agent (all other domains)
423
+ **Supporting agents**: UI Agent, UX Agent (for design-heavy domains)
424
+
425
+ **Token optimization**:
426
+ - `max_input_files: 6`, `max_input_tokens: 18000`.
427
+ - History summarized after 5 turns (long phase).
428
+ - Output style: `implementation_slice`.
429
+ - `build_log` appended to project state after each approved increment.
430
+
431
+ **Approval gate**: After each increment. User may approve, request changes, or redirect to a different part of the solution.
432
+
433
+ ---
434
+
435
+ ### Phase 4 — Review, Testing & Refinement
436
+
437
+ **Inputs**: Completed (or near-complete) `work_product`, `requirements_spec`, `solution_design`.
438
+
439
+ **Output artifact**: `refinement_report`
440
+
441
+ ```
442
+ refinement_report:
443
+ verdict: <ready_to_ship | minor_revisions | significant_revisions>
444
+ findings: [{severity, area, issue, recommendation}]
445
+ positive_findings: [list]
446
+ applied_changes: [list after iteration]
447
+ ```
448
+
449
+ **Primary agent**: Reviewer Agent
450
+ **Supporting agents**: Code Agent (for software fixes), Execution Agent (for content/copy fixes)
451
+
452
+ **Review lens by domain**:
453
+ | Domain | What is reviewed |
454
+ |---|---|
455
+ | `software` | Correctness, edge cases, security, test coverage, performance |
456
+ | `content` | Logical flow, claims vs. evidence, style consistency, reading level |
457
+ | `research` | Rigor, coverage gaps, bias, source credibility |
458
+ | `data_analytics` | Metric correctness, NULL handling, grain consistency |
459
+ | `marketing` | Brand alignment, CTA clarity, funnel coherence |
460
+ | `ops_process` | Edge case coverage, ownership clarity, compliance |
461
+
462
+ **Token optimization**:
463
+ - `max_input_files: 8`, `max_input_tokens: 20000`.
464
+ - Output style: `critique_summary`.
465
+ - Compression Agent summarizes prior implementation turns before this phase runs.
466
+
467
+ **Approval gate**: After review findings are presented and changes applied, Reviewer Agent confirms: "All critical/high items resolved — ready to proceed to handoff?" User approves.
468
+
469
+ ---
470
+
471
+ ### Phase 5 — Packaging, Handoff & Next Steps
472
+
473
+ **Inputs**: Approved `work_product`, all prior artifacts.
474
+
475
+ **Output artifact**: `handoff_package`
476
+
477
+ ```
478
+ handoff_package:
479
+ summary: [3–5 bullets]
480
+ how_to_use: [numbered steps]
481
+ whats_done: [list]
482
+ whats_next:
483
+ p1_must_do: [list]
484
+ p2_recommended: [list]
485
+ p3_future: [list]
486
+ ```
487
+
488
+ **Primary agent**: Orchestrator
489
+ **Supporting agents**: Execution Agent (drafts domain-specific instructions)
490
+
491
+ **Token optimization**:
492
+ - `max_input_tokens: 8000` (context is now the final artifact + project state, not raw files).
493
+ - Output style: `handoff_package`.
494
+ - After handoff is confirmed, Compression Agent archives the full `project_state.md` snapshot for future sessions.
495
+
496
+ **Approval gate**: Final — user confirms the handoff package is complete.
497
+
498
+ ---
499
+
500
+ ### Domain Examples
501
+
502
+ #### Example A — Software: Complaint-Tracking Microservice
503
+
504
+ **User**: "Build a microservice that tracks user complaints with SLAs for an Indian government portal."
505
+
506
+ | Phase | What happens |
507
+ |---|---|
508
+ | 0 — Task Framing | Orchestrator detects domain: `software`, type: `greenfield`. Asks: stack? team? SLA values? existing auth? Produces `task_profile`. |
509
+ | 1 — Requirements | Architect/Planner elicits: complaint lifecycle states, SLA thresholds, notification triggers, audit requirements. Produces `requirements_spec` with compliance constraint `[compliance: RTI Act]`. |
510
+ | 2 — Solution Design | Architect/Planner produces: REST API contract (POST /complaints, GET /complaints/{id}, PATCH /complaints/{id}/escalate), Postgres data model, SLA-check background job design, ADR for queue choice. |
511
+ | 3 — Implementation | Code Agent delivers: data models → repository layer → service layer → API routes → SLA job → tests. One component per increment. |
512
+ | 4 — Review | Reviewer Agent: flags missing index on `complaints.status`, missing auth on escalation endpoint, no test for SLA breach notification. Code Agent applies fixes. |
513
+ | 5 — Handoff | Docker setup instructions, migration command, env var list, recommended Phase 2 features (dashboard, bulk export). |
514
+
515
+ **Project state evolution (abbreviated)**:
516
+ ```
517
+ Turn 2: task_profile confirmed (domain: software, greenfield)
518
+ Turn 5: requirements_spec approved (7 endpoints, 3 SLA tiers)
519
+ Turn 8: solution_design approved (ADR: RabbitMQ for SLA notifications)
520
+ Turn 18: work_product complete (8 increments, 12 files)
521
+ Turn 21: refinement_report: 2 critical fixed, 3 medium fixed
522
+ Turn 23: handoff_package confirmed
523
+ ```
524
+
525
+ ---
526
+
527
+ #### Example B — Research: Market Research Brief
528
+
529
+ **User**: "Write a 5-page market research brief on algorithmic trading adoption among Indian retail traders."
530
+
531
+ | Phase | What happens |
532
+ |---|---|
533
+ | 0 — Task Framing | Orchestrator detects domain: `research`, type: `greenfield`. Asks: audience (technical or executive?), sources (public data only?), 5-page = ~2500 words?, deadline. Produces `task_profile`. |
534
+ | 1 — Requirements | Architect/Planner elicits: key research questions (adoption rate, barriers, regulatory context, platform comparison), audience (fintech analyst, not academic), tone (professional, data-driven). |
535
+ | 2 — Solution Design | Architect/Planner produces: research question tree (3 primary + 8 sub-questions), document outline (Executive Summary, Market Size, Adoption Drivers, Barriers, Regulatory Landscape, Platform Comparison, Outlook), seed source list, analysis framework (PESTLE for barriers). |
536
+ | 3 — Drafting | Execution Agent drafts section by section: Executive Summary → Market Size → Adoption Drivers → Barriers → Regulatory → Platform Comparison → Outlook. Each section ~350–400 words. |
537
+ | 4 — Review | Reviewer Agent checks: unsupported claims (3 flagged), missing SEBI regulatory context (high severity), inconsistent use of "algo trading" vs. "algorithmic trading". All fixed. |
538
+ | 5 — Handoff | Final 2,650-word document, key findings table (5 rows), limitations section, 3 recommended follow-up research questions. |
539
+
540
+ **Project state evolution (abbreviated)**:
541
+ ```
542
+ Turn 2: task_profile confirmed (domain: research, 2500 words, fintech analyst audience)
543
+ Turn 4: requirements_spec approved (3 research questions, PESTLE framework)
544
+ Turn 6: solution_design approved (7-section outline, seed sources)
545
+ Turn 16: work_product complete (7 section drafts)
546
+ Turn 19: refinement_report: 1 high fixed, 2 medium fixed
547
+ Turn 21: handoff_package confirmed
548
+ ```