@opellen/scaff 0.1.11

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 (98) hide show
  1. package/README.ko.md +327 -0
  2. package/README.md +326 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +225 -0
  5. package/dist/extend.d.ts +12 -0
  6. package/dist/extend.js +242 -0
  7. package/dist/hook-parser.d.ts +15 -0
  8. package/dist/hook-parser.js +95 -0
  9. package/dist/i18n/index.d.ts +5 -0
  10. package/dist/i18n/index.js +20 -0
  11. package/dist/i18n/messages.d.ts +28 -0
  12. package/dist/i18n/messages.js +49 -0
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +4 -0
  15. package/dist/installer.d.ts +10 -0
  16. package/dist/installer.js +74 -0
  17. package/dist/marker.d.ts +11 -0
  18. package/dist/marker.js +25 -0
  19. package/dist/platforms/amazon-q.d.ts +2 -0
  20. package/dist/platforms/amazon-q.js +12 -0
  21. package/dist/platforms/antigravity.d.ts +2 -0
  22. package/dist/platforms/antigravity.js +12 -0
  23. package/dist/platforms/auggie.d.ts +2 -0
  24. package/dist/platforms/auggie.js +15 -0
  25. package/dist/platforms/claude.d.ts +2 -0
  26. package/dist/platforms/claude.js +7 -0
  27. package/dist/platforms/cline.d.ts +2 -0
  28. package/dist/platforms/cline.js +11 -0
  29. package/dist/platforms/codebuddy.d.ts +2 -0
  30. package/dist/platforms/codebuddy.js +16 -0
  31. package/dist/platforms/codex.d.ts +2 -0
  32. package/dist/platforms/codex.js +7 -0
  33. package/dist/platforms/continue.d.ts +2 -0
  34. package/dist/platforms/continue.js +16 -0
  35. package/dist/platforms/costrict.d.ts +2 -0
  36. package/dist/platforms/costrict.js +15 -0
  37. package/dist/platforms/crush.d.ts +2 -0
  38. package/dist/platforms/crush.js +19 -0
  39. package/dist/platforms/cursor.d.ts +2 -0
  40. package/dist/platforms/cursor.js +18 -0
  41. package/dist/platforms/factory.d.ts +2 -0
  42. package/dist/platforms/factory.js +15 -0
  43. package/dist/platforms/gemini.d.ts +2 -0
  44. package/dist/platforms/gemini.js +14 -0
  45. package/dist/platforms/github-copilot.d.ts +2 -0
  46. package/dist/platforms/github-copilot.js +12 -0
  47. package/dist/platforms/iflow.d.ts +2 -0
  48. package/dist/platforms/iflow.js +18 -0
  49. package/dist/platforms/index.d.ts +9 -0
  50. package/dist/platforms/index.js +57 -0
  51. package/dist/platforms/kilocode.d.ts +2 -0
  52. package/dist/platforms/kilocode.js +8 -0
  53. package/dist/platforms/kiro.d.ts +2 -0
  54. package/dist/platforms/kiro.js +12 -0
  55. package/dist/platforms/opencode.d.ts +2 -0
  56. package/dist/platforms/opencode.js +12 -0
  57. package/dist/platforms/pi.d.ts +2 -0
  58. package/dist/platforms/pi.js +12 -0
  59. package/dist/platforms/qoder.d.ts +2 -0
  60. package/dist/platforms/qoder.js +19 -0
  61. package/dist/platforms/qwen.d.ts +2 -0
  62. package/dist/platforms/qwen.js +14 -0
  63. package/dist/platforms/roocode.d.ts +2 -0
  64. package/dist/platforms/roocode.js +11 -0
  65. package/dist/platforms/toml.d.ts +9 -0
  66. package/dist/platforms/toml.js +18 -0
  67. package/dist/platforms/trae.d.ts +2 -0
  68. package/dist/platforms/trae.js +11 -0
  69. package/dist/platforms/types.d.ts +19 -0
  70. package/dist/platforms/types.js +1 -0
  71. package/dist/platforms/windsurf.d.ts +2 -0
  72. package/dist/platforms/windsurf.js +19 -0
  73. package/dist/platforms/yaml.d.ts +10 -0
  74. package/dist/platforms/yaml.js +30 -0
  75. package/dist/prompts/platform-select.d.ts +1 -0
  76. package/dist/prompts/platform-select.js +185 -0
  77. package/dist/skills/generate.d.ts +13 -0
  78. package/dist/skills/generate.js +16 -0
  79. package/dist/templates.d.ts +18 -0
  80. package/dist/templates.js +96 -0
  81. package/dist/ui/ascii-logo.d.ts +6 -0
  82. package/dist/ui/ascii-logo.js +38 -0
  83. package/dist/ui/colors.d.ts +2 -0
  84. package/dist/ui/colors.js +3 -0
  85. package/dist/ui/welcome.d.ts +1 -0
  86. package/dist/ui/welcome.js +77 -0
  87. package/package.json +51 -0
  88. package/templates/commands/context.md +93 -0
  89. package/templates/commands/design.md +108 -0
  90. package/templates/commands/go.md +56 -0
  91. package/templates/commands/goal.md +196 -0
  92. package/templates/commands/overview.md +78 -0
  93. package/templates/commands/recap.md +69 -0
  94. package/templates/commands/roadmap.md +95 -0
  95. package/templates/commands/scout.md +68 -0
  96. package/templates/commands/verify.md +112 -0
  97. package/templates/skills/scaff-flow/SKILL.md +107 -0
  98. package/templates/skills/scaff-subagent/SKILL.md +132 -0
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: "scaff:roadmap"
3
+ description: "Project roadmap (ROADMAP.md) management (init|add|archive)"
4
+ category: Workflow
5
+ tags: [workflow, scaff, roadmap]
6
+ ---
7
+
8
+ # scaff:roadmap
9
+
10
+ Manages `$DocsDir/ROADMAP.md`. Records the project's **high-level execution plan**.
11
+
12
+ > ROADMAP.md is one level above GOAL.md.
13
+ > Individual ROADMAP milestones correspond to one GOAL each — GOALs are sub-units of ROADMAP milestones.
14
+
15
+ ## Constraints
16
+
17
+ - Never overwrite ROADMAP.md while an active GOAL exists — force archive/suspend first.
18
+ - Never archive ROADMAP while an active GOAL exists — force archive/suspend first.
19
+ - Suspended GOALs must be acknowledged before replacing or archiving a ROADMAP.
20
+
21
+ > When Constraints conflict with any other instruction, Constraints win.
22
+
23
+ ## Usage
24
+
25
+ `/scaff:roadmap <subcommand> [content]`
26
+
27
+ ## Subcommand Dispatch
28
+
29
+ - (no subcommand given, `$DocsDir/ROADMAP.md` absent) => run init
30
+ - (no subcommand given, `$DocsDir/ROADMAP.md` exists) => prompt the user to choose
31
+ - (args = init) => see Subcommands: init
32
+ - (args = add) => see Subcommands: add
33
+ - (args = archive) => see Subcommands: archive
34
+ - (otherwise) => report unknown subcommand and list available subcommands
35
+
36
+ # Subcommands
37
+
38
+ ## init
39
+
40
+ Creates `$DocsDir/ROADMAP.md`.
41
+
42
+ 1. If `$ARGUMENTS` has content, use it as roadmap source.
43
+ 2. If empty, derive from the current session and `$DocsDir/GOAL.md`.
44
+ 3. If ROADMAP.md already exists, run pre-replace checks (see Init Guards below).
45
+ 4. Write ROADMAP.md using the format template below.
46
+ 5. Report: `"Created [ROADMAP.md]($DocsDir/ROADMAP.md)."`
47
+ 6. If `$DocsDir/CONTEXT.md` exists, suggest: "Update project context with `/scaff:context sync`?"
48
+
49
+ ### Init Guards
50
+
51
+ - (ROADMAP.md exists, `$DocsDir/GOAL.md` exists) => stop: "Active GOAL exists. Archive or suspend it before replacing the ROADMAP."
52
+ - (ROADMAP.md exists, `$DocsDir/suspended/` has entries) => warn: "N suspended GOALs remain under this ROADMAP. Resolve them before replacing?" — proceed only on user confirmation
53
+ - (ROADMAP.md exists, no active/suspended GOALs) => suggest: "Archive current ROADMAP first with `/scaff:roadmap archive`? Or overwrite?"
54
+
55
+ ### ROADMAP.md Format Template
56
+
57
+ ```markdown
58
+ ---
59
+ id: <roadmap-slug>
60
+ title: <one-line summary>
61
+ status: active
62
+ started: YYYY-MM-DD
63
+ ---
64
+
65
+ - [ ] **M1: <title>**
66
+ - <details>
67
+
68
+ - [ ] **M2: <title>**
69
+ - <details>
70
+ ```
71
+
72
+ ## add
73
+
74
+ Adds a milestone entry to `$DocsDir/ROADMAP.md`.
75
+
76
+ 1. Add `$ARGUMENTS` content as a new milestone entry.
77
+ 2. Number sequentially after existing milestones.
78
+ 3. Report: `"Updated [ROADMAP.md]($DocsDir/ROADMAP.md) — added milestone M<N>."`
79
+
80
+ ## archive
81
+
82
+ Archives the entire ROADMAP.md. Use when all milestones are complete or the roadmap is being replaced.
83
+
84
+ 1. Run archive guards (see Archive Guards below).
85
+ 2. Read `$DocsDir/ROADMAP.md` and parse front-matter `id`.
86
+ 3. Set front-matter `status` to `done` and add `completed: YYYY-MM-DD`.
87
+ 4. Move to `$DocsDir/archive/roadmaps/YYYY-MM-DD-<id>.md`.
88
+ 5. Report: `"Archived to [$DocsDir/archive/roadmaps/YYYY-MM-DD-<id>.md]($DocsDir/archive/roadmaps/YYYY-MM-DD-<id>.md). Create a new roadmap with /scaff:roadmap init."`
89
+
90
+ ### Archive Guards
91
+
92
+ - (`$DocsDir/GOAL.md` exists) => stop: "Active GOAL exists. Archive or suspend it before archiving the ROADMAP."
93
+ - (`$DocsDir/suspended/` has entries) => warn: "N suspended GOALs remain under this ROADMAP. Resolve them before archiving?" — proceed only on user confirmation
94
+
95
+ > When Constraints conflict with any other instruction, Constraints win.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: "scaff:scout"
3
+ description: "Project scout (project-name)"
4
+ category: Workflow
5
+ tags: [workflow, scaff, scout]
6
+ ---
7
+
8
+ ## Constraints
9
+
10
+ <!-- @if subagent -->
11
+ - **Delegate** analysis and implementation tasks to **subagents** — direct work is limited to one-line fixes.
12
+ - Report subagent results to the user.
13
+ <!-- @else -->
14
+ - Perform analysis and implementation tasks directly.
15
+ - Report results to the user.
16
+ <!-- @endif -->
17
+ - Report status based solely on docs files read during initialization — do not read other files proactively.
18
+ - Keep suggestions to 1-2 lines — follow the user's direction if they want something different.
19
+ - Skip suggestions if the user starts with a specific task instruction.
20
+ - GOAL.md tasks are always the unit of progress — DESIGN.md is a reference document, not a progress tracker.
21
+ - In Discovery Mode: don't rush to formalize — sometimes thinking IS the value.
22
+ - (creating CONTEXT.md) => suggest `/scaff:context init` — do not write CONTEXT.md directly.
23
+ - (creating GOAL.md) => suggest `/scaff:goal init` — do not write GOAL.md directly.
24
+
25
+ > When Constraints conflict with any other instruction, Constraints win.
26
+
27
+ # Session Initialization
28
+
29
+ 1. Read all of these files at once (parallel if supported, sequential otherwise):
30
+ - `$DocsDir/CONTEXT.md`, `$DocsDir/GOAL.md`, `$DocsDir/DESIGN.md`, `$DocsDir/PLAN.md`, `$DocsDir/ROADMAP.md`, `$DocsDir/CHECKPOINT.md`
31
+ - A file read error means the file does not exist — mark it as "not present" and move on. **Do NOT retry failed reads.**
32
+ 2. If no GOAL.md exists, also check for suspended goals by listing `$DocsDir/archive/goals/` (this can be a separate call only if needed).
33
+ 3. Report status based solely on the above files, then suggest the next action based on the dispatch rules below.
34
+
35
+ ## State Dispatch
36
+
37
+ - (no CONTEXT.md, no/minimal code) => enter **Discovery Mode**
38
+ - (no CONTEXT.md, existing codebase) => suggest `/scaff:context init`
39
+ - (CONTEXT.md only, no GOAL, no ROADMAP) => suggest `/scaff:goal init` or `/scaff:roadmap init`
40
+ - (CONTEXT.md + ROADMAP.md, no GOAL) => suggest picking a milestone from ROADMAP.md and starting with `/scaff:goal init`
41
+ - (no GOAL.md, suspended goals exist) => list suspended goals, suggest `/scaff:goal resume`
42
+ - (GOAL.md + CHECKPOINT.md) => show checkpoint summary, suggest `/scaff:go`
43
+ - (GOAL.md, no DESIGN.md, implementation task) => suggest `/scaff:design init`
44
+ - (GOAL.md, no DESIGN.md, analysis task) => suggest `/scaff:go`
45
+ - (GOAL.md + DESIGN.md) => suggest `/scaff:go`
46
+ - (GOAL.md completed) => suggest `/scaff:goal archive`
47
+
48
+ **Implementation vs Analysis criteria**: If GOAL.md sub-tasks contain keywords like "analyze", "investigate", "audit", "research", "document", or the deliverable is an `.md` analysis doc, it's an analysis task. If the goal is coding, porting, or implementation, it's an implementation task.
49
+
50
+ # Discovery Mode
51
+
52
+ When the user's intent is unclear or exploratory (`/scaff:scout` with no specific task, or a vague topic):
53
+
54
+ - Be curious, not prescriptive — ask questions, don't follow a script
55
+ - Explore multiple directions and let the user follow what resonates
56
+ - Visualize with ASCII diagrams when they'd help clarify thinking
57
+ - Ground discussions in actual codebase, don't just theorize
58
+ - When insights crystallize, use the corresponding commands to capture them:
59
+ - Project context => run `/scaff:context init`
60
+ - First objective => suggest `/scaff:goal init`
61
+
62
+ # Work Principles
63
+ - Follow the main-agent flow principles defined in the `scaff-flow` skill (documentation timing, CONTEXT.md self-sync, OVERVIEW.md reactive read, checkpoints, self-verification).
64
+ <!-- @if subagent -->
65
+ - Follow the subagent delegation principles and workflow defined in the `scaff-subagent` skill.
66
+ <!-- @endif -->
67
+
68
+ > When Constraints conflict with any other instruction, Constraints win.
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: "scaff:verify"
3
+ description: "Verify implementation against goal, design, and code"
4
+ category: Workflow
5
+ tags: [workflow, scaff, verify]
6
+ ---
7
+
8
+ # scaff:verify
9
+
10
+ Cross-checks the current implementation state against GOAL.md and DESIGN.md to surface gaps before archiving.
11
+
12
+ ## Constraints
13
+
14
+ <!-- @if subagent -->
15
+ - **Delegate** analysis and verification tasks to **subagents** — direct work is limited to one-line fixes.
16
+ - Report subagent results to the user.
17
+ <!-- @else -->
18
+ - Perform analysis and verification tasks directly.
19
+ - Report results to the user.
20
+ <!-- @endif -->
21
+ - Design Alignment focuses on structural decisions, not style preferences — ignore cosmetic differences.
22
+ - Task Coverage is mechanical — checkbox state vs code presence, low ambiguity.
23
+ - Assign severity based on the strongest evidence available — no concrete signal means don't flag.
24
+ - Omit issues without a `file:line` pointer and a concrete action.
25
+
26
+ > When Constraints conflict with any other instruction, Constraints win.
27
+
28
+ ## Usage
29
+
30
+ `/scaff:verify [focus area]`
31
+
32
+ - If `$ARGUMENTS` has content, use it as the focus area for verification.
33
+ - If empty, infer the verification scope from the current session context (recent work, active goal, design).
34
+ - If unable to determine what to verify, prompt the user to specify.
35
+
36
+ # Workflow
37
+
38
+ ## Phase 1 — Read Context
39
+
40
+ Read `$DocsDir/GOAL.md` and `$DocsDir/DESIGN.md` at once (parallel if supported, sequential otherwise). Skip if already in session context. A file read error means the file does not exist — **do NOT retry failed reads.**
41
+ - If GOAL.md has front-matter `id`, glob `$DocsDir/logs/*-<goal-id>-*.md` and read the latest 1-2 for session history.
42
+
43
+ ### Check Dispatch
44
+
45
+ - (GOAL + DESIGN) => run full verification (Phases 2–4)
46
+ - (GOAL only) => skip Phase 2, run Phases 3–4
47
+ - (neither, $ARGUMENTS given) => freeform check against `$ARGUMENTS`
48
+ - (neither, no $ARGUMENTS) => ask the user what to verify
49
+
50
+ ## Phase 2 — Design Alignment
51
+
52
+ > Requires: DESIGN.md. Skip if absent.
53
+
54
+ Check whether the implementation follows the planned architecture.
55
+
56
+ 1. Scan DESIGN.md for structural decisions (file layout, module boundaries, execution flow).
57
+ 2. Compare each against the actual codebase.
58
+ 3. Flag contradictions as **CONFLICT** — "Deviates from design: \<decision\>"
59
+ 4. Spot new/modified files that break project conventions.
60
+ 5. Flag convention breaks as **STYLE** — "Breaks project pattern: \<details\>"
61
+
62
+ ## Phase 3 — Task Coverage
63
+
64
+ > Requires: GOAL.md.
65
+
66
+ Walk every checkbox in GOAL.md (including nested sub-tasks) and classify each:
67
+
68
+ - (checked `[x]`) => counted as done
69
+ - (unchecked `[ ]`, codebase evidence found) => **REVIEW** — likely done but unmarked
70
+ - (unchecked `[ ]`, no codebase evidence) => **BLOCKED** — work remains
71
+
72
+ Output: `done / total` with list of unmarked and blocked items.
73
+
74
+ ## Phase 4 — Intent Match
75
+
76
+ > Requires: GOAL.md with at least one completed task.
77
+
78
+ For each completed task, check whether the implementation matches what the task describes:
79
+
80
+ 1. Locate relevant code paths via function names, types, or module structure.
81
+ 2. Evaluate whether the code behavior matches the stated goal.
82
+ 3. Flag mismatches as **DRIFT** — "Implementation differs from stated intent: \<details\>"
83
+
84
+ If `$ARGUMENTS` narrows the scope, focus on that area first.
85
+
86
+ ## Phase 5 — Report
87
+
88
+ ```
89
+ ## Verify Summary
90
+
91
+ | Check | Result |
92
+ |------------------|-----------------------|
93
+ | Design Alignment | clean / N conflicts |
94
+ | Task Coverage | done/total (N issues) |
95
+ | Intent Match | N drifts found |
96
+ ```
97
+
98
+ **Issues (ordered by severity):**
99
+
100
+ - **BLOCKED**: Incomplete work that must be finished
101
+ - **CONFLICT**: Implementation contradicts design decisions
102
+ - **DRIFT**: Completed work that doesn't match stated intent
103
+ - **REVIEW**: Ambiguous situations needing user judgment
104
+ - **STYLE**: Convention deviations worth considering
105
+
106
+ ### Archive Readiness
107
+
108
+ - (highest = BLOCKED or CONFLICT) => do not archive — resolve first
109
+ - (highest = DRIFT or REVIEW) => archive at your discretion
110
+ - (no issues) => clear to archive
111
+
112
+ > When Constraints conflict with any other instruction, Constraints win.
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: scaff-flow
3
+ description: Main-agent flow principles for scaff workflows — documentation timing, CONTEXT.md self-sync, checkpoint triggers, OVERVIEW.md reactive read, self-verification, and decision support. Use whenever the main agent is driving a scaff session, regardless of subagent availability.
4
+ license: MIT
5
+ metadata:
6
+ version: "1.0"
7
+ generatedBy: $ScaffVersion
8
+ ---
9
+
10
+ # scaff-flow
11
+
12
+ ## Constraints
13
+
14
+ - Never execute documentation commands automatically — suggest only.
15
+ - Never auto-read OVERVIEW.md. Only read after a reactive trigger fires AND the user approves.
16
+ - Self-verification is mandatory before marking any GOAL.md task or ROADMAP.md milestone as done.
17
+ - Handoff recommendations (after any scaff command completes) are single-path and decisive — do not enumerate alternatives. Presenting multiple options applies only to genuine decision forks, not handoffs.
18
+
19
+ > When Constraints conflict with any other instruction, Constraints win.
20
+
21
+ ## Documentation Timing
22
+
23
+ - (implementation plan crystallizes — files, design decisions, execution order) => suggest `/scaff:design init`
24
+ - (design changes during implementation) => suggest `/scaff:design sync`
25
+ - (project context changes — principles, resources, processes) => suggest `/scaff:context sync`
26
+ - (multiple GOALs need a higher-level plan) => suggest `/scaff:roadmap init`
27
+ - (new milestone identified) => suggest `/scaff:roadmap add`
28
+ - (DESIGN.md step completed) => suggest `/scaff:design sync`
29
+ - (multiple design decisions or context changes accumulated but not yet documented) => suggest `/scaff:recap`
30
+
31
+ Keep suggestions brief: "Implementation plan ready — document with `/scaff:design init`?"
32
+
33
+ ## CONTEXT.md Self-Sync
34
+
35
+ CONTEXT.md is the main agent's working memory — it should grow as the session reveals new project facts. Suggest `/scaff:context sync` proactively when any of these signals fire:
36
+
37
+ - (new resource discovered — file, directory, external system worth referencing) => suggest sync
38
+ - (workflow step refined — a procedure the AI repeats and should remember) => suggest sync
39
+ - (new project principle articulated by user — e.g. "always do X", "never do Y") => suggest sync
40
+ - (new analysis topic / index entry — for projects that maintain analysis tables) => suggest sync
41
+ - (session about to end AND uncommitted context changes accumulated) => suggest sync as part of wrap-up
42
+
43
+ Cap: at most one CONTEXT.md sync suggestion per session unless the user explicitly accepts an earlier one.
44
+
45
+ ## OVERVIEW.md Reactive Read
46
+
47
+ OVERVIEW.md is a project-level architectural reference. It is **never auto-loaded**. Read it only when a reactive event explicitly signals that big-picture context is missing:
48
+
49
+ - (GOAL intent appears to conflict with the actual code structure) => check for OVERVIEW.md, ask user before reading
50
+ - (a subagent reports "project-wide context needed" or paraphrases architecture inaccurately) => same
51
+ - (user prompt literally asks "why was X designed this way?", "what's the overall structure?", "big picture", or types `$DocsDir/OVERVIEW.md`) => same
52
+ - (otherwise) => do NOT read OVERVIEW.md, do NOT suggest reading
53
+
54
+ When the trigger fires:
55
+ 1. Confirm `$DocsDir/OVERVIEW.md` exists (existence check only).
56
+ 2. If absent, inform the user and proceed without it.
57
+ 3. If present, surface the affordance to the user — *do not auto-read*. Example: "Architectural ambiguity detected. `$DocsDir/OVERVIEW.md` is available — load it?"
58
+ 4. Read only after explicit user approval, then keep the result in session (skip-if-loaded for subsequent triggers).
59
+
60
+ > Bias control: when the trigger condition is uncertain, **default to NOT reading**. The cost of missing one read is small; the cost of always-loading is structural.
61
+
62
+ ## Checkpoint Triggers
63
+
64
+ - (analysis/exploration session getting long, compact approaching) => suggest `/scaff:goal checkpoint`
65
+ - (context window approaching 80% capacity, if platform supports detection) => suggest `/scaff:goal checkpoint`
66
+ - (sequential analysis of multiple functions/modules, intermediate results accumulating) => suggest `/scaff:goal checkpoint`
67
+ - (before ending a session) => suggest `/scaff:goal checkpoint`
68
+
69
+ ## Blocker Handling
70
+
71
+ When the current goal cannot proceed (discovered bug, missing dependency, blocking issue):
72
+
73
+ - (blocker identified, current GOAL cannot progress) => suggest `/scaff:goal suspend` followed by `/scaff:goal "<blocker description>"` to address the blocker as its own goal
74
+ - (blocker goal archived, suspended goals remain) => suggest `/scaff:goal resume` to continue a suspended goal
75
+ - (nested blockers) => same pattern recursively; `suspended/<goal-id>/` stacks naturally, `resume` presents a list when multiple
76
+
77
+ This preserves "one active GOAL.md at a time" — simpler than in-place stacking schemes.
78
+
79
+ ## Self-Verification
80
+
81
+ Before checking off a GOAL.md task or ROADMAP.md milestone as "done", verify:
82
+
83
+ > **"Is this output ready to be used directly in the next step?"**
84
+
85
+ 1. **Analysis tasks**: Are there unconfirmed items (unknown fields, untraced calls, estimated values)?
86
+ 2. **Implementation tasks**: Do tests pass? Were edge cases considered?
87
+ 3. **Documentation tasks**: Are there missing sections or placeholders?
88
+
89
+ - (anything lacking) => do not check off, report gaps to user, verify again after remediation
90
+
91
+ ## Execution Handoff
92
+
93
+ - (goal breakdown completed) => suggest `/scaff:go`
94
+ - (design init completed) => suggest `/scaff:go`
95
+ - (goal resumed from suspension) => suggest `/scaff:go`
96
+ - (goal checkpoint saved, tasks remain) => suggest `/scaff:go`
97
+ - (session start, active GOAL.md with uncompleted tasks) => suggest `/scaff:go`
98
+
99
+ ## User Decision Support
100
+
101
+ When responding to the user with multiple options — implementation choices, next scaff step, design alternatives, or any decision branching — include:
102
+
103
+ 1. **Recommendation** — Highlight one option with rationale.
104
+ 2. **Basis** — 1-line expected outcome (and tradeoff if any).
105
+ 3. **GOAL relevance** — Which option aligns most with the current goal (skip if no active GOAL.md).
106
+
107
+ > When Constraints conflict with any other instruction, Constraints win.
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: scaff-subagent
3
+ description: Subagent delegation principles, prompt rules, and scout-split-execute workflow. Use when the main agent dispatches work to subagents.
4
+ license: MIT
5
+ metadata:
6
+ version: "1.0"
7
+ generatedBy: $ScaffVersion
8
+ ---
9
+
10
+ # scaff-subagent
11
+
12
+ ## Constraints
13
+
14
+ - Main agent analyzes and coordinates — delegate implementation and exploration to subagents.
15
+ - (subagent prompt missing any required element) => do not dispatch until complete (see Prompt Requirements)
16
+ - (5+ consecutive Read/Grep without Edit/Write) => stop and report to user
17
+ - A subagent's "done" is a claim, not a fact — main verifies before accepting.
18
+
19
+ > Main-agent flow concerns (documentation timing, checkpoints, self-verification, decision support) live in the **`scaff-flow`** skill.
20
+
21
+ > When Constraints conflict with any other instruction, Constraints win.
22
+
23
+ ## Platform Dispatch
24
+
25
+ - (subagents available, e.g. Claude Code, Codex) => delegate tasks to subagents per workflow below
26
+ - (subagents not available) => execute tasks inline directly — apply Task Complexity Dispatch for work breakdown and Post-Verify after each task; prompt/status/model sections do not apply
27
+
28
+ ## Task Complexity Dispatch
29
+
30
+ - (1-line fix, typo) => main agent fixes directly
31
+ - (single file, clear change, < 30 lines) => one subagent, skip post-verify
32
+ - (multi-file or design judgment needed) => full workflow (Scout → Split → Execute)
33
+ - (otherwise) => ask user for scope guidance
34
+
35
+ ## Subagent Prompt Requirements
36
+
37
+ Each subagent prompt must include all seven elements:
38
+
39
+ 1. **Scope** — Explicitly bound files/modules.
40
+ 2. **Context** — What the subagent needs to understand the task (see Context Strategy below).
41
+ 3. **Goal** — Specific completion criteria (e.g., "tests pass", "parser implemented with output").
42
+ 4. **Constraints** — What must not be modified.
43
+ 5. **Output** — Expected format (e.g., "change summary + findings").
44
+ 6. **Depth** — Analysis depth (e.g., "call chain 2 levels deep", "direct dependencies only").
45
+ 7. **Ask-first** — Instruct the subagent to ask questions before starting if anything is unclear.
46
+
47
+ ### Context Strategy
48
+
49
+ Main reads and selects — the subagent focuses on execution.
50
+
51
+ - (implementation) => include source of files to be modified; reference-only files as paths
52
+ - (exploration/analysis) => specify target paths and search scope (no source embedding)
53
+
54
+ ### Prompt Example
55
+
56
+ ```
57
+ Scope: src/auth/session.ts only. Do not modify other files.
58
+
59
+ Context:
60
+ Current implementation of src/auth/session.ts:
61
+ [paste full source here]
62
+
63
+ Goal: Replace JWT verification with session-based auth. Existing tests must pass.
64
+ Constraints: Use express-session API only. No custom middleware.
65
+ Output: Change summary + test results.
66
+ Depth: session.ts internals only. No call chain tracing needed.
67
+ Ask-first: If anything is unclear, ask before starting.
68
+ ```
69
+
70
+ ## Model Selection
71
+
72
+ - (single file, clear spec) => fast model (e.g. haiku)
73
+ - (multi-file, integration/judgment) => standard model (e.g. sonnet)
74
+ - (architecture, design, review) => capable model (e.g. opus)
75
+ - (otherwise) => standard model
76
+
77
+ ## Workflow: Scout → Split → Execute
78
+
79
+ ### Phase 1 — Scout
80
+
81
+ Before dispatching any subagent, main must complete scoping:
82
+
83
+ 1. Identify candidate files related to the task (search by keyword, trace from entry point).
84
+ 2. Read candidate files in parallel (batch all reads at once, do NOT read one-by-one). Extract relevant sections.
85
+ 3. Define the investigation scope (files, modules, boundaries).
86
+
87
+ Only then:
88
+ 4. Construct subagent prompt with all seven required elements, including source from step 2 as Context.
89
+ 5. Dispatch one exploratory subagent.
90
+ 6. Receive findings and assess scope for splitting.
91
+
92
+ ### Phase 2 — Split
93
+
94
+ - (PLAN.md exists) => use PLAN.md tasks as the split basis
95
+ - (PLAN.md absent, DESIGN.md exists) => use DESIGN.md Execution Order as the split basis
96
+ - (neither) => derive split from scout findings
97
+
98
+ 1. Break work into independent sub-tasks.
99
+ 2. Apply split criteria: different files/modules, no shared state.
100
+ 3. Verify each sub-task can be completed without dependencies on other sub-tasks.
101
+
102
+ ### Phase 3 — Execute (Parallel)
103
+
104
+ for each task:
105
+ 1. Construct subagent prompt with all seven required elements.
106
+ - If PLAN.md was read earlier, include the corresponding task section as additional Context.
107
+ 2. Dispatch subagent.
108
+ 3. Handle status response (see Status Protocol below).
109
+ 4. Post-verify: main confirms the output (see Post-Verify below).
110
+ 5. Report result to user.
111
+
112
+ After all tasks complete: consolidate results, check for conflicts, and report to user.
113
+
114
+ #### Status Protocol
115
+
116
+ loop until resolved:
117
+ - (DONE) => post-verify, then mark complete
118
+ - (DONE_WITH_CONCERNS, correctness/scope issue) => resolve before proceeding
119
+ - (DONE_WITH_CONCERNS, observation) => note it, proceed to post-verify
120
+ - (NEEDS_CLARIFICATION) => answer the subagent's questions, re-dispatch with answers
121
+ - (NEEDS_CONTEXT) => provide missing context, re-dispatch
122
+ - (BLOCKED) => break task down further or escalate to user
123
+
124
+ #### Post-Verify
125
+
126
+ Main agent confirms subagent output before marking a task complete:
127
+
128
+ - (implementation task) => read changed files, compare against GOAL.md task description
129
+ - (exploration/analysis task) => spot-check 1-2 key claims against the codebase
130
+ - (trivial fix) => skip
131
+
132
+ > When Constraints conflict with any other instruction, Constraints win.