prizmkit 1.1.130 → 1.1.134

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 (119) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/command-adapter.js +0 -2
  3. package/bundled/dev-pipeline/.env.example +1 -1
  4. package/bundled/dev-pipeline/assets/skill-subagent-integration.md +11 -6
  5. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +445 -8
  6. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +2 -9
  7. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +21 -1
  8. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +87 -66
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +53 -3
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +55 -25
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +4 -0
  12. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +119 -18
  13. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +3 -2
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +411 -17
  15. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +57 -14
  16. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +5 -4
  17. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +55 -2
  18. package/bundled/dev-pipeline/scripts/prompt_framework.py +152 -1
  19. package/bundled/dev-pipeline/scripts/update-bug-status.py +53 -0
  20. package/bundled/dev-pipeline/scripts/update-checkpoint.py +294 -69
  21. package/bundled/dev-pipeline/scripts/update-feature-status.py +57 -0
  22. package/bundled/dev-pipeline/scripts/update-refactor-status.py +53 -0
  23. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +5 -5
  24. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +28 -22
  25. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +24 -10
  26. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +20 -2
  27. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +2 -2
  28. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
  29. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +5 -10
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +9 -19
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +21 -0
  32. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +1 -1
  33. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +10 -10
  34. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  35. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +15 -0
  36. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +2 -2
  37. package/bundled/dev-pipeline/templates/sections/phase-commit.md +2 -2
  38. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +26 -23
  39. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +5 -5
  40. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +15 -11
  41. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +1 -1
  42. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +6 -6
  43. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +21 -0
  44. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
  45. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
  46. package/bundled/dev-pipeline/templates/sections/task-contract.md +4 -0
  47. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +362 -3
  48. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +349 -48
  49. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +129 -0
  50. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +91 -0
  51. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +567 -23
  52. package/bundled/dev-pipeline/tests/test_unified_cli.py +37 -10
  53. package/bundled/skills/_metadata.json +63 -26
  54. package/bundled/skills/app-planner/SKILL.md +4 -3
  55. package/bundled/skills/bug-fix-workflow/SKILL.md +89 -180
  56. package/bundled/skills/bug-planner/SKILL.md +12 -27
  57. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +131 -220
  58. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +36 -90
  59. package/bundled/skills/feature-pipeline-launcher/SKILL.md +129 -271
  60. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +35 -76
  61. package/bundled/skills/feature-planner/SKILL.md +27 -22
  62. package/bundled/skills/feature-planner/assets/planning-guide.md +4 -4
  63. package/bundled/skills/feature-workflow/SKILL.md +94 -121
  64. package/bundled/skills/prizmkit/SKILL.md +130 -94
  65. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +181 -0
  66. package/bundled/skills/prizmkit-code-review/SKILL.md +132 -86
  67. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +243 -0
  68. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +42 -1
  69. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +181 -0
  70. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +93 -1
  71. package/bundled/skills/prizmkit-committer/SKILL.md +125 -48
  72. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +181 -0
  73. package/bundled/skills/prizmkit-implement/SKILL.md +99 -73
  74. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +1 -1
  75. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +181 -0
  76. package/bundled/skills/prizmkit-init/SKILL.md +5 -5
  77. package/bundled/skills/prizmkit-plan/SKILL.md +146 -105
  78. package/bundled/skills/prizmkit-plan/assets/plan-template.md +18 -0
  79. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +242 -0
  80. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +4 -4
  81. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +181 -0
  82. package/bundled/skills/prizmkit-retrospective/SKILL.md +111 -53
  83. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +7 -6
  84. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +5 -4
  85. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +181 -0
  86. package/bundled/skills/prizmkit-test/SKILL.md +52 -6
  87. package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +63 -12
  88. package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +1 -1
  89. package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +13 -0
  90. package/bundled/skills/prizmkit-test/references/evidence-protocol.md +6 -1
  91. package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +8 -1
  92. package/bundled/skills/prizmkit-test/references/examples.md +1 -1
  93. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +4 -1
  94. package/bundled/skills/prizmkit-test/references/test-report-template.md +1 -1
  95. package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +15 -0
  96. package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +181 -0
  97. package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +744 -23
  98. package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +194 -15
  99. package/bundled/skills/prizmkit-workflow/SKILL.md +266 -0
  100. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +181 -0
  101. package/bundled/skills/recovery-workflow/SKILL.md +62 -241
  102. package/bundled/skills/recovery-workflow/evals/evals.json +17 -33
  103. package/bundled/skills/recovery-workflow/references/detection.md +28 -52
  104. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +105 -439
  105. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +136 -275
  106. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +53 -88
  107. package/bundled/skills/refactor-planner/SKILL.md +12 -57
  108. package/bundled/skills/refactor-planner/references/behavior-preservation.md +111 -230
  109. package/bundled/skills/refactor-planner/references/error-recovery.md +37 -0
  110. package/bundled/skills/refactor-planner/references/planning-phases.md +11 -17
  111. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +1 -1
  112. package/bundled/skills/refactor-workflow/SKILL.md +98 -139
  113. package/bundled/templates/project-memory-template.md +4 -4
  114. package/package.json +1 -1
  115. package/src/index.js +4 -0
  116. package/src/prompts.js +10 -3
  117. package/src/scaffold.js +1 -1
  118. package/bundled/dev-pipeline/tests/test-deploy-safety.sh +0 -223
  119. package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
@@ -1,338 +1,199 @@
1
1
  ---
2
2
  name: "refactor-pipeline-launcher"
3
- description: "Launch and manage the refactor pipeline from within an AI CLI session. Start pipeline in background, monitor logs, check status, stop pipeline. Use this skill whenever the user wants to start refactoring, run the refactor pipeline, check refactor progress, retry refactors, or stop the pipeline. Trigger on: 'run refactor pipeline', 'start refactoring', 'refactor pipeline status', 'stop refactor pipeline', 'retry refactor', 'launch refactor pipeline'. (project)"
3
+ description: "Build refactor-pipeline commands from a validated .prizmkit/plans/refactor-list.json without executing them. Produces foreground or background-daemon start commands plus status, logs, stop, and safe retry commands. Use whenever the user wants to start a prepared refactor list, construct a refactor command, configure strict behavior checks, inspect refactor status, view logs, stop a run, retry a refactor, or clean retry R-001. Trigger on: 'run refactor pipeline', 'start refactoring', 'refactor status', 'refactor logs', 'stop refactor pipeline', 'retry refactor'."
4
4
  ---
5
5
 
6
- # Refactor Pipeline Launcher
6
+ # Refactor Pipeline Command Builder
7
7
 
8
- Launch the autonomous refactor pipeline from within an AI CLI conversation. Only Background daemon mode is fully detached and survives AI CLI session closure; Foreground runs in the current session, and Manual prints commands without launching.
8
+ Build commands for the autonomous refactor pipeline from within an AI CLI conversation. This skill reads configuration and planning inputs, asks only the choices needed to construct an accurate command, displays the command and its effects, then stops.
9
9
 
10
- ### Execution Mode
10
+ ## Command-Only Boundary
11
11
 
12
- Three execution modes are available. The user chooses one before configuring other options:
12
+ This skill:
13
13
 
14
- 1. **Foreground** (recommended) `python3 ./.prizmkit/dev-pipeline/cli.py refactor run`. Visible output, direct error feedback, no orphaned processes.
15
- 2. **Background daemon** `python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json`. Runs fully detached, survives AI CLI session closure.
16
- 3. **Manual** — Display the assembled command(s) only. Do not execute anything. User runs them on their own.
14
+ - reads a validated refactor list and relevant configuration;
15
+ - builds prerequisite-check, optional baseline-check, start, status, logs, stop, and retry commands;
16
+ - explains command effects and destructive options before returning them;
17
+ - never executes shell commands, starts processes, follows logs, changes pipeline state, refactors source code, runs tests, or performs verification.
17
18
 
18
- ### When to Use
19
+ Do not invoke another workflow or implementation skill from this command builder. The user decides where and when to run the returned command.
19
20
 
20
- **Start pipeline** -- User says:
21
- - "run refactor pipeline", "start refactoring", "launch refactor pipeline"
22
- - "execute refactor list", "refactor all", "start refactoring tasks"
23
- - After refactor-planner completes: "refactor it", "start refactoring from the list"
21
+ ## When to Use
24
22
 
25
- **Check status** -- User says:
26
- - "refactor pipeline status", "refactor progress", "check refactoring"
27
- - "how's the refactoring going", "refactor status"
23
+ Use this skill for:
28
24
 
29
- **Stop pipeline** -- User says:
30
- - "stop refactor pipeline", "stop refactoring", "halt refactor", "pause refactoring"
25
+ - constructing a foreground or background-daemon refactor pipeline command;
26
+ - selecting strict behavior-check configuration;
27
+ - constructing status, logs, stop, or retry commands;
28
+ - translating user-selected runtime options into environment variables.
31
29
 
32
- **Show logs** -- User says:
33
- - "refactor logs", "show refactor logs", "what's being refactored"
34
- - "view refactor logs"
30
+ Do not use it to:
35
31
 
36
- **Retry single refactor** -- User says:
37
- - "retry R-001", "retry this refactor", "re-run R-001"
32
+ - create or modify `.prizmkit/plans/refactor-list.json` use `refactor-planner`;
33
+ - perform a refactor in the current conversation;
34
+ - execute a baseline test, monitor a run, or verify behavior preservation.
38
35
 
39
- **Do NOT use this skill when:**
40
- - User wants to plan refactoring (use `refactor-planner` instead)
41
- - User wants a single interactive refactor in current session (use `refactor-workflow` — but note it will delegate back here for batch execution)
42
- - User wants to implement features (use `feature-pipeline-launcher`)
36
+ ## Inputs
43
37
 
44
- ### Prerequisites
38
+ Default paths:
45
39
 
46
- Before any action, validate:
40
+ - Runtime CLI: `.prizmkit/dev-pipeline/cli.py`
41
+ - Refactor plan: `.prizmkit/plans/refactor-list.json`
47
42
 
48
- 1. **refactor pipeline exists**: Confirm `.prizmkit/dev-pipeline/cli.py` is present
49
- 2. **For start**: `.prizmkit/plans/refactor-list.json` must exist in `.prizmkit/plans/` (or user-specified path)
50
- 3. **Dependencies**: `python3`, `git`, and the configured AI CLI must be in PATH. Resolve and report the AI CLI from `AI_CLI` env, then `.prizmkit/config.json` `ai_cli`, then fallback to `claude` only when neither is configured. Read `${SKILL_DIR}/references/configuration.md` §Configured AI CLI Prerequisite Check before running the AI CLI check.
51
- 4. **Python version**: Requires Python 3.10+ for the unified dev-pipeline runtime
52
- 5. **Browser tools** (optional): If any refactor has `browser_interaction` field, check the corresponding tool is available. Refactors may specify `tool: "playwright-cli"`, `tool: "opencli"`, or `tool: "auto"` (AI chooses at runtime).
43
+ Accept a user-specified refactor-list path when provided. Read the plan directly to summarize IDs, types, dependencies, preservation strategies, and current statuses. If the plan is missing or malformed, report that a valid refactor plan is required and stop without constructing a start command.
44
+
45
+ Read `${SKILL_DIR}/references/configuration.md` before constructing prerequisite, baseline, or runtime option fragments.
46
+
47
+ ## Intent Routing
48
+
49
+ | Intent | Output |
50
+ |---|---|
51
+ | Start prepared refactors | Prerequisite/baseline command suggestions plus one start command |
52
+ | Check status | Daemon status and item-level status commands |
53
+ | Show logs | Recent or follow-log command |
54
+ | Stop | Daemon stop command plus optional status command |
55
+ | Retry one refactor | Standard or clean reset-and-run command with safety disclosure |
56
+
57
+ Only the start intent uses the execution-mode and configuration rounds.
58
+
59
+ ## Start Command Workflow
60
+
61
+ ### Step 1: Resolve inputs
62
+
63
+ 1. Resolve the refactor-list path.
64
+ 2. Read the list and summarize total, eligible, blocked, and selected refactor IDs.
65
+ 3. Summarize the declared behavior-preservation strategies without running them.
66
+ 4. If an existing run is suspected from user context, include a status command in the output; do not run it.
67
+
68
+ ### Step 2: Build optional baseline suggestions
69
+
70
+ Because refactoring depends on a known baseline, include commands the user can run before the pipeline command:
53
71
 
54
- Quick check:
55
72
  ```bash
56
- command -v python3 >/dev/null && command -v git >/dev/null && echo "Core dependencies OK"
57
- # AI CLI check: read `${SKILL_DIR}/references/configuration.md` §Configured AI CLI Prerequisite Check.
58
- # It must print `Configured AI CLI: <name>` and verify that exact executable.
59
- # Optional: browser interaction support (check both tools — refactors may use either)
60
- command -v playwright-cli && echo "playwright-cli OK" || echo "playwright-cli not found (playwright browser verification will be skipped)"
61
- command -v opencli && echo "opencli OK" || echo "opencli not found (opencli browser verification will be skipped)"
73
+ git status --short
62
74
  ```
63
75
 
64
- If `.prizmkit/plans/refactor-list.json` is missing, inform user:
65
- > "No .prizmkit/plans/refactor-list.json found. Run the `refactor-planner` skill first to generate one, or provide a path to your refactor list."
76
+ If the project instruction files or package metadata name a baseline test command, display that exact command. Otherwise state that no baseline command was discovered and ask the user whether they want to provide one. Do not infer and run a test command.
66
77
 
67
- ### Workflow
78
+ ### Step 3: Ask execution mode
68
79
 
69
- Detect user intent from their message, then follow the corresponding workflow:
80
+ Use one `AskUserQuestion` call with exactly one question:
70
81
 
71
- ---
82
+ - **Foreground (Recommended)** — build `refactor run`; output remains attached to the user's terminal.
83
+ - **Background daemon** — build `daemon refactor start`; the runtime manages detached execution and logs.
72
84
 
73
- #### Intent A: Start Pipeline
74
-
75
- > **Execution model**: The pipeline processes eligible refactor tasks one at a time. The `dependencies` field is active: dependencies must complete before dependents are selected. Among unrelated eligible refactors, stable list order determines selection.
76
-
77
- 1. **Check prerequisites**:
78
- ```bash
79
- ls .prizmkit/plans/refactor-list.json 2>/dev/null && echo "Found" || echo "Missing"
80
- ```
85
+ Wait for the response before asking configuration.
81
86
 
82
- 2. **Check not already running**:
83
- ```bash
84
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status 2>/dev/null
85
- ```
86
- If running, inform user and ask: "Refactor pipeline is already running. Want to restart it, check status, or view logs?"
87
-
88
- 3. **Show refactor summary** (so user knows what will be refactored):
89
- ```bash
90
- python3 -c "
91
- import json
92
- with open('.prizmkit/plans/refactor-list.json') as f:
93
- data = json.load(f)
94
- refactors = data.get('refactors', [])
95
- print(f'Total refactor tasks: {len(refactors)}')
96
- type_counts = {}
97
- for r in refactors:
98
- t = r.get('type', 'unknown')
99
- type_counts[t] = type_counts.get(t, 0) + 1
100
- if type_counts:
101
- print(f'By type: {dict(sorted(type_counts.items()))}')
102
- print()
103
- priority_order = {'critical': 0, 'high': 1, 'medium': 2, 'low': 3}
104
- refactors_sorted = sorted(refactors, key=lambda r: (priority_order.get(r.get('priority', 'medium'), 2), r.get('id', '')))
105
- for r in refactors_sorted:
106
- print(f\" {r['id']}: [{r.get('priority','medium').upper()}] [{r.get('type','?')}] {r.get('title', 'untitled')}\")
107
- "
108
- ```
109
- If pipeline state already exists, use the status command instead:
110
- ```bash
111
- python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
112
- ```
113
-
114
- 4. **Run preflight checks** (behavior-preservation baseline):
115
-
116
- Before refactoring, verify the codebase is in a clean, testable state:
117
- ```bash
118
- # Check git working tree is clean
119
- git status --porcelain | head -5
120
-
121
- # Detect the likely baseline test command
122
- python3 - <<'PY'
123
- from pathlib import Path
124
- if Path('package.json').exists():
125
- print('Detected package.json; use the project test script if configured')
126
- elif Path('pytest.ini').exists() or Path('pyproject.toml').exists():
127
- print('Detected Python project; use pytest if configured')
128
- elif Path('go.mod').exists():
129
- print('Detected Go project; use go test ./...')
130
- else:
131
- print('No obvious test command detected; ask the user for the baseline command')
132
- PY
133
- ```
134
-
135
- Use the detected command, an existing project convention, or a user-provided command to establish the baseline before launch.
136
-
137
- If git working tree is dirty, warn the user:
138
- > "Working tree has uncommitted changes. It's recommended to commit or stash changes before starting refactoring so each refactor task has a clean baseline. Continue anyway?"
139
-
140
- If no baseline command is detected, warn and ask the user for the correct command or explicit permission to continue without an automated baseline.
141
-
142
- If test baseline fails, warn the user:
143
- > "Test suite is not passing. Refactoring relies on tests to verify behavior preservation. Fix failing tests before starting the refactor pipeline, or continue at your own risk."
144
-
145
- Wait for user confirmation before proceeding.
146
-
147
- 5. **Ask execution mode** (first user decision):
148
-
149
- Present the three execution modes from the **Execution Mode** section above as a single standalone `AskUserQuestion` call (exactly 1 question, multiSelect: false). Wait for the user's response before continuing to step 6.
150
-
151
- Each `AskUserQuestion` round is a genuine gate: callers tend to merge interactive rounds and pre-fill answers, which skips real user decisions and produces wrong configs. Therefore: ask execution mode (step 5) and configuration (step 6) as SEPARATE `AskUserQuestion` calls, in order, and do not assemble or show the final command (step 7) until the user has answered both. If you find yourself writing the final command before the user has answered, STOP — you are violating this rule.
152
-
153
- 6. **Ask configuration options** — a SEPARATE `AskUserQuestion` call from step 5, applies to ALL execution modes (Foreground, Background, AND Manual).
154
-
155
- Use `AskUserQuestion` to present ALL 4 configuration choices (the full 4-question budget goes to config, NOT shared with execution mode):
156
-
157
- **Question 1 — Verbose logging** (multiSelect: false):
158
- - On (default) — Detailed AI session logs including tool calls and subagent activity
159
- - Off — Minimal logging
160
-
161
- **Question 2 — Max retries** (multiSelect: false):
162
- - 3 (default)
163
- - 1
164
- - 5
165
-
166
- **Question 3 — Strict behavior check** (multiSelect: false):
167
- - On (default) — Run full test suite after each refactor task to verify behavior preservation
168
- - Off — Skip post-task test verification (faster but riskier)
169
-
170
- **Question 4 — Advanced config?** (multiSelect: false):
171
- - No (default) — Use defaults for failure behavior
172
- - Yes — Configure stop-on-failure, deploy-after-completion, and reasoning effort options
173
-
174
- Note: Refactor filter defaults to all refactor items. Runtime selects eligible refactors in stable list order after dependencies are completed; planners should order unrelated refactors by user priority before launch. If the user selects "Other" on any option, handle their custom input.
175
-
176
- **If user chose "Yes" to Advanced config**, run the advanced configuration round (a second `AskUserQuestion` round, plus a reasoning-effort follow-up). It applies to a minority of sessions, so the full question set lives in `${SKILL_DIR}/references/configuration.md` → **Advanced Configuration Round**.
177
-
178
- Read `${SKILL_DIR}/references/configuration.md` for the current environment-variable mapping and advanced environment-variable tables.
179
-
180
-
181
- 7. **Show final command**: After user confirms configuration in step 6, assemble the complete command from execution mode + user-confirmed configuration, and present it to the user.
182
-
183
- **Foreground command:**
184
- ```bash
185
- VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 python3 ./.prizmkit/dev-pipeline/cli.py refactor run .prizmkit/plans/refactor-list.json
186
- ```
187
- Selected-options example:
188
- ```bash
189
- VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5 STOP_ON_FAILURE=1 ENABLE_DEPLOY=1 PRIZMKIT_EFFORT=high \
190
- python3 ./.prizmkit/dev-pipeline/cli.py refactor run .prizmkit/plans/refactor-list.json
191
- ```
192
-
193
- **Background daemon command:**
194
- ```bash
195
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json --env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1"
196
- ```
197
- Selected-options example:
198
- ```bash
199
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json \
200
- --env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5 STOP_ON_FAILURE=1 ENABLE_DEPLOY=1 PRIZMKIT_EFFORT=high"
201
- ```
202
-
203
- **Manual mode**: Print the assembled command(s) and **stop here**. Do not execute anything. Do not proceed to step 8.
204
- ```
205
- # To run in foreground:
206
- VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 python3 ./.prizmkit/dev-pipeline/cli.py refactor run .prizmkit/plans/refactor-list.json
207
-
208
- # To run in background (detached):
209
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json --env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1"
87
+ ### Step 4: Ask base configuration
210
88
 
211
- # To check status:
212
- python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
213
- ```
89
+ Use a separate `AskUserQuestion` call with exactly four questions:
214
90
 
215
- 8. **Confirm and launch** (Foreground and Background only Manual mode ends at step 7):
91
+ 1. **Verbose logging** — On or Off.
92
+ 2. **Max retries** — 3, 1, 5, or a user-provided non-negative integer.
93
+ 3. **Strict behavior check** — On or Off.
94
+ 4. **Advanced config** — No or Yes.
216
95
 
217
- Use a separate `AskUserQuestion` call: "Ready to launch the refactor pipeline with the above command?"
218
- Options:
219
- - Launch now (Recommended)
220
- - Cancel
96
+ If Advanced config is Yes, load the advanced question set from `${SKILL_DIR}/references/configuration.md`. Advanced configuration contains only stop-on-failure and reasoning effort.
221
97
 
222
- After user confirms, execute the command from step 7.
98
+ ### Step 5: Build command fragments
223
99
 
224
- 9. **Post-launch** (depends on execution mode):
100
+ Map confirmed choices to environment variables using `${SKILL_DIR}/references/configuration.md`.
225
101
 
226
- **If foreground**: Pipeline runs to completion in the terminal. After it finishes:
227
- - Summarize results: total refactors, succeeded, failed, skipped
228
- - If all succeeded: each refactor session has already run `prizmkit-retrospective` internally. Ask user what's next.
229
- - If some failed: show failed refactor IDs and suggest `python3 ./.prizmkit/dev-pipeline/cli.py reset refactor <R-XXX> --clean --run` for a fresh retry
230
- - **Browser verification**: Refactor sessions with `browser_interaction` perform supplemental UI verification during execution. After completion, use `python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json` and per-refactor session logs as the source of truth before summarizing browser verification results.
102
+ Return this prerequisite-check command separately from the pipeline command:
231
103
 
232
- **If background daemon**:
233
- 1. Verify launch:
234
- ```bash
235
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
236
- ```
237
- 2. Start log monitoring — Use the Bash tool with `run_in_background: true`:
238
- ```bash
239
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --follow
240
- ```
241
- 3. Report to user:
242
- - Pipeline PID
243
- - Log file location
244
- - "You can ask me 'refactor status' or 'show refactor logs' at any time"
245
- - "Closing this session will NOT stop the pipeline"
104
+ ```bash
105
+ command -v python3 >/dev/null && command -v git >/dev/null && test -f .prizmkit/dev-pipeline/cli.py && python3 -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)'
106
+ ```
246
107
 
247
- ---
108
+ Also include the configured AI CLI check fragment from the reference. These are returned commands, not checks performed by this skill.
109
+
110
+ ### Step 6: Return the start command
111
+
112
+ Foreground template:
248
113
 
249
- #### Intent B: Check Status
114
+ ```bash
115
+ VERBOSE=1 MAX_RETRIES=3 STRICT_BEHAVIOR_CHECK=1 \
116
+ python3 ./.prizmkit/dev-pipeline/cli.py refactor run .prizmkit/plans/refactor-list.json
117
+ ```
250
118
 
251
- 1. **Check daemon status**:
252
- ```bash
253
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
254
- ```
119
+ Background template:
255
120
 
256
- 2. **Show refactor-level progress**:
257
- ```bash
258
- python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
259
- ```
121
+ ```bash
122
+ python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start .prizmkit/plans/refactor-list.json \
123
+ --env "VERBOSE=1 MAX_RETRIES=3 STRICT_BEHAVIOR_CHECK=1"
124
+ ```
260
125
 
261
- 3. **Show recent log activity** (last 20 lines):
262
- ```bash
263
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --lines 20
264
- ```
126
+ Return only the template matching the confirmed mode and options. Explain that the command has not been executed, then stop.
265
127
 
266
- 4. **Summarize** to user: total refactors, completed, in-progress, failed, pending.
128
+ ## Status Command
267
129
 
268
- ---
130
+ Return:
269
131
 
270
- #### Intent C: Stop Pipeline
132
+ ```bash
133
+ python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
134
+ python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
135
+ ```
271
136
 
272
- 1. **Stop the daemon**:
273
- ```bash
274
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor stop
275
- ```
137
+ Do not infer completion from the plan file alone when runtime state may exist.
276
138
 
277
- 2. **Verify stopped**:
278
- ```bash
279
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status 2>/dev/null || true
280
- ```
139
+ ## Logs Command
281
140
 
282
- 3. **Inform user**: "Refactor pipeline stopped. State is preserved -- you can resume later with 'start refactoring' and it will pick up where it left off."
141
+ Recent logs:
283
142
 
284
- ---
143
+ ```bash
144
+ python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --lines 50
145
+ ```
285
146
 
286
- #### Intent D: Show Logs
147
+ Follow logs:
287
148
 
288
- 1. **Check if running**:
289
- ```bash
290
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status 2>/dev/null
291
- ```
149
+ ```bash
150
+ python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --follow
151
+ ```
292
152
 
293
- 2. **If running** -- Start live tail with Bash tool `run_in_background: true`:
294
- ```bash
295
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --follow
296
- ```
153
+ When the user names a specific refactor, explain that its session path can be identified from `.prizmkit/state/refactor/<REFACTOR_ID>/status.json`; do not read or tail it from this skill.
297
154
 
298
- 3. **If not running** -- Show last 50 lines:
299
- ```bash
300
- python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor logs --lines 50
301
- ```
155
+ ## Stop Command
302
156
 
303
- 4. **For per-refactor session logs** (when user asks about a specific refactor):
304
- ```bash
305
- # Check refactor status for last session ID
306
- cat .prizmkit/state/refactor/<REFACTOR_ID>/status.json 2>/dev/null
307
- # Then tail that refactor's session log
308
- tail -100 .prizmkit/state/refactor/<REFACTOR_ID>/sessions/<SESSION_ID>/logs/session.log
309
- ```
157
+ Return:
310
158
 
311
- ---
159
+ ```bash
160
+ python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor stop
161
+ ```
312
162
 
313
- #### Intent E: Retry Single Refactor
163
+ Optionally include the daemon status command for the user to run afterward. Do not claim the pipeline stopped until runtime output confirms it.
314
164
 
315
- When user says "retry R-001" or "clean retry R-001":
165
+ ## Retry Command
166
+
167
+ A reset can discard uncommitted changes when the target task branch is currently checked out. Clean reset additionally deletes the task branch and clears its task history/artifacts. Never hide these effects behind the word “retry.”
168
+
169
+ Use `AskUserQuestion` before constructing a retry command:
170
+
171
+ - **Standard retry (Recommended)** — reset task status and rerun while preserving a non-current task branch; warn that an active task branch may still have uncommitted changes discarded by reset.
172
+ - **Clean retry** — perform the standard reset and also delete the task branch and clear task history/artifacts.
173
+ - **Cancel** — return no reset command.
174
+
175
+ Standard template:
316
176
 
317
177
  ```bash
318
- python3 ./.prizmkit/dev-pipeline/cli.py reset refactor R-001 --clean --run .prizmkit/plans/refactor-list.json
178
+ python3 ./.prizmkit/dev-pipeline/cli.py reset refactor R-001 --run .prizmkit/plans/refactor-list.json
319
179
  ```
320
180
 
321
- Notes:
322
- - `python3 ./.prizmkit/dev-pipeline/cli.py reset refactor <R-XXX> --clean --run .prizmkit/plans/refactor-list.json` performs a full clean (deletes session history and artifacts) before retrying the selected refactor — this gives a fresh start.
323
- - Keep pipeline daemon mode for main run management (`python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor start`, `python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status`, or `python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor stop`).
181
+ Clean template:
324
182
 
325
- ---
183
+ ```bash
184
+ python3 ./.prizmkit/dev-pipeline/cli.py reset refactor R-001 --clean --run .prizmkit/plans/refactor-list.json
185
+ ```
186
+
187
+ For clean retry, require explicit acknowledgement of branch deletion and possible uncommitted-change loss before displaying the command.
326
188
 
327
- ### Error Handling
189
+ ## Output Contract
328
190
 
329
- Read the error-handling table in `${SKILL_DIR}/references/configuration.md` for the full list of errors and recovery actions.
191
+ For every request, return:
330
192
 
331
- ### Integration Notes
193
+ 1. Intent and resolved target.
194
+ 2. Input plan path and selected IDs, when applicable.
195
+ 3. Assumptions, optional baseline commands, and safety warnings.
196
+ 4. Exact runtime command block.
197
+ 5. `Command execution: not performed by this skill.`
332
198
 
333
- - **After refactor-planner**: This is the natural next step. When user finishes refactor planning and has `.prizmkit/plans/refactor-list.json`, suggest launching the refactor pipeline.
334
- - **Session independence**: Only Background daemon mode runs detached. Foreground runs in the current AI CLI session, and Manual mode prints commands without launching.
335
- - **Single instance per family**: Only one refactor pipeline can run at a time. Different pipeline families may coexist because they use separate daemon metadata and state directories.
336
- - **Pipeline coexistence**: Refactor pipeline uses `.prizmkit/state/refactor/` separate from `.prizmkit/state/features/` (features) and `.prizmkit/state/bugfix/` (bugs), so all three pipelines can run simultaneously without conflict.
337
- - **State preservation**: Stopping and restarting the pipeline resumes from where it left off -- completed refactors are not re-run.
338
- - **HANDOFF**: After pipeline completes all refactors, each session has already run `prizmkit-retrospective` internally. Ask user what's next.
199
+ Never report command success, process IDs, log locations, refactor completion, baseline results, verification results, or state changes unless the user later supplies authoritative runtime output for explanation.