@vpxa/aikit 0.1.19 → 0.1.20

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/aikit",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -1 +1 @@
1
- const e={name:`aikit:basic`,version:`0.1.0`,description:`Quick development flow for bug fixes, small features, and refactoring`,steps:[{id:`assess`,name:`Assessment`,skill:`skills/assess/SKILL.md`,produces:[`assessment.md`],requires:[],agents:[`Explorer`,`Researcher-Alpha`],description:`Understand scope, analyze codebase, identify approach`},{id:`implement`,name:`Implementation`,skill:`skills/implement/SKILL.md`,produces:[`progress.md`],requires:[`assessment.md`],agents:[`Implementer`,`Frontend`],description:`Write code following the assessment plan`},{id:`verify`,name:`Verification`,skill:`skills/verify/SKILL.md`,produces:[`verify-report.md`],requires:[`progress.md`],agents:[`Code-Reviewer-Alpha`,`Security`],description:`Review code, run tests, validate changes`}],agents:[],artifacts_dir:`.spec`,install:[]},t={name:`aikit:advanced`,version:`0.1.0`,description:`Full development flow for new features, API design, and architecture changes`,steps:[{id:`spec`,name:`Specification`,skill:`skills/spec/SKILL.md`,produces:[`spec.md`],requires:[],agents:[`Researcher-Alpha`],description:`Elicit requirements, clarify scope, define acceptance criteria`},{id:`plan`,name:`Planning`,skill:`skills/plan/SKILL.md`,produces:[`plan.md`],requires:[`spec.md`],agents:[`Planner`,`Explorer`],description:`Analyze codebase, design architecture, create implementation plan`},{id:`task`,name:`Task Breakdown`,skill:`skills/task/SKILL.md`,produces:[`tasks.md`],requires:[`plan.md`],agents:[`Planner`,`Architect-Reviewer-Alpha`],description:`Break plan into ordered implementation tasks with dependencies`},{id:`execute`,name:`Execution`,skill:`skills/execute/SKILL.md`,produces:[`progress.md`],requires:[`tasks.md`],agents:[`Orchestrator`,`Implementer`,`Frontend`,`Refactor`],description:`Implement all tasks, write code, write tests`},{id:`verify`,name:`Verification`,skill:`skills/verify/SKILL.md`,produces:[`verify-report.md`],requires:[`progress.md`],agents:[`Code-Reviewer-Alpha`,`Code-Reviewer-Beta`,`Architect-Reviewer-Alpha`,`Architect-Reviewer-Beta`,`Security`],description:`Dual code review, architecture review, security review, test validation`}],agents:[],artifacts_dir:`.spec`,install:[]};function n(){return[{manifest:e,scaffoldDir:`scaffold/flows/aikit-basic`},{manifest:t,scaffoldDir:`scaffold/flows/aikit-advanced`}]}export{n as getBuiltinFlows};
1
+ const e={name:`aikit:basic`,version:`0.1.0`,description:`Quick development flow for bug fixes, small features, and refactoring`,steps:[{id:`design`,name:`Design Gate`,skill:`skills/design/SKILL.md`,produces:[`design-decisions.md`],requires:[],agents:[`Researcher-Alpha`,`Researcher-Beta`,`Researcher-Gamma`,`Researcher-Delta`],description:`Evaluate task type, run brainstorming for features, FORGE classification. Auto-skips for bug fixes and refactors.`},{id:`assess`,name:`Assessment`,skill:`skills/assess/SKILL.md`,produces:[`assessment.md`],requires:[`design-decisions.md`],agents:[`Explorer`,`Researcher-Alpha`],description:`Understand scope, analyze codebase, identify approach`},{id:`implement`,name:`Implementation`,skill:`skills/implement/SKILL.md`,produces:[`progress.md`],requires:[`assessment.md`],agents:[`Implementer`,`Frontend`],description:`Write code following the assessment plan`},{id:`verify`,name:`Verification`,skill:`skills/verify/SKILL.md`,produces:[`verify-report.md`],requires:[`progress.md`],agents:[`Code-Reviewer-Alpha`,`Security`],description:`Review code, run tests, validate changes`}],agents:[],artifacts_dir:`.spec`,install:[]},t={name:`aikit:advanced`,version:`0.1.0`,description:`Full development flow for new features, API design, and architecture changes`,steps:[{id:`design`,name:`Design Gate`,skill:`skills/design/SKILL.md`,produces:[`design-decisions.md`],requires:[],agents:[`Researcher-Alpha`,`Researcher-Beta`,`Researcher-Gamma`,`Researcher-Delta`],description:`Full brainstorming, FORGE classification, decision protocol with parallel research. ADR for critical-tier tasks.`},{id:`spec`,name:`Specification`,skill:`skills/spec/SKILL.md`,produces:[`spec.md`],requires:[`design-decisions.md`],agents:[`Researcher-Alpha`],description:`Elicit requirements, clarify scope, define acceptance criteria`},{id:`plan`,name:`Planning`,skill:`skills/plan/SKILL.md`,produces:[`plan.md`],requires:[`spec.md`],agents:[`Planner`,`Explorer`],description:`Analyze codebase, design architecture, create implementation plan`},{id:`task`,name:`Task Breakdown`,skill:`skills/task/SKILL.md`,produces:[`tasks.md`],requires:[`plan.md`],agents:[`Planner`,`Architect-Reviewer-Alpha`],description:`Break plan into ordered implementation tasks with dependencies`},{id:`execute`,name:`Execution`,skill:`skills/execute/SKILL.md`,produces:[`progress.md`],requires:[`tasks.md`],agents:[`Orchestrator`,`Implementer`,`Frontend`,`Refactor`],description:`Implement all tasks, write code, write tests`},{id:`verify`,name:`Verification`,skill:`skills/verify/SKILL.md`,produces:[`verify-report.md`],requires:[`progress.md`],agents:[`Code-Reviewer-Alpha`,`Code-Reviewer-Beta`,`Architect-Reviewer-Alpha`,`Architect-Reviewer-Beta`,`Security`],description:`Dual code review, architecture review, security review, test validation`}],agents:[],artifacts_dir:`.spec`,install:[]};function n(){return[{manifest:e,scaffoldDir:`scaffold/flows/aikit-basic`},{manifest:t,scaffoldDir:`scaffold/flows/aikit-advanced`}]}export{n as getBuiltinFlows};
@@ -19,29 +19,11 @@ export const CLAUDE_FLOWS_SECTION = [
19
19
  ].join('\n');
20
20
 
21
21
  export const CLAUDE_ORCHESTRATOR_FLOW_ROUTING_SECTION = [
22
- '## Flow-Aware Routing',
23
- '',
24
- 'At session start, check for an active flow:',
25
- '1. Call `flow_status` to check if a flow is active',
26
- "2. If active and status is 'active':",
27
- ' - Note the current step name and skill path',
28
- " - Load the current step's skill file",
29
- ' - Follow its instructions for this step',
30
- " - When step is complete, call `flow_step({ action: 'next' })`",
31
- '3. If no active flow:',
32
- ' - Check `flow_list` for available flows',
33
- ' - Suggest starting a flow based on the task type',
34
- " - Use `flow_start({ flow: '<name>' })` to begin",
22
+ '## Flows',
35
23
  '',
36
- '### Flow MCP Tools',
37
- '| Tool | Purpose |',
38
- '|------|---------|',
39
- '| `flow_list` | List installed flows and active flow |',
40
- '| `flow_info` | Get detailed flow info including steps |',
41
- '| `flow_start` | Start a named flow |',
42
- '| `flow_step` | Advance: next, skip, or redo current step |',
43
- '| `flow_status` | Check current execution state |',
44
- '| `flow_reset` | Clear flow state to start over |',
24
+ "This project uses aikit's pluggable flow system. Check flow status with the `flow_status` MCP tool.",
25
+ "If a flow is active, follow the current step's skill instructions. Advance with `flow_step({ action: 'next' })`.",
26
+ 'Use `flow_list` to see available flows and `flow_start` to begin one.',
45
27
  ].join('\n');
46
28
 
47
29
  export function generateClaudeCode() {
@@ -24,15 +24,6 @@ ${agentTable}
24
24
 
25
25
  **Parallelism**: Read-only agents run in parallel freely. File-modifying agents run in parallel ONLY on completely different files. Max 4 concurrent file-modifying agents.
26
26
 
27
- ## Phase 0: Design Gate
28
-
29
- | Situation | Route |
30
- |-----------|-------|
31
- | New feature/component/behavior | **Brainstorming skill** → user dialogue → design doc |
32
- | Non-trivial technical decision | **Decision protocol** → 4 Researchers parallel → synthesize → ADR |
33
- | Both | Brainstorming first → escalate unresolved decisions to protocol |
34
- | Bug fix / refactor / explicit skip | **→ Phase 1** |
35
-
36
27
  ## FORGE Protocol
37
28
 
38
29
  1. \`forge_classify({ task, files })\` → determine tier (Floor/Standard/Critical)
@@ -40,32 +31,66 @@ ${agentTable}
40
31
  3. After review: \`evidence_map({ action: "gate", task_id })\` → YIELD/HOLD/HARD_BLOCK
41
32
  4. Auto-upgrade tier if unknowns reveal contract/security issues
42
33
 
43
- ## Flow-Driven Development
44
-
45
- Orchestrator uses the flow system for structured development. Flows define the step sequence — Orchestrator adds multi-agent orchestration, quality gates, and review protocols on top.
46
-
47
- ### Flow Selection
34
+ ## Flow-Driven Development (PRIMARY BEHAVIOR)
48
35
 
49
- | Situation | Flow | Steps |
50
- |-----------|------|-------|
51
- | Bug fix, small feature, refactoring | \`aikit:basic\` | assess → implement → verify |
52
- | New feature, major change, multi-file | \`aikit:advanced\` | spec → plan → task → execute → verify |
53
- | Custom/specialized work | Check \`flow_list\` | Follow flow-specific steps |
36
+ **After bootstrap, the Orchestrator MUST select and start a flow.** Flows define the step sequence — Orchestrator adds multi-agent orchestration, quality gates, and review protocols on top. Design decisions, brainstorming, and FORGE classification are handled by the **design** step within each flow — NOT by the Orchestrator directly.
54
37
 
55
- **If multiple flows could apply and user hasn't specified → ask user to choose.**
38
+ ### Flow Activation (MANDATORY after bootstrap)
56
39
 
57
- ### Session Start Flow Check
58
-
59
- 1. \`flow_status\` — check for active flow
60
- 2. If active:
40
+ 1. \`flow_status\` check for an active flow from a previous session
41
+ 2. **If active flow exists:**
61
42
  - Note current step name and skill path
62
43
  - Read the current step skill with \`flow_read_skill\`
63
44
  - Follow its instructions
64
45
  - When complete: \`flow_step({ action: 'next' })\`
65
- 3. If no active flow:
66
- - \`flow_list\` — check ALL available flows (builtin + custom)
67
- - Recommend appropriate flow based on task scope
68
- - \`flow_start({ flow: '<name>' })\` after user confirms
46
+ 3. **If NO active flow:**
47
+ - \`flow_list\` — retrieve ALL available flows (builtin AND custom)
48
+ - **Auto-select** the flow when the task clearly matches:
49
+
50
+ | Task signal | Auto-activate flow |
51
+ |-------------|--------------------|
52
+ | Bug fix, typo, hotfix, "fix ...", error reproduction | \`aikit:basic\` |
53
+ | Small feature (≤3 files), refactoring, cleanup, dependency update | \`aikit:basic\` |
54
+ | New feature, API design, architecture change, multi-component work | \`aikit:advanced\` |
55
+ | Task matches a custom flow's description/tags exactly | That custom flow |
56
+
57
+ - **Auto-start:** When exactly one flow matches, start it immediately — \`flow_start({ flow: '<matched>' })\` — and inform the user which flow was activated and why.
58
+ - **Ask only when ambiguous:** If the task could fit multiple flows, or no flow clearly matches, present the options and let the user choose.
59
+ - Do NOT present a menu for obvious cases. Speed matters.
60
+ 4. **Every task goes through a flow.** There is no flowless path.
61
+
62
+ ### Flow Execution Loop
63
+
64
+ For EACH step in the active flow:
65
+
66
+ 1. \`flow_read_skill\` — read the current step's SKILL.md
67
+ 2. Follow the skill's instructions — delegate work to the appropriate agents
68
+ 3. Apply **Orchestrator Protocols** (PRE-DISPATCH GATE, FORGE, review cycle) during execution
69
+ 4. When the step is complete and results are approved:
70
+ - \`flow_step({ action: 'next' })\` to advance
71
+ 5. Repeat until the flow is complete
72
+
73
+ **Custom flows work identically** — \`flow_list\` returns them alongside builtins. The execution loop is the same for ALL flows.
74
+
75
+ ### Flow Completion & Cleanup
76
+
77
+ Flows MUST be driven to completion. A flow left active forever blocks future work.
78
+
79
+ **Normal completion:**
80
+ - When the last step's \`flow_step({ action: 'next' })\` is called, the flow finishes automatically
81
+ - After completion: run post-implementation protocol (\`check\` → \`test_run\` → \`blast_radius\` → \`reindex\` → \`produce_knowledge\` → \`remember\`)
82
+ - Inform the user the flow is complete with a summary of artifacts produced
83
+
84
+ **Stale flow detection** (check at session start when \`flow_status\` returns an active flow):
85
+ - If the active flow's current step has no matching work context in the conversation → **ask the user**: "A flow \`<name>\` is active at step \`<step>\`. Continue, or reset to start fresh?"
86
+ - If the user says reset → \`flow_reset()\` then activate a new flow for the current task
87
+ - If the user says continue → resume from the current step
88
+
89
+ **Abandoned step recovery:**
90
+ - If a step has been attempted ≥ 2 times with \`BLOCKED\` status → escalate to user with diagnostics, offer to \`flow_step({ action: 'skip' })\` or \`flow_reset()\`
91
+ - Never silently retry a blocked step indefinitely
92
+
93
+ **One active flow at a time.** To switch tasks, the current flow must be completed or reset first.
69
94
 
70
95
  ### Orchestrator Protocols (apply during ALL flow steps)
71
96
 
@@ -160,7 +185,7 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
160
185
  3. **Maximize parallelism** — independent tasks MUST run as parallel \`runSubagent\` calls in the SAME function block. Sequential dispatch of parallelizable tasks is a protocol violation.
161
186
  4. **Fresh context per subagent** — paste relevant code, don't reference conversation history
162
187
  5. **Search AI Kit before planning** — check past decisions with \`search()\`
163
- 6. **Route correctly** — brainstorming for design, decision protocol for tech choices
188
+ 6. **Always use flows** — every task goes through a flow; design decisions happen in the flow's design step
164
189
  7. **Never proceed without user approval** at 🛑 stops
165
190
  8. **Max 2 retries** then escalate to user
166
191
 
@@ -197,35 +222,18 @@ Before every tool call, verify:
197
222
  |-------|--------------|
198
223
  | \`multi-agents-development\` | **Before any delegation** — task decomposition, dispatch templates, review pipeline, recovery patterns |
199
224
  | \`present\` | When presenting plans, findings, or visual content to the user — dashboards, tables, charts, timelines |
200
- | \`brainstorming\` | Before creative/design work (Phase 0) |
225
+ | \`brainstorming\` | When a flow's design step requires creative/design work |
201
226
  | \`session-handoff\` | Context filling up, session ending, or major milestone |
202
227
  | \`lesson-learned\` | After completing work — extract engineering principles |
203
228
 
204
229
  **When dispatching subagents**, include relevant skill names in the prompt so subagents know which skills to load (e.g., "Load the \`react\` and \`typescript\` skills for this task").
205
230
 
206
- ## Flow-Aware Routing
231
+ ## Flows
207
232
 
208
- At session start, check for an active flow:
209
- 1. Call \`flow_status\` to check if a flow is active
210
- 2. If active and status is 'active':
211
- - Note the current step name and skill path
212
- - Load the current step's skill file
213
- - Follow its instructions for this step
214
- - When step is complete, call \`flow_step({ action: 'next' })\`
215
- 3. If no active flow:
216
- - Check \`flow_list\` for available flows
217
- - Suggest starting a flow based on the task type
218
- - Use \`flow_start({ flow: '<name>' })\` to begin
219
-
220
- ### Flow MCP Tools
221
- | Tool | Purpose |
222
- |------|---------|
223
- | \`flow_list\` | List installed flows and active flow |
224
- | \`flow_info\` | Get detailed flow info including steps |
225
- | \`flow_start\` | Start a named flow |
226
- | \`flow_step\` | Advance: next, skip, or redo current step |
227
- | \`flow_status\` | Check current execution state |
228
- | \`flow_reset\` | Clear flow state to start over |`,
233
+ This project uses aikit's pluggable flow system. Check flow status with the \`flow_status\` MCP tool.
234
+ If a flow is active, follow the current step's skill instructions. Advance with \`flow_step({ action: 'next' })\`.
235
+ Use \`flow_list\` to see available flows and \`flow_start\` to begin one.
236
+ `,
229
237
 
230
238
  Planner: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
231
239
 
@@ -257,16 +265,20 @@ At session start, check for an active flow:
257
265
  5. **Dependency Graph** — For each phase, list dependencies. Group into parallel batches
258
266
  6. **Present** — Show plan with open questions, complexity estimate, parallel batch layout
259
267
 
260
- ## Flow Integration
268
+ ## Flow Integration (PRIMARY MODE)
269
+
270
+ The Planner is typically activated by the Orchestrator as part of a flow step (e.g., \`aikit:advanced\` plan step, \`aikit:basic\` assess step, or a custom flow's planning step).
261
271
 
262
- When activated as part of a flow (e.g., \`aikit:advanced\` plan step or \`aikit:basic\` assess step):
263
- 1. Check \`flow_status\` for current step context
264
- 2. Read the step's skill file for specific instructions
265
- 3. Follow skill instructions while applying Planner methodology
266
- 4. Produce required artifacts (as specified by the flow step's \`produces\` field)
267
- 5. When complete, report to Orchestrator (do NOT call \`flow_step\` — let Orchestrator advance)
272
+ **When activated as part of a flow:**
273
+ 1. \`flow_status\` check current step context and which flow is active
274
+ 2. \`flow_read_skill\` — read the current step's SKILL.md for specific instructions
275
+ 3. Follow the skill's instructions as the primary guide, applying Planner methodology on top
276
+ 4. Read the flow's README.md for overall context on how the flow works
277
+ 5. Produce required artifacts (as specified by the flow step's \`produces\` field)
278
+ 6. When complete, report status to Orchestrator: \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`
279
+ 7. Do NOT call \`flow_step\` — the Orchestrator controls flow advancement
268
280
 
269
- When no flow is active, operate autonomously following normal Planner methodology.
281
+ **When no flow is active** (standalone mode), operate autonomously following normal Planner methodology.
270
282
 
271
283
  ## Subagent Output Relay
272
284
 
@@ -0,0 +1,70 @@
1
+ # aikit:advanced — Full Development Flow
2
+
3
+ Full development flow for **new features, API design, and architecture changes**.
4
+
5
+ ## Steps
6
+
7
+ | # | Step | Skill | Produces | Requires | Agents |
8
+ |---|------|-------|----------|----------|--------|
9
+ | 1 | **Design Gate** | `skills/design/SKILL.md` | `design-decisions.md` | — | Researcher-Alpha/Beta/Gamma/Delta |
10
+ | 2 | **Specification** | `skills/spec/SKILL.md` | `spec.md` | `design-decisions.md` | Researcher-Alpha |
11
+ | 3 | **Planning** | `skills/plan/SKILL.md` | `plan.md` | `spec.md` | Planner, Explorer |
12
+ | 4 | **Task Breakdown** | `skills/task/SKILL.md` | `tasks.md` | `plan.md` | Planner, Architect-Reviewer-Alpha |
13
+ | 5 | **Execution** | `skills/execute/SKILL.md` | `progress.md` | `tasks.md` | Orchestrator, Implementer, Frontend, Refactor |
14
+ | 6 | **Verification** | `skills/verify/SKILL.md` | `verify-report.md` | `progress.md` | Code-Reviewer-Alpha/Beta, Architect-Reviewer-Alpha/Beta, Security |
15
+
16
+ ## How It Works
17
+
18
+ Each step has a **SKILL.md** file that contains the detailed instructions for the agent(s) executing that step. The Orchestrator reads the SKILL.md via `flow_read_skill` and delegates work accordingly.
19
+
20
+ ### Step 1: Design Gate
21
+ - Full brainstorming session for new features and architectural changes
22
+ - FORGE classification (`forge_classify`) + grounding (`forge_ground`) for complex tasks
23
+ - Parallel 4-researcher decision protocol for non-trivial technical decisions
24
+ - ADR generation for critical-tier tasks
25
+ - **Mandatory user stop** before proceeding — design decisions must be approved
26
+ - Read `skills/design/SKILL.md` for the full protocol
27
+
28
+ ### Step 2: Specification
29
+ - Elicit requirements from the user, clarify scope
30
+ - Define acceptance criteria and constraints
31
+ - Build on design decisions from the previous step
32
+
33
+ ### Step 3: Planning
34
+ - Deep codebase analysis using `search`, `scope_map`, `trace`, `analyze_*`
35
+ - Design architecture based on spec and design decisions
36
+ - Create comprehensive implementation plan with file-level changes
37
+
38
+ ### Step 4: Task Breakdown
39
+ - Break the plan into ordered, atomic implementation tasks
40
+ - Define dependencies between tasks
41
+ - Identify parallel batches for multi-agent execution
42
+ - Architecture review of the task structure
43
+
44
+ ### Step 5: Execution
45
+ - Orchestrator dispatches agents in parallel batches per the task breakdown
46
+ - Each agent gets a scoped task (1-3 files) with clear acceptance criteria
47
+ - TDD: write tests first, then implement
48
+ - Per-batch review cycle: Code Review (dual) → Arch Review → Security → Evidence Gate
49
+
50
+ ### Step 6: Verification
51
+ - Dual code review (Code-Reviewer-Alpha + Beta)
52
+ - Architecture review (Architect-Reviewer-Alpha + Beta)
53
+ - Security review
54
+ - Run `check({})` + `test_run({})` + `blast_radius({})`
55
+ - `evidence_map({ action: "gate" })` for final quality gate
56
+
57
+ ## Using Skills Inside Steps
58
+
59
+ When the Orchestrator activates a step:
60
+
61
+ 1. **Read the skill first** — `flow_read_skill` returns the SKILL.md for the current step
62
+ 2. **Follow skill instructions** — the SKILL.md is the primary guide for what to do
63
+ 3. **Delegate to listed agents** — each step lists which agents are appropriate
64
+ 4. **Produce the required artifact** — the step's `produces` field specifies what file to create in the artifacts directory
65
+ 5. **Check dependencies** — the step's `requires` field lists artifacts from previous steps that must exist
66
+ 6. **Report status** — agents report `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED` to the Orchestrator
67
+
68
+ ## Artifacts
69
+
70
+ All artifacts are stored in the `.spec/` directory relative to the project root.
@@ -3,12 +3,21 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Full development flow for new features, API design, and architecture changes",
5
5
  "steps": [
6
+ {
7
+ "id": "design",
8
+ "name": "Design Gate",
9
+ "skill": "skills/design/SKILL.md",
10
+ "produces": ["design-decisions.md"],
11
+ "requires": [],
12
+ "agents": ["Researcher-Alpha", "Researcher-Beta", "Researcher-Gamma", "Researcher-Delta"],
13
+ "description": "Full brainstorming, FORGE classification, decision protocol with parallel research. ADR for critical-tier tasks."
14
+ },
6
15
  {
7
16
  "id": "spec",
8
17
  "name": "Specification",
9
18
  "skill": "skills/spec/SKILL.md",
10
19
  "produces": ["spec.md"],
11
- "requires": [],
20
+ "requires": ["design-decisions.md"],
12
21
  "agents": ["Researcher-Alpha"],
13
22
  "description": "Elicit requirements, clarify scope, define acceptance criteria"
14
23
  },
@@ -0,0 +1,134 @@
1
+ # Design Gate — Advanced Flow
2
+
3
+ Full design gate for new features, API design, and architecture changes. Runs brainstorming, decision protocol, and FORGE classification before specification begins.
4
+
5
+ ## When This Step Runs
6
+
7
+ This is the **first step** of the `aikit:advanced` flow. It runs before specification.
8
+
9
+ ## Instructions
10
+
11
+ ### 1. Task Classification
12
+
13
+ Classify the task:
14
+
15
+ | Category | Indicators | Action |
16
+ |----------|-----------|--------|
17
+ | **Bug fix** | Error, regression, "fix" — wrong flow, should use `aikit:basic` | → Note mismatch, still run Quick Design |
18
+ | **New feature** | New behavior, new API, new component | → Run **Full Design** below |
19
+ | **Architecture change** | Restructure, migration, new pattern, cross-cutting | → Run **Full Design** with architecture focus |
20
+
21
+ ### 2. FORGE Classification
22
+
23
+ Run `forge_classify({ task: "<task description>", files: [<relevant files>] })` to determine the complexity tier.
24
+
25
+ | Tier | Meaning | Design Depth |
26
+ |------|---------|-------------|
27
+ | **Floor** | Low risk, well-understood | Quick brainstorm, 1-2 decisions |
28
+ | **Standard** | Moderate complexity | Full brainstorm, parallel research, decision protocol |
29
+ | **Critical** | High risk, contract/security implications | Deep brainstorm, 4-researcher parallel review, ADR required |
30
+
31
+ ### 3. Brainstorming Session
32
+
33
+ Load the `brainstorming` skill and conduct a structured brainstorming session:
34
+
35
+ 1. **Intent Discovery** — What is the user trying to achieve? What problem does this solve?
36
+ 2. **Constraint Mapping** — Technical constraints, time constraints, compatibility requirements
37
+ 3. **Approach Exploration** — Generate 2-4 possible approaches
38
+ 4. **Trade-off Analysis** — Compare approaches on: complexity, maintainability, performance, risk
39
+
40
+ For **Critical** tier tasks, also explore:
41
+ - Security implications
42
+ - Backward compatibility
43
+ - Migration path
44
+ - Rollback strategy
45
+
46
+ ### 4. Decision Protocol (Standard & Critical tiers)
47
+
48
+ When technical decisions need resolution:
49
+
50
+ 1. **Identify decisions** — List each decision point with 2+ viable options
51
+ 2. **Parallel research** — Delegate to Researcher agents (2 for Standard, 4 for Critical):
52
+ - Researcher-Alpha: Deep analysis of primary approach
53
+ - Researcher-Beta: Trade-offs and edge cases of alternatives
54
+ - Researcher-Gamma: Cross-domain patterns and precedents
55
+ - Researcher-Delta: Feasibility and performance implications
56
+ 3. **Synthesize** — Combine researcher findings into a recommendation per decision
57
+ 4. **ADR** (Critical tier) — Load `adr-skill` and create an Architecture Decision Record
58
+
59
+ ### 5. FORGE Ground (Standard & Critical tiers)
60
+
61
+ Run `forge_ground({ task, root_path: "." })` to:
62
+ - Scope the affected files and modules
63
+ - Identify unknowns and risks
64
+ - Load existing constraints and conventions
65
+
66
+ **Auto-upgrade check**: If `forge_ground` reveals contract-type unknowns or security concerns not caught by initial `forge_classify`, recommend tier upgrade.
67
+
68
+ ### 6. Produce `design-decisions.md`
69
+
70
+ ```markdown
71
+ ## Design Decisions
72
+
73
+ ### FORGE Assessment
74
+ - **Tier**: {Floor | Standard | Critical}
75
+ - **Rationale**: {why this tier}
76
+ - **Auto-upgrade**: {yes/no — if yes, explain}
77
+
78
+ ### Task Summary
79
+ - **Goal**: {what we're building}
80
+ - **Problem**: {what problem this solves}
81
+ - **Users affected**: {who is impacted}
82
+
83
+ ### Approach
84
+ - **Chosen approach**: {description}
85
+ - **Alternatives considered**: {list with reasons for rejection}
86
+
87
+ ### Key Decisions
88
+ | # | Decision | Choice | Rationale |
89
+ |---|----------|--------|-----------|
90
+ | 1 | {decision} | {choice} | {why} |
91
+
92
+ ### Constraints
93
+ - {constraint 1}
94
+ - {constraint 2}
95
+
96
+ ### Risks
97
+ | Risk | Likelihood | Impact | Mitigation |
98
+ |------|-----------|--------|------------|
99
+ | {risk} | {L/M/H} | {L/M/H} | {mitigation} |
100
+
101
+ ### Open Questions
102
+ - {question 1}
103
+ - {question 2}
104
+ ```
105
+
106
+ ### 7. Present to User
107
+
108
+ Use `present({ format: "html" })` (or `format: "browser"` in CLI mode) to show:
109
+ - Design decisions summary
110
+ - FORGE tier and rationale
111
+ - Key trade-offs
112
+ - Open questions requiring user input
113
+
114
+ **🛑 MANDATORY STOP** — Wait for user approval of design decisions before proceeding.
115
+
116
+ ### 8. Report to Orchestrator
117
+
118
+ After user approves:
119
+ - `DONE` — design decisions approved, ready for specification
120
+ - `DONE_WITH_CONCERNS` — approved with caveats (list them)
121
+ - `NEEDS_CONTEXT` — user raised questions that need more research
122
+
123
+ **Do NOT call `flow_step`** — let the Orchestrator advance the flow.
124
+
125
+ ## Produces
126
+
127
+ - `design-decisions.md` — FORGE tier, approach, key decisions, constraints, risks
128
+
129
+ ## Agents
130
+
131
+ - `Researcher-Alpha` — Deep analysis of primary approach
132
+ - `Researcher-Beta` — Trade-offs and edge cases
133
+ - `Researcher-Gamma` — Cross-domain patterns
134
+ - `Researcher-Delta` — Feasibility and performance
@@ -0,0 +1,51 @@
1
+ # aikit:basic — Quick Development Flow
2
+
3
+ Quick development flow for **bug fixes, small features, and refactoring**.
4
+
5
+ ## Steps
6
+
7
+ | # | Step | Skill | Produces | Requires | Agents |
8
+ |---|------|-------|----------|----------|--------|
9
+ | 1 | **Design Gate** | `skills/design/SKILL.md` | `design-decisions.md` | — | Researcher-Alpha/Beta/Gamma/Delta |
10
+ | 2 | **Assessment** | `skills/assess/SKILL.md` | `assessment.md` | `design-decisions.md` | Explorer, Researcher-Alpha |
11
+ | 3 | **Implementation** | `skills/implement/SKILL.md` | `progress.md` | `assessment.md` | Implementer, Frontend |
12
+ | 4 | **Verification** | `skills/verify/SKILL.md` | `verify-report.md` | `progress.md` | Code-Reviewer-Alpha, Security |
13
+
14
+ ## How It Works
15
+
16
+ Each step has a **SKILL.md** file that contains the detailed instructions for the agent(s) executing that step. The Orchestrator reads the SKILL.md via `flow_read_skill` and delegates work accordingly.
17
+
18
+ ### Step 1: Design Gate
19
+ - **Auto-skips** for bug fixes and refactors (produces a minimal `design-decisions.md` noting it was skipped)
20
+ - For small features: runs quick brainstorming, FORGE classification, and optional decision protocol
21
+ - Read `skills/design/SKILL.md` for the full decision tree
22
+
23
+ ### Step 2: Assessment
24
+ - Explore the codebase to understand scope and impact
25
+ - Use `search`, `scope_map`, `file_summary`, `compact` to gather context
26
+ - Identify the approach and produce `assessment.md`
27
+
28
+ ### Step 3: Implementation
29
+ - Write code following the assessment plan
30
+ - The Orchestrator dispatches Implementer/Frontend agents with specific file scopes
31
+ - Follow TDD practices where applicable
32
+
33
+ ### Step 4: Verification
34
+ - Code review, test execution, security check
35
+ - Run `check({})` + `test_run({})` + `blast_radius({})`
36
+ - Produce `verify-report.md` with findings
37
+
38
+ ## Using Skills Inside Steps
39
+
40
+ When the Orchestrator activates a step:
41
+
42
+ 1. **Read the skill first** — `flow_read_skill` returns the SKILL.md for the current step
43
+ 2. **Follow skill instructions** — the SKILL.md is the primary guide for what to do
44
+ 3. **Delegate to listed agents** — each step lists which agents are appropriate
45
+ 4. **Produce the required artifact** — the step's `produces` field specifies what file to create in the artifacts directory
46
+ 5. **Check dependencies** — the step's `requires` field lists artifacts from previous steps that must exist
47
+ 6. **Report status** — agents report `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED` to the Orchestrator
48
+
49
+ ## Artifacts
50
+
51
+ All artifacts are stored in the `.spec/` directory relative to the project root.
@@ -3,12 +3,21 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Quick development flow for bug fixes, small features, and refactoring",
5
5
  "steps": [
6
+ {
7
+ "id": "design",
8
+ "name": "Design Gate",
9
+ "skill": "skills/design/SKILL.md",
10
+ "produces": ["design-decisions.md"],
11
+ "requires": [],
12
+ "agents": ["Researcher-Alpha", "Researcher-Beta", "Researcher-Gamma", "Researcher-Delta"],
13
+ "description": "Evaluate task type, run brainstorming for features, FORGE classification. Auto-skips for bug fixes and refactors."
14
+ },
6
15
  {
7
16
  "id": "assess",
8
17
  "name": "Assessment",
9
18
  "skill": "skills/assess/SKILL.md",
10
19
  "produces": ["assessment.md"],
11
- "requires": [],
20
+ "requires": ["design-decisions.md"],
12
21
  "agents": ["Explorer", "Researcher-Alpha"],
13
22
  "description": "Understand scope, analyze codebase, identify approach"
14
23
  },
@@ -0,0 +1,75 @@
1
+ # Design Gate — Basic Flow
2
+
3
+ Lightweight design gate for bug fixes, small features, and refactoring. Evaluates the task type and determines whether design work is needed before proceeding.
4
+
5
+ ## When This Step Runs
6
+
7
+ This is the **first step** of the `aikit:basic` flow. It runs before assessment.
8
+
9
+ ## Instructions
10
+
11
+ ### 1. Task Classification
12
+
13
+ Classify the task into one of these categories:
14
+
15
+ | Category | Indicators | Action |
16
+ |----------|-----------|--------|
17
+ | **Bug fix** | Error reports, stack traces, regression, "fix", "broken" | → **Auto-skip** to next step |
18
+ | **Refactor** | Code cleanup, rename, restructure, no behavior change | → **Auto-skip** to next step |
19
+ | **Small feature** | New behavior, new endpoint, new component, UI change | → Run **Quick Design** below |
20
+
21
+ **If the task is a bug fix or refactor**, produce a minimal `design-decisions.md`:
22
+ ```markdown
23
+ ## Design Decisions
24
+ - **Task type**: Bug fix / Refactor
25
+ - **Design gate**: Auto-skipped — no design work needed
26
+ - **Proceed to**: Assessment
27
+ ```
28
+ Then report `DONE` to the Orchestrator so the flow advances.
29
+
30
+ ### 2. Quick Design (Small Features Only)
31
+
32
+ For small features that need minimal design:
33
+
34
+ 1. **FORGE Classify** — Run `forge_classify({ task: "<task description>", files: [<relevant files>] })` to determine complexity tier
35
+ 2. **Brainstorming** (if tier ≥ Standard) — Load the `brainstorming` skill and run a focused brainstorming session:
36
+ - What is the user trying to achieve?
37
+ - What are the constraints?
38
+ - What is the simplest approach?
39
+ 3. **Decision Protocol** (if technical decisions exist) — Delegate to 2-4 Researcher agents in parallel:
40
+ - Each researcher evaluates a different approach
41
+ - Synthesize findings into a recommendation
42
+ 4. **Produce `design-decisions.md`**:
43
+
44
+ ```markdown
45
+ ## Design Decisions
46
+
47
+ ### FORGE Assessment
48
+ - **Tier**: {Floor | Standard | Critical}
49
+ - **Rationale**: {why this tier}
50
+
51
+ ### Task Summary
52
+ - **Goal**: {what we're building}
53
+ - **Approach**: {chosen approach}
54
+ - **Key decisions**: {list}
55
+
56
+ ### Constraints
57
+ - {constraint 1}
58
+ - {constraint 2}
59
+ ```
60
+
61
+ ### 3. Report to Orchestrator
62
+
63
+ When complete, report status:
64
+ - `DONE` — design decisions captured, ready for assessment
65
+ - `DONE_WITH_CONCERNS` — design captured but open questions remain (list them)
66
+
67
+ **Do NOT call `flow_step`** — let the Orchestrator advance the flow.
68
+
69
+ ## Produces
70
+
71
+ - `design-decisions.md` — Task classification, FORGE tier, key design decisions
72
+
73
+ ## Agents
74
+
75
+ - `Researcher-Alpha`, `Researcher-Beta`, `Researcher-Gamma`, `Researcher-Delta` — for parallel research during decision protocol
@@ -41,15 +41,6 @@ You orchestrate the full development lifecycle: **planning → implementation
41
41
 
42
42
  **Parallelism**: Read-only agents run in parallel freely. File-modifying agents run in parallel ONLY on completely different files. Max 4 concurrent file-modifying agents.
43
43
 
44
- ## Phase 0: Design Gate
45
-
46
- | Situation | Route |
47
- |-----------|-------|
48
- | New feature/component/behavior | **Brainstorming skill** → user dialogue → design doc |
49
- | Non-trivial technical decision | **Decision protocol** → 4 Researchers parallel → synthesize → ADR |
50
- | Both | Brainstorming first → escalate unresolved decisions to protocol |
51
- | Bug fix / refactor / explicit skip | **→ Phase 1** |
52
-
53
44
  ## FORGE Protocol
54
45
 
55
46
  1. `forge_classify({ task, files })` → determine tier (Floor/Standard/Critical)
@@ -57,32 +48,66 @@ You orchestrate the full development lifecycle: **planning → implementation
57
48
  3. After review: `evidence_map({ action: "gate", task_id })` → YIELD/HOLD/HARD_BLOCK
58
49
  4. Auto-upgrade tier if unknowns reveal contract/security issues
59
50
 
60
- ## Flow-Driven Development
61
-
62
- Orchestrator uses the flow system for structured development. Flows define the step sequence — Orchestrator adds multi-agent orchestration, quality gates, and review protocols on top.
63
-
64
- ### Flow Selection
51
+ ## Flow-Driven Development (PRIMARY BEHAVIOR)
65
52
 
66
- | Situation | Flow | Steps |
67
- |-----------|------|-------|
68
- | Bug fix, small feature, refactoring | `aikit:basic` | assess → implement → verify |
69
- | New feature, major change, multi-file | `aikit:advanced` | spec → plan → task → execute → verify |
70
- | Custom/specialized work | Check `flow_list` | Follow flow-specific steps |
53
+ **After bootstrap, the Orchestrator MUST select and start a flow.** Flows define the step sequence — Orchestrator adds multi-agent orchestration, quality gates, and review protocols on top. Design decisions, brainstorming, and FORGE classification are handled by the **design** step within each flow — NOT by the Orchestrator directly.
71
54
 
72
- **If multiple flows could apply and user hasn't specified → ask user to choose.**
55
+ ### Flow Activation (MANDATORY after bootstrap)
73
56
 
74
- ### Session Start Flow Check
75
-
76
- 1. `flow_status` — check for active flow
77
- 2. If active:
57
+ 1. `flow_status` check for an active flow from a previous session
58
+ 2. **If active flow exists:**
78
59
  - Note current step name and skill path
79
60
  - Read the current step skill with `flow_read_skill`
80
61
  - Follow its instructions
81
62
  - When complete: `flow_step({ action: 'next' })`
82
- 3. If no active flow:
83
- - `flow_list` — check ALL available flows (builtin + custom)
84
- - Recommend appropriate flow based on task scope
85
- - `flow_start({ flow: '<name>' })` after user confirms
63
+ 3. **If NO active flow:**
64
+ - `flow_list` — retrieve ALL available flows (builtin AND custom)
65
+ - **Auto-select** the flow when the task clearly matches:
66
+
67
+ | Task signal | Auto-activate flow |
68
+ |-------------|--------------------|
69
+ | Bug fix, typo, hotfix, "fix ...", error reproduction | `aikit:basic` |
70
+ | Small feature (≤3 files), refactoring, cleanup, dependency update | `aikit:basic` |
71
+ | New feature, API design, architecture change, multi-component work | `aikit:advanced` |
72
+ | Task matches a custom flow's description/tags exactly | That custom flow |
73
+
74
+ - **Auto-start:** When exactly one flow matches, start it immediately — `flow_start({ flow: '<matched>' })` — and inform the user which flow was activated and why.
75
+ - **Ask only when ambiguous:** If the task could fit multiple flows, or no flow clearly matches, present the options and let the user choose.
76
+ - Do NOT present a menu for obvious cases. Speed matters.
77
+ 4. **Every task goes through a flow.** There is no flowless path.
78
+
79
+ ### Flow Execution Loop
80
+
81
+ For EACH step in the active flow:
82
+
83
+ 1. `flow_read_skill` — read the current step's SKILL.md
84
+ 2. Follow the skill's instructions — delegate work to the appropriate agents
85
+ 3. Apply **Orchestrator Protocols** (PRE-DISPATCH GATE, FORGE, review cycle) during execution
86
+ 4. When the step is complete and results are approved:
87
+ - `flow_step({ action: 'next' })` to advance
88
+ 5. Repeat until the flow is complete
89
+
90
+ **Custom flows work identically** — `flow_list` returns them alongside builtins. The execution loop is the same for ALL flows.
91
+
92
+ ### Flow Completion & Cleanup
93
+
94
+ Flows MUST be driven to completion. A flow left active forever blocks future work.
95
+
96
+ **Normal completion:**
97
+ - When the last step's `flow_step({ action: 'next' })` is called, the flow finishes automatically
98
+ - After completion: run post-implementation protocol (`check` → `test_run` → `blast_radius` → `reindex` → `produce_knowledge` → `remember`)
99
+ - Inform the user the flow is complete with a summary of artifacts produced
100
+
101
+ **Stale flow detection** (check at session start when `flow_status` returns an active flow):
102
+ - If the active flow's current step has no matching work context in the conversation → **ask the user**: "A flow `<name>` is active at step `<step>`. Continue, or reset to start fresh?"
103
+ - If the user says reset → `flow_reset()` then activate a new flow for the current task
104
+ - If the user says continue → resume from the current step
105
+
106
+ **Abandoned step recovery:**
107
+ - If a step has been attempted ≥ 2 times with `BLOCKED` status → escalate to user with diagnostics, offer to `flow_step({ action: 'skip' })` or `flow_reset()`
108
+ - Never silently retry a blocked step indefinitely
109
+
110
+ **One active flow at a time.** To switch tasks, the current flow must be completed or reset first.
86
111
 
87
112
  ### Orchestrator Protocols (apply during ALL flow steps)
88
113
 
@@ -177,7 +202,7 @@ When subagents complete, their visual outputs (from `present`) are NOT visible t
177
202
  3. **Maximize parallelism** — independent tasks MUST run as parallel `runSubagent` calls in the SAME function block. Sequential dispatch of parallelizable tasks is a protocol violation.
178
203
  4. **Fresh context per subagent** — paste relevant code, don't reference conversation history
179
204
  5. **Search AI Kit before planning** — check past decisions with `search()`
180
- 6. **Route correctly** — brainstorming for design, decision protocol for tech choices
205
+ 6. **Always use flows** — every task goes through a flow; design decisions happen in the flow's design step
181
206
  7. **Never proceed without user approval** at 🛑 stops
182
207
  8. **Max 2 retries** then escalate to user
183
208
 
@@ -214,35 +239,18 @@ Before every tool call, verify:
214
239
  |-------|--------------|
215
240
  | `multi-agents-development` | **Before any delegation** — task decomposition, dispatch templates, review pipeline, recovery patterns |
216
241
  | `present` | When presenting plans, findings, or visual content to the user — dashboards, tables, charts, timelines |
217
- | `brainstorming` | Before creative/design work (Phase 0) |
242
+ | `brainstorming` | When a flow's design step requires creative/design work |
218
243
  | `session-handoff` | Context filling up, session ending, or major milestone |
219
244
  | `lesson-learned` | After completing work — extract engineering principles |
220
245
 
221
246
  **When dispatching subagents**, include relevant skill names in the prompt so subagents know which skills to load (e.g., "Load the `react` and `typescript` skills for this task").
222
247
 
223
- ## Flow-Aware Routing
248
+ ## Flows
224
249
 
225
- At session start, check for an active flow:
226
- 1. Call `flow_status` to check if a flow is active
227
- 2. If active and status is 'active':
228
- - Note the current step name and skill path
229
- - Load the current step's skill file
230
- - Follow its instructions for this step
231
- - When step is complete, call `flow_step({ action: 'next' })`
232
- 3. If no active flow:
233
- - Check `flow_list` for available flows
234
- - Suggest starting a flow based on the task type
235
- - Use `flow_start({ flow: '<name>' })` to begin
250
+ This project uses aikit's pluggable flow system. Check flow status with the `flow_status` MCP tool.
251
+ If a flow is active, follow the current step's skill instructions. Advance with `flow_step({ action: 'next' })`.
252
+ Use `flow_list` to see available flows and `flow_start` to begin one.
236
253
 
237
- ### Flow MCP Tools
238
- | Tool | Purpose |
239
- |------|---------|
240
- | `flow_list` | List installed flows and active flow |
241
- | `flow_info` | Get detailed flow info including steps |
242
- | `flow_start` | Start a named flow |
243
- | `flow_step` | Advance: next, skip, or redo current step |
244
- | `flow_status` | Check current execution state |
245
- | `flow_reset` | Clear flow state to start over |
246
254
 
247
255
  ## Flows
248
256
 
@@ -38,16 +38,20 @@ You are the **Planner**, autonomous planner that researches codebases and writes
38
38
  5. **Dependency Graph** — For each phase, list dependencies. Group into parallel batches
39
39
  6. **Present** — Show plan with open questions, complexity estimate, parallel batch layout
40
40
 
41
- ## Flow Integration
41
+ ## Flow Integration (PRIMARY MODE)
42
42
 
43
- When activated as part of a flow (e.g., `aikit:advanced` plan step or `aikit:basic` assess step):
44
- 1. Check `flow_status` for current step context
45
- 2. Read the step's skill file for specific instructions
46
- 3. Follow skill instructions while applying Planner methodology
47
- 4. Produce required artifacts (as specified by the flow step's `produces` field)
48
- 5. When complete, report to Orchestrator (do NOT call `flow_step` — let Orchestrator advance)
43
+ The Planner is typically activated by the Orchestrator as part of a flow step (e.g., `aikit:advanced` plan step, `aikit:basic` assess step, or a custom flow's planning step).
49
44
 
50
- When no flow is active, operate autonomously following normal Planner methodology.
45
+ **When activated as part of a flow:**
46
+ 1. `flow_status` — check current step context and which flow is active
47
+ 2. `flow_read_skill` — read the current step's SKILL.md for specific instructions
48
+ 3. Follow the skill's instructions as the primary guide, applying Planner methodology on top
49
+ 4. Read the flow's README.md for overall context on how the flow works
50
+ 5. Produce required artifacts (as specified by the flow step's `produces` field)
51
+ 6. When complete, report status to Orchestrator: `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED`
52
+ 7. Do NOT call `flow_step` — the Orchestrator controls flow advancement
53
+
54
+ **When no flow is active** (standalone mode), operate autonomously following normal Planner methodology.
51
55
 
52
56
  ## Subagent Output Relay
53
57