@davidorex/pi-jit-agents 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.
- package/CHANGELOG.md +49 -0
- package/README.md +2 -2
- package/dist/agent-spec.d.ts.map +1 -1
- package/dist/agent-spec.js +69 -5
- package/dist/agent-spec.js.map +1 -1
- package/dist/budget-enforcer.d.ts +43 -0
- package/dist/budget-enforcer.d.ts.map +1 -0
- package/dist/budget-enforcer.js +172 -0
- package/dist/budget-enforcer.js.map +1 -0
- package/dist/compile.d.ts +39 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +363 -24
- package/dist/compile.js.map +1 -1
- package/dist/dispatch-inline.d.ts +25 -0
- package/dist/dispatch-inline.d.ts.map +1 -0
- package/dist/dispatch-inline.js +41 -0
- package/dist/dispatch-inline.js.map +1 -0
- package/dist/field-path.d.ts +32 -0
- package/dist/field-path.d.ts.map +1 -0
- package/dist/field-path.js +48 -0
- package/dist/field-path.js.map +1 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/jit-runtime.d.ts +14 -3
- package/dist/jit-runtime.d.ts.map +1 -1
- package/dist/jit-runtime.js +41 -5
- package/dist/jit-runtime.js.map +1 -1
- package/dist/markers.d.ts +28 -0
- package/dist/markers.d.ts.map +1 -0
- package/dist/markers.js +36 -0
- package/dist/markers.js.map +1 -0
- package/dist/renderer-registry.d.ts +60 -0
- package/dist/renderer-registry.d.ts.map +1 -0
- package/dist/renderer-registry.js +141 -0
- package/dist/renderer-registry.js.map +1 -0
- package/dist/template.d.ts +15 -0
- package/dist/template.d.ts.map +1 -1
- package/dist/template.js +29 -3
- package/dist/template.js.map +1 -1
- package/dist/trace-redactor.d.ts +1 -1
- package/dist/trace-redactor.js +1 -1
- package/dist/trace-writer.js +2 -2
- package/dist/types.d.ts +86 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -4
- package/schemas/agent-trace.schema.json +30 -2
- package/templates/analyzers/base-analyzer.md +9 -0
- package/templates/analyzers/patterns-task.md +11 -0
- package/templates/analyzers/patterns.md +15 -0
- package/templates/analyzers/quality-task.md +11 -0
- package/templates/analyzers/quality.md +15 -0
- package/templates/analyzers/structure-task.md +17 -0
- package/templates/analyzers/structure.md +15 -0
- package/templates/architecture-designer/task.md +117 -0
- package/templates/architecture-inferrer/task.md +61 -0
- package/templates/audit-finding-verifier/task.md +59 -0
- package/templates/audit-fixer/task.md +67 -0
- package/templates/audit-results-router/task.md +37 -0
- package/templates/decomposer/task.md +56 -0
- package/templates/explorer/system.md +3 -0
- package/templates/explorer/task.md +9 -0
- package/templates/gap-identifier/task.md +103 -0
- package/templates/gap-resolution-assessor/task.md +48 -0
- package/templates/handoff-writer/task.md +101 -0
- package/templates/investigator/task.md +30 -0
- package/templates/items/architecture.md +33 -0
- package/templates/items/conformance.md +26 -0
- package/templates/items/conventions.md +19 -0
- package/templates/items/decisions.md +47 -0
- package/templates/items/domain.md +21 -0
- package/templates/items/features.md +63 -0
- package/templates/items/framework-gaps.md +43 -0
- package/templates/items/issues.md +21 -0
- package/templates/items/layer-plans.md +50 -0
- package/templates/items/project.md +48 -0
- package/templates/items/requirements.md +20 -0
- package/templates/items/research.md +57 -0
- package/templates/items/spec-reviews.md +51 -0
- package/templates/items/tasks.md +29 -0
- package/templates/phase-author/task.md +82 -0
- package/templates/plan-creator/task.md +143 -0
- package/templates/plan-decomposer/task.md +46 -0
- package/templates/project-definer/task.md +67 -0
- package/templates/project-inferrer/task.md +56 -0
- package/templates/requirements-gatherer/task.md +90 -0
- package/templates/researcher/task.md +26 -0
- package/templates/shared/macros.md +169 -0
- package/templates/shared/render-helpers.md +106 -0
- package/templates/spec-implementer/task.md +53 -0
- package/templates/synthesizer/system.md +3 -0
- package/templates/synthesizer/task.md +38 -0
- package/templates/task-verifier/task.md +44 -0
- package/templates/task-worker/task.md +52 -0
- package/templates/verifier/task.md +57 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Verify whether the following audit findings have been resolved.
|
|
2
|
+
|
|
3
|
+
## Audit Findings
|
|
4
|
+
|
|
5
|
+
{% for finding in audit.findings %}
|
|
6
|
+
### Finding: {{ finding.id }}
|
|
7
|
+
|
|
8
|
+
**Description**: {{ finding.description }}
|
|
9
|
+
**Severity**: {{ finding.severity | default("unspecified") }}
|
|
10
|
+
**Category**: {{ finding.category | default("unspecified") }}
|
|
11
|
+
**Principle**: {{ finding.principle | default("unspecified") }}
|
|
12
|
+
|
|
13
|
+
**Locations**:
|
|
14
|
+
{% for loc in finding.locations %}
|
|
15
|
+
- `{{ loc.file }}` {% if loc.line %}line {{ loc.line }}{% endif %} {% if loc.description %} — {{ loc.description }}{% endif %}
|
|
16
|
+
{% endfor %}
|
|
17
|
+
|
|
18
|
+
{% if finding.fix %}
|
|
19
|
+
**Fix suggestion**: {{ finding.fix.suggestion | default("none") }}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
{% if finding.resolution and finding.resolution.status == 'passed' %}
|
|
23
|
+
*Previously marked as resolved — re-verify.*
|
|
24
|
+
{% endif %}
|
|
25
|
+
---
|
|
26
|
+
{% endfor %}
|
|
27
|
+
|
|
28
|
+
## Implementation Results
|
|
29
|
+
|
|
30
|
+
{% if implementation_results is iterable and implementation_results is not string %}
|
|
31
|
+
{% for result in implementation_results %}
|
|
32
|
+
- {{ result.spec_name | default(result.name | default("task")) }}: {{ result.status | default("unknown") }}
|
|
33
|
+
{% endfor %}
|
|
34
|
+
{% else %}
|
|
35
|
+
```json
|
|
36
|
+
{{ implementation_results | dump(2) }}
|
|
37
|
+
```
|
|
38
|
+
{% endif %}
|
|
39
|
+
|
|
40
|
+
{% if conformance_reference %}
|
|
41
|
+
## Conformance Reference
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{{ conformance_reference | dump(2) }}
|
|
45
|
+
```
|
|
46
|
+
{% endif %}
|
|
47
|
+
|
|
48
|
+
## Instructions
|
|
49
|
+
|
|
50
|
+
For EACH finding above:
|
|
51
|
+
|
|
52
|
+
1. Read the code at the referenced location(s)
|
|
53
|
+
2. Determine if the finding's described issue is addressed
|
|
54
|
+
3. Record your verdict: `passed`, `failed`, or `needs_inspect`
|
|
55
|
+
4. Provide specific evidence (code snippet, file:line reference)
|
|
56
|
+
|
|
57
|
+
Do NOT use grep exit codes as evidence. Read the code and assess whether the issue described in the finding is genuinely resolved.
|
|
58
|
+
|
|
59
|
+
Produce JSON output with a `findings` array containing one entry per finding, plus summary statistics.
|
|
@@ -0,0 +1,67 @@
|
|
|
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.
|
|
@@ -0,0 +1,37 @@
|
|
|
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.
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
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.
|
|
@@ -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 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
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
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.
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{#-
|
|
2
|
+
Per-item macro for the `architecture` block (Plan 8 / per-item-macros wave 4).
|
|
3
|
+
|
|
4
|
+
Singleton kind: architecture holds one record per repository describing
|
|
5
|
+
modules, patterns, boundaries, and (optionally) compilation_pipeline /
|
|
6
|
+
execution_model / dispatch_design. The "per-item" rendering operates on
|
|
7
|
+
the whole block payload as a single record; the whole-block delegator in
|
|
8
|
+
shared/macros.md passes its data argument straight through.
|
|
9
|
+
|
|
10
|
+
No cross-block references — depth parameter accepted for shape-uniformity
|
|
11
|
+
with the renderer-registry call convention; no helpers from
|
|
12
|
+
shared/render-helpers.md are needed.
|
|
13
|
+
-#}
|
|
14
|
+
|
|
15
|
+
{% macro render_architecture_item(a, depth=0) %}
|
|
16
|
+
{% if a %}
|
|
17
|
+
## Architecture
|
|
18
|
+
{% if a.overview %}{{ a.overview }}
|
|
19
|
+
{% endif %}
|
|
20
|
+
{% if a.modules %}
|
|
21
|
+
### Modules
|
|
22
|
+
{% for m in a.modules %}- **{{ m.name }}** (`{{ m.file }}`{% if m.lines %}, {{ m.lines }} lines{% endif %}): {{ enforceBudget(m.responsibility, "architecture", "modules.items.responsibility") }}{% if m.dependencies %} — deps: {{ m.dependencies | join(", ") }}{% endif %}
|
|
23
|
+
{% endfor %}{% endif %}
|
|
24
|
+
{% if a.patterns %}
|
|
25
|
+
### Patterns
|
|
26
|
+
{% for p in a.patterns %}- **{{ p.name }}**: {{ enforceBudget(p.description, "architecture", "patterns.items.description") }}{% if p.used_in %} — used in: {{ p.used_in | join(", ") }}{% endif %}
|
|
27
|
+
{% endfor %}{% endif %}
|
|
28
|
+
{% if a.boundaries %}
|
|
29
|
+
### Boundaries
|
|
30
|
+
{% for b in a.boundaries %}- {{ b }}
|
|
31
|
+
{% endfor %}{% endif %}
|
|
32
|
+
{% endif %}
|
|
33
|
+
{% endmacro %}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{#-
|
|
2
|
+
Per-item macro for the `conformance-reference` block (Plan 8 / per-item-macros wave 4).
|
|
3
|
+
|
|
4
|
+
Block schema: .project/schemas/conformance-reference.schema.json. The
|
|
5
|
+
block holds a name, scope, and principles[]. Each principle has nested
|
|
6
|
+
rules[]. The "per-item" granularity here is one principle (with its
|
|
7
|
+
rules) — the natural unit for prompt injection per the substrate spec.
|
|
8
|
+
|
|
9
|
+
No cross-block references — references are to source material (sources[]
|
|
10
|
+
at the block level), not to other block items. Depth parameter accepted
|
|
11
|
+
for renderer-registry shape-uniformity.
|
|
12
|
+
|
|
13
|
+
Companion whole-block macro:
|
|
14
|
+
render_conformance(data) in shared/macros.md emits the block-level
|
|
15
|
+
name + scope header, then iterates principles through this macro.
|
|
16
|
+
-#}
|
|
17
|
+
|
|
18
|
+
{% macro render_conformance_principle(p, depth=0) %}
|
|
19
|
+
{% if p %}
|
|
20
|
+
### {{ p.id }}: {{ p.name }}
|
|
21
|
+
{% if p.description %}{{ enforceBudget(p.description, "conformance-reference", "principles.items.description") }}{% endif %}
|
|
22
|
+
{% for r in p.rules %}- **{{ r.id }}**: {{ enforceBudget(r.rule, "conformance-reference", "principles.items.rules.items.rule") }}{% if r.severity %} [{{ r.severity }}]{% endif %}{% if r.check_method %} — check: {{ r.check_method }}{% endif %}
|
|
23
|
+
{% if r.anti_patterns %} Anti-patterns: {{ r.anti_patterns | join("; ") }}
|
|
24
|
+
{% endif %}{% endfor %}
|
|
25
|
+
{% endif %}
|
|
26
|
+
{% endmacro %}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{#-
|
|
2
|
+
Per-item macro for the `conventions` block (Plan 8 / per-item-macros wave 4).
|
|
3
|
+
|
|
4
|
+
Block schema: .project/schemas/conventions.schema.json. Each item is one
|
|
5
|
+
rule object inside data.rules[] (id, description, enforcement, severity).
|
|
6
|
+
|
|
7
|
+
No cross-block references — conventions are leaf rules. Depth parameter
|
|
8
|
+
accepted for shape-uniformity; reserved for future schema additions.
|
|
9
|
+
|
|
10
|
+
Companion whole-block macro:
|
|
11
|
+
render_conventions(data) in shared/macros.md emits the test_conventions
|
|
12
|
+
and lint_command/lint_scope header fields once, then iterates rules
|
|
13
|
+
through this macro.
|
|
14
|
+
-#}
|
|
15
|
+
|
|
16
|
+
{% macro render_convention(rule, depth=0) %}
|
|
17
|
+
{% if rule %}- **{{ rule.id }}** [{{ rule.severity }}, {{ rule.enforcement }}]: {{ enforceBudget(rule.description, "conventions", "rules.items.description") }}
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% endmacro %}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{#-
|
|
2
|
+
Per-item macro for the `decisions` block.
|
|
3
|
+
|
|
4
|
+
Block schema: .project/schemas/decisions.schema.json (Plan 6 / per-item-macros wave 3).
|
|
5
|
+
|
|
6
|
+
Macro signature:
|
|
7
|
+
render_decision(dec, depth=0)
|
|
8
|
+
dec — single decision object matching .decisions[*] in the schema
|
|
9
|
+
depth — integer recursion budget for cross-block reference inlining
|
|
10
|
+
|
|
11
|
+
Cross-block reference recursion (supersedes, superseded_by, related_findings,
|
|
12
|
+
related_features, related_gaps) is delegated to shared/render-helpers.md —
|
|
13
|
+
see that file for the depth contract, ambient globals, and empty-array
|
|
14
|
+
convention shared across all per-item macros.
|
|
15
|
+
|
|
16
|
+
References array (`references[]`):
|
|
17
|
+
Labelled pointers (label + optional path/lines/commit). NOT recursable —
|
|
18
|
+
references point to code paths, research docs, commit SHAs, external specs,
|
|
19
|
+
none of which are project blocks. Rendered inline as one bullet per ref.
|
|
20
|
+
-#}
|
|
21
|
+
{% from "shared/render-helpers.md" import render_id_list_block, render_id_single_block, render_optional_scalar %}
|
|
22
|
+
|
|
23
|
+
{% macro render_decision(dec, depth=0) %}
|
|
24
|
+
ID: {{ dec.id }}
|
|
25
|
+
Title: {{ dec.title }}
|
|
26
|
+
Status: {{ dec.status }}
|
|
27
|
+
Created by: {{ dec.created_by }}
|
|
28
|
+
Created at: {{ dec.created_at }}
|
|
29
|
+
{{ render_optional_scalar("Enacted by", dec.enacted_by) }}{{ render_optional_scalar("Enacted at", dec.enacted_at) }}
|
|
30
|
+
Context:
|
|
31
|
+
{{ enforceBudget(dec.context, "decisions", "decisions.items.context") }}
|
|
32
|
+
|
|
33
|
+
Decision:
|
|
34
|
+
{{ enforceBudget(dec.decision, "decisions", "decisions.items.decision") }}
|
|
35
|
+
|
|
36
|
+
Consequences:
|
|
37
|
+
{% if dec.consequences and dec.consequences | length > 0 %}{% for c in dec.consequences %} - {{ enforceBudget(c, "decisions", "decisions.items.consequences.items") }}
|
|
38
|
+
{% endfor %}{% else %} (none)
|
|
39
|
+
{% endif %}{% if dec.options_considered is defined %}Options considered:
|
|
40
|
+
{% if dec.options_considered | length > 0 %}{% for opt in dec.options_considered %} - {{ opt.label }}: {{ opt.description }}
|
|
41
|
+
{% if opt.tradeoffs %} Tradeoffs: {{ opt.tradeoffs }}
|
|
42
|
+
{% endif %}{% if opt.rejected_reason %} Rejected reason: {{ opt.rejected_reason }}
|
|
43
|
+
{% endif %}{% endfor %}{% else %} (none)
|
|
44
|
+
{% endif %}{% endif %}{{ render_id_list_block("Supersedes", dec.supersedes, depth) }}{{ render_id_single_block("Superseded by", dec.superseded_by, depth) }}{{ render_id_list_block("Related findings", dec.related_findings, depth) }}{{ render_id_list_block("Related features", dec.related_features, depth) }}{{ render_id_list_block("Related gaps", dec.related_gaps, depth) }}{% if dec.references is defined %}References:
|
|
45
|
+
{% if dec.references | length > 0 %}{% for ref in dec.references %} - {{ ref.label }}{% if ref.path %} — path: {{ ref.path }}{% if ref.lines %}:{{ ref.lines }}{% endif %}{% endif %}{% if ref.commit %} — commit: {{ ref.commit }}{% endif %}
|
|
46
|
+
{% endfor %}{% else %} (none)
|
|
47
|
+
{% endif %}{% endif %}{% endmacro %}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{#-
|
|
2
|
+
Per-item macro for the `domain` block (Plan 8 / per-item-macros wave 4).
|
|
3
|
+
|
|
4
|
+
Block schema: .project/schemas/domain.schema.json. Each item is one
|
|
5
|
+
knowledge entry inside data.entries[]. Required: id, title, content,
|
|
6
|
+
category. Optional: source, confidence, related_requirements (array of
|
|
7
|
+
REQ- IDs), tags.
|
|
8
|
+
|
|
9
|
+
Cross-block reference recursion (related_requirements) is delegated to
|
|
10
|
+
shared/render-helpers.md — see that file for the depth contract, ambient
|
|
11
|
+
globals, and empty-array convention.
|
|
12
|
+
-#}
|
|
13
|
+
{% from "shared/render-helpers.md" import render_id_list_inline %}
|
|
14
|
+
|
|
15
|
+
{% macro render_domain_entry(e, depth=0) %}
|
|
16
|
+
{% if e %}- **{{ e.id }}** [{{ e.category }}]: {{ e.title }}
|
|
17
|
+
{{ enforceBudget(e.content, "domain", "entries.items.content") }}{% if e.tags %} — tags: {{ e.tags | join(", ") }}{% endif %}
|
|
18
|
+
{% if e.source %} Source: {{ e.source }}
|
|
19
|
+
{% endif %}{% if e.confidence %} Confidence: {{ e.confidence }}
|
|
20
|
+
{% endif %}{{ render_id_list_inline("Related requirements", e.related_requirements, depth) }}{% endif %}
|
|
21
|
+
{% endmacro %}
|