merge: sync Kilo runtime branch with main
Bring the latest main branch updates into feat/kilo-runtime-support while preserving KILO_CONFIG resolution, Kilo agent permission conversion, and relative .claude path rewrites.
This commit is contained in:
@@ -20,7 +20,7 @@ Extract from init JSON: `commit_docs`, `date`, `timestamp`, `todo_count`, `todos
|
||||
|
||||
Ensure directories exist:
|
||||
```bash
|
||||
mkdir -p .planning/todos/pending .planning/todos/done
|
||||
mkdir -p .planning/todos/pending .planning/todos/completed
|
||||
```
|
||||
|
||||
Note existing areas from the todos array for consistency in infer_area step.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<purpose>
|
||||
|
||||
Drive all remaining milestone phases autonomously. For each incomplete phase: discuss → plan → execute using Skill() flat invocations. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
|
||||
Drive milestone phases autonomously — all remaining phases, or a single phase via `--only N`. For each incomplete phase: discuss → plan → execute using Skill() flat invocations. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
|
||||
|
||||
</purpose>
|
||||
|
||||
@@ -16,15 +16,23 @@ Read all files referenced by the invoking prompt's execution_context before star
|
||||
|
||||
## 1. Initialize
|
||||
|
||||
Parse `$ARGUMENTS` for `--from N` flag:
|
||||
Parse `$ARGUMENTS` for `--from N` and `--only N` flags:
|
||||
|
||||
```bash
|
||||
FROM_PHASE=""
|
||||
if echo "$ARGUMENTS" | grep -qE '\-\-from\s+[0-9]'; then
|
||||
FROM_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-from\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
|
||||
fi
|
||||
|
||||
ONLY_PHASE=""
|
||||
if echo "$ARGUMENTS" | grep -qE '\-\-only\s+[0-9]'; then
|
||||
ONLY_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-only\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
|
||||
FROM_PHASE="$ONLY_PHASE"
|
||||
fi
|
||||
```
|
||||
|
||||
When `--only` is set, also set `FROM_PHASE` to the same value so existing filter logic applies.
|
||||
|
||||
Bootstrap via milestone-level init:
|
||||
|
||||
```bash
|
||||
@@ -48,7 +56,8 @@ Display startup banner:
|
||||
Phases: {phase_count} total, {completed_phases} complete
|
||||
```
|
||||
|
||||
If `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
|
||||
If `ONLY_PHASE` is set, display: `Single phase mode: Phase ${ONLY_PHASE}`
|
||||
Else if `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
|
||||
|
||||
</step>
|
||||
|
||||
@@ -68,6 +77,16 @@ Parse the JSON `phases` array.
|
||||
|
||||
**Apply `--from N` filter:** If `FROM_PHASE` was provided, additionally filter out phases where `number < FROM_PHASE` (use numeric comparison — handles decimal phases like "5.1").
|
||||
|
||||
**Apply `--only N` filter:** If `ONLY_PHASE` was provided, additionally filter OUT phases where `number != ONLY_PHASE`. This means the phase list will contain exactly one phase (or zero if already complete).
|
||||
|
||||
**If `ONLY_PHASE` is set and no phases remain** (phase already complete):
|
||||
|
||||
```
|
||||
Phase ${ONLY_PHASE} is already complete. Nothing to do.
|
||||
```
|
||||
|
||||
Exit cleanly.
|
||||
|
||||
**Sort by `number`** in numeric ascending order.
|
||||
|
||||
**If no incomplete phases remain:**
|
||||
@@ -117,7 +136,9 @@ For the current phase, display the progress banner:
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
Where N = current phase number (from the ROADMAP, e.g., 6), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 8), P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
|
||||
Where N = current phase number (from the ROADMAP, e.g., 63), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 67). **Important:** T must be `phase_count` (the total number of phases in this milestone), NOT the count of remaining/incomplete phases. When phases are numbered 61-67, T=7 and the banner should read `Phase 63/7` (phase 63, 7 total in milestone), not `Phase 63/3` (which would confuse 3 remaining with 3 total). P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
|
||||
|
||||
**Alternative display when phase numbers exceed total** (e.g., multi-milestone projects where phases are numbered globally): If N > T (phase number exceeds milestone phase count), use the format `Phase {N} ({position}/{T})` where `position` is the 1-based index of this phase among incomplete phases being processed. This prevents confusing displays like "Phase 63/5".
|
||||
|
||||
**3a. Smart Discuss**
|
||||
|
||||
@@ -211,6 +232,9 @@ Proceed to 3b.
|
||||
|
||||
**If SKIP_DISCUSS is `false` (or unset):** Execute the smart_discuss step for this phase.
|
||||
|
||||
**IMPORTANT — Discuss must be single-pass in autonomous mode.**
|
||||
The discuss step in `--auto` mode MUST NOT loop. If CONTEXT.md already exists after discuss completes, do NOT re-invoke discuss for the same phase. The `has_context` check below is authoritative — once true, discuss is done for this phase regardless of perceived "gaps" in the context file.
|
||||
|
||||
After smart_discuss completes, verify context was written:
|
||||
|
||||
```bash
|
||||
@@ -686,7 +710,9 @@ Decisions captured: {count} across {area_count} areas
|
||||
|
||||
## 4. Iterate
|
||||
|
||||
After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
|
||||
**If `ONLY_PHASE` is set:** Do not iterate. Proceed directly to lifecycle step (which exits cleanly per single-phase mode).
|
||||
|
||||
**Otherwise:** After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
|
||||
|
||||
```bash
|
||||
ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze)
|
||||
@@ -715,7 +741,23 @@ If all phases complete, proceed to lifecycle step.
|
||||
|
||||
## 5. Lifecycle
|
||||
|
||||
After all phases complete, run the milestone lifecycle sequence: audit → complete → cleanup.
|
||||
**If `ONLY_PHASE` is set:** Skip lifecycle. A single phase does not trigger audit/complete/cleanup. Display:
|
||||
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► AUTONOMOUS ▸ PHASE ${ONLY_PHASE} COMPLETE ✓
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
Phase ${ONLY_PHASE}: ${PHASE_NAME} — Done
|
||||
Mode: Single phase (--only)
|
||||
|
||||
Lifecycle skipped — run /gsd:autonomous without --only
|
||||
after all phases complete to trigger audit/complete/cleanup.
|
||||
```
|
||||
|
||||
Exit cleanly.
|
||||
|
||||
**Otherwise:** After all phases complete, run the milestone lifecycle sequence: audit → complete → cleanup.
|
||||
|
||||
Display lifecycle transition banner:
|
||||
|
||||
@@ -852,7 +894,7 @@ When any phase operation fails or a blocker is detected, present 3 options via A
|
||||
Skipped: {list of skipped phases}
|
||||
Remaining: {list of remaining phases}
|
||||
|
||||
Resume with: /gsd:autonomous --from {next_phase}
|
||||
Resume with: /gsd:autonomous ${ONLY_PHASE ? "--only " + ONLY_PHASE : "--from " + next_phase}
|
||||
```
|
||||
|
||||
</step>
|
||||
@@ -882,10 +924,15 @@ When any phase operation fails or a blocker is detected, present 3 options via A
|
||||
- [ ] Complete-milestone invoked via Skill() with ${milestone_version} arg
|
||||
- [ ] Cleanup invoked via Skill() — internal confirmation is acceptable (CTRL-01)
|
||||
- [ ] Final completion banner displayed after lifecycle
|
||||
- [ ] Progress bar uses phase number / total milestone phases (not position among incomplete)
|
||||
- [ ] Progress bar uses phase number / total milestone phases (not position among incomplete), with fallback display when phase numbers exceed total
|
||||
- [ ] Smart discuss documents relationship to discuss-phase with CTRL-03 note
|
||||
- [ ] Frontend phases get UI-SPEC generated before planning (step 3a.5) if not already present
|
||||
- [ ] Frontend phases get UI review audit after successful execution (step 3d.5) if UI-SPEC exists
|
||||
- [ ] UI phase and UI review respect workflow.ui_phase and workflow.ui_review config toggles
|
||||
- [ ] UI review is advisory (non-blocking) — phase proceeds to iterate regardless of score
|
||||
- [ ] `--only N` restricts execution to exactly one phase
|
||||
- [ ] `--only N` skips lifecycle step (audit/complete/cleanup)
|
||||
- [ ] `--only N` exits cleanly after single phase completes
|
||||
- [ ] `--only N` on already-complete phase exits with message
|
||||
- [ ] `--only N` handle_blocker resume message uses --only flag
|
||||
</success_criteria>
|
||||
|
||||
@@ -126,7 +126,7 @@ Use AskUserQuestion:
|
||||
<step name="execute_action">
|
||||
**Work on it now:**
|
||||
```bash
|
||||
mv ".planning/todos/pending/[filename]" ".planning/todos/done/"
|
||||
mv ".planning/todos/pending/[filename]" ".planning/todos/completed/"
|
||||
```
|
||||
Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
|
||||
|
||||
@@ -155,7 +155,7 @@ If todo was moved to done/, commit the change:
|
||||
|
||||
```bash
|
||||
git rm --cached .planning/todos/pending/[filename] 2>/dev/null || true
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: start work on todo - [title]" --files .planning/todos/done/[filename] .planning/STATE.md
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: start work on todo - [title]" --files .planning/todos/completed/[filename] .planning/STATE.md
|
||||
```
|
||||
|
||||
Tool respects `commit_docs` config and gitignore automatically.
|
||||
|
||||
@@ -55,6 +55,12 @@ gaps = [
|
||||
</step>
|
||||
|
||||
<step name="report_plan">
|
||||
**Read worktree config:**
|
||||
|
||||
```bash
|
||||
USE_WORKTREES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
|
||||
```
|
||||
|
||||
**Report diagnosis plan to user:**
|
||||
|
||||
```
|
||||
@@ -92,7 +98,7 @@ For each gap, fill the debug-subagent-prompt template and spawn:
|
||||
Task(
|
||||
prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}",
|
||||
subagent_type="gsd-debugger",
|
||||
isolation="worktree",
|
||||
${USE_WORKTREES !== "false" ? 'isolation="worktree",' : ''}
|
||||
description="Debug: {truth_short}"
|
||||
)
|
||||
```
|
||||
|
||||
@@ -155,6 +155,11 @@ Exit workflow.
|
||||
- In `discuss_areas`: for each discussion question, choose the recommended option (first option, or the one marked "recommended") without using AskUserQuestion
|
||||
- Log each auto-selected choice inline so the user can review decisions in the context file
|
||||
- After discussion completes, auto-advance to plan-phase (existing behavior)
|
||||
|
||||
**Chain mode** — If `--chain` is present in ARGUMENTS:
|
||||
- Discussion is fully interactive (questions, gray area selection — same as default mode)
|
||||
- After discussion completes, auto-advance to plan-phase → execute-phase (same as `--auto`)
|
||||
- This is the middle ground: user controls the discuss decisions, then plan+execute run autonomously
|
||||
</step>
|
||||
|
||||
<step name="check_existing">
|
||||
@@ -182,6 +187,26 @@ If "Skip": Exit workflow
|
||||
|
||||
**If doesn't exist:**
|
||||
|
||||
**Check for interrupted discussion checkpoint:**
|
||||
|
||||
```bash
|
||||
ls ${phase_dir}/*-DISCUSS-CHECKPOINT.json 2>/dev/null || true
|
||||
```
|
||||
|
||||
If a checkpoint file exists (previous session was interrupted before CONTEXT.md was written):
|
||||
|
||||
**If `--auto`:** Auto-select "Resume" — load checkpoint and continue from last completed area.
|
||||
|
||||
**Otherwise:** Use AskUserQuestion:
|
||||
- header: "Resume"
|
||||
- question: "Found interrupted discussion checkpoint ({N} areas completed out of {M}). Resume from where you left off?"
|
||||
- options:
|
||||
- "Resume" — Load checkpoint, skip completed areas, continue discussion
|
||||
- "Start fresh" — Delete checkpoint, start discussion from scratch
|
||||
|
||||
If "Resume": Parse the checkpoint JSON. Load `decisions` into the internal accumulator. Set `areas_completed` to skip those areas. Continue to `present_gray_areas` with only the remaining areas.
|
||||
If "Start fresh": Delete the checkpoint file. Continue as if no checkpoint existed.
|
||||
|
||||
Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
|
||||
|
||||
**If `--auto`:** Auto-select "Continue and replan after". Log: `[auto] Plans exist — continuing with context capture, will replan after.`
|
||||
@@ -640,6 +665,16 @@ Each answer (or answer set, in batch mode) should reveal the next question or ne
|
||||
```
|
||||
After all areas are auto-resolved, skip the "Explore more gray areas" prompt and proceed directly to write_context.
|
||||
|
||||
**CRITICAL — Auto-mode pass cap:**
|
||||
In `--auto` mode, the discuss step MUST complete in a **single pass**. After writing CONTEXT.md once, you are DONE — proceed immediately to write_context and then auto_advance. Do NOT re-read your own CONTEXT.md to find "gaps", "undefined types", or "missing decisions" and run additional passes. This creates a self-feeding loop where each pass generates references that the next pass treats as gaps, consuming unbounded time and resources.
|
||||
|
||||
Check the pass cap from config:
|
||||
```bash
|
||||
MAX_PASSES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.max_discuss_passes 2>/dev/null || echo "3")
|
||||
```
|
||||
|
||||
If you have already written and committed CONTEXT.md, the discuss step is complete. Move on.
|
||||
|
||||
**Interactive mode (no `--auto`):**
|
||||
|
||||
**For each area:**
|
||||
@@ -719,6 +754,44 @@ Back to [current area]: [return to current question]"
|
||||
|
||||
Track deferred ideas internally.
|
||||
|
||||
**Incremental checkpoint — save after each area completes:**
|
||||
|
||||
After each area is resolved (user says "Next area" or area auto-resolves in `--auto` mode), immediately write a checkpoint file with all decisions captured so far. This prevents data loss if the session is interrupted mid-discussion.
|
||||
|
||||
**Checkpoint file:** `${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json`
|
||||
|
||||
Write after each area:
|
||||
```json
|
||||
{
|
||||
"phase": "{PHASE_NUM}",
|
||||
"phase_name": "{phase_name}",
|
||||
"timestamp": "{ISO timestamp}",
|
||||
"areas_completed": ["Area 1", "Area 2"],
|
||||
"areas_remaining": ["Area 3", "Area 4"],
|
||||
"decisions": {
|
||||
"Area 1": [
|
||||
{"question": "...", "answer": "...", "options_presented": ["..."]},
|
||||
{"question": "...", "answer": "...", "options_presented": ["..."]}
|
||||
],
|
||||
"Area 2": [
|
||||
{"question": "...", "answer": "...", "options_presented": ["..."]}
|
||||
]
|
||||
},
|
||||
"deferred_ideas": ["..."],
|
||||
"canonical_refs": ["..."]
|
||||
}
|
||||
```
|
||||
|
||||
This is a structured checkpoint, not the final CONTEXT.md — the `write_context` step still produces the canonical output. But if the session dies, the next `gsd:discuss-phase` invocation can detect this checkpoint and offer to resume from it instead of starting from scratch.
|
||||
|
||||
**On session resume:** In the `check_existing` step, also check for `*-DISCUSS-CHECKPOINT.json`. If found and no CONTEXT.md exists:
|
||||
- Display: "Found interrupted discussion checkpoint ({N} areas completed). Resume from checkpoint?"
|
||||
- Options: "Resume" / "Start fresh"
|
||||
- On "Resume": Load the checkpoint, skip completed areas, continue from where it left off
|
||||
- On "Start fresh": Delete the checkpoint, proceed as normal
|
||||
|
||||
**After write_context completes successfully:** Delete the checkpoint file — the canonical CONTEXT.md now has all decisions.
|
||||
|
||||
**Track discussion log data internally:**
|
||||
For each question asked, accumulate:
|
||||
- Area name
|
||||
@@ -880,6 +953,7 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
|
||||
---
|
||||
|
||||
**Also available:**
|
||||
- `/gsd:discuss-phase ${PHASE} --chain ${GSD_WS}` — re-run with auto plan+execute after
|
||||
- `/gsd:plan-phase ${PHASE} --skip-research ${GSD_WS}` — plan without research
|
||||
- `/gsd:ui-phase ${PHASE} ${GSD_WS}` — generate UI design contract before planning (if phase has frontend work)
|
||||
- Review/edit CONTEXT.md before continuing
|
||||
@@ -933,6 +1007,12 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
|
||||
|
||||
Write file.
|
||||
|
||||
**Clean up checkpoint file** — CONTEXT.md is now the canonical record:
|
||||
|
||||
```bash
|
||||
rm -f "${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json"
|
||||
```
|
||||
|
||||
Commit phase context and discussion log:
|
||||
|
||||
```bash
|
||||
@@ -961,10 +1041,10 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(state): record
|
||||
<step name="auto_advance">
|
||||
Check for auto-advance trigger:
|
||||
|
||||
1. Parse `--auto` flag from $ARGUMENTS
|
||||
2. **Sync chain flag with intent** — if user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
|
||||
1. Parse `--auto` and `--chain` flags from $ARGUMENTS
|
||||
2. **Sync chain flag with intent** — if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
|
||||
```bash
|
||||
if [[ ! "$ARGUMENTS" =~ --auto ]]; then
|
||||
if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
|
||||
fi
|
||||
```
|
||||
@@ -974,12 +1054,12 @@ Check for auto-advance trigger:
|
||||
AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
|
||||
```
|
||||
|
||||
**If `--auto` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct `--auto` usage without new-project):
|
||||
**If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct usage without new-project):
|
||||
```bash
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true
|
||||
```
|
||||
|
||||
**If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
|
||||
**If `--auto` flag present OR `--chain` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
|
||||
|
||||
Display banner:
|
||||
```
|
||||
@@ -1006,7 +1086,7 @@ This keeps the auto-advance chain flat — discuss, plan, and execute all run at
|
||||
|
||||
Auto-advance pipeline finished: discuss → plan → execute
|
||||
|
||||
Next: /gsd:discuss-phase ${NEXT_PHASE} --auto ${GSD_WS}
|
||||
Next: /gsd:discuss-phase ${NEXT_PHASE} ${WAS_CHAIN ? "--chain" : "--auto"} ${GSD_WS}
|
||||
<sub>/clear first → fresh context window</sub>
|
||||
```
|
||||
- **PLANNING COMPLETE** → Planning done, execution didn't complete:
|
||||
@@ -1025,7 +1105,7 @@ This keeps the auto-advance chain flat — discuss, plan, and execute all run at
|
||||
Continue: /gsd:plan-phase ${PHASE} --gaps ${GSD_WS}
|
||||
```
|
||||
|
||||
**If neither `--auto` nor config enabled:**
|
||||
**If none of `--auto`, `--chain`, nor config enabled:**
|
||||
Route to `confirm_creation` step (existing behavior — show manual next steps).
|
||||
</step>
|
||||
|
||||
@@ -1046,4 +1126,9 @@ Route to `confirm_creation` step (existing behavior — show manual next steps).
|
||||
- Deferred ideas preserved for future phases
|
||||
- STATE.md updated with session info
|
||||
- User knows next steps
|
||||
- Checkpoint file written after each area completes (incremental save)
|
||||
- Interrupted sessions can be resumed from checkpoint (no re-answering completed areas)
|
||||
- Checkpoint file cleaned up after successful CONTEXT.md write
|
||||
- `--chain` triggers interactive discuss followed by auto plan+execute (no auto-answering)
|
||||
- `--chain` and `--auto` both persist chain flag and auto-advance to plan-phase
|
||||
</success_criteria>
|
||||
|
||||
1153
get-shit-done/workflows/docs-update.md
Normal file
1153
get-shit-done/workflows/docs-update.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -68,6 +68,14 @@ AGENT_SKILLS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills
|
||||
|
||||
Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
|
||||
|
||||
Read worktree config:
|
||||
|
||||
```bash
|
||||
USE_WORKTREES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
|
||||
```
|
||||
|
||||
When `USE_WORKTREES` is `false`, all executor agents run without `isolation="worktree"` — they execute sequentially on the main working tree instead of in parallel worktrees.
|
||||
|
||||
**If `phase_found` is false:** Error — phase directory not found.
|
||||
**If `plan_count` is 0:** Error — no plans found in phase.
|
||||
**If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
|
||||
@@ -223,6 +231,8 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
|
||||
For 200k models, this keeps orchestrator context lean (~10-15%).
|
||||
For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
|
||||
|
||||
**Worktree mode** (`USE_WORKTREES` is not `false`):
|
||||
|
||||
```
|
||||
Task(
|
||||
subagent_type="gsd-executor",
|
||||
@@ -279,6 +289,19 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
|
||||
)
|
||||
```
|
||||
|
||||
**Sequential mode** (`USE_WORKTREES` is `false`):
|
||||
|
||||
Omit `isolation="worktree"` from the Task call. Replace the `<parallel_execution>` block with:
|
||||
|
||||
```
|
||||
<sequential_execution>
|
||||
You are running as a SEQUENTIAL executor agent on the main working tree.
|
||||
Use normal git commits (with hooks). Do NOT use --no-verify.
|
||||
</sequential_execution>
|
||||
```
|
||||
|
||||
When worktrees are disabled, execute plans **one at a time within each wave** (sequential) regardless of the `PARALLELIZATION` setting — multiple agents writing to the same working tree concurrently would cause conflicts.
|
||||
|
||||
3. **Wait for all agents in wave to complete.**
|
||||
|
||||
**Completion signal fallback (Copilot and runtimes where Task() may not return):**
|
||||
@@ -313,6 +336,39 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
|
||||
```
|
||||
If hooks fail: report the failure and ask "Fix hook issues now?" or "Continue to next wave?"
|
||||
|
||||
4.5. **Worktree cleanup (when `isolation="worktree"` was used):**
|
||||
|
||||
When executor agents ran in worktree isolation, their commits land on temporary branches in separate working trees. After the wave completes, merge these changes back and clean up:
|
||||
|
||||
```bash
|
||||
# List worktrees created by this wave's agents
|
||||
WORKTREES=$(git worktree list --porcelain | grep "^worktree " | grep -v "$(pwd)$" | sed 's/^worktree //')
|
||||
|
||||
for WT in $WORKTREES; do
|
||||
# Get the branch name for this worktree
|
||||
WT_BRANCH=$(git -C "$WT" rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
if [ -n "$WT_BRANCH" ] && [ "$WT_BRANCH" != "HEAD" ]; then
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
# Merge the worktree branch into the current branch
|
||||
git merge "$WT_BRANCH" --no-edit -m "chore: merge executor worktree ($WT_BRANCH)" 2>&1 || {
|
||||
echo "⚠ Merge conflict from worktree $WT_BRANCH — resolve manually"
|
||||
continue
|
||||
}
|
||||
|
||||
# Remove the worktree
|
||||
git worktree remove "$WT" --force 2>/dev/null || true
|
||||
|
||||
# Delete the temporary branch
|
||||
git branch -D "$WT_BRANCH" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
```
|
||||
|
||||
**If `workflow.use_worktrees` is `false`:** Agents ran on the main working tree — skip this step entirely.
|
||||
|
||||
**If no worktrees found:** Skip silently — agents may have been spawned without worktree isolation.
|
||||
|
||||
5. **Report completion — spot-check claims first:**
|
||||
|
||||
For each SUMMARY.md:
|
||||
@@ -436,6 +492,27 @@ After all waves:
|
||||
### Issues Encountered
|
||||
[Aggregate from SUMMARYs, or "None"]
|
||||
```
|
||||
|
||||
**Security gate check:**
|
||||
```bash
|
||||
SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
|
||||
SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1)
|
||||
```
|
||||
|
||||
If `SECURITY_CFG` is `false`: skip.
|
||||
|
||||
If `SECURITY_CFG` is `true` AND `SECURITY_FILE` is empty (no SECURITY.md yet):
|
||||
Include in the next-steps routing output:
|
||||
```
|
||||
⚠ Security enforcement enabled — run before advancing:
|
||||
/gsd:secure-phase {PHASE} ${GSD_WS}
|
||||
```
|
||||
|
||||
If `SECURITY_CFG` is `true` AND SECURITY.md exists: check frontmatter `threats_open`. If > 0:
|
||||
```
|
||||
⚠ Security gate: {threats_open} threats open
|
||||
/gsd:secure-phase {PHASE} — resolve before advancing
|
||||
```
|
||||
</step>
|
||||
|
||||
<step name="handle_partial_wave_execution">
|
||||
@@ -580,6 +657,72 @@ Options:
|
||||
Use AskUserQuestion to present the options.
|
||||
</step>
|
||||
|
||||
<step name="schema_drift_gate">
|
||||
Post-execution schema drift detection. Catches false-positive verification where
|
||||
build/types pass because TypeScript types come from config, not the live database.
|
||||
|
||||
**Run after execution completes but BEFORE verification marks success.**
|
||||
|
||||
```bash
|
||||
SCHEMA_DRIFT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify schema-drift "${PHASE_NUMBER}" 2>/dev/null)
|
||||
```
|
||||
|
||||
Parse JSON result for: `drift_detected`, `blocking`, `schema_files`, `orms`, `unpushed_orms`, `message`.
|
||||
|
||||
**If `drift_detected` is false:** Skip to verify_phase_goal.
|
||||
|
||||
**If `drift_detected` is true AND `blocking` is true:**
|
||||
|
||||
Check for override:
|
||||
```bash
|
||||
SKIP_SCHEMA=$(echo "${GSD_SKIP_SCHEMA_CHECK:-false}")
|
||||
```
|
||||
|
||||
**If `SKIP_SCHEMA` is `true`:**
|
||||
|
||||
Display:
|
||||
```
|
||||
⚠ Schema drift detected but GSD_SKIP_SCHEMA_CHECK=true — bypassing gate.
|
||||
|
||||
Schema files changed: {schema_files}
|
||||
ORMs requiring push: {unpushed_orms}
|
||||
|
||||
Proceeding to verification (database may be out of sync).
|
||||
```
|
||||
→ Continue to verify_phase_goal.
|
||||
|
||||
**If `SKIP_SCHEMA` is not `true`:**
|
||||
|
||||
BLOCK verification. Display:
|
||||
|
||||
```
|
||||
## BLOCKED: Schema Drift Detected
|
||||
|
||||
Schema-relevant files changed during this phase but no database push command
|
||||
was executed. Build and type checks pass because TypeScript types come from
|
||||
config, not the live database — verification would produce a false positive.
|
||||
|
||||
Schema files changed: {schema_files}
|
||||
ORMs requiring push: {unpushed_orms}
|
||||
|
||||
Required push commands:
|
||||
{For each unpushed ORM, show the push command from the message}
|
||||
|
||||
Options:
|
||||
1. Run push command now (recommended) — execute the push, then re-verify
|
||||
2. Skip schema check (GSD_SKIP_SCHEMA_CHECK=true) — bypass this gate
|
||||
3. Abort — stop execution and investigate
|
||||
```
|
||||
|
||||
If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use AskUserQuestion.
|
||||
|
||||
**If user selects option 1:** Present the specific push command(s) to run. After user confirms execution, re-run the schema drift check. If it passes, continue to verify_phase_goal.
|
||||
|
||||
**If user selects option 2:** Set override and continue to verify_phase_goal.
|
||||
|
||||
**If user selects option 3:** Stop execution. Report partial completion.
|
||||
</step>
|
||||
|
||||
<step name="verify_phase_goal">
|
||||
Verify phase achieved its GOAL, not just completed tasks.
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
||||
| Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
|
||||
| Decision | C (main) | Execute entirely in main context |
|
||||
|
||||
**Pattern A:** init_agent_tracking → spawn Task(subagent_type="gsd-executor", model=executor_model, isolation="worktree") with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report.
|
||||
**Pattern A:** init_agent_tracking → spawn Task(subagent_type="gsd-executor", model=executor_model) with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report. **Include `isolation="worktree"` only if `workflow.use_worktrees` is not `false`** (read via `config-get workflow.use_worktrees`).
|
||||
|
||||
**Pattern B:** Execute segment-by-segment. Autonomous segments: spawn subagent for assigned tasks only (no SUMMARY/commit). Checkpoints: main context. After all segments: aggregate, create SUMMARY, commit. See segment_execution.
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ Usage: `/gsd:do I want to start a new milestone`
|
||||
|
||||
### Quick Mode
|
||||
|
||||
**`/gsd:quick [--full] [--discuss] [--research]`**
|
||||
**`/gsd:quick [--full] [--validate] [--discuss] [--research]`**
|
||||
Execute small, ad-hoc tasks with GSD guarantees but skip optional agents.
|
||||
|
||||
Quick mode uses the same system with a shorter path:
|
||||
@@ -143,14 +143,16 @@ Quick mode uses the same system with a shorter path:
|
||||
- Updates STATE.md tracking (not ROADMAP.md)
|
||||
|
||||
Flags enable additional quality steps:
|
||||
- `--full` — Complete quality pipeline: discussion + research + plan-checking + verification
|
||||
- `--validate` — Plan-checking (max 2 iterations) and post-execution verification only
|
||||
- `--discuss` — Lightweight discussion to surface gray areas before planning
|
||||
- `--research` — Focused research agent investigates approaches before planning
|
||||
- `--full` — Adds plan-checking (max 2 iterations) and post-execution verification
|
||||
|
||||
Flags are composable: `--discuss --research --full` gives the complete quality pipeline for a single task.
|
||||
Granular flags are composable: `--discuss --research --validate` gives the same as `--full`.
|
||||
|
||||
Usage: `/gsd:quick`
|
||||
Usage: `/gsd:quick --research --full`
|
||||
Usage: `/gsd:quick --full`
|
||||
Usage: `/gsd:quick --research --validate`
|
||||
Result: Creates `.planning/quick/NNN-slug/PLAN.md`, `.planning/quick/NNN-slug/SUMMARY.md`
|
||||
|
||||
---
|
||||
@@ -343,11 +345,12 @@ Usage: `/gsd:ship 4` or `/gsd:ship 4 --draft`
|
||||
|
||||
---
|
||||
|
||||
**`/gsd:review --phase N [--gemini] [--claude] [--codex] [--all]`**
|
||||
**`/gsd:review --phase N [--gemini] [--claude] [--codex] [--coderabbit] [--all]`**
|
||||
Cross-AI peer review — invoke external AI CLIs to independently review phase plans.
|
||||
|
||||
- Detects available CLIs (gemini, claude, codex)
|
||||
- Detects available CLIs (gemini, claude, codex, coderabbit)
|
||||
- Each CLI reviews plans independently with the same structured prompt
|
||||
- CodeRabbit reviews the current git diff (not a prompt) — may take up to 5 minutes
|
||||
- Produces REVIEWS.md with per-reviewer feedback and consensus summary
|
||||
- Feed reviews back into planning: `/gsd:plan-phase N --reviews`
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ After discuss completes, loop back to dashboard step.
|
||||
|
||||
### Plan Phase N
|
||||
|
||||
Planning runs autonomously. Spawn a background agent:
|
||||
Planning runs autonomously. Spawn a background agent that delegates to the Skill pipeline:
|
||||
|
||||
```
|
||||
Task(
|
||||
@@ -222,16 +222,12 @@ Working directory: {cwd}
|
||||
Phase: {N} — {phase_name}
|
||||
Goal: {goal}
|
||||
|
||||
Steps:
|
||||
1. Read the plan-phase workflow: cat ~/.claude/get-shit-done/workflows/plan-phase.md
|
||||
2. Run: node \"$HOME/.claude/get-shit-done/bin/gsd-tools.cjs\" init plan-phase {N}
|
||||
3. Follow the workflow steps to produce PLAN.md files for this phase.
|
||||
4. If research is enabled in config, run the research step first.
|
||||
5. Spawn a gsd-planner subagent via Task() to create the plans.
|
||||
6. If plan-checker is enabled, spawn a gsd-plan-checker subagent to verify.
|
||||
7. Commit plan files when complete.
|
||||
Run the plan-phase Skill:
|
||||
Skill(skill=\"gsd:plan-phase\", args=\"{N} --auto\")
|
||||
|
||||
Important: You are running in the background. Do NOT use AskUserQuestion — make autonomous decisions based on project context. If you hit a blocker, write it to STATE.md as a blocker and stop. Do NOT silently work around permission or file access errors — let them fail so the manager can surface them with resolution hints."
|
||||
This delegates to the full plan-phase pipeline including local patches, research, plan-checker, and all quality gates.
|
||||
|
||||
Important: You are running in the background. Do NOT use AskUserQuestion — make autonomous decisions based on project context. If you hit a blocker, write it to STATE.md as a blocker and stop. Do NOT silently work around permission or file access errors — let them fail so the manager can surface them with resolution hints. Do NOT use --no-verify on git commits."
|
||||
)
|
||||
```
|
||||
|
||||
@@ -245,7 +241,7 @@ Loop back to dashboard step.
|
||||
|
||||
### Execute Phase N
|
||||
|
||||
Execution runs autonomously. Spawn a background agent:
|
||||
Execution runs autonomously. Spawn a background agent that delegates to the Skill pipeline:
|
||||
|
||||
```
|
||||
Task(
|
||||
@@ -257,16 +253,12 @@ Working directory: {cwd}
|
||||
Phase: {N} — {phase_name}
|
||||
Goal: {goal}
|
||||
|
||||
Steps:
|
||||
1. Read the execute-phase workflow: cat ~/.claude/get-shit-done/workflows/execute-phase.md
|
||||
2. Run: node \"$HOME/.claude/get-shit-done/bin/gsd-tools.cjs\" init execute-phase {N}
|
||||
3. Follow the workflow steps: discover plans, analyze dependencies, group into waves.
|
||||
4. For each wave, spawn gsd-executor subagents via Task() to execute plans in parallel.
|
||||
5. After all waves complete, spawn a gsd-verifier subagent if verifier is enabled.
|
||||
6. Update ROADMAP.md and STATE.md with progress.
|
||||
7. Commit all changes.
|
||||
Run the execute-phase Skill:
|
||||
Skill(skill=\"gsd:execute-phase\", args=\"{N}\")
|
||||
|
||||
Important: You are running in the background. Do NOT use AskUserQuestion — make autonomous decisions. Use --no-verify on git commits. If you hit a permission error, file lock, or any access issue, do NOT work around it — let it fail and write the error to STATE.md as a blocker so the manager can surface it with resolution guidance."
|
||||
This delegates to the full execute-phase pipeline including local patches, branching, wave-based execution, verification, and all quality gates.
|
||||
|
||||
Important: You are running in the background. Do NOT use AskUserQuestion — make autonomous decisions. Do NOT use --no-verify on git commits — let pre-commit hooks run normally. If you hit a permission error, file lock, or any access issue, do NOT work around it — let it fail and write the error to STATE.md as a blocker so the manager can surface it with resolution guidance."
|
||||
)
|
||||
```
|
||||
|
||||
@@ -306,7 +298,7 @@ Classify the error:
|
||||
- **question:** "Phase {N} failed — permission denied for `{tool_or_command}`. Want me to add it to settings.local.json so it's allowed?"
|
||||
- **options:** "Add permission and retry" / "Run this phase inline instead" / "Skip and continue"
|
||||
- "Add permission and retry": Use `Skill(skill="update-config")` to add the permission to `settings.local.json`, then re-spawn the background agent. Loop to dashboard.
|
||||
- "Run this phase inline instead": Dispatch the same action (plan/execute) inline via `Skill()` instead of a background Task. Loop to dashboard after.
|
||||
- "Run this phase inline instead": Dispatch the same action inline via the appropriate Skill — use `Skill(skill="gsd:plan-phase", args="{N}")` if the failed action was planning, or `Skill(skill="gsd:execute-phase", args="{N}")` if the failed action was execution. Loop to dashboard after.
|
||||
- "Skip and continue": Loop to dashboard (phase stays in current state).
|
||||
|
||||
**Other errors** (git lock, file conflict, logic error, etc.):
|
||||
@@ -314,7 +306,7 @@ Classify the error:
|
||||
- **question:** "Background agent for Phase {N} encountered an issue: {error}. What next?"
|
||||
- **options:** "Retry" / "Run inline instead" / "Skip and continue" / "View details"
|
||||
- "Retry": Re-spawn the same background agent. Loop to dashboard.
|
||||
- "Run inline instead": Dispatch the action inline via `Skill()`. Loop to dashboard after.
|
||||
- "Run inline instead": Dispatch the action inline via the appropriate Skill — use `Skill(skill="gsd:plan-phase", args="{N}")` if the failed action was planning, or `Skill(skill="gsd:execute-phase", args="{N}")` if the failed action was execution. Loop to dashboard after.
|
||||
- "Skip and continue": Loop to dashboard (phase stays in current state).
|
||||
- "View details": Read STATE.md blockers section, display, then re-present options.
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ If plans exist but not all have matching summaries:
|
||||
|
||||
**Route 5: All plans have summaries → verify and complete**
|
||||
If all plans in the current phase have summaries:
|
||||
→ Next action: `/gsd:verify-work` then `/gsd:complete-phase`
|
||||
→ Next action: `/gsd:verify-work`
|
||||
|
||||
**Route 6: Phase complete, next phase exists → advance**
|
||||
If the current phase is complete and the next phase exists in ROADMAP:
|
||||
|
||||
@@ -101,7 +101,7 @@ If a scope has no directory or no entries, show: `(no notes)`
|
||||
3. If N is invalid or refers to an already-promoted note, tell the user and stop
|
||||
4. **Requires `.planning/` directory** — if it doesn't exist, warn: "Todos require a GSD project. Run `/gsd:new-project` to initialize one."
|
||||
5. Ensure `.planning/todos/pending/` directory exists
|
||||
6. Generate todo ID: `{NNN}-{slug}` where NNN is the next sequential number (scan both `.planning/todos/pending/` and `.planning/todos/done/` for the highest existing number, increment by 1, zero-pad to 3 digits) and slug is the first ~4 meaningful words of the note text
|
||||
6. Generate todo ID: `{NNN}-{slug}` where NNN is the next sequential number (scan both `.planning/todos/pending/` and `.planning/todos/completed/` for the highest existing number, increment by 1, zero-pad to 3 digits) and slug is the first ~4 meaningful words of the note text
|
||||
7. Extract the note text from the source file (body after frontmatter)
|
||||
8. Create `.planning/todos/pending/{id}.md`:
|
||||
|
||||
|
||||
@@ -360,6 +360,32 @@ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED
|
||||
|
||||
**If not found:** Warn and continue — plans may fail Dimension 8.
|
||||
|
||||
## 5.55. Security Threat Model Gate
|
||||
|
||||
> Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled.
|
||||
|
||||
```bash
|
||||
SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
|
||||
SECURITY_ASVS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
|
||||
SECURITY_BLOCK=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
|
||||
```
|
||||
|
||||
**If `SECURITY_CFG` is `false`:** Skip to step 5.6.
|
||||
|
||||
**If `SECURITY_CFG` is `true`:** Display banner:
|
||||
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► SECURITY THREAT MODEL REQUIRED (ASVS L{SECURITY_ASVS})
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
Each PLAN.md must include a <threat_model> block.
|
||||
Block on: {SECURITY_BLOCK} severity threats.
|
||||
Opt out: set security_enforcement: false in .planning/config.json
|
||||
```
|
||||
|
||||
Continue to step 5.6. Security config is passed to the planner in step 8.
|
||||
|
||||
## 5.6. UI Design Contract Gate
|
||||
|
||||
> Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.planning/config.json`. If keys are absent, treat as enabled.
|
||||
@@ -409,7 +435,69 @@ Otherwise use AskUserQuestion:
|
||||
- "Continue without UI-SPEC" → Continue to step 6.
|
||||
- "Not a frontend phase" → Continue to step 6.
|
||||
|
||||
**If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 6.
|
||||
**If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 5.7.
|
||||
|
||||
## 5.7. Schema Push Detection Gate
|
||||
|
||||
> Detects schema-relevant files in the phase scope and injects a mandatory `[BLOCKING]` schema push task into the plan. Prevents false-positive verification where build/types pass because TypeScript types come from config, not the live database.
|
||||
|
||||
Check if any files in the phase scope match schema patterns:
|
||||
|
||||
```bash
|
||||
PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" --pick section 2>/dev/null)
|
||||
```
|
||||
|
||||
Scan `PHASE_SECTION`, `CONTEXT.md` (if loaded), and `RESEARCH.md` (if exists) for file paths matching these ORM patterns:
|
||||
|
||||
| ORM | File Patterns |
|
||||
|-----|--------------|
|
||||
| Payload CMS | `src/collections/**/*.ts`, `src/globals/**/*.ts` |
|
||||
| Prisma | `prisma/schema.prisma`, `prisma/schema/*.prisma` |
|
||||
| Drizzle | `drizzle/schema.ts`, `src/db/schema.ts`, `drizzle/*.ts` |
|
||||
| Supabase | `supabase/migrations/*.sql` |
|
||||
| TypeORM | `src/entities/**/*.ts`, `src/migrations/**/*.ts` |
|
||||
|
||||
Also check if any existing PLAN.md files for this phase already reference these file patterns in `files_modified`.
|
||||
|
||||
**If schema-relevant files detected:**
|
||||
|
||||
Set `SCHEMA_PUSH_REQUIRED=true` and `SCHEMA_ORM={detected_orm}`.
|
||||
|
||||
Determine the push command for the detected ORM:
|
||||
|
||||
| ORM | Push Command | Non-TTY Workaround |
|
||||
|-----|-------------|-------------------|
|
||||
| Payload CMS | `npx payload migrate` | `CI=true PAYLOAD_MIGRATING=true npx payload migrate` |
|
||||
| Prisma | `npx prisma db push` | `npx prisma db push --accept-data-loss` (if destructive) |
|
||||
| Drizzle | `npx drizzle-kit push` | `npx drizzle-kit push` |
|
||||
| Supabase | `supabase db push` | Set `SUPABASE_ACCESS_TOKEN` env var |
|
||||
| TypeORM | `npx typeorm migration:run` | `npx typeorm migration:run -d src/data-source.ts` |
|
||||
|
||||
Inject the following into the planner prompt (step 8) as an additional constraint:
|
||||
|
||||
```markdown
|
||||
<schema_push_requirement>
|
||||
**[BLOCKING] Schema Push Required**
|
||||
|
||||
This phase modifies schema-relevant files ({detected_files}). The planner MUST include
|
||||
a `[BLOCKING]` task that runs the database schema push command AFTER all schema file
|
||||
modifications are complete but BEFORE verification.
|
||||
|
||||
- ORM detected: {SCHEMA_ORM}
|
||||
- Push command: {push_command}
|
||||
- Non-TTY workaround: {env_hint}
|
||||
- If push requires interactive prompts that cannot be suppressed, flag the task for
|
||||
manual intervention with `autonomous: false`
|
||||
|
||||
This task is mandatory — the phase CANNOT pass verification without it. Build and
|
||||
type checks will pass without the push (types come from config, not the live database),
|
||||
creating a false-positive verification state.
|
||||
</schema_push_requirement>
|
||||
```
|
||||
|
||||
Display: `Schema files detected ({SCHEMA_ORM}) — [BLOCKING] push task will be injected into plans`
|
||||
|
||||
**If no schema-relevant files detected:** Skip silently to step 6.
|
||||
|
||||
## 6. Check Existing Plans
|
||||
|
||||
@@ -496,6 +584,7 @@ ${AGENT_SKILLS_PLANNER}
|
||||
|
||||
**Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
|
||||
**Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, plans should account for project skill rules
|
||||
|
||||
</planning_context>
|
||||
|
||||
<downstream_consumer>
|
||||
@@ -560,9 +649,42 @@ Task(
|
||||
## 9. Handle Planner Return
|
||||
|
||||
- **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
|
||||
- **`## PHASE SPLIT RECOMMENDED`:** The planner determined the phase is too complex to implement all user decisions without simplifying them. Handle in step 9b.
|
||||
- **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
|
||||
- **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
|
||||
|
||||
## 9b. Handle Phase Split Recommendation
|
||||
|
||||
When the planner returns `## PHASE SPLIT RECOMMENDED`, it means the phase has too many decisions to implement at full fidelity within the plan budget. The planner proposes groupings.
|
||||
|
||||
**Extract from planner return:**
|
||||
- Proposed sub-phases (e.g., "17a: processing core (D-01 to D-19)", "17b: billing + config UX (D-20 to D-27)")
|
||||
- Which D-XX decisions go in each sub-phase
|
||||
- Why the split is necessary (decision count, complexity estimate)
|
||||
|
||||
**Present to user:**
|
||||
```
|
||||
## Phase {X} is too complex for full-fidelity implementation
|
||||
|
||||
The planner found {N} decisions that cannot all be implemented without
|
||||
simplifying some. Instead of reducing your decisions, we recommend splitting:
|
||||
|
||||
**Option 1: Split into sub-phases**
|
||||
- Phase {X}a: {name} — {D-XX to D-YY} ({N} decisions)
|
||||
- Phase {X}b: {name} — {D-XX to D-YY} ({M} decisions)
|
||||
|
||||
**Option 2: Proceed anyway** (planner will attempt all, quality may degrade)
|
||||
|
||||
**Option 3: Prioritize** — you choose which decisions to implement now,
|
||||
rest become a follow-up phase
|
||||
```
|
||||
|
||||
Use AskUserQuestion with these 3 options.
|
||||
|
||||
**If "Split":** Use `/gsd:insert-phase` to create the sub-phases, then replan each.
|
||||
**If "Proceed":** Return to planner with instruction to attempt all decisions at full fidelity, accepting more plans/tasks.
|
||||
**If "Prioritize":** Use AskUserQuestion (multiSelect) to let user pick which D-XX are "now" vs "later". Create CONTEXT.md for each sub-phase with the selected decisions.
|
||||
|
||||
## 10. Spawn gsd-plan-checker Agent
|
||||
|
||||
Display banner:
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<purpose>
|
||||
Execute small, ad-hoc tasks with GSD guarantees (atomic commits, STATE.md tracking). Quick mode spawns gsd-planner (quick mode) + gsd-executor(s), tracks tasks in `.planning/quick/`, and updates STATE.md's "Quick Tasks Completed" table.
|
||||
|
||||
With `--discuss` flag: lightweight discussion phase before planning. Surfaces assumptions, clarifies gray areas, captures decisions in CONTEXT.md so the planner treats them as locked.
|
||||
With `--full` flag: enables the complete quality pipeline — discussion + research + plan-checking + verification. One flag for everything.
|
||||
|
||||
With `--full` flag: enables plan-checking (max 2 iterations) and post-execution verification for quality guarantees without full milestone ceremony.
|
||||
With `--validate` flag: enables plan-checking (max 2 iterations) and post-execution verification only. Use when you want quality guarantees without discussion or research.
|
||||
|
||||
With `--discuss` flag: lightweight discussion phase before planning. Surfaces assumptions, clarifies gray areas, captures decisions in CONTEXT.md so the planner treats them as locked.
|
||||
|
||||
With `--research` flag: spawns a focused research agent before planning. Investigates implementation approaches, library options, and pitfalls. Use when you're unsure how to approach a task.
|
||||
|
||||
Flags are composable: `--discuss --research --full` gives discussion + research + plan-checking + verification.
|
||||
Granular flags are composable: `--discuss --research --validate` gives the same result as `--full`.
|
||||
</purpose>
|
||||
|
||||
<required_reading>
|
||||
@@ -27,9 +29,10 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo
|
||||
**Step 1: Parse arguments and get task description**
|
||||
|
||||
Parse `$ARGUMENTS` for:
|
||||
- `--full` flag → store as `$FULL_MODE` (true/false)
|
||||
- `--discuss` flag → store as `$DISCUSS_MODE` (true/false)
|
||||
- `--research` flag → store as `$RESEARCH_MODE` (true/false)
|
||||
- `--full` flag → store `$FULL_MODE=true`, `$DISCUSS_MODE=true`, `$RESEARCH_MODE=true`, `$VALIDATE_MODE=true`
|
||||
- `--validate` flag → store `$VALIDATE_MODE=true`
|
||||
- `--discuss` flag → store `$DISCUSS_MODE=true`
|
||||
- `--research` flag → store `$RESEARCH_MODE=true`
|
||||
- Remaining text → use as `$DESCRIPTION` if non-empty
|
||||
|
||||
If `$DESCRIPTION` is empty after parsing, prompt user interactively:
|
||||
@@ -48,25 +51,34 @@ If still empty, re-prompt: "Please provide a task description."
|
||||
|
||||
Display banner based on active flags:
|
||||
|
||||
If `$DISCUSS_MODE` and `$RESEARCH_MODE` and `$FULL_MODE`:
|
||||
If `$FULL_MODE` (all phases enabled — `--full` or all granular flags):
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► QUICK TASK (DISCUSS + RESEARCH + FULL)
|
||||
GSD ► QUICK TASK (FULL)
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
◆ Discussion + research + plan checking + verification enabled
|
||||
```
|
||||
|
||||
If `$DISCUSS_MODE` and `$FULL_MODE` (no research):
|
||||
If `$DISCUSS_MODE` and `$RESEARCH_MODE` and `$VALIDATE_MODE` (no `$FULL_MODE` — composed granularly):
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► QUICK TASK (DISCUSS + FULL)
|
||||
GSD ► QUICK TASK (DISCUSS + RESEARCH + VALIDATE)
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
◆ Discussion + research + plan checking + verification enabled
|
||||
```
|
||||
|
||||
If `$DISCUSS_MODE` and `$VALIDATE_MODE` (no research):
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► QUICK TASK (DISCUSS + VALIDATE)
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
◆ Discussion + plan checking + verification enabled
|
||||
```
|
||||
|
||||
If `$DISCUSS_MODE` and `$RESEARCH_MODE` (no full):
|
||||
If `$DISCUSS_MODE` and `$RESEARCH_MODE` (no validate):
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► QUICK TASK (DISCUSS + RESEARCH)
|
||||
@@ -75,10 +87,10 @@ If `$DISCUSS_MODE` and `$RESEARCH_MODE` (no full):
|
||||
◆ Discussion + research enabled
|
||||
```
|
||||
|
||||
If `$RESEARCH_MODE` and `$FULL_MODE` (no discuss):
|
||||
If `$RESEARCH_MODE` and `$VALIDATE_MODE` (no discuss):
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► QUICK TASK (RESEARCH + FULL)
|
||||
GSD ► QUICK TASK (RESEARCH + VALIDATE)
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
◆ Research + plan checking + verification enabled
|
||||
@@ -102,10 +114,10 @@ If `$RESEARCH_MODE` only:
|
||||
◆ Research phase enabled — investigating approaches before planning
|
||||
```
|
||||
|
||||
If `$FULL_MODE` only:
|
||||
If `$VALIDATE_MODE` only:
|
||||
```
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
GSD ► QUICK TASK (FULL MODE)
|
||||
GSD ► QUICK TASK (VALIDATE)
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
◆ Plan checking + verification enabled
|
||||
@@ -126,6 +138,10 @@ AGENT_SKILLS_VERIFIER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" age
|
||||
|
||||
Parse JSON for: `planner_model`, `executor_model`, `checker_model`, `verifier_model`, `commit_docs`, `branch_name`, `quick_id`, `slug`, `date`, `timestamp`, `quick_dir`, `task_dir`, `roadmap_exists`, `planning_exists`.
|
||||
|
||||
```bash
|
||||
USE_WORKTREES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
|
||||
```
|
||||
|
||||
**If `roadmap_exists` is false:** Error — Quick mode requires an active project with ROADMAP.md. Run `/gsd:new-project` first.
|
||||
|
||||
Quick tasks can run mid-phase - validation only checks ROADMAP.md exists, not phase status.
|
||||
@@ -367,16 +383,16 @@ If research file not found, warn but continue: "Research agent did not produce o
|
||||
|
||||
**Step 5: Spawn planner (quick mode)**
|
||||
|
||||
**If `$FULL_MODE`:** Use `quick-full` mode with stricter constraints.
|
||||
**If `$VALIDATE_MODE`:** Use `quick-full` mode with stricter constraints.
|
||||
|
||||
**If NOT `$FULL_MODE`:** Use standard `quick` mode.
|
||||
**If NOT `$VALIDATE_MODE`:** Use standard `quick` mode.
|
||||
|
||||
```
|
||||
Task(
|
||||
prompt="
|
||||
<planning_context>
|
||||
|
||||
**Mode:** ${FULL_MODE ? 'quick-full' : 'quick'}
|
||||
**Mode:** ${VALIDATE_MODE ? 'quick-full' : 'quick'}
|
||||
**Directory:** ${QUICK_DIR}
|
||||
**Description:** ${DESCRIPTION}
|
||||
|
||||
@@ -397,9 +413,9 @@ ${AGENT_SKILLS_PLANNER}
|
||||
- Create a SINGLE plan with 1-3 focused tasks
|
||||
- Quick tasks should be atomic and self-contained
|
||||
${RESEARCH_MODE ? '- Research findings are available — use them to inform library/pattern choices' : '- No research phase'}
|
||||
${FULL_MODE ? '- Target ~40% context usage (structured for verification)' : '- Target ~30% context usage (simple, focused)'}
|
||||
${FULL_MODE ? '- MUST generate `must_haves` in plan frontmatter (truths, artifacts, key_links)' : ''}
|
||||
${FULL_MODE ? '- Each task MUST have `files`, `action`, `verify`, `done` fields' : ''}
|
||||
${VALIDATE_MODE ? '- Target ~40% context usage (structured for verification)' : '- Target ~30% context usage (simple, focused)'}
|
||||
${VALIDATE_MODE ? '- MUST generate `must_haves` in plan frontmatter (truths, artifacts, key_links)' : ''}
|
||||
${VALIDATE_MODE ? '- Each task MUST have `files`, `action`, `verify`, `done` fields' : ''}
|
||||
</constraints>
|
||||
|
||||
<output>
|
||||
@@ -422,9 +438,9 @@ If plan not found, error: "Planner failed to create ${quick_id}-PLAN.md"
|
||||
|
||||
---
|
||||
|
||||
**Step 5.5: Plan-checker loop (only when `$FULL_MODE`)**
|
||||
**Step 5.5: Plan-checker loop (only when `$VALIDATE_MODE`)**
|
||||
|
||||
Skip this step entirely if NOT `$FULL_MODE`.
|
||||
Skip this step entirely if NOT `$VALIDATE_MODE`.
|
||||
|
||||
Display banner:
|
||||
```
|
||||
@@ -552,22 +568,37 @@ ${AGENT_SKILLS_EXECUTOR}
|
||||
|
||||
<constraints>
|
||||
- Execute all tasks in the plan
|
||||
- Commit each task atomically
|
||||
- Commit each task atomically (code changes only)
|
||||
- Create summary at: ${QUICK_DIR}/${quick_id}-SUMMARY.md
|
||||
- Do NOT commit docs artifacts (SUMMARY.md, STATE.md, PLAN.md) — the orchestrator handles the docs commit in Step 8
|
||||
- Do NOT update ROADMAP.md (quick tasks are separate from planned phases)
|
||||
</constraints>
|
||||
",
|
||||
subagent_type="gsd-executor",
|
||||
model="{executor_model}",
|
||||
isolation="worktree",
|
||||
${USE_WORKTREES !== "false" ? 'isolation="worktree",' : ''}
|
||||
description="Execute: ${DESCRIPTION}"
|
||||
)
|
||||
```
|
||||
|
||||
After executor returns:
|
||||
1. Verify summary exists at `${QUICK_DIR}/${quick_id}-SUMMARY.md`
|
||||
2. Extract commit hash from executor output
|
||||
3. Report completion status
|
||||
1. **Worktree cleanup:** If the executor ran with `isolation="worktree"`, merge the worktree branch back and clean up:
|
||||
```bash
|
||||
# Find worktrees created by the executor
|
||||
WORKTREES=$(git worktree list --porcelain | grep "^worktree " | grep -v "$(pwd)$" | sed 's/^worktree //')
|
||||
for WT in $WORKTREES; do
|
||||
WT_BRANCH=$(git -C "$WT" rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
if [ -n "$WT_BRANCH" ] && [ "$WT_BRANCH" != "HEAD" ]; then
|
||||
git merge "$WT_BRANCH" --no-edit -m "chore: merge quick task worktree ($WT_BRANCH)" 2>&1 || echo "⚠ Merge conflict — resolve manually"
|
||||
git worktree remove "$WT" --force 2>/dev/null || true
|
||||
git branch -D "$WT_BRANCH" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
```
|
||||
If `workflow.use_worktrees` is `false`, skip this step.
|
||||
2. Verify summary exists at `${QUICK_DIR}/${quick_id}-SUMMARY.md`
|
||||
3. Extract commit hash from executor output
|
||||
4. Report completion status
|
||||
|
||||
**Known Claude Code bug (classifyHandoffIfNeeded):** If executor reports "failed" with error `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a real failure. Check if summary file exists and git log shows commits. If so, treat as successful.
|
||||
|
||||
@@ -577,9 +608,9 @@ Note: For quick tasks producing multiple plans (rare), spawn executors in parall
|
||||
|
||||
---
|
||||
|
||||
**Step 6.5: Verification (only when `$FULL_MODE`)**
|
||||
**Step 6.5: Verification (only when `$VALIDATE_MODE`)**
|
||||
|
||||
Skip this step entirely if NOT `$FULL_MODE`.
|
||||
Skip this step entirely if NOT `$VALIDATE_MODE`.
|
||||
|
||||
Display banner:
|
||||
```
|
||||
@@ -636,7 +667,7 @@ Read STATE.md and check for `### Quick Tasks Completed` section.
|
||||
|
||||
Insert after `### Blockers/Concerns` section:
|
||||
|
||||
**If `$FULL_MODE`:**
|
||||
**If `$VALIDATE_MODE`:**
|
||||
```markdown
|
||||
### Quick Tasks Completed
|
||||
|
||||
@@ -644,7 +675,7 @@ Insert after `### Blockers/Concerns` section:
|
||||
|---|-------------|------|--------|--------|-----------|
|
||||
```
|
||||
|
||||
**If NOT `$FULL_MODE`:**
|
||||
**If NOT `$VALIDATE_MODE`:**
|
||||
```markdown
|
||||
### Quick Tasks Completed
|
||||
|
||||
@@ -652,18 +683,18 @@ Insert after `### Blockers/Concerns` section:
|
||||
|---|-------------|------|--------|-----------|
|
||||
```
|
||||
|
||||
**Note:** If the table already exists, match its existing column format. If adding `--full` to a project that already has quick tasks without a Status column, add the Status column to the header and separator rows, and leave Status empty for the new row's predecessors.
|
||||
**Note:** If the table already exists, match its existing column format. If adding `--validate` (or `--full`) to a project that already has quick tasks without a Status column, add the Status column to the header and separator rows, and leave Status empty for the new row's predecessors.
|
||||
|
||||
**7c. Append new row to table:**
|
||||
|
||||
Use `date` from init:
|
||||
|
||||
**If `$FULL_MODE` (or table has Status column):**
|
||||
**If `$VALIDATE_MODE` (or table has Status column):**
|
||||
```markdown
|
||||
| ${quick_id} | ${DESCRIPTION} | ${date} | ${commit_hash} | ${VERIFICATION_STATUS} | [${quick_id}-${slug}](./quick/${quick_id}-${slug}/) |
|
||||
```
|
||||
|
||||
**If NOT `$FULL_MODE` (and table has no Status column):**
|
||||
**If NOT `$VALIDATE_MODE` (and table has no Status column):**
|
||||
```markdown
|
||||
| ${quick_id} | ${DESCRIPTION} | ${date} | ${commit_hash} | [${quick_id}-${slug}](./quick/${quick_id}-${slug}/) |
|
||||
```
|
||||
@@ -681,7 +712,7 @@ Use Edit tool to make these changes atomically
|
||||
|
||||
**Step 8: Final commit and completion**
|
||||
|
||||
Stage and commit quick task artifacts:
|
||||
Stage and commit quick task artifacts. This step MUST always run — even if the executor already committed some files (e.g. when running without worktree isolation). The `gsd-tools commit` command handles already-committed files gracefully.
|
||||
|
||||
Build file list:
|
||||
- `${QUICK_DIR}/${quick_id}-PLAN.md`
|
||||
@@ -689,9 +720,12 @@ Build file list:
|
||||
- `.planning/STATE.md`
|
||||
- If `$DISCUSS_MODE` and context file exists: `${QUICK_DIR}/${quick_id}-CONTEXT.md`
|
||||
- If `$RESEARCH_MODE` and research file exists: `${QUICK_DIR}/${quick_id}-RESEARCH.md`
|
||||
- If `$FULL_MODE` and verification file exists: `${QUICK_DIR}/${quick_id}-VERIFICATION.md`
|
||||
- If `$VALIDATE_MODE` and verification file exists: `${QUICK_DIR}/${quick_id}-VERIFICATION.md`
|
||||
|
||||
```bash
|
||||
# Explicitly stage all artifacts before commit — PLAN.md may be untracked
|
||||
# if the executor ran without worktree isolation and committed docs early
|
||||
git add ${file_list} 2>/dev/null
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(quick-${quick_id}): ${DESCRIPTION}" --files ${file_list}
|
||||
```
|
||||
|
||||
@@ -702,11 +736,11 @@ commit_hash=$(git rev-parse --short HEAD)
|
||||
|
||||
Display completion output:
|
||||
|
||||
**If `$FULL_MODE`:**
|
||||
**If `$VALIDATE_MODE`:**
|
||||
```
|
||||
---
|
||||
|
||||
GSD > QUICK TASK COMPLETE (FULL MODE)
|
||||
GSD > QUICK TASK COMPLETE (VALIDATED)
|
||||
|
||||
Quick Task ${quick_id}: ${DESCRIPTION}
|
||||
|
||||
@@ -720,7 +754,7 @@ Commit: ${commit_hash}
|
||||
Ready for next task: /gsd:quick ${GSD_WS}
|
||||
```
|
||||
|
||||
**If NOT `$FULL_MODE`:**
|
||||
**If NOT `$VALIDATE_MODE`:**
|
||||
```
|
||||
---
|
||||
|
||||
@@ -742,16 +776,17 @@ Ready for next task: /gsd:quick ${GSD_WS}
|
||||
<success_criteria>
|
||||
- [ ] ROADMAP.md validation passes
|
||||
- [ ] User provides task description
|
||||
- [ ] `--full`, `--discuss`, and `--research` flags parsed from arguments when present
|
||||
- [ ] `--full`, `--validate`, `--discuss`, and `--research` flags parsed from arguments when present
|
||||
- [ ] `--full` sets all booleans (`$FULL_MODE`, `$DISCUSS_MODE`, `$RESEARCH_MODE`, `$VALIDATE_MODE`)
|
||||
- [ ] Slug generated (lowercase, hyphens, max 40 chars)
|
||||
- [ ] Quick ID generated (YYMMDD-xxx format, 2s Base36 precision)
|
||||
- [ ] Directory created at `.planning/quick/YYMMDD-xxx-slug/`
|
||||
- [ ] (--discuss) Gray areas identified and presented, decisions captured in `${quick_id}-CONTEXT.md`
|
||||
- [ ] (--research) Research agent spawned, `${quick_id}-RESEARCH.md` created
|
||||
- [ ] `${quick_id}-PLAN.md` created by planner (honors CONTEXT.md decisions when --discuss, uses RESEARCH.md findings when --research)
|
||||
- [ ] (--full) Plan checker validates plan, revision loop capped at 2
|
||||
- [ ] (--validate) Plan checker validates plan, revision loop capped at 2
|
||||
- [ ] `${quick_id}-SUMMARY.md` created by executor
|
||||
- [ ] (--full) `${quick_id}-VERIFICATION.md` created by verifier
|
||||
- [ ] STATE.md updated with quick task row (Status column when --full)
|
||||
- [ ] (--validate) `${quick_id}-VERIFICATION.md` created by verifier
|
||||
- [ ] STATE.md updated with quick task row (Status column when --validate)
|
||||
- [ ] Artifacts committed
|
||||
</success_criteria>
|
||||
|
||||
@@ -18,12 +18,14 @@ Check which AI CLIs are available on the system:
|
||||
command -v gemini >/dev/null 2>&1 && echo "gemini:available" || echo "gemini:missing"
|
||||
command -v claude >/dev/null 2>&1 && echo "claude:available" || echo "claude:missing"
|
||||
command -v codex >/dev/null 2>&1 && echo "codex:available" || echo "codex:missing"
|
||||
command -v coderabbit >/dev/null 2>&1 && echo "coderabbit:available" || echo "coderabbit:missing"
|
||||
```
|
||||
|
||||
Parse flags from `$ARGUMENTS`:
|
||||
- `--gemini` → include Gemini
|
||||
- `--claude` → include Claude
|
||||
- `--codex` → include Codex
|
||||
- `--coderabbit` → include CodeRabbit
|
||||
- `--all` → include all available
|
||||
- No flags → include all available
|
||||
|
||||
@@ -131,6 +133,14 @@ claude -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" --no-input 2>/dev/null > /t
|
||||
codex exec --skip-git-repo-check "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-codex-{phase}.md
|
||||
```
|
||||
|
||||
**CodeRabbit:**
|
||||
|
||||
Note: CodeRabbit reviews the current git diff/working tree — it does not accept a prompt. It may take up to 5 minutes. Use `timeout: 360000` on the Bash tool call.
|
||||
|
||||
```bash
|
||||
coderabbit review --prompt-only 2>/dev/null > /tmp/gsd-review-coderabbit-{phase}.md
|
||||
```
|
||||
|
||||
If a CLI fails, log the error and continue with remaining CLIs.
|
||||
|
||||
Display progress:
|
||||
@@ -150,7 +160,7 @@ Combine all review responses into `{phase_dir}/{padded_phase}-REVIEWS.md`:
|
||||
```markdown
|
||||
---
|
||||
phase: {N}
|
||||
reviewers: [gemini, claude, codex]
|
||||
reviewers: [gemini, claude, codex, coderabbit]
|
||||
reviewed_at: {ISO timestamp}
|
||||
plans_reviewed: [{list of PLAN.md files}]
|
||||
---
|
||||
@@ -175,6 +185,12 @@ plans_reviewed: [{list of PLAN.md files}]
|
||||
|
||||
---
|
||||
|
||||
## CodeRabbit Review
|
||||
|
||||
{coderabbit review content}
|
||||
|
||||
---
|
||||
|
||||
## Consensus Summary
|
||||
|
||||
{synthesize common concerns across all reviewers}
|
||||
|
||||
164
get-shit-done/workflows/secure-phase.md
Normal file
164
get-shit-done/workflows/secure-phase.md
Normal file
@@ -0,0 +1,164 @@
|
||||
<purpose>
|
||||
Verify threat mitigations for a completed phase. Confirm PLAN.md threat register dispositions are resolved. Update SECURITY.md.
|
||||
</purpose>
|
||||
|
||||
<required_reading>
|
||||
@~/.claude/get-shit-done/references/ui-brand.md
|
||||
</required_reading>
|
||||
|
||||
<available_agent_types>
|
||||
Valid GSD subagent types (use exact names — do not fall back to 'general-purpose'):
|
||||
- gsd-security-auditor — Verifies threat mitigation coverage
|
||||
</available_agent_types>
|
||||
|
||||
<process>
|
||||
|
||||
## 0. Initialize
|
||||
|
||||
```bash
|
||||
INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}")
|
||||
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
|
||||
AGENT_SKILLS_AUDITOR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-security-auditor 2>/dev/null)
|
||||
```
|
||||
|
||||
Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`.
|
||||
|
||||
```bash
|
||||
AUDITOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-security-auditor --raw)
|
||||
SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
|
||||
```
|
||||
|
||||
If `SECURITY_CFG` is `false`: exit with "Security enforcement disabled. Enable via /gsd:settings."
|
||||
|
||||
Display banner: `GSD > SECURE PHASE {N}: {name}`
|
||||
|
||||
## 1. Detect Input State
|
||||
|
||||
```bash
|
||||
SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1)
|
||||
PLAN_FILES=$(ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null)
|
||||
SUMMARY_FILES=$(ls "${PHASE_DIR}"/*-SUMMARY.md 2>/dev/null)
|
||||
```
|
||||
|
||||
- **State A** (`SECURITY_FILE` non-empty): Audit existing
|
||||
- **State B** (`SECURITY_FILE` empty, `PLAN_FILES` and `SUMMARY_FILES` non-empty): Run from artifacts
|
||||
- **State C** (`SUMMARY_FILES` empty): Exit — "Phase {N} not executed. Run /gsd:execute-phase {N} first."
|
||||
|
||||
## 2. Discovery
|
||||
|
||||
### 2a. Read Phase Artifacts
|
||||
|
||||
Read PLAN.md — extract `<threat_model>` block: trust boundaries, STRIDE register (`threat_id`, `category`, `component`, `disposition`, `mitigation_plan`).
|
||||
|
||||
### 2b. Read Summary Threat Flags
|
||||
|
||||
Read SUMMARY.md — extract `## Threat Flags` entries.
|
||||
|
||||
### 2c. Build Threat Register
|
||||
|
||||
Per threat: `{ threat_id, category, component, disposition, mitigation_pattern, files_to_check }`
|
||||
|
||||
## 3. Threat Classification
|
||||
|
||||
Classify each threat:
|
||||
|
||||
| Status | Criteria |
|
||||
|--------|----------|
|
||||
| CLOSED | mitigation found OR accepted risk documented in SECURITY.md OR transfer documented |
|
||||
| OPEN | none of the above |
|
||||
|
||||
Build: `{ threat_id, category, component, disposition, status, evidence }`
|
||||
|
||||
If `threats_open: 0` → skip to Step 6 directly.
|
||||
|
||||
## 4. Present Threat Plan
|
||||
|
||||
Call AskUserQuestion with threat table and options:
|
||||
1. "Verify all open threats" → Step 5
|
||||
2. "Accept all open — document in accepted risks log" → add to SECURITY.md accepted risks, set all CLOSED, Step 6
|
||||
3. "Cancel" → exit
|
||||
|
||||
## 5. Spawn gsd-security-auditor
|
||||
|
||||
```
|
||||
Task(
|
||||
prompt="Read ~/.claude/agents/gsd-security-auditor.md for instructions.\n\n" +
|
||||
"<files_to_read>{PLAN, SUMMARY, impl files, SECURITY.md}</files_to_read>" +
|
||||
"<threat_register>{threat register}</threat_register>" +
|
||||
"<config>asvs_level: {SECURITY_ASVS}, block_on: {SECURITY_BLOCK_ON}</config>" +
|
||||
"<constraints>Never modify implementation files. Verify mitigations exist — do not scan for new threats. Escalate implementation gaps.</constraints>" +
|
||||
"${AGENT_SKILLS_AUDITOR}",
|
||||
subagent_type="gsd-security-auditor",
|
||||
model="{AUDITOR_MODEL}",
|
||||
description="Verify threat mitigations for Phase {N}"
|
||||
)
|
||||
```
|
||||
|
||||
Handle return:
|
||||
- `## SECURED` → record closures → Step 6
|
||||
- `## OPEN_THREATS` → record closed + open, present user with accept/block choice → Step 6
|
||||
- `## ESCALATE` → present to user → Step 6
|
||||
|
||||
## 6. Write/Update SECURITY.md
|
||||
|
||||
**State B (create):**
|
||||
1. Read template from `~/.claude/get-shit-done/templates/SECURITY.md`
|
||||
2. Fill: frontmatter, threat register, accepted risks, audit trail
|
||||
3. Write to `${PHASE_DIR}/${PADDED_PHASE}-SECURITY.md`
|
||||
|
||||
**State A (update):**
|
||||
1. Update threat register statuses, append to audit trail:
|
||||
|
||||
```markdown
|
||||
## Security Audit {date}
|
||||
| Metric | Count |
|
||||
|--------|-------|
|
||||
| Threats found | {N} |
|
||||
| Closed | {M} |
|
||||
| Open | {K} |
|
||||
```
|
||||
|
||||
**ENFORCING GATE:** If `threats_open > 0` after all options exhausted (user did not accept, not all verified closed):
|
||||
|
||||
```
|
||||
GSD > PHASE {N} SECURITY BLOCKED
|
||||
{K} threats open — phase advancement blocked until threats_open: 0
|
||||
▶ Fix mitigations then re-run: /gsd:secure-phase {N}
|
||||
▶ Or document accepted risks in SECURITY.md and re-run.
|
||||
```
|
||||
|
||||
Do NOT emit next-phase routing. Stop here.
|
||||
|
||||
## 7. Commit
|
||||
|
||||
```bash
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PHASE}): add/update security threat verification"
|
||||
```
|
||||
|
||||
## 8. Results + Routing
|
||||
|
||||
**Secured (threats_open: 0):**
|
||||
```
|
||||
GSD > PHASE {N} THREAT-SECURE
|
||||
threats_open: 0 — all threats have dispositions.
|
||||
▶ /gsd:validate-phase {N} validate test coverage
|
||||
▶ /gsd:verify-work {N} run UAT
|
||||
```
|
||||
|
||||
Display `/clear` reminder.
|
||||
|
||||
</process>
|
||||
|
||||
<success_criteria>
|
||||
- [ ] Security enforcement checked — exit if false
|
||||
- [ ] Input state detected (A/B/C) — state C exits cleanly
|
||||
- [ ] PLAN.md threat model parsed, register built
|
||||
- [ ] SUMMARY.md threat flags incorporated
|
||||
- [ ] threats_open: 0 → skip directly to Step 6
|
||||
- [ ] User gate with threat table presented
|
||||
- [ ] Auditor spawned with complete context
|
||||
- [ ] All three return formats (SECURED/OPEN_THREATS/ESCALATE) handled
|
||||
- [ ] SECURITY.md created or updated
|
||||
- [ ] threats_open > 0 BLOCKS advancement (no next-phase routing emitted)
|
||||
- [ ] Results with routing presented on success
|
||||
</success_criteria>
|
||||
@@ -199,11 +199,18 @@ Format each as: Test Name → What to do → Expected result → Why can't verif
|
||||
</step>
|
||||
|
||||
<step name="determine_status">
|
||||
**passed:** All truths VERIFIED, all artifacts pass levels 1-3, all key links WIRED, no blocker anti-patterns.
|
||||
Classify status using this decision tree IN ORDER (most restrictive first):
|
||||
|
||||
**gaps_found:** Any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, or blocker found.
|
||||
1. IF any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, or blocker found:
|
||||
→ **gaps_found**
|
||||
|
||||
**human_needed:** All automated checks pass but human verification items remain.
|
||||
2. IF the previous step produced ANY human verification items:
|
||||
→ **human_needed** (even if all truths VERIFIED and score is N/N)
|
||||
|
||||
3. IF all checks pass AND no human verification items:
|
||||
→ **passed**
|
||||
|
||||
**passed is ONLY valid when no human verification items exist.**
|
||||
|
||||
**Score:** `verified_truths / total_truths`
|
||||
</step>
|
||||
|
||||
@@ -375,11 +375,38 @@ Present summary:
|
||||
**If issues > 0:** Proceed to `diagnose_issues`
|
||||
|
||||
**If issues == 0:**
|
||||
|
||||
```bash
|
||||
SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
|
||||
SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1)
|
||||
```
|
||||
|
||||
If `SECURITY_CFG` is `true` AND `SECURITY_FILE` is empty:
|
||||
```
|
||||
⚠ Security enforcement enabled — /gsd:secure-phase {phase} has not run.
|
||||
Run before advancing to the next phase.
|
||||
|
||||
All tests passed. Ready to continue.
|
||||
|
||||
- `/gsd:secure-phase {phase}` — security review (required before advancing)
|
||||
- `/gsd:plan-phase {next}` — Plan next phase
|
||||
- `/gsd:execute-phase {next}` — Execute next phase
|
||||
- `/gsd:ui-review {phase}` — visual quality audit (if frontend files were modified)
|
||||
```
|
||||
|
||||
If `SECURITY_CFG` is `true` AND `SECURITY_FILE` exists: check frontmatter `threats_open`. If > 0:
|
||||
```
|
||||
⚠ Security gate: {threats_open} threats open
|
||||
/gsd:secure-phase {phase} — resolve before advancing
|
||||
```
|
||||
|
||||
If `SECURITY_CFG` is `false` OR (`SECURITY_FILE` exists AND `threats_open` is `0`):
|
||||
```
|
||||
All tests passed. Ready to continue.
|
||||
|
||||
- `/gsd:plan-phase {next}` — Plan next phase
|
||||
- `/gsd:execute-phase {next}` — Execute next phase
|
||||
- `/gsd:secure-phase {phase}` — security review
|
||||
- `/gsd:ui-review {phase}` — visual quality audit (if frontend files were modified)
|
||||
```
|
||||
</step>
|
||||
|
||||
Reference in New Issue
Block a user