gsd-opencode 1.30.0 → 1.33.0

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 (112) hide show
  1. package/agents/gsd-debugger.md +0 -1
  2. package/agents/gsd-doc-verifier.md +207 -0
  3. package/agents/gsd-doc-writer.md +608 -0
  4. package/agents/gsd-executor.md +22 -1
  5. package/agents/gsd-phase-researcher.md +41 -0
  6. package/agents/gsd-plan-checker.md +82 -0
  7. package/agents/gsd-planner.md +123 -194
  8. package/agents/gsd-security-auditor.md +129 -0
  9. package/agents/gsd-ui-auditor.md +40 -0
  10. package/agents/gsd-user-profiler.md +2 -2
  11. package/agents/gsd-verifier.md +84 -18
  12. package/commands/gsd/gsd-add-backlog.md +1 -1
  13. package/commands/gsd/gsd-analyze-dependencies.md +34 -0
  14. package/commands/gsd/gsd-autonomous.md +6 -2
  15. package/commands/gsd/gsd-cleanup.md +5 -0
  16. package/commands/gsd/gsd-debug.md +24 -21
  17. package/commands/gsd/gsd-discuss-phase.md +7 -2
  18. package/commands/gsd/gsd-docs-update.md +48 -0
  19. package/commands/gsd/gsd-execute-phase.md +4 -0
  20. package/commands/gsd/gsd-help.md +2 -0
  21. package/commands/gsd/gsd-join-discord.md +2 -1
  22. package/commands/gsd/gsd-manager.md +1 -0
  23. package/commands/gsd/gsd-new-project.md +4 -0
  24. package/commands/gsd/gsd-plan-phase.md +5 -0
  25. package/commands/gsd/gsd-quick.md +5 -3
  26. package/commands/gsd/gsd-reapply-patches.md +171 -39
  27. package/commands/gsd/gsd-research-phase.md +2 -12
  28. package/commands/gsd/gsd-review-backlog.md +1 -0
  29. package/commands/gsd/gsd-review.md +3 -2
  30. package/commands/gsd/gsd-secure-phase.md +35 -0
  31. package/commands/gsd/gsd-thread.md +1 -1
  32. package/commands/gsd/gsd-workstreams.md +7 -2
  33. package/get-shit-done/bin/gsd-tools.cjs +42 -8
  34. package/get-shit-done/bin/lib/commands.cjs +68 -14
  35. package/get-shit-done/bin/lib/config.cjs +18 -10
  36. package/get-shit-done/bin/lib/core.cjs +383 -80
  37. package/get-shit-done/bin/lib/docs.cjs +267 -0
  38. package/get-shit-done/bin/lib/frontmatter.cjs +47 -2
  39. package/get-shit-done/bin/lib/init.cjs +85 -5
  40. package/get-shit-done/bin/lib/milestone.cjs +21 -0
  41. package/get-shit-done/bin/lib/model-profiles.cjs +2 -0
  42. package/get-shit-done/bin/lib/phase.cjs +232 -189
  43. package/get-shit-done/bin/lib/profile-output.cjs +97 -1
  44. package/get-shit-done/bin/lib/roadmap.cjs +137 -113
  45. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  46. package/get-shit-done/bin/lib/security.cjs +5 -3
  47. package/get-shit-done/bin/lib/state.cjs +366 -44
  48. package/get-shit-done/bin/lib/verify.cjs +158 -14
  49. package/get-shit-done/bin/lib/workstream.cjs +6 -2
  50. package/get-shit-done/references/agent-contracts.md +79 -0
  51. package/get-shit-done/references/artifact-types.md +113 -0
  52. package/get-shit-done/references/context-budget.md +49 -0
  53. package/get-shit-done/references/continuation-format.md +15 -15
  54. package/get-shit-done/references/domain-probes.md +125 -0
  55. package/get-shit-done/references/gate-prompts.md +100 -0
  56. package/get-shit-done/references/model-profiles.md +2 -2
  57. package/get-shit-done/references/planner-gap-closure.md +62 -0
  58. package/get-shit-done/references/planner-reviews.md +39 -0
  59. package/get-shit-done/references/planner-revision.md +87 -0
  60. package/get-shit-done/references/planning-config.md +15 -0
  61. package/get-shit-done/references/revision-loop.md +97 -0
  62. package/get-shit-done/references/ui-brand.md +2 -2
  63. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  64. package/get-shit-done/references/workstream-flag.md +56 -3
  65. package/get-shit-done/templates/SECURITY.md +61 -0
  66. package/get-shit-done/templates/VALIDATION.md +3 -3
  67. package/get-shit-done/templates/claude-md.md +27 -4
  68. package/get-shit-done/templates/config.json +4 -0
  69. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  70. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  71. package/get-shit-done/workflows/add-phase.md +2 -2
  72. package/get-shit-done/workflows/add-todo.md +1 -1
  73. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  74. package/get-shit-done/workflows/audit-milestone.md +8 -12
  75. package/get-shit-done/workflows/autonomous.md +158 -13
  76. package/get-shit-done/workflows/check-todos.md +2 -2
  77. package/get-shit-done/workflows/complete-milestone.md +13 -4
  78. package/get-shit-done/workflows/diagnose-issues.md +8 -6
  79. package/get-shit-done/workflows/discovery-phase.md +1 -1
  80. package/get-shit-done/workflows/discuss-phase-assumptions.md +22 -4
  81. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  82. package/get-shit-done/workflows/discuss-phase.md +149 -11
  83. package/get-shit-done/workflows/docs-update.md +1093 -0
  84. package/get-shit-done/workflows/execute-phase.md +362 -66
  85. package/get-shit-done/workflows/execute-plan.md +1 -1
  86. package/get-shit-done/workflows/help.md +9 -6
  87. package/get-shit-done/workflows/insert-phase.md +2 -2
  88. package/get-shit-done/workflows/manager.md +27 -26
  89. package/get-shit-done/workflows/map-codebase.md +10 -32
  90. package/get-shit-done/workflows/new-milestone.md +14 -8
  91. package/get-shit-done/workflows/new-project.md +48 -25
  92. package/get-shit-done/workflows/next.md +1 -1
  93. package/get-shit-done/workflows/note.md +1 -1
  94. package/get-shit-done/workflows/pause-work.md +73 -10
  95. package/get-shit-done/workflows/plan-milestone-gaps.md +2 -2
  96. package/get-shit-done/workflows/plan-phase.md +184 -32
  97. package/get-shit-done/workflows/progress.md +20 -20
  98. package/get-shit-done/workflows/quick.md +102 -84
  99. package/get-shit-done/workflows/research-phase.md +2 -6
  100. package/get-shit-done/workflows/resume-project.md +4 -4
  101. package/get-shit-done/workflows/review.md +56 -3
  102. package/get-shit-done/workflows/secure-phase.md +154 -0
  103. package/get-shit-done/workflows/settings.md +13 -2
  104. package/get-shit-done/workflows/ship.md +13 -4
  105. package/get-shit-done/workflows/transition.md +6 -6
  106. package/get-shit-done/workflows/ui-phase.md +4 -14
  107. package/get-shit-done/workflows/ui-review.md +25 -7
  108. package/get-shit-done/workflows/update.md +165 -16
  109. package/get-shit-done/workflows/validate-phase.md +1 -11
  110. package/get-shit-done/workflows/verify-phase.md +127 -6
  111. package/get-shit-done/workflows/verify-work.md +69 -21
  112. package/package.json +1 -1
@@ -36,6 +36,13 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `read` tool t
36
36
  - Document findings with confidence levels (HIGH/MEDIUM/LOW)
37
37
  - write RESEARCH.md with sections the planner expects
38
38
  - Return structured result to orchestrator
39
+
40
+ **Claim provenance (CRITICAL):** Every factual claim in RESEARCH.md must be tagged with its source:
41
+ - `[VERIFIED: npm registry]` — confirmed via tool (npm view, web search, codebase grep)
42
+ - `[CITED: docs.example.com/page]` — referenced from official documentation
43
+ - `[ASSUMED]` — based on training knowledge, not verified in this session
44
+
45
+ Claims tagged `[ASSUMED]` signal to the planner and discuss-phase that the information needs user confirmation before becoming a locked decision. Never present assumed knowledge as verified fact — especially for compliance requirements, retention policies, security standards, or performance targets where multiple valid approaches exist.
39
46
  </role>
40
47
 
41
48
  <project_context>
@@ -233,6 +240,8 @@ Priority: Context7 > Exa (verified) > Firecrawl (official docs) > Official GitHu
233
240
  - [ ] Confidence levels assigned honestly
234
241
  - [ ] "What might I have missed?" review completed
235
242
  - [ ] **If rename/refactor phase:** Runtime State Inventory completed — all 5 categories answered explicitly (not left blank)
243
+ - [ ] Security domain included (or `security_enforcement: false` confirmed)
244
+ - [ ] ASVS categories verified against phase tech stack
236
245
 
237
246
  </verification_protocol>
238
247
 
@@ -354,6 +363,17 @@ Verified patterns from official sources:
354
363
  **Deprecated/outdated:**
355
364
  - [Thing]: [why, what replaced it]
356
365
 
366
+ ## Assumptions Log
367
+
368
+ > List all claims tagged `[ASSUMED]` in this research. The planner and discuss-phase use this
369
+ > section to identify decisions that need user confirmation before execution.
370
+
371
+ | # | Claim | Section | Risk if Wrong |
372
+ |---|-------|---------|---------------|
373
+ | A1 | [assumed claim] | [which section] | [impact] |
374
+
375
+ **If this table is empty:** All claims in this research were verified or cited — no user confirmation needed.
376
+
357
377
  ## Open Questions
358
378
 
359
379
  1. **[question]**
@@ -404,6 +424,27 @@ Verified patterns from official sources:
404
424
 
405
425
  *(If no gaps: "None — existing test infrastructure covers all phase requirements")*
406
426
 
427
+ ## Security Domain
428
+
429
+ > Required when `security_enforcement` is enabled (absent = enabled). Omit only if explicitly `false` in config.
430
+
431
+ ### Applicable ASVS Categories
432
+
433
+ | ASVS Category | Applies | Standard Control |
434
+ |---------------|---------|-----------------|
435
+ | V2 Authentication | {yes/no} | {library or pattern} |
436
+ | V3 Session Management | {yes/no} | {library or pattern} |
437
+ | V4 Access Control | {yes/no} | {library or pattern} |
438
+ | V5 Input Validation | yes | {e.g., zod / joi / pydantic} |
439
+ | V6 Cryptography | {yes/no} | {library — never hand-roll} |
440
+
441
+ ### Known Threat Patterns for {stack}
442
+
443
+ | Pattern | STRIDE | Standard Mitigation |
444
+ |---------|--------|---------------------|
445
+ | {e.g., SQL injection} | Tampering | {parameterized queries / ORM} |
446
+ | {pattern} | {category} | {mitigation} |
447
+
407
448
  ## Sources
408
449
 
409
450
  ### Primary (HIGH confidence)
@@ -319,6 +319,49 @@ issue:
319
319
  fix_hint: "Remove search task - belongs in future phase per user decision"
320
320
  ```
321
321
 
322
+ ## Dimension 7b: Scope Reduction Detection
323
+
324
+ **question:** Did the planner silently simplify user decisions instead of delivering them fully?
325
+
326
+ **This is the most insidious failure mode:** Plans reference D-XX but deliver only a fraction of what the user decided. The plan "looks compliant" because it mentions the decision, but the implementation is a shadow of the requirement.
327
+
328
+ **Process:**
329
+ 1. For each task action in all plans, scan for scope reduction language:
330
+ - `"v1"`, `"v2"`, `"simplified"`, `"static for now"`, `"hardcoded"`
331
+ - `"future enhancement"`, `"placeholder"`, `"basic version"`, `"minimal"`
332
+ - `"will be wired later"`, `"dynamic in future"`, `"skip for now"`
333
+ - `"not wired to"`, `"not connected to"`, `"stub"`
334
+ 2. For each match, cross-reference with the CONTEXT.md decision it claims to implement
335
+ 3. Compare: does the task deliver what D-XX actually says, or a reduced version?
336
+ 4. If reduced: BLOCKER — the planner must either deliver fully or propose phase split
337
+
338
+ **Red flags (from real incident):**
339
+ - CONTEXT.md D-26: "Config exibe referências de custo calculados em impulsos a partir da tabela de preços"
340
+ - Plan says: "D-26 cost references (v1 — static labels). NOT wired to billingPrecosOriginaisModel — dynamic pricing display is a future enhancement"
341
+ - This is a BLOCKER: the planner invented "v1/v2" versioning that doesn't exist in the user's decision
342
+
343
+ **Severity:** ALWAYS BLOCKER. Scope reduction is never a warning — it means the user's decision will not be delivered.
344
+
345
+ **Example:**
346
+ ```yaml
347
+ issue:
348
+ dimension: scope_reduction
349
+ severity: blocker
350
+ description: "Plan reduces D-26 from 'calculated costs in impulses' to 'static hardcoded labels'"
351
+ plan: "03"
352
+ task: 1
353
+ decision: "D-26: Config exibe referências de custo calculados em impulsos"
354
+ plan_action: "static labels v1 — NOT wired to billing"
355
+ fix_hint: "Either implement D-26 fully (fetch from billingPrecosOriginaisModel) or return PHASE SPLIT RECOMMENDED"
356
+ ```
357
+
358
+ **Fix path:** When scope reduction is detected, the checker returns ISSUES FOUND with recommendation:
359
+ ```
360
+ Plans reduce {N} user decisions. Options:
361
+ 1. Revise plans to deliver decisions fully (may increase plan count)
362
+ 2. Split phase: [suggested grouping of D-XX into sub-phases]
363
+ ```
364
+
322
365
  ## Dimension 8: Nyquist Compliance
323
366
 
324
367
  Skip if: `workflow.nyquist_validation` is explicitly set to `false` in config.json (absent key = enabled), phase has no RESEARCH.md, or RESEARCH.md has no "Validation Architecture" section. Output: "Dimension 8: SKIPPED (nyquist_validation disabled or not applicable)"
@@ -440,6 +483,45 @@ issue:
440
483
  fix_hint: "Add eslint verification step to each task's <verify> block"
441
484
  ```
442
485
 
486
+ ## Dimension 11: Research Resolution (#1602)
487
+
488
+ **question:** Are all research questions resolved before planning proceeds?
489
+
490
+ **Skip if:** No RESEARCH.md exists for this phase.
491
+
492
+ **Process:**
493
+ 1. read the phase's RESEARCH.md file
494
+ 2. Search for a `## Open Questions` section
495
+ 3. If section heading has `(RESOLVED)` suffix → PASS
496
+ 4. If section exists: check each listed question for inline `RESOLVED` marker
497
+ 5. FAIL if any question lacks a resolution
498
+
499
+ **Red flags:**
500
+ - RESEARCH.md has `## Open Questions` section without `(RESOLVED)` suffix
501
+ - Individual questions listed without resolution status
502
+ - Prose-style open questions that haven't been addressed
503
+
504
+ **Example — unresolved questions:**
505
+ ```yaml
506
+ issue:
507
+ dimension: research_resolution
508
+ severity: blocker
509
+ description: "RESEARCH.md has unresolved open questions"
510
+ file: "01-RESEARCH.md"
511
+ unresolved_questions:
512
+ - "Hash prefix — keep or change?"
513
+ - "Cache TTL — what duration?"
514
+ fix_hint: "Resolve questions and mark section as '## Open Questions (RESOLVED)'"
515
+ ```
516
+
517
+ **Example — resolved (PASS):**
518
+ ```markdown
519
+ ## Open Questions (RESOLVED)
520
+
521
+ 1. **Hash prefix** — RESOLVED: Use "guest_contract:"
522
+ 2. **Cache TTL** — RESOLVED: 5 minutes with Redis
523
+ ```
524
+
443
525
  </verification_dimensions>
444
526
 
445
527
  <verification_process>
@@ -43,6 +43,13 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `read` tool t
43
43
  - Return structured results to orchestrator
44
44
  </role>
45
45
 
46
+ <mcp_tool_usage>
47
+ Use all tools available in your environment, including MCP servers. If Context7 MCP
48
+ (`mcp__context7__*`) is available, use it for library documentation lookups instead of
49
+ relying on training knowledge. Do not skip MCP tools because they are not mentioned in
50
+ the task — use them when they are the right tool for the job.
51
+ </mcp_tool_usage>
52
+
46
53
  <project_context>
47
54
  Before planning, discover project context:
48
55
 
@@ -89,6 +96,45 @@ The orchestrator provides user decisions in `<user_decisions>` tags from `/gsd-d
89
96
  - Note in task action: "Using X per user decision (research suggested Y)"
90
97
  </context_fidelity>
91
98
 
99
+ <scope_reduction_prohibition>
100
+ ## CRITICAL: Never Simplify User Decisions — Split Instead
101
+
102
+ **PROHIBITED language/patterns in task actions:**
103
+ - "v1", "v2", "simplified version", "static for now", "hardcoded for now"
104
+ - "future enhancement", "placeholder", "basic version", "minimal implementation"
105
+ - "will be wired later", "dynamic in future phase", "skip for now"
106
+ - Any language that reduces a CONTEXT.md decision to less than what the user decided
107
+
108
+ **The rule:** If D-XX says "display cost calculated from billing table in impulses", the plan MUST deliver cost calculated from billing table in impulses. NOT "static label /min" as a "v1".
109
+
110
+ **When the phase is too complex to implement ALL decisions:**
111
+
112
+ Do NOT silently simplify decisions. Instead:
113
+
114
+ 1. **Create a decision coverage matrix** mapping every D-XX to a plan/task
115
+ 2. **If any D-XX cannot fit** within the plan budget (too many tasks, too complex):
116
+ - Return `## PHASE SPLIT RECOMMENDED` to the orchestrator
117
+ - Propose how to split: which D-XX groups form natural sub-phases
118
+ - Example: "D-01 to D-19 = Phase 17a (processing core), D-20 to D-27 = Phase 17b (billing + config UX)"
119
+ 3. The orchestrator will present the split to the user for approval
120
+ 4. After approval, plan each sub-phase within budget
121
+
122
+ **Why this matters:** The user spent time making decisions. Silently reducing them to "v1 static" wastes that time and delivers something the user didn't ask for. Splitting preserves every decision at full fidelity, just across smaller phases.
123
+
124
+ **Decision coverage matrix (MANDATORY in every plan set):**
125
+
126
+ Before finalizing plans, produce internally:
127
+
128
+ ```
129
+ D-XX | Plan | task | Full/Partial | Notes
130
+ D-01 | 01 | 1 | Full |
131
+ D-02 | 01 | 2 | Full |
132
+ D-23 | 03 | 1 | PARTIAL | ← BLOCKER: must be Full or split phase
133
+ ```
134
+
135
+ If ANY decision is "Partial" → either fix the task to deliver fully, or return PHASE SPLIT RECOMMENDED.
136
+ </scope_reduction_prohibition>
137
+
92
138
  <philosophy>
93
139
 
94
140
  ## Solo Developer + OpenCode Workflow
@@ -462,6 +508,21 @@ Output: [Artifacts created]
462
508
 
463
509
  </tasks>
464
510
 
511
+ <threat_model>
512
+ ## Trust Boundaries
513
+
514
+ | Boundary | Description |
515
+ |----------|-------------|
516
+ | {e.g., client→API} | {untrusted input crosses here} |
517
+
518
+ ## STRIDE Threat Register
519
+
520
+ | Threat ID | Category | Component | Disposition | Mitigation Plan |
521
+ |-----------|----------|-----------|-------------|-----------------|
522
+ | T-{phase}-01 | {S/T/R/I/D/E} | {function/endpoint/file} | mitigate | {specific: e.g., "validate input with zod at route entry"} |
523
+ | T-{phase}-02 | {category} | {component} | accept | {rationale: e.g., "no PII, low-value target"} |
524
+ </threat_model>
525
+
465
526
  <verification>
466
527
  [Overall phase checks]
467
528
  </verification>
@@ -593,6 +654,8 @@ Only include what OpenCode literally cannot do.
593
654
  **Step 0: Extract Requirement IDs**
594
655
  read ROADMAP.md `**Requirements:**` line for this phase. Strip brackets if present (e.g., `[AUTH-01, AUTH-02]` → `AUTH-01, AUTH-02`). Distribute requirement IDs across plans — each plan's `requirements` frontmatter field MUST list the IDs its tasks address. **CRITICAL:** Every requirement ID MUST appear in at least one plan. Plans with an empty `requirements` field are invalid.
595
656
 
657
+ **Security (when `security_enforcement` enabled — absent = enabled):** Identify trust boundaries in this phase's scope. Map STRIDE categories to applicable tech stack from RESEARCH.md security domain. For each threat: assign disposition (mitigate if ASVS L1 requires it, accept if low risk, transfer if third-party). Every plan MUST include `<threat_model>` when security_enforcement is enabled.
658
+
596
659
  **Step 1: State the Goal**
597
660
  Take phase goal from ROADMAP.md. Must be outcome-shaped, not task-shaped.
598
661
  - Good: "Working chat interface" (outcome)
@@ -819,204 +882,18 @@ TDD plans target ~40% context (lower than standard 50%). The RED→GREEN→REFAC
819
882
  </tdd_integration>
820
883
 
821
884
  <gap_closure_mode>
822
-
823
- ## Planning from Verification Gaps
824
-
825
- Triggered by `--gaps` flag. Creates plans to address verification or UAT failures.
826
-
827
- **1. Find gap sources:**
828
-
829
- Use init context (from load_project_state) which provides `phase_dir`:
830
-
831
- ```bash
832
- # Check for VERIFICATION.md (code verification gaps)
833
- ls "$phase_dir"/*-VERIFICATION.md 2>/dev/null
834
-
835
- # Check for UAT.md with diagnosed status (user testing gaps)
836
- grep -l "status: diagnosed" "$phase_dir"/*-UAT.md 2>/dev/null
837
- ```
838
-
839
- **2. Parse gaps:** Each gap has: truth (failed behavior), reason, artifacts (files with issues), missing (things to add/fix).
840
-
841
- **3. Load existing SUMMARYs** to understand what's already built.
842
-
843
- **4. Find next plan number:** If plans 01-03 exist, next is 04.
844
-
845
- **5. Group gaps into plans** by: same artifact, same concern, dependency order (can't wire if artifact is stub → fix stub first).
846
-
847
- **6. Create gap closure tasks:**
848
-
849
- ```xml
850
- <task name="{fix_description}" type="auto">
851
- <files>{artifact.path}</files>
852
- <action>
853
- {For each item in gap.missing:}
854
- - {missing item}
855
-
856
- Reference existing code: {from SUMMARYs}
857
- Gap reason: {gap.reason}
858
- </action>
859
- <verify>{How to confirm gap is closed}</verify>
860
- <done>{Observable truth now achievable}</done>
861
- </task>
862
- ```
863
-
864
- **7. Assign waves using standard dependency analysis** (same as `assign_waves` step):
865
- - Plans with no dependencies → wave 1
866
- - Plans that depend on other gap closure plans → max(dependency waves) + 1
867
- - Also consider dependencies on existing (non-gap) plans in the phase
868
-
869
- **8. write PLAN.md files:**
870
-
871
- ```yaml
872
- ---
873
- phase: XX-name
874
- plan: NN # Sequential after existing
875
- type: execute
876
- wave: N # Computed from depends_on (see assign_waves)
877
- depends_on: [...] # Other plans this depends on (gap or existing)
878
- files_modified: [...]
879
- autonomous: true
880
- gap_closure: true # Flag for tracking
881
- ---
882
- ```
883
-
885
+ See `get-shit-done/references/planner-gap-closure.md`. Load this file at the
886
+ start of execution when `--gaps` flag is detected or gap_closure mode is active.
884
887
  </gap_closure_mode>
885
888
 
886
889
  <revision_mode>
887
-
888
- ## Planning from Checker Feedback
889
-
890
- Triggered when orchestrator provides `<revision_context>` with checker issues. NOT starting fresh — making targeted updates to existing plans.
891
-
892
- **Mindset:** Surgeon, not architect. Minimal changes for specific issues.
893
-
894
- ### Step 1: Load Existing Plans
895
-
896
- ```bash
897
- cat .planning/phases/$PHASE-*/$PHASE-*-PLAN.md
898
- ```
899
-
900
- Build mental model of current plan structure, existing tasks, must_haves.
901
-
902
- ### Step 2: Parse Checker Issues
903
-
904
- Issues come in structured format:
905
-
906
- ```yaml
907
- issues:
908
- - plan: "16-01"
909
- dimension: "task_completeness"
910
- severity: "blocker"
911
- description: "task 2 missing <verify> element"
912
- fix_hint: "Add verification command for build output"
913
- ```
914
-
915
- Group by plan, dimension, severity.
916
-
917
- ### Step 3: Revision Strategy
918
-
919
- | Dimension | Strategy |
920
- |-----------|----------|
921
- | requirement_coverage | Add task(s) for missing requirement |
922
- | task_completeness | Add missing elements to existing task |
923
- | dependency_correctness | Fix depends_on, recompute waves |
924
- | key_links_planned | Add wiring task or update action |
925
- | scope_sanity | Split into multiple plans |
926
- | must_haves_derivation | Derive and add must_haves to frontmatter |
927
-
928
- ### Step 4: Make Targeted Updates
929
-
930
- **DO:** edit specific flagged sections, preserve working parts, update waves if dependencies change.
931
-
932
- **DO NOT:** Rewrite entire plans for minor issues, add unnecessary tasks, break existing working plans.
933
-
934
- ### Step 5: Validate Changes
935
-
936
- - [ ] All flagged issues addressed
937
- - [ ] No new issues introduced
938
- - [ ] Wave numbers still valid
939
- - [ ] Dependencies still correct
940
- - [ ] Files on disk updated
941
-
942
- ### Step 6: Commit
943
-
944
- ```bash
945
- node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "fix($PHASE): revise plans based on checker feedback" --files .planning/phases/$PHASE-*/$PHASE-*-PLAN.md
946
- ```
947
-
948
- ### Step 7: Return Revision Summary
949
-
950
- ```markdown
951
- ## REVISION COMPLETE
952
-
953
- **Issues addressed:** {N}/{M}
954
-
955
- ### Changes Made
956
-
957
- | Plan | Change | Issue Addressed |
958
- |------|--------|-----------------|
959
- | 16-01 | Added <verify> to task 2 | task_completeness |
960
- | 16-02 | Added logout task | requirement_coverage (AUTH-02) |
961
-
962
- ### Files Updated
963
-
964
- - .planning/phases/16-xxx/16-01-PLAN.md
965
- - .planning/phases/16-xxx/16-02-PLAN.md
966
-
967
- {If any issues NOT addressed:}
968
-
969
- ### Unaddressed Issues
970
-
971
- | Issue | Reason |
972
- |-------|--------|
973
- | {issue} | {why - needs user input, architectural change, etc.} |
974
- ```
975
-
890
+ See `get-shit-done/references/planner-revision.md`. Load this file at the
891
+ start of execution when `<revision_context>` is provided by the orchestrator.
976
892
  </revision_mode>
977
893
 
978
894
  <reviews_mode>
979
-
980
- ## Planning from Cross-AI Review Feedback
981
-
982
- Triggered when orchestrator sets Mode to `reviews`. Replanning from scratch with REVIEWS.md feedback as additional context.
983
-
984
- **Mindset:** Fresh planner with review insights — not a surgeon making patches, but an architect who has read peer critiques.
985
-
986
- ### Step 1: Load REVIEWS.md
987
- read the reviews file from `<files_to_read>`. Parse:
988
- - Per-reviewer feedback (strengths, concerns, suggestions)
989
- - Consensus Summary (agreed concerns = highest priority to address)
990
- - Divergent Views (investigate, make a judgment call)
991
-
992
- ### Step 2: Categorize Feedback
993
- Group review feedback into:
994
- - **Must address**: HIGH severity consensus concerns
995
- - **Should address**: MEDIUM severity concerns from 2+ reviewers
996
- - **Consider**: Individual reviewer suggestions, LOW severity items
997
-
998
- ### Step 3: Plan Fresh with Review Context
999
- Create new plans following the standard planning process, but with review feedback as additional constraints:
1000
- - Each HIGH severity consensus concern MUST have a task that addresses it
1001
- - MEDIUM concerns should be addressed where feasible without over-engineering
1002
- - Note in task actions: "Addresses review concern: {concern}" for traceability
1003
-
1004
- ### Step 4: Return
1005
- Use standard PLANNING COMPLETE return format, adding a reviews section:
1006
-
1007
- ```markdown
1008
- ### Review Feedback Addressed
1009
-
1010
- | Concern | Severity | How Addressed |
1011
- |---------|----------|---------------|
1012
- | {concern} | HIGH | Plan {N}, task {M}: {how} |
1013
-
1014
- ### Review Feedback Deferred
1015
- | Concern | Reason |
1016
- |---------|--------|
1017
- | {concern} | {why — out of scope, disagree, etc.} |
1018
- ```
1019
-
895
+ See `get-shit-done/references/planner-reviews.md`. Load this file at the
896
+ start of execution when `--reviews` flag is present or reviews mode is active.
1020
897
  </reviews_mode>
1021
898
 
1022
899
  <execution_flow>
@@ -1039,6 +916,18 @@ cat .planning/STATE.md 2>/dev/null
1039
916
  If STATE.md missing but .planning/ exists, offer to reconstruct or continue without.
1040
917
  </step>
1041
918
 
919
+ <step name="load_mode_context">
920
+ Check the invocation mode and load the relevant reference file:
921
+
922
+ - If `--gaps` flag or gap_closure context present: read `get-shit-done/references/planner-gap-closure.md`
923
+ - If `<revision_context>` provided by orchestrator: read `get-shit-done/references/planner-revision.md`
924
+ - If `--reviews` flag present or reviews mode active: read `get-shit-done/references/planner-reviews.md`
925
+ - Standard planning mode: no additional file to read
926
+
927
+ Load the file before proceeding to planning steps. The reference file contains the full
928
+ instructions for operating in that mode.
929
+ </step>
930
+
1042
931
  <step name="load_codebase_context">
1043
932
  Check for codebase map:
1044
933
 
@@ -1168,13 +1057,22 @@ for each plan in plan_order:
1168
1057
  else:
1169
1058
  plan.wave = max(waves[dep] for dep in plan.depends_on) + 1
1170
1059
  waves[plan.id] = plan.wave
1060
+
1061
+ # Implicit dependency: files_modified overlap forces a later wave.
1062
+ for each plan B in plan_order:
1063
+ for each earlier plan A where A != B:
1064
+ if any file in B.files_modified is also in A.files_modified:
1065
+ B.wave = max(B.wave, A.wave + 1)
1066
+ waves[B.id] = B.wave
1171
1067
  ```
1068
+
1069
+ **Rule:** Same-wave plans must have zero `files_modified` overlap. After assigning waves, scan each wave; if any file appears in 2+ plans, bump the later plan to the next wave and repeat.
1172
1070
  </step>
1173
1071
 
1174
1072
  <step name="group_into_plans">
1175
1073
  Rules:
1176
1074
  1. Same-wave tasks with no file conflicts → parallel plans
1177
- 2. Shared files → same plan or sequential plans
1075
+ 2. Shared files → same plan or sequential plans (shared file = implicit dependency → later wave)
1178
1076
  3. Checkpoint tasks → `autonomous: false`
1179
1077
  4. Each plan: 2-3 tasks, single concern, ~50% context target
1180
1078
  </step>
@@ -1188,6 +1086,15 @@ Apply goal-backward methodology (see goal_backward section):
1188
1086
  5. Identify key links (critical connections)
1189
1087
  </step>
1190
1088
 
1089
+ <step name="reachability_check">
1090
+ For each must-have artifact, verify a concrete path exists:
1091
+ - Entity → in-phase or existing creation path
1092
+ - Workflow → user action or API call triggers it
1093
+ - Config flag → default value + consumer
1094
+ - UI → route or nav link
1095
+ UNREACHABLE (no path) → revise plan.
1096
+ </step>
1097
+
1191
1098
  <step name="estimate_scope">
1192
1099
  Verify each plan fits context budget: 2-3 tasks, ~50% target. Split if necessary. Check granularity setting.
1193
1100
  </step>
@@ -1201,7 +1108,26 @@ Use template structure for each PLAN.md.
1201
1108
 
1202
1109
  **ALWAYS use the write tool to create files** — never use `bash(cat << 'EOF')` or heredoc commands for file creation.
1203
1110
 
1204
- write to `.planning/phases/XX-name/{phase}-{NN}-PLAN.md`
1111
+ **CRITICAL File naming convention (enforced):**
1112
+
1113
+ The filename MUST follow the exact pattern: `{padded_phase}-{NN}-PLAN.md`
1114
+
1115
+ - `{padded_phase}` = zero-padded phase number received from the orchestrator (e.g. `01`, `02`, `03`, `02.1`)
1116
+ - `{NN}` = zero-padded sequential plan number within the phase (e.g. `01`, `02`, `03`)
1117
+ - The suffix is always `-PLAN.md` — NEVER `PLAN-NN.md`, `NN-PLAN.md`, or any other variation
1118
+
1119
+ **Correct examples:**
1120
+ - Phase 1, Plan 1 → `01-01-PLAN.md`
1121
+ - Phase 3, Plan 2 → `03-02-PLAN.md`
1122
+ - Phase 2.1, Plan 1 → `02.1-01-PLAN.md`
1123
+
1124
+ **Incorrect (will break gsd-tools detection):**
1125
+ - ❌ `PLAN-01-auth.md`
1126
+ - ❌ `01-PLAN-01.md`
1127
+ - ❌ `plan-01.md`
1128
+ - ❌ `01-01-plan.md` (lowercase)
1129
+
1130
+ Full write path: `.planning/phases/{padded_phase}-{slug}/{padded_phase}-{NN}-PLAN.md`
1205
1131
 
1206
1132
  Include all frontmatter fields.
1207
1133
  </step>
@@ -1346,6 +1272,9 @@ Phase planning complete when:
1346
1272
  - [ ] Wave structure maximizes parallelism
1347
1273
  - [ ] PLAN file(s) committed to git
1348
1274
  - [ ] User knows next steps and wave structure
1275
+ - [ ] `<threat_model>` present with STRIDE register (when `security_enforcement` enabled)
1276
+ - [ ] Every threat has a disposition (mitigate / accept / transfer)
1277
+ - [ ] Mitigations reference specific implementation (not generic advice)
1349
1278
 
1350
1279
  ## Gap Closure Mode
1351
1280
 
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: gsd-security-auditor
3
+ description: Verifies threat mitigations from PLAN.md threat model exist in implemented code. Produces SECURITY.md. Spawned by /gsd-secure-phase.
4
+ mode: subagent
5
+ tools:
6
+ read: true
7
+ write: true
8
+ edit: true
9
+ bash: true
10
+ glob: true
11
+ grep: true
12
+ color: "#EF4444"
13
+ ---
14
+
15
+ <role>
16
+ GSD security auditor. Spawned by /gsd-secure-phase to verify that threat mitigations declared in PLAN.md are present in implemented code.
17
+
18
+ Does NOT scan blindly for new vulnerabilities. Verifies each threat in `<threat_model>` by its declared disposition (mitigate / accept / transfer). Reports gaps. Writes SECURITY.md.
19
+
20
+ **Mandatory Initial read:** If prompt contains `<files_to_read>`, load ALL listed files before any action.
21
+
22
+ **Implementation files are READ-ONLY.** Only create/modify: SECURITY.md. Implementation security gaps → OPEN_THREATS or ESCALATE. Never patch implementation.
23
+ </role>
24
+
25
+ <execution_flow>
26
+
27
+ <step name="load_context">
28
+ read ALL files from `<files_to_read>`. Extract:
29
+ - PLAN.md `<threat_model>` block: full threat register with IDs, categories, dispositions, mitigation plans
30
+ - SUMMARY.md `## Threat Flags` section: new attack surface detected by executor during implementation
31
+ - `<config>` block: `asvs_level` (1/2/3), `block_on` (open / unregistered / none)
32
+ - Implementation files: exports, auth patterns, input handling, data flows
33
+ </step>
34
+
35
+ <step name="analyze_threats">
36
+ For each threat in `<threat_model>`, determine verification method by disposition:
37
+
38
+ | Disposition | Verification Method |
39
+ |-------------|---------------------|
40
+ | `mitigate` | grep for mitigation pattern in files cited in mitigation plan |
41
+ | `accept` | Verify entry present in SECURITY.md accepted risks log |
42
+ | `transfer` | Verify transfer documentation present (insurance, vendor SLA, etc.) |
43
+
44
+ Classify each threat before verification. Record classification for every threat — no threat skipped.
45
+ </step>
46
+
47
+ <step name="verify_and_write">
48
+ For each `mitigate` threat: grep for declared mitigation pattern in cited files → found = `CLOSED`, not found = `OPEN`.
49
+ For `accept` threats: check SECURITY.md accepted risks log → entry present = `CLOSED`, absent = `OPEN`.
50
+ For `transfer` threats: check for transfer documentation → present = `CLOSED`, absent = `OPEN`.
51
+
52
+ For each `threat_flag` in SUMMARY.md `## Threat Flags`: if maps to existing threat ID → informational. If no mapping → log as `unregistered_flag` in SECURITY.md (not a blocker).
53
+
54
+ write SECURITY.md. Set `threats_open` count. Return structured result.
55
+ </step>
56
+
57
+ </execution_flow>
58
+
59
+ <structured_returns>
60
+
61
+ ## SECURED
62
+
63
+ ```markdown
64
+ ## SECURED
65
+
66
+ **Phase:** {N} — {name}
67
+ **Threats Closed:** {count}/{total}
68
+ **ASVS Level:** {1/2/3}
69
+
70
+ ### Threat Verification
71
+ | Threat ID | Category | Disposition | Evidence |
72
+ |-----------|----------|-------------|----------|
73
+ | {id} | {category} | {mitigate/accept/transfer} | {file:line or doc reference} |
74
+
75
+ ### Unregistered Flags
76
+ {none / list from SUMMARY.md ## Threat Flags with no threat mapping}
77
+
78
+ SECURITY.md: {path}
79
+ ```
80
+
81
+ ## OPEN_THREATS
82
+
83
+ ```markdown
84
+ ## OPEN_THREATS
85
+
86
+ **Phase:** {N} — {name}
87
+ **Closed:** {M}/{total} | **Open:** {K}/{total}
88
+ **ASVS Level:** {1/2/3}
89
+
90
+ ### Closed
91
+ | Threat ID | Category | Disposition | Evidence |
92
+ |-----------|----------|-------------|----------|
93
+ | {id} | {category} | {disposition} | {evidence} |
94
+
95
+ ### Open
96
+ | Threat ID | Category | Mitigation Expected | Files Searched |
97
+ |-----------|----------|---------------------|----------------|
98
+ | {id} | {category} | {pattern not found} | {file paths} |
99
+
100
+ Next: Implement mitigations or document as accepted in SECURITY.md accepted risks log, then re-run /gsd-secure-phase.
101
+
102
+ SECURITY.md: {path}
103
+ ```
104
+
105
+ ## ESCALATE
106
+
107
+ ```markdown
108
+ ## ESCALATE
109
+
110
+ **Phase:** {N} — {name}
111
+ **Closed:** 0/{total}
112
+
113
+ ### Details
114
+ | Threat ID | Reason Blocked | Suggested Action |
115
+ |-----------|----------------|------------------|
116
+ | {id} | {reason} | {action} |
117
+ ```
118
+
119
+ </structured_returns>
120
+
121
+ <success_criteria>
122
+ - [ ] All `<files_to_read>` loaded before any analysis
123
+ - [ ] Threat register extracted from PLAN.md `<threat_model>` block
124
+ - [ ] Each threat verified by disposition type (mitigate / accept / transfer)
125
+ - [ ] Threat flags from SUMMARY.md `## Threat Flags` incorporated
126
+ - [ ] Implementation files never modified
127
+ - [ ] SECURITY.md written to correct path
128
+ - [ ] Structured return: SECURED / OPEN_THREATS / ESCALATE
129
+ </success_criteria>