prizmkit 1.0.79 → 1.0.84
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/bundled/VERSION.json +3 -3
- package/bundled/agents/prizm-dev-team-dev.md +12 -17
- package/bundled/agents/prizm-dev-team-reviewer.md +7 -11
- package/bundled/dev-pipeline/README.md +0 -1
- package/bundled/dev-pipeline/run.sh +23 -5
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +23 -13
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +11 -4
- package/bundled/dev-pipeline/scripts/utils.py +111 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +0 -22
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +56 -54
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +61 -62
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +3 -3
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +1 -1
- package/bundled/skills/prizmkit-implement/SKILL.md +5 -7
- package/bundled/skills/prizmkit-plan/SKILL.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +4 -3
- package/package.json +1 -1
- package/bundled/dev-pipeline/templates/agent-knowledge-template.md +0 -13
package/bundled/VERSION.json
CHANGED
|
@@ -18,10 +18,10 @@ You are the team's "construction worker" — you build strictly according to blu
|
|
|
18
18
|
|
|
19
19
|
### Project Context
|
|
20
20
|
|
|
21
|
-
Project documentation is in `.prizm-docs/`. Before implementation, read `context-snapshot.md` (if it exists in `.prizmkit/specs/###-feature-name/`); its Section 3 contains Prizm Context and Section 4 contains
|
|
22
|
-
1. Read `.
|
|
23
|
-
2. Read
|
|
24
|
-
3.
|
|
21
|
+
Project documentation is in `.prizm-docs/`. Before implementation, read `context-snapshot.md` (if it exists in `.prizmkit/specs/###-feature-name/`); its Section 3 contains Prizm Context and Section 4 contains a File Manifest with paths and key interfaces. Read source files on-demand as directed by the manifest. If the snapshot does not exist:
|
|
22
|
+
1. Read `.prizm-docs/root.prizm` to understand rules and known traps (TRAPS)
|
|
23
|
+
2. Read relevant L1/L2 docs for affected modules
|
|
24
|
+
3. Read required source files directly
|
|
25
25
|
|
|
26
26
|
### Artifact Paths
|
|
27
27
|
|
|
@@ -30,7 +30,6 @@ Project documentation is in `.prizm-docs/`. Before implementation, read `context
|
|
|
30
30
|
| `.prizm-docs/` | Architecture index — module structure, interfaces, dependencies, known traps (TRAPS) |
|
|
31
31
|
| `CLAUDE.md` / `CODEBUDDY.md` + `memory/MEMORY.md` | Project memory — development decisions (DECISIONS), interface conventions, project-level rules |
|
|
32
32
|
| `.prizmkit/specs/###-feature-name/` | Feature artifacts — spec.md / plan.md (with Tasks section) |
|
|
33
|
-
| `.prizmkit/specs/###-feature-name/agents/` | Agent knowledge docs — each agent's findings, decisions, interface records |
|
|
34
33
|
|
|
35
34
|
### Must Do (MUST)
|
|
36
35
|
|
|
@@ -44,8 +43,7 @@ Project documentation is in `.prizm-docs/`. Before implementation, read `context
|
|
|
44
43
|
8. Checkpoint tasks must verify that build and tests pass before proceeding to the next phase
|
|
45
44
|
9. Execute sequential tasks in order; stop on failure. Parallel `[P]` tasks may continue
|
|
46
45
|
10. When creating a new sub-module, generate the corresponding `.prizm-docs/` L2 document
|
|
47
|
-
11.
|
|
48
|
-
12. If no context-snapshot.md exists, scan required source files and write summaries to the CONTEXT_BUILT section of your own `agents/dev-{N}.md`
|
|
46
|
+
11. After completing ALL tasks, append '## Implementation Log' to context-snapshot.md: files changed/created, key decisions, notable discoveries
|
|
49
47
|
|
|
50
48
|
### Never Do (NEVER)
|
|
51
49
|
|
|
@@ -53,9 +51,7 @@ Project documentation is in `.prizm-docs/`. Before implementation, read `context
|
|
|
53
51
|
- Do not modify code in modules owned by other Dev Agents
|
|
54
52
|
- Do not perform integration testing (that is the Reviewer's responsibility)
|
|
55
53
|
- **Do not execute any git operations** (git commit / git add / git reset / git push are all prohibited — the Orchestrator handles commits via /prizmkit-committer)
|
|
56
|
-
- Do not modify any files in `.prizmkit/specs/` except `plan.md` (marking Tasks
|
|
57
|
-
- Do not create new documentation entries for bug fixes; bug fixes are completions of existing features and should update the original feature's documentation
|
|
58
|
-
- Do not modify other agents' knowledge docs (only write to your own `agents/dev-{N}.md`)
|
|
54
|
+
- Do not modify any files in `.prizmkit/specs/` except `plan.md` (marking Tasks [x]) and `context-snapshot.md` (appending Implementation Log)
|
|
59
55
|
- Do not use TaskCreate/TaskUpdate to create or modify Orchestrator-level tasks (Task tools are for internal progress tracking only, and task IDs are not shared across agent sub-sessions)
|
|
60
56
|
|
|
61
57
|
### Behavioral Rules
|
|
@@ -75,23 +71,22 @@ DEV-11: Checkpoint tasks must verify that build and tests pass
|
|
|
75
71
|
DEV-12: Generate L2 .prizm-docs/ documentation when creating new sub-modules
|
|
76
72
|
DEV-13: Executing any git command is prohibited (git add/commit/reset/push are all forbidden)
|
|
77
73
|
DEV-14: If `npm test` has pre-existing failures, do not ignore them — list them explicitly in COMPLETION_SIGNAL for Orchestrator decision
|
|
78
|
-
DEV-15:
|
|
79
|
-
DEV-16: Without context-snapshot: read
|
|
74
|
+
DEV-15: After ALL tasks, append '## Implementation Log' to context-snapshot.md (files changed, key decisions, discoveries)
|
|
75
|
+
DEV-16: Without context-snapshot: read .prizm-docs/ → read source files directly
|
|
80
76
|
```
|
|
81
77
|
|
|
82
78
|
### Workflow
|
|
83
79
|
|
|
84
80
|
1. Receive task assignment
|
|
85
|
-
2. Read `.prizmkit/specs/###-feature-name/context-snapshot.md` (if it exists) — Section 3 contains Prizm Context, Section 4 contains
|
|
86
|
-
a. Read `.
|
|
87
|
-
b. Read
|
|
88
|
-
c. Scan required source files and write summaries to the CONTEXT_BUILT section of your own `agents/dev-{N}.md`
|
|
81
|
+
2. Read `.prizmkit/specs/###-feature-name/context-snapshot.md` (if it exists) — Section 3 contains Prizm Context, Section 4 contains a File Manifest. If the snapshot does not exist:
|
|
82
|
+
a. Read `.prizm-docs/root.prizm` and relevant module documentation
|
|
83
|
+
b. Read required source files directly
|
|
89
84
|
3. Read `plan.md` (with Tasks section) and `spec.md` in `.prizmkit/specs/###-feature-name/`
|
|
90
85
|
4. For each assigned task, execute in plan.md Tasks order:
|
|
91
86
|
a. Get target file context and TRAPS from context-snapshot.md (if no snapshot, read the target file module's documentation)
|
|
92
87
|
b. TDD: write tests based on acceptance criteria → implement feature code → run tests to verify
|
|
93
88
|
c. Mark the task as `[x]` in the plan.md Tasks section
|
|
94
|
-
d.
|
|
89
|
+
d. After all tasks, append Implementation Log to context-snapshot.md
|
|
95
90
|
e. Send STATUS_UPDATE to the Orchestrator
|
|
96
91
|
5. For checkpoint tasks, verify that build and tests pass before continuing
|
|
97
92
|
6. On interface design ambiguity, send ESCALATION (do not assume)
|
|
@@ -16,9 +16,7 @@ You are the team's "quality inspector + proofreader" — you do not produce the
|
|
|
16
16
|
|
|
17
17
|
### Project Context
|
|
18
18
|
|
|
19
|
-
Project documentation is in `.prizm-docs/`. Before review, read `context-snapshot.md` (if it exists in `.prizmkit/specs/###-feature-name/`); its Section 3 contains Prizm Context (RULES, PATTERNS, TRAPS)
|
|
20
|
-
|
|
21
|
-
During review, you may read `.prizmkit/specs/###-feature-name/agents/dev-*.md` to understand Dev's implementation decisions and findings.
|
|
19
|
+
Project documentation is in `.prizm-docs/`. Before review, read `context-snapshot.md` (if it exists in `.prizmkit/specs/###-feature-name/`); its Section 3 contains Prizm Context (RULES, PATTERNS, TRAPS). Section 4 contains a File Manifest. The '## Implementation Log' section (if present) describes what Dev changed and key decisions. If the snapshot does not exist, read `root.prizm` to understand project rules.
|
|
22
20
|
|
|
23
21
|
### Artifact Paths
|
|
24
22
|
|
|
@@ -27,7 +25,6 @@ During review, you may read `.prizmkit/specs/###-feature-name/agents/dev-*.md` t
|
|
|
27
25
|
| `.prizm-docs/` | Architecture index — module structure, interfaces, dependencies, known traps (TRAPS) |
|
|
28
26
|
| `CLAUDE.md` / `CODEBUDDY.md` + `memory/MEMORY.md` | Project memory — development decisions (DECISIONS), interface conventions, project-level rules |
|
|
29
27
|
| `.prizmkit/specs/###-feature-name/` | Feature artifacts — spec.md / plan.md (with Tasks section) |
|
|
30
|
-
| `.prizmkit/specs/###-feature-name/agents/` | Agent knowledge docs — each agent's findings, decisions, interface records |
|
|
31
28
|
|
|
32
29
|
### Must Do (MUST)
|
|
33
30
|
|
|
@@ -40,8 +37,8 @@ During review, you may read `.prizmkit/specs/###-feature-name/agents/dev-*.md` t
|
|
|
40
37
|
7. Check that code conforms to `.prizm-docs/` RULES and PATTERNS
|
|
41
38
|
8. Review is a **read-only operation** (the review portions of Phase 4 and Phase 6 do not modify code files)
|
|
42
39
|
9. Integration test cases must cover all user stories defined in spec.md
|
|
43
|
-
10.
|
|
44
|
-
11. During review, read
|
|
40
|
+
10. After completing review, append '## Review Notes' to context-snapshot.md: issues found (severity), test results, final verdict
|
|
41
|
+
11. During review, read the '## Implementation Log' section of context-snapshot.md to understand Dev's changes and decisions
|
|
45
42
|
|
|
46
43
|
### Never Do (NEVER)
|
|
47
44
|
|
|
@@ -50,7 +47,6 @@ During review, you may read `.prizmkit/specs/###-feature-name/agents/dev-*.md` t
|
|
|
50
47
|
- Do not perform task scheduling (that is the Orchestrator's responsibility)
|
|
51
48
|
- **Do not execute any git operations** (git commit / git add / git reset / git push are all prohibited)
|
|
52
49
|
- Do not use TaskCreate/TaskUpdate to create or modify Orchestrator-level tasks (Task tools are for internal progress tracking only, and task IDs are not shared across agent sub-sessions)
|
|
53
|
-
- Do not modify other agents' knowledge docs (only write to your own `agents/reviewer.md`)
|
|
54
50
|
|
|
55
51
|
### Behavioral Rules
|
|
56
52
|
|
|
@@ -65,8 +61,8 @@ REV-07: Security findings are always HIGH or CRITICAL
|
|
|
65
61
|
REV-08: Integration tests must cover all user stories in spec.md
|
|
66
62
|
REV-09: Review code for conformance to .prizm-docs/ PATTERNS and RULES
|
|
67
63
|
REV-10: Do not use the timeout command (incompatible with macOS). Run tests directly with node --test or npm test without a timeout prefix
|
|
68
|
-
REV-11:
|
|
69
|
-
REV-12:
|
|
64
|
+
REV-11: After review, append '## Review Notes' to context-snapshot.md (issues, severity, test results, verdict)
|
|
65
|
+
REV-12: Read Implementation Log in context-snapshot.md to understand Dev's decisions; reference relevant decisions in the review report
|
|
70
66
|
```
|
|
71
67
|
|
|
72
68
|
### Phase 4 Workflow: Cross-Validation
|
|
@@ -86,7 +82,7 @@ REV-12: During review, read agents/dev-*.md to understand implementation decisio
|
|
|
86
82
|
**Precondition**: Dev has completed implementation; all tasks are marked `[x]`
|
|
87
83
|
|
|
88
84
|
1. Read `context-snapshot.md` (if it exists); its Section 3 contains RULES and PATTERNS. If the snapshot does not exist, read `.prizm-docs/root.prizm`
|
|
89
|
-
2. Read
|
|
85
|
+
2. Read '## Implementation Log' in context-snapshot.md to understand Dev's changes and decisions
|
|
90
86
|
3. Run `/prizmkit-code-review` (read-only)
|
|
91
87
|
- 6 review dimensions: spec compliance, plan adherence, code quality, security, consistency, test coverage
|
|
92
88
|
- Verdict: PASS | PASS WITH WARNINGS | NEEDS FIXES
|
|
@@ -96,7 +92,7 @@ REV-12: During review, read agents/dev-*.md to understand implementation decisio
|
|
|
96
92
|
- User story acceptance criteria (from spec.md)
|
|
97
93
|
- Boundary conditions and exception paths
|
|
98
94
|
4. Generate a unified review report
|
|
99
|
-
5. Append
|
|
95
|
+
5. Append '## Review Notes' to context-snapshot.md (issues found, severity, test results, verdict)
|
|
100
96
|
6. Send COMPLETION_SIGNAL (with verdict)
|
|
101
97
|
|
|
102
98
|
### Verdict Criteria
|
|
@@ -955,7 +955,6 @@ dev-pipeline/
|
|
|
955
955
|
| +-- bootstrap-tier3.md # Tier 3 prompt template (full team, full/self-evolve)
|
|
956
956
|
| +-- bootstrap-prompt.md # Legacy monolithic template (fallback)
|
|
957
957
|
| +-- bugfix-bootstrap-prompt.md # Bug-fix session prompt template
|
|
958
|
-
| +-- agent-knowledge-template.md # Template for agent knowledge docs
|
|
959
958
|
| +-- feature-list-schema.json # JSON schema for feature-list.json
|
|
960
959
|
| +-- bug-fix-list-schema.json # JSON schema for bug-fix-list.json
|
|
961
960
|
| +-- session-status-schema.json # JSON schema for session-status.json
|
|
@@ -525,14 +525,31 @@ run_one() {
|
|
|
525
525
|
exit 1
|
|
526
526
|
fi
|
|
527
527
|
|
|
528
|
-
if [[ ! -f "$STATE_DIR/pipeline.json" ]]; then
|
|
529
|
-
log_error "No pipeline state found. Run './run.sh run' first to initialize."
|
|
530
|
-
exit 1
|
|
531
|
-
fi
|
|
532
|
-
|
|
533
528
|
check_dependencies
|
|
534
529
|
run_log_cleanup
|
|
535
530
|
|
|
531
|
+
# Initialize pipeline state if needed (same logic as run_all)
|
|
532
|
+
if [[ ! -f "$STATE_DIR/pipeline.json" ]]; then
|
|
533
|
+
log_info "Initializing pipeline state for single-feature run..."
|
|
534
|
+
local init_result
|
|
535
|
+
init_result=$(python3 "$SCRIPTS_DIR/init-pipeline.py" \
|
|
536
|
+
--feature-list "$feature_list" \
|
|
537
|
+
--state-dir "$STATE_DIR" 2>&1)
|
|
538
|
+
|
|
539
|
+
local init_valid
|
|
540
|
+
init_valid=$(echo "$init_result" | python3 -c "import sys,json; print(json.load(sys.stdin).get('valid', False))" 2>/dev/null || echo "False")
|
|
541
|
+
|
|
542
|
+
if [[ "$init_valid" != "True" ]]; then
|
|
543
|
+
log_error "Pipeline initialization failed:"
|
|
544
|
+
echo "$init_result"
|
|
545
|
+
exit 1
|
|
546
|
+
fi
|
|
547
|
+
|
|
548
|
+
local features_count
|
|
549
|
+
features_count=$(echo "$init_result" | python3 -c "import sys,json; print(json.load(sys.stdin).get('features_count', 0))" 2>/dev/null || echo "0")
|
|
550
|
+
log_success "Pipeline initialized with $features_count features"
|
|
551
|
+
fi
|
|
552
|
+
|
|
536
553
|
# Auto-detect framework repo: if scripts/bundle.js exists, enable self-evolve mode
|
|
537
554
|
local project_root
|
|
538
555
|
project_root=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null || echo "")
|
|
@@ -703,6 +720,7 @@ sys.exit(1)
|
|
|
703
720
|
echo -e "${BOLD}════════════════════════════════════════════════════${NC}"
|
|
704
721
|
echo -e "${BOLD} Run: $feature_id — $feature_title${NC}"
|
|
705
722
|
echo -e "${BOLD}════════════════════════════════════════════════════${NC}"
|
|
723
|
+
log_info "AI CLI: $CLI_CMD (platform: $PLATFORM)"
|
|
706
724
|
log_info "Session ID: $session_id"
|
|
707
725
|
log_info "Resume Phase: $resume_phase"
|
|
708
726
|
local effective_model="${feature_model:-$MODEL}"
|
|
@@ -19,7 +19,7 @@ import os
|
|
|
19
19
|
import re
|
|
20
20
|
import sys
|
|
21
21
|
|
|
22
|
-
from utils import load_json_file, setup_logging
|
|
22
|
+
from utils import enrich_global_context, load_json_file, setup_logging
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
DEFAULT_MAX_RETRIES = 3
|
|
@@ -142,8 +142,15 @@ def format_acceptance_criteria(criteria):
|
|
|
142
142
|
return "\n".join(lines)
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
def format_global_context(global_context):
|
|
146
|
-
"""Format global_context dict as a key-value list.
|
|
145
|
+
def format_global_context(global_context, project_root=None):
|
|
146
|
+
"""Format global_context dict as a key-value list.
|
|
147
|
+
|
|
148
|
+
If global_context is empty/sparse and project_root is provided,
|
|
149
|
+
auto-detect tech stack from project files to fill gaps.
|
|
150
|
+
"""
|
|
151
|
+
if project_root:
|
|
152
|
+
enrich_global_context(global_context, project_root)
|
|
153
|
+
|
|
147
154
|
if not global_context:
|
|
148
155
|
return "- (none specified)"
|
|
149
156
|
lines = []
|
|
@@ -362,14 +369,23 @@ def determine_pipeline_mode(complexity):
|
|
|
362
369
|
"""Map estimated_complexity to pipeline mode.
|
|
363
370
|
|
|
364
371
|
Returns: 'lite', 'standard', or 'full'
|
|
372
|
+
|
|
373
|
+
Tier assignment rationale:
|
|
374
|
+
- low + medium → lite (single agent): most features don't benefit from
|
|
375
|
+
the orchestrator→dev→reviewer overhead. A single agent reading
|
|
376
|
+
.prizm-docs + implementing directly is faster and cheaper.
|
|
377
|
+
- high → standard (orchestrator + dev + reviewer): complex features
|
|
378
|
+
need the spec→plan→analyze→implement→review pipeline.
|
|
379
|
+
- critical → full (full team + framework guardrails): architectural
|
|
380
|
+
changes that touch many files and need extra safety checks.
|
|
365
381
|
"""
|
|
366
382
|
mapping = {
|
|
367
383
|
"low": "lite",
|
|
368
|
-
"medium": "
|
|
369
|
-
"high": "
|
|
384
|
+
"medium": "lite",
|
|
385
|
+
"high": "standard",
|
|
370
386
|
"critical": "full",
|
|
371
387
|
}
|
|
372
|
-
return mapping.get(complexity, "
|
|
388
|
+
return mapping.get(complexity, "lite")
|
|
373
389
|
|
|
374
390
|
|
|
375
391
|
def build_replacements(args, feature, features, global_context, script_dir):
|
|
@@ -447,12 +463,6 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
447
463
|
args.feature_id, feature.get("title", "")
|
|
448
464
|
)
|
|
449
465
|
|
|
450
|
-
# Ensure agents/ directory exists for agent knowledge docs
|
|
451
|
-
agents_dir = os.path.join(
|
|
452
|
-
project_root, ".prizmkit", "specs", feature_slug, "agents"
|
|
453
|
-
)
|
|
454
|
-
os.makedirs(agents_dir, exist_ok=True)
|
|
455
|
-
|
|
456
466
|
# Detect project state
|
|
457
467
|
init_done = detect_init_status(project_root)
|
|
458
468
|
artifacts = detect_existing_artifacts(project_root, feature_slug)
|
|
@@ -487,7 +497,7 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
487
497
|
"{{COMPLETED_DEPENDENCIES}}": get_completed_dependencies(
|
|
488
498
|
features, feature
|
|
489
499
|
),
|
|
490
|
-
"{{GLOBAL_CONTEXT}}": format_global_context(global_context),
|
|
500
|
+
"{{GLOBAL_CONTEXT}}": format_global_context(global_context, project_root),
|
|
491
501
|
"{{TEAM_CONFIG_PATH}}": team_config_path,
|
|
492
502
|
"{{DEV_SUBAGENT_PATH}}": dev_subagent,
|
|
493
503
|
"{{REVIEWER_SUBAGENT_PATH}}": reviewer_subagent,
|
|
@@ -19,7 +19,7 @@ import os
|
|
|
19
19
|
import re
|
|
20
20
|
import sys
|
|
21
21
|
|
|
22
|
-
from utils import load_json_file, setup_logging
|
|
22
|
+
from utils import enrich_global_context, load_json_file, setup_logging
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
DEFAULT_MAX_RETRIES = 3
|
|
@@ -76,8 +76,15 @@ def format_acceptance_criteria(criteria):
|
|
|
76
76
|
return "\n".join(lines)
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
def format_global_context(global_context):
|
|
80
|
-
"""Format global_context dict as a key-value list.
|
|
79
|
+
def format_global_context(global_context, project_root=None):
|
|
80
|
+
"""Format global_context dict as a key-value list.
|
|
81
|
+
|
|
82
|
+
If global_context is empty/sparse and project_root is provided,
|
|
83
|
+
auto-detect tech stack from project files to fill gaps.
|
|
84
|
+
"""
|
|
85
|
+
if project_root:
|
|
86
|
+
enrich_global_context(global_context, project_root)
|
|
87
|
+
|
|
81
88
|
if not global_context:
|
|
82
89
|
return "- (none specified)"
|
|
83
90
|
lines = []
|
|
@@ -249,7 +256,7 @@ def build_replacements(args, bug, global_context, script_dir):
|
|
|
249
256
|
),
|
|
250
257
|
"{{AFFECTED_FEATURE}}": bug.get("affected_feature", "N/A"),
|
|
251
258
|
"{{ENVIRONMENT}}": format_environment(bug.get("environment")),
|
|
252
|
-
"{{GLOBAL_CONTEXT}}": format_global_context(global_context),
|
|
259
|
+
"{{GLOBAL_CONTEXT}}": format_global_context(global_context, project_root),
|
|
253
260
|
"{{TEAM_CONFIG_PATH}}": team_config_path,
|
|
254
261
|
"{{DEV_SUBAGENT_PATH}}": dev_subagent,
|
|
255
262
|
"{{REVIEWER_SUBAGENT_PATH}}": reviewer_subagent,
|
|
@@ -105,3 +105,114 @@ def _build_progress_bar(percent, width=20):
|
|
|
105
105
|
empty = width - filled
|
|
106
106
|
bar = "\u2588" * filled + "\u2591" * empty
|
|
107
107
|
return "{} {:>3}%".format(bar, int(percent))
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def detect_project_context(project_root):
|
|
111
|
+
"""Auto-detect project tech stack from project files.
|
|
112
|
+
|
|
113
|
+
Reads package.json, pyproject.toml, and common config files
|
|
114
|
+
to infer language, test framework, and other stack details.
|
|
115
|
+
Returns a dict of detected key-value pairs.
|
|
116
|
+
"""
|
|
117
|
+
detected = {}
|
|
118
|
+
|
|
119
|
+
# 1. Node.js / JavaScript / TypeScript project
|
|
120
|
+
pkg_path = os.path.join(project_root, "package.json")
|
|
121
|
+
if os.path.isfile(pkg_path):
|
|
122
|
+
try:
|
|
123
|
+
with open(pkg_path, "r", encoding="utf-8") as f:
|
|
124
|
+
pkg = json.load(f)
|
|
125
|
+
|
|
126
|
+
# Language detection
|
|
127
|
+
deps = {}
|
|
128
|
+
deps.update(pkg.get("dependencies", {}))
|
|
129
|
+
deps.update(pkg.get("devDependencies", {}))
|
|
130
|
+
if "typescript" in deps or os.path.isfile(
|
|
131
|
+
os.path.join(project_root, "tsconfig.json")
|
|
132
|
+
):
|
|
133
|
+
detected["language"] = "TypeScript"
|
|
134
|
+
else:
|
|
135
|
+
detected["language"] = "JavaScript"
|
|
136
|
+
|
|
137
|
+
# Test framework detection (order: more specific first)
|
|
138
|
+
scripts = pkg.get("scripts", {})
|
|
139
|
+
test_script = (
|
|
140
|
+
scripts.get("test", "")
|
|
141
|
+
+ " "
|
|
142
|
+
+ scripts.get("test:unit", "")
|
|
143
|
+
)
|
|
144
|
+
if "vitest" in deps or "vitest" in test_script:
|
|
145
|
+
detected["testing_framework"] = "Vitest"
|
|
146
|
+
elif "jest" in deps or "jest" in test_script:
|
|
147
|
+
detected["testing_framework"] = "Jest"
|
|
148
|
+
elif "mocha" in deps or "mocha" in test_script:
|
|
149
|
+
detected["testing_framework"] = "Mocha"
|
|
150
|
+
elif "--test" in test_script or "node:test" in test_script:
|
|
151
|
+
detected["testing_framework"] = "Node.js built-in test runner"
|
|
152
|
+
|
|
153
|
+
# Framework detection
|
|
154
|
+
if "next" in deps:
|
|
155
|
+
detected["framework"] = "Next.js"
|
|
156
|
+
elif "express" in deps:
|
|
157
|
+
detected["framework"] = "Express.js"
|
|
158
|
+
elif "fastify" in deps:
|
|
159
|
+
detected["framework"] = "Fastify"
|
|
160
|
+
elif "react" in deps:
|
|
161
|
+
detected["framework"] = "React"
|
|
162
|
+
elif "vue" in deps:
|
|
163
|
+
detected["framework"] = "Vue.js"
|
|
164
|
+
except (json.JSONDecodeError, IOError):
|
|
165
|
+
pass
|
|
166
|
+
|
|
167
|
+
# 2. Python project detection
|
|
168
|
+
if not detected:
|
|
169
|
+
for marker in ["pyproject.toml", "setup.py", "requirements.txt"]:
|
|
170
|
+
if os.path.isfile(os.path.join(project_root, marker)):
|
|
171
|
+
detected["language"] = "Python"
|
|
172
|
+
# Check for pytest
|
|
173
|
+
toml_path = os.path.join(project_root, "pyproject.toml")
|
|
174
|
+
if os.path.isfile(toml_path):
|
|
175
|
+
try:
|
|
176
|
+
with open(toml_path, "r", encoding="utf-8") as f:
|
|
177
|
+
content = f.read()
|
|
178
|
+
if "pytest" in content:
|
|
179
|
+
detected["testing_framework"] = "pytest"
|
|
180
|
+
except IOError:
|
|
181
|
+
pass
|
|
182
|
+
break
|
|
183
|
+
|
|
184
|
+
return detected
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def enrich_global_context(global_context, project_root):
|
|
188
|
+
"""Fill gaps in global_context using auto-detected project info.
|
|
189
|
+
|
|
190
|
+
Only adds auto-detected values for keys not already present.
|
|
191
|
+
Mutates global_context in place and returns it.
|
|
192
|
+
"""
|
|
193
|
+
if not project_root:
|
|
194
|
+
return global_context
|
|
195
|
+
|
|
196
|
+
detected = detect_project_context(project_root)
|
|
197
|
+
# Map detected keys → global_context convention names
|
|
198
|
+
key_mapping = {
|
|
199
|
+
"language": "language",
|
|
200
|
+
"testing_framework": "testing_strategy",
|
|
201
|
+
"framework": "framework",
|
|
202
|
+
}
|
|
203
|
+
# Alternate key names that should block auto-detection
|
|
204
|
+
alt_keys = {
|
|
205
|
+
"testing_strategy": ["testing_framework", "test_framework"],
|
|
206
|
+
}
|
|
207
|
+
for det_key, ctx_key in key_mapping.items():
|
|
208
|
+
if det_key not in detected:
|
|
209
|
+
continue
|
|
210
|
+
if ctx_key in global_context:
|
|
211
|
+
continue
|
|
212
|
+
already_set = any(
|
|
213
|
+
k in global_context for k in alt_keys.get(ctx_key, [])
|
|
214
|
+
)
|
|
215
|
+
if not already_set:
|
|
216
|
+
global_context[ctx_key] = detected[det_key] + " (auto-detected)"
|
|
217
|
+
|
|
218
|
+
return global_context
|
|
@@ -56,28 +56,6 @@ You are running in headless mode with a FINITE context window. Exceeding it will
|
|
|
56
56
|
|
|
57
57
|
## Execution
|
|
58
58
|
|
|
59
|
-
### Phase 0.5: Agent Knowledge Setup
|
|
60
|
-
|
|
61
|
-
Create the agent knowledge directory and initialize your own knowledge doc:
|
|
62
|
-
```bash
|
|
63
|
-
mkdir -p .prizmkit/specs/{{FEATURE_SLUG}}/agents
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Write `.prizmkit/specs/{{FEATURE_SLUG}}/agents/orchestrator.md`:
|
|
67
|
-
```markdown
|
|
68
|
-
# Orchestrator
|
|
69
|
-
|
|
70
|
-
## FINDINGS
|
|
71
|
-
|
|
72
|
-
## DECISIONS
|
|
73
|
-
|
|
74
|
-
## INTERFACES_DISCOVERED
|
|
75
|
-
|
|
76
|
-
## CONTEXT_BUILT
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
After each phase, append notable DECISIONS/FINDINGS to your `agents/orchestrator.md`.
|
|
80
|
-
|
|
81
59
|
{{IF_INIT_NEEDED}}
|
|
82
60
|
### Phase 0: Project Bootstrap
|
|
83
61
|
- Run `/prizmkit-init` (invoke the prizmkit-init skill)
|
|
@@ -48,47 +48,25 @@ You are running in headless mode with a FINITE context window. Exceeding it will
|
|
|
48
48
|
## PrizmKit Directory Convention
|
|
49
49
|
|
|
50
50
|
```
|
|
51
|
-
.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ←
|
|
51
|
+
.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes Sections 1-4; Dev appends Implementation Log; Reviewer appends Review Notes
|
|
52
52
|
.prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
**`context-snapshot.md`** is the shared knowledge base.
|
|
55
|
+
**`context-snapshot.md`** is the shared knowledge base. Orchestrator writes Sections 1-4; Dev appends Implementation Log; Reviewer appends Review Notes. Append-only after initial creation.
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
59
59
|
## Subagent Timeout Recovery
|
|
60
60
|
|
|
61
|
-
If
|
|
61
|
+
If any agent times out:
|
|
62
62
|
1. `ls .prizmkit/specs/{{FEATURE_SLUG}}/` — check what exists
|
|
63
|
-
2.
|
|
64
|
-
3. Max 2 retries. After 2 failures,
|
|
63
|
+
2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and any Implementation Log/Review Notes from previous agents. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
|
|
64
|
+
3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
68
|
## Execution
|
|
69
69
|
|
|
70
|
-
### Phase 0.5: Agent Knowledge Setup
|
|
71
|
-
|
|
72
|
-
Create the agent knowledge directory and initialize your own knowledge doc:
|
|
73
|
-
```bash
|
|
74
|
-
mkdir -p .prizmkit/specs/{{FEATURE_SLUG}}/agents
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Write `.prizmkit/specs/{{FEATURE_SLUG}}/agents/orchestrator.md`:
|
|
78
|
-
```markdown
|
|
79
|
-
# Orchestrator
|
|
80
|
-
|
|
81
|
-
## FINDINGS
|
|
82
|
-
|
|
83
|
-
## DECISIONS
|
|
84
|
-
|
|
85
|
-
## INTERFACES_DISCOVERED
|
|
86
|
-
|
|
87
|
-
## CONTEXT_BUILT
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
After each phase, append notable DECISIONS/FINDINGS to your `agents/orchestrator.md`.
|
|
91
|
-
|
|
92
70
|
{{IF_INIT_NEEDED}}
|
|
93
71
|
### Phase 0: Project Bootstrap
|
|
94
72
|
- Run `/prizmkit-init` (invoke the prizmkit-init skill)
|
|
@@ -117,8 +95,19 @@ If MISSING — build it now:
|
|
|
117
95
|
- **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
|
|
118
96
|
- **Section 2 — Project Structure**: relevant `ls src/` output
|
|
119
97
|
- **Section 3 — Prizm Context**: full content of root.prizm and relevant L1/L2 docs
|
|
120
|
-
- **Section 4 —
|
|
121
|
-
|
|
98
|
+
- **Section 4 — File Manifest**: For each file relevant to this feature, list: file path, why it's needed (modify/reference/test), key interface signatures (function names + params + return types). Do NOT include full file content — agents read files on-demand. Format:
|
|
99
|
+
### Files to Modify
|
|
100
|
+
| File | Why Needed | Key Interfaces |
|
|
101
|
+
|------|-----------|----------------|
|
|
102
|
+
| `src/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
|
|
103
|
+
|
|
104
|
+
### Files for Reference
|
|
105
|
+
| File | Why Needed | Key Interfaces |
|
|
106
|
+
|------|-----------|----------------|
|
|
107
|
+
| `src/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
|
|
108
|
+
|
|
109
|
+
### Known TRAPS (from .prizm-docs/)
|
|
110
|
+
- <trap entries extracted from L1/L2 docs>
|
|
122
111
|
|
|
123
112
|
### Phase 2: Plan & Tasks (you, the orchestrator)
|
|
124
113
|
|
|
@@ -147,44 +136,55 @@ This ensures the pipeline sees a "partial" status even if the session crashes mi
|
|
|
147
136
|
Spawn Dev subagent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false).
|
|
148
137
|
|
|
149
138
|
Prompt:
|
|
150
|
-
> "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
|
|
151
|
-
>
|
|
139
|
+
> "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}) using TDD.
|
|
152
140
|
> **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST.
|
|
153
|
-
>
|
|
154
|
-
>
|
|
155
|
-
>
|
|
156
|
-
>
|
|
157
|
-
>
|
|
158
|
-
>
|
|
159
|
-
> -
|
|
160
|
-
> -
|
|
161
|
-
> -
|
|
162
|
-
> Do NOT
|
|
141
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — Section 3 has Prizm Context (TRAPS/RULES), Section 4 has File Manifest with paths and interfaces. Read source files on-demand as directed by the manifest.
|
|
142
|
+
> 2. Read `plan.md` (including Tasks section) from `.prizmkit/specs/{{FEATURE_SLUG}}/`.
|
|
143
|
+
> 3. Implement task-by-task. Mark each `[x]` in plan.md Tasks section **immediately** after completion (do NOT batch).
|
|
144
|
+
> 4. Use `TEST_CMD=<TEST_CMD>` to run tests — do NOT explore alternative test commands.
|
|
145
|
+
> 5. After ALL tasks done, append '## Implementation Log' to context-snapshot.md with:
|
|
146
|
+
> - Files changed/created (with paths)
|
|
147
|
+
> - Key implementation decisions and rationale
|
|
148
|
+
> - Deviations from plan.md (if any)
|
|
149
|
+
> - Notable discoveries (unexpected behavior, hidden dependencies, new TRAPS)
|
|
150
|
+
> 6. Do NOT execute any git commands (no git add/commit/reset/push).
|
|
151
|
+
> 7. If `<TEST_CMD>` shows failures, check against BASELINE_FAILURES=`<BASELINE_FAILURES>`. Failures present in the baseline are pre-existing — list them explicitly in your COMPLETION_SIGNAL.
|
|
152
|
+
> Do NOT exit until all tasks are [x] and the '## Implementation Log' section is written in context-snapshot.md."
|
|
163
153
|
|
|
164
154
|
Wait for Dev to return. All tasks must be `[x]`, tests pass.
|
|
165
155
|
|
|
156
|
+
**Gate Check — Implementation Log**:
|
|
157
|
+
After Dev agent returns, verify the Implementation Log was written:
|
|
158
|
+
```bash
|
|
159
|
+
grep -q "## Implementation Log" .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md && echo "GATE:PASS" || echo "GATE:MISSING"
|
|
160
|
+
```
|
|
161
|
+
If GATE:MISSING — send message to Dev (re-spawn if needed): "Write the '## Implementation Log' section to context-snapshot.md before I can proceed to review. Include: files changed/created, key decisions, deviations from plan, notable discoveries."
|
|
162
|
+
|
|
166
163
|
### Phase 4: Review — Reviewer Subagent
|
|
167
164
|
|
|
168
165
|
Spawn Reviewer subagent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
|
|
169
166
|
|
|
170
167
|
Prompt:
|
|
171
|
-
> "Read {{REVIEWER_SUBAGENT_PATH}}.
|
|
172
|
-
>
|
|
168
|
+
> "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
173
169
|
> **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST.
|
|
174
|
-
> This file contains ALL source code and context. Do NOT re-read individual source files.
|
|
175
170
|
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
|
|
176
|
-
> - Section
|
|
177
|
-
> - Section 4:
|
|
178
|
-
> - 'Implementation Log': what Dev changed
|
|
179
|
-
> 2.
|
|
180
|
-
> 3.
|
|
181
|
-
> 4.
|
|
182
|
-
> 5. Append a 'Review Notes' section to `context-snapshot.md`: issues found (severity), test results, final verdict.
|
|
183
|
-
> 6. **Agent Knowledge Doc**: Maintain `.prizmkit/specs/{{FEATURE_SLUG}}/agents/reviewer.md`. Write FINDINGS/DECISIONS after review (e.g., patterns discovered, quality issues, architectural observations).
|
|
184
|
-
> 7. If review uncovers durable pitfalls or conventions, add corresponding TRAPS/RULES notes to relevant `.prizm-docs/` files.
|
|
171
|
+
> - Section 3: Prizm Context (RULES, PATTERNS to check against)
|
|
172
|
+
> - Section 4: File Manifest (original file structure)
|
|
173
|
+
> - '## Implementation Log': what Dev changed, key decisions, discoveries
|
|
174
|
+
> 2. Run prizmkit-code-review: spec compliance (against spec.md), code quality, correctness. Read ONLY files listed in Implementation Log.
|
|
175
|
+
> 3. Write and execute integration tests covering all user stories from spec.md. Use `TEST_CMD=<TEST_CMD>` — do NOT try alternative test commands.
|
|
176
|
+
> 4. Append '## Review Notes' to context-snapshot.md: issues found (with severity), test results, final verdict.
|
|
185
177
|
> Report verdict: PASS, PASS_WITH_WARNINGS, or NEEDS_FIXES."
|
|
186
178
|
|
|
187
179
|
Wait for Reviewer to return.
|
|
180
|
+
|
|
181
|
+
**Gate Check — Review Notes**:
|
|
182
|
+
After Reviewer agent returns, verify the Review Notes were written:
|
|
183
|
+
```bash
|
|
184
|
+
grep -q "## Review Notes" .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md && echo "GATE:PASS" || echo "GATE:MISSING"
|
|
185
|
+
```
|
|
186
|
+
If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write the '## Review Notes' section to context-snapshot.md. Include: issues found (severity), test results, final verdict."
|
|
187
|
+
|
|
188
188
|
- If NEEDS_FIXES: spawn Dev to fix (Dev reads updated snapshot), re-run Review (max 3 rounds)
|
|
189
189
|
|
|
190
190
|
**CP-2**: Tests pass, verdict is not NEEDS_FIXES.
|
|
@@ -271,9 +271,11 @@ Re-check `git status --short` and ensure it is empty before exiting.
|
|
|
271
271
|
|
|
272
272
|
- Tier 2: orchestrator builds context+plan, Dev implements, Reviewer reviews — use direct Agent spawn for agents
|
|
273
273
|
- Build context-snapshot.md FIRST; all subagents read it instead of re-reading source files
|
|
274
|
+
- context-snapshot.md is append-only: orchestrator writes Sections 1-4, Dev appends Implementation Log, Reviewer appends Review Notes
|
|
275
|
+
- Gate checks enforce Implementation Log and Review Notes are written before proceeding
|
|
274
276
|
- Do NOT use `run_in_background=true` when spawning subagents
|
|
275
277
|
- Session-status.json is written BEFORE commit (as partial), then updated to success AFTER commit — this prevents pipeline from treating a terminated session as crashed
|
|
276
278
|
- `/prizmkit-committer` is mandatory, and must not be replaced with manual git commit commands
|
|
277
279
|
- Before exiting, `git status --short` must be empty
|
|
278
280
|
- When staging leftover files in the final clean check, always use explicit file names — NEVER use `git add -A`
|
|
279
|
-
- On timeout: check snapshot → model:lite → remaining steps only → max 2 retries → orchestrator fallback
|
|
281
|
+
- On timeout: check snapshot + git diff HEAD → model:lite → remaining steps only → max 2 retries per phase → orchestrator fallback
|
|
@@ -82,16 +82,12 @@ You are running in headless mode with a FINITE context window. Exceeding it will
|
|
|
82
82
|
## PrizmKit Directory Convention
|
|
83
83
|
|
|
84
84
|
```
|
|
85
|
-
.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes
|
|
85
|
+
.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes Sections 1-4; Dev appends Implementation Log; Reviewer appends Review Notes
|
|
86
86
|
.prizmkit/specs/{{FEATURE_SLUG}}/spec.md
|
|
87
87
|
.prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
**`context-snapshot.md`** is the shared knowledge base. Orchestrator writes
|
|
91
|
-
|
|
92
|
-
### Agent Files
|
|
93
|
-
- Dev Agent: `{{DEV_SUBAGENT_PATH}}`
|
|
94
|
-
- Reviewer Agent: `{{REVIEWER_SUBAGENT_PATH}}`
|
|
90
|
+
**`context-snapshot.md`** is the shared knowledge base. Orchestrator writes Sections 1-4; Dev appends Implementation Log; Reviewer appends Review Notes. This eliminates redundant I/O across all agents.
|
|
95
91
|
|
|
96
92
|
---
|
|
97
93
|
|
|
@@ -99,36 +95,13 @@ You are running in headless mode with a FINITE context window. Exceeding it will
|
|
|
99
95
|
|
|
100
96
|
If any agent times out:
|
|
101
97
|
1. `ls .prizmkit/specs/{{FEATURE_SLUG}}/` — check what exists
|
|
102
|
-
2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for
|
|
98
|
+
2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and any Implementation Log/Review Notes from previous agents. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
|
|
103
99
|
3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
|
|
104
100
|
|
|
105
101
|
---
|
|
106
102
|
|
|
107
103
|
## Execution
|
|
108
104
|
|
|
109
|
-
### Phase 0.5: Agent Knowledge Setup
|
|
110
|
-
|
|
111
|
-
Create the agent knowledge directory and initialize your own knowledge doc:
|
|
112
|
-
```bash
|
|
113
|
-
mkdir -p .prizmkit/specs/{{FEATURE_SLUG}}/agents
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Write `.prizmkit/specs/{{FEATURE_SLUG}}/agents/orchestrator.md`:
|
|
117
|
-
```markdown
|
|
118
|
-
# Orchestrator
|
|
119
|
-
|
|
120
|
-
## FINDINGS
|
|
121
|
-
|
|
122
|
-
## DECISIONS
|
|
123
|
-
|
|
124
|
-
## INTERFACES_DISCOVERED
|
|
125
|
-
|
|
126
|
-
## CONTEXT_BUILT
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
After each phase, append notable DECISIONS/FINDINGS to your `agents/orchestrator.md`.
|
|
130
|
-
When spawning multiple Dev agents, each writes its own `agents/dev-{N}.md` (e.g., `dev-1.md`, `dev-2.md`).
|
|
131
|
-
|
|
132
105
|
{{IF_INIT_NEEDED}}
|
|
133
106
|
### Phase 0: Project Bootstrap
|
|
134
107
|
- Run `/prizmkit-init` (invoke the prizmkit-init skill)
|
|
@@ -200,11 +173,23 @@ If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing
|
|
|
200
173
|
- **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
|
|
201
174
|
- **Section 2 — Project Structure**: relevant `ls src/` output
|
|
202
175
|
- **Section 3 — Prizm Context**: full content of root.prizm and relevant L1/L2 docs
|
|
203
|
-
- **Section 4 —
|
|
176
|
+
- **Section 4 — File Manifest**: For each file relevant to this feature, list: file path, why it's needed (modify/reference/test), key interface signatures (function names + params + return types). Do NOT include full file content — agents read files on-demand. Format:
|
|
177
|
+
### Files to Modify
|
|
178
|
+
| File | Why Needed | Key Interfaces |
|
|
179
|
+
|------|-----------|----------------|
|
|
180
|
+
| `src/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
|
|
181
|
+
|
|
182
|
+
### Files for Reference
|
|
183
|
+
| File | Why Needed | Key Interfaces |
|
|
184
|
+
|------|-----------|----------------|
|
|
185
|
+
| `src/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
|
|
186
|
+
|
|
187
|
+
### Known TRAPS (from .prizm-docs/)
|
|
188
|
+
- <trap entries extracted from L1/L2 docs>
|
|
204
189
|
- **Section 5 — Existing Tests**: full content of related test files as code blocks
|
|
205
190
|
4. Confirm: `ls .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`
|
|
206
191
|
|
|
207
|
-
**After Step A
|
|
192
|
+
**After Step A**: Use context-snapshot.md Section 4 File Manifest to guide targeted file reads. Do NOT scan directories or read unrelated files.
|
|
208
193
|
|
|
209
194
|
**Step B — Planning Artifacts** (generate only missing files):
|
|
210
195
|
|
|
@@ -225,10 +210,9 @@ Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_i
|
|
|
225
210
|
|
|
226
211
|
Prompt:
|
|
227
212
|
> "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
228
|
-
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST —
|
|
213
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has project context, Section 4 has file manifest.
|
|
229
214
|
> 2. Run prizmkit-analyze: cross-check `spec.md` and `plan.md` (including Tasks section) for consistency.
|
|
230
|
-
> 3. Before flagging CRITICAL or HIGH issues,
|
|
231
|
-
> 4. **Agent Knowledge Doc**: Maintain `.prizmkit/specs/{{FEATURE_SLUG}}/agents/reviewer.md`. Write FINDINGS/DECISIONS after analysis (e.g., consistency issues found, ambiguities identified).
|
|
215
|
+
> 3. Before flagging CRITICAL or HIGH issues, read the relevant source files listed in the File Manifest to verify.
|
|
232
216
|
> Report: CRITICAL, HIGH, MEDIUM issues found (or 'No issues found')."
|
|
233
217
|
|
|
234
218
|
Wait for Reviewer to return.
|
|
@@ -273,28 +257,36 @@ Append the following to the Dev agent prompt:
|
|
|
273
257
|
Prompt:
|
|
274
258
|
> "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}) using TDD.
|
|
275
259
|
> **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST.
|
|
276
|
-
>
|
|
277
|
-
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — all source files and context are there.
|
|
260
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — Section 3 has Prizm Context (TRAPS/RULES), Section 4 has File Manifest with paths and interfaces. Read source files on-demand as directed by the manifest.
|
|
278
261
|
> 2. Read `plan.md` (including Tasks section) from `.prizmkit/specs/{{FEATURE_SLUG}}/`.
|
|
279
262
|
> 3. Implement task-by-task. Mark each `[x]` in plan.md Tasks section **immediately** after completion (do NOT batch).
|
|
280
263
|
> 4. Use `TEST_CMD=<TEST_CMD>` to run tests — do NOT explore alternative test commands.
|
|
281
|
-
> 5.
|
|
282
|
-
>
|
|
283
|
-
>
|
|
284
|
-
>
|
|
285
|
-
>
|
|
264
|
+
> 5. After ALL tasks done, append '## Implementation Log' to context-snapshot.md with:
|
|
265
|
+
> - Files changed/created (with paths)
|
|
266
|
+
> - Key implementation decisions and rationale
|
|
267
|
+
> - Deviations from plan.md (if any)
|
|
268
|
+
> - Notable discoveries (unexpected behavior, hidden dependencies, new TRAPS)
|
|
269
|
+
> 6. Do NOT execute any git commands (no git add/commit/reset/push).
|
|
270
|
+
> 7. If `<TEST_CMD>` shows failures, check against BASELINE_FAILURES=`<BASELINE_FAILURES>`. Failures present in the baseline are pre-existing — list them explicitly in your COMPLETION_SIGNAL.
|
|
271
|
+
> Do NOT exit until all tasks are [x] and the '## Implementation Log' section is written in context-snapshot.md."
|
|
272
|
+
|
|
273
|
+
**Gate Check — Implementation Log**:
|
|
274
|
+
After Dev agent returns, verify the Implementation Log was written:
|
|
275
|
+
```bash
|
|
276
|
+
grep -q "## Implementation Log" .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md && echo "GATE:PASS" || echo "GATE:MISSING"
|
|
277
|
+
```
|
|
278
|
+
If GATE:MISSING — send message to Dev (re-spawn if needed): "Write the '## Implementation Log' section to context-snapshot.md before I can proceed to review. Include: files changed/created, key decisions, deviations from plan, notable discoveries."
|
|
286
279
|
|
|
287
280
|
Wait for Dev to return. **If Dev times out before all tasks are `[x]`**:
|
|
288
281
|
1. Check progress: `grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md`
|
|
289
282
|
2. If any tasks remain: re-spawn Dev with this recovery prompt:
|
|
290
283
|
> "Read {{DEV_SUBAGENT_PATH}}. You are resuming implementation of feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
|
|
291
|
-
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — Section 4 has
|
|
292
|
-
> 2.
|
|
284
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — Section 4 has File Manifest, 'Implementation Log' (if present) shows what was already done.
|
|
285
|
+
> 2. Run `git diff HEAD` to see actual code changes already made.
|
|
293
286
|
> 3. Read plan.md Tasks section — complete ONLY the remaining `[ ]` tasks. Do NOT redo completed `[x]` tasks.
|
|
294
287
|
> 4. Use `TEST_CMD=<TEST_CMD>` to run tests.
|
|
295
|
-
> 5.
|
|
296
|
-
> 6.
|
|
297
|
-
> 7. Do NOT execute any git commands."
|
|
288
|
+
> 5. Append progress to '## Implementation Log' in context-snapshot.md.
|
|
289
|
+
> 6. Do NOT execute any git commands."
|
|
298
290
|
3. Max 2 recovery retries. After 2 failures, orchestrator implements remaining tasks directly.
|
|
299
291
|
|
|
300
292
|
All tasks `[x]`, tests pass.
|
|
@@ -318,25 +310,31 @@ Append the following to the Reviewer agent prompt:
|
|
|
318
310
|
Prompt:
|
|
319
311
|
> "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
320
312
|
> **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST.
|
|
321
|
-
>
|
|
322
|
-
>
|
|
323
|
-
>
|
|
324
|
-
>
|
|
325
|
-
>
|
|
326
|
-
>
|
|
327
|
-
>
|
|
313
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
|
|
314
|
+
> - Section 3: Prizm Context (RULES, PATTERNS to check against)
|
|
315
|
+
> - Section 4: File Manifest (original file structure)
|
|
316
|
+
> - '## Implementation Log': what Dev changed, key decisions, discoveries
|
|
317
|
+
> 2. Run prizmkit-code-review: spec compliance (against spec.md), code quality, correctness. Read ONLY files listed in Implementation Log.
|
|
318
|
+
> 3. Write and execute integration tests covering all user stories from spec.md. Use `TEST_CMD=<TEST_CMD>` — do NOT try alternative test commands.
|
|
319
|
+
> 4. Append '## Review Notes' to context-snapshot.md: issues found (with severity), test results, final verdict.
|
|
328
320
|
> Report verdict: PASS, PASS_WITH_WARNINGS, or NEEDS_FIXES."
|
|
329
321
|
|
|
330
322
|
Wait for Reviewer to return.
|
|
323
|
+
|
|
324
|
+
**Gate Check — Review Notes**:
|
|
325
|
+
After Reviewer agent returns, verify the Review Notes were written:
|
|
326
|
+
```bash
|
|
327
|
+
grep -q "## Review Notes" .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md && echo "GATE:PASS" || echo "GATE:MISSING"
|
|
328
|
+
```
|
|
329
|
+
If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write the '## Review Notes' section to context-snapshot.md. Include: issues found (severity), test results, final verdict."
|
|
330
|
+
|
|
331
331
|
- If NEEDS_FIXES: spawn Dev to fix with this prompt:
|
|
332
332
|
> "Read {{DEV_SUBAGENT_PATH}}. Fix NEEDS_FIXES issues for feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
|
|
333
|
-
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — 'Review Notes' section lists the exact issues to fix.
|
|
334
|
-
> 2.
|
|
335
|
-
> 3.
|
|
336
|
-
> 4.
|
|
337
|
-
> 5.
|
|
338
|
-
> 6. Update `.prizmkit/specs/{{FEATURE_SLUG}}/agents/dev-1.md` with any new FINDINGS/DECISIONS from the fix.
|
|
339
|
-
> 7. Do NOT execute any git commands."
|
|
333
|
+
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — '## Review Notes' section lists the exact issues to fix.
|
|
334
|
+
> 2. Fix ONLY the issues listed in 'Review Notes'. Do NOT refactor unrelated code.
|
|
335
|
+
> 3. Use `TEST_CMD=<TEST_CMD>` to verify fixes.
|
|
336
|
+
> 4. Append fix summary to '## Implementation Log' in context-snapshot.md.
|
|
337
|
+
> 5. Do NOT execute any git commands."
|
|
340
338
|
Then re-run Review (max 3 rounds).
|
|
341
339
|
|
|
342
340
|
**CP-3**: Integration tests pass, verdict is not NEEDS_FIXES.
|
|
@@ -465,7 +463,8 @@ Re-check `git status --short` and ensure it is empty before exiting.
|
|
|
465
463
|
## Reminders
|
|
466
464
|
|
|
467
465
|
- Tier 3: full team — Dev (implementation) → Reviewer (review) — spawn agents directly via Agent tool
|
|
468
|
-
- context-snapshot.md is
|
|
466
|
+
- context-snapshot.md is append-only: orchestrator writes Sections 1-4, Dev appends Implementation Log, Reviewer appends Review Notes
|
|
467
|
+
- Gate checks enforce Implementation Log and Review Notes are written before proceeding
|
|
469
468
|
- Do NOT use `run_in_background=true` when spawning agents
|
|
470
469
|
- ALWAYS write preliminary session-status.json BEFORE commit (as partial), then update to success AFTER commit — this prevents pipeline from treating a terminated session as crashed
|
|
471
470
|
- Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
|
|
@@ -126,16 +126,16 @@ class TestDeterminePipelineMode:
|
|
|
126
126
|
assert determine_pipeline_mode("low") == "lite"
|
|
127
127
|
|
|
128
128
|
def test_medium(self):
|
|
129
|
-
assert determine_pipeline_mode("medium") == "
|
|
129
|
+
assert determine_pipeline_mode("medium") == "lite"
|
|
130
130
|
|
|
131
131
|
def test_high(self):
|
|
132
|
-
assert determine_pipeline_mode("high") == "
|
|
132
|
+
assert determine_pipeline_mode("high") == "standard"
|
|
133
133
|
|
|
134
134
|
def test_critical(self):
|
|
135
135
|
assert determine_pipeline_mode("critical") == "full"
|
|
136
136
|
|
|
137
137
|
def test_unknown(self):
|
|
138
|
-
assert determine_pipeline_mode("banana") == "
|
|
138
|
+
assert determine_pipeline_mode("banana") == "lite"
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
# ---------------------------------------------------------------------------
|
|
@@ -27,7 +27,7 @@ Perform a comprehensive code review against the feature spec, implementation pla
|
|
|
27
27
|
- If none found → prompt user: "No review baseline found. Which workflow are you in? (feature/refactor/bugfix)"
|
|
28
28
|
2. Read **architecture index**: `.prizm-docs/root.prizm` RULES and PATTERNS for project conventions
|
|
29
29
|
3. Read **project memory**: platform memory file (`CLAUDE.md` for Claude Code, `CODEBUDDY.md` + `memory/MEMORY.md` for CodeBuddy) for past DECISIONS — helps verify implementation respects established conventions
|
|
30
|
-
4. Read
|
|
30
|
+
4. Read '## Implementation Log' section of context-snapshot.md in the feature directory (if exists) — understand Dev's implementation decisions, trade-offs, and notable discoveries. This context helps distinguish intentional design choices from accidental patterns during review.
|
|
31
31
|
5. Scan all code files referenced in completed tasks
|
|
32
32
|
4. Review across 6 dimensions:
|
|
33
33
|
- **Spec compliance**: Does code implement all acceptance criteria? Missing criteria are the #1 source of "it works but it's wrong" bugs
|
|
@@ -28,20 +28,18 @@ Execute implementation by following the task breakdown in plan.md. Respects task
|
|
|
28
28
|
- **Refactor mode**: read `refactor-analysis.md` in the same directory — pay special attention to Scope Boundary (do not implement changes outside scope) and Baseline Tests (all must still pass)
|
|
29
29
|
- **Bugfix mode**: read `fix-plan.md` in the same directory
|
|
30
30
|
2. Load project context — use the most efficient source available:
|
|
31
|
-
- If `context-snapshot.md` exists in the feature directory → read it. Section 3 has Prizm docs + TRAPS
|
|
31
|
+
- If `context-snapshot.md` exists in the feature directory → read it. Section 3 has Prizm docs + TRAPS. Section 4 has File Manifest (Tier-2/3) or full source (Tier-1). Read source files on-demand as directed by the manifest.
|
|
32
32
|
- Otherwise → **self-service context fallback**:
|
|
33
|
-
1. Read
|
|
34
|
-
2. Read **
|
|
35
|
-
3.
|
|
36
|
-
4. Scan needed source files
|
|
37
|
-
5. Write CONTEXT_BUILT entries to your own `agents/<role>.md` (e.g., `agents/dev-1.md`) so future agents don't need to re-scan
|
|
33
|
+
1. Read **architecture index**: `.prizm-docs/root.prizm` and relevant L1/L2 for affected modules. Pay special attention to TRAPS.
|
|
34
|
+
2. Read **project memory**: platform memory file for past DECISIONS and interface conventions.
|
|
35
|
+
3. Scan needed source files
|
|
38
36
|
3. Check if checkpoint tasks are complete before proceeding to next phase
|
|
39
37
|
4. For each unchecked task in order:
|
|
40
38
|
a. If task has `[P]` marker, it can run in parallel with other `[P]` tasks in the same group
|
|
41
39
|
b. Read L2 doc for target file's module (if exists) — TRAPS save you from repeating known mistakes
|
|
42
40
|
c. Apply TDD where applicable: write a failing test first, then implement until it passes. For UI components or configuration changes where unit tests don't apply, skip the test-first step.
|
|
43
41
|
d. Mark task as `[x]` in `plan.md` Tasks section immediately — not batched at the end. Immediate marking means the plan always reflects true progress, even if the session is interrupted.
|
|
44
|
-
e.
|
|
42
|
+
e. After all tasks, append '## Implementation Log' to `context-snapshot.md` (if running in pipeline context): files changed/created, key decisions, notable discoveries.
|
|
45
43
|
f. Error handling: sequential tasks stop on failure (later tasks may depend on this one). Parallel `[P]` tasks continue — report all failures at the end.
|
|
46
44
|
5. At each checkpoint: verify build passes and tests pass. Checkpoints catch integration errors early — skipping them means cascading failures in later phases that are much harder to debug.
|
|
47
45
|
6. After all tasks: run full test suite
|
|
@@ -32,7 +32,7 @@ Generate a comprehensive technical implementation plan from a feature specificat
|
|
|
32
32
|
- **Refactor mode**: Read `refactor-analysis.md` for refactoring goals, scope boundary, and baseline tests
|
|
33
33
|
- **Bugfix mode**: Read bug description / `fix-plan.md` for reproduction steps and expected fix
|
|
34
34
|
2. Load project context (use first available source):
|
|
35
|
-
- If `.prizmkit/specs/###-feature-name/context-snapshot.md` exists → read it for all context (Section 3 'Prizm Context' for docs, Section 4 '
|
|
35
|
+
- If `.prizmkit/specs/###-feature-name/context-snapshot.md` exists → read it for all context (Section 3 'Prizm Context' for docs, Section 4 'File Manifest' for code structure and interfaces). The context-snapshot consolidates project context into one read, saving significant tokens.
|
|
36
36
|
- Otherwise → read `.prizm-docs/root.prizm` and relevant `.prizm-docs/` L1/L2 docs for affected modules
|
|
37
37
|
3. Resolve any remaining `[NEEDS CLARIFICATION]` by proposing solutions
|
|
38
38
|
4. Research technical approach based on project's tech stack
|
|
@@ -99,7 +99,7 @@ Extract TRAPS and module-level RULES from development work and inject into `.pri
|
|
|
99
99
|
**2a.** Gather context — read the **actual code that was changed** plus any available artifacts:
|
|
100
100
|
|
|
101
101
|
- `git diff HEAD` — the real source of truth for what happened
|
|
102
|
-
- `.prizmkit/specs/###-feature-name/
|
|
102
|
+
- `.prizmkit/specs/###-feature-name/context-snapshot.md` — read the '## Implementation Log' section (Dev's changes, decisions, discoveries) and '## Review Notes' section (Reviewer's findings). These are the **preferred source** for pre-categorized decisions and findings. If these sections exist, prefer them over re-extracting from git diff.
|
|
103
103
|
- `.prizmkit/specs/###-feature-name/plan.md` — if feature work, read planned vs actual
|
|
104
104
|
- `.prizmkit/bugfix/<id>/fix-report.md` — if bugfix, read what was discovered
|
|
105
105
|
- The relevant `.prizm-docs/` L1/L2 docs for affected modules
|
|
@@ -151,7 +151,8 @@ Sediment DECISIONS and interface conventions to platform memory files. This is w
|
|
|
151
151
|
- `codebuddy` → targets: BOTH `CODEBUDDY.md` in project root AND `memory/MEMORY.md` (dual-write required)
|
|
152
152
|
|
|
153
153
|
**2b-2.** Collect sedimentation candidates:
|
|
154
|
-
- From
|
|
154
|
+
- From context-snapshot.md '## Implementation Log': DECISIONS and notable discoveries
|
|
155
|
+
- From context-snapshot.md '## Review Notes': quality patterns, architectural observations
|
|
155
156
|
- From git diff analysis: any project-level conventions established
|
|
156
157
|
- Filter: only entries that answer "Would a new session benefit from knowing this decision/convention?"
|
|
157
158
|
|
|
@@ -168,7 +169,7 @@ Sediment DECISIONS and interface conventions to platform memory files. This is w
|
|
|
168
169
|
|
|
169
170
|
**2b-5.** For CodeBuddy platform: write identical content to BOTH `CODEBUDDY.md` AND `memory/MEMORY.md` (dual-write, both must be updated).
|
|
170
171
|
|
|
171
|
-
**2b-6.** If no
|
|
172
|
+
**2b-6.** If no Implementation Log or Review Notes sections exist in context-snapshot.md, still attempt to extract DECISIONS from git diff and plan.md. Skip only if no meaningful decisions were made.
|
|
172
173
|
|
|
173
174
|
---
|
|
174
175
|
|
package/package.json
CHANGED