@vpxa/aikit 0.1.73 → 0.1.74

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 (126) hide show
  1. package/package.json +4 -1
  2. package/packages/cli/dist/index.js +2 -2
  3. package/packages/cli/dist/{init-D_OGLUN1.js → init-DQkar6Es.js} +4 -4
  4. package/packages/cli/dist/scaffold-ukCDW3wQ.js +2 -0
  5. package/packages/cli/dist/{templates-DJ7EC5vw.js → templates-ArdAVWoY.js} +13 -3
  6. package/packages/cli/dist/user-CopNWxHP.js +5 -0
  7. package/packages/dashboard/dist/assets/index-C6D-PCp0.js.map +1 -1
  8. package/packages/flows/dist/index.d.ts +29 -0
  9. package/packages/flows/dist/index.js +1 -1
  10. package/packages/server/dist/index.js +1 -1
  11. package/packages/server/dist/{server-B9Mx1aK-.js → server-CVhVH5cT.js} +127 -127
  12. package/packages/tools/dist/index.d.ts +19 -1
  13. package/packages/tools/dist/index.js +39 -39
  14. package/scaffold/{flows → _preview/flows}/aikit-advanced/README.md +1 -1
  15. package/scaffold/{flows → _preview/flows}/aikit-basic/README.md +1 -1
  16. package/scaffold/adapters/flows.mjs +27 -0
  17. package/scaffold/adapters/skills.mjs +25 -0
  18. package/scaffold/compiled/flows-data.mjs +1571 -0
  19. package/scaffold/compiled/skills-data.mjs +11678 -0
  20. package/scaffold/definitions/exclusions.mjs +58 -0
  21. package/scaffold/definitions/plugins.mjs +44 -44
  22. package/scaffold/generate.mjs +24 -14
  23. package/packages/cli/dist/scaffold-CJwkHf-q.js +0 -2
  24. package/packages/cli/dist/user-BEmVW8Tp.js +0 -5
  25. package/scaffold/flows/aikit-advanced/flow.json +0 -69
  26. package/scaffold/flows/aikit-basic/flow.json +0 -45
  27. /package/scaffold/{general → _preview}/agents/Architect-Reviewer-Alpha.agent.md +0 -0
  28. /package/scaffold/{general → _preview}/agents/Architect-Reviewer-Beta.agent.md +0 -0
  29. /package/scaffold/{general → _preview}/agents/Code-Reviewer-Alpha.agent.md +0 -0
  30. /package/scaffold/{general → _preview}/agents/Code-Reviewer-Beta.agent.md +0 -0
  31. /package/scaffold/{general → _preview}/agents/Debugger.agent.md +0 -0
  32. /package/scaffold/{general → _preview}/agents/Documenter.agent.md +0 -0
  33. /package/scaffold/{general → _preview}/agents/Explorer.agent.md +0 -0
  34. /package/scaffold/{general → _preview}/agents/Frontend.agent.md +0 -0
  35. /package/scaffold/{general → _preview}/agents/Implementer.agent.md +0 -0
  36. /package/scaffold/{general → _preview}/agents/Orchestrator.agent.md +0 -0
  37. /package/scaffold/{general → _preview}/agents/Planner.agent.md +0 -0
  38. /package/scaffold/{general → _preview}/agents/README.md +0 -0
  39. /package/scaffold/{general → _preview}/agents/Refactor.agent.md +0 -0
  40. /package/scaffold/{general → _preview}/agents/Researcher-Alpha.agent.md +0 -0
  41. /package/scaffold/{general → _preview}/agents/Researcher-Beta.agent.md +0 -0
  42. /package/scaffold/{general → _preview}/agents/Researcher-Delta.agent.md +0 -0
  43. /package/scaffold/{general → _preview}/agents/Researcher-Gamma.agent.md +0 -0
  44. /package/scaffold/{general → _preview}/agents/Security.agent.md +0 -0
  45. /package/scaffold/{general → _preview}/agents/_shared/architect-reviewer-base.md +0 -0
  46. /package/scaffold/{general → _preview}/agents/_shared/code-agent-base.md +0 -0
  47. /package/scaffold/{general → _preview}/agents/_shared/code-reviewer-base.md +0 -0
  48. /package/scaffold/{general → _preview}/agents/_shared/decision-protocol.md +0 -0
  49. /package/scaffold/{general → _preview}/agents/_shared/forge-protocol.md +0 -0
  50. /package/scaffold/{general → _preview}/agents/_shared/researcher-base.md +0 -0
  51. /package/scaffold/{general → _preview}/agents/templates/adr-template.md +0 -0
  52. /package/scaffold/{general → _preview}/agents/templates/execution-state.md +0 -0
  53. /package/scaffold/{flows → _preview/flows}/_epilogue/steps/docs-sync/README.md +0 -0
  54. /package/scaffold/{flows → _preview/flows}/aikit-advanced/steps/design/README.md +0 -0
  55. /package/scaffold/{flows → _preview/flows}/aikit-advanced/steps/execute/README.md +0 -0
  56. /package/scaffold/{flows → _preview/flows}/aikit-advanced/steps/plan/README.md +0 -0
  57. /package/scaffold/{flows → _preview/flows}/aikit-advanced/steps/spec/README.md +0 -0
  58. /package/scaffold/{flows → _preview/flows}/aikit-advanced/steps/task/README.md +0 -0
  59. /package/scaffold/{flows → _preview/flows}/aikit-advanced/steps/verify/README.md +0 -0
  60. /package/scaffold/{flows → _preview/flows}/aikit-basic/steps/assess/README.md +0 -0
  61. /package/scaffold/{flows → _preview/flows}/aikit-basic/steps/design/README.md +0 -0
  62. /package/scaffold/{flows → _preview/flows}/aikit-basic/steps/implement/README.md +0 -0
  63. /package/scaffold/{flows → _preview/flows}/aikit-basic/steps/verify/README.md +0 -0
  64. /package/scaffold/{general → _preview}/prompts/aikit-ask.prompt.md +0 -0
  65. /package/scaffold/{general → _preview}/prompts/aikit-debug.prompt.md +0 -0
  66. /package/scaffold/{general → _preview}/prompts/aikit-design.prompt.md +0 -0
  67. /package/scaffold/{general → _preview}/prompts/aikit-flow-add.prompt.md +0 -0
  68. /package/scaffold/{general → _preview}/prompts/aikit-flow-create.prompt.md +0 -0
  69. /package/scaffold/{general → _preview}/prompts/aikit-flow-manage.prompt.md +0 -0
  70. /package/scaffold/{general → _preview}/prompts/aikit-implement.prompt.md +0 -0
  71. /package/scaffold/{general → _preview}/prompts/aikit-plan.prompt.md +0 -0
  72. /package/scaffold/{general → _preview}/prompts/aikit-review.prompt.md +0 -0
  73. /package/scaffold/{general → _preview}/skills/adr-skill/SKILL.md +0 -0
  74. /package/scaffold/{general → _preview}/skills/adr-skill/assets/templates/adr-madr.md +0 -0
  75. /package/scaffold/{general → _preview}/skills/adr-skill/assets/templates/adr-readme.md +0 -0
  76. /package/scaffold/{general → _preview}/skills/adr-skill/assets/templates/adr-simple.md +0 -0
  77. /package/scaffold/{general → _preview}/skills/adr-skill/references/adr-conventions.md +0 -0
  78. /package/scaffold/{general → _preview}/skills/adr-skill/references/examples.md +0 -0
  79. /package/scaffold/{general → _preview}/skills/adr-skill/references/review-checklist.md +0 -0
  80. /package/scaffold/{general → _preview}/skills/adr-skill/references/template-variants.md +0 -0
  81. /package/scaffold/{general → _preview}/skills/adr-skill/scripts/bootstrap_adr.js +0 -0
  82. /package/scaffold/{general → _preview}/skills/adr-skill/scripts/new_adr.js +0 -0
  83. /package/scaffold/{general → _preview}/skills/adr-skill/scripts/set_adr_status.js +0 -0
  84. /package/scaffold/{general → _preview}/skills/aikit/SKILL.md +0 -0
  85. /package/scaffold/{general → _preview}/skills/brainstorming/SKILL.md +0 -0
  86. /package/scaffold/{general → _preview}/skills/brainstorming/spec-document-reviewer-prompt.md +0 -0
  87. /package/scaffold/{general → _preview}/skills/c4-architecture/SKILL.md +0 -0
  88. /package/scaffold/{general → _preview}/skills/c4-architecture/references/advanced-patterns.md +0 -0
  89. /package/scaffold/{general → _preview}/skills/c4-architecture/references/c4-syntax.md +0 -0
  90. /package/scaffold/{general → _preview}/skills/c4-architecture/references/common-mistakes.md +0 -0
  91. /package/scaffold/{general → _preview}/skills/c4-architecture/references/html-design-system.md +0 -0
  92. /package/scaffold/{general → _preview}/skills/c4-architecture/references/html-template.html +0 -0
  93. /package/scaffold/{general → _preview}/skills/docs/SKILL.md +0 -0
  94. /package/scaffold/{general → _preview}/skills/docs/references/diataxis-anti-patterns.md +0 -0
  95. /package/scaffold/{general → _preview}/skills/docs/references/diataxis-compass.md +0 -0
  96. /package/scaffold/{general → _preview}/skills/docs/references/diataxis-quadrants.md +0 -0
  97. /package/scaffold/{general → _preview}/skills/docs/references/diataxis-quality.md +0 -0
  98. /package/scaffold/{general → _preview}/skills/docs/references/diataxis-templates.md +0 -0
  99. /package/scaffold/{general → _preview}/skills/docs/references/flow-artifacts-guide.md +0 -0
  100. /package/scaffold/{general → _preview}/skills/docs/references/project-knowledge-gotchas.md +0 -0
  101. /package/scaffold/{general → _preview}/skills/docs/references/project-knowledge-templates.md +0 -0
  102. /package/scaffold/{general → _preview}/skills/docs/references/project-knowledge-workflow.md +0 -0
  103. /package/scaffold/{general → _preview}/skills/frontend-design/SKILL.md +0 -0
  104. /package/scaffold/{general → _preview}/skills/lesson-learned/SKILL.md +0 -0
  105. /package/scaffold/{general → _preview}/skills/lesson-learned/references/anti-patterns.md +0 -0
  106. /package/scaffold/{general → _preview}/skills/lesson-learned/references/se-principles.md +0 -0
  107. /package/scaffold/{general → _preview}/skills/multi-agents-development/SKILL.md +0 -0
  108. /package/scaffold/{general → _preview}/skills/multi-agents-development/architecture-review-prompt.md +0 -0
  109. /package/scaffold/{general → _preview}/skills/multi-agents-development/code-quality-review-prompt.md +0 -0
  110. /package/scaffold/{general → _preview}/skills/multi-agents-development/implementer-prompt.md +0 -0
  111. /package/scaffold/{general → _preview}/skills/multi-agents-development/parallel-dispatch-example.md +0 -0
  112. /package/scaffold/{general → _preview}/skills/multi-agents-development/spec-review-prompt.md +0 -0
  113. /package/scaffold/{general → _preview}/skills/present/SKILL.md +0 -0
  114. /package/scaffold/{general → _preview}/skills/react/SKILL.md +0 -0
  115. /package/scaffold/{general → _preview}/skills/repo-access/SKILL.md +0 -0
  116. /package/scaffold/{general → _preview}/skills/repo-access/references/error-patterns.md +0 -0
  117. /package/scaffold/{general → _preview}/skills/repo-access/references/platform-matrix.md +0 -0
  118. /package/scaffold/{general → _preview}/skills/requirements-clarity/SKILL.md +0 -0
  119. /package/scaffold/{general → _preview}/skills/session-handoff/SKILL.md +0 -0
  120. /package/scaffold/{general → _preview}/skills/session-handoff/references/handoff-template.md +0 -0
  121. /package/scaffold/{general → _preview}/skills/session-handoff/references/resume-checklist.md +0 -0
  122. /package/scaffold/{general → _preview}/skills/session-handoff/scripts/check_staleness.js +0 -0
  123. /package/scaffold/{general → _preview}/skills/session-handoff/scripts/create_handoff.js +0 -0
  124. /package/scaffold/{general → _preview}/skills/session-handoff/scripts/list_handoffs.js +0 -0
  125. /package/scaffold/{general → _preview}/skills/session-handoff/scripts/validate_handoff.js +0 -0
  126. /package/scaffold/{general → _preview}/skills/typescript/SKILL.md +0 -0
@@ -0,0 +1,1571 @@
1
+ // Auto-generated by scaffold/compile.mjs — DO NOT EDIT
2
+ export const FLOWS = {
3
+ "_epilogue": [
4
+ { file: "steps/docs-sync/README.md", content: `# Epilogue: Documentation Sync
5
+
6
+ > **This is a mandatory epilogue step.** It runs automatically after every flow completes to keep project documentation synchronized with code changes.
7
+
8
+ ## Objective
9
+
10
+ Review the changes made during this flow and update the \`docs/\` folder using AI Kit analysis tools — never write docs from scratch when a tool can generate the foundation.
11
+
12
+ ## Prerequisites
13
+
14
+ Load the \`docs\` skill before proceeding — it contains the full documentation convention, templates, architecture blueprint workflow, and change-to-doc mapping rules.
15
+
16
+ ## Instructions
17
+
18
+ ### 0. Gather Flow Artifacts
19
+
20
+ Read all artifacts produced during this flow — they contain design decisions, requirements, and verification results that are the most valuable documentation input.
21
+
22
+ \`\`\`
23
+ flow_status() # Get artifactsPath
24
+ find({ pattern: "*.md", path: "{{artifacts_path}}" }) # Discover all flow artifacts
25
+ digest({ sources: [ # Compress artifacts for context
26
+ { path: "<found-artifact-1>" },
27
+ { path: "<found-artifact-2>" },
28
+ ...
29
+ ]})
30
+ \`\`\`
31
+
32
+ Map each discovered artifact to documentation actions using the artifact-to-doc mapping from the \`docs\` skill. Different flows produce different artifacts — read everything \`find()\` returns and focus on content that contains decisions, requirements, and verification results.
33
+
34
+ If no artifacts exist, proceed to Step 1 in source-only mode.
35
+
36
+ ### 1. Assess Changes (tool-driven)
37
+
38
+ \`\`\`
39
+ git_context({}) # What changed in this flow
40
+ blast_radius({ changed_files: ["<changed-files>"] }) # Impact analysis — which modules affected
41
+ \`\`\`
42
+
43
+ Use the output to classify changes:
44
+
45
+ | Change Signal | Documentation Action |
46
+ |---------------|---------------------|
47
+ | New files in \`src/\` | Potential new component doc |
48
+ | Modified API surface | Update reference docs |
49
+ | New package or module boundary | Update architecture overview |
50
+ | Architecture decision made | Delegate to \`adr-skill\` |
51
+ | Test-only or config-only changes | Likely skip |
52
+
53
+ ### 2. Apply the Change-to-Doc Mapping
54
+
55
+ Follow the decision tree from the \`docs\` skill to determine which documentation actions are needed.
56
+
57
+ ### 3. Bootstrap \`docs/\` If Needed (full tool-driven workflow)
58
+
59
+ If \`docs/\` doesn't exist, run the **Architecture Blueprint Workflow** from the \`docs\` skill:
60
+
61
+ \`\`\`
62
+ # Step 1: Generate content with AI Kit tools
63
+ produce_knowledge({ path: "." }) # → Foundation for docs/README.md
64
+ analyze_structure({ path: "." }) # → docs/architecture/overview.md structure
65
+ analyze_diagram({ path: "." }) # → docs/architecture/ Mermaid diagrams
66
+ analyze_dependencies({ path: "." }) # → docs/architecture/overview.md deps section
67
+ analyze_entry_points({ path: "." }) # → docs/reference/api.md foundation
68
+ analyze_patterns({ path: "." }) # → docs/architecture/overview.md patterns
69
+
70
+ # Step 2: Create the docs/ tree from tool outputs
71
+ docs/
72
+ ├── README.md ← From produce_knowledge + project context
73
+ ├── architecture/
74
+ │ ├── overview.md ← From analyze_structure + analyze_dependencies + analyze_diagram
75
+ │ └── components/ ← From analyze_symbols per major component
76
+ ├── decisions/
77
+ │ └── index.md ← ADR log (delegate to adr-skill)
78
+ ├── guides/
79
+ │ └── testing.md ← From analyze_patterns test info
80
+ └── reference/
81
+ └── api.md ← From analyze_entry_points
82
+ \`\`\`
83
+
84
+ Use the Architecture Blueprint sections from the \`docs\` skill as the template for each document.
85
+
86
+ ### 4. Update Existing Docs (tool-assisted)
87
+
88
+ When \`docs/\` already exists:
89
+
90
+ \`\`\`
91
+ compact({ path: "docs/architecture/overview.md", query: "section to update" }) # Read target section
92
+ blast_radius({ changed_files: ["<files>"] }) # What's affected
93
+ \`\`\`
94
+
95
+ - **Don't rewrite** — update the relevant sections of existing docs
96
+ - **Don't duplicate** — if the information is in code comments or READMEs, reference it
97
+ - Use \`compact\` to read existing doc sections before editing
98
+ - Use \`blast_radius\` output to determine which sections need updating
99
+
100
+ ### 5. Delegate When Appropriate
101
+
102
+ - Architecture decisions → \`adr-skill\` → \`docs/decisions/\`
103
+ - Architecture diagrams → \`c4-architecture\` skill → \`docs/architecture/\`
104
+ - Full architecture refresh → Run the Architecture Blueprint Workflow from \`docs\` skill
105
+
106
+ ### 6. Update Index
107
+
108
+ If documents were added, removed, or renamed, update \`docs/README.md\` to reflect the current structure.
109
+
110
+ ### 7. Skip If Nothing Changed
111
+
112
+ If the flow's changes don't warrant doc updates (e.g., pure bug fix with no revelations), report:
113
+ - "No documentation updates needed"
114
+ - Reason: (brief explanation)
115
+
116
+ ## Completion Criteria
117
+
118
+ - [ ] \`git_context\` + \`blast_radius\` used to assess changes
119
+ - [ ] Change-to-doc mapping applied from \`docs\` skill
120
+ - [ ] \`docs/\` bootstrapped with tool outputs if it didn't exist
121
+ - [ ] Relevant docs created or updated (or skipped with reason)
122
+ - [ ] \`docs/README.md\` index is current
123
+ - [ ] No placeholder/empty docs created — all content tool-generated or hand-written with purpose` },
124
+ ],
125
+ "aikit-advanced": [
126
+ { file: "README.md", content: `# aikit:advanced — Full Development Flow
127
+
128
+ Full development flow for **new features, API design, and architecture changes**.
129
+
130
+ ## Steps
131
+
132
+ | # | Step | Skill | Produces | Requires | Agents |
133
+ |---|------|-------|----------|----------|--------|
134
+ | 1 | **Design Gate** | \`steps/design/README.md\` | \`design-decisions.md\` | — | Researcher-Alpha/Beta/Gamma/Delta |
135
+ | 2 | **Specification** | \`steps/spec/README.md\` | \`spec.md\` | \`design-decisions.md\` | Researcher-Alpha |
136
+ | 3 | **Planning** | \`steps/plan/README.md\` | \`plan.md\` | \`spec.md\` | Planner, Explorer |
137
+ | 4 | **Task Breakdown** | \`steps/task/README.md\` | \`tasks.md\` | \`plan.md\` | Planner, Architect-Reviewer-Alpha |
138
+ | 5 | **Execution** | \`steps/execute/README.md\` | \`progress.md\` | \`tasks.md\` | Orchestrator, Implementer, Frontend, Refactor |
139
+ | 6 | **Verification** | \`steps/verify/README.md\` | \`verify-report.md\` | \`progress.md\` | Code-Reviewer-Alpha/Beta, Architect-Reviewer-Alpha/Beta, Security |
140
+
141
+ ## How It Works
142
+
143
+ Each step has a **README.md** file that contains the detailed instructions for the agent(s) executing that step. The Orchestrator reads the README.md via \`flow_read_instruction\` and delegates work accordingly.
144
+
145
+ ### Step 1: Design Gate
146
+ - Full brainstorming session for new features and architectural changes
147
+ - FORGE classification (\`forge_classify\`) + grounding (\`forge_ground\`) for complex tasks
148
+ - Parallel 4-researcher decision protocol for non-trivial technical decisions
149
+ - ADR generation for critical-tier tasks
150
+ - **Mandatory user stop** before proceeding — design decisions must be approved
151
+ - Read \`steps/design/README.md\` for the full protocol
152
+
153
+ ### Step 2: Specification
154
+ - Elicit requirements from the user, clarify scope
155
+ - Define acceptance criteria and constraints
156
+ - Build on design decisions from the previous step
157
+
158
+ ### Step 3: Planning
159
+ - Deep codebase analysis using \`search\`, \`scope_map\`, \`trace\`, \`analyze_*\`
160
+ - Design architecture based on spec and design decisions
161
+ - Create comprehensive implementation plan with file-level changes
162
+
163
+ ### Step 4: Task Breakdown
164
+ - Break the plan into ordered, atomic implementation tasks
165
+ - Define dependencies between tasks
166
+ - Identify parallel batches for multi-agent execution
167
+ - Architecture review of the task structure
168
+
169
+ ### Step 5: Execution
170
+ - Orchestrator dispatches agents in parallel batches per the task breakdown
171
+ - Each agent gets a scoped task (1-3 files) with clear acceptance criteria
172
+ - TDD: write tests first, then implement
173
+ - Per-batch review cycle: Code Review (dual) → Arch Review → Security → Evidence Gate
174
+
175
+ ### Step 6: Verification
176
+ - Dual code review (Code-Reviewer-Alpha + Beta)
177
+ - Architecture review (Architect-Reviewer-Alpha + Beta)
178
+ - Security review
179
+ - Run \`check({})\` + \`test_run({})\` + \`blast_radius({})\`
180
+ - \`evidence_map({ action: "gate" })\` for final quality gate
181
+
182
+ ## Using Skills Inside Steps
183
+
184
+ When the Orchestrator activates a step:
185
+
186
+ 1. **Read the instruction first** — \`flow_read_instruction\` returns the README.md for the current step
187
+ 2. **Follow step instructions** — the README.md is the primary guide for what to do
188
+ 3. **Delegate to listed agents** — each step lists which agents are appropriate
189
+ 4. **Produce the required artifact** — the step's \`produces\` field specifies what file to create in the artifacts directory
190
+ 5. **Check dependencies** — the step's \`requires\` field lists artifacts from previous steps that must exist
191
+ 6. **Report status** — agents report \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\` to the Orchestrator
192
+
193
+ ## Artifacts
194
+
195
+ All artifacts are stored in the run directory under \`.flows/{topic}/\`. The template variable \`{{artifacts_path}}\` resolves to the actual path at runtime.
196
+ ` },
197
+ { file: "steps/design/README.md", content: `# Design Gate — Advanced Flow
198
+
199
+ Full design gate for new features, API design, and architecture changes. Runs brainstorming, decision protocol, and FORGE classification before specification begins.
200
+
201
+ ## When This Step Runs
202
+
203
+ This is the **first step** of the \`aikit:advanced\` flow. It runs before specification.
204
+
205
+ ## Instructions
206
+
207
+ ### 1. Task Classification
208
+
209
+ Classify the task:
210
+
211
+ | Category | Indicators | Action |
212
+ |----------|-----------|--------|
213
+ | **Bug fix** | Error, regression, "fix" — wrong flow, should use \`aikit:basic\` | → Note mismatch, still run Quick Design |
214
+ | **New feature** | New behavior, new API, new component | → Run **Full Design** below |
215
+ | **Architecture change** | Restructure, migration, new pattern, cross-cutting | → Run **Full Design** with architecture focus |
216
+
217
+ ### 2. FORGE Classification
218
+
219
+ Run \`forge_classify({ task: "<task description>", files: [<relevant files>] })\` to determine the complexity tier.
220
+
221
+ | Tier | Meaning | Design Depth |
222
+ |------|---------|-------------|
223
+ | **Floor** | Low risk, well-understood | Quick brainstorm, 1-2 decisions |
224
+ | **Standard** | Moderate complexity | Full brainstorm, parallel research, decision protocol |
225
+ | **Critical** | High risk, contract/security implications | Deep brainstorm, 4-researcher parallel review, ADR required |
226
+
227
+ ### 3. Brainstorming Session
228
+
229
+ Load the \`brainstorming\` skill and conduct a structured brainstorming session:
230
+
231
+ 1. **Intent Discovery** — What is the user trying to achieve? What problem does this solve?
232
+ 2. **Constraint Mapping** — Technical constraints, time constraints, compatibility requirements
233
+ 3. **Approach Exploration** — Generate 2-4 possible approaches
234
+ 4. **Trade-off Analysis** — Compare approaches on: complexity, maintainability, performance, risk
235
+
236
+ For **Critical** tier tasks, also explore:
237
+ - Security implications
238
+ - Backward compatibility
239
+ - Migration path
240
+ - Rollback strategy
241
+
242
+ ### 4. Decision Protocol (Standard & Critical tiers)
243
+
244
+ When technical decisions need resolution:
245
+
246
+ 1. **Identify decisions** — List each decision point with 2+ viable options
247
+ 2. **Parallel research** — Delegate to Researcher agents (2 for Standard, 4 for Critical):
248
+ - Researcher-Alpha: Deep analysis of primary approach
249
+ - Researcher-Beta: Trade-offs and edge cases of alternatives
250
+ - Researcher-Gamma: Cross-domain patterns and precedents
251
+ - Researcher-Delta: Feasibility and performance implications
252
+ 3. **Synthesize** — Combine researcher findings into a recommendation per decision
253
+ 4. **ADR** (Critical tier) — Load \`adr-skill\` and create an Architecture Decision Record
254
+
255
+ ### 5. FORGE Ground (Standard & Critical tiers)
256
+
257
+ Run \`forge_ground({ task, root_path: "." })\` to:
258
+ - Scope the affected files and modules
259
+ - Identify unknowns and risks
260
+ - Load existing constraints and conventions
261
+
262
+ **Auto-upgrade check**: If \`forge_ground\` reveals contract-type unknowns or security concerns not caught by initial \`forge_classify\`, recommend tier upgrade.
263
+
264
+ ### 6. Write \`{{artifacts_path}}/design-decisions.md\` to disk
265
+
266
+ **You MUST create this file on disk** using \`create_file\` or equivalent — do not just present content in chat.
267
+
268
+ \`\`\`markdown
269
+ ## Design Decisions
270
+
271
+ ### FORGE Assessment
272
+ - **Tier**: {Floor | Standard | Critical}
273
+ - **Rationale**: {why this tier}
274
+ - **Auto-upgrade**: {yes/no — if yes, explain}
275
+
276
+ ### Task Summary
277
+ - **Goal**: {what we're building}
278
+ - **Problem**: {what problem this solves}
279
+ - **Users affected**: {who is impacted}
280
+
281
+ ### Approach
282
+ - **Chosen approach**: {description}
283
+ - **Alternatives considered**: {list with reasons for rejection}
284
+
285
+ ### Key Decisions
286
+ | # | Decision | Choice | Rationale |
287
+ |---|----------|--------|-----------|
288
+ | 1 | {decision} | {choice} | {why} |
289
+
290
+ ### Constraints
291
+ - {constraint 1}
292
+ - {constraint 2}
293
+
294
+ ### Risks
295
+ | Risk | Likelihood | Impact | Mitigation |
296
+ |------|-----------|--------|------------|
297
+ | {risk} | {L/M/H} | {L/M/H} | {mitigation} |
298
+
299
+ ### Open Questions
300
+ - {question 1}
301
+ - {question 2}
302
+ \`\`\`
303
+
304
+ ### 7. Present to User
305
+
306
+ Use \`present({ format: "html" })\` (or \`format: "browser"\` in CLI mode) to show:
307
+ - Design decisions summary
308
+ - FORGE tier and rationale
309
+ - Key trade-offs
310
+ - Open questions requiring user input
311
+
312
+ **🛑 MANDATORY STOP** — Wait for user approval of design decisions before proceeding.
313
+
314
+ ### 8. Report to Orchestrator
315
+
316
+ After user approves:
317
+ - \`DONE\` — design decisions approved, ready for specification
318
+ - \`DONE_WITH_CONCERNS\` — approved with caveats (list them)
319
+ - \`NEEDS_CONTEXT\` — user raised questions that need more research
320
+
321
+ **Do NOT call \`flow_step\`** — let the Orchestrator advance the flow.
322
+
323
+ ## Outputs
324
+
325
+ Write \`{{artifacts_path}}/design-decisions.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat. This file is a prerequisite for the next step.
326
+
327
+ ## Produces
328
+
329
+ - \`{{artifacts_path}}/design-decisions.md\` — FORGE tier, approach, key decisions, constraints, risks
330
+
331
+ ## Agents
332
+
333
+ - \`Researcher-Alpha\` — Deep analysis of primary approach
334
+ - \`Researcher-Beta\` — Trade-offs and edge cases
335
+ - \`Researcher-Gamma\` — Cross-domain patterns
336
+ - \`Researcher-Delta\` — Feasibility and performance
337
+
338
+ ## Foundation Integration
339
+
340
+ Load these skills BEFORE executing this step:
341
+
342
+ | Skill | Purpose | When |
343
+ |-------|---------|------|
344
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
345
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
346
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
347
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
348
+ | \`c4-architecture\` | C4 model diagrams showing system structure changes | When visualizing proposed architecture |
349
+ | \`adr-skill\` | Architecture Decision Records for non-trivial decisions | Critical tier — document architecture decisions |
350
+
351
+ ### Presentation Rules
352
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
353
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
354
+ - Tables, charts, progress tracking, code review findings → always present
355
+ - Artifact content and summaries → present with structured layout
356
+ - Only use plain text for brief confirmations and simple questions
357
+
358
+ ## Completion Criteria
359
+
360
+ - [ ] \`{{artifacts_path}}/design-decisions.md\` written to disk (NOT just presented in chat)
361
+ - [ ] FORGE tier determined and documented
362
+ - [ ] Brainstorming session completed (for Standard+ tier)
363
+ - [ ] Key design decisions documented with rationale
364
+ - [ ] User approval received (🛑 MANDATORY STOP)
365
+
366
+ ## Knowledge Capture
367
+
368
+ Before completing this step, persist important findings using \`remember()\`:
369
+
370
+ - **Design decisions**: Chosen approach and alternatives considered with trade-offs
371
+ - **Architecture patterns**: New patterns introduced or existing patterns that must be followed
372
+ - **Constraints discovered**: Technical limitations, compatibility requirements, or performance boundaries
373
+
374
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
375
+ ` },
376
+ { file: "steps/execute/README.md", content: `---
377
+ name: execute
378
+ description: Implement all tasks from the task breakdown, dispatching agents in parallel where possible.
379
+ ---
380
+
381
+ # Execution
382
+
383
+ ## Prerequisites Check
384
+
385
+ Before starting this step, verify:
386
+ - [ ] Task breakdown approved with valid task graph
387
+ - [ ] \`{{artifacts_path}}/tasks.md\` exists with defined batches and dependencies
388
+
389
+ If prerequisites are NOT met -> **backtrack to task step** (\`flow_step({ action: 'redo' })\` on previous step)
390
+
391
+ ## Purpose
392
+
393
+ Execute all tasks from the breakdown, dispatching implementation agents in batches for maximum parallelism while maintaining correctness.
394
+
395
+ ## Inputs
396
+
397
+ - \`{{artifacts_path}}/tasks.md\` — the atomic task list with dependencies and agent assignments
398
+
399
+ ## Process
400
+
401
+ 1. **Load tasks** — Read task graph, dependencies, and parallelism map
402
+ 2. **Execute by batch** — For each batch in the parallelism map:
403
+ a. Dispatch assigned agents in parallel (different files = safe parallelism)
404
+ b. Each agent receives: task scope, affected files, acceptance criteria, relevant code context via \`compact()\`/\`digest()\`
405
+ c. Wait for all agents in batch to complete
406
+ d. Run \`check({})\` + \`test_run({})\` after each batch
407
+ e. Fix any failures before proceeding to next batch
408
+ 3. **Track progress** — Update task checkboxes as each completes
409
+ 4. **Handle failures** — If an agent reports \`BLOCKED\` or \`NEEDS_CONTEXT\`:
410
+ - Max 2 retries per task with refined context
411
+ - If still blocked, escalate to user
412
+ 5. **Final validation** — After all batches: \`check({})\` + \`test_run({})\` must pass
413
+
414
+ ## Outputs
415
+
416
+ Write \`{{artifacts_path}}/progress.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
417
+
418
+ Template:
419
+
420
+ \`\`\`markdown
421
+ # Execution Progress: <feature title>
422
+
423
+ ## Task Status
424
+ - [x] T1.1: <description> — DONE
425
+ - [x] T1.2: <description> — DONE
426
+ - [x] T2.1: <description> — DONE
427
+ - [ ] T2.2: <description> — IN PROGRESS
428
+ ...
429
+
430
+ ## Changes Made
431
+ | File | Change | Task |
432
+ |------|--------|------|
433
+ | <file> | <description> | T1.1 |
434
+ | ... | ... | ... |
435
+
436
+ ## Tests Added/Modified
437
+ <list of test files and what they cover>
438
+
439
+ ## Validation
440
+ - check: PASS/FAIL
441
+ - test_run: PASS/FAIL (<N> passed, <M> failed)
442
+
443
+ ## Deviations
444
+ <any changes from the task plan and why>
445
+
446
+ ## Blocked Items
447
+ <items that needed user intervention, if any>
448
+ \`\`\`
449
+
450
+ ## Agents
451
+
452
+ | Agent | Role |
453
+ |-------|------|
454
+ | **Orchestrator** | Coordinates batch execution, handles failures and retries |
455
+ | **Implementer** | Primary code writer for backend, logic, and infrastructure tasks |
456
+ | **Frontend** | UI/UX implementation for React components, styling, responsive design |
457
+ | **Refactor** | Code cleanup, restructuring, and pattern alignment tasks |
458
+
459
+ **Parallelism rules**:
460
+ - Read-only agents: unlimited parallelism
461
+ - File-modifying agents: parallel ONLY on completely different files
462
+ - Max 4 concurrent file-modifying agents
463
+
464
+ ## Foundation Integration
465
+
466
+ Load these skills BEFORE executing this step:
467
+
468
+ | Skill | Purpose | When |
469
+ |-------|---------|------|
470
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
471
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
472
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
473
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
474
+ | \`session-handoff\` | Context preservation for long-running execution phases | When execution spans multiple sessions or context is filling |
475
+
476
+ ### Presentation Rules
477
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
478
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
479
+ - Tables, charts, progress tracking, code review findings → always present
480
+ - Artifact content and summaries → present with structured layout
481
+ - Only use plain text for brief confirmations and simple questions
482
+
483
+ ### Orchestrator Dispatch Protocol
484
+
485
+ Follow the \`multi-agents-development\` skill patterns for dispatch:
486
+
487
+ 1. **Independence Check** before parallelizing:
488
+ - Same files? → sequential
489
+ - Shared mutable state? → sequential
490
+ - Execution-order dependent? → sequential
491
+ - Need shared new types? → define contract first, then parallel
492
+ - All clear? → **parallel dispatch**
493
+
494
+ 2. **Subagent Context Template** (each dispatch includes):
495
+ - **Scope**: exact files + boundary (do NOT touch)
496
+ - **Goal**: acceptance criteria, testable
497
+ - **Arch Context**: actual code snippets via \`compact()\`/\`digest()\`
498
+ - **Constraints**: patterns, conventions, anti-patterns
499
+ - **Self-Review**: checklist before declaring DONE
500
+
501
+ 3. **Status Protocol**: \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`
502
+ 4. **Max 2 retries** per task — then escalate to user
503
+
504
+ ## Completion Criteria
505
+
506
+ - [ ] All tasks marked completed
507
+ - [ ] \`check({})\` passes
508
+ - [ ] \`test_run({})\` passes
509
+ - [ ] No blocked items remaining
510
+ - [ ] \`{{artifacts_path}}/progress.md\` written
511
+
512
+ ## Knowledge Capture
513
+
514
+ Before completing this step, persist important findings using \`remember()\`:
515
+
516
+ - **Implementation decisions**: Why specific approaches were chosen over alternatives
517
+ - **Patterns established**: New conventions or patterns that future code should follow
518
+ - **Gotchas encountered**: Edge cases, workarounds, or non-obvious behaviors discovered during execution
519
+
520
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
521
+ ` },
522
+ { file: "steps/plan/README.md", content: `---
523
+ name: plan
524
+ description: Analyze the codebase, design the architecture, and create a detailed implementation plan.
525
+ ---
526
+
527
+ # Planning
528
+
529
+ ## Prerequisites Check
530
+
531
+ Before starting this step, verify:
532
+ - [ ] Specification approved with clarity score ≥90
533
+ - [ ] \`{{artifacts_path}}/spec.md\` exists and is complete
534
+
535
+ If prerequisites are NOT met → **backtrack to spec step** (\`flow_step({ action: 'redo' })\` on previous step)
536
+
537
+ ## Purpose
538
+
539
+ Translate the specification into a concrete, phased implementation plan with architecture decisions, file-level scope, and dependency ordering.
540
+
541
+ ## Inputs
542
+
543
+ - \`{{artifacts_path}}/spec.md\` — the validated specification
544
+
545
+ ## Process
546
+
547
+ 1. **Load spec** — Read and internalize all requirements and acceptance criteria
548
+ 2. **Codebase analysis** — \`scope_map({ task: "<feature>" })\` to identify affected subsystems
549
+ 3. **Deep dive** — \`file_summary()\` + \`compact()\` on each affected module
550
+ 4. **Architecture design** — Decide on:
551
+ - Where new code lives (new files vs extensions)
552
+ - API surface changes
553
+ - Data model changes
554
+ - Integration patterns
555
+ 5. **ADR for non-trivial decisions** — Use \`adr-skill\` for decisions that affect future development
556
+ 6. **Phase decomposition** — Break work into 3–10 ordered phases, each independently testable
557
+ 7. **Dependency graph** — Map which phases depend on others and which can parallelize
558
+ 8. **Risk assessment** — Identify implementation risks per phase
559
+
560
+ ## Outputs
561
+
562
+ Write \`{{artifacts_path}}/plan.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
563
+
564
+ Template:
565
+
566
+ \`\`\`markdown
567
+ # Implementation Plan: <feature title>
568
+
569
+ ## Architecture Overview
570
+ <high-level design with rationale>
571
+
572
+ ## Affected Modules
573
+ | Module | Changes | Risk |
574
+ |--------|---------|------|
575
+ | <module> | <what changes> | low/medium/high |
576
+
577
+ ## Phases
578
+ ### Phase 1: <name>
579
+ - **Files**: <list>
580
+ - **Changes**: <description>
581
+ - **Tests**: <what to test>
582
+ - **Depends on**: none
583
+ - **Parallelizable with**: Phase 2
584
+
585
+ ### Phase 2: <name>
586
+ ...
587
+
588
+ ## Architecture Decisions
589
+ - ADR-<N>: <title> — <chosen option and rationale>
590
+
591
+ ## Risks
592
+ | Risk | Likelihood | Impact | Mitigation |
593
+ |------|-----------|--------|------------|
594
+ | <risk> | low/medium/high | <impact> | <mitigation> |
595
+ \`\`\`
596
+
597
+ ## Agents
598
+
599
+ | Agent | Role |
600
+ |-------|------|
601
+ | **Planner** | Creates comprehensive TDD implementation plans with phase decomposition |
602
+ | **Explorer** | Rapid codebase exploration for discovery of affected files and dependencies |
603
+
604
+ Use Explorer for initial breadth (file discovery, dependency tracing), then Planner for depth (phase design, ordering).
605
+
606
+ ## Foundation Integration
607
+
608
+ Load these skills BEFORE executing this step:
609
+
610
+ | Skill | Purpose | When |
611
+ |-------|---------|------|
612
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
613
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
614
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
615
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
616
+ | \`adr-skill\` | Architecture Decision Records for non-trivial technical decisions | When plan involves architecture choices that need documentation |
617
+ | \`c4-architecture\` | C4 model diagrams showing system structure changes | When plan modifies system architecture |
618
+
619
+ ### Presentation Rules
620
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
621
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
622
+ - Tables, charts, progress tracking, code review findings → always present
623
+ - Artifact content and summaries → present with structured layout
624
+ - Only use plain text for brief confirmations and simple questions
625
+
626
+ ## Completion Criteria
627
+
628
+ - [ ] All spec requirements have corresponding plan phases
629
+ - [ ] Each phase has explicit file scope and test strategy
630
+ - [ ] Architecture decisions documented with rationale
631
+ - [ ] Dependency graph has no circular dependencies
632
+ - [ ] Risks identified with mitigations
633
+ - [ ] \`{{artifacts_path}}/plan.md\` written
634
+
635
+ ## Knowledge Capture
636
+
637
+ Before completing this step, persist important findings using \`remember()\`:
638
+
639
+ - **Task dependencies**: Critical ordering constraints and parallel opportunities
640
+ - **Risk assessment**: Identified risks and mitigation strategies
641
+ - **Resource decisions**: File ownership, module boundaries, and integration points
642
+
643
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
644
+ ` },
645
+ { file: "steps/spec/README.md", content: `---
646
+ name: spec
647
+ description: Elicit requirements, clarify scope, and define acceptance criteria through structured dialogue.
648
+ ---
649
+
650
+ # Specification
651
+
652
+ ## Prerequisites Check
653
+
654
+ Before starting this step, verify:
655
+ - [ ] Design decisions approved (design-decisions.md exists with user approval)
656
+ - [ ] FORGE tier assigned and documented
657
+
658
+ If prerequisites are NOT met -> **backtrack to design step** (\`flow_step({ action: 'redo' })\` on previous step)
659
+
660
+ ## Purpose
661
+
662
+ Transform a vague or broad feature request into a precise, testable specification through requirements elicitation and stakeholder dialogue.
663
+
664
+ ## Inputs
665
+
666
+ - User's feature request, issue, or idea
667
+ - Codebase context (accessed via aikit MCP tools)
668
+
669
+ ## Process
670
+
671
+ 1. **Understand intent** — Parse what the user wants and why
672
+ 2. **Search for context** — \`search()\` for related prior decisions, existing patterns, and similar features
673
+ 3. **Elicit requirements** — Ask structured questions to clarify:
674
+ - **Functional**: What must the system do?
675
+ - **Non-functional**: Performance, security, accessibility constraints
676
+ - **Scope boundaries**: What is explicitly out of scope?
677
+ - **Acceptance criteria**: How do we know it's done?
678
+ 4. **Score clarity** — Use the \`requirements-clarity\` skill to score 0–100. Iterate questions until ≥ 90.
679
+ 5. **Draft specification** — Write formal spec with all requirements resolved
680
+
681
+ ## Outputs
682
+
683
+ Write \`{{artifacts_path}}/spec.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
684
+
685
+ Template:
686
+
687
+ \`\`\`markdown
688
+ # Specification: <feature title>
689
+
690
+ ## Summary
691
+ <1-2 sentence description>
692
+
693
+ ## Motivation
694
+ <why this feature is needed>
695
+
696
+ ## Functional Requirements
697
+ 1. <requirement with acceptance criterion>
698
+ 2. ...
699
+
700
+ ## Non-Functional Requirements
701
+ - Performance: <constraints>
702
+ - Security: <constraints>
703
+ - Accessibility: <constraints>
704
+
705
+ ## Scope
706
+ ### In Scope
707
+ - <item>
708
+
709
+ ### Out of Scope
710
+ - <item>
711
+
712
+ ## Acceptance Criteria
713
+ - [ ] <testable criterion>
714
+ - [ ] ...
715
+
716
+ ## Open Questions
717
+ <none — all resolved during elicitation>
718
+
719
+ ## Clarity Score: <N>/100
720
+ \`\`\`
721
+
722
+ ## Agents
723
+
724
+ | Agent | Role |
725
+ |-------|------|
726
+ | **Researcher-Alpha** | Deep analysis of existing codebase patterns, prior decisions, and technical constraints |
727
+
728
+ Use the \`brainstorming\` skill for creative/design exploration before formalizing requirements. Use \`requirements-clarity\` skill to score and iterate until the spec is unambiguous.
729
+
730
+ ## Foundation Integration
731
+
732
+ Load these skills BEFORE executing this step:
733
+
734
+ | Skill | Purpose | When |
735
+ |-------|---------|------|
736
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
737
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
738
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
739
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
740
+ | \`requirements-clarity\` | Score requirements 0-100, iterate until ≥90 before proceeding | Before writing spec — ensures requirements are clear enough |
741
+
742
+ ### Presentation Rules
743
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
744
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
745
+ - Tables, charts, progress tracking, code review findings → always present
746
+ - Artifact content and summaries → present with structured layout
747
+ - Only use plain text for brief confirmations and simple questions
748
+
749
+ ## Completion Criteria
750
+
751
+ - [ ] All functional requirements have acceptance criteria
752
+ - [ ] Scope boundaries are explicit
753
+ - [ ] Requirements clarity score ≥ 90
754
+ - [ ] No open questions remain
755
+ - [ ] \`{{artifacts_path}}/spec.md\` written
756
+
757
+ ## Knowledge Capture
758
+
759
+ Before completing this step, persist important findings using \`remember()\`:
760
+
761
+ - **Requirements clarified**: Ambiguities resolved and assumptions validated
762
+ - **Scope boundaries**: What the spec covers and explicit exclusions
763
+ - **Acceptance criteria**: Key testable conditions that define "done"
764
+
765
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
766
+ ` },
767
+ { file: "steps/task/README.md", content: `---
768
+ name: task
769
+ description: Break the implementation plan into ordered, atomic tasks with dependencies and agent assignments.
770
+ ---
771
+
772
+ # Task Breakdown
773
+
774
+ ## Prerequisites Check
775
+
776
+ Before starting this step, verify:
777
+ - [ ] Implementation plan approved
778
+ - [ ] \`{{artifacts_path}}/plan.md\` exists with defined phases
779
+
780
+ If prerequisites are NOT met → **backtrack to plan step** (\`flow_step({ action: 'redo' })\` on previous step)
781
+
782
+ ## Purpose
783
+
784
+ Decompose the implementation plan into small, atomic tasks that agents can execute independently, with clear dependency ordering and acceptance criteria per task.
785
+
786
+ ## Inputs
787
+
788
+ - \`{{artifacts_path}}/plan.md\` — the phased implementation plan
789
+
790
+ ## Process
791
+
792
+ 1. **Load plan** — Read phases, file scope, and dependency graph
793
+ 2. **Decompose phases into tasks** — Each task should:
794
+ - Touch 1–3 files maximum
795
+ - Have a single, testable outcome
796
+ - Take one agent one focused session
797
+ 3. **Define dependencies** — Map task-to-task dependencies (not just phase-to-phase)
798
+ 4. **Assign agents** — Match each task to the best-fit agent based on scope
799
+ 5. **Identify parallelism** — Mark which tasks can run simultaneously
800
+ 6. **Architecture review** — Have Architect-Reviewer validate task ordering won't create integration issues
801
+
802
+ ## Outputs
803
+
804
+ Write \`{{artifacts_path}}/tasks.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
805
+
806
+ Template:
807
+
808
+ \`\`\`markdown
809
+ # Task Breakdown: <feature title>
810
+
811
+ ## Task Graph
812
+
813
+ ### Phase 1: <name>
814
+ - [ ] **T1.1**: <description>
815
+ - Files: <list>
816
+ - Agent: <agent name>
817
+ - Depends on: none
818
+ - Acceptance: <testable criterion>
819
+
820
+ - [ ] **T1.2**: <description>
821
+ - Files: <list>
822
+ - Agent: <agent name>
823
+ - Depends on: T1.1
824
+ - Acceptance: <testable criterion>
825
+
826
+ ### Phase 2: <name>
827
+ - [ ] **T2.1**: <description> (can parallel with T1.2)
828
+ ...
829
+
830
+ ## Parallelism Map
831
+ | Batch | Tasks | Agents |
832
+ |-------|-------|--------|
833
+ | 1 | T1.1 | Implementer |
834
+ | 2 | T1.2, T2.1 | Implementer, Frontend |
835
+ | 3 | T2.2 | Implementer |
836
+ | ... | ... | ... |
837
+
838
+ ## Estimated Batches: <N>
839
+ \`\`\`
840
+
841
+ ## Agents
842
+
843
+ | Agent | Role |
844
+ |-------|------|
845
+ | **Planner** | Decomposes plan phases into atomic tasks with dependency ordering |
846
+ | **Architect-Reviewer-Alpha** | Validates task decomposition won't cause integration issues |
847
+
848
+ Planner does the decomposition, then Architect-Reviewer validates the task graph.
849
+
850
+ ## Foundation Integration
851
+
852
+ Load these skills BEFORE executing this step:
853
+
854
+ | Skill | Purpose | When |
855
+ |-------|---------|------|
856
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
857
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
858
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
859
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
860
+
861
+ ### Presentation Rules
862
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
863
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
864
+ - Tables, charts, progress tracking, code review findings → always present
865
+ - Artifact content and summaries → present with structured layout
866
+ - Only use plain text for brief confirmations and simple questions
867
+
868
+ ## Completion Criteria
869
+
870
+ - [ ] Every plan phase maps to ≥1 task
871
+ - [ ] Each task touches ≤3 files
872
+ - [ ] Dependencies form a DAG (no cycles)
873
+ - [ ] Parallelism opportunities identified
874
+ - [ ] Architect review confirms no integration risks
875
+ - [ ] \`{{artifacts_path}}/tasks.md\` written
876
+
877
+ ## Knowledge Capture
878
+
879
+ Before completing this step, persist important findings using \`remember()\`:
880
+
881
+ - **Task decomposition rationale**: Why tasks were split this way and what each accomplishes
882
+ - **Interface contracts**: APIs, types, or data shapes that tasks depend on
883
+ - **Coordination points**: Where tasks interact and handoff requirements
884
+
885
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
886
+ ` },
887
+ { file: "steps/verify/README.md", content: `---
888
+ name: verify
889
+ description: Dual code review, architecture review, security review, and comprehensive test validation.
890
+ ---
891
+
892
+ # Verification (Advanced)
893
+
894
+ ## Prerequisites Check
895
+
896
+ Before starting this step, verify:
897
+ - [ ] All tasks marked complete in progress tracker
898
+ - [ ] \`check({})\` and \`test_run({})\` pass
899
+ - [ ] \`{{artifacts_path}}/progress.md\` exists with execution results
900
+
901
+ If prerequisites are NOT met → **backtrack to execute step** (\`flow_step({ action: 'redo' })\` on previous step)
902
+
903
+ ## Purpose
904
+
905
+ Perform thorough multi-perspective validation of all changes through parallel dual code review, architecture review, and security analysis.
906
+
907
+ ## Inputs
908
+
909
+ - \`{{artifacts_path}}/spec.md\` — original requirements and acceptance criteria
910
+ - \`{{artifacts_path}}/plan.md\` — architecture decisions and phase design
911
+ - \`{{artifacts_path}}/tasks.md\` — task breakdown with per-task acceptance criteria
912
+ - \`{{artifacts_path}}/progress.md\` — implementation status and changes made
913
+
914
+ ## Process
915
+
916
+ 1. **Load all artifacts** — Read spec, plan, tasks, and progress
917
+ 2. **Dual code review** (parallel):
918
+ - Code-Reviewer-Alpha: focus on correctness, conventions, quality
919
+ - Code-Reviewer-Beta: focus on edge cases, error handling, maintainability
920
+ 3. **Architecture review** (parallel with code review):
921
+ - Architect-Reviewer-Alpha: validate changes align with plan and ADRs
922
+ - Architect-Reviewer-Beta: assess long-term maintainability and evolution
923
+ 4. **Security review**:
924
+ - Security agent: OWASP Top 10, auth/authz, input validation, secrets
925
+ 5. **Quality gates** — \`check({})\` + \`test_run({})\` must pass
926
+ 6. **Blast radius** — \`blast_radius({ changed_files: [...] })\` on all modified files
927
+ 7. **Acceptance criteria** — Verify each spec acceptance criterion is met
928
+ 8. **FORGE gate** — \`evidence_map({ action: "gate" })\` for final quality assessment
929
+ 9. **Synthesize report** — Merge all reviewer findings into unified verdict
930
+
931
+ ## Outputs
932
+
933
+ Write \`{{artifacts_path}}/verify-report.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
934
+
935
+ Template:
936
+
937
+ \`\`\`markdown
938
+ # Verification Report: <feature title>
939
+
940
+ ## Verdict: PASS | FAIL
941
+
942
+ ## Acceptance Criteria
943
+ - [x] <criterion> — verified by <method>
944
+ - [ ] <criterion> — FAILED: <reason>
945
+
946
+ ## Quality Gates
947
+ - check: PASS/FAIL
948
+ - test_run: PASS/FAIL (<N> passed, <M> failed)
949
+ - blast_radius: <impact summary>
950
+ - FORGE gate: YIELD/HOLD/HARD_BLOCK
951
+
952
+ ## Code Review (Alpha)
953
+ <findings with severity: critical/major/minor/suggestion>
954
+
955
+ ## Code Review (Beta)
956
+ <findings with severity>
957
+
958
+ ## Architecture Review
959
+ <alignment assessment, any concerns>
960
+
961
+ ## Security Review
962
+ <vulnerabilities found, OWASP compliance>
963
+
964
+ ## Recommendation
965
+ APPROVE | REQUEST CHANGES
966
+
967
+ ### Required Changes (if any)
968
+ 1. <change needed>
969
+ 2. ...
970
+ \`\`\`
971
+
972
+ ## Agents
973
+
974
+ | Agent | Role |
975
+ |-------|------|
976
+ | **Code-Reviewer-Alpha** | Primary code review — correctness, quality, conventions |
977
+ | **Code-Reviewer-Beta** | Secondary code review — edge cases, error handling, maintainability |
978
+ | **Architect-Reviewer-Alpha** | Primary architecture review — alignment with plan and ADRs |
979
+ | **Architect-Reviewer-Beta** | Secondary architecture review — long-term evolution |
980
+ | **Security** | Security analysis — OWASP, auth, input validation |
981
+
982
+ **Parallelism**: All 5 reviewers can run in parallel — they are read-only.
983
+
984
+ ## Foundation Integration
985
+
986
+ Load these skills BEFORE executing this step:
987
+
988
+ | Skill | Purpose | When |
989
+ |-------|---------|------|
990
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
991
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
992
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
993
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
994
+ | \`lesson-learned\` | Extract engineering principles from completed work | After verification — capture lessons from the implementation |
995
+ | \`session-handoff\` | Context preservation for session continuity | When verification spans sessions or for final handoff documentation |
996
+
997
+ ### Presentation Rules
998
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
999
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
1000
+ - Tables, charts, progress tracking, code review findings → always present
1001
+ - Artifact content and summaries → present with structured layout
1002
+ - Only use plain text for brief confirmations and simple questions
1003
+
1004
+ ### FORGE Quality Gate
1005
+
1006
+ After all reviews complete:
1007
+ 1. \`evidence_map({ action: "gate", task_id: "<slug>" })\` → returns YIELD/HOLD/HARD_BLOCK
1008
+ 2. YIELD → approved, proceed to commit
1009
+ 3. HOLD → minor issues, fix then re-gate (max 3 rounds)
1010
+ 4. HARD_BLOCK → critical issues, escalate to user
1011
+
1012
+ ## Completion Criteria
1013
+
1014
+ - [ ] Dual code review complete (2 reviewers)
1015
+ - [ ] Architecture review complete (2 reviewers)
1016
+ - [ ] Security review complete
1017
+ - [ ] \`check({})\` passes
1018
+ - [ ] \`test_run({})\` passes
1019
+ - [ ] All spec acceptance criteria verified
1020
+ - [ ] FORGE gate passed (YIELD)
1021
+ - [ ] \`{{artifacts_path}}/verify-report.md\` written with clear verdict
1022
+
1023
+ ## Knowledge Capture
1024
+
1025
+ Before completing this step, persist important findings using \`remember()\`:
1026
+
1027
+ - **Test coverage gaps**: Areas that couldn't be fully tested and why
1028
+ - **Quality findings**: Issues found during verification and their resolutions
1029
+ - **Session checkpoint**: Summarize what was accomplished, decisions made, and any remaining work
1030
+
1031
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
1032
+ ` },
1033
+ ],
1034
+ "aikit-basic": [
1035
+ { file: "README.md", content: `# aikit:basic — Quick Development Flow
1036
+
1037
+ Quick development flow for **bug fixes, small features, and refactoring**.
1038
+
1039
+ ## Steps
1040
+
1041
+ | # | Step | Skill | Produces | Requires | Agents |
1042
+ |---|------|-------|----------|----------|--------|
1043
+ | 1 | **Design Gate** | \`steps/design/README.md\` | \`design-decisions.md\` | — | Researcher-Alpha/Beta/Gamma/Delta |
1044
+ | 2 | **Assessment** | \`steps/assess/README.md\` | \`assessment.md\` | \`design-decisions.md\` | Explorer, Researcher-Alpha |
1045
+ | 3 | **Implementation** | \`steps/implement/README.md\` | \`progress.md\` | \`assessment.md\` | Implementer, Frontend |
1046
+ | 4 | **Verification** | \`steps/verify/README.md\` | \`verify-report.md\` | \`progress.md\` | Code-Reviewer-Alpha, Security |
1047
+
1048
+ ## How It Works
1049
+
1050
+ Each step has a **README.md** file that contains the detailed instructions for the agent(s) executing that step. The Orchestrator reads the README.md via \`flow_read_instruction\` and delegates work accordingly.
1051
+
1052
+ ### Step 1: Design Gate
1053
+ - **Auto-skips** for bug fixes and refactors (produces a minimal \`design-decisions.md\` noting it was skipped)
1054
+ - For small features: runs quick brainstorming, FORGE classification, and optional decision protocol
1055
+ - Read \`steps/design/README.md\` for the full decision tree
1056
+
1057
+ ### Step 2: Assessment
1058
+ - Explore the codebase to understand scope and impact
1059
+ - Use \`search\`, \`scope_map\`, \`file_summary\`, \`compact\` to gather context
1060
+ - Identify the approach and produce \`assessment.md\`
1061
+
1062
+ ### Step 3: Implementation
1063
+ - Write code following the assessment plan
1064
+ - The Orchestrator dispatches Implementer/Frontend agents with specific file scopes
1065
+ - Follow TDD practices where applicable
1066
+
1067
+ ### Step 4: Verification
1068
+ - Code review, test execution, security check
1069
+ - Run \`check({})\` + \`test_run({})\` + \`blast_radius({})\`
1070
+ - Produce \`verify-report.md\` with findings
1071
+
1072
+ ## Using Skills Inside Steps
1073
+
1074
+ When the Orchestrator activates a step:
1075
+
1076
+ 1. **Read the instruction first** — \`flow_read_instruction\` returns the README.md for the current step
1077
+ 2. **Follow step instructions** — the README.md is the primary guide for what to do
1078
+ 3. **Delegate to listed agents** — each step lists which agents are appropriate
1079
+ 4. **Produce the required artifact** — the step's \`produces\` field specifies what file to create in the artifacts directory
1080
+ 5. **Check dependencies** — the step's \`requires\` field lists artifacts from previous steps that must exist
1081
+ 6. **Report status** — agents report \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\` to the Orchestrator
1082
+
1083
+ ## Artifacts
1084
+
1085
+ All artifacts are stored in the run directory under \`.flows/{topic}/\`. The template variable \`{{artifacts_path}}\` resolves to the actual path at runtime.
1086
+ ` },
1087
+ { file: "steps/assess/README.md", content: `---
1088
+ name: assess
1089
+ description: Understand scope, analyze the codebase, and identify the implementation approach.
1090
+ ---
1091
+
1092
+ # Assessment
1093
+
1094
+ ## Purpose
1095
+
1096
+ Analyze the task requirements and codebase to produce a clear, actionable assessment before any code changes begin.
1097
+
1098
+ ## Inputs
1099
+
1100
+ - User's task description or issue reference
1101
+ - Codebase (accessed via aikit MCP tools)
1102
+
1103
+ ## Prerequisites Check
1104
+
1105
+ Before executing this step, verify:
1106
+
1107
+ - [ ] Design decisions documented (from the design step)
1108
+ - [ ] FORGE classification determined (tier assigned)
1109
+ - [ ] If brainstorming was done, session outcomes are recorded
1110
+
1111
+ If any prerequisites are missing or incomplete:
1112
+ 1. Inform the Orchestrator with specifics about what's missing
1113
+ 2. Recommend \`flow_step({ action: 'redo' })\` on the **design** step
1114
+ 3. Do NOT proceed with partial inputs — quality degrades downstream
1115
+
1116
+ ## Process
1117
+
1118
+ 1. **Parse the goal** — Extract what needs to change, success criteria, and constraints
1119
+ 2. **Search for prior work** — \`search({ query: "<task keywords>" })\` to check for existing decisions or related code
1120
+ 3. **Map affected scope** — \`scope_map({ task: "<description>" })\` to identify files and modules involved
1121
+ 4. **Analyze structure** — \`file_summary()\` on each affected file; \`compact()\` for deeper sections
1122
+ 5. **Identify risks** — Note dependencies, breaking change potential, test coverage gaps
1123
+ 6. **Draft approach** — Outline the implementation strategy in 3–7 steps
1124
+
1125
+ ## Outputs
1126
+
1127
+ Write \`{{artifacts_path}}/assessment.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
1128
+
1129
+ Template:
1130
+
1131
+ \`\`\`markdown
1132
+ # Assessment: <task title>
1133
+
1134
+ ## Goal
1135
+ <what needs to happen>
1136
+
1137
+ ## Affected Files
1138
+ <list of files with brief reason>
1139
+
1140
+ ## Approach
1141
+ <numbered implementation steps>
1142
+
1143
+ ## Risks
1144
+ <potential issues and mitigations>
1145
+
1146
+ ## Open Questions
1147
+ <anything that needs clarification before proceeding>
1148
+ \`\`\`
1149
+
1150
+ ## Agents
1151
+
1152
+ | Agent | Role |
1153
+ |-------|------|
1154
+ | **Explorer** | Rapid file discovery, dependency tracing, structural context |
1155
+ | **Researcher-Alpha** | Deep analysis of complex logic, prior decisions, architectural implications |
1156
+
1157
+ Use Explorer first for breadth, then Researcher-Alpha for depth on complex areas.
1158
+
1159
+ ## Foundation Integration
1160
+
1161
+ Load these skills BEFORE executing this step:
1162
+
1163
+ | Skill | Purpose | When |
1164
+ |-------|---------|------|
1165
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1166
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1167
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1168
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1169
+ | \`c4-architecture\` | C4 model architecture diagrams — system context, container, component, deployment views | When visualizing system structure during assessment |
1170
+ | \`adr-skill\` | Architecture Decision Records — create, review, maintain ADRs | When assessment reveals non-trivial design decisions |
1171
+
1172
+ ### Presentation Rules
1173
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1174
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
1175
+ - Tables, charts, progress tracking, code review findings → always present
1176
+ - Artifact content and summaries → present with structured layout
1177
+ - Only use plain text for brief confirmations and simple questions
1178
+
1179
+ ## Completion Criteria
1180
+
1181
+ - [ ] All affected files identified
1182
+ - [ ] Implementation approach is concrete (not vague)
1183
+ - [ ] Risks documented with mitigations
1184
+ - [ ] No unresolved open questions that block implementation
1185
+ - [ ] \`{{artifacts_path}}/assessment.md\` written
1186
+
1187
+ ## Knowledge Capture
1188
+
1189
+ Before completing this step, persist important findings using \`remember()\`:
1190
+
1191
+ - **Codebase discoveries**: File locations, architecture patterns, or dependency relationships found during assessment
1192
+ - **Problem diagnosis**: Root cause analysis, contributing factors, and affected components
1193
+ - **Scope decisions**: What's in scope, what's explicitly excluded, and why
1194
+
1195
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
1196
+ ` },
1197
+ { file: "steps/design/README.md", content: `# Design Gate — Basic Flow
1198
+
1199
+ Lightweight design gate for bug fixes, small features, and refactoring. Evaluates the task type and determines whether design work is needed before proceeding.
1200
+
1201
+ ## When This Step Runs
1202
+
1203
+ This is the **first step** of the \`aikit:basic\` flow. It runs before assessment.
1204
+
1205
+ ## Instructions
1206
+
1207
+ ### 1. Task Classification
1208
+
1209
+ Classify the task into one of these categories:
1210
+
1211
+ | Category | Indicators | Action |
1212
+ |----------|-----------|--------|
1213
+ | **Bug fix** | Error reports, stack traces, regression, "fix", "broken" | → **Auto-skip** to next step |
1214
+ | **Refactor** | Code cleanup, rename, restructure, no behavior change | → **Auto-skip** to next step |
1215
+ | **Small feature** | New behavior, new endpoint, new component, UI change | → Run **Quick Design** below |
1216
+
1217
+ **If the task is a bug fix or refactor**, write \`{{artifacts_path}}/design-decisions.md\` to disk:
1218
+ \`\`\`markdown
1219
+ ## Design Decisions
1220
+ - **Task type**: Bug fix / Refactor
1221
+ - **Design gate**: Auto-skipped — no design work needed
1222
+ - **Proceed to**: Assessment
1223
+ \`\`\`
1224
+ **You MUST create this file on disk** at the exact \`{{artifacts_path}}/design-decisions.md\` path — do not just present the content in chat.
1225
+ Then report \`DONE\` to the Orchestrator so the flow advances.
1226
+
1227
+ ### 2. Quick Design (Small Features Only)
1228
+
1229
+ For small features that need minimal design:
1230
+
1231
+ 1. **FORGE Classify** — Run \`forge_classify({ task: "<task description>", files: [<relevant files>] })\` to determine complexity tier
1232
+ 2. **Brainstorming** (if tier ≥ Standard) — Load the \`brainstorming\` skill and run a focused brainstorming session:
1233
+ - What is the user trying to achieve?
1234
+ - What are the constraints?
1235
+ - What is the simplest approach?
1236
+ 3. **Decision Protocol** (if technical decisions exist) — Delegate to 2-4 Researcher agents in parallel:
1237
+ - Each researcher evaluates a different approach
1238
+ - Synthesize findings into a recommendation
1239
+ 4. **Write \`{{artifacts_path}}/design-decisions.md\`** to disk:
1240
+
1241
+ \`\`\`markdown
1242
+ ## Design Decisions
1243
+
1244
+ ### FORGE Assessment
1245
+ - **Tier**: {Floor | Standard | Critical}
1246
+ - **Rationale**: {why this tier}
1247
+
1248
+ ### Task Summary
1249
+ - **Goal**: {what we're building}
1250
+ - **Approach**: {chosen approach}
1251
+ - **Key decisions**: {list}
1252
+
1253
+ ### Constraints
1254
+ - {constraint 1}
1255
+ - {constraint 2}
1256
+ \`\`\`
1257
+
1258
+ ### 3. Report to Orchestrator
1259
+
1260
+ When complete, report status:
1261
+ - \`DONE\` — design decisions captured, ready for assessment
1262
+ - \`DONE_WITH_CONCERNS\` — design captured but open questions remain (list them)
1263
+
1264
+ **Do NOT call \`flow_step\`** — let the Orchestrator advance the flow.
1265
+
1266
+ ## Outputs
1267
+
1268
+ Write \`{{artifacts_path}}/design-decisions.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat. This file is a prerequisite for the next step.
1269
+
1270
+ ## Produces
1271
+
1272
+ - \`{{artifacts_path}}/design-decisions.md\` — Task classification, FORGE tier, key design decisions
1273
+
1274
+ ## Agents
1275
+
1276
+ - \`Researcher-Alpha\`, \`Researcher-Beta\`, \`Researcher-Gamma\`, \`Researcher-Delta\` — for parallel research during decision protocol
1277
+
1278
+ ## Foundation Integration
1279
+
1280
+ Load these skills BEFORE executing this step:
1281
+
1282
+ | Skill | Purpose | When |
1283
+ |-------|---------|------|
1284
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1285
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1286
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1287
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1288
+ | \`c4-architecture\` | C4 model architecture diagrams — system context, container, component, deployment views | When visualizing system structure during design |
1289
+ | \`adr-skill\` | Architecture Decision Records — create, review, maintain ADRs | When making non-trivial design or technology decisions |
1290
+
1291
+ ### Presentation Rules
1292
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1293
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
1294
+ - Tables, charts, progress tracking, code review findings → always present
1295
+ - Artifact content and summaries → present with structured layout
1296
+ - Only use plain text for brief confirmations and simple questions
1297
+
1298
+ ## Completion Criteria
1299
+
1300
+ - [ ] \`{{artifacts_path}}/design-decisions.md\` written to disk (NOT just presented in chat)
1301
+ - [ ] FORGE tier determined (for small features)
1302
+ - [ ] Key design decisions documented
1303
+
1304
+ ## Knowledge Capture
1305
+
1306
+ Before completing this step, persist important findings using \`remember()\`:
1307
+
1308
+ - **Design decisions**: Chosen approach and alternatives considered with trade-offs
1309
+ - **Architecture patterns**: New patterns introduced or existing patterns that must be followed
1310
+ - **Constraints discovered**: Technical limitations, compatibility requirements, or performance boundaries
1311
+
1312
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
1313
+ ` },
1314
+ { file: "steps/implement/README.md", content: `---
1315
+ name: implement
1316
+ description: Write code following the assessment plan, using TDD practices where applicable.
1317
+ ---
1318
+
1319
+ # Implementation
1320
+
1321
+ ## Purpose
1322
+
1323
+ Execute the implementation plan from the assessment, writing production code and tests.
1324
+
1325
+ ## Inputs
1326
+
1327
+ - \`{{artifacts_path}}/assessment.md\` — the approach, affected files, and risks
1328
+
1329
+ ## Prerequisites Check
1330
+
1331
+ Before executing this step, verify:
1332
+
1333
+ - [ ] Assessment complete and scope approved (from the assess step)
1334
+ - [ ] Files-to-modify list is clear and bounded
1335
+ - [ ] \`check({})\` baseline captured (know what currently passes)
1336
+
1337
+ If any prerequisites are missing or incomplete:
1338
+ 1. Inform the Orchestrator with specifics about what's missing
1339
+ 2. Recommend \`flow_step({ action: 'redo' })\` on the **assess** step
1340
+ 3. Do NOT proceed with partial inputs — quality degrades downstream
1341
+
1342
+ ## Process
1343
+
1344
+ 1. **Read assessment** — Load \`{{artifacts_path}}/assessment.md\` and internalize the approach
1345
+ 2. **Set up tests first** — Where applicable, write failing tests that define success
1346
+ 3. **Implement changes** — Follow the approach steps sequentially
1347
+ - One logical change per commit-worthy chunk
1348
+ - Stay within the assessed file scope — do not expand without re-assessment
1349
+ 4. **Run validation** — \`check({})\` for type/lint errors, \`test_run({})\` for test results
1350
+ 5. **Fix issues** — Iterate until \`check\` and \`test_run\` pass (max 3 rounds)
1351
+ 6. **Document progress** — Write progress artifact with what was done and any deviations
1352
+
1353
+ ## Outputs
1354
+
1355
+ Write \`{{artifacts_path}}/progress.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
1356
+
1357
+ Template:
1358
+
1359
+ \`\`\`markdown
1360
+ # Implementation Progress: <task title>
1361
+
1362
+ ## Changes Made
1363
+ <list of files changed with brief description>
1364
+
1365
+ ## Tests
1366
+ <tests added or modified>
1367
+
1368
+ ## Deviations from Assessment
1369
+ <any changes to the original plan and why>
1370
+
1371
+ ## Validation
1372
+ - check: PASS/FAIL
1373
+ - test_run: PASS/FAIL (<N> passed, <M> failed)
1374
+
1375
+ ## Notes
1376
+ <anything the reviewer should know>
1377
+ \`\`\`
1378
+
1379
+ ## Agents
1380
+
1381
+ | Agent | Role |
1382
+ |-------|------|
1383
+ | **Implementer** | Primary code writer — follows TDD, writes production code and tests |
1384
+ | **Frontend** | UI/UX specialist — use when changes involve React components, styling, or responsive design |
1385
+
1386
+ Dispatch Implementer for backend/logic changes, Frontend for UI changes. Both can run in parallel if working on different files.
1387
+
1388
+ ## Foundation Integration
1389
+
1390
+ Load these skills BEFORE executing this step:
1391
+
1392
+ | Skill | Purpose | When |
1393
+ |-------|---------|------|
1394
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1395
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1396
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1397
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1398
+ | \`session-handoff\` | Context preservation for session transfers | When implementation is long-running and context may fill up |
1399
+
1400
+ ### Presentation Rules
1401
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1402
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
1403
+ - Tables, charts, progress tracking, code review findings → always present
1404
+ - Artifact content and summaries → present with structured layout
1405
+ - Only use plain text for brief confirmations and simple questions
1406
+
1407
+ ### Orchestrator Dispatch Protocol
1408
+
1409
+ Follow the \`multi-agents-development\` skill patterns for dispatch:
1410
+
1411
+ 1. **Independence Check** before parallelizing:
1412
+ - Same files? → sequential
1413
+ - Shared mutable state? → sequential
1414
+ - Execution-order dependent? → sequential
1415
+ - Need shared new types? → define contract first, then parallel
1416
+ - All clear? → **parallel dispatch**
1417
+
1418
+ 2. **Subagent Context Template** (each dispatch includes):
1419
+ - **Scope**: exact files + boundary (do NOT touch)
1420
+ - **Goal**: acceptance criteria, testable
1421
+ - **Arch Context**: actual code snippets via \`compact()\`/\`digest()\`
1422
+ - **Constraints**: patterns, conventions, anti-patterns
1423
+ - **Self-Review**: checklist before declaring DONE
1424
+
1425
+ 3. **Status Protocol**: \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`
1426
+ 4. **Max 2 retries** per task — then escalate to user
1427
+
1428
+ ## Completion Criteria
1429
+
1430
+ - [ ] All assessment steps implemented
1431
+ - [ ] \`check({})\` passes (no type/lint errors)
1432
+ - [ ] \`test_run({})\` passes (no test failures)
1433
+ - [ ] No files modified outside assessed scope
1434
+ - [ ] \`{{artifacts_path}}/progress.md\` written
1435
+
1436
+ ## Knowledge Capture
1437
+
1438
+ Before completing this step, persist important findings using \`remember()\`:
1439
+
1440
+ - **Implementation decisions**: Why specific approaches were chosen over alternatives
1441
+ - **Patterns established**: New conventions or patterns that future code should follow
1442
+ - **Gotchas encountered**: Edge cases, workarounds, or non-obvious behaviors discovered during implementation
1443
+
1444
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
1445
+ ` },
1446
+ { file: "steps/verify/README.md", content: `---
1447
+ name: verify
1448
+ description: Review code changes, run tests, validate correctness and quality.
1449
+ ---
1450
+
1451
+ # Verification
1452
+
1453
+ ## Purpose
1454
+
1455
+ Validate that the implementation meets the original requirements, passes all quality gates, and introduces no regressions.
1456
+
1457
+ ## Inputs
1458
+
1459
+ - \`{{artifacts_path}}/assessment.md\` — original requirements and approach
1460
+ - \`{{artifacts_path}}/progress.md\` — what was implemented and any deviations
1461
+
1462
+ ## Prerequisites Check
1463
+
1464
+ Before executing this step, verify:
1465
+
1466
+ - [ ] Implementation complete (from the implement step)
1467
+ - [ ] \`check({})\` + \`test_run({})\` pass at baseline
1468
+ - [ ] Changed files list is available for blast radius analysis
1469
+
1470
+ If any prerequisites are missing or incomplete:
1471
+ 1. Inform the Orchestrator with specifics about what's missing
1472
+ 2. Recommend \`flow_step({ action: 'redo' })\` on the **implement** step
1473
+ 3. Do NOT proceed with partial inputs — quality degrades downstream
1474
+
1475
+ ## Process
1476
+
1477
+ 1. **Load context** — Read assessment and progress artifacts
1478
+ 2. **Code review** — Review all changed files for:
1479
+ - Correctness against requirements
1480
+ - Code quality and adherence to project conventions
1481
+ - Error handling and edge cases
1482
+ - No unnecessary changes (scope creep)
1483
+ 3. **Run quality gates** — \`check({})\` + \`test_run({})\` must pass
1484
+ 4. **Blast radius** — \`blast_radius({ changed_files: [...] })\` to assess impact
1485
+ 5. **Security scan** — Check for OWASP Top 10 issues in changed code
1486
+ 6. **Write report** — Document findings with PASS/FAIL verdict
1487
+
1488
+ ## Outputs
1489
+
1490
+ Write \`{{artifacts_path}}/verify-report.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
1491
+
1492
+ Template:
1493
+
1494
+ \`\`\`markdown
1495
+ # Verification Report: <task title>
1496
+
1497
+ ## Verdict: PASS | FAIL
1498
+
1499
+ ## Quality Gates
1500
+ - check: PASS/FAIL
1501
+ - test_run: PASS/FAIL (<N> passed, <M> failed)
1502
+ - blast_radius: <summary of impact>
1503
+
1504
+ ## Code Review Findings
1505
+ <issues found, if any, with severity>
1506
+
1507
+ ## Security
1508
+ <any security concerns>
1509
+
1510
+ ## Recommendation
1511
+ <APPROVE for commit / REQUEST CHANGES with specific items>
1512
+ \`\`\`
1513
+
1514
+ ## Agents
1515
+
1516
+ | Agent | Role |
1517
+ |-------|------|
1518
+ | **Code-Reviewer-Alpha** | Primary code reviewer — correctness, quality, conventions |
1519
+ | **Security** | Security specialist — vulnerability analysis, OWASP compliance |
1520
+
1521
+ Run both in parallel — they review different aspects of the same changes.
1522
+
1523
+ ## Foundation Integration
1524
+
1525
+ Load these skills BEFORE executing this step:
1526
+
1527
+ | Skill | Purpose | When |
1528
+ |-------|---------|------|
1529
+ | \`aikit\` | Core MCP tools — search, analyze, remember, validate | Always (auto-loaded) |
1530
+ | \`present\` | Rich rendering for any structured output — assessments, reports, comparisons, reviews, status boards, tables, charts, and all artifact content | Use for ANY output that benefits from rich rendering, not just dashboards |
1531
+ | \`multi-agents-development\` | Dispatch templates, task decomposition, review pipeline patterns | Before dispatching any subagent |
1532
+ | \`brainstorming\` | Structured ideation for design/creative decisions | Before any design choice or new feature exploration |
1533
+ | \`lesson-learned\` | Extract engineering lessons from completed work via git history | After verification completes — capture principles from what was built |
1534
+ | \`session-handoff\` | Context preservation for session transfers | When verification is the final step and session context should be saved |
1535
+
1536
+ ### Presentation Rules
1537
+ - Use \`present\` for **any output** that benefits from rich rendering — not limited to dashboards
1538
+ - Assessments, reports, comparisons, reviews, status boards → \`present({ format: "html" })\`
1539
+ - Tables, charts, progress tracking, code review findings → always present
1540
+ - Artifact content and summaries → present with structured layout
1541
+ - Only use plain text for brief confirmations and simple questions
1542
+
1543
+ ### FORGE Quality Gate
1544
+
1545
+ After all reviews complete:
1546
+ 1. \`evidence_map({ action: "gate", task_id: "<slug>" })\` → returns YIELD/HOLD/HARD_BLOCK
1547
+ 2. YIELD → approved, proceed to commit
1548
+ 3. HOLD → minor issues, fix then re-gate (max 3 rounds)
1549
+ 4. HARD_BLOCK → critical issues, escalate to user
1550
+
1551
+ ## Completion Criteria
1552
+
1553
+ - [ ] \`check({})\` passes
1554
+ - [ ] \`test_run({})\` passes
1555
+ - [ ] Code review complete with no blocking issues
1556
+ - [ ] Security review complete
1557
+ - [ ] Blast radius assessed
1558
+ - [ ] \`{{artifacts_path}}/verify-report.md\` written with clear PASS/FAIL verdict
1559
+
1560
+ ## Knowledge Capture
1561
+
1562
+ Before completing this step, persist important findings using \`remember()\`:
1563
+
1564
+ - **Test coverage gaps**: Areas that couldn't be fully tested and why
1565
+ - **Quality findings**: Issues found during verification and their resolutions
1566
+ - **Session checkpoint**: Summarize what was accomplished, decisions made, and any remaining work
1567
+
1568
+ **Every step produces knowledge worth preserving.** If you discovered something that would help a future session, call \`remember()\` now.
1569
+ ` },
1570
+ ],
1571
+ };