gsd-antigravity-kit 1.32.0 → 2.0.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 (163) hide show
  1. package/.agent/skills/gsd/SKILL.md +152 -123
  2. package/.agent/skills/gsd/VERSION +1 -0
  3. package/.agent/skills/gsd/assets/templates/user-profile.md +8 -8
  4. package/.agent/skills/gsd/bin/gsd-tools.cjs +81 -3
  5. package/.agent/skills/gsd/bin/help-manifest.json +24 -1
  6. package/.agent/skills/gsd/bin/hooks/gsd-check-update.js +15 -5
  7. package/.agent/skills/gsd/bin/hooks/gsd-context-monitor.js +1 -1
  8. package/.agent/skills/gsd/bin/hooks/gsd-phase-boundary.sh +27 -0
  9. package/.agent/skills/gsd/bin/hooks/gsd-prompt-guard.js +2 -1
  10. package/.agent/skills/gsd/bin/hooks/gsd-read-guard.js +1 -1
  11. package/.agent/skills/gsd/bin/hooks/gsd-session-state.sh +33 -0
  12. package/.agent/skills/gsd/bin/hooks/gsd-statusline.js +5 -5
  13. package/.agent/skills/gsd/bin/hooks/gsd-validate-commit.sh +47 -0
  14. package/.agent/skills/gsd/bin/hooks/gsd-workflow-guard.js +1 -1
  15. package/.agent/skills/gsd/bin/lib/config.cjs +31 -10
  16. package/.agent/skills/gsd/bin/lib/core.cjs +48 -13
  17. package/.agent/skills/gsd/bin/lib/frontmatter.cjs +34 -2
  18. package/.agent/skills/gsd/bin/lib/intel.cjs +660 -0
  19. package/.agent/skills/gsd/bin/lib/learnings.cjs +378 -0
  20. package/.agent/skills/gsd/bin/lib/milestone.cjs +13 -4
  21. package/.agent/skills/gsd/bin/lib/model-profiles.cjs +17 -17
  22. package/.agent/skills/gsd/bin/lib/profile-output.cjs +31 -31
  23. package/.agent/skills/gsd/bin/lib/security.cjs +119 -0
  24. package/.agent/skills/gsd/bin/lib/verify.cjs +15 -15
  25. package/.agent/skills/gsd/migration_report.md +7 -0
  26. package/.agent/skills/gsd/references/agents/gsd-code-fixer.md +516 -0
  27. package/.agent/skills/gsd/references/agents/gsd-code-reviewer.md +355 -0
  28. package/.agent/skills/gsd/references/agents/gsd-debugger.md +10 -1
  29. package/.agent/skills/gsd/references/agents/gsd-executor.md +3 -0
  30. package/.agent/skills/gsd/references/agents/gsd-intel-updater.md +314 -0
  31. package/.agent/skills/gsd/references/agents/gsd-phase-researcher.md +3 -0
  32. package/.agent/skills/gsd/references/agents/gsd-plan-checker.md +16 -4
  33. package/.agent/skills/gsd/references/agents/gsd-planner.md +7 -0
  34. package/.agent/skills/gsd/references/agents/gsd-user-profiler.md +5 -5
  35. package/.agent/skills/gsd/references/agents/gsd-verifier.md +55 -1
  36. package/.agent/skills/gsd/references/agents/profiles/dev.md +21 -0
  37. package/.agent/skills/gsd/references/agents/profiles/research.md +22 -0
  38. package/.agent/skills/gsd/references/agents/profiles/review.md +22 -0
  39. package/.agent/skills/gsd/references/commands/{gsd-add-todo.md → atomic/add-todo.md} +5 -4
  40. package/.agent/skills/gsd/references/commands/{gsd-check-todos.md → atomic/check-todos.md} +5 -4
  41. package/.agent/skills/gsd/references/commands/{gsd-cleanup.md → atomic/cleanup.md} +4 -3
  42. package/.agent/skills/gsd/references/commands/{gsd-do.md → atomic/do.md} +4 -3
  43. package/.agent/skills/gsd/references/commands/{gsd-help.md → atomic/help.md} +4 -3
  44. package/.agent/skills/gsd/references/commands/{gsd-join-discord.md → atomic/join-discord.md} +21 -19
  45. package/.agent/skills/gsd/references/commands/{gsd-note.md → atomic/note.md} +4 -3
  46. package/.agent/skills/gsd/references/commands/{gsd-session-report.md → atomic/session-report.md} +4 -3
  47. package/.agent/skills/gsd/references/commands/{gsd-ship.md → atomic/ship.md} +4 -3
  48. package/.agent/skills/gsd/references/commands/{gsd-stats.md → atomic/stats.md} +4 -3
  49. package/.agent/skills/gsd/references/commands/{gsd-thread.md → atomic/thread.md} +7 -6
  50. package/.agent/skills/gsd/references/commands/atomic/undo.md +36 -0
  51. package/.agent/skills/gsd/references/commands/{gsd-add-backlog.md → milestone/add-backlog.md} +8 -7
  52. package/.agent/skills/gsd/references/commands/{gsd-audit-milestone.md → milestone/audit-milestone.md} +4 -3
  53. package/.agent/skills/gsd/references/commands/{gsd-complete-milestone.md → milestone/complete-milestone.md} +6 -4
  54. package/.agent/skills/gsd/references/commands/{gsd-milestone-summary.md → milestone/milestone-summary.md} +5 -3
  55. package/.agent/skills/gsd/references/commands/{gsd-new-milestone.md → milestone/new-milestone.md} +4 -3
  56. package/.agent/skills/gsd/references/commands/{gsd-plan-milestone-gaps.md → milestone/plan-milestone-gaps.md} +4 -3
  57. package/.agent/skills/gsd/references/commands/{gsd-plant-seed.md → milestone/plant-seed.md} +4 -3
  58. package/.agent/skills/gsd/references/commands/{gsd-review-backlog.md → milestone/review-backlog.md} +6 -5
  59. package/.agent/skills/gsd/references/commands/misc/audit-fix.md +35 -0
  60. package/.agent/skills/gsd/references/commands/{gsd-audit-uat.md → misc/audit-uat.md} +4 -3
  61. package/.agent/skills/gsd/references/commands/{gsd-next.md → misc/next.md} +6 -3
  62. package/.agent/skills/gsd/references/commands/{gsd-progress.md → misc/progress.md} +4 -3
  63. package/.agent/skills/gsd/references/commands/{gsd-verify-work.md → misc/verify-work.md} +4 -3
  64. package/.agent/skills/gsd/references/commands/{gsd-add-phase.md → phase/add-phase.md} +5 -4
  65. package/.agent/skills/gsd/references/commands/{gsd-add-tests.md → phase/add-tests.md} +8 -3
  66. package/.agent/skills/gsd/references/commands/{gsd-discuss-phase.md → phase/discuss-phase.md} +5 -4
  67. package/.agent/skills/gsd/references/commands/{gsd-execute-phase.md → phase/execute-phase.md} +4 -3
  68. package/.agent/skills/gsd/references/commands/{gsd-insert-phase.md → phase/insert-phase.md} +5 -4
  69. package/.agent/skills/gsd/references/commands/{gsd-list-phase-assumptions.md → phase/list-phase-assumptions.md} +4 -3
  70. package/.agent/skills/gsd/references/commands/{gsd-plan-phase.md → phase/plan-phase.md} +4 -3
  71. package/.agent/skills/gsd/references/commands/{gsd-remove-phase.md → phase/remove-phase.md} +5 -4
  72. package/.agent/skills/gsd/references/commands/{gsd-research-phase.md → phase/research-phase.md} +7 -6
  73. package/.agent/skills/gsd/references/commands/{gsd-secure-phase.md → phase/secure-phase.md} +4 -3
  74. package/.agent/skills/gsd/references/commands/{gsd-ui-phase.md → phase/ui-phase.md} +4 -3
  75. package/.agent/skills/gsd/references/commands/{gsd-ui-review.md → phase/ui-review.md} +4 -3
  76. package/.agent/skills/gsd/references/commands/{gsd-validate-phase.md → phase/validate-phase.md} +4 -3
  77. package/.agent/skills/gsd/references/commands/{gsd-workstreams.md → phase/workstreams.md} +71 -70
  78. package/.agent/skills/gsd/references/commands/{gsd-analyze-dependencies.md → project/analyze-dependencies.md} +5 -4
  79. package/.agent/skills/gsd/references/commands/project/explore.md +29 -0
  80. package/.agent/skills/gsd/references/commands/project/import.md +38 -0
  81. package/.agent/skills/gsd/references/commands/project/intel.md +181 -0
  82. package/.agent/skills/gsd/references/commands/{gsd-list-workspaces.md → project/list-workspaces.md} +4 -3
  83. package/.agent/skills/gsd/references/commands/{gsd-map-codebase.md → project/map-codebase.md} +4 -3
  84. package/.agent/skills/gsd/references/commands/{gsd-new-project.md → project/new-project.md} +4 -3
  85. package/.agent/skills/gsd/references/commands/{gsd-new-workspace.md → project/new-workspace.md} +4 -3
  86. package/.agent/skills/gsd/references/commands/{gsd-remove-workspace.md → project/remove-workspace.md} +4 -3
  87. package/.agent/skills/gsd/references/commands/project/scan.md +28 -0
  88. package/.agent/skills/gsd/references/commands/{gsd-autonomous.md → system/autonomous.md} +4 -3
  89. package/.agent/skills/gsd/references/commands/system/code-review-fix.md +54 -0
  90. package/.agent/skills/gsd/references/commands/system/code-review.md +57 -0
  91. package/.agent/skills/gsd/references/commands/{gsd-debug.md → system/debug.md} +7 -6
  92. package/.agent/skills/gsd/references/commands/{gsd-docs-update.md → system/docs-update.md} +4 -3
  93. package/.agent/skills/gsd/references/commands/{gsd-fast.md → system/fast.md} +4 -3
  94. package/.agent/skills/gsd/references/commands/{gsd-forensics.md → system/forensics.md} +5 -3
  95. package/.agent/skills/gsd/references/commands/{gsd-health.md → system/health.md} +5 -4
  96. package/.agent/skills/gsd/references/commands/{gsd-manager.md → system/manager.md} +4 -3
  97. package/.agent/skills/gsd/references/commands/{gsd-pause-work.md → system/pause-work.md} +4 -3
  98. package/.agent/skills/gsd/references/commands/{gsd-pr-branch.md → system/pr-branch.md} +4 -3
  99. package/.agent/skills/gsd/references/commands/{gsd-profile-user.md → system/profile-user.md} +4 -3
  100. package/.agent/skills/gsd/references/commands/{gsd-quick.md → system/quick.md} +4 -3
  101. package/.agent/skills/gsd/references/commands/{gsd-reapply-patches.md → system/reapply-patches.md} +25 -7
  102. package/.agent/skills/gsd/references/commands/{gsd-resume-work.md → system/resume-work.md} +4 -3
  103. package/.agent/skills/gsd/references/commands/{gsd-review.md → system/review.md} +4 -3
  104. package/.agent/skills/gsd/references/commands/system/set-profile.md +14 -0
  105. package/.agent/skills/gsd/references/commands/{gsd-settings.md → system/settings.md} +4 -3
  106. package/.agent/skills/gsd/references/commands/{gsd-update.md → system/update.md} +4 -3
  107. package/.agent/skills/gsd/references/docs/agent-contracts.md +79 -0
  108. package/.agent/skills/gsd/references/docs/common-bug-patterns.md +114 -0
  109. package/.agent/skills/gsd/references/docs/context-budget.md +49 -0
  110. package/.agent/skills/gsd/references/docs/domain-probes.md +125 -0
  111. package/.agent/skills/gsd/references/docs/few-shot-examples/plan-checker.md +73 -0
  112. package/.agent/skills/gsd/references/docs/few-shot-examples/verifier.md +109 -0
  113. package/.agent/skills/gsd/references/docs/gate-prompts.md +100 -0
  114. package/.agent/skills/gsd/references/docs/gates.md +70 -0
  115. package/.agent/skills/gsd/references/docs/model-profile-resolution.md +2 -0
  116. package/.agent/skills/gsd/references/docs/model-profiles.md +20 -14
  117. package/.agent/skills/gsd/references/docs/planning-config.md +216 -1
  118. package/.agent/skills/gsd/references/docs/revision-loop.md +97 -0
  119. package/.agent/skills/gsd/references/docs/thinking-models-debug.md +44 -0
  120. package/.agent/skills/gsd/references/docs/thinking-models-execution.md +50 -0
  121. package/.agent/skills/gsd/references/docs/thinking-models-planning.md +62 -0
  122. package/.agent/skills/gsd/references/docs/thinking-models-research.md +50 -0
  123. package/.agent/skills/gsd/references/docs/thinking-models-verification.md +55 -0
  124. package/.agent/skills/gsd/references/docs/thinking-partner.md +96 -0
  125. package/.agent/skills/gsd/references/docs/universal-anti-patterns.md +58 -0
  126. package/.agent/skills/gsd/references/docs/user-profiling.md +10 -10
  127. package/.agent/skills/gsd/references/docs/verification-overrides.md +227 -0
  128. package/.agent/skills/gsd/references/docs/workstream-flag.md +2 -2
  129. package/.agent/skills/gsd/references/mapping.md +11 -21
  130. package/.agent/skills/gsd/references/workflows/analyze-dependencies.md +3 -3
  131. package/.agent/skills/gsd/references/workflows/audit-fix.md +157 -0
  132. package/.agent/skills/gsd/references/workflows/autonomous.md +22 -1
  133. package/.agent/skills/gsd/references/workflows/code-review-fix.md +497 -0
  134. package/.agent/skills/gsd/references/workflows/code-review.md +515 -0
  135. package/.agent/skills/gsd/references/workflows/discuss-phase-power.md +3 -3
  136. package/.agent/skills/gsd/references/workflows/discuss-phase.md +20 -0
  137. package/.agent/skills/gsd/references/workflows/execute-phase.md +103 -0
  138. package/.agent/skills/gsd/references/workflows/explore.md +139 -0
  139. package/.agent/skills/gsd/references/workflows/import.md +274 -0
  140. package/.agent/skills/gsd/references/workflows/inbox.md +384 -0
  141. package/.agent/skills/gsd/references/workflows/manager.md +5 -5
  142. package/.agent/skills/gsd/references/workflows/new-milestone.md +1 -1
  143. package/.agent/skills/gsd/references/workflows/next.md +56 -0
  144. package/.agent/skills/gsd/references/workflows/plan-phase.md +48 -1
  145. package/.agent/skills/gsd/references/workflows/quick.md +96 -2
  146. package/.agent/skills/gsd/references/workflows/review.md +23 -3
  147. package/.agent/skills/gsd/references/workflows/scan.md +102 -0
  148. package/.agent/skills/gsd/references/workflows/settings.md +1 -1
  149. package/.agent/skills/gsd/references/workflows/ui-review.md +2 -2
  150. package/.agent/skills/gsd/references/workflows/undo.md +312 -0
  151. package/.agent/skills/gsd/references/workflows/update.md +5 -5
  152. package/.agent/skills/gsd-converter/SKILL.md +67 -59
  153. package/.agent/skills/gsd-converter/assets/migration-manifest.json +74 -0
  154. package/.agent/skills/gsd-converter/references/mapping.md +6 -16
  155. package/.agent/skills/gsd-converter/scripts/convert.py +419 -80
  156. package/.agent/skills/gsd-converter/scripts/regression_test.py +33 -0
  157. package/.agent/skills/selectpaste-update/SKILL.md +46 -0
  158. package/.agent/skills/selectpaste-update/scripts/sync-commands.py +317 -0
  159. package/README.md +4 -2
  160. package/bin/install.js +116 -116
  161. package/package.json +1 -1
  162. package/.agent/skills/gsd/references/commands/gsd-set-profile.md +0 -12
  163. /package/.agent/skills/gsd/references/commands/{gsd-tools.md → system/gsd-tools.md} +0 -0
@@ -25,6 +25,10 @@ via filesystem and git state.
25
25
 
26
26
  <required_reading>
27
27
  Read STATE.md before any operation to load project context.
28
+
29
+ @references/docs/agent-contracts.md
30
+ @references/docs/context-budget.md
31
+ @references/docs/gates.md
28
32
  </required_reading>
29
33
 
30
34
  <available_agent_types>
@@ -482,12 +486,55 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
482
486
  if [ -n "$WT_BRANCH" ] && [ "$WT_BRANCH" != "HEAD" ]; then
483
487
  CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
484
488
 
489
+ # --- Orchestrator file protection (#1756) ---
490
+ # Snapshot orchestrator-owned files BEFORE merge. If the worktree
491
+ # branch outlived a milestone transition, its versions of STATE.md
492
+ # and ROADMAP.md are stale. Main always wins for these files.
493
+ STATE_BACKUP=$(mktemp)
494
+ ROADMAP_BACKUP=$(mktemp)
495
+ git show HEAD:.planning/STATE.md > "$STATE_BACKUP" 2>/dev/null || true
496
+ git show HEAD:.planning/ROADMAP.md > "$ROADMAP_BACKUP" 2>/dev/null || true
497
+
498
+ # Snapshot list of files on main BEFORE merge to detect resurrections
499
+ PRE_MERGE_FILES=$(git ls-files .planning/)
500
+
485
501
  # Merge the worktree branch into the current branch
486
502
  git merge "$WT_BRANCH" --no-edit -m "chore: merge executor worktree ($WT_BRANCH)" 2>&1 || {
487
503
  echo "⚠ Merge conflict from worktree $WT_BRANCH — resolve manually"
504
+ rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
488
505
  continue
489
506
  }
490
507
 
508
+ # Restore orchestrator-owned files (main always wins)
509
+ if [ -s "$STATE_BACKUP" ]; then
510
+ cp "$STATE_BACKUP" .planning/STATE.md
511
+ fi
512
+ if [ -s "$ROADMAP_BACKUP" ]; then
513
+ cp "$ROADMAP_BACKUP" .planning/ROADMAP.md
514
+ fi
515
+ rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
516
+
517
+ # Detect files deleted on main but re-added by worktree merge
518
+ # (e.g., archived phase directories that were intentionally removed)
519
+ DELETED_FILES=$(git diff --diff-filter=A --name-only HEAD~1 -- .planning/ 2>/dev/null || true)
520
+ for RESURRECTED in $DELETED_FILES; do
521
+ # Check if this file was NOT in main's pre-merge tree
522
+ if ! echo "$PRE_MERGE_FILES" | grep -qxF "$RESURRECTED"; then
523
+ git rm -f "$RESURRECTED" 2>/dev/null || true
524
+ fi
525
+ done
526
+
527
+ # Amend merge commit with restored files if any changed
528
+ if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \
529
+ [ -n "$DELETED_FILES" ]; then
530
+ # Only amend the commit with .planning/ files if commit_docs is enabled (#1783)
531
+ .agent/skills/gsd/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true")
532
+ if [ "$COMMIT_DOCS" != "false" ]; then
533
+ git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true
534
+ git commit --amend --no-edit 2>/dev/null || true
535
+ fi
536
+ fi
537
+
491
538
  # Remove the worktree
492
539
  git worktree remove "$WT" --force 2>/dev/null || true
493
540
 
@@ -694,6 +741,39 @@ Selected wave finished successfully. This phase still has incomplete plans, so p
694
741
  - this means the selected wave happened to be the last remaining work in the phase
695
742
  </step>
696
743
 
744
+ <step name="code_review_gate" required="true">
745
+ **This step is REQUIRED and must not be skipped.** Auto-invoke code review on the phase's source changes. Advisory only — never blocks execution flow.
746
+
747
+ **Config gate:**
748
+ ```bash
749
+ .agent/skills/gsd/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true")
750
+ ```
751
+
752
+ If `CODE_REVIEW_ENABLED` is `"false"`: display "Code review skipped (workflow.code_review=false)" and proceed to next step.
753
+
754
+ **Invoke review:**
755
+ ```
756
+ Skill(skill="gsd:code-review", args="${PHASE_NUMBER}")
757
+ ```
758
+
759
+ **Check results using deterministic path (not glob):**
760
+ ```bash
761
+ PADDED=$(printf "%02d" "${PHASE_NUMBER}")
762
+ REVIEW_FILE="${PHASE_DIR}/${PADDED}-REVIEW.md"
763
+ REVIEW_STATUS=$(sed -n '/^---$/,/^---$/p' "$REVIEW_FILE" | grep "^status:" | head -1 | cut -d: -f2 | tr -d ' ')
764
+ ```
765
+
766
+ If REVIEW_STATUS is not "clean" and not "skipped" and not empty, display:
767
+ ```
768
+ Code review found issues. Consider running:
769
+ /gsd-code-review-fix ${PHASE_NUMBER}
770
+ ```
771
+
772
+ **Error handling:** If the Skill invocation fails or throws, catch the error, display "Code review encountered an error (non-blocking): {error}" and proceed to next step. Review failures must never block execution.
773
+
774
+ Regardless of review result, ALWAYS proceed to close_parent_artifacts → regression_gate → verify_phase_goal.
775
+ </step>
776
+
697
777
  <step name="close_parent_artifacts">
698
778
  **For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
699
779
 
@@ -1034,6 +1114,29 @@ These items are tracked and will appear in `/gsd-progress` and `/gsd-audit-uat`.
1034
1114
  ```
1035
1115
  </step>
1036
1116
 
1117
+ <step name="auto_copy_learnings">
1118
+ **Auto-copy phase learnings to global store (when enabled).**
1119
+
1120
+ This step runs AFTER phase completion and SUMMARY.md is written. It copies any LEARNINGS.md
1121
+ entries from the completed phase to the global learnings store at `~/.gsd/knowledge/`.
1122
+
1123
+ **Check config gate:**
1124
+ ```bash
1125
+ .agent/skills/gsd/bin/gsd-tools.cjs" config-get features.global_learnings --raw 2>/dev/null || echo "false")
1126
+ ```
1127
+
1128
+ **If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default).
1129
+
1130
+ **If enabled:**
1131
+
1132
+ 1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context)
1133
+ 2. If found, copy to global store:
1134
+ ```bash
1135
+ .agent/skills/gsd/bin/gsd-tools.cjs" learnings copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing"
1136
+ ```
1137
+ Copy failure must NOT block phase completion.
1138
+ </step>
1139
+
1037
1140
  <step name="update_project_md">
1038
1141
  **Evolve PROJECT.md to reflect phase completion (prevents planning document drift — #956):**
1039
1142
 
@@ -0,0 +1,139 @@
1
+ <purpose>
2
+ Socratic ideation workflow. Guides the developer through exploring an idea via probing questions,
3
+ offers mid-conversation research when useful, then routes crystallized outputs to GSD artifacts.
4
+ </purpose>
5
+
6
+ <required_reading>
7
+ Read all files referenced by the invoking prompt's execution_context before starting.
8
+
9
+ @references/docs/questioning.md
10
+ @references/docs/domain-probes.md
11
+ </required_reading>
12
+
13
+ <available_agent_types>
14
+ Valid GSD subagent types (use exact names — do not fall back to 'general-purpose'):
15
+ - gsd-phase-researcher — Researches specific questions and returns concise findings
16
+ </available_agent_types>
17
+
18
+ <process>
19
+
20
+ ## Step 1: Open the conversation
21
+
22
+ If a topic was provided, acknowledge it and begin exploring:
23
+ ```
24
+ ## Explore: {topic}
25
+
26
+ Let's think through this together. I'll ask questions to help clarify the idea
27
+ before we commit to any artifacts.
28
+ ```
29
+
30
+ If no topic, ask:
31
+ ```
32
+ ## Explore
33
+
34
+ What's on your mind? This could be a feature idea, an architectural question,
35
+ a problem you're trying to solve, or something you're not sure about yet.
36
+ ```
37
+
38
+ ## Step 2: Socratic conversation (2-5 exchanges)
39
+
40
+ Guide the conversation using principles from `questioning.md` and `domain-probes.md`:
41
+
42
+ - Ask **one question at a time** (never a list of questions)
43
+ - Questions should probe: constraints, tradeoffs, users, scope, dependencies, risks
44
+ - Use domain-specific probes contextually when the topic touches a known domain
45
+ - Listen for signals: "or" / "versus" / "tradeoff" indicate competing priorities worth exploring
46
+ - Reflect back what you hear to confirm understanding before moving forward
47
+
48
+ **Conversation should feel natural, not formulaic.** Avoid rigid sequences. Follow the developer's energy — if they're excited about one aspect, go deeper there.
49
+
50
+ ## Step 3: Mid-conversation research offer (after 2-3 exchanges)
51
+
52
+ If the conversation surfaces factual questions, technology comparisons, or unknowns that research could resolve, offer:
53
+
54
+ ```
55
+ This touches on [specific question]. Want me to do a quick research pass before we continue?
56
+ This would take ~30 seconds and might surface useful context.
57
+
58
+ [Yes, research this] / [No, let's keep exploring]
59
+ ```
60
+
61
+ If yes, spawn a research agent:
62
+ ```
63
+ Task(
64
+ prompt="Quick research: {specific_question}. Return 3-5 key findings, no more than 200 words.",
65
+ subagent_type="gsd-phase-researcher"
66
+ )
67
+ ```
68
+
69
+ Share findings and continue the conversation.
70
+
71
+ If the topic doesn't warrant research, skip this step entirely. **Don't force it.**
72
+
73
+ ## Step 4: Crystallize outputs (after 3-6 exchanges)
74
+
75
+ When the conversation reaches natural conclusions or the developer signals readiness, propose outputs. Analyze the conversation to identify what was discussed and suggest **up to 4 outputs** from:
76
+
77
+ | Type | Destination | When to suggest |
78
+ |------|-------------|-----------------|
79
+ | Note | `.planning/notes/{slug}.md` | Observations, context, decisions worth remembering |
80
+ | Todo | `.planning/todos/pending/{slug}.md` | Concrete actionable tasks identified |
81
+ | Seed | `.planning/seeds/{slug}.md` | Forward-looking ideas with trigger conditions |
82
+ | Research question | `.planning/research/questions.md` (append) | Open questions that need deeper investigation |
83
+ | Requirement | `REQUIREMENTS.md` (append) | Clear requirements that emerged from discussion |
84
+ | New phase | `ROADMAP.md` (append) | Scope large enough to warrant its own phase |
85
+
86
+ Present suggestions:
87
+ ```
88
+ Based on our conversation, I'd suggest capturing:
89
+
90
+ 1. **Note:** "Authentication strategy decisions" — your reasoning about JWT vs sessions
91
+ 2. **Todo:** "Evaluate Passport.js vs custom middleware" — the comparison you want to do
92
+ 3. **Seed:** "OAuth2 provider support" — trigger: when user management phase starts
93
+
94
+ Create these? You can select specific ones or modify them.
95
+
96
+ [Create all] / [Let me pick] / [Skip — just exploring]
97
+ ```
98
+
99
+ **Never write artifacts without explicit user selection.**
100
+
101
+ ## Step 5: Write selected outputs
102
+
103
+ For each selected output, write the file:
104
+
105
+ - **Notes:** Create `.planning/notes/{slug}.md` with frontmatter (title, date, context)
106
+ - **Todos:** Create `.planning/todos/pending/{slug}.md` with frontmatter (title, date, priority)
107
+ - **Seeds:** Create `.planning/seeds/{slug}.md` with frontmatter (title, trigger_condition, planted_date)
108
+ - **Research questions:** Append to `.planning/research/questions.md`
109
+ - **Requirements:** Append to `.planning/REQUIREMENTS.md` with next available REQ ID
110
+ - **Phases:** Use existing `/gsd-add-phase` command via SlashCommand
111
+
112
+ Commit if `commit_docs` is enabled:
113
+ ```bash
114
+ .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs: capture exploration — {topic_slug}" --files {file_list}
115
+ ```
116
+
117
+ ## Step 6: Close
118
+
119
+ ```
120
+ ## Exploration Complete
121
+
122
+ **Topic:** {topic}
123
+ **Outputs:** {count} artifact(s) created
124
+ {list of created files}
125
+
126
+ Continue exploring with `/gsd-explore` or start working with `/gsd-next`.
127
+ ```
128
+
129
+ </process>
130
+
131
+ <success_criteria>
132
+ - [ ] Socratic conversation follows questioning.md principles
133
+ - [ ] Questions asked one at a time, not in batches
134
+ - [ ] Research offered contextually (not forced)
135
+ - [ ] Up to 4 outputs proposed from conversation
136
+ - [ ] User explicitly selects which outputs to create
137
+ - [ ] Files written to correct destinations
138
+ - [ ] Commit respects commit_docs config
139
+ </success_criteria>
@@ -0,0 +1,274 @@
1
+ # Import Workflow
2
+
3
+ External plan ingestion with conflict detection and agent delegation.
4
+
5
+ - **--from**: Import external plan → conflict detection → write PLAN.md → validate via gsd-plan-checker
6
+
7
+ Future: `--prd` mode (PRD extraction into PROJECT.md + REQUIREMENTS.md + ROADMAP.md) is planned for a follow-up PR.
8
+
9
+ ---
10
+
11
+ <step name="banner">
12
+
13
+ Display the stage banner:
14
+
15
+ ```
16
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
17
+ GSD ► IMPORT
18
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
19
+ ```
20
+
21
+ </step>
22
+
23
+ <step name="parse_arguments">
24
+
25
+ Parse `$ARGUMENTS` to determine the execution mode:
26
+
27
+ - If `--from` is present: extract FILEPATH (the next token after `--from`), set MODE=plan
28
+ - If `--prd` is present: display message that `--prd` is not yet implemented and exit:
29
+ ```
30
+ GSD > --prd mode is planned for a future release. Use --from to import plan files.
31
+ ```
32
+ - If neither flag is found: display usage and exit:
33
+
34
+ ```
35
+ Usage: /gsd-import --from <path>
36
+
37
+ --from <path> Import an external plan file into GSD format
38
+ ```
39
+
40
+ **Validate the file path:**
41
+
42
+ Verify the path does not contain traversal sequences and the file exists:
43
+
44
+ ```bash
45
+ case "{FILEPATH}" in
46
+ *..* ) echo "SECURITY_ERROR: path contains traversal sequence"; exit 1 ;;
47
+ esac
48
+ test -f "{FILEPATH}" || echo "FILE_NOT_FOUND"
49
+ ```
50
+
51
+ If FILE_NOT_FOUND: display error and exit:
52
+
53
+ ```
54
+ ╔══════════════════════════════════════════════════════════════╗
55
+ ║ ERROR ║
56
+ ╚══════════════════════════════════════════════════════════════╝
57
+
58
+ File not found: {FILEPATH}
59
+
60
+ **To fix:** Verify the file path and try again.
61
+ ```
62
+
63
+ </step>
64
+
65
+ ---
66
+
67
+ ## Path A: MODE=plan (--from)
68
+
69
+ <step name="plan_load_context">
70
+
71
+ Load project context for conflict detection:
72
+
73
+ 1. Read `.planning/ROADMAP.md` — extract phase structure, phase numbers, dependencies
74
+ 2. Read `.planning/PROJECT.md` — extract project constraints, tech stack, scope boundaries.
75
+ **If PROJECT.md does not exist:** skip constraint checks that rely on it and display:
76
+ ```
77
+ GSD > Note: No PROJECT.md found. Conflict checks against project constraints will be skipped.
78
+ ```
79
+ 3. Read `.planning/REQUIREMENTS.md` — extract existing requirements for overlap and contradiction checks.
80
+ **If REQUIREMENTS.md does not exist:** skip requirement conflict checks and continue.
81
+ 4. Glob for all CONTEXT.md files across phase directories:
82
+ ```bash
83
+ find .planning/phases/ -name "*-CONTEXT.md" -o -name "CONTEXT.md" 2>/dev/null
84
+ ```
85
+ Read each CONTEXT.md found — extract locked decisions (any decision in a `<decisions>` block)
86
+
87
+ Store loaded context for conflict detection in the next step.
88
+
89
+ </step>
90
+
91
+ <step name="plan_read_input">
92
+
93
+ Read the imported file at FILEPATH.
94
+
95
+ Determine the format:
96
+ - **GSD PLAN.md format**: Has YAML frontmatter with `phase:`, `plan:`, `type:` fields
97
+ - **Freeform document**: Any other format (markdown spec, design doc, task list, etc.)
98
+
99
+ Extract from the imported content:
100
+ - **Phase target**: Which phase this plan belongs to (from frontmatter or inferred from content)
101
+ - **Plan objectives**: What the plan aims to accomplish
102
+ - **Tasks listed**: Individual work items described in the plan
103
+ - **Files modified**: Any files mentioned as targets
104
+ - **Dependencies**: Any referenced prerequisites
105
+
106
+ </step>
107
+
108
+ <step name="plan_conflict_detection">
109
+
110
+ Run conflict checks against the loaded project context. Output as a plain-text conflict report using [BLOCKER], [WARNING], and [INFO] labels. Do NOT use markdown tables (no `|---|` format).
111
+
112
+ ### BLOCKER checks (any one prevents import):
113
+
114
+ - Plan targets a phase number that does not exist in ROADMAP.md → [BLOCKER]
115
+ - Plan specifies a tech stack that contradicts PROJECT.md constraints → [BLOCKER]
116
+ - Plan contradicts a locked decision in any CONTEXT.md `<decisions>` block → [BLOCKER]
117
+ - Plan contradicts an existing requirement in REQUIREMENTS.md → [BLOCKER]
118
+
119
+ ### WARNING checks (user confirmation required):
120
+
121
+ - Plan partially overlaps existing requirement coverage in REQUIREMENTS.md → [WARNING]
122
+ - Plan has `depends_on` referencing plans that are not yet complete → [WARNING]
123
+ - Plan modifies files that overlap with existing incomplete plans → [WARNING]
124
+ - Plan phase number conflicts with existing phase numbering in ROADMAP.md → [WARNING]
125
+
126
+ ### INFO checks (informational, no action needed):
127
+
128
+ - Plan uses a library not currently in the project tech stack → [INFO]
129
+ - Plan adds a new phase to the ROADMAP.md structure → [INFO]
130
+
131
+ Display the full Conflict Detection Report:
132
+
133
+ ```
134
+ ## Conflict Detection Report
135
+
136
+ ### BLOCKERS ({N})
137
+
138
+ [BLOCKER] {Short title}
139
+ Found: {what the imported plan says}
140
+ Expected: {what project context requires}
141
+ → {Specific action to resolve}
142
+
143
+ ### WARNINGS ({N})
144
+
145
+ [WARNING] {Short title}
146
+ Found: {what was detected}
147
+ Impact: {what could go wrong}
148
+ → {Suggested action}
149
+
150
+ ### INFO ({N})
151
+
152
+ [INFO] {Short title}
153
+ Note: {relevant information}
154
+ ```
155
+
156
+ **If any [BLOCKER] exists:**
157
+
158
+ Display:
159
+ ```
160
+ GSD > BLOCKED: {N} blockers must be resolved before import can proceed.
161
+ ```
162
+
163
+ Exit WITHOUT writing any files. This is the safety gate — no PLAN.md is written when blockers exist.
164
+
165
+ **If only WARNINGS and/or INFO (no blockers):**
166
+
167
+ Ask via AskUserQuestion using the approve-revise-abort pattern:
168
+ - question: "Review the warnings above. Proceed with import?"
169
+ - header: "Approve?"
170
+ - options: Approve | Abort
171
+
172
+ If user selects "Abort": exit cleanly with message "Import cancelled."
173
+
174
+ </step>
175
+
176
+ <step name="plan_convert">
177
+
178
+ Convert the imported content to GSD PLAN.md format.
179
+
180
+ Ensure the PLAN.md has all required frontmatter fields:
181
+ ```yaml
182
+ ---
183
+ phase: "{NN}-{slug}"
184
+ plan: "{NN}-{MM}"
185
+ type: "feature|refactor|config|test|docs"
186
+ wave: 1
187
+ depends_on: []
188
+ files_modified: []
189
+ autonomous: true
190
+ must_haves:
191
+ truths: []
192
+ artifacts: []
193
+ ---
194
+ ```
195
+
196
+ **Reject PBR naming conventions in source content:**
197
+ If the imported plan references PBR plan naming (e.g., `PLAN-01.md`, `plan-01.md`), rename all references to GSD `{NN}-{MM}-PLAN.md` convention during conversion.
198
+
199
+ Apply GSD naming convention for the output filename:
200
+ - Format: `{NN}-{MM}-PLAN.md` (e.g., `04-01-PLAN.md`)
201
+ - NEVER use `PLAN-01.md`, `plan-01.md`, or any other format
202
+ - NN = phase number (zero-padded), MM = plan number within the phase (zero-padded)
203
+
204
+ Determine the target directory:
205
+ ```
206
+ .planning/phases/{NN}-{slug}/
207
+ ```
208
+
209
+ If the directory does not exist, create it:
210
+ ```bash
211
+ mkdir -p ".planning/phases/{NN}-{slug}/"
212
+ ```
213
+
214
+ Write the PLAN.md file to the target directory.
215
+
216
+ </step>
217
+
218
+ <step name="plan_validate">
219
+
220
+ Delegate validation to gsd-plan-checker:
221
+
222
+ ```
223
+ Task({
224
+ subagent_type: "gsd-plan-checker",
225
+ prompt: "Validate: .planning/phases/{phase}/{plan}-PLAN.md — check frontmatter completeness, task structure, and GSD conventions. Report any issues."
226
+ })
227
+ ```
228
+
229
+ If the checker returns errors:
230
+ - Display the errors to the user
231
+ - Ask the user to resolve issues before the plan is considered imported
232
+ - Do not delete the written file — the user can fix and re-validate manually
233
+
234
+ If the checker returns clean:
235
+ - Display: "Plan validation passed"
236
+
237
+ </step>
238
+
239
+ <step name="plan_finalize">
240
+
241
+ Update `.planning/ROADMAP.md` to reflect the new plan:
242
+ - Add the plan to the Plans list under the correct phase section
243
+ - Include the plan name and description
244
+
245
+ Update `.planning/STATE.md` if appropriate (e.g., increment total plan count).
246
+
247
+ Commit the imported plan and updated files:
248
+ ```bash
249
+ .agent/skills/gsd/bin/gsd-tools.cjs" commit "docs({phase}): import plan from {basename FILEPATH}" --files .planning/phases/{phase}/{plan}-PLAN.md .planning/ROADMAP.md
250
+ ```
251
+
252
+ Display completion:
253
+ ```
254
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
255
+ GSD ► IMPORT COMPLETE
256
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
257
+ ```
258
+
259
+ Show: plan filename written, phase directory, validation result, next steps.
260
+
261
+ </step>
262
+
263
+ ---
264
+
265
+ ## Anti-Patterns
266
+
267
+ Do NOT:
268
+ - Use markdown tables (`|---|`) in the conflict detection report — use plain-text [BLOCKER]/[WARNING]/[INFO] labels
269
+ - Write PLAN.md files as `PLAN-01.md` or `plan-01.md` — always use `{NN}-{MM}-PLAN.md`
270
+ - Use `pbr:plan-checker` or `pbr:planner` — use `gsd-plan-checker` and `gsd-planner`
271
+ - Write `.planning/.active-skill` — this is a PBR pattern with no GSD equivalent
272
+ - Reference `pbr-tools`, `pbr:`, or `PLAN-BUILD-RUN` anywhere
273
+ - Write any PLAN.md file when blockers exist — the safety gate must hold
274
+ - Skip path validation on the --from file argument