prizmkit 1.0.45 → 1.0.66

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 (67) 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 +3 -3
  4. package/bundled/agents/prizm-dev-team-dev.md +1 -1
  5. package/bundled/dev-pipeline/README.md +6 -8
  6. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +24 -19
  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/generate-bootstrap-prompt.py +17 -4
  13. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +2 -2
  14. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +16 -27
  15. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +20 -32
  16. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +32 -53
  17. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +29 -41
  18. package/bundled/dev-pipeline/templates/session-status-schema.json +1 -1
  19. package/bundled/dev-pipeline/tests/conftest.py +19 -126
  20. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +207 -0
  21. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +128 -141
  22. package/bundled/dev-pipeline/tests/test_utils.py +51 -110
  23. package/bundled/rules/prizm/prizm-commit-workflow.md +3 -3
  24. package/bundled/skills/_metadata.json +15 -16
  25. package/bundled/skills/app-planner/SKILL.md +8 -7
  26. package/bundled/skills/bug-fix-workflow/SKILL.md +171 -0
  27. package/bundled/skills/bug-planner/SKILL.md +25 -33
  28. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +156 -0
  29. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +5 -7
  30. package/bundled/skills/dev-pipeline-launcher/SKILL.md +4 -6
  31. package/bundled/skills/feature-workflow/SKILL.md +25 -42
  32. package/bundled/skills/prizm-kit/SKILL.md +61 -23
  33. package/bundled/skills/prizm-kit/assets/{claude-md-template.md → project-memory-template.md} +3 -3
  34. package/bundled/skills/prizmkit-analyze/SKILL.md +44 -33
  35. package/bundled/skills/prizmkit-clarify/SKILL.md +40 -30
  36. package/bundled/skills/prizmkit-code-review/SKILL.md +58 -45
  37. package/bundled/skills/prizmkit-committer/SKILL.md +30 -68
  38. package/bundled/skills/prizmkit-implement/SKILL.md +60 -28
  39. package/bundled/skills/prizmkit-init/SKILL.md +57 -66
  40. package/bundled/skills/prizmkit-plan/SKILL.md +60 -23
  41. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +74 -19
  42. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +23 -23
  43. package/bundled/skills/prizmkit-retrospective/SKILL.md +142 -65
  44. package/bundled/skills/prizmkit-retrospective/assets/retrospective-template.md +13 -0
  45. package/bundled/skills/prizmkit-specify/SKILL.md +69 -15
  46. package/bundled/skills/refactor-workflow/SKILL.md +116 -52
  47. package/bundled/team/prizm-dev-team.json +2 -2
  48. package/package.json +1 -1
  49. package/src/scaffold.js +4 -4
  50. package/bundled/dev-pipeline/lib/worktree.sh +0 -164
  51. package/bundled/dev-pipeline/tests/__init__.py +0 -0
  52. package/bundled/dev-pipeline/tests/test_check_session.py +0 -131
  53. package/bundled/dev-pipeline/tests/test_cleanup_logs.py +0 -119
  54. package/bundled/dev-pipeline/tests/test_detect_stuck.py +0 -207
  55. package/bundled/dev-pipeline/tests/test_generate_prompt.py +0 -190
  56. package/bundled/dev-pipeline/tests/test_init_bugfix_pipeline.py +0 -153
  57. package/bundled/dev-pipeline/tests/test_init_pipeline.py +0 -241
  58. package/bundled/dev-pipeline/tests/test_update_bug_status.py +0 -142
  59. package/bundled/dev-pipeline/tests/test_update_feature_status.py +0 -338
  60. package/bundled/dev-pipeline/tests/test_worktree.py +0 -236
  61. package/bundled/dev-pipeline/tests/test_worktree_integration.py +0 -796
  62. package/bundled/skills/prizm-kit/assets/codebuddy-md-template.md +0 -35
  63. package/bundled/skills/prizm-kit/assets/hooks/prizm-commit-hook.json +0 -15
  64. package/bundled/skills/prizmkit-summarize/SKILL.md +0 -51
  65. package/bundled/skills/prizmkit-summarize/assets/registry-template.md +0 -18
  66. package/bundled/templates/hooks/commit-intent-claude.json +0 -26
  67. /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))
@@ -344,16 +344,16 @@ def detect_init_status(project_root):
344
344
  def detect_existing_artifacts(project_root, feature_slug):
345
345
  """Check which planning artifacts already exist for this feature.
346
346
 
347
- Returns a dict with keys: has_spec, has_plan, has_tasks, all_complete.
347
+ Returns a dict with keys: has_spec, has_plan, all_complete.
348
+ Tasks are now part of plan.md (Tasks section), not a separate file.
348
349
  """
349
350
  specs_dir = os.path.join(project_root, ".prizmkit", "specs", feature_slug)
350
351
  result = {
351
352
  "has_spec": os.path.isfile(os.path.join(specs_dir, "spec.md")),
352
353
  "has_plan": os.path.isfile(os.path.join(specs_dir, "plan.md")),
353
- "has_tasks": os.path.isfile(os.path.join(specs_dir, "tasks.md")),
354
354
  }
355
355
  result["all_complete"] = all([
356
- result["has_spec"], result["has_plan"], result["has_tasks"]
356
+ result["has_spec"], result["has_plan"]
357
357
  ])
358
358
  return result
359
359
 
@@ -414,6 +414,20 @@ def build_replacements(args, feature, features, global_context, script_dir):
414
414
  reviewer_subagent = os.path.join(
415
415
  agents_dir, "prizm-dev-team-reviewer.md",
416
416
  )
417
+
418
+ # Verify agent files actually exist — missing files cause confusing
419
+ # errors when the AI session tries to read them later.
420
+ for agent_path, agent_name in [
421
+ (dev_subagent, "dev agent"),
422
+ (reviewer_subagent, "reviewer agent"),
423
+ ]:
424
+ if not os.path.isfile(agent_path):
425
+ LOGGER.warning(
426
+ "Agent file not found: %s (%s). "
427
+ "Subagent spawning may fail. "
428
+ "Run `npx prizmkit install` to reinstall agent definitions.",
429
+ agent_path, agent_name,
430
+ )
417
431
  # Validator scripts - check if they exist in .codebuddy/scripts/, otherwise use dev-pipeline/scripts/
418
432
  validator_scripts_dir = os.path.join(project_root, "dev-pipeline", "scripts")
419
433
  init_script_path = os.path.join(validator_scripts_dir, "init-dev-team.py")
@@ -481,7 +495,6 @@ def build_replacements(args, feature, features, global_context, script_dir):
481
495
  "{{INIT_DONE}}": "true" if init_done else "false",
482
496
  "{{HAS_SPEC}}": "true" if artifacts["has_spec"] else "false",
483
497
  "{{HAS_PLAN}}": "true" if artifacts["has_plan"] else "false",
484
- "{{HAS_TASKS}}": "true" if artifacts["has_tasks"] else "false",
485
498
  "{{ARTIFACTS_COMPLETE}}": "true" if artifacts["all_complete"] else "false",
486
499
  "{{IS_SELF_EVOLVE}}": "true" if is_self_evolve else "false",
487
500
  }
@@ -28,11 +28,11 @@ from datetime import datetime, timezone
28
28
  # Phase keywords for detection
29
29
  PHASE_KEYWORDS = {
30
30
  "specify": ["prizmkit-specify", "spec.md", "specification", "gathering requirements"],
31
- "plan": ["prizmkit-plan", "plan.md", "architecture", "design plan", "task checklist", "task breakdown", "tasks.md"],
31
+ "plan": ["prizmkit-plan", "plan.md", "architecture", "design plan", "task checklist", "task breakdown"],
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
 
@@ -5,7 +5,7 @@
5
5
  - **Feature ID**: {{FEATURE_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
6
6
  - **Complexity**: {{COMPLEXITY}} | **Retry**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
7
7
  - **Previous Status**: {{PREV_SESSION_STATUS}} | **Resume From**: {{RESUME_PHASE}}
8
- - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}} tasks={{HAS_TASKS}}
8
+ - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}}
9
9
 
10
10
  ## Your Mission
11
11
 
@@ -35,9 +35,7 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
35
35
 
36
36
  ```
37
37
  .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md
38
- .prizmkit/specs/{{FEATURE_SLUG}}/plan.md
39
- .prizmkit/specs/{{FEATURE_SLUG}}/tasks.md
40
- .prizmkit/specs/REGISTRY.md
38
+ .prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
41
39
  ```
42
40
 
43
41
  ---
@@ -81,19 +79,18 @@ If MISSING — build it now:
81
79
  ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null
82
80
  ```
83
81
 
84
- If plan.md or tasks.md missing, write them directly:
85
- - `plan.md`: key components, data flow, files to create/modify (under 80 lines)
86
- - `tasks.md`: checklist with `[ ]` checkboxes, each task = one implementable unit
82
+ If plan.md missing, write it directly:
83
+ - `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.
87
84
 
88
- **CP-1**: plan.md and tasks.md exist.
85
+ **CP-1**: plan.md exists with Tasks section.
89
86
 
90
87
  ### Phase 3: Implement
91
88
 
92
- For each task in tasks.md:
89
+ For each task in plan.md Tasks section:
93
90
  1. Read the relevant section from `context-snapshot.md` (no need to re-read individual files)
94
91
  2. Write/edit the code
95
92
  3. Run tests after each task
96
- 4. Mark task `[x]` in tasks.md immediately
93
+ 3. Mark task `[x]` in plan.md Tasks section immediately
97
94
 
98
95
  After all tasks complete, append to `context-snapshot.md`:
99
96
  ```
@@ -111,24 +108,17 @@ Key decisions: [list]
111
108
 
112
109
  **CP-2**: All acceptance criteria met, tests pass.
113
110
 
114
- ### Phase 4.5: Prizm Doc Update (mandatory for feature sessions)
111
+ ### Phase 4.5: Memory Maintenance (mandatory before commit)
115
112
 
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
113
+ Run `/prizmkit-retrospective` the **sole maintainer** of `.prizm-docs/`:
114
+ 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
115
+ 2. **Knowledge injection** (feature sessions only): Extract TRAPS/RULES/DECISIONS from completed work into `.prizm-docs/`
116
+ 3. Stage all doc changes: `git add .prizm-docs/`
120
117
 
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/`
118
+ Doc maintenance pass condition (pipeline-enforced): `.prizm-docs/` changed in the final commit.
128
119
 
129
120
  ### Phase 5: Commit
130
121
 
131
- - Run `/prizmkit-summarize` → archive to REGISTRY.md
132
122
  - Run `/prizmkit-committer` → `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`, do NOT push
133
123
  - MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
134
124
  - Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
@@ -158,8 +148,7 @@ Write to: `{{SESSION_STATUS_PATH}}`
158
148
  "retrospective_done": true,
159
149
  "artifacts": {
160
150
  "context_snapshot_path": ".prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md",
161
- "plan_path": ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md",
162
- "tasks_path": ".prizmkit/specs/{{FEATURE_SLUG}}/tasks.md"
151
+ "plan_path": ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md"
163
152
  },
164
153
  "git_commit": "<commit hash>",
165
154
  "timestamp": "2026-03-04T10:00:00Z"
@@ -174,11 +163,11 @@ After writing `session-status.json`, verify repository is clean:
174
163
  git status --short
175
164
  ```
176
165
 
177
- If any files remain, include them in the last commit:
166
+ If any files remain (e.g. session-status.json), stage and create a follow-up commit:
178
167
 
179
168
  ```bash
180
169
  git add -A
181
- git commit --amend --no-edit
170
+ git commit -m "chore({{FEATURE_ID}}): include session artifacts"
182
171
  ```
183
172
 
184
173
  Re-check `git status --short` and ensure it is empty before exiting.
@@ -5,7 +5,7 @@
5
5
  - **Feature ID**: {{FEATURE_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
6
6
  - **Complexity**: {{COMPLEXITY}} | **Retry**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
7
7
  - **Previous Status**: {{PREV_SESSION_STATUS}} | **Resume From**: {{RESUME_PHASE}}
8
- - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}} tasks={{HAS_TASKS}}
8
+ - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}}
9
9
 
10
10
  ## Your Mission
11
11
 
@@ -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. Spawn Dev and Reviewer agents via the Agent tool.
17
17
 
18
18
  ### Feature Description
19
19
 
@@ -35,9 +35,7 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
35
35
 
36
36
  ```
37
37
  .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← written by you, read by Dev + Reviewer
38
- .prizmkit/specs/{{FEATURE_SLUG}}/plan.md
39
- .prizmkit/specs/{{FEATURE_SLUG}}/tasks.md
40
- .prizmkit/specs/REGISTRY.md
38
+ .prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
41
39
  ```
42
40
 
43
41
  **`context-snapshot.md`** is the shared knowledge base. You write it once; Dev and Reviewer read it instead of re-scanning individual files.
@@ -89,25 +87,23 @@ If MISSING — build it now:
89
87
  ### Phase 2: Plan & Tasks (you, the orchestrator)
90
88
 
91
89
  ```bash
92
- ls .prizmkit/specs/{{FEATURE_SLUG}}/plan.md .prizmkit/specs/{{FEATURE_SLUG}}/tasks.md 2>/dev/null
90
+ ls .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null
93
91
  ```
94
92
 
95
93
  If either missing, write them yourself:
96
- - `plan.md`: architecture — components, interfaces, data flow, files to create/modify, testing approach
97
- - `tasks.md`: checklist with `[ ]` checkboxes ordered by dependency
98
-
99
- **CP-1**: plan.md and tasks.md exist.
94
+ - `plan.md`: architecture — components, interfaces, data flow, files to create/modify, testing approach, and a Tasks section with `[ ]` checkboxes ordered by dependency
95
+ **CP-1**: plan.md exists with Tasks section.
100
96
 
101
97
  ### Phase 3: Implement — Dev Subagent
102
98
 
103
- Spawn Dev subagent (Task tool, subagent_type="prizm-dev-team-dev", run_in_background=false).
99
+ Spawn Dev subagent (Agent tool, subagent_type="prizm-dev-team-dev", run_in_background=false).
104
100
 
105
101
  Prompt:
106
102
  > "Read {{DEV_SUBAGENT_PATH}}. Implement feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
107
103
  >
108
104
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — all project context, source files, and tests are embedded there. Do NOT re-read individual source files.
109
- > 2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` and `.prizmkit/specs/{{FEATURE_SLUG}}/tasks.md`.
110
- > 3. Implement task-by-task using TDD. Mark each task `[x]` in tasks.md immediately after completion.
105
+ > 2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` (including Tasks section).
106
+ > 3. Implement task-by-task using TDD. Mark each task `[x]` in plan.md Tasks section immediately after completion.
111
107
  > 4. After ALL tasks complete, append an 'Implementation Log' section to `context-snapshot.md`:
112
108
  > - Files created/modified (with paths)
113
109
  > - Key implementation decisions
@@ -118,7 +114,7 @@ Wait for Dev to return. All tasks must be `[x]`, tests pass.
118
114
 
119
115
  ### Phase 4: Review — Reviewer Subagent
120
116
 
121
- Spawn Reviewer subagent (Task tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
117
+ Spawn Reviewer subagent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
122
118
 
123
119
  Prompt:
124
120
  > "Read {{REVIEWER_SUBAGENT_PATH}}. Review feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
@@ -138,24 +134,17 @@ Wait for Reviewer to return.
138
134
 
139
135
  **CP-2**: Tests pass, verdict is not NEEDS_FIXES.
140
136
 
141
- ### Phase 4.5: Prizm Doc Update (mandatory for feature sessions)
142
-
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
147
-
148
- Doc maintenance pass condition (pipeline-enforced): `REGISTRY.md` **or** `.prizm-docs/` changed in the final commit.
137
+ ### Phase 4.5: Memory Maintenance (mandatory before commit)
149
138
 
150
- ### Phase 4.7: Retrospective (feature sessions only, before commit)
139
+ Run `/prizmkit-retrospective` the **sole maintainer** of `.prizm-docs/`:
140
+ 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
141
+ 2. **Knowledge injection** (feature sessions only): Extract TRAPS/RULES/DECISIONS from completed work into `.prizm-docs/`
142
+ 3. Stage all doc changes: `git add .prizm-docs/`
151
143
 
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/`
144
+ Doc maintenance pass condition (pipeline-enforced): `.prizm-docs/` changed in the final commit.
155
145
 
156
146
  ### Phase 5: Commit
157
147
 
158
- - Run `/prizmkit-summarize` → archive to REGISTRY.md
159
148
  - Run `/prizmkit-committer` → `feat({{FEATURE_ID}}): {{FEATURE_TITLE}}`, do NOT push
160
149
  - MANDATORY: commit must be done via `/prizmkit-committer` skill. Do NOT run manual `git add`/`git commit` as a substitute.
161
150
  - Do NOT run `update-feature-status.py` here — the pipeline runner handles feature-list.json updates automatically after session exit.
@@ -185,8 +174,7 @@ Write to: `{{SESSION_STATUS_PATH}}`
185
174
  "retrospective_done": true,
186
175
  "artifacts": {
187
176
  "context_snapshot_path": ".prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md",
188
- "plan_path": ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md",
189
- "tasks_path": ".prizmkit/specs/{{FEATURE_SLUG}}/tasks.md"
177
+ "plan_path": ".prizmkit/specs/{{FEATURE_SLUG}}/plan.md"
190
178
  },
191
179
  "git_commit": "<commit hash>",
192
180
  "timestamp": "2026-03-04T10:00:00Z"
@@ -201,11 +189,11 @@ After writing `session-status.json`, verify repository is clean:
201
189
  git status --short
202
190
  ```
203
191
 
204
- If any files remain, include them in the last commit:
192
+ If any files remain (e.g. session-status.json), stage and create a follow-up commit:
205
193
 
206
194
  ```bash
207
195
  git add -A
208
- git commit --amend --no-edit
196
+ git commit -m "chore({{FEATURE_ID}}): include session artifacts"
209
197
  ```
210
198
 
211
199
  Re-check `git status --short` and ensure it is empty before exiting.
@@ -223,7 +211,7 @@ Re-check `git status --short` and ensure it is empty before exiting.
223
211
 
224
212
  ## Reminders
225
213
 
226
- - Tier 2: orchestrator builds context+plan, Dev implements, Reviewer reviews — no TeamCreate
214
+ - Tier 2: orchestrator builds context+plan, Dev implements, Reviewer reviews — use direct Agent spawn for agents
227
215
  - Build context-snapshot.md FIRST; all subagents read it instead of re-reading source files
228
216
  - Do NOT use `run_in_background=true` when spawning subagents
229
217
  - ALWAYS write session-status.json before exiting