prizmkit 1.0.122 → 1.0.123

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.0.122",
3
- "bundledAt": "2026-03-27T16:12:14.647Z",
4
- "bundledFrom": "69c231a"
2
+ "frameworkVersion": "1.0.123",
3
+ "bundledAt": "2026-03-27T16:40:06.103Z",
4
+ "bundledFrom": "601c3b6"
5
5
  }
@@ -159,7 +159,7 @@ Manages `run.sh` as a background daemon process with PID tracking and log consol
159
159
  | `logs` | View pipeline logs. `--follow` for live tail, `--lines N` for last N lines |
160
160
  | `restart` | Stop + start |
161
161
 
162
- **`--mode` options:** `lite`, `standard`, `full`, `self-evolve`
162
+ **`--mode` options:** `lite`, `standard`, `full`
163
163
 
164
164
  **`--env` format:** Pass environment variables as a quoted string:
165
165
 
@@ -308,7 +308,7 @@ python3 scripts/generate-bootstrap-prompt.py \
308
308
  --output <path> \
309
309
  [--state-dir <path>] \
310
310
  [--template <path>] \
311
- [--mode lite|standard|full|self-evolve]
311
+ [--mode lite|standard|full]
312
312
  ```
313
313
 
314
314
  **Template auto-selection by complexity:**
@@ -318,7 +318,6 @@ python3 scripts/generate-bootstrap-prompt.py \
318
318
  | `low` | lite | `bootstrap-tier1.md` (single agent) |
319
319
  | `medium` | standard | `bootstrap-tier2.md` (dual agent) |
320
320
  | `high` / `critical` | full | `bootstrap-tier3.md` (full team) |
321
- | (override) | self-evolve | `bootstrap-tier3.md` + framework guardrails |
322
321
 
323
322
  **Output (JSON to stdout):**
324
323
 
@@ -331,7 +330,7 @@ The `model` field is extracted from the feature's `"model"` field in feature-lis
331
330
  **Conditional blocks resolved:**
332
331
  - `{{IF_RESUME}}` / `{{IF_FRESH_START}}` — Resume vs fresh start
333
332
  - `{{IF_INIT_NEEDED}}` / `{{IF_INIT_DONE}}` — PrizmKit init status
334
- - `{{IF_MODE_LITE}}` / `{{IF_MODE_STANDARD}}` / `{{IF_MODE_FULL}}` / `{{IF_MODE_SELF_EVOLVE}}` — Pipeline mode blocks
333
+ - `{{IF_MODE_LITE}}` / `{{IF_MODE_STANDARD}}` / `{{IF_MODE_FULL}}` — Pipeline mode blocks
335
334
 
336
335
  ---
337
336
 
@@ -570,7 +569,7 @@ Also exports: `log_info`, `log_warn`, `log_error`, `log_success` (with timestamp
570
569
  |----------|---------|---------|-------------|
571
570
  | `MAX_RETRIES` | `3` | run.sh | Max retry attempts per feature before marking as failed |
572
571
  | `SESSION_TIMEOUT` | `0` (none) | run.sh, retry-feature.sh, run-bugfix.sh, retry-bug.sh | Timeout in seconds per AI CLI session. 0 = no timeout |
573
- | `PIPELINE_MODE` | (auto) | run.sh, launch-daemon.sh | Override mode for all features: `lite\|standard\|full\|self-evolve` |
572
+ | `PIPELINE_MODE` | (auto) | run.sh, launch-daemon.sh | Override mode for all features: `lite\|standard\|full` |
574
573
  | `DEV_BRANCH` | auto-generated | run.sh | Custom git branch name (default: `dev/{feature-id}-{timestamp}`) |
575
574
  | `AUTO_PUSH` | `0` | run.sh | Set to `1` to auto-push branch to remote after successful session |
576
575
 
@@ -920,7 +919,7 @@ dev-pipeline/
920
919
  +-- templates/
921
920
  | +-- bootstrap-tier1.md # Tier 1 prompt template (single agent, lite)
922
921
  | +-- bootstrap-tier2.md # Tier 2 prompt template (dual agent, standard)
923
- | +-- bootstrap-tier3.md # Tier 3 prompt template (full team, full/self-evolve)
922
+ | +-- bootstrap-tier3.md # Tier 3 prompt template (full team, full)
924
923
  | +-- bootstrap-prompt.md # Legacy monolithic template (fallback)
925
924
  | +-- bugfix-bootstrap-prompt.md # Bug-fix session prompt template
926
925
  | +-- feature-list-schema.json # JSON schema for feature-list.json
@@ -29,8 +29,8 @@ dev-pipeline (outer loop)
29
29
 
30
30
  | Agent | Definition Path | Type |
31
31
  |-------|----------------|------|
32
- | Dev | `core/agents/prizm-dev-team-dev.md` | prizm-dev-team-dev |
33
- | Reviewer | `core/agents/prizm-dev-team-reviewer.md` | prizm-dev-team-reviewer |
32
+ | Dev | `.claude/agents/prizm-dev-team-dev.md` (or `.codebuddy/agents/`) | prizm-dev-team-dev |
33
+ | Reviewer | `.claude/agents/prizm-dev-team-reviewer.md` (or `.codebuddy/agents/`) | prizm-dev-team-reviewer |
34
34
 
35
35
  Note: The Orchestrator role is handled by the main agent (session orchestrator) directly — no separate agent definition needed.
36
36
 
@@ -110,15 +110,15 @@ cmd_start() {
110
110
  --mode)
111
111
  shift
112
112
  if [[ $# -eq 0 ]]; then
113
- log_error "--mode requires a value (lite|standard|full|self-evolve)"
113
+ log_error "--mode requires a value (lite|standard|full)"
114
114
  exit 1
115
115
  fi
116
116
  case "$1" in
117
- lite|standard|full|self-evolve)
117
+ lite|standard|full)
118
118
  mode_override="$1"
119
119
  ;;
120
120
  *)
121
- log_error "Invalid mode: $1 (must be lite, standard, full, or self-evolve)"
121
+ log_error "Invalid mode: $1 (must be lite, standard, or full)"
122
122
  exit 1
123
123
  ;;
124
124
  esac
@@ -578,7 +578,7 @@ Commands:
578
578
  help Show this help
579
579
 
580
580
  Options:
581
- --mode <lite|standard|full|self-evolve> Override pipeline mode for all features
581
+ --mode <lite|standard|full> Override pipeline mode for all features
582
582
  --features <filter> Run only specified features (e.g. F-001,F-003 or F-001:F-010)
583
583
  --env "KEY=VAL ..." Set environment variables
584
584
 
@@ -587,9 +587,9 @@ Examples:
587
587
  ./launch-daemon.sh start my-features.json # Start with custom feature list
588
588
  ./launch-daemon.sh start --features F-001:F-005 # Run only features F-001 through F-005
589
589
  ./launch-daemon.sh start --features F-001,F-003,F-007 # Run specific features
590
- ./launch-daemon.sh start --mode self-evolve # Self-evolve mode (framework development)
590
+ ./launch-daemon.sh start --mode full # Full mode for complex features
591
591
  ./launch-daemon.sh start --env "MAX_RETRIES=5 SESSION_TIMEOUT=7200"
592
- ./launch-daemon.sh start feature-list.json --mode self-evolve --env "VERBOSE=1"
592
+ ./launch-daemon.sh start feature-list.json --mode full --env "VERBOSE=1"
593
593
  ./launch-daemon.sh status # Check if running (JSON on stdout)
594
594
  ./launch-daemon.sh logs --follow # Live log tailing
595
595
  ./launch-daemon.sh logs --lines 100 # Last 100 lines
@@ -27,7 +27,7 @@ set -euo pipefail
27
27
  # LOG_CLEANUP_ENABLED Run periodic log cleanup (default: 1)
28
28
  # LOG_RETENTION_DAYS Delete logs older than N days (default: 14)
29
29
  # LOG_MAX_TOTAL_MB Keep total logs under N MB via oldest-first cleanup (default: 1024)
30
- # PIPELINE_MODE Override mode for all features: lite|standard|full|self-evolve (used by daemon)
30
+ # PIPELINE_MODE Override mode for all features: lite|standard|full (used by daemon)
31
31
  # DEV_BRANCH Custom dev branch name (default: auto-generated dev/{feature_id}-YYYYMMDDHHmm)
32
32
  # AUTO_PUSH Auto-push to remote after successful feature (default: 0). Set to 1 to enable.
33
33
  # ============================================================
@@ -419,11 +419,11 @@ run_one() {
419
419
  exit 1
420
420
  fi
421
421
  case "$1" in
422
- lite|standard|full|self-evolve)
422
+ lite|standard|full)
423
423
  mode_override="$1"
424
424
  ;;
425
425
  *)
426
- log_error "Invalid mode: $1 (must be lite, standard, full, or self-evolve)"
426
+ log_error "Invalid mode: $1 (must be lite, standard, or full)"
427
427
  exit 1
428
428
  ;;
429
429
  esac
@@ -513,14 +513,6 @@ run_one() {
513
513
  log_success "Pipeline initialized with $features_count features"
514
514
  fi
515
515
 
516
- # Auto-detect framework repo: if scripts/bundle.js exists, enable self-evolve mode
517
- local project_root
518
- project_root=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null || echo "")
519
- if [[ -z "$mode_override" && -n "$project_root" && -f "$project_root/scripts/bundle.js" ]]; then
520
- log_info "Detected PrizmKit framework repo — auto-enabling self-evolve mode"
521
- mode_override="self-evolve"
522
- fi
523
-
524
516
  # Verify feature exists
525
517
  local feature_title
526
518
  feature_title=$(python3 -c "
@@ -752,37 +744,6 @@ sys.exit(1)
752
744
 
753
745
  echo ""
754
746
  if [[ "$session_status" == "success" ]]; then
755
- # Self-evolve mode: run framework validation after successful session
756
- if [[ "$mode_override" == "self-evolve" ]]; then
757
- log_info "Self-evolve mode: running framework validation..."
758
- if bash "$SCRIPTS_DIR/validate-framework.sh" 2>&1; then
759
- log_success "Framework validation passed"
760
- else
761
- log_warn "Framework validation failed — review issues above"
762
- session_status="framework_validation_failed"
763
- fi
764
-
765
- # Check for reload_needed marker in session status
766
- local session_status_file="$session_dir/session-status.json"
767
- if [[ -f "$session_status_file" ]]; then
768
- local reload_needed
769
- reload_needed=$(python3 -c "
770
- import json, sys
771
- with open(sys.argv[1]) as f:
772
- data = json.load(f)
773
- print(data.get('reload_needed', False))
774
- " "$session_status_file" 2>/dev/null || echo "False")
775
- if [[ "$reload_needed" == "True" ]]; then
776
- echo ""
777
- log_warn "╔══════════════════════════════════════════════════════════════╗"
778
- log_warn "║ RELOAD NEEDED: This session modified pipeline skills or ║"
779
- log_warn "║ templates that are used by the dev-pipeline itself. ║"
780
- log_warn "║ Changes will take effect in the NEXT session. ║"
781
- log_warn "╚══════════════════════════════════════════════════════════════╝"
782
- fi
783
- fi
784
- fi
785
-
786
747
  log_success "════════════════════════════════════════════════════"
787
748
  log_success " $feature_id completed successfully!"
788
749
  log_success "════════════════════════════════════════════════════"
@@ -991,18 +952,6 @@ for f in data.get('stuck_features', []):
991
952
  main_prompt_args+=(--mode "$PIPELINE_MODE")
992
953
  fi
993
954
 
994
- # Auto-detect framework repo: if scripts/bundle.js exists, enable self-evolve mode
995
- if [[ -z "${PIPELINE_MODE:-}" ]]; then
996
- local _project_root
997
- _project_root=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null || echo "")
998
- if [[ -n "$_project_root" && -f "$_project_root/scripts/bundle.js" ]]; then
999
- if [[ $session_count -eq 0 ]]; then
1000
- log_info "Detected PrizmKit framework repo — auto-enabling self-evolve mode"
1001
- fi
1002
- main_prompt_args+=(--mode "self-evolve")
1003
- fi
1004
- fi
1005
-
1006
955
  local gen_output
1007
956
  gen_output=$(python3 "$SCRIPTS_DIR/generate-bootstrap-prompt.py" "${main_prompt_args[@]}" 2>/dev/null) || {
1008
957
  log_error "Failed to generate bootstrap prompt for $feature_id"
@@ -1102,7 +1051,7 @@ show_help() {
1102
1051
  echo "Single Feature Options (run <feature-id>):"
1103
1052
  echo " --dry-run Generate bootstrap prompt only, don't spawn session"
1104
1053
  echo " --resume-phase N Override resume phase (default: auto-detect)"
1105
- echo " --mode <lite|standard|full|self-evolve> Override pipeline mode (bypasses estimated_complexity)"
1054
+ echo " --mode <lite|standard|full> Override pipeline mode (bypasses estimated_complexity)"
1106
1055
  echo " --clean Delete artifacts and reset before running"
1107
1056
  echo " --no-reset Skip feature status reset step"
1108
1057
  echo " --timeout N Session timeout in seconds (default: 0 = no limit)"
@@ -1117,7 +1066,7 @@ show_help() {
1117
1066
  echo " LOG_CLEANUP_ENABLED Run log cleanup before execution (default: 1)"
1118
1067
  echo " LOG_RETENTION_DAYS Delete logs older than N days (default: 14)"
1119
1068
  echo " LOG_MAX_TOTAL_MB Keep total logs under N MB (default: 1024)"
1120
- echo " PIPELINE_MODE Override mode for all features: lite|standard|full|self-evolve"
1069
+ echo " PIPELINE_MODE Override mode for all features: lite|standard|full"
1121
1070
  echo ""
1122
1071
  echo "Examples:"
1123
1072
  echo " ./run.sh run # Run all features"
@@ -84,7 +84,7 @@ def parse_args():
84
84
  )
85
85
  parser.add_argument(
86
86
  "--mode",
87
- choices=["lite", "standard", "full", "self-evolve"],
87
+ choices=["lite", "standard", "full"],
88
88
  default=None,
89
89
  help="Override pipeline mode (default: auto-detect from complexity)",
90
90
  )
@@ -283,35 +283,15 @@ def process_mode_blocks(content, pipeline_mode, init_done):
283
283
  """Process pipeline mode and init conditional blocks.
284
284
 
285
285
  Keeps the block matching the current mode, removes the others.
286
- For self-evolve mode: keeps SELF_EVOLVE blocks AND FULL blocks
287
- (since self-evolve is full + framework guardrails).
288
286
  """
289
- is_self_evolve = pipeline_mode == "self-evolve"
290
-
291
- # Step 1: Handle SELF_EVOLVE conditional blocks first
292
- se_open = "{{IF_MODE_SELF_EVOLVE}}"
293
- se_close = "{{END_IF_MODE_SELF_EVOLVE}}"
294
- if is_self_evolve:
295
- # Keep content, remove tags
296
- content = content.replace(se_open + "\n", "")
297
- content = content.replace(se_open, "")
298
- content = content.replace(se_close + "\n", "")
299
- content = content.replace(se_close, "")
300
- else:
301
- # Remove entire SELF_EVOLVE blocks
302
- pattern = re.escape(se_open) + r".*?" + re.escape(se_close) + r"\n?"
303
- content = re.sub(pattern, "", content, flags=re.DOTALL)
304
-
305
- # Step 2: Handle lite/standard/full blocks
306
- # self-evolve inherits full mode for the standard tier blocks
307
- effective_mode = "full" if is_self_evolve else pipeline_mode
287
+ # Handle lite/standard/full blocks
308
288
  modes = ["lite", "standard", "full"]
309
289
 
310
290
  for mode in modes:
311
291
  tag_open = "{{{{IF_MODE_{}}}}}".format(mode.upper())
312
292
  tag_close = "{{{{END_IF_MODE_{}}}}}".format(mode.upper())
313
293
 
314
- if mode == effective_mode:
294
+ if mode == pipeline_mode:
315
295
  # Keep content, remove tags
316
296
  content = content.replace(tag_open + "\n", "")
317
297
  content = content.replace(tag_open, "")
@@ -472,8 +452,6 @@ def build_replacements(args, feature, features, global_context, script_dir):
472
452
  else:
473
453
  pipeline_mode = determine_pipeline_mode(complexity)
474
454
 
475
- is_self_evolve = pipeline_mode == "self-evolve"
476
-
477
455
  # Auto-detect resume: if all planning artifacts exist and resume_phase
478
456
  # is "null" (fresh start), skip to Phase 6
479
457
  effective_resume = args.resume_phase
@@ -512,7 +490,6 @@ def build_replacements(args, feature, features, global_context, script_dir):
512
490
  "{{HAS_SPEC}}": "true" if artifacts["has_spec"] else "false",
513
491
  "{{HAS_PLAN}}": "true" if artifacts["has_plan"] else "false",
514
492
  "{{ARTIFACTS_COMPLETE}}": "true" if artifacts["all_complete"] else "false",
515
- "{{IS_SELF_EVOLVE}}": "true" if is_self_evolve else "false",
516
493
  }
517
494
 
518
495
  return replacements, effective_resume
@@ -584,7 +561,6 @@ def main():
584
561
  "lite": "bootstrap-tier1.md",
585
562
  "standard": "bootstrap-tier2.md",
586
563
  "full": "bootstrap-tier3.md",
587
- "self-evolve": "bootstrap-tier3.md",
588
564
  }
589
565
  _tier_file = _tier_file_map.get(_mode, "bootstrap-tier2.md")
590
566
  _tier_path = os.path.join(script_dir, "..", "templates", _tier_file)
@@ -88,8 +88,13 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md 2>/dev/null && echo "EXI
88
88
 
89
89
  If MISSING — build it now:
90
90
  1. Read `.prizm-docs/root.prizm` and relevant L1 prizm docs
91
- 2. Scan `src/` for files related to this feature; read each one
92
- 3. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
91
+ 2. Detect source code directories: read KEY_FILES and STRUCTURE sections from `root.prizm` to identify where source code lives (e.g. `src/`, `app/`, `lib/`, `cmd/`, `packages/`, or project root). If `root.prizm` is missing, scan the project tree:
92
+ ```bash
93
+ find . -maxdepth 2 -type f \( -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.java" -o -name "*.rb" -o -name "*.rs" \) -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/vendor/*' | head -30
94
+ ```
95
+ Identify the top-level source directories from the results.
96
+ 3. Scan the detected source directories for files related to this feature; read each one
97
+ 4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
93
98
  - **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
94
99
  - **Section 2 — Project Structure**: run the following to get a visual directory tree, then paste output:
95
100
  ```bash
@@ -108,6 +113,12 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null
108
113
  If plan.md missing, write it directly:
109
114
  - `plan.md`: key components, data flow, files to create/modify, and a Tasks section with `[ ]` checkboxes (each task = one implementable unit). Keep under 80 lines.
110
115
 
116
+ **Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
117
+ Before proceeding past CP-1:
118
+ 1. Scan for existing schema files (`*.prisma`, `*.sql`, `migrations/`, `models/`, `*.entity.*`) and read them
119
+ 2. Ensure new tables/fields follow existing naming conventions and constraint patterns
120
+ 3. Resolve all uncertain DB design decisions before writing Tasks — document choices in plan.md
121
+
111
122
  **CP-1**: plan.md exists with Tasks section.
112
123
 
113
124
  ### Phase 3: Implement + Test
@@ -38,9 +38,9 @@ You are running in headless mode with a FINITE context window. Exceeding it will
38
38
  1. **context-snapshot.md is your single source of truth** — After Phase 1 builds it, ALWAYS read context-snapshot.md instead of re-reading individual source files
39
39
  2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
40
40
  3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
41
- 4. **One task at a time** — In Phase 3 (implement), complete and test one task before starting the next.
41
+ 4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
42
42
  5. **Minimize tool output** — When running commands, use `| head -20` or `| tail -20` to limit output. Never dump entire test suites or logs.
43
- 6. **No intermediate commits** — Do NOT run `git add`/`git commit` during Phase 1-4. All changes are committed once at the end in Phase 5 via `/prizmkit-committer`.
43
+ 6. **No intermediate commits** — Do NOT run `git add`/`git commit` during Phase 1-5. All changes are committed once at the end in Phase 6 via `/prizmkit-committer`.
44
44
  7. **Capture test output once** — When running the test suite, always use `$TEST_CMD 2>&1 | tee /tmp/test-out.txt | tail -20`. Then grep `/tmp/test-out.txt` for details. Never re-run the suite just to apply a different filter.
45
45
 
46
46
  ---
@@ -90,7 +90,7 @@ cat .prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md 2>/dev/null || echo "NO_PREV
90
90
  ```
91
91
  If failure-log.md exists:
92
92
  - Read ROOT_CAUSE and SUGGESTION — adjust your approach accordingly
93
- - Read DISCOVERED_TRAPS — if any are genuine, inject into .prizm-docs/ during Phase 5 retrospective
93
+ - Read DISCOVERED_TRAPS — if any are genuine, inject into .prizm-docs/ during Phase 6 retrospective
94
94
  - Do NOT delete failure-log.md until this session completes all phases and commits successfully
95
95
 
96
96
  ```bash
@@ -99,8 +99,13 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md 2>/dev/null && echo "EXI
99
99
 
100
100
  If MISSING — build it now:
101
101
  1. Read `.prizm-docs/root.prizm` and relevant L1/L2 prizm docs
102
- 2. Scan `src/` for files related to this feature; read each one
103
- 3. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
102
+ 2. Detect source code directories: read KEY_FILES and STRUCTURE sections from `root.prizm` to identify where source code lives (e.g. `src/`, `app/`, `lib/`, `cmd/`, `packages/`, or project root). If `root.prizm` is missing, scan the project tree:
103
+ ```bash
104
+ find . -maxdepth 2 -type f \( -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.java" -o -name "*.rb" -o -name "*.rs" \) -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/vendor/*' | head -30
105
+ ```
106
+ Identify the top-level source directories from the results.
107
+ 3. Scan the detected source directories for files related to this feature; read each one
108
+ 4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
104
109
  - **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
105
110
  - **Section 2 — Project Structure**: run the following to get a visual directory tree, then paste output:
106
111
  ```bash
@@ -111,12 +116,12 @@ If MISSING — build it now:
111
116
  ### Files to Modify
112
117
  | File | Why Needed | Key Interfaces |
113
118
  |------|-----------|----------------|
114
- | `src/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
119
+ | `<source-dir>/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
115
120
 
116
121
  ### Files for Reference
117
122
  | File | Why Needed | Key Interfaces |
118
123
  |------|-----------|----------------|
119
- | `src/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
124
+ | `<source-dir>/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
120
125
 
121
126
  ### Known TRAPS (from .prizm-docs/)
122
127
  - <trap entries extracted from L1/L2 docs>
@@ -139,7 +144,23 @@ Before proceeding past CP-1, verify:
139
144
 
140
145
  **CP-1**: plan.md exists with Tasks section.
141
146
 
142
- ### Phase 3: ImplementDev Subagent
147
+ ### Phase 3: AnalyzeReviewer Subagent
148
+
149
+ Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
150
+
151
+ Prompt:
152
+ > "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
153
+ > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has project context, Section 4 has file manifest.
154
+ > 2. Run prizmkit-analyze: cross-check `plan.md` (including Tasks section) against feature description and acceptance criteria for consistency.
155
+ > 3. Before flagging CRITICAL or HIGH issues, read the relevant source files listed in the File Manifest to verify.
156
+ > Report: CRITICAL, HIGH, MEDIUM issues found (or 'No issues found')."
157
+
158
+ Wait for Reviewer to return.
159
+ - If CRITICAL issues found: fix them yourself — read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full project context. Fix ONLY the listed CRITICAL issues in plan.md. Then re-run analyze (max 1 round).
160
+
161
+ **CP-2**: No CRITICAL issues.
162
+
163
+ ### Phase 4: Implement — Dev Subagent
143
164
 
144
165
  **Build artifacts rule** (passed to Dev): After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary or build directory is in `.gitignore`. Never commit compiled binaries, build output, or generated artifacts.
145
166
 
@@ -171,7 +192,7 @@ grep -q "## Implementation Log" .prizmkit/specs/{{FEATURE_SLUG}}/context-snapsho
171
192
  ```
172
193
  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."
173
194
 
174
- ### Phase 4: Review + Test — Reviewer Subagent
195
+ ### Phase 5: Review + Test — Reviewer Subagent
175
196
 
176
197
  Spawn Reviewer subagent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
177
198
 
@@ -198,29 +219,29 @@ If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write the '#
198
219
 
199
220
  - If NEEDS_FIXES: spawn Dev to fix (Dev reads Fix Instructions in snapshot), re-run Review (max 3 rounds)
200
221
 
201
- **CP-2**: Tests pass, verdict is not NEEDS_FIXES.
222
+ **CP-3**: Tests pass, verdict is not NEEDS_FIXES.
202
223
 
203
- ### Phase 5: Architecture Sync & Commit (SINGLE COMMIT)
224
+ ### Phase 6: Architecture Sync & Commit (SINGLE COMMIT)
204
225
 
205
- **5a.** Run `/prizmkit-retrospective` — maintains `.prizm-docs/` (architecture index):
226
+ **6a.** Run `/prizmkit-retrospective` — maintains `.prizm-docs/` (architecture index):
206
227
  1. **Structural sync**: Use `git diff --cached --name-status` to locate changed modules, update KEY_FILES/INTERFACES/DEPENDENCIES/file counts in affected `.prizm-docs/` files
207
228
  2. **Architecture knowledge** (feature sessions only): Extract TRAPS/RULES/DECISIONS from completed work into `.prizm-docs/`
208
229
  3. Stage doc changes: `git add .prizm-docs/`
209
230
  ⚠️ Do NOT commit here. Only stage.
210
231
 
211
- **5b.** Stage all feature code explicitly (NEVER use `git add -A` or `git add .`):
232
+ **6b.** Stage all feature code explicitly (NEVER use `git add -A` or `git add .`):
212
233
  ```bash
213
234
  git add <specific-files-created-or-modified>
214
235
  git add .prizm-docs/
215
236
  ```
216
237
 
217
- **5c.** Run `/prizmkit-committer` → THE ONLY commit for this feature:
238
+ **6c.** Run `/prizmkit-committer` → THE ONLY commit for this feature:
218
239
  `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`
219
240
  This single commit includes: feature code + tests + .prizm-docs/ updates. Do NOT push.
220
241
  - MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
221
242
  - Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
222
243
 
223
- **5d.** Final verification:
244
+ **6d.** Final verification:
224
245
  ```bash
225
246
  git status --short
226
247
  ```
@@ -260,13 +281,13 @@ rm -f .prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md
260
281
 
261
282
  ## Reminders
262
283
 
263
- - Tier 2: orchestrator builds context+plan, Dev implements, Reviewer reviews+tests — use direct Agent spawn for agents
284
+ - Tier 2: orchestrator builds context+plan, Analyzer checks consistency, Dev implements, Reviewer reviews+tests — use direct Agent spawn for agents
264
285
  - Build context-snapshot.md FIRST; all subagents read it instead of re-reading source files
265
286
  - context-snapshot.md is append-only: orchestrator writes Sections 1-4, Dev appends Implementation Log, Reviewer appends Review Notes
266
287
  - Gate checks enforce Implementation Log and Review Notes are written before proceeding
267
288
  - Do NOT use `run_in_background=true` when spawning subagents
268
289
  - `/prizmkit-committer` is mandatory, and must not be replaced with manual git commit commands
269
- - Do NOT run `git add`/`git commit` during Phase 1-4 — all changes are committed once in Phase 5
290
+ - Do NOT run `git add`/`git commit` during Phase 1-5 — all changes are committed once in Phase 6
270
291
  - If any files remain after the commit, amend the existing commit — do NOT create a follow-up commit
271
292
  - When staging files, always use explicit file names — NEVER use `git add -A` or `git add .`
272
293
  - On timeout: check snapshot + git diff HEAD → model:lite → remaining steps only → max 2 retries per phase → orchestrator fallback
@@ -31,38 +31,6 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
31
31
 
32
32
  {{GLOBAL_CONTEXT}}
33
33
 
34
- {{IF_MODE_SELF_EVOLVE}}
35
- ## Framework Self-Development Context
36
-
37
- **You are developing the PrizmKit framework itself.** This is NOT a regular project — you are modifying the tool that powers this pipeline. Extra guardrails apply.
38
-
39
- ### Framework Structure
40
-
41
- ```
42
- core/skills/ — Skill definitions (each has _metadata.json)
43
- core/agents/ — Agent .md definitions (YAML frontmatter required)
44
- core/team/ — Team config (dev repo only, NOT installed)
45
- dev-pipeline/ — Pipeline scripts + templates (installed with --pipeline)
46
- templates/ — Bootstrap prompt templates (tier1/2/3)
47
- scripts/ — Python/bash pipeline scripts
48
- create-prizmkit/ — npm package / CLI installer
49
- bundled/ — Pre-bundled assets (auto-generated, NEVER edit directly)
50
- tests/ — Validation + unit tests
51
- ```
52
-
53
- ### 5 Key Invariants (MUST be preserved)
54
-
55
- 1. **Skill ↔ _metadata.json 1:1 mapping**: Every directory in `core/skills/` MUST have a `_metadata.json`. Every `_metadata.json` must reference an existing skill directory.
56
- 2. **Template variables resolve completely**: All `{{PLACEHOLDER}}` in `dev-pipeline/templates/` must be resolvable by `generate-bootstrap-prompt.py`. No unresolved placeholders in output.
57
- 3. **Agent YAML frontmatter is valid**: Every `.md` in `core/agents/` must have valid YAML frontmatter with required fields (name, description, tools).
58
- 4. **Bundle is generated, never hand-edited**: `create-prizmkit/bundled/` is auto-generated by `scripts/bundle.js`. Manual edits will be overwritten.
59
- 5. **CI must pass**: `npm run ci` (validate-all + bundle + verify-bundle + eslint + vitest) must pass after every change.
60
-
61
- ### Version Isolation
62
-
63
- LLM context is frozen at prompt time. Modifying a skill source file during this session will NOT change the behavior of that skill within this session. The real risk is structural inconsistency.
64
- {{END_IF_MODE_SELF_EVOLVE}}
65
-
66
34
  ## ⚠️ Context Budget Rules (CRITICAL — read before any phase)
67
35
 
68
36
  You are running in headless mode with a FINITE context window. Exceeding it will crash the session and lose all work. Follow these rules strictly:
@@ -165,9 +133,9 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null
165
133
  - `context-snapshot.md` exists → use it directly, skip Phase 1
166
134
  - Some missing → generate only missing files
167
135
 
168
- Before planning, check whether feature code already exists in the project:
136
+ Before planning, check whether feature code already exists in the project (search in source directories identified from `root.prizm` or the project tree scan):
169
137
  ```bash
170
- grep -r "{{FEATURE_SLUG}}" src/ --include="*.js" --include="*.ts" -l 2>/dev/null | head -20
138
+ grep -r "{{FEATURE_SLUG}}" . --include="*.js" --include="*.ts" --include="*.py" --include="*.go" --include="*.java" --include="*.rb" --include="*.rs" -l --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist --exclude-dir=build --exclude-dir=vendor --exclude-dir=.prizmkit 2>/dev/null | head -20
171
139
  ```
172
140
 
173
141
  Record result as `EXISTING_CODE` (list of files, or empty).
@@ -177,8 +145,13 @@ If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing
177
145
  **Step A — Build Context Snapshot** (skip if `context-snapshot.md` already exists):
178
146
 
179
147
  1. Read `.prizm-docs/root.prizm` and relevant L1/L2 prizm docs
180
- 2. Scan `src/` for files related to this feature; read each one
181
- 3. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
148
+ 2. Detect source code directories: read KEY_FILES and STRUCTURE sections from `root.prizm` to identify where source code lives (e.g. `src/`, `app/`, `lib/`, `cmd/`, `packages/`, or project root). If `root.prizm` is missing, scan the project tree:
149
+ ```bash
150
+ find . -maxdepth 2 -type f \( -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.java" -o -name "*.rb" -o -name "*.rs" \) -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/vendor/*' | head -30
151
+ ```
152
+ Identify the top-level source directories from the results.
153
+ 3. Scan the detected source directories for files related to this feature; read each one
154
+ 4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
182
155
  - **Section 1 — Feature Brief**: feature description + acceptance criteria (copy from above)
183
156
  - **Section 2 — Project Structure**: run the following to get a visual directory tree, then paste output:
184
157
  ```bash
@@ -189,12 +162,12 @@ If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing
189
162
  ### Files to Modify
190
163
  | File | Why Needed | Key Interfaces |
191
164
  |------|-----------|----------------|
192
- | `src/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
165
+ | `<source-dir>/config.js` | Add runtime config layer | `config` (Zod object), `configSchema` |
193
166
 
194
167
  ### Files for Reference
195
168
  | File | Why Needed | Key Interfaces |
196
169
  |------|-----------|----------------|
197
- | `src/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
170
+ | `<source-dir>/security/permission-guard.js` | Permission check integration | `checkCommandPermission(userId, cmd)` |
198
171
 
199
172
  ### Known TRAPS (from .prizm-docs/)
200
173
  - <trap entries extracted from L1/L2 docs>
@@ -214,6 +187,13 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/spec.md .prizmkit/specs/{{FEATURE_SLUG}}/pla
214
187
 
215
188
  > All files go under `.prizmkit/specs/{{FEATURE_SLUG}}/`. Confirm each with `ls` after writing.
216
189
 
190
+ **Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
191
+ Before proceeding past CP-1, verify:
192
+ 1. Plan.md Data Model section references existing schema/model files (scan for `*.prisma`, `*.sql`, `migrations/`, `models/`, `*.entity.*` files; read them if not already in context-snapshot)
193
+ 2. All new tables/fields follow existing naming conventions, ID strategy, timestamp patterns, and constraint style
194
+ 3. No `[NEEDS CLARIFICATION]` remains in Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
195
+ 4. If a DB design decision genuinely cannot be resolved from existing code alone, document the assumption made and flag it in the Implementation Log for user review.
196
+
217
197
  **CP-1**: Both spec.md and plan.md exist.
218
198
 
219
199
  ### Phase 3: Analyze — Reviewer Agent
@@ -245,17 +225,6 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || echo
245
225
 
246
226
  Spawn Dev agent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false).
247
227
 
248
- {{IF_MODE_SELF_EVOLVE}}
249
- **Framework Self-Evolve — Dev Extra Instructions**:
250
- Append the following to the Dev agent prompt:
251
- > "FRAMEWORK RULES (self-evolve mode):
252
- > - If you modify any file in `core/skills/`, also update `_metadata.json` in the same skill directory.
253
- > - If you modify `dev-pipeline/templates/*.md`, verify all `{{PLACEHOLDER}}` markers have matching entries in `generate-bootstrap-prompt.py`.
254
- > - Before marking implementation complete, run `node tests/validate-all.js` and fix any failures.
255
- > - NEVER directly modify files in `create-prizmkit/bundled/` — those are auto-generated by `scripts/bundle.js`.
256
- > - If you modify any file in `dev-pipeline/scripts/` or `dev-pipeline/templates/` or `core/skills/` that this pipeline uses, note this in your Implementation Log for reload_needed tracking."
257
- {{END_IF_MODE_SELF_EVOLVE}}
258
-
259
228
  Prompt:
260
229
  > "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}) using TDD.
261
230
  > **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST.
@@ -298,18 +267,6 @@ All tasks `[x]`, tests pass.
298
267
 
299
268
  Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
300
269
 
301
- {{IF_MODE_SELF_EVOLVE}}
302
- **Framework Self-Evolve — Reviewer Extra Instructions**:
303
- Append the following to the Reviewer agent prompt:
304
- > "FRAMEWORK REVIEW DIMENSIONS (self-evolve mode):
305
- > In addition to standard code review, check:
306
- > 1. **Structural integrity**: Every `core/skills/*/` must have `_metadata.json`. Run `node tests/validate-all.js` to verify.
307
- > 2. **Template safety**: If any `dev-pipeline/templates/*.md` was modified, check that all `{{PLACEHOLDER}}` markers are properly balanced (open/close) and resolvable.
308
- > 3. **Agent frontmatter**: If any `core/agents/*.md` was modified, validate YAML frontmatter has required fields (name, description, tools).
309
- > 4. **CI gate**: Run `npm run ci` and report the result. Any failure is CRITICAL.
310
- > 5. **Bundle safety**: Verify no files in `create-prizmkit/bundled/` were directly modified (check `git diff --name-only` for bundled/ changes)."
311
- {{END_IF_MODE_SELF_EVOLVE}}
312
-
313
270
  Prompt:
314
271
  > "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
315
272
  > **IMPORTANT**: Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST.
@@ -346,20 +303,6 @@ If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write the '#
346
303
 
347
304
  ### Phase 6: Retrospective & Commit (SINGLE COMMIT) — DO NOT SKIP
348
305
 
349
- {{IF_MODE_SELF_EVOLVE}}
350
- **Framework Validation Gate (self-evolve mode)**:
351
-
352
- Before proceeding with commit, run the full framework CI pipeline:
353
-
354
- ```bash
355
- bash {{VALIDATOR_SCRIPTS_DIR}}/validate-framework.sh
356
- ```
357
-
358
- - If ALL steps pass → proceed with commit below.
359
- - If any step fails → fix the issue and re-run. Maximum 2 fix-and-retry rounds.
360
- - After 2 failed rounds → exit and let the pipeline runner handle the failure.
361
- {{END_IF_MODE_SELF_EVOLVE}}
362
-
363
306
  **For bug fixes**: run `/prizmkit-retrospective` for structural sync only (skip knowledge injection unless a new TRAPS was discovered). Use `fix(<scope>):` commit prefix.
364
307
 
365
308
  **6a.** Check if feature already committed:
@@ -191,17 +191,3 @@ class TestProcessModeBlocks:
191
191
  tpl = "{{IF_INIT_NEEDED}}\nneed init\n{{END_IF_INIT_NEEDED}}"
192
192
  result = process_mode_blocks(tpl, "standard", init_done=False)
193
193
  assert "need init" in result
194
-
195
- def test_self_evolve_keeps_self_evolve_and_full(self):
196
- tpl = (
197
- "{{IF_MODE_SELF_EVOLVE}}se content{{END_IF_MODE_SELF_EVOLVE}}"
198
- "{{IF_MODE_FULL}}full content{{END_IF_MODE_FULL}}"
199
- )
200
- result = process_mode_blocks(tpl, "self-evolve", init_done=True)
201
- assert "se content" in result
202
- assert "full content" in result
203
-
204
- def test_self_evolve_removes_lite(self):
205
- tpl = "{{IF_MODE_LITE}}lite content{{END_IF_MODE_LITE}}"
206
- result = process_mode_blocks(tpl, "self-evolve", init_done=True)
207
- assert "lite content" not in result