prizmkit 1.0.45 → 1.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/agent-adapter.js +2 -1
  3. package/bundled/adapters/claude/command-adapter.js +4 -3
  4. package/bundled/agents/prizm-dev-team-dev.md +1 -1
  5. package/bundled/dev-pipeline/README.md +3 -4
  6. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +2 -3
  7. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +2 -2
  8. package/bundled/dev-pipeline/launch-daemon.sh +2 -2
  9. package/bundled/dev-pipeline/lib/branch.sh +76 -0
  10. package/bundled/dev-pipeline/run-bugfix.sh +58 -149
  11. package/bundled/dev-pipeline/run.sh +60 -153
  12. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +1 -1
  13. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +8 -16
  14. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +10 -18
  15. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +20 -24
  16. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +6 -6
  17. package/bundled/dev-pipeline/tests/conftest.py +19 -131
  18. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +207 -0
  19. package/bundled/dev-pipeline/tests/test_utils.py +51 -110
  20. package/bundled/rules/prizm/prizm-commit-workflow.md +3 -3
  21. package/bundled/skills/_metadata.json +15 -16
  22. package/bundled/skills/app-planner/SKILL.md +8 -7
  23. package/bundled/skills/bug-fix-workflow/SKILL.md +174 -0
  24. package/bundled/skills/bug-planner/SKILL.md +20 -32
  25. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +3 -5
  26. package/bundled/skills/dev-pipeline-launcher/SKILL.md +4 -6
  27. package/bundled/skills/feature-workflow/SKILL.md +25 -42
  28. package/bundled/skills/prizm-kit/SKILL.md +57 -21
  29. package/bundled/skills/prizm-kit/assets/{claude-md-template.md → project-memory-template.md} +2 -2
  30. package/bundled/skills/prizmkit-analyze/SKILL.md +41 -29
  31. package/bundled/skills/prizmkit-clarify/SKILL.md +40 -30
  32. package/bundled/skills/prizmkit-code-review/SKILL.md +48 -43
  33. package/bundled/skills/prizmkit-committer/SKILL.md +30 -68
  34. package/bundled/skills/prizmkit-implement/SKILL.md +48 -26
  35. package/bundled/skills/prizmkit-init/SKILL.md +57 -66
  36. package/bundled/skills/prizmkit-plan/SKILL.md +46 -20
  37. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +60 -19
  38. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +23 -23
  39. package/bundled/skills/prizmkit-retrospective/SKILL.md +142 -65
  40. package/bundled/skills/prizmkit-retrospective/assets/retrospective-template.md +13 -0
  41. package/bundled/skills/prizmkit-specify/SKILL.md +63 -13
  42. package/bundled/skills/refactor-workflow/SKILL.md +105 -49
  43. package/bundled/team/prizm-dev-team.json +2 -2
  44. package/package.json +1 -1
  45. package/src/scaffold.js +3 -3
  46. package/bundled/dev-pipeline/lib/worktree.sh +0 -164
  47. package/bundled/dev-pipeline/tests/__init__.py +0 -0
  48. package/bundled/dev-pipeline/tests/test_check_session.py +0 -131
  49. package/bundled/dev-pipeline/tests/test_cleanup_logs.py +0 -119
  50. package/bundled/dev-pipeline/tests/test_detect_stuck.py +0 -207
  51. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +0 -181
  52. package/bundled/dev-pipeline/tests/test_generate_prompt.py +0 -190
  53. package/bundled/dev-pipeline/tests/test_init_bugfix_pipeline.py +0 -153
  54. package/bundled/dev-pipeline/tests/test_init_pipeline.py +0 -241
  55. package/bundled/dev-pipeline/tests/test_update_bug_status.py +0 -142
  56. package/bundled/dev-pipeline/tests/test_update_feature_status.py +0 -338
  57. package/bundled/dev-pipeline/tests/test_worktree.py +0 -236
  58. package/bundled/dev-pipeline/tests/test_worktree_integration.py +0 -796
  59. package/bundled/skills/prizm-kit/assets/codebuddy-md-template.md +0 -35
  60. package/bundled/skills/prizm-kit/assets/hooks/prizm-commit-hook.json +0 -15
  61. package/bundled/skills/prizmkit-summarize/SKILL.md +0 -51
  62. package/bundled/skills/prizmkit-summarize/assets/registry-template.md +0 -18
  63. package/bundled/templates/hooks/commit-intent-claude.json +0 -26
  64. /package/bundled/templates/hooks/{commit-intent-codebuddy.json → commit-intent.json} +0 -0
@@ -28,8 +28,8 @@ set -euo pipefail
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
30
  # PIPELINE_MODE Override mode for all features: lite|standard|full|self-evolve (used by daemon)
31
- # USE_WORKTREE Enable git worktree isolation per session (default: 1). Set to 0 to disable.
32
- # AUTO_PUSH Auto-push to remote after successful worktree merge (default: 0). Set to 1 to enable.
31
+ # DEV_BRANCH Custom dev branch name (default: auto-generated dev/pipeline-{run_id})
32
+ # AUTO_PUSH Auto-push to remote after successful feature (default: 0). Set to 1 to enable.
33
33
  # ============================================================
34
34
 
35
35
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -46,7 +46,7 @@ LOG_RETENTION_DAYS=${LOG_RETENTION_DAYS:-14}
46
46
  LOG_MAX_TOTAL_MB=${LOG_MAX_TOTAL_MB:-1024}
47
47
  VERBOSE=${VERBOSE:-0}
48
48
  MODEL=${MODEL:-""}
49
- USE_WORKTREE=${USE_WORKTREE:-1}
49
+ DEV_BRANCH=${DEV_BRANCH:-""}
50
50
  AUTO_PUSH=${AUTO_PUSH:-0}
51
51
 
52
52
  # Source shared common helpers (CLI/platform detection + logs + deps)
@@ -56,8 +56,8 @@ prizm_detect_cli_and_platform
56
56
  # Source shared heartbeat library
57
57
  source "$SCRIPT_DIR/lib/heartbeat.sh"
58
58
 
59
- # Source shared worktree library
60
- source "$SCRIPT_DIR/lib/worktree.sh"
59
+ # Source shared branch library
60
+ source "$SCRIPT_DIR/lib/branch.sh"
61
61
 
62
62
  # Detect stream-json support
63
63
  detect_stream_json_support "$CLI_CMD"
@@ -65,9 +65,9 @@ detect_stream_json_support "$CLI_CMD"
65
65
  # Feature list path (set in main, used by cleanup trap)
66
66
  FEATURE_LIST=""
67
67
 
68
- # Active worktree tracking (for cleanup on interrupt)
69
- _ACTIVE_WORKTREE_PATH=""
70
- _ACTIVE_WORKTREE_BRANCH=""
68
+ # Branch tracking (for cleanup on interrupt)
69
+ _ORIGINAL_BRANCH=""
70
+ _DEV_BRANCH_NAME=""
71
71
 
72
72
  # ============================================================
73
73
  # Shared: Spawn an AI CLI session and wait for result
@@ -83,7 +83,6 @@ _ACTIVE_WORKTREE_BRANCH=""
83
83
  # $4 - bootstrap_prompt (path)
84
84
  # $5 - session_dir
85
85
  # $6 - max_retries (for status update)
86
- # $7 - worktree_path (optional; if set, AI CLI runs inside this directory)
87
86
  spawn_and_wait_session() {
88
87
  local feature_id="$1"
89
88
  local feature_list="$2"
@@ -91,7 +90,6 @@ spawn_and_wait_session() {
91
90
  local bootstrap_prompt="$4"
92
91
  local session_dir="$5"
93
92
  local max_retries="$6"
94
- local worktree_path="${7:-}"
95
93
 
96
94
  local session_log="$session_dir/logs/session.log"
97
95
  local progress_json="$session_dir/logs/progress.json"
@@ -116,14 +114,6 @@ spawn_and_wait_session() {
116
114
  # within an existing Claude Code session (e.g. via launch-daemon.sh).
117
115
  unset CLAUDECODE 2>/dev/null || true
118
116
 
119
- # If worktree path is provided, cd into it for the AI CLI session
120
- local _saved_pwd=""
121
- if [[ -n "$worktree_path" && -d "$worktree_path" ]]; then
122
- _saved_pwd="$(pwd)"
123
- cd "$worktree_path"
124
- log_info "Running AI CLI in worktree: $worktree_path"
125
- fi
126
-
127
117
  case "$CLI_CMD" in
128
118
  *claude*)
129
119
  # Claude Code: prompt via -p argument, --dangerously-skip-permissions for auto-accept
@@ -149,11 +139,6 @@ spawn_and_wait_session() {
149
139
  esac
150
140
  local cbc_pid=$!
151
141
 
152
- # Restore original directory if we changed it
153
- if [[ -n "$_saved_pwd" ]]; then
154
- cd "$_saved_pwd"
155
- fi
156
-
157
142
  # Start progress parser (no-op if stream-json not supported)
158
143
  start_progress_parser "$session_log" "$progress_json" "$SCRIPTS_DIR"
159
144
  local parser_pid="${_PARSER_PID:-}"
@@ -229,9 +214,9 @@ spawn_and_wait_session() {
229
214
  else
230
215
  local docs_changed=""
231
216
  docs_changed=$(git -C "$project_root" log --name-only --format="" -1 2>/dev/null \
232
- | grep -E '(\.prizm-docs/|\.prizmkit/specs/REGISTRY\.md)' | head -1 || true)
217
+ | grep -E '\.prizm-docs/' | head -1 || true)
233
218
  if [[ -z "$docs_changed" ]]; then
234
- log_warn "Session committed but no .prizm-docs or REGISTRY.md changes detected."
219
+ log_warn "Session committed but no .prizm-docs changes detected."
235
220
  session_status="docs_missing"
236
221
  fi
237
222
  fi
@@ -280,13 +265,10 @@ cleanup() {
280
265
  # Kill all child processes (claude-internal, heartbeat, progress parser, etc.)
281
266
  kill 0 2>/dev/null || true
282
267
 
283
- # Clean up active worktree if any
284
- if [[ -n "$_ACTIVE_WORKTREE_PATH" ]]; then
285
- local _project_root
286
- _project_root="$(cd "$SCRIPT_DIR/.." && pwd)"
287
- worktree_cleanup "$_project_root" "$_ACTIVE_WORKTREE_PATH" "$_ACTIVE_WORKTREE_BRANCH"
288
- _ACTIVE_WORKTREE_PATH=""
289
- _ACTIVE_WORKTREE_BRANCH=""
268
+ # Log current branch info for recovery
269
+ if [[ -n "$_DEV_BRANCH_NAME" ]]; then
270
+ log_info "Development was on branch: $_DEV_BRANCH_NAME"
271
+ log_info "Original branch was: $_ORIGINAL_BRANCH"
290
272
  fi
291
273
 
292
274
  if [[ -n "$FEATURE_LIST" && -f "$FEATURE_LIST" ]]; then
@@ -623,13 +605,9 @@ sys.exit(1)
623
605
  log_warn "Interrupted. Killing session..."
624
606
  # Kill all child processes
625
607
  kill 0 2>/dev/null || true
626
- # Clean up active worktree if any
627
- if [[ -n "$_ACTIVE_WORKTREE_PATH" ]]; then
628
- local _proj_root
629
- _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
630
- worktree_cleanup "$_proj_root" "$_ACTIVE_WORKTREE_PATH" "$_ACTIVE_WORKTREE_BRANCH"
631
- _ACTIVE_WORKTREE_PATH=""
632
- _ACTIVE_WORKTREE_BRANCH=""
608
+ # Log current branch info
609
+ if [[ -n "$_DEV_BRANCH_NAME" ]]; then
610
+ log_info "Development was on branch: $_DEV_BRANCH_NAME"
633
611
  fi
634
612
  log_info "Session log: $session_dir/logs/session.log"
635
613
  exit 130
@@ -638,63 +616,31 @@ sys.exit(1)
638
616
 
639
617
  _SPAWN_RESULT=""
640
618
 
641
- # Worktree lifecycle: create worktree before session if enabled
642
- local _wt_path="" _wt_branch=""
643
- if [[ "$USE_WORKTREE" == "1" ]]; then
644
- local _proj_root
645
- _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
646
- local _wt_base="$STATE_DIR/worktrees"
647
- local _source_branch
648
- _source_branch=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
649
-
650
- # Prune stale worktrees before creating new one
651
- worktree_prune_stale "$_proj_root"
652
-
653
- _WORKTREE_PATH=""
654
- _WORKTREE_BRANCH=""
655
- if worktree_create "$_proj_root" "$_wt_base" "$session_id" "$_source_branch"; then
656
- _wt_path="$_WORKTREE_PATH"
657
- _wt_branch="$_WORKTREE_BRANCH"
658
- _ACTIVE_WORKTREE_PATH="$_wt_path"
659
- _ACTIVE_WORKTREE_BRANCH="$_wt_branch"
660
- else
661
- log_warn "Failed to create worktree; running session in main working tree"
662
- fi
619
+ # Branch lifecycle: create and checkout feature branch
620
+ local _proj_root
621
+ _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
622
+ local _source_branch
623
+ _source_branch=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
624
+ _ORIGINAL_BRANCH="$_source_branch"
625
+
626
+ local _branch_name="${DEV_BRANCH:-dev/${feature_id}-$(date +%s)}"
627
+ if branch_create "$_proj_root" "$_branch_name" "$_source_branch"; then
628
+ _DEV_BRANCH_NAME="$_branch_name"
629
+ else
630
+ log_warn "Failed to create branch; running session on current branch"
663
631
  fi
664
632
 
665
633
  spawn_and_wait_session \
666
634
  "$feature_id" "$feature_list" "$session_id" \
667
- "$bootstrap_prompt" "$session_dir" 999 "$_wt_path"
635
+ "$bootstrap_prompt" "$session_dir" 999
668
636
  local session_status="$_SPAWN_RESULT"
669
637
 
670
- # Worktree lifecycle: merge and cleanup after session
671
- if [[ -n "$_wt_path" && -n "$_wt_branch" ]]; then
638
+ # Auto-push after successful session
639
+ if [[ "$session_status" == "success" && "$AUTO_PUSH" == "1" ]]; then
672
640
  local _proj_root
673
641
  _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
674
- local _target_branch
675
- _target_branch=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
676
-
677
- if [[ "$session_status" == "success" ]]; then
678
- _MERGE_RESULT=""
679
- worktree_merge "$_proj_root" "$_wt_branch" "$_target_branch" "$feature_id" "$session_id" || true
680
- if [[ "$_MERGE_RESULT" == "success" ]]; then
681
- if [[ "$AUTO_PUSH" == "1" ]]; then
682
- log_info "AUTO_PUSH enabled; pushing to remote..."
683
- git -C "$_proj_root" push 2>/dev/null || log_warn "Auto-push failed"
684
- fi
685
- worktree_cleanup "$_proj_root" "$_wt_path" "$_wt_branch"
686
- elif [[ "$_MERGE_RESULT" == "conflict" ]]; then
687
- session_status="merge_conflict"
688
- _SPAWN_RESULT="merge_conflict"
689
- log_warn "Worktree branch preserved for manual conflict resolution: $_wt_branch"
690
- else
691
- worktree_cleanup "$_proj_root" "$_wt_path" "$_wt_branch"
692
- fi
693
- else
694
- worktree_cleanup "$_proj_root" "$_wt_path" "$_wt_branch"
695
- fi
696
- _ACTIVE_WORKTREE_PATH=""
697
- _ACTIVE_WORKTREE_BRANCH=""
642
+ log_info "AUTO_PUSH enabled; pushing to remote..."
643
+ git -C "$_proj_root" push -u origin "$_DEV_BRANCH_NAME" 2>/dev/null || log_warn "Auto-push failed"
698
644
  fi
699
645
 
700
646
  echo ""
@@ -766,13 +712,6 @@ main() {
766
712
  check_dependencies
767
713
  run_log_cleanup
768
714
 
769
- # Prune stale worktree references at startup
770
- if [[ "$USE_WORKTREE" == "1" ]]; then
771
- local _prune_root
772
- _prune_root="$(cd "$SCRIPT_DIR/.." && pwd)"
773
- worktree_prune_stale "$_prune_root"
774
- fi
775
-
776
715
  # Initialize pipeline state if needed
777
716
  if [[ ! -f "$STATE_DIR/pipeline.json" ]]; then
778
717
  log_info "Initializing pipeline state..."
@@ -813,6 +752,23 @@ main() {
813
752
  echo -e "${BOLD}════════════════════════════════════════════════════${NC}"
814
753
  echo ""
815
754
 
755
+ # Branch lifecycle: create dev branch for this pipeline run
756
+ local _proj_root
757
+ _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
758
+ local _source_branch
759
+ _source_branch=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
760
+ _ORIGINAL_BRANCH="$_source_branch"
761
+
762
+ local run_id_for_branch
763
+ run_id_for_branch=$(jq -r '.run_id' "$STATE_DIR/pipeline.json" 2>/dev/null || echo "$$")
764
+ local _branch_name="${DEV_BRANCH:-dev/pipeline-${run_id_for_branch}}"
765
+ if branch_create "$_proj_root" "$_branch_name" "$_source_branch"; then
766
+ _DEV_BRANCH_NAME="$_branch_name"
767
+ log_info "Dev branch: $_branch_name"
768
+ else
769
+ log_warn "Failed to create dev branch; running on current branch: $_source_branch"
770
+ fi
771
+
816
772
  # Main processing loop
817
773
  local session_count=0
818
774
 
@@ -851,6 +807,10 @@ for f in data.get('stuck_features', []):
851
807
  log_success "════════════════════════════════════════════════════"
852
808
  log_success " All features completed! Pipeline finished."
853
809
  log_success " Total sessions: $session_count"
810
+ if [[ -n "$_DEV_BRANCH_NAME" ]]; then
811
+ log_success " Dev branch: $_DEV_BRANCH_NAME"
812
+ log_success " Merge with: git checkout $_ORIGINAL_BRANCH && git merge $_DEV_BRANCH_NAME"
813
+ fi
854
814
  log_success "════════════════════════════════════════════════════"
855
815
  rm -f "$STATE_DIR/current-session.json"
856
816
  break
@@ -948,70 +908,17 @@ os.replace(tmp, target)
948
908
  log_info "Spawning AI CLI session: $session_id"
949
909
  _SPAWN_RESULT=""
950
910
 
951
- # Worktree lifecycle: create worktree before session if enabled
952
- local _wt_path="" _wt_branch=""
953
- if [[ "$USE_WORKTREE" == "1" ]]; then
954
- local _proj_root
955
- _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
956
- local _wt_base="$STATE_DIR/worktrees"
957
- local _source_branch
958
- _source_branch=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
959
-
960
- _WORKTREE_PATH=""
961
- _WORKTREE_BRANCH=""
962
- if worktree_create "$_proj_root" "$_wt_base" "$session_id" "$_source_branch"; then
963
- _wt_path="$_WORKTREE_PATH"
964
- _wt_branch="$_WORKTREE_BRANCH"
965
- _ACTIVE_WORKTREE_PATH="$_wt_path"
966
- _ACTIVE_WORKTREE_BRANCH="$_wt_branch"
967
- else
968
- log_warn "Failed to create worktree; running session in main working tree"
969
- fi
970
- fi
971
-
972
911
  spawn_and_wait_session \
973
912
  "$feature_id" "$feature_list" "$session_id" \
974
- "$bootstrap_prompt" "$session_dir" "$MAX_RETRIES" "$_wt_path"
913
+ "$bootstrap_prompt" "$session_dir" "$MAX_RETRIES"
975
914
  local session_status="$_SPAWN_RESULT"
976
915
 
977
- # Worktree lifecycle: merge and cleanup after session
978
- if [[ -n "$_wt_path" && -n "$_wt_branch" ]]; then
916
+ # Auto-push after successful session
917
+ if [[ "$session_status" == "success" && "$AUTO_PUSH" == "1" ]]; then
979
918
  local _proj_root
980
919
  _proj_root="$(cd "$SCRIPT_DIR/.." && pwd)"
981
- local _target_branch
982
- _target_branch=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
983
-
984
- if [[ "$session_status" == "success" ]]; then
985
- _MERGE_RESULT=""
986
- worktree_merge "$_proj_root" "$_wt_branch" "$_target_branch" "$feature_id" "$session_id" || true
987
- if [[ "$_MERGE_RESULT" == "success" ]]; then
988
- if [[ "$AUTO_PUSH" == "1" ]]; then
989
- log_info "AUTO_PUSH enabled; pushing to remote..."
990
- git -C "$_proj_root" push 2>/dev/null || log_warn "Auto-push failed"
991
- fi
992
- worktree_cleanup "$_proj_root" "$_wt_path" "$_wt_branch"
993
- elif [[ "$_MERGE_RESULT" == "conflict" ]]; then
994
- session_status="merge_conflict"
995
- _SPAWN_RESULT="merge_conflict"
996
- log_warn "Worktree branch preserved for manual conflict resolution: $_wt_branch"
997
- # Update feature status to merge_conflict
998
- python3 "$SCRIPTS_DIR/update-feature-status.py" \
999
- --feature-list "$feature_list" \
1000
- --state-dir "$STATE_DIR" \
1001
- --feature-id "$feature_id" \
1002
- --session-status "merge_conflict" \
1003
- --session-id "$session_id" \
1004
- --max-retries "$MAX_RETRIES" \
1005
- --action update >/dev/null 2>&1 || true
1006
- else
1007
- worktree_cleanup "$_proj_root" "$_wt_path" "$_wt_branch"
1008
- fi
1009
- else
1010
- # Non-success: cleanup worktree
1011
- worktree_cleanup "$_proj_root" "$_wt_path" "$_wt_branch"
1012
- fi
1013
- _ACTIVE_WORKTREE_PATH=""
1014
- _ACTIVE_WORKTREE_BRANCH=""
920
+ log_info "AUTO_PUSH enabled; pushing to remote..."
921
+ git -C "$_proj_root" push 2>/dev/null || log_warn "Auto-push failed"
1015
922
  fi
1016
923
 
1017
924
  session_count=$((session_count + 1))
@@ -32,7 +32,7 @@ PHASE_KEYWORDS = {
32
32
  "analyze": ["prizmkit-analyze", "cross-check", "consistency", "analyzing"],
33
33
  "implement": ["prizmkit-implement", "implement", "TDD", "coding", "writing code"],
34
34
  "code-review": ["prizmkit-code-review", "code review", "review verdict", "reviewing"],
35
- "summarize": ["prizmkit-summarize", "REGISTRY.md", "summarize", "summary"],
35
+ "retrospective": ["prizmkit-retrospective", "retrospective", "knowledge distillation", "TRAPS", ".prizm-docs/ sync", "structural sync"],
36
36
  "commit": ["prizmkit-committer", "git commit", "feat(", "fix(", "committing"],
37
37
  }
38
38
 
@@ -37,7 +37,6 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
37
37
  .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md
38
38
  .prizmkit/specs/{{FEATURE_SLUG}}/plan.md
39
39
  .prizmkit/specs/{{FEATURE_SLUG}}/tasks.md
40
- .prizmkit/specs/REGISTRY.md
41
40
  ```
42
41
 
43
42
  ---
@@ -111,24 +110,17 @@ Key decisions: [list]
111
110
 
112
111
  **CP-2**: All acceptance criteria met, tests pass.
113
112
 
114
- ### Phase 4.5: Prizm Doc Update (mandatory for feature sessions)
113
+ ### Phase 4.5: Memory Maintenance (mandatory before commit)
115
114
 
116
- Run `/prizmkit-prizm-docs` and sync project docs before commit:
117
- 1. Use `git diff --cached --name-status` (fallback: `git diff --name-status`) to locate changed modules
118
- 2. Update affected `.prizm-docs/` files (L1/L2, changelog.prizm)
119
- 3. Stage documentation updates (`git add .prizm-docs/`) if changed
115
+ Run `/prizmkit-retrospective` the **sole maintainer** of `.prizm-docs/`:
116
+ 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
117
+ 2. **Knowledge injection** (feature sessions only): Extract TRAPS/RULES/DECISIONS from completed work into `.prizm-docs/`
118
+ 3. Stage all doc changes: `git add .prizm-docs/`
120
119
 
121
- Doc maintenance pass condition (pipeline-enforced): `REGISTRY.md` **or** `.prizm-docs/` changed in the final commit.
122
-
123
- ### Phase 4.7: Retrospective (feature sessions only, before commit)
124
-
125
- If this session is a feature (not a bug-fix-only commit), run `/prizmkit-retrospective` now — **before committing**.
126
- Retrospective must update relevant `.prizm-docs/` sections (TRAPS/RULES/DECISIONS) when applicable, so those changes are included in the feature commit.
127
- Stage any `.prizm-docs/` changes produced: `git add .prizm-docs/`
120
+ Doc maintenance pass condition (pipeline-enforced): `.prizm-docs/` changed in the final commit.
128
121
 
129
122
  ### Phase 5: Commit
130
123
 
131
- - Run `/prizmkit-summarize` → archive to REGISTRY.md
132
124
  - Run `/prizmkit-committer` → `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`, do NOT push
133
125
  - MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
134
126
  - Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
@@ -174,11 +166,11 @@ After writing `session-status.json`, verify repository is clean:
174
166
  git status --short
175
167
  ```
176
168
 
177
- If any files remain, include them in the last commit:
169
+ If any files remain (e.g. session-status.json), stage and create a follow-up commit:
178
170
 
179
171
  ```bash
180
172
  git add -A
181
- git commit --amend --no-edit
173
+ git commit -m "chore({{FEATURE_ID}}): include session artifacts"
182
174
  ```
183
175
 
184
176
  Re-check `git status --short` and ensure it is empty before exiting.
@@ -13,7 +13,7 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
13
13
 
14
14
  **CRITICAL**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn subagents, wait for each to finish (run_in_background=false).
15
15
 
16
- **Tier 2 — Dual Agent**: You handle context + planning directly. Then spawn Dev and Reviewer subagents. No TeamCreate required.
16
+ **Tier 2 — Dual Agent**: You handle context + planning directly. Then spawn Dev and Reviewer subagents. You may spawn agents directly via the Task tool or use TeamCreate for coordination — choose based on the situation.
17
17
 
18
18
  ### Feature Description
19
19
 
@@ -37,7 +37,6 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
37
37
  .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← written by you, read by Dev + Reviewer
38
38
  .prizmkit/specs/{{FEATURE_SLUG}}/plan.md
39
39
  .prizmkit/specs/{{FEATURE_SLUG}}/tasks.md
40
- .prizmkit/specs/REGISTRY.md
41
40
  ```
42
41
 
43
42
  **`context-snapshot.md`** is the shared knowledge base. You write it once; Dev and Reviewer read it instead of re-scanning individual files.
@@ -138,24 +137,17 @@ Wait for Reviewer to return.
138
137
 
139
138
  **CP-2**: Tests pass, verdict is not NEEDS_FIXES.
140
139
 
141
- ### Phase 4.5: Prizm Doc Update (mandatory for feature sessions)
140
+ ### Phase 4.5: Memory Maintenance (mandatory before commit)
142
141
 
143
- Run `/prizmkit-prizm-docs` and sync project docs before commit:
144
- 1. Use `git diff --cached --name-status` (fallback: `git diff --name-status`) to locate changed modules
145
- 2. Update affected `.prizm-docs/` files (L1/L2, changelog.prizm)
146
- 3. Stage documentation updates (`git add .prizm-docs/`) if changed
142
+ Run `/prizmkit-retrospective` the **sole maintainer** of `.prizm-docs/`:
143
+ 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
144
+ 2. **Knowledge injection** (feature sessions only): Extract TRAPS/RULES/DECISIONS from completed work into `.prizm-docs/`
145
+ 3. Stage all doc changes: `git add .prizm-docs/`
147
146
 
148
- Doc maintenance pass condition (pipeline-enforced): `REGISTRY.md` **or** `.prizm-docs/` changed in the final commit.
149
-
150
- ### Phase 4.7: Retrospective (feature sessions only, before commit)
151
-
152
- If this session is a feature (not a bug-fix-only commit), run `/prizmkit-retrospective` now — **before committing**.
153
- Retrospective must update relevant `.prizm-docs/` sections (TRAPS/RULES/DECISIONS) when applicable, so those changes are included in the feature commit.
154
- Stage any `.prizm-docs/` changes produced: `git add .prizm-docs/`
147
+ Doc maintenance pass condition (pipeline-enforced): `.prizm-docs/` changed in the final commit.
155
148
 
156
149
  ### Phase 5: Commit
157
150
 
158
- - Run `/prizmkit-summarize` → archive to REGISTRY.md
159
151
  - Run `/prizmkit-committer` → `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`, do NOT push
160
152
  - MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
161
153
  - Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
@@ -201,11 +193,11 @@ After writing `session-status.json`, verify repository is clean:
201
193
  git status --short
202
194
  ```
203
195
 
204
- If any files remain, include them in the last commit:
196
+ If any files remain (e.g. session-status.json), stage and create a follow-up commit:
205
197
 
206
198
  ```bash
207
199
  git add -A
208
- git commit --amend --no-edit
200
+ git commit -m "chore({{FEATURE_ID}}): include session artifacts"
209
201
  ```
210
202
 
211
203
  Re-check `git status --short` and ensure it is empty before exiting.
@@ -223,7 +215,7 @@ Re-check `git status --short` and ensure it is empty before exiting.
223
215
 
224
216
  ## Reminders
225
217
 
226
- - Tier 2: orchestrator builds context+plan, Dev implements, Reviewer reviews — no TeamCreate
218
+ - Tier 2: orchestrator builds context+plan, Dev implements, Reviewer reviews — use direct Task spawn or TeamCreate as appropriate
227
219
  - Build context-snapshot.md FIRST; all subagents read it instead of re-reading source files
228
220
  - Do NOT use `run_in_background=true` when spawning subagents
229
221
  - ALWAYS write session-status.json before exiting
@@ -13,7 +13,7 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
13
13
 
14
14
  **CRITICAL**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn subagents, wait for each to finish (run_in_background=false). Do NOT spawn agents in background and exit — that kills the session.
15
15
 
16
- **Tier 3 — Full Team**: Dev + Reviewer agents spawned directly via Task tool. Full 7-phase pipeline.
16
+ **Tier 3 — Full Team**: For complex features, create a coordinated agent team via TeamCreate. Use the full 7-phase pipeline with Dev + Reviewer agents.
17
17
 
18
18
  ### Feature Description
19
19
 
@@ -71,7 +71,6 @@ LLM context is frozen at prompt time. Modifying a skill source file during this
71
71
  .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes, all subagents read
72
72
  .prizmkit/specs/{{FEATURE_SLUG}}/spec.md
73
73
  .prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
74
- .prizmkit/specs/REGISTRY.md
75
74
  ```
76
75
 
77
76
  **`context-snapshot.md`** is the shared knowledge base. Orchestrator writes it once; Dev and Reviewer read it instead of re-scanning source files. This eliminates redundant I/O across all agents.
@@ -119,7 +118,7 @@ Save the list of **pre-existing failing tests** (if any) as `BASELINE_FAILURES`.
119
118
 
120
119
  ### Step 1: Team Setup
121
120
 
122
- No TeamCreate required. Agents are spawned directly via the `Task` tool using `subagent_type`.
121
+ Create a coordinated agent team for this feature session:
123
122
 
124
123
  1. Run init script:
125
124
  `python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
@@ -127,6 +126,11 @@ No TeamCreate required. Agents are spawned directly via the `Task` tool using `s
127
126
  2. Check for existing artifacts:
128
127
  `ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null`
129
128
 
129
+ 3. Create the agent team:
130
+ - Call `TeamCreate` with `team_name="prizm-dev-team-{{FEATURE_ID}}"` and `description="Implementing {{FEATURE_TITLE}}"`
131
+ - Reference team config at `{{TEAM_CONFIG_PATH}}` for agent definitions
132
+ - Spawn Dev and Reviewer agents as team members
133
+
130
134
  Agent files are at:
131
135
  - Dev: `{{DEV_SUBAGENT_PATH}}`
132
136
  - Reviewer: `{{REVIEWER_SUBAGENT_PATH}}`
@@ -287,7 +291,7 @@ Wait for Reviewer to return.
287
291
 
288
292
  **CP-3**: Integration tests pass, verdict is not NEEDS_FIXES.
289
293
 
290
- ### Phase 7: Summarize & Commit — DO NOT SKIP
294
+ ### Phase 7: Retrospective & Commit — DO NOT SKIP
291
295
 
292
296
  {{IF_MODE_SELF_EVOLVE}}
293
297
  **Framework Validation Gate (self-evolve mode)**:
@@ -310,7 +314,7 @@ bash {{VALIDATOR_SCRIPTS_DIR}}/validate-framework.sh
310
314
  Then set `"reload_needed": true` in session-status.json.
311
315
  {{END_IF_MODE_SELF_EVOLVE}}
312
316
 
313
- **For bug fixes**: skip `/prizmkit-summarize`, skip retrospective, and use `fix(<scope>):` commit prefix.
317
+ **For bug fixes**: run `/prizmkit-retrospective` for structural sync only (skip knowledge injection unless a new TRAPS was discovered). Use `fix(<scope>):` commit prefix.
314
318
 
315
319
  **7a.** Check if feature already committed:
316
320
  ```bash
@@ -319,21 +323,11 @@ git log --oneline | grep "{{FEATURE_ID}}" | head -3
319
323
  - If a commit for `{{FEATURE_ID}}` already exists → **skip 7c** (do NOT run /prizmkit-committer, do NOT run git reset, do NOT stage or unstage anything). Proceed directly to Step 3.
320
324
  - If no existing commit → proceed normally with 7a–7c.
321
325
 
322
- **7b.** Run `/prizmkit-summarize` archive to REGISTRY.md
323
-
324
- **7b.5.** Update prizm-docs (feature sessions):
325
- - Read the 'Implementation Log' in `context-snapshot.md` to identify changed files
326
- - For each changed file, check if any related `.prizm-docs/` L1/L2 doc needs updating (new APIs, changed behavior, new TRAPS)
327
- - Update `.prizm-docs/changelog.prizm`: append one-line entry `- feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`
328
- - Stage all modified prizm-docs: `git add .prizm-docs/`
329
- - Pipeline docs pass condition is `REGISTRY.md` OR `.prizm-docs/` changed in final commit
330
-
331
- **7b.6.** Run `/prizmkit-retrospective` (feature sessions only, **before commit**):
332
- - Extract lessons from completed feature — compare spec/plan/tasks vs actual
333
- - Update relevant `.prizm-docs/` sections: TRAPS, RULES, DECISIONS
334
- - Write `.prizmkit/specs/{{FEATURE_SLUG}}/retrospective.md`
335
- - Stage any `.prizm-docs/` changes: `git add .prizm-docs/`
336
- - **Skip if this session is bug-fix-only**
326
+ **7b.** Run `/prizmkit-retrospective` (**before commit**, the sole maintainer of `.prizm-docs/`):
327
+ - **Structural sync**: update KEY_FILES/INTERFACES/DEPENDENCIES/file counts for changed modules
328
+ - **Knowledge injection** (feature sessions only): extract TRAPS, RULES, DECISIONS from completed work
329
+ - Stage all doc changes: `git add .prizm-docs/`
330
+ - **For bug-fix sessions**: structural sync only, skip knowledge injection unless a genuinely new pitfall was discovered
337
331
 
338
332
  **7c.** Run `/prizmkit-committer` → `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`, do NOT push
339
333
 
@@ -383,18 +377,20 @@ After writing `session-status.json`, verify repository is clean:
383
377
  git status --short
384
378
  ```
385
379
 
386
- If any files remain, include them in the last commit:
380
+ If any files remain (e.g. session-status.json), stage and create a follow-up commit:
387
381
 
388
382
  ```bash
389
383
  git add -A
390
- git commit --amend --no-edit
384
+ git commit -m "chore({{FEATURE_ID}}): include session artifacts"
391
385
  ```
392
386
 
393
387
  Re-check `git status --short` and ensure it is empty before exiting.
394
388
 
395
389
  ## Step 4: Team Cleanup
396
390
 
397
- No team cleanup needed agents were spawned directly without TeamCreate.
391
+ Clean up the agent team created in Step 1:
392
+ - Call `TeamDelete` to remove the team and free resources
393
+ - Only call TeamDelete after all agents have completed and session-status.json is written
398
394
 
399
395
  ## Critical Paths
400
396
 
@@ -411,7 +407,7 @@ No team cleanup needed — agents were spawned directly without TeamCreate.
411
407
 
412
408
  ## Reminders
413
409
 
414
- - Tier 3: full team — Dev (implementation) → Reviewer (review) — agents spawned directly via Task tool (no TeamCreate needed)
410
+ - Tier 3: full team — Dev (implementation) → Reviewer (review) — create coordinated team via TeamCreate, clean up with TeamDelete at session end
415
411
  - context-snapshot.md is the team knowledge base: orchestrator writes it once, all agents read it
416
412
  - Do NOT use `run_in_background=true` when spawning agents
417
413
  - ALWAYS write session-status.json before exiting
@@ -21,14 +21,14 @@ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}
21
21
  **MANDATORY TEAM REQUIREMENT**: You MUST use the `prizm-dev-team` multi-agent team. This is NON-NEGOTIABLE. All implementation and review work MUST be performed by the appropriate team agents (Dev, Reviewer). You are the orchestrator — handle coordination, planning, and commit phases directly.
22
22
 
23
23
  **BUG FIX DOCUMENTATION POLICY**: Bug fixes MUST NOT be recorded as new documentation entries:
24
- - Do NOT run `/prizmkit-summarize` (no REGISTRY.md entries)
24
+ - Run `/prizmkit-retrospective` with structural sync only (Job 1) — skip knowledge injection unless a genuinely new TRAP was discovered
25
25
  - Do NOT create spec/plan/tasks under `.prizmkit/specs/`
26
26
  - Do NOT update `.prizm-docs/` module docs for pure bug fixes (unless TRAPS update is needed)
27
27
  - Commit with `fix(<scope>):` prefix, NOT `feat:`
28
28
 
29
29
  ### Team Definition Reference
30
30
 
31
- - **Source of truth**: `core/team/prizm-dev-team.json`
31
+ - **Source of truth**: `{{TEAM_CONFIG_PATH}}`
32
32
  - **Installed team config**: `{{TEAM_CONFIG_PATH}}`
33
33
 
34
34
  ### Bug Description
@@ -81,7 +81,7 @@ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}
81
81
  - If valid, reuse it. Set `TEAM_REUSED=true`
82
82
 
83
83
  2. **If no reusable team**, create a new one:
84
- - Reference `core/team/prizm-dev-team.json`
84
+ - Reference `{{TEAM_CONFIG_PATH}}`
85
85
  - Call `TeamCreate` with `team_name="prizm-dev-team-{{BUG_ID}}"` and `description="Fixing {{BUG_TITLE}}"`
86
86
  - Set `TEAM_REUSED=false`
87
87
 
@@ -211,7 +211,7 @@ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}
211
211
  1. Run `/prizmkit-committer` with:
212
212
  - Commit message: `fix({{FIX_SCOPE}}): {{BUG_TITLE}}`
213
213
  - Include both fix code and reproduction test
214
- - Do NOT run `/prizmkit-summarize`
214
+ - Do NOT run `/prizmkit-retrospective` with REGISTRY archiving
215
215
  - Do NOT push (user will push manually)
216
216
  2. If a new pitfall was discovered (not previously in TRAPS):
217
217
  - Update the affected module's TRAPS section in `.prizm-docs/`
@@ -267,7 +267,7 @@ Write to: `{{SESSION_STATUS_PATH}}`
267
267
 
268
268
  | Resource | Path |
269
269
  |----------|------|
270
- | Team Definition (source of truth) | `core/team/prizm-dev-team.json` |
270
+ | Team Definition (source of truth) | `{{TEAM_CONFIG_PATH}}` |
271
271
  | Team Config (installed) | `{{TEAM_CONFIG_PATH}}` |
272
272
  | Bug Fix Artifacts Dir | `.prizmkit/bugfix/{{BUG_ID}}/` |
273
273
  | Fix Plan | `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md` |
@@ -282,7 +282,7 @@ Write to: `{{SESSION_STATUS_PATH}}`
282
282
  - **MANDATORY**: Use `prizm-dev-team` — single-agent execution is FORBIDDEN
283
283
  - **Only 2 artifact files per bug**: fix-plan.md + fix-report.md — NEVER more
284
284
  - **Do NOT create** spec.md, plan.md, or tasks.md for bug fixes
285
- - **Do NOT run** `/prizmkit-summarize` (no REGISTRY.md entries for bugs)
285
+ - **Do NOT run** `/prizmkit-retrospective` knowledge injection for bugs (structural sync only, unless genuinely new TRAP discovered)
286
286
  - **Commit with** `fix(<scope>):` prefix, NOT `feat:`
287
287
  - **Update TRAPS** in `.prizm-docs/` only if a genuinely new pitfall was discovered
288
288
  - Dev agents use TDD approach: reproduction test goes from RED → GREEN