@davidorex/pi-workflows 0.14.6 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/README.md +12 -9
  3. package/agents/handoff-writer.agent.yaml +1 -1
  4. package/agents/requirements-gatherer.agent.yaml +1 -1
  5. package/dist/agent-spec.d.ts.map +1 -1
  6. package/dist/agent-spec.js +4 -3
  7. package/dist/agent-spec.js.map +1 -1
  8. package/dist/auth-required.d.ts +10 -0
  9. package/dist/auth-required.d.ts.map +1 -0
  10. package/dist/auth-required.js +10 -0
  11. package/dist/auth-required.js.map +1 -0
  12. package/dist/bundled-dirs.d.ts +2 -0
  13. package/dist/bundled-dirs.d.ts.map +1 -0
  14. package/dist/bundled-dirs.js +26 -0
  15. package/dist/bundled-dirs.js.map +1 -0
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +146 -14
  19. package/dist/index.js.map +1 -1
  20. package/dist/render-by-id.d.ts +62 -0
  21. package/dist/render-by-id.d.ts.map +1 -0
  22. package/dist/render-by-id.js +105 -0
  23. package/dist/render-by-id.js.map +1 -0
  24. package/dist/step-agent.js +1 -1
  25. package/dist/step-block.d.ts +5 -1
  26. package/dist/step-block.d.ts.map +1 -1
  27. package/dist/step-block.js +88 -40
  28. package/dist/step-block.js.map +1 -1
  29. package/dist/step-monitor.d.ts +1 -1
  30. package/dist/step-monitor.d.ts.map +1 -1
  31. package/dist/step-monitor.js +1 -1
  32. package/dist/step-monitor.js.map +1 -1
  33. package/dist/step-shared.d.ts +1 -1
  34. package/dist/step-shared.d.ts.map +1 -1
  35. package/dist/step-shared.js +16 -10
  36. package/dist/step-shared.js.map +1 -1
  37. package/dist/template-validation.d.ts.map +1 -1
  38. package/dist/template-validation.js +6 -6
  39. package/dist/template-validation.js.map +1 -1
  40. package/dist/template.d.ts.map +1 -1
  41. package/dist/template.js +2 -1
  42. package/dist/template.js.map +1 -1
  43. package/dist/test-helpers.d.ts +91 -0
  44. package/dist/test-helpers.d.ts.map +1 -1
  45. package/dist/test-helpers.js +185 -1
  46. package/dist/test-helpers.js.map +1 -1
  47. package/dist/tui.d.ts +3 -3
  48. package/dist/tui.d.ts.map +1 -1
  49. package/dist/tui.js +1 -1
  50. package/dist/types.d.ts +36 -1
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/workflow-discovery.d.ts.map +1 -1
  53. package/dist/workflow-discovery.js +2 -1
  54. package/dist/workflow-discovery.js.map +1 -1
  55. package/dist/workflow-executor.d.ts.map +1 -1
  56. package/dist/workflow-executor.js +23 -9
  57. package/dist/workflow-executor.js.map +1 -1
  58. package/dist/workflow-sdk.d.ts.map +1 -1
  59. package/dist/workflow-sdk.js +18 -11
  60. package/dist/workflow-sdk.js.map +1 -1
  61. package/dist/workflow-spec.js +99 -2
  62. package/dist/workflow-spec.js.map +1 -1
  63. package/package.json +17 -7
  64. package/skill-narrative.md +5 -3
  65. package/skills/pi-workflows/SKILL.md +46 -9
  66. package/skills/pi-workflows/references/bundled-resources.md +0 -36
  67. package/workflows/analyze-existing-project.workflow.yaml +1 -1
  68. package/workflows/init-new-project.workflow.yaml +1 -1
  69. package/workflows/plan-from-requirements.workflow.yaml +2 -2
  70. package/templates/analyzers/base-analyzer.md +0 -9
  71. package/templates/analyzers/patterns-task.md +0 -11
  72. package/templates/analyzers/patterns.md +0 -15
  73. package/templates/analyzers/quality-task.md +0 -11
  74. package/templates/analyzers/quality.md +0 -15
  75. package/templates/analyzers/structure-task.md +0 -17
  76. package/templates/analyzers/structure.md +0 -15
  77. package/templates/architecture-designer/task.md +0 -117
  78. package/templates/architecture-inferrer/task.md +0 -61
  79. package/templates/audit-finding-verifier/task.md +0 -59
  80. package/templates/audit-fixer/task.md +0 -67
  81. package/templates/audit-results-router/task.md +0 -37
  82. package/templates/decomposer/task.md +0 -56
  83. package/templates/explorer/system.md +0 -3
  84. package/templates/explorer/task.md +0 -9
  85. package/templates/gap-identifier/task.md +0 -103
  86. package/templates/gap-resolution-assessor/task.md +0 -48
  87. package/templates/handoff-writer/task.md +0 -101
  88. package/templates/investigator/task.md +0 -30
  89. package/templates/phase-author/task.md +0 -82
  90. package/templates/plan-creator/task.md +0 -143
  91. package/templates/plan-decomposer/task.md +0 -46
  92. package/templates/project-definer/task.md +0 -67
  93. package/templates/project-inferrer/task.md +0 -56
  94. package/templates/requirements-gatherer/task.md +0 -90
  95. package/templates/researcher/task.md +0 -26
  96. package/templates/shared/macros.md +0 -152
  97. package/templates/spec-implementer/task.md +0 -53
  98. package/templates/synthesizer/system.md +0 -3
  99. package/templates/synthesizer/task.md +0 -38
  100. package/templates/task-verifier/task.md +0 -44
  101. package/templates/task-worker/task.md +0 -52
  102. package/templates/verifier/task.md +0 -57
@@ -1,67 +0,0 @@
1
- ## Audit Findings to Fix
2
-
3
- ### Principle: {{ task.principle }}
4
- ### Category: {{ task.category }}
5
- ### Severity: {{ task.severity }}
6
-
7
- ### Findings
8
-
9
- {% for finding in task.findings %}
10
- #### {{ finding.id }}: {{ finding.description }}
11
-
12
- {% for loc in finding.locations %}
13
- - `{{ loc.file }}` lines {{ loc.lines | join(', ') }}
14
- {% endfor %}
15
-
16
- {% if finding.fix %}
17
- **Fix**: {{ finding.fix.suggestion }}
18
- {% if finding.fix.verify_method == "grep" %}
19
- **Verify**: pattern `{{ finding.fix.verify_pattern }}` should NOT match after fix
20
- {% endif %}
21
- {% endif %}
22
-
23
- {% endfor %}
24
-
25
- ### Files to Modify
26
-
27
- {% for file in task.files %}
28
- - `{{ file }}`
29
- {% endfor %}
30
-
31
- ### Acceptance Criteria
32
-
33
- {% for criterion in task.acceptance_criteria %}
34
- - {{ criterion }}
35
- {% endfor %}
36
-
37
- {% if conformance_reference %}
38
- ### Conformance Reference
39
-
40
- {% for principle in conformance_reference.principles %}
41
- {% if principle.id == task.principle.split(':')[0] %}
42
- #### {{ principle.name }}
43
-
44
- {{ principle.description }}
45
-
46
- {% for rule in principle.rules %}
47
- - **{{ rule.id }}**: {{ rule.rule }}
48
- {% if rule.examples %}
49
- - Correct: `{{ rule.examples[0] }}`
50
- {% endif %}
51
- {% if rule.anti_patterns %}
52
- - Wrong: `{{ rule.anti_patterns[0] }}`
53
- {% endif %}
54
- {% endfor %}
55
- {% endif %}
56
- {% endfor %}
57
- {% endif %}
58
-
59
- ## Instructions
60
-
61
- 1. Read the files listed above to understand the current code
62
- 2. Fix each finding according to the fix suggestion
63
- 3. Ensure fixes follow the conformance reference principles
64
- 4. Run the test suite: `node --experimental-strip-types --test src/*.test.ts`
65
- 5. Fix any test failures caused by your changes
66
-
67
- Produce a JSON result conforming to the execution-results schema.
@@ -1,37 +0,0 @@
1
- Review the audit fix results and produce a routing manifest.
2
-
3
- ## Implementation Results
4
-
5
- {% if implementation_results is iterable and implementation_results is not string %}
6
- {% for result in implementation_results %}
7
- ### Task: {{ result.spec_name | default(result.name | default("unnamed")) }}
8
-
9
- - Status: {{ result.status | default("unknown") }}
10
- {% if result.decisions %}
11
- - Decisions: {{ result.decisions | length }}
12
- {% endif %}
13
- {% if result.issues %}
14
- - Issues flagged: {{ result.issues | length }}
15
- {% endif %}
16
- {% endfor %}
17
- {% else %}
18
- ```json
19
- {{ implementation_results | dump(2) }}
20
- ```
21
- {% endif %}
22
-
23
- ## Verification Results
24
-
25
- ```json
26
- {{ verification | dump(2) }}
27
- ```
28
-
29
- ## Instructions
30
-
31
- Produce a routing manifest with:
32
-
33
- 1. **decisions** — validated decisions from implementation results (with complete id, description, rationale fields)
34
- 2. **new_issues** — genuine issues that should be tracked (with stable id, description, status: "open", category, priority)
35
- 3. **summary** — accurate summary of what was completed, what failed, what needs inspection
36
-
37
- Only include items that are well-formed and represent genuine project artifacts. Do not route items that are missing required fields or describe hypothetical concerns.
@@ -1,56 +0,0 @@
1
- ## Decomposition Request
2
-
3
- **Gap:** {{ gap.id }} — {{ gap.description }}
4
-
5
- ## Investigation Findings
6
-
7
- **Complexity:** {{ investigation.complexity }}
8
- **Summary:** {{ investigation.summary }}
9
-
10
- ### Affected Files
11
- {% for f in investigation.affected_files %}
12
- - `{{ f.path }}` — {{ f.role }}: {{ f.current_behavior }}
13
- {% endfor %}
14
-
15
- ### Constraints
16
- {% for c in investigation.constraints %}
17
- - {{ c }}
18
- {% endfor %}
19
-
20
- ### Risks
21
- {% for r in investigation.risks %}
22
- - {{ r }}
23
- {% endfor %}
24
-
25
- {% if research %}
26
- ## Research Findings
27
-
28
- ### Patterns
29
- {% for p in research.patterns %}
30
- - **{{ p.name }}**: {{ p.description }} — {{ p.applicability }}
31
- {% endfor %}
32
-
33
- ### Recommendations
34
- {% for r in research.recommendations %}
35
- - {{ r }}
36
- {% endfor %}
37
- {% endif %}
38
-
39
- ## Instructions
40
-
41
- Decompose this gap into implementation specs. Each spec is a unit of work for a single implementing agent.
42
-
43
- 1. Break the work into the smallest meaningful units
44
- 2. Declare file targets for each spec
45
- 3. Set `depends_on` for specs that must be sequential (shared files, interface dependencies)
46
- 4. Mark `parallel_safe` for specs that can run concurrently
47
- 5. Write acceptance criteria that are verifiable (grep patterns, test commands, not "it works")
48
- 6. Estimate complexity per spec
49
-
50
- ## Required Output Schema
51
-
52
- You MUST produce JSON conforming exactly to this schema. Every required field must be present.
53
-
54
- ```json
55
- {{ output_schema }}
56
- ```
@@ -1,3 +0,0 @@
1
- You are a code explorer. Given a path, produce a comprehensive structural overview as JSON.
2
-
3
- Include files with their sizes, exports, imports, and line counts. Identify types, interfaces, and key functions. Map dependencies between files.
@@ -1,9 +0,0 @@
1
- Explore the code at `{{ path }}`.
2
-
3
- Produce a JSON object with:
4
- - `files`: array of { path, type, language, lines, exports, imports }
5
- - `types`: array of { name, file, line, kind, definition }
6
- - `dependencies`: array of { from, to, type }
7
- - `entryPoints`: array of file paths that serve as entry points
8
-
9
- Write your findings as valid JSON.
@@ -1,103 +0,0 @@
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 exploration.files is defined %}
33
- ### Files ({{ exploration.files | length }} total)
34
- {% for file in exploration.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 exploration.types is defined %}
40
- ### Types
41
- {% for t in exploration.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
- ```
@@ -1,48 +0,0 @@
1
- Assess whether the implementation resolves this gap.
2
-
3
- ## Gap
4
-
5
- **ID**: {{ gap.id }}
6
- **Description**: {{ gap.description }}
7
- **Category**: {{ gap.category | default("unspecified") }}
8
- **Priority**: {{ gap.priority | default("unspecified") }}
9
-
10
- ## Investigation Findings
11
-
12
- ```json
13
- {{ investigation | dump(2) }}
14
- ```
15
-
16
- ## Implementation Results
17
-
18
- {% if implementation_results is iterable and implementation_results is not string %}
19
- {% for result in implementation_results %}
20
- ### Spec: {{ result.spec_name | default("unnamed") }}
21
- - Status: {{ result.status | default("unknown") }}
22
- - Files changed: {{ result.files_changed | default([]) | join(", ") }}
23
- {% if result.commit_hash %}- Commit: {{ result.commit_hash }}{% endif %}
24
- {% endfor %}
25
- {% else %}
26
- ```json
27
- {{ implementation_results | dump(2) }}
28
- ```
29
- {% endif %}
30
-
31
- ## Check Results
32
-
33
- - Status: {{ check_results.status }}
34
- {% if check_results.errors | length > 0 %}
35
- - Errors:
36
- {% for err in check_results.errors %}
37
- - {{ err }}
38
- {% endfor %}
39
- {% endif %}
40
-
41
- ## Instructions
42
-
43
- 1. Read the gap description above. Understand what root cause it identifies.
44
- 2. Examine the implementation results — what files were changed and what was the stated work.
45
- 3. Run `git diff HEAD~{{ implementation_results | length | default(1) }}` (or appropriate range) to see actual code changes.
46
- 4. Judge: do the code changes address the root cause described in the gap?
47
- 5. If tests failed or lint errors exist, the gap is NOT resolved regardless of code quality.
48
- 6. Produce your assessment as JSON.
@@ -1,101 +0,0 @@
1
- Capture a handoff snapshot for the project at `{{ path }}`.
2
-
3
- ## Current Project State
4
-
5
- {% if project_state.blocks_status %}
6
- ### Block Availability
7
-
8
- | Block | Available |
9
- |-------|-----------|
10
- {% for name, available in project_state.blocks_status %}
11
- | {{ name }} | {{ "yes" if available else "NO — absent" }} |
12
- {% endfor %}
13
- {% endif %}
14
-
15
- {% if project_state.project %}
16
- ### Project
17
- **{{ project_state.project.name | default("unnamed") }}** — {{ project_state.project.description | default("no description") }}
18
- Status: {{ project_state.project.status | default("unknown") }}
19
- {% endif %}
20
-
21
- {% if project_state.phases and project_state.phases | length > 0 %}
22
- ### Phases
23
- {% for phase in project_state.phases %}
24
- - Phase {{ phase.number | default(loop.index) }}: {{ phase.name | default("unnamed") }} ({{ phase.status | default("unknown") }})
25
- {% endfor %}
26
- {% endif %}
27
-
28
- {% if project_state.blockSummaries %}
29
- ### Block Summaries
30
- {% for block in project_state.blockSummaries %}
31
- - **{{ block.name }}**: {{ block.count | default("?") }} entries
32
- {% endfor %}
33
- {% endif %}
34
-
35
- {% if project_state.gaps %}
36
- ### Open Gaps
37
- {% for gap in project_state.gaps %}
38
- {% if gap.status == "open" %}
39
- - [{{ gap.priority }}] {{ gap.id }}: {{ gap.description }}
40
- {% endif %}
41
- {% endfor %}
42
- {% endif %}
43
-
44
- {% if project_state.decisions %}
45
- ### Recent Decisions
46
- {% for decision in project_state.decisions %}
47
- - {{ decision.id | default("?") }}: {{ decision.description | default(decision.title | default("no description")) }}
48
- {% endfor %}
49
- {% endif %}
50
-
51
- {% if project_state.recentCommits %}
52
- ### Recent Commits
53
- {% for commit in project_state.recentCommits %}
54
- - `{{ commit.sha | default("?") | truncate(7, true, "") }}` {{ commit.message | default("no message") }}
55
- {% endfor %}
56
- {% endif %}
57
-
58
- ## Instructions
59
-
60
- Synthesize the project state above into a handoff block that enables a future agent or human to resume work seamlessly.
61
-
62
- 1. **context** — Write a paragraph capturing:
63
- - What was being worked on (current phase, recent commits, active changes)
64
- - The current state of thinking (what decisions were made, what approach is being taken)
65
- - Any momentum or direction that should be preserved
66
-
67
- 2. **timestamp** — Current datetime in ISO 8601 format (e.g., 2026-03-18T14:30:00Z)
68
-
69
- 3. **current_phase** — The phase currently being worked on (number or name)
70
-
71
- 4. **current_tasks** — Task IDs currently in progress (from project state if available, otherwise infer from recent activity)
72
-
73
- 5. **blockers** — Anything preventing progress:
74
- - Unresolved decisions that block implementation
75
- - Failing tests or broken builds
76
- - Missing dependencies or external requirements
77
- - Only include genuine blockers, not wishes
78
-
79
- 6. **next_actions** — Concrete next steps, ordered by priority:
80
- - What should the next session do first?
81
- - What's the next logical step in the current phase?
82
- - Keep to 3-5 actionable items
83
-
84
- 7. **open_questions** — Genuine unknowns requiring input:
85
- - Design decisions that need human judgment
86
- - Ambiguities discovered during development
87
- - Technical choices with trade-offs that haven't been resolved
88
-
89
- 8. **key_decisions_pending** — Decision IDs from the project state that need resolution
90
-
91
- 9. **files_in_flux** — Files with incomplete or in-progress changes (NOT every recently committed file — only files that have partial work)
92
-
93
- Read project blocks if needed to get more detail than the summary provides. Focus on in-flight state, not project overview.
94
-
95
- ## Required Output Schema
96
-
97
- You MUST produce JSON conforming exactly to this schema. Every required field must be present.
98
-
99
- ```json
100
- {{ output_schema }}
101
- ```
@@ -1,30 +0,0 @@
1
- ## Gap to Investigate
2
-
3
- **ID:** {{ gap.id }}
4
- **Description:** {{ gap.description }}
5
- **Category:** {{ gap.category }}
6
- **Priority:** {{ gap.priority }}
7
- {% if gap.details %}
8
- **Details:** {{ gap.details }}
9
- {% endif %}
10
-
11
- ## Instructions
12
-
13
- Produce structured findings for this gap. Scope your investigation to the minimum needed:
14
-
15
- 1. If the gap names specific files, read those. If not, use `find` or `ls` to identify candidates — don't read file contents unless you need to confirm behavior.
16
- 2. For each affected file: what it does, what needs to change.
17
- 3. List hard constraints (existing tests, interfaces, conventions that must not break).
18
- 4. Note risks only if non-obvious.
19
- 5. Set `needs_research` to true only if the solution requires knowledge you don't have. Most gaps don't.
20
- 6. Complexity: `low` = single concern, mechanical. `medium` = multiple files, design choices. `high` = architectural.
21
-
22
- Match your depth to the gap's category and priority. A `cleanup/low` gap needs a few lines of findings, not a codebase survey.
23
-
24
- ## Required Output Schema
25
-
26
- You MUST produce JSON conforming exactly to this schema. Every required field must be present.
27
-
28
- ```json
29
- {{ output_schema }}
30
- ```
@@ -1,82 +0,0 @@
1
- ## Intent
2
-
3
- {{ intent }}
4
-
5
- ## Existing Phases
6
-
7
- {% for phase in phases %}
8
- - Phase {{ phase.number }}: {{ phase.name }} ({{ phase.status }})
9
- {% endfor %}
10
-
11
- {% if architecture and architecture.modules %}
12
- ## Current Architecture
13
-
14
- {% for module in architecture.modules %}
15
- - **{{ module.name }}** ({{ module.file }}, {{ module.lines }} lines): {{ module.responsibility }}
16
- {% endfor %}
17
-
18
- {% if architecture.compilation_pipeline %}
19
- ### Compilation Pipeline
20
- {% for stage in architecture.compilation_pipeline %}
21
- {{ loop.index }}. **{{ stage.stage }}**: {{ stage.description }}
22
- {% endfor %}
23
- {% endif %}
24
- {% endif %}
25
-
26
- {% if conventions and conventions.rules %}
27
- ## Conventions
28
-
29
- {% for rule in conventions.rules %}
30
- - {{ rule.id }}: {{ rule.description }} ({{ rule.enforcement }})
31
- {% endfor %}
32
- {% endif %}
33
-
34
- {% if gaps and gaps.gaps %}
35
- ## Current Gaps
36
-
37
- {% for gap in gaps.gaps %}
38
- {% if gap.status == "open" %}
39
- - [{{ gap.priority }}] {{ gap.id }}: {{ gap.description }}
40
- {% endif %}
41
- {% endfor %}
42
- {% endif %}
43
-
44
- {% if inventory %}
45
- ## Current Inventory
46
-
47
- {% if inventory.step_types %}- Step types: {{ inventory.step_types | length }}
48
- {% endif %}{% if inventory.agent_specs %}- Agent specs: {{ inventory.agent_specs | length }}
49
- {% endif %}{% if inventory.schemas %}- Schemas: {{ inventory.schemas | length }}
50
- {% endif %}{% if inventory.test_count is defined %}- Tests: {{ inventory.test_count }}
51
- {% endif %}{% endif %}
52
-
53
- ## Instructions
54
-
55
- Convert the intent above into a structured phase spec. Read the codebase to understand what exists and what the intent requires.
56
-
57
- 1. **Determine the phase number** — next after the highest existing phase number
58
- 2. **Write a clear intent statement** — what this phase accomplishes and why
59
- 3. **Define success criteria** — each with a verify_method:
60
- - `command`: can be verified by running a shell command (test suite, grep, validate)
61
- - `inspect`: requires reading files and assessing content
62
- - `human`: requires human judgment
63
- 4. **Decompose into specs** — each spec is a focused unit of work:
64
- - Sequential numbering continuing from the last spec in the previous phase
65
- - Clear intent per spec
66
- - Concrete acceptance criteria (strings, each independently checkable)
67
- - Specs should be ordered by dependency — earlier specs don't depend on later ones
68
- 5. **Identify dependencies** — which phase numbers this phase depends on
69
- 6. **List artifacts produced** — file paths this phase will create or modify
70
-
71
- ### Sizing guidance
72
-
73
- - Each spec should be completable by one agent in one context window
74
- - If a spec needs more than ~5 files changed, split it
75
- - If a spec has more than ~5 acceptance criteria, it might be doing too much
76
- - Group related changes (e.g., schema + instance + validation test = one spec)
77
-
78
- ### Cross-reference gaps
79
-
80
- Check if any existing open gaps are addressed by this phase. If so, note that in the spec intent — the gap can be marked resolved when the spec completes.
81
-
82
- Produce a JSON object conforming to the phase schema.
@@ -1,143 +0,0 @@
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
- ```