@davidorex/pi-workflows 0.2.0 → 0.3.1

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 (216) hide show
  1. package/CHANGELOG.md +7 -4
  2. package/README.md +12 -2
  3. package/agents/architecture-designer.agent.yaml +58 -0
  4. package/agents/architecture-inferrer.agent.yaml +60 -0
  5. package/agents/gap-identifier.agent.yaml +66 -0
  6. package/agents/handoff-writer.agent.yaml +64 -0
  7. package/agents/plan-creator.agent.yaml +63 -0
  8. package/agents/project-definer.agent.yaml +53 -0
  9. package/agents/project-inferrer.agent.yaml +63 -0
  10. package/agents/requirements-gatherer.agent.yaml +58 -0
  11. package/dist/agent-spec.d.ts +27 -0
  12. package/dist/agent-spec.d.ts.map +1 -0
  13. package/dist/agent-spec.js +112 -0
  14. package/dist/agent-spec.js.map +1 -0
  15. package/dist/checkpoint.d.ts +50 -0
  16. package/dist/checkpoint.d.ts.map +1 -0
  17. package/dist/checkpoint.js +109 -0
  18. package/dist/checkpoint.js.map +1 -0
  19. package/dist/completion.d.ts +18 -0
  20. package/dist/completion.d.ts.map +1 -0
  21. package/dist/completion.js +58 -0
  22. package/dist/completion.js.map +1 -0
  23. package/dist/dag.d.ts +56 -0
  24. package/dist/dag.d.ts.map +1 -0
  25. package/dist/dag.js +178 -0
  26. package/dist/dag.js.map +1 -0
  27. package/dist/dispatch.d.ts +35 -0
  28. package/dist/dispatch.d.ts.map +1 -0
  29. package/dist/dispatch.js +311 -0
  30. package/dist/dispatch.js.map +1 -0
  31. package/dist/expression.d.ts +64 -0
  32. package/dist/expression.d.ts.map +1 -0
  33. package/dist/expression.js +294 -0
  34. package/dist/expression.js.map +1 -0
  35. package/dist/format.d.ts +19 -0
  36. package/dist/format.d.ts.map +1 -0
  37. package/dist/format.js +42 -0
  38. package/dist/format.js.map +1 -0
  39. package/dist/index.d.ts +8 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +724 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/output.d.ts +12 -0
  44. package/dist/output.d.ts.map +1 -0
  45. package/dist/output.js +59 -0
  46. package/dist/output.js.map +1 -0
  47. package/dist/state.d.ts +66 -0
  48. package/dist/state.d.ts.map +1 -0
  49. package/dist/state.js +227 -0
  50. package/dist/state.js.map +1 -0
  51. package/dist/step-agent.d.ts +35 -0
  52. package/dist/step-agent.d.ts.map +1 -0
  53. package/dist/step-agent.js +171 -0
  54. package/dist/step-agent.js.map +1 -0
  55. package/dist/step-command.d.ts +21 -0
  56. package/dist/step-command.d.ts.map +1 -0
  57. package/dist/step-command.js +150 -0
  58. package/dist/step-command.js.map +1 -0
  59. package/dist/step-foreach.d.ts +33 -0
  60. package/dist/step-foreach.d.ts.map +1 -0
  61. package/dist/step-foreach.js +112 -0
  62. package/dist/step-foreach.js.map +1 -0
  63. package/dist/step-gate.d.ts +18 -0
  64. package/dist/step-gate.d.ts.map +1 -0
  65. package/dist/step-gate.js +137 -0
  66. package/dist/step-gate.js.map +1 -0
  67. package/dist/step-loop.d.ts +32 -0
  68. package/dist/step-loop.d.ts.map +1 -0
  69. package/dist/step-loop.js +278 -0
  70. package/dist/step-loop.js.map +1 -0
  71. package/dist/step-monitor.d.ts +56 -0
  72. package/dist/step-monitor.d.ts.map +1 -0
  73. package/dist/step-monitor.js +317 -0
  74. package/dist/step-monitor.js.map +1 -0
  75. package/dist/step-parallel.d.ts +43 -0
  76. package/dist/step-parallel.d.ts.map +1 -0
  77. package/dist/step-parallel.js +122 -0
  78. package/dist/step-parallel.js.map +1 -0
  79. package/{src/step-pause.ts → dist/step-pause.d.ts} +3 -13
  80. package/dist/step-pause.d.ts.map +1 -0
  81. package/dist/step-pause.js +22 -0
  82. package/dist/step-pause.js.map +1 -0
  83. package/dist/step-shared.d.ts +63 -0
  84. package/dist/step-shared.d.ts.map +1 -0
  85. package/dist/step-shared.js +136 -0
  86. package/dist/step-shared.js.map +1 -0
  87. package/dist/step-transform.d.ts +11 -0
  88. package/dist/step-transform.d.ts.map +1 -0
  89. package/dist/step-transform.js +41 -0
  90. package/dist/step-transform.js.map +1 -0
  91. package/dist/template.d.ts +51 -0
  92. package/dist/template.d.ts.map +1 -0
  93. package/{src/template.ts → dist/template.js} +32 -38
  94. package/dist/template.js.map +1 -0
  95. package/dist/test-helpers.d.ts +17 -0
  96. package/dist/test-helpers.d.ts.map +1 -0
  97. package/dist/test-helpers.js +46 -0
  98. package/dist/test-helpers.js.map +1 -0
  99. package/dist/tui.d.ts +47 -0
  100. package/dist/tui.d.ts.map +1 -0
  101. package/dist/tui.js +143 -0
  102. package/dist/tui.js.map +1 -0
  103. package/dist/types.d.ts +165 -0
  104. package/dist/types.d.ts.map +1 -0
  105. package/dist/types.js +3 -0
  106. package/dist/types.js.map +1 -0
  107. package/dist/workflow-discovery.d.ts +23 -0
  108. package/dist/workflow-discovery.d.ts.map +1 -0
  109. package/dist/workflow-discovery.js +103 -0
  110. package/dist/workflow-discovery.js.map +1 -0
  111. package/dist/workflow-executor.d.ts +50 -0
  112. package/dist/workflow-executor.d.ts.map +1 -0
  113. package/dist/workflow-executor.js +738 -0
  114. package/dist/workflow-executor.js.map +1 -0
  115. package/dist/workflow-sdk.d.ts +44 -0
  116. package/dist/workflow-sdk.d.ts.map +1 -0
  117. package/dist/workflow-sdk.js +457 -0
  118. package/dist/workflow-sdk.js.map +1 -0
  119. package/dist/workflow-spec.d.ts +33 -0
  120. package/dist/workflow-spec.d.ts.map +1 -0
  121. package/dist/workflow-spec.js +476 -0
  122. package/dist/workflow-spec.js.map +1 -0
  123. package/dist/workflows-dir.d.ts +3 -0
  124. package/dist/workflows-dir.d.ts.map +1 -0
  125. package/{src/workflows-dir.ts → dist/workflows-dir.js} +1 -0
  126. package/dist/workflows-dir.js.map +1 -0
  127. package/package.json +53 -38
  128. package/schemas/decomposition-specs.schema.json +48 -48
  129. package/schemas/execution-results.schema.json +48 -48
  130. package/schemas/investigation-findings.schema.json +43 -43
  131. package/schemas/pattern-analysis.schema.json +41 -41
  132. package/schemas/phase.schema.json +48 -0
  133. package/schemas/plan-breakdown.schema.json +20 -20
  134. package/schemas/quality-analysis.schema.json +33 -33
  135. package/schemas/research-findings.schema.json +42 -42
  136. package/schemas/structure-analysis.schema.json +40 -40
  137. package/schemas/synthesis.schema.json +31 -31
  138. package/schemas/verifier-output.schema.json +94 -94
  139. package/skill-narrative.md +107 -0
  140. package/skills/pi-workflows/SKILL.md +185 -0
  141. package/skills/pi-workflows/references/bundled-resources.md +87 -0
  142. package/templates/architecture-designer/task.md +117 -0
  143. package/templates/architecture-inferrer/task.md +61 -0
  144. package/templates/gap-identifier/task.md +103 -0
  145. package/templates/handoff-writer/task.md +91 -0
  146. package/templates/plan-creator/task.md +143 -0
  147. package/templates/project-definer/task.md +67 -0
  148. package/templates/project-inferrer/task.md +56 -0
  149. package/templates/requirements-gatherer/task.md +90 -0
  150. package/workflows/analyze-existing-project.workflow.yaml +94 -0
  151. package/workflows/create-handoff.workflow.yaml +66 -0
  152. package/workflows/create-phase.workflow.yaml +1 -1
  153. package/workflows/do-gap.workflow.yaml +4 -4
  154. package/workflows/fix-audit.workflow.yaml +1 -1
  155. package/workflows/gap-to-phase.workflow.yaml +1 -1
  156. package/workflows/init-new-project.workflow.yaml +81 -0
  157. package/workflows/plan-from-requirements.workflow.yaml +59 -0
  158. package/workflows/self-implement.workflow.yaml +3 -3
  159. package/workflows/typed-analysis.workflow.yaml +4 -4
  160. package/src/agent-spec.test.ts +0 -289
  161. package/src/agent-spec.ts +0 -122
  162. package/src/block-validation.test.ts +0 -350
  163. package/src/checkpoint.test.ts +0 -237
  164. package/src/checkpoint.ts +0 -140
  165. package/src/completion.test.ts +0 -143
  166. package/src/completion.ts +0 -68
  167. package/src/dag.test.ts +0 -350
  168. package/src/dag.ts +0 -219
  169. package/src/dispatch.test.ts +0 -475
  170. package/src/dispatch.ts +0 -353
  171. package/src/expression.test.ts +0 -353
  172. package/src/expression.ts +0 -332
  173. package/src/format.test.ts +0 -80
  174. package/src/format.ts +0 -41
  175. package/src/graduated-failure.test.ts +0 -556
  176. package/src/index.test.ts +0 -114
  177. package/src/index.ts +0 -516
  178. package/src/loop.test.ts +0 -551
  179. package/src/output.test.ts +0 -213
  180. package/src/output.ts +0 -70
  181. package/src/parallel-integration.test.ts +0 -175
  182. package/src/resume.test.ts +0 -192
  183. package/src/state.test.ts +0 -192
  184. package/src/state.ts +0 -254
  185. package/src/step-agent.test.ts +0 -327
  186. package/src/step-agent.ts +0 -178
  187. package/src/step-command.test.ts +0 -330
  188. package/src/step-command.ts +0 -132
  189. package/src/step-foreach.test.ts +0 -647
  190. package/src/step-foreach.ts +0 -148
  191. package/src/step-gate.test.ts +0 -185
  192. package/src/step-gate.ts +0 -116
  193. package/src/step-loop.test.ts +0 -626
  194. package/src/step-loop.ts +0 -323
  195. package/src/step-parallel.test.ts +0 -475
  196. package/src/step-parallel.ts +0 -168
  197. package/src/step-pause.test.ts +0 -30
  198. package/src/step-shared.test.ts +0 -355
  199. package/src/step-shared.ts +0 -157
  200. package/src/step-transform.test.ts +0 -155
  201. package/src/step-transform.ts +0 -47
  202. package/src/template-integration.test.ts +0 -72
  203. package/src/template.test.ts +0 -162
  204. package/src/test-helpers.ts +0 -51
  205. package/src/tui.test.ts +0 -355
  206. package/src/tui.ts +0 -182
  207. package/src/types.ts +0 -195
  208. package/src/verifier-schema.test.ts +0 -226
  209. package/src/workflow-discovery.test.ts +0 -105
  210. package/src/workflow-discovery.ts +0 -114
  211. package/src/workflow-executor.test.ts +0 -1532
  212. package/src/workflow-executor.ts +0 -810
  213. package/src/workflow-sdk.test.ts +0 -238
  214. package/src/workflow-sdk.ts +0 -262
  215. package/src/workflow-spec.test.ts +0 -576
  216. package/src/workflow-spec.ts +0 -471
@@ -0,0 +1,87 @@
1
+ # Bundled Resources
2
+
3
+ ## agents/ (21 files)
4
+
5
+ - `agents/architecture-designer.agent.yaml`
6
+ - `agents/architecture-inferrer.agent.yaml`
7
+ - `agents/audit-fixer.agent.yaml`
8
+ - `agents/code-explorer.agent.yaml`
9
+ - `agents/decomposer.agent.yaml`
10
+ - `agents/gap-identifier.agent.yaml`
11
+ - `agents/handoff-writer.agent.yaml`
12
+ - `agents/investigator.agent.yaml`
13
+ - `agents/pattern-analyzer.agent.yaml`
14
+ - `agents/phase-author.agent.yaml`
15
+ - `agents/plan-creator.agent.yaml`
16
+ - `agents/plan-decomposer.agent.yaml`
17
+ - `agents/project-definer.agent.yaml`
18
+ - `agents/project-inferrer.agent.yaml`
19
+ - `agents/quality-analyzer.agent.yaml`
20
+ - `agents/requirements-gatherer.agent.yaml`
21
+ - `agents/researcher.agent.yaml`
22
+ - `agents/spec-implementer.agent.yaml`
23
+ - `agents/structure-analyzer.agent.yaml`
24
+ - `agents/synthesizer.agent.yaml`
25
+ - `agents/verifier.agent.yaml`
26
+
27
+ ## schemas/ (11 files)
28
+
29
+ - `schemas/decomposition-specs.schema.json`
30
+ - `schemas/execution-results.schema.json`
31
+ - `schemas/investigation-findings.schema.json`
32
+ - `schemas/pattern-analysis.schema.json`
33
+ - `schemas/phase.schema.json`
34
+ - `schemas/plan-breakdown.schema.json`
35
+ - `schemas/quality-analysis.schema.json`
36
+ - `schemas/research-findings.schema.json`
37
+ - `schemas/structure-analysis.schema.json`
38
+ - `schemas/synthesis.schema.json`
39
+ - `schemas/verifier-output.schema.json`
40
+
41
+ ## workflows/ (14 files)
42
+
43
+ - `workflows/analyze-existing-project.workflow.yaml`
44
+ - `workflows/create-handoff.workflow.yaml`
45
+ - `workflows/create-phase.workflow.yaml`
46
+ - `workflows/do-gap.workflow.yaml`
47
+ - `workflows/fix-audit.workflow.yaml`
48
+ - `workflows/gap-to-phase.workflow.yaml`
49
+ - `workflows/init-new-project.workflow.yaml`
50
+ - `workflows/parallel-analysis.workflow.yaml`
51
+ - `workflows/parallel-explicit.workflow.yaml`
52
+ - `workflows/pausable-analysis.workflow.yaml`
53
+ - `workflows/plan-from-requirements.workflow.yaml`
54
+ - `workflows/resumable-analysis.workflow.yaml`
55
+ - `workflows/self-implement.workflow.yaml`
56
+ - `workflows/typed-analysis.workflow.yaml`
57
+
58
+ ## templates/ (28 files)
59
+
60
+ - `templates/analyzers/base-analyzer.md`
61
+ - `templates/analyzers/macros.md`
62
+ - `templates/analyzers/patterns-task.md`
63
+ - `templates/analyzers/patterns.md`
64
+ - `templates/analyzers/quality-task.md`
65
+ - `templates/analyzers/quality.md`
66
+ - `templates/analyzers/structure-task.md`
67
+ - `templates/analyzers/structure.md`
68
+ - `templates/architecture-designer/task.md`
69
+ - `templates/architecture-inferrer/task.md`
70
+ - `templates/audit-fixer/task.md`
71
+ - `templates/decomposer/task.md`
72
+ - `templates/explorer/system.md`
73
+ - `templates/explorer/task.md`
74
+ - `templates/gap-identifier/task.md`
75
+ - `templates/handoff-writer/task.md`
76
+ - `templates/investigator/task.md`
77
+ - `templates/phase-author/task.md`
78
+ - `templates/plan-creator/task.md`
79
+ - `templates/plan-decomposer/task.md`
80
+ - `templates/project-definer/task.md`
81
+ - `templates/project-inferrer/task.md`
82
+ - `templates/requirements-gatherer/task.md`
83
+ - `templates/researcher/task.md`
84
+ - `templates/spec-implementer/task.md`
85
+ - `templates/synthesizer/system.md`
86
+ - `templates/synthesizer/task.md`
87
+ - `templates/verifier/task.md`
@@ -0,0 +1,117 @@
1
+ ## Project Identity
2
+
3
+ **Name:** {{ project.name }}
4
+ **Description:** {{ project.description }}
5
+ **Core Value:** {{ project.core_value }}
6
+ {% if project.stack %}
7
+
8
+ ### Stack
9
+ {% for item in project.stack %}
10
+ - {{ item }}
11
+ {% endfor %}
12
+ {% endif %}
13
+
14
+ ### Constraints
15
+ {% for constraint in project.constraints %}
16
+ - [{{ constraint.type }}] {{ constraint.description }}
17
+ {% endfor %}
18
+
19
+ ### Scope Boundaries
20
+
21
+ **In scope:**
22
+ {% for item in project.scope_boundaries.in %}
23
+ - {{ item }}
24
+ {% endfor %}
25
+
26
+ **Out of scope:**
27
+ {% for item in project.scope_boundaries.out %}
28
+ - {{ item }}
29
+ {% endfor %}
30
+
31
+ ## Requirements
32
+
33
+ ### Must
34
+ {% for req in requirements.requirements %}
35
+ {% if req.priority == "must" %}
36
+ - **{{ req.id }}** [{{ req.type }}]: {{ req.description }}
37
+ {% endif %}
38
+ {% endfor %}
39
+
40
+ ### Should
41
+ {% for req in requirements.requirements %}
42
+ {% if req.priority == "should" %}
43
+ - **{{ req.id }}** [{{ req.type }}]: {{ req.description }}
44
+ {% endif %}
45
+ {% endfor %}
46
+
47
+ ### Could
48
+ {% for req in requirements.requirements %}
49
+ {% if req.priority == "could" %}
50
+ - **{{ req.id }}** [{{ req.type }}]: {{ req.description }}
51
+ {% endif %}
52
+ {% endfor %}
53
+
54
+ ## Instructions
55
+
56
+ Design the initial architecture for this project. Produce modules, patterns, and boundaries that satisfy the requirements above — starting with "must" requirements and ensuring "should" requirements have a clear home.
57
+
58
+ ### For each module, provide:
59
+
60
+ 1. **name** — short identifier (e.g., "api", "auth", "storage", "cli")
61
+ 2. **file** — primary file path relative to project root (e.g., "src/api.ts")
62
+ 3. **responsibility** — one sentence: what this module owns and what it does not
63
+ 4. **dependencies** — array of other module names this depends on (empty if none)
64
+ 5. **lines** — estimated lines of code (rough order of magnitude)
65
+
66
+ ### For each pattern, provide:
67
+
68
+ 1. **name** — recognized pattern name (e.g., "Repository Pattern", "Event Sourcing", "Middleware Pipeline")
69
+ 2. **description** — why this pattern is appropriate for this project's specific needs
70
+ 3. **used_in** — array of module names that implement this pattern
71
+
72
+ ### For boundaries, provide:
73
+
74
+ An array of strings — each describing a hard architectural constraint. These should be specific to this project, not generic ("All database access goes through the storage module", not "separate concerns").
75
+
76
+ ### Design principles
77
+
78
+ - Module count should be proportional to requirements — a 5-requirement project needs 3-5 modules, not 15
79
+ - Every "must" functional requirement should map to at least one module's responsibility
80
+ - Every "must" non-functional requirement should be addressed by a pattern or boundary
81
+ - Dependencies should flow in one direction — avoid circular module dependencies
82
+ - If the project has a stated stack, modules should use file extensions and conventions matching that stack
83
+ - Prefer explicit boundaries over implicit conventions
84
+
85
+ ### Overview
86
+
87
+ Write an `overview` paragraph (required) summarizing:
88
+ - The architectural style (layered, modular, pipeline, etc.)
89
+ - The key structural decisions and why they fit this project
90
+ - How the architecture supports the core_value
91
+
92
+ ### Output format
93
+
94
+ Produce a single JSON object:
95
+
96
+ ```json
97
+ {
98
+ "overview": "string (required)",
99
+ "modules": [
100
+ {
101
+ "name": "string (required)",
102
+ "file": "string (required)",
103
+ "responsibility": "string (required)",
104
+ "dependencies": ["string"],
105
+ "lines": 100
106
+ }
107
+ ],
108
+ "patterns": [
109
+ {
110
+ "name": "string (required)",
111
+ "description": "string (required)",
112
+ "used_in": ["module-name"]
113
+ }
114
+ ],
115
+ "boundaries": ["string"]
116
+ }
117
+ ```
@@ -0,0 +1,61 @@
1
+ Infer the architecture of the project at `{{ path }}`.
2
+
3
+ ## Codebase Analysis
4
+
5
+ {% if analysis.files is defined %}
6
+ ### Files
7
+ {% for file in analysis.files %}
8
+ - `{{ file.path }}` ({{ file.language | default("unknown") }}, {{ file.lines | default("?") }} lines){% if file.exports %} — {{ file.exports | length }} exports{% endif %}
9
+ {% endfor %}
10
+ {% endif %}
11
+
12
+ {% if analysis.types is defined %}
13
+ ### Types
14
+ {% for t in analysis.types %}
15
+ - `{{ t.name }}` ({{ t.kind }}) in `{{ t.file }}`
16
+ {% endfor %}
17
+ {% endif %}
18
+
19
+ {% if analysis.dependencies is defined %}
20
+ ### Dependencies
21
+ {% for d in analysis.dependencies %}
22
+ - `{{ d.from }}` → `{{ d.to }}` ({{ d.type | default("import") }})
23
+ {% endfor %}
24
+ {% endif %}
25
+
26
+ {% if analysis.entryPoints is defined %}
27
+ ### Entry Points
28
+ {% for ep in analysis.entryPoints %}
29
+ - `{{ ep }}`
30
+ {% endfor %}
31
+ {% endif %}
32
+
33
+ ## Instructions
34
+
35
+ From the analysis above and targeted code reads, produce an architecture block:
36
+
37
+ 1. **Modules** — each cohesive unit with a clear responsibility. For each:
38
+ - `name`: concise identifier (e.g., "block-api", "expression-engine")
39
+ - `file`: primary file path relative to project root
40
+ - `responsibility`: one-sentence description of what this module does
41
+ - `dependencies`: array of other module names this module depends on
42
+ - `lines`: approximate line count
43
+
44
+ 2. **Patterns** — design patterns evidenced in the code. For each:
45
+ - `name`: pattern name (e.g., "registry", "factory", "middleware")
46
+ - `description`: how this pattern is applied in this codebase
47
+ - `used_in`: array of module names that use this pattern
48
+
49
+ 3. **Boundaries** — architectural seams where modules interact through defined interfaces (e.g., "block-api validates all writes before persistence", "dispatch spawns subprocesses through a single entry point")
50
+
51
+ 4. **Overview** — one paragraph summarizing the architecture: what the system does, how it's organized, and what the key design decisions are
52
+
53
+ Read entry points, config files, and module interfaces to confirm the analysis. Do not read every file.
54
+
55
+ ## Required Output Schema
56
+
57
+ You MUST produce JSON conforming exactly to this schema. Every required field must be present.
58
+
59
+ ```json
60
+ {{ output_schema }}
61
+ ```
@@ -0,0 +1,103 @@
1
+ Identify gaps in the project at `{{ path }}`.
2
+
3
+ ## Architecture
4
+
5
+ {% if architecture.overview %}
6
+ {{ architecture.overview }}
7
+ {% endif %}
8
+
9
+ ### Modules
10
+ {% if architecture.modules is defined %}
11
+ {% for m in architecture.modules %}
12
+ - **{{ m.name }}** (`{{ m.file }}`{% if m.lines %}, {{ m.lines }} lines{% endif %}): {{ m.responsibility }}
13
+ {% endfor %}
14
+ {% endif %}
15
+
16
+ {% if architecture.patterns is defined %}
17
+ ### Patterns
18
+ {% for p in architecture.patterns %}
19
+ - **{{ p.name }}**: {{ p.description }}{% if p.used_in %} — used in: {{ p.used_in | join(", ") }}{% endif %}
20
+ {% endfor %}
21
+ {% endif %}
22
+
23
+ {% if architecture.boundaries is defined %}
24
+ ### Boundaries
25
+ {% for b in architecture.boundaries %}
26
+ - {{ b }}
27
+ {% endfor %}
28
+ {% endif %}
29
+
30
+ ## Codebase Analysis
31
+
32
+ {% if analysis.files is defined %}
33
+ ### Files ({{ analysis.files | length }} total)
34
+ {% for file in analysis.files %}
35
+ - `{{ file.path }}` ({{ file.language | default("unknown") }}, {{ file.lines | default("?") }} lines){% if file.exports %} — {{ file.exports | length }} exports{% endif %}
36
+ {% endfor %}
37
+ {% endif %}
38
+
39
+ {% if analysis.types is defined %}
40
+ ### Types
41
+ {% for t in analysis.types %}
42
+ - `{{ t.name }}` ({{ t.kind }}) in `{{ t.file }}`
43
+ {% endfor %}
44
+ {% endif %}
45
+
46
+ ## Instructions
47
+
48
+ Cross-reference the architecture and analysis to identify gaps. Use targeted reads to verify findings.
49
+
50
+ ### Gap categories to check
51
+
52
+ 1. **missing** — functionality that should exist based on architecture but doesn't
53
+ - Test files for source modules (find test files, compare against source)
54
+ - Error handling for public APIs
55
+ - Documentation for exported interfaces
56
+ - Schema validation for user-facing inputs
57
+
58
+ 2. **incomplete** — partially implemented functionality
59
+ - TODO/FIXME/HACK comments (`grep -r "TODO\|FIXME\|HACK"`)
60
+ - Stub or placeholder implementations
61
+ - Functions that return hardcoded values or throw "not implemented"
62
+
63
+ 3. **defect** — likely bugs or incorrect behavior
64
+ - Uncaught promise rejections, missing null checks
65
+ - Type assertions that bypass safety (`as any`, `!` operator overuse)
66
+ - Error paths that swallow exceptions silently
67
+
68
+ 4. **technical-debt** — code that works but hampers maintenance
69
+ - Duplicated logic across modules
70
+ - Outdated patterns inconsistent with the rest of the codebase
71
+ - Overly complex functions (high cyclomatic complexity)
72
+
73
+ 5. **improvement** — opportunities to improve existing working code
74
+ - Performance bottlenecks
75
+ - Missing caching or memoization for expensive operations
76
+ - Public APIs that could be more ergonomic
77
+
78
+ 6. **question** — ambiguities requiring human or further investigation
79
+ - Unclear design decisions without documented rationale
80
+ - Behavior that could be intentional or accidental
81
+
82
+ ### Gap ID format
83
+
84
+ Use the pattern: `gap-{abbrev}-{nnn}` where abbrev is:
85
+ - `miss` for missing, `inc` for incomplete, `def` for defect
86
+ - `debt` for technical-debt, `imp` for improvement, `q` for question
87
+
88
+ ### Priority calibration
89
+
90
+ - **critical**: blocks further development or causes data loss
91
+ - **high**: significant impact on reliability, correctness, or developer experience
92
+ - **medium**: notable but workable; should be addressed in normal development
93
+ - **low**: minor cleanup or cosmetic; address opportunistically
94
+
95
+ Set `source` to `"agent"` for all gaps. Set `status` to `"open"` for all gaps.
96
+
97
+ ## Required Output Schema
98
+
99
+ You MUST produce JSON conforming exactly to this schema. Every required field must be present.
100
+
101
+ ```json
102
+ {{ output_schema }}
103
+ ```
@@ -0,0 +1,91 @@
1
+ Capture a handoff snapshot for the project at `{{ path }}`.
2
+
3
+ ## Current Project State
4
+
5
+ {% if project_state.project is defined %}
6
+ ### Project
7
+ **{{ project_state.project.name | default("unnamed") }}** — {{ project_state.project.description | default("no description") }}
8
+ Status: {{ project_state.project.status | default("unknown") }}
9
+ {% endif %}
10
+
11
+ {% if project_state.phases is defined and project_state.phases | length > 0 %}
12
+ ### Phases
13
+ {% for phase in project_state.phases %}
14
+ - Phase {{ phase.number | default(loop.index) }}: {{ phase.name | default("unnamed") }} ({{ phase.status | default("unknown") }})
15
+ {% endfor %}
16
+ {% endif %}
17
+
18
+ {% if project_state.blockSummaries is defined %}
19
+ ### Block Summaries
20
+ {% for block in project_state.blockSummaries %}
21
+ - **{{ block.name }}**: {{ block.count | default("?") }} entries
22
+ {% endfor %}
23
+ {% endif %}
24
+
25
+ {% if project_state.gaps is defined %}
26
+ ### Open Gaps
27
+ {% for gap in project_state.gaps %}
28
+ {% if gap.status == "open" %}
29
+ - [{{ gap.priority }}] {{ gap.id }}: {{ gap.description }}
30
+ {% endif %}
31
+ {% endfor %}
32
+ {% endif %}
33
+
34
+ {% if project_state.decisions is defined %}
35
+ ### Recent Decisions
36
+ {% for decision in project_state.decisions %}
37
+ - {{ decision.id | default("?") }}: {{ decision.description | default(decision.title | default("no description")) }}
38
+ {% endfor %}
39
+ {% endif %}
40
+
41
+ {% if project_state.recentCommits is defined %}
42
+ ### Recent Commits
43
+ {% for commit in project_state.recentCommits %}
44
+ - `{{ commit.sha | default("?") | truncate(7, true, "") }}` {{ commit.message | default("no message") }}
45
+ {% endfor %}
46
+ {% endif %}
47
+
48
+ ## Instructions
49
+
50
+ Synthesize the project state above into a handoff block that enables a future agent or human to resume work seamlessly.
51
+
52
+ 1. **context** — Write a paragraph capturing:
53
+ - What was being worked on (current phase, recent commits, active changes)
54
+ - The current state of thinking (what decisions were made, what approach is being taken)
55
+ - Any momentum or direction that should be preserved
56
+
57
+ 2. **timestamp** — Current datetime in ISO 8601 format (e.g., 2026-03-18T14:30:00Z)
58
+
59
+ 3. **current_phase** — The phase currently being worked on (number or name)
60
+
61
+ 4. **current_tasks** — Task IDs currently in progress (from project state if available, otherwise infer from recent activity)
62
+
63
+ 5. **blockers** — Anything preventing progress:
64
+ - Unresolved decisions that block implementation
65
+ - Failing tests or broken builds
66
+ - Missing dependencies or external requirements
67
+ - Only include genuine blockers, not wishes
68
+
69
+ 6. **next_actions** — Concrete next steps, ordered by priority:
70
+ - What should the next session do first?
71
+ - What's the next logical step in the current phase?
72
+ - Keep to 3-5 actionable items
73
+
74
+ 7. **open_questions** — Genuine unknowns requiring input:
75
+ - Design decisions that need human judgment
76
+ - Ambiguities discovered during development
77
+ - Technical choices with trade-offs that haven't been resolved
78
+
79
+ 8. **key_decisions_pending** — Decision IDs from the project state that need resolution
80
+
81
+ 9. **files_in_flux** — Files with incomplete or in-progress changes (NOT every recently committed file — only files that have partial work)
82
+
83
+ Read project blocks if needed to get more detail than the summary provides. Focus on in-flight state, not project overview.
84
+
85
+ ## Required Output Schema
86
+
87
+ You MUST produce JSON conforming exactly to this schema. Every required field must be present.
88
+
89
+ ```json
90
+ {{ output_schema }}
91
+ ```
@@ -0,0 +1,143 @@
1
+ ## Project Identity
2
+
3
+ **Name:** {{ project.name }}
4
+ **Description:** {{ project.description }}
5
+ **Core Value:** {{ project.core_value }}
6
+ **Status:** {{ project.status }}
7
+ {% if project.stack %}
8
+
9
+ ### Stack
10
+ {% for item in project.stack %}
11
+ - {{ item }}
12
+ {% endfor %}
13
+ {% endif %}
14
+
15
+ ## Requirements Summary
16
+
17
+ {% for req in requirements.requirements %}
18
+ {% if req.priority == "must" %}
19
+ - **{{ req.id }}** [must/{{ req.type }}]: {{ req.description }}
20
+ {% endif %}
21
+ {% endfor %}
22
+ {% for req in requirements.requirements %}
23
+ {% if req.priority == "should" %}
24
+ - **{{ req.id }}** [should/{{ req.type }}]: {{ req.description }}
25
+ {% endif %}
26
+ {% endfor %}
27
+ {% for req in requirements.requirements %}
28
+ {% if req.priority == "could" %}
29
+ - **{{ req.id }}** [could/{{ req.type }}]: {{ req.description }}
30
+ {% endif %}
31
+ {% endfor %}
32
+
33
+ ## Architecture
34
+
35
+ **Overview:** {{ architecture.overview }}
36
+
37
+ ### Modules
38
+ {% for module in architecture.modules %}
39
+ - **{{ module.name }}** (`{{ module.file }}`): {{ module.responsibility }}{% if module.dependencies %} [depends: {{ module.dependencies | join(", ") }}]{% endif %}
40
+ {% endfor %}
41
+
42
+ ### Patterns
43
+ {% for pattern in architecture.patterns %}
44
+ - **{{ pattern.name }}**: {{ pattern.description }} (used in: {{ pattern.used_in | join(", ") }})
45
+ {% endfor %}
46
+
47
+ ### Boundaries
48
+ {% for boundary in architecture.boundaries %}
49
+ - {{ boundary }}
50
+ {% endfor %}
51
+
52
+ {% if existing_files %}
53
+ ## Existing Project Files
54
+
55
+ The project directory already contains these files:
56
+ {% for file in existing_files %}
57
+ - {{ file }}
58
+ {% endfor %}
59
+
60
+ Account for existing structure — do not plan to recreate files that already exist unless they need modification.
61
+ {% endif %}
62
+
63
+ ## Instructions
64
+
65
+ Create implementation phases and tasks that build this project incrementally. The plan should take the project from its current state ({{ project.status }}) to a working system that satisfies all "must" requirements and addresses "should" requirements.
66
+
67
+ ### Phase guidelines
68
+
69
+ 1. **Phase 1** — Foundation: project structure, core module scaffolding, configuration, initial tests
70
+ 2. **Phase 2+** — Layer functionality in priority order: "must" requirements first, then "should"
71
+ 3. **Final phase** — Integration, documentation, and verification
72
+ 4. Each phase should represent a meaningful milestone — the project is more capable after each phase
73
+ 5. A phase with more than 8-10 tasks is likely too large — split it
74
+
75
+ ### For each phase, provide:
76
+
77
+ - **number** — sequential starting at 1
78
+ - **name** — short descriptive name
79
+ - **intent** — what this phase accomplishes and why it comes at this point
80
+ - **goal** — what is true after this phase that was not true before
81
+ - **status** — `"planned"`
82
+ - **success_criteria** — array of `{ criterion, verify_method }` (verify_method: "command", "inspect", or "test")
83
+ - **dependencies** — array of phase numbers this depends on (empty for phase 1)
84
+ - **inputs** — what this phase needs from prior phases or external sources
85
+ - **outputs** — what this phase produces for later phases or users
86
+
87
+ ### For each task, provide:
88
+
89
+ - **id** — unique, formatted as T-001, T-002, etc.
90
+ - **description** — clear statement of what to do
91
+ - **status** — `"planned"`
92
+ - **phase** — phase number this belongs to
93
+ - **files** — array of file paths this task creates or modifies
94
+ - **acceptance_criteria** — array of specific, verifiable statements
95
+ - **depends_on** — array of task IDs this depends on (empty if none)
96
+ - **notes** — optional: any implementation guidance or caveats
97
+
98
+ ### Task sizing
99
+
100
+ - Each task should be completable by one agent in one context window
101
+ - A task touching more than 3-5 files likely needs splitting
102
+ - A task with more than 5 acceptance criteria may be doing too much
103
+ - Group related changes: schema + implementation + test = one task when files are few
104
+
105
+ ### Traceability
106
+
107
+ - Every "must" requirement should be addressed by at least one task
108
+ - Every task's files should map to at least one architecture module
109
+ - Note requirement IDs in task descriptions or notes where the mapping is clear
110
+
111
+ ### Output format
112
+
113
+ Produce a single JSON object with two arrays:
114
+
115
+ ```json
116
+ {
117
+ "phases": [
118
+ {
119
+ "number": 1,
120
+ "name": "string",
121
+ "intent": "string",
122
+ "goal": "string",
123
+ "status": "planned",
124
+ "success_criteria": [{ "criterion": "string", "verify_method": "command" }],
125
+ "dependencies": [],
126
+ "inputs": ["string"],
127
+ "outputs": ["string"]
128
+ }
129
+ ],
130
+ "tasks": [
131
+ {
132
+ "id": "T-001",
133
+ "description": "string",
134
+ "status": "planned",
135
+ "phase": 1,
136
+ "files": ["src/file.ts"],
137
+ "acceptance_criteria": ["string"],
138
+ "depends_on": [],
139
+ "notes": "optional string"
140
+ }
141
+ ]
142
+ }
143
+ ```
@@ -0,0 +1,67 @@
1
+ ## Vision Statement
2
+
3
+ {{ vision }}
4
+
5
+ {% if context %}
6
+ ## Additional Context
7
+
8
+ {{ context }}
9
+ {% endif %}
10
+
11
+ ## Instructions
12
+
13
+ Produce a structured project identity from the vision statement above. Extract, infer, or derive each field — do not leave gaps where the vision provides signal.
14
+
15
+ ### Fields to produce
16
+
17
+ 1. **name** — short, lowercase-hyphenated project identifier
18
+ 2. **description** — 1-3 sentences capturing what the project does and why it matters
19
+ 3. **core_value** — one sentence a stakeholder outside the project could understand
20
+ 4. **target_users** — array of user roles or personas who benefit
21
+ 5. **constraints** — array of `{ type, description }` objects reflecting real limitations from the vision
22
+ - type examples: "technical", "organizational", "timeline", "budget", "regulatory", "compatibility"
23
+ 6. **scope_boundaries** — `{ in: [...], out: [...] }` capturing what is and is not in scope
24
+ - `out` is especially important: document what a reader might assume is in scope but is not
25
+ 7. **goals** — array of `{ id, description, success_criteria: [...] }` objects
26
+ - IDs: G-001, G-002, etc.
27
+ - success_criteria: measurable or verifiable statements (not aspirational)
28
+ 8. **status** — set to `"inception"`
29
+
30
+ {% if stack %}
31
+ ### Stack
32
+
33
+ The following technology stack has been specified:
34
+
35
+ {% for item in stack %}
36
+ - {{ item }}
37
+ {% endfor %}
38
+
39
+ Include these in the output `stack` array.
40
+ {% endif %}
41
+
42
+ {% if repository %}
43
+ ### Repository
44
+
45
+ Repository: {{ repository }}
46
+
47
+ Include this in the output `repository` field.
48
+ {% endif %}
49
+
50
+ ### Output format
51
+
52
+ Produce a single JSON object. Every required field must be present. The object should conform to the project block schema:
53
+
54
+ ```json
55
+ {
56
+ "name": "string (required)",
57
+ "description": "string (required)",
58
+ "core_value": "string (required)",
59
+ "target_users": ["string"],
60
+ "constraints": [{ "type": "string", "description": "string" }],
61
+ "scope_boundaries": { "in": ["string"], "out": ["string"] },
62
+ "goals": [{ "id": "G-001", "description": "string", "success_criteria": ["string"] }],
63
+ "status": "inception",
64
+ "repository": "string (if provided)",
65
+ "stack": ["string (if provided)"]
66
+ }
67
+ ```