refactor: extract settings, add-todo, pause-work, set-profile to thin orchestrators

Completes Phase 1 thin orchestrator extraction.
Token savings: ~8,500 chars across 4 commands

Ported from: get-shit-done-v2@95b6214
This commit is contained in:
TÂCHES
2026-02-07 11:08:35 -06:00
parent 8f26bfa478
commit d2623e0114
8 changed files with 578 additions and 542 deletions

View File

@@ -0,0 +1,153 @@
<purpose>
Capture an idea, task, or issue that surfaces during a GSD session as a structured todo for later work. Enables "thought → capture → continue" flow without losing context.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="ensure_directory">
```bash
mkdir -p .planning/todos/pending .planning/todos/done
```
</step>
<step name="check_existing_areas">
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js list-todos | grep -oP '"area":\s*"\K[^"]+' | sort -u
```
Note existing areas for consistency in infer_area step.
</step>
<step name="extract_content">
**With arguments:** Use as the title/focus.
- `/gsd:add-todo Add auth token refresh` → title = "Add auth token refresh"
**Without arguments:** Analyze recent conversation to extract:
- The specific problem, idea, or task discussed
- Relevant file paths mentioned
- Technical details (error messages, line numbers, constraints)
Formulate:
- `title`: 3-10 word descriptive title (action verb preferred)
- `problem`: What's wrong or why this is needed
- `solution`: Approach hints or "TBD" if just an idea
- `files`: Relevant paths with line numbers from conversation
</step>
<step name="infer_area">
Infer area from file paths:
| Path pattern | Area |
|--------------|------|
| `src/api/*`, `api/*` | `api` |
| `src/components/*`, `src/ui/*` | `ui` |
| `src/auth/*`, `auth/*` | `auth` |
| `src/db/*`, `database/*` | `database` |
| `tests/*`, `__tests__/*` | `testing` |
| `docs/*` | `docs` |
| `.planning/*` | `planning` |
| `scripts/*`, `bin/*` | `tooling` |
| No files or unclear | `general` |
Use existing area from step 2 if similar match exists.
</step>
<step name="check_duplicates">
```bash
# Search for key words from title in existing todos
grep -l -i "[key words from title]" .planning/todos/pending/*.md 2>/dev/null
```
If potential duplicate found:
1. Read the existing todo
2. Compare scope
If overlapping, use AskUserQuestion:
- header: "Duplicate?"
- question: "Similar todo exists: [title]. What would you like to do?"
- options:
- "Skip" — keep existing todo
- "Replace" — update existing with new context
- "Add anyway" — create as separate todo
</step>
<step name="create_file">
```bash
timestamp=$(node ~/.claude/get-shit-done/bin/gsd-tools.js current-timestamp full --raw)
date_prefix=$(node ~/.claude/get-shit-done/bin/gsd-tools.js current-timestamp date --raw)
slug=$(node ~/.claude/get-shit-done/bin/gsd-tools.js generate-slug "$title" --raw)
```
Write to `.planning/todos/pending/${date_prefix}-${slug}.md`:
```markdown
---
created: [timestamp]
title: [title]
area: [area]
files:
- [file:lines]
---
## Problem
[problem description - enough context for future Claude to understand weeks later]
## Solution
[approach hints or "TBD"]
```
</step>
<step name="update_state">
If `.planning/STATE.md` exists:
1. Count todos: `node ~/.claude/get-shit-done/bin/gsd-tools.js list-todos --raw`
2. Update "### Pending Todos" under "## Accumulated Context"
</step>
<step name="git_commit">
Commit the todo and any updated state:
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js commit "docs: capture todo - [title]" --files .planning/todos/pending/[filename] .planning/STATE.md
```
Tool respects `commit_docs` config and gitignore automatically.
Confirm: "Committed: docs: capture todo - [title]"
</step>
<step name="confirm">
```
Todo saved: .planning/todos/pending/[filename]
[title]
Area: [area]
Files: [count] referenced
---
Would you like to:
1. Continue with current work
2. Add another todo
3. View all todos (/gsd:check-todos)
```
</step>
</process>
<success_criteria>
- [ ] Directory structure exists
- [ ] Todo file created with valid frontmatter
- [ ] Problem section has enough context for future Claude
- [ ] No duplicates (checked and resolved)
- [ ] Area consistent with existing todos
- [ ] STATE.md updated if exists
- [ ] Todo and state committed to git
</success_criteria>

View File

@@ -0,0 +1,122 @@
<purpose>
Create `.continue-here.md` handoff file to preserve complete work state across sessions. Enables seamless resumption with full context restoration.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="detect">
Find current phase directory from most recently modified files:
```bash
# Find most recent phase directory with work
ls -lt .planning/phases/*/PLAN.md 2>/dev/null | head -1 | grep -oP 'phases/\K[^/]+'
```
If no active phase detected, ask user which phase they're pausing work on.
</step>
<step name="gather">
**Collect complete state for handoff:**
1. **Current position**: Which phase, which plan, which task
2. **Work completed**: What got done this session
3. **Work remaining**: What's left in current plan/phase
4. **Decisions made**: Key decisions and rationale
5. **Blockers/issues**: Anything stuck
6. **Mental context**: The approach, next steps, "vibe"
7. **Files modified**: What's changed but not committed
Ask user for clarifications if needed via conversational questions.
</step>
<step name="write">
**Write handoff to `.planning/phases/XX-name/.continue-here.md`:**
```markdown
---
phase: XX-name
task: 3
total_tasks: 7
status: in_progress
last_updated: [timestamp from current-timestamp]
---
<current_state>
[Where exactly are we? Immediate context]
</current_state>
<completed_work>
- Task 1: [name] - Done
- Task 2: [name] - Done
- Task 3: [name] - In progress, [what's done]
</completed_work>
<remaining_work>
- Task 3: [what's left]
- Task 4: Not started
- Task 5: Not started
</remaining_work>
<decisions_made>
- Decided to use [X] because [reason]
- Chose [approach] over [alternative] because [reason]
</decisions_made>
<blockers>
- [Blocker 1]: [status/workaround]
</blockers>
<context>
[Mental state, what were you thinking, the plan]
</context>
<next_action>
Start with: [specific first action when resuming]
</next_action>
```
Be specific enough for a fresh Claude to understand immediately.
Use `current-timestamp` for last_updated field:
```bash
timestamp=$(node ~/.claude/get-shit-done/bin/gsd-tools.js current-timestamp full --raw)
```
</step>
<step name="commit">
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js commit "wip: [phase-name] paused at task [X]/[Y]" --files .planning/phases/*/.continue-here.md
```
</step>
<step name="confirm">
```
✓ Handoff created: .planning/phases/[XX-name]/.continue-here.md
Current state:
- Phase: [XX-name]
- Task: [X] of [Y]
- Status: [in_progress/blocked]
- Committed as WIP
To resume: /gsd:resume-work
```
</step>
</process>
<success_criteria>
- [ ] .continue-here.md created in correct phase directory
- [ ] All sections filled with specific content
- [ ] Committed as WIP
- [ ] User knows location and how to resume
</success_criteria>

View File

@@ -0,0 +1,80 @@
<purpose>
Switch the model profile used by GSD agents. Controls which Claude model each agent uses, balancing quality vs token spend.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="validate">
Validate argument:
```
if $ARGUMENTS.profile not in ["quality", "balanced", "budget"]:
Error: Invalid profile "$ARGUMENTS.profile"
Valid profiles: quality, balanced, budget
EXIT
```
</step>
<step name="ensure_config">
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js config-ensure-section
```
Creates `.planning/config.json` with defaults if missing.
</step>
<step name="update_config">
Read current config:
```bash
cat .planning/config.json
```
Update `model_profile` field:
```json
{
"model_profile": "$ARGUMENTS.profile"
}
```
Write updated config back to `.planning/config.json`.
</step>
<step name="confirm">
Display confirmation with model table for selected profile:
```
✓ Model profile set to: $ARGUMENTS.profile
Agents will now use:
[Show table from MODEL_PROFILES in gsd-tools.js for selected profile]
Example:
| Agent | Model |
|-------|-------|
| gsd-planner | opus |
| gsd-executor | sonnet |
| gsd-verifier | haiku |
| ... | ... |
Next spawned agents will use the new profile.
```
Map profile names:
- quality: use "quality" column from MODEL_PROFILES
- balanced: use "balanced" column from MODEL_PROFILES
- budget: use "budget" column from MODEL_PROFILES
</step>
</process>
<success_criteria>
- [ ] Argument validated
- [ ] Config file ensured
- [ ] Config updated with new model_profile
- [ ] Confirmation displayed with model table
</success_criteria>

View File

@@ -0,0 +1,142 @@
<purpose>
Interactive configuration of GSD workflow agents (research, plan_check, verifier) and model profile selection via multi-question prompt. Updates .planning/config.json with user preferences.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="ensure_config">
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js config-ensure-section
```
Creates `.planning/config.json` with defaults if missing.
</step>
<step name="read_current">
```bash
cat .planning/config.json
```
Parse current values (default to `true` if not present):
- `workflow.research` — spawn researcher during plan-phase
- `workflow.plan_check` — spawn plan checker during plan-phase
- `workflow.verifier` — spawn verifier during execute-phase
- `model_profile` — which model each agent uses (default: `balanced`)
- `git.branching_strategy` — branching approach (default: `"none"`)
</step>
<step name="present_settings">
Use AskUserQuestion with current values pre-selected:
```
AskUserQuestion([
{
question: "Which model profile for agents?",
header: "Model",
multiSelect: false,
options: [
{ label: "Quality", description: "Opus everywhere except verification (highest cost)" },
{ label: "Balanced (Recommended)", description: "Opus for planning, Sonnet for execution/verification" },
{ label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost)" }
]
},
{
question: "Spawn Plan Researcher? (researches domain before planning)",
header: "Research",
multiSelect: false,
options: [
{ label: "Yes", description: "Research phase goals before planning" },
{ label: "No", description: "Skip research, plan directly" }
]
},
{
question: "Spawn Plan Checker? (verifies plans before execution)",
header: "Plan Check",
multiSelect: false,
options: [
{ label: "Yes", description: "Verify plans meet phase goals" },
{ label: "No", description: "Skip plan verification" }
]
},
{
question: "Spawn Execution Verifier? (verifies phase completion)",
header: "Verifier",
multiSelect: false,
options: [
{ label: "Yes", description: "Verify must-haves after execution" },
{ label: "No", description: "Skip post-execution verification" }
]
},
{
question: "Git branching strategy?",
header: "Branching",
multiSelect: false,
options: [
{ label: "None (Recommended)", description: "Commit directly to current branch" },
{ label: "Per Phase", description: "Create branch for each phase (gsd/phase-{N}-{name})" },
{ label: "Per Milestone", description: "Create branch for entire milestone (gsd/{version}-{name})" }
]
}
])
```
</step>
<step name="update_config">
Merge new settings into existing config.json:
```json
{
...existing_config,
"model_profile": "quality" | "balanced" | "budget",
"workflow": {
"research": true/false,
"plan_check": true/false,
"verifier": true/false
},
"git": {
"branching_strategy": "none" | "phase" | "milestone"
}
}
```
Write updated config to `.planning/config.json`.
</step>
<step name="confirm">
Display:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GSD ► SETTINGS UPDATED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
| Setting | Value |
|----------------------|-------|
| Model Profile | {quality/balanced/budget} |
| Plan Researcher | {On/Off} |
| Plan Checker | {On/Off} |
| Execution Verifier | {On/Off} |
| Git Branching | {None/Per Phase/Per Milestone} |
These settings apply to future /gsd:plan-phase and /gsd:execute-phase runs.
Quick commands:
- /gsd:set-profile <profile> — switch model profile
- /gsd:plan-phase --research — force research
- /gsd:plan-phase --skip-research — skip research
- /gsd:plan-phase --skip-verify — skip plan check
```
</step>
</process>
<success_criteria>
- [ ] Current config read
- [ ] User presented with 5 settings (profile + 3 workflow toggles + git branching)
- [ ] Config updated with model_profile, workflow, and git sections
- [ ] Changes confirmed to user
</success_criteria>