@nforma.ai/nforma 0.2.1

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 (215) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1024 -0
  3. package/agents/qgsd-codebase-mapper.md +764 -0
  4. package/agents/qgsd-debugger.md +1201 -0
  5. package/agents/qgsd-executor.md +472 -0
  6. package/agents/qgsd-integration-checker.md +443 -0
  7. package/agents/qgsd-phase-researcher.md +502 -0
  8. package/agents/qgsd-plan-checker.md +643 -0
  9. package/agents/qgsd-planner.md +1182 -0
  10. package/agents/qgsd-project-researcher.md +621 -0
  11. package/agents/qgsd-quorum-orchestrator.md +628 -0
  12. package/agents/qgsd-quorum-slot-worker.md +41 -0
  13. package/agents/qgsd-quorum-synthesizer.md +133 -0
  14. package/agents/qgsd-quorum-test-worker.md +37 -0
  15. package/agents/qgsd-quorum-worker.md +161 -0
  16. package/agents/qgsd-research-synthesizer.md +239 -0
  17. package/agents/qgsd-roadmapper.md +660 -0
  18. package/agents/qgsd-verifier.md +628 -0
  19. package/bin/accept-debug-invariant.cjs +165 -0
  20. package/bin/account-manager.cjs +719 -0
  21. package/bin/aggregate-requirements.cjs +466 -0
  22. package/bin/analyze-assumptions.cjs +757 -0
  23. package/bin/analyze-state-space.cjs +921 -0
  24. package/bin/attribute-trace-divergence.cjs +150 -0
  25. package/bin/auth-drivers/gh-cli.cjs +93 -0
  26. package/bin/auth-drivers/index.cjs +46 -0
  27. package/bin/auth-drivers/pool.cjs +67 -0
  28. package/bin/auth-drivers/simple.cjs +95 -0
  29. package/bin/autoClosePtoF.cjs +110 -0
  30. package/bin/blessed-terminal.cjs +350 -0
  31. package/bin/build-phase-index.cjs +472 -0
  32. package/bin/call-quorum-slot.cjs +541 -0
  33. package/bin/ccr-secure-config.cjs +99 -0
  34. package/bin/ccr-secure-start.cjs +83 -0
  35. package/bin/check-bundled-sdks.cjs +177 -0
  36. package/bin/check-coverage-guard.cjs +112 -0
  37. package/bin/check-liveness-fairness.cjs +95 -0
  38. package/bin/check-mcp-health.cjs +123 -0
  39. package/bin/check-provider-health.cjs +395 -0
  40. package/bin/check-results-exit.cjs +24 -0
  41. package/bin/check-spec-sync.cjs +360 -0
  42. package/bin/check-trace-redaction.cjs +271 -0
  43. package/bin/check-trace-schema-drift.cjs +99 -0
  44. package/bin/compareDrift.cjs +21 -0
  45. package/bin/conformance-schema.cjs +12 -0
  46. package/bin/count-scenarios.cjs +420 -0
  47. package/bin/debt-dedup.cjs +144 -0
  48. package/bin/debt-ledger.cjs +61 -0
  49. package/bin/debt-retention.cjs +76 -0
  50. package/bin/debt-state-machine.cjs +80 -0
  51. package/bin/detect-coverage-gaps.cjs +204 -0
  52. package/bin/detect-project-intent.cjs +362 -0
  53. package/bin/export-prism-constants.cjs +164 -0
  54. package/bin/extract-annotations.cjs +633 -0
  55. package/bin/extractFormalExpected.cjs +104 -0
  56. package/bin/fingerprint-drift.cjs +24 -0
  57. package/bin/fingerprint-issue.cjs +46 -0
  58. package/bin/formal-core.cjs +519 -0
  59. package/bin/formal-ref-linker.cjs +141 -0
  60. package/bin/formal-test-sync.cjs +788 -0
  61. package/bin/generate-formal-specs.cjs +588 -0
  62. package/bin/generate-petri-net.cjs +397 -0
  63. package/bin/generate-phase-spec.cjs +249 -0
  64. package/bin/generate-proposed-changes.cjs +194 -0
  65. package/bin/generate-tla-cfg.cjs +122 -0
  66. package/bin/generate-traceability-matrix.cjs +701 -0
  67. package/bin/generate-triage-bundle.cjs +300 -0
  68. package/bin/gh-account-rotate.cjs +34 -0
  69. package/bin/initialize-model-registry.cjs +105 -0
  70. package/bin/install-formal-tools.cjs +382 -0
  71. package/bin/install.js +2424 -0
  72. package/bin/isNumericThreshold.cjs +34 -0
  73. package/bin/issue-classifier.cjs +151 -0
  74. package/bin/levenshtein.cjs +74 -0
  75. package/bin/lint-formal-models.cjs +580 -0
  76. package/bin/load-baseline-requirements.cjs +275 -0
  77. package/bin/manage-agents-core.cjs +815 -0
  78. package/bin/migrate-formal-dir.cjs +172 -0
  79. package/bin/migrate-planning.cjs +206 -0
  80. package/bin/migrate-to-slots.cjs +255 -0
  81. package/bin/nForma.cjs +2726 -0
  82. package/bin/observe-config.cjs +353 -0
  83. package/bin/observe-debt-writer.cjs +140 -0
  84. package/bin/observe-handler-grafana.cjs +128 -0
  85. package/bin/observe-handler-internal.cjs +301 -0
  86. package/bin/observe-handler-logstash.cjs +153 -0
  87. package/bin/observe-handler-prometheus.cjs +185 -0
  88. package/bin/observe-handlers.cjs +436 -0
  89. package/bin/observe-registry.cjs +131 -0
  90. package/bin/observe-render.cjs +168 -0
  91. package/bin/planning-paths.cjs +167 -0
  92. package/bin/polyrepo.cjs +560 -0
  93. package/bin/prism-priority.cjs +153 -0
  94. package/bin/probe-quorum-slots.cjs +167 -0
  95. package/bin/promote-model.cjs +225 -0
  96. package/bin/propose-debug-invariants.cjs +165 -0
  97. package/bin/providers.json +392 -0
  98. package/bin/pty-proxy.py +129 -0
  99. package/bin/qgsd-solve.cjs +2477 -0
  100. package/bin/quorum-consensus-gate.cjs +238 -0
  101. package/bin/quorum-formal-context.cjs +183 -0
  102. package/bin/quorum-slot-dispatch.cjs +934 -0
  103. package/bin/read-policy.cjs +60 -0
  104. package/bin/requirement-map.cjs +63 -0
  105. package/bin/requirements-core.cjs +247 -0
  106. package/bin/resolve-cli.cjs +101 -0
  107. package/bin/review-mcp-logs.cjs +294 -0
  108. package/bin/run-account-manager-tlc.cjs +188 -0
  109. package/bin/run-account-pool-alloy.cjs +158 -0
  110. package/bin/run-alloy.cjs +153 -0
  111. package/bin/run-audit-alloy.cjs +187 -0
  112. package/bin/run-breaker-tlc.cjs +181 -0
  113. package/bin/run-formal-check.cjs +395 -0
  114. package/bin/run-formal-verify.cjs +701 -0
  115. package/bin/run-installer-alloy.cjs +188 -0
  116. package/bin/run-oauth-rotation-prism.cjs +132 -0
  117. package/bin/run-oscillation-tlc.cjs +202 -0
  118. package/bin/run-phase-tlc.cjs +228 -0
  119. package/bin/run-prism.cjs +446 -0
  120. package/bin/run-protocol-tlc.cjs +201 -0
  121. package/bin/run-quorum-composition-alloy.cjs +155 -0
  122. package/bin/run-sensitivity-sweep.cjs +231 -0
  123. package/bin/run-stop-hook-tlc.cjs +188 -0
  124. package/bin/run-tlc.cjs +467 -0
  125. package/bin/run-transcript-alloy.cjs +173 -0
  126. package/bin/run-uppaal.cjs +264 -0
  127. package/bin/secrets.cjs +134 -0
  128. package/bin/sensitivity-report.cjs +219 -0
  129. package/bin/sensitivity-sweep-feedback.cjs +194 -0
  130. package/bin/set-secret.cjs +29 -0
  131. package/bin/setup-telemetry-cron.sh +36 -0
  132. package/bin/sweepPtoF.cjs +63 -0
  133. package/bin/sync-baseline-requirements.cjs +290 -0
  134. package/bin/task-envelope.cjs +360 -0
  135. package/bin/telemetry-collector.cjs +229 -0
  136. package/bin/unified-mcp-server.mjs +735 -0
  137. package/bin/update-agents.cjs +369 -0
  138. package/bin/update-scoreboard.cjs +1134 -0
  139. package/bin/validate-debt-entry.cjs +207 -0
  140. package/bin/validate-invariant.cjs +419 -0
  141. package/bin/validate-memory.cjs +389 -0
  142. package/bin/validate-requirements-haiku.cjs +435 -0
  143. package/bin/validate-traces.cjs +438 -0
  144. package/bin/verify-formal-results.cjs +124 -0
  145. package/bin/verify-quorum-health.cjs +273 -0
  146. package/bin/write-check-result.cjs +106 -0
  147. package/bin/xstate-to-tla.cjs +483 -0
  148. package/bin/xstate-trace-walker.cjs +205 -0
  149. package/commands/qgsd/add-phase.md +43 -0
  150. package/commands/qgsd/add-requirement.md +24 -0
  151. package/commands/qgsd/add-todo.md +47 -0
  152. package/commands/qgsd/audit-milestone.md +37 -0
  153. package/commands/qgsd/check-todos.md +45 -0
  154. package/commands/qgsd/cleanup.md +18 -0
  155. package/commands/qgsd/close-formal-gaps.md +33 -0
  156. package/commands/qgsd/complete-milestone.md +136 -0
  157. package/commands/qgsd/debug.md +166 -0
  158. package/commands/qgsd/discuss-phase.md +83 -0
  159. package/commands/qgsd/execute-phase.md +117 -0
  160. package/commands/qgsd/fix-tests.md +27 -0
  161. package/commands/qgsd/formal-test-sync.md +32 -0
  162. package/commands/qgsd/health.md +22 -0
  163. package/commands/qgsd/help.md +22 -0
  164. package/commands/qgsd/insert-phase.md +32 -0
  165. package/commands/qgsd/join-discord.md +18 -0
  166. package/commands/qgsd/list-phase-assumptions.md +46 -0
  167. package/commands/qgsd/map-codebase.md +71 -0
  168. package/commands/qgsd/map-requirements.md +20 -0
  169. package/commands/qgsd/mcp-restart.md +176 -0
  170. package/commands/qgsd/mcp-set-model.md +134 -0
  171. package/commands/qgsd/mcp-setup.md +1371 -0
  172. package/commands/qgsd/mcp-status.md +274 -0
  173. package/commands/qgsd/mcp-update.md +238 -0
  174. package/commands/qgsd/new-milestone.md +44 -0
  175. package/commands/qgsd/new-project.md +42 -0
  176. package/commands/qgsd/observe.md +260 -0
  177. package/commands/qgsd/pause-work.md +38 -0
  178. package/commands/qgsd/plan-milestone-gaps.md +34 -0
  179. package/commands/qgsd/plan-phase.md +44 -0
  180. package/commands/qgsd/polyrepo.md +50 -0
  181. package/commands/qgsd/progress.md +24 -0
  182. package/commands/qgsd/queue.md +54 -0
  183. package/commands/qgsd/quick.md +133 -0
  184. package/commands/qgsd/quorum-test.md +275 -0
  185. package/commands/qgsd/quorum.md +707 -0
  186. package/commands/qgsd/reapply-patches.md +110 -0
  187. package/commands/qgsd/remove-phase.md +31 -0
  188. package/commands/qgsd/research-phase.md +189 -0
  189. package/commands/qgsd/resume-work.md +40 -0
  190. package/commands/qgsd/set-profile.md +34 -0
  191. package/commands/qgsd/settings.md +39 -0
  192. package/commands/qgsd/solve.md +565 -0
  193. package/commands/qgsd/sync-baselines.md +119 -0
  194. package/commands/qgsd/triage.md +233 -0
  195. package/commands/qgsd/update.md +37 -0
  196. package/commands/qgsd/verify-work.md +38 -0
  197. package/hooks/dist/config-loader.js +297 -0
  198. package/hooks/dist/conformance-schema.cjs +12 -0
  199. package/hooks/dist/gsd-context-monitor.js +64 -0
  200. package/hooks/dist/qgsd-check-update.js +62 -0
  201. package/hooks/dist/qgsd-circuit-breaker.js +682 -0
  202. package/hooks/dist/qgsd-precompact.js +156 -0
  203. package/hooks/dist/qgsd-prompt.js +653 -0
  204. package/hooks/dist/qgsd-session-start.js +122 -0
  205. package/hooks/dist/qgsd-slot-correlator.js +58 -0
  206. package/hooks/dist/qgsd-spec-regen.js +86 -0
  207. package/hooks/dist/qgsd-statusline.js +91 -0
  208. package/hooks/dist/qgsd-stop.js +553 -0
  209. package/hooks/dist/qgsd-token-collector.js +133 -0
  210. package/hooks/dist/unified-mcp-server.mjs +669 -0
  211. package/package.json +95 -0
  212. package/scripts/build-hooks.js +46 -0
  213. package/scripts/postinstall.js +48 -0
  214. package/scripts/secret-audit.sh +45 -0
  215. package/templates/qgsd.json +49 -0
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: qgsd:add-phase
3
+ description: Add phase to end of current milestone in roadmap
4
+ argument-hint: <description>
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ ---
10
+
11
+ <objective>
12
+ Add a new integer phase to the end of the current milestone in the roadmap.
13
+
14
+ Routes to the add-phase workflow which handles:
15
+ - Phase number calculation (next sequential integer)
16
+ - Directory creation with slug generation
17
+ - Roadmap structure updates
18
+ - STATE.md roadmap evolution tracking
19
+ </objective>
20
+
21
+ <execution_context>
22
+ @~/.claude/qgsd/workflows/add-phase.md
23
+ </execution_context>
24
+
25
+ <context>
26
+ Arguments: $ARGUMENTS (phase description)
27
+
28
+ Roadmap and state are resolved in-workflow via `init phase-op` and targeted tool calls.
29
+ </context>
30
+
31
+ <process>
32
+ **Follow the add-phase workflow** from `@~/.claude/qgsd/workflows/add-phase.md`.
33
+
34
+ The workflow handles all logic including:
35
+ 1. Argument parsing and validation
36
+ 2. Roadmap existence checking
37
+ 3. Current milestone identification
38
+ 4. Next phase number calculation (ignoring decimals)
39
+ 5. Slug generation from description
40
+ 6. Phase directory creation
41
+ 7. Roadmap entry insertion
42
+ 8. STATE.md updates
43
+ </process>
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: qgsd:add-requirement
3
+ description: Add a single requirement to .planning/formal/requirements.json with duplicate and conflict checks
4
+ argument-hint: [--id=PREFIX-NN] [--text="..."] [--category="..."] [--phase=vX.XX-NN] [--dry-run]
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Agent
11
+ - AskUserQuestion
12
+ ---
13
+ <objective>
14
+ Add a single requirement to the formal requirements envelope (`.planning/formal/requirements.json`). Validates the ID format, checks for duplicate IDs, runs Haiku semantic conflict detection against same-prefix requirements, and elevates conflicts to the user before writing. Handles envelope freeze/unfreeze lifecycle automatically.
15
+ </objective>
16
+
17
+ <execution_context>
18
+ @~/.claude/qgsd/workflows/add-requirement.md
19
+ </execution_context>
20
+
21
+ <process>
22
+ Execute the add-requirement workflow from @~/.claude/qgsd/workflows/add-requirement.md end-to-end.
23
+ Pass through all --flags from arguments. If required fields (id, text, category, phase) are not provided as arguments, prompt the user interactively.
24
+ </process>
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: qgsd:add-todo
3
+ description: Capture idea or task as todo from current conversation context
4
+ argument-hint: [optional description]
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - AskUserQuestion
10
+ ---
11
+
12
+ <objective>
13
+ Capture an idea, task, or issue that surfaces during a GSD session as a structured todo for later work.
14
+
15
+ Routes to the add-todo workflow which handles:
16
+ - Directory structure creation
17
+ - Content extraction from arguments or conversation
18
+ - Area inference from file paths
19
+ - Duplicate detection and resolution
20
+ - Todo file creation with frontmatter
21
+ - STATE.md updates
22
+ - Git commits
23
+ </objective>
24
+
25
+ <execution_context>
26
+ @~/.claude/qgsd/workflows/add-todo.md
27
+ </execution_context>
28
+
29
+ <context>
30
+ Arguments: $ARGUMENTS (optional todo description)
31
+
32
+ State is resolved in-workflow via `init todos` and targeted reads.
33
+ </context>
34
+
35
+ <process>
36
+ **Follow the add-todo workflow** from `@~/.claude/qgsd/workflows/add-todo.md`.
37
+
38
+ The workflow handles all logic including:
39
+ 1. Directory ensuring
40
+ 2. Existing area checking
41
+ 3. Content extraction (arguments or conversation)
42
+ 4. Area inference
43
+ 5. Duplicate checking
44
+ 6. File creation with slug generation
45
+ 7. STATE.md updates
46
+ 8. Git commits
47
+ </process>
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: qgsd:audit-milestone
3
+ description: Audit milestone completion against original intent before archiving
4
+ argument-hint: "[version] [--auto]"
5
+ allowed-tools:
6
+ - Read
7
+ - Glob
8
+ - Grep
9
+ - Bash
10
+ - Task
11
+ - Write
12
+ - AskUserQuestion
13
+ ---
14
+ <objective>
15
+ Verify milestone achieved its definition of done. Check requirements coverage, cross-phase integration, and end-to-end flows.
16
+
17
+ **This command IS the orchestrator.** Reads existing VERIFICATION.md files (phases already verified during execute-phase), aggregates tech debt and deferred gaps, then spawns integration checker for cross-phase wiring.
18
+ </objective>
19
+
20
+ <execution_context>
21
+ @~/.claude/qgsd/workflows/audit-milestone.md
22
+ </execution_context>
23
+
24
+ <context>
25
+ Version: $ARGUMENTS (optional — defaults to current milestone)
26
+
27
+ Core planning files are resolved in-workflow (`init milestone-op`) and loaded only as needed.
28
+
29
+ **Completed Work:**
30
+ Glob: .planning/phases/*/*-SUMMARY.md
31
+ Glob: .planning/phases/*/*-VERIFICATION.md
32
+ </context>
33
+
34
+ <process>
35
+ Execute the audit-milestone workflow from @~/.claude/qgsd/workflows/audit-milestone.md end-to-end.
36
+ Preserve all workflow gates (scope determination, verification reading, integration check, requirements coverage, routing).
37
+ </process>
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: qgsd:check-todos
3
+ description: List pending todos and select one to work on
4
+ argument-hint: [area filter]
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - AskUserQuestion
10
+ ---
11
+
12
+ <objective>
13
+ List all pending todos, allow selection, load full context for the selected todo, and route to appropriate action.
14
+
15
+ Routes to the check-todos workflow which handles:
16
+ - Todo counting and listing with area filtering
17
+ - Interactive selection with full context loading
18
+ - Roadmap correlation checking
19
+ - Action routing (work now, add to phase, brainstorm, create phase)
20
+ - STATE.md updates and git commits
21
+ </objective>
22
+
23
+ <execution_context>
24
+ @~/.claude/qgsd/workflows/check-todos.md
25
+ </execution_context>
26
+
27
+ <context>
28
+ Arguments: $ARGUMENTS (optional area filter)
29
+
30
+ Todo state and roadmap correlation are loaded in-workflow using `init todos` and targeted reads.
31
+ </context>
32
+
33
+ <process>
34
+ **Follow the check-todos workflow** from `@~/.claude/qgsd/workflows/check-todos.md`.
35
+
36
+ The workflow handles all logic including:
37
+ 1. Todo existence checking
38
+ 2. Area filtering
39
+ 3. Interactive listing and selection
40
+ 4. Full context loading with file summaries
41
+ 5. Roadmap correlation checking
42
+ 6. Action offering and execution
43
+ 7. STATE.md updates
44
+ 8. Git commits
45
+ </process>
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: qgsd:cleanup
3
+ description: Archive accumulated phase directories from completed milestones
4
+ ---
5
+ <objective>
6
+ Archive phase directories from completed milestones into `.planning/milestones/v{X.Y}-phases/`.
7
+
8
+ Use when `.planning/phases/` has accumulated directories from past milestones.
9
+ </objective>
10
+
11
+ <execution_context>
12
+ @~/.claude/qgsd/workflows/cleanup.md
13
+ </execution_context>
14
+
15
+ <process>
16
+ Follow the cleanup workflow at @~/.claude/qgsd/workflows/cleanup.md.
17
+ Identify completed milestones, show a dry-run summary, and archive on confirmation.
18
+ </process>
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: close-formal-gaps
3
+ description: Analyze and close formal model coverage gaps — clusters uncovered requirements, selects formalism (TLA+/Alloy/PRISM/Petri), generates specs, runs checkers, and updates the model registry
4
+ argument-hint: [--batch] [--category="Category Name"] [--ids=REQ-01,REQ-02] [--all] [--formalism=tla|alloy|prism|petri] [--dry-run]
5
+ allowed_tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ execution_context: workflow
14
+ ---
15
+
16
+ <objective>
17
+ Close formal model coverage gaps by generating new formal specifications for uncovered requirements.
18
+ </objective>
19
+
20
+ <execution_context>
21
+ @/Users/jonathanborduas/.claude/qgsd/workflows/close-formal-gaps.md
22
+ </execution_context>
23
+
24
+ <process>
25
+ Execute the close-formal-gaps workflow from @/Users/jonathanborduas/.claude/qgsd/workflows/close-formal-gaps.md end-to-end.
26
+ Pass through all --flags from arguments:
27
+ --batch Fully autonomous mode — skip all user prompts, auto-approve clusters
28
+ --category="Category Name" Focus on a specific category
29
+ --ids=REQ-01,REQ-02 Focus on specific requirement IDs
30
+ --all Process all uncovered requirements
31
+ --formalism=tla|alloy|prism|petri Override formalism selection
32
+ --dry-run Show what would be generated without writing
33
+ </process>
@@ -0,0 +1,136 @@
1
+ ---
2
+ type: prompt
3
+ name: qgsd:complete-milestone
4
+ description: Archive completed milestone and prepare for next version
5
+ argument-hint: <version>
6
+ allowed-tools:
7
+ - Read
8
+ - Write
9
+ - Bash
10
+ ---
11
+
12
+ <objective>
13
+ Mark milestone {{version}} complete, archive to milestones/, and update ROADMAP.md and REQUIREMENTS.md.
14
+
15
+ Purpose: Create historical record of shipped version, archive milestone artifacts (roadmap + requirements), and prepare for next milestone.
16
+ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tagged.
17
+ </objective>
18
+
19
+ <execution_context>
20
+ **Load these files NOW (before proceeding):**
21
+
22
+ - @~/.claude/qgsd/workflows/complete-milestone.md (main workflow)
23
+ - @~/.claude/qgsd/templates/milestone-archive.md (archive template)
24
+ </execution_context>
25
+
26
+ <context>
27
+ **Project files:**
28
+ - `.planning/ROADMAP.md`
29
+ - `.planning/REQUIREMENTS.md`
30
+ - `.planning/STATE.md`
31
+ - `.planning/PROJECT.md`
32
+
33
+ **User input:**
34
+
35
+ - Version: {{version}} (e.g., "1.0", "1.1", "2.0")
36
+ </context>
37
+
38
+ <process>
39
+
40
+ **Follow complete-milestone.md workflow:**
41
+
42
+ 0. **Check for audit:**
43
+
44
+ - Look for `.planning/milestones/v{{version}}-MILESTONE-AUDIT.md` (or legacy `.planning/v{{version}}-MILESTONE-AUDIT.md`)
45
+ - If missing or stale: recommend `/qgsd:audit-milestone` first
46
+ - If audit status is `gaps_found`: recommend `/qgsd:plan-milestone-gaps` first
47
+ - If audit status is `passed`: proceed to step 1
48
+
49
+ ```markdown
50
+ ## Pre-flight Check
51
+
52
+ {If no v{{version}}-MILESTONE-AUDIT.md in milestones/ or root:}
53
+ ⚠ No milestone audit found. Run `/qgsd:audit-milestone` first to verify
54
+ requirements coverage, cross-phase integration, and E2E flows.
55
+
56
+ {If audit has gaps:}
57
+ ⚠ Milestone audit found gaps. Run `/qgsd:plan-milestone-gaps` to create
58
+ phases that close the gaps, or proceed anyway to accept as tech debt.
59
+
60
+ {If audit passed:}
61
+ ✓ Milestone audit passed. Proceeding with completion.
62
+ ```
63
+
64
+ 1. **Verify readiness:**
65
+
66
+ - Check all phases in milestone have completed plans (SUMMARY.md exists)
67
+ - Present milestone scope and stats
68
+ - Wait for confirmation
69
+
70
+ 2. **Gather stats:**
71
+
72
+ - Count phases, plans, tasks
73
+ - Calculate git range, file changes, LOC
74
+ - Extract timeline from git log
75
+ - Present summary, confirm
76
+
77
+ 3. **Extract accomplishments:**
78
+
79
+ - Read all phase SUMMARY.md files in milestone range
80
+ - Extract 4-6 key accomplishments
81
+ - Present for approval
82
+
83
+ 4. **Archive milestone:**
84
+
85
+ - Create `.planning/milestones/v{{version}}-ROADMAP.md`
86
+ - Extract full phase details from ROADMAP.md
87
+ - Fill milestone-archive.md template
88
+ - Update ROADMAP.md to one-line summary with link
89
+
90
+ 5. **Archive requirements:**
91
+
92
+ - Create `.planning/milestones/v{{version}}-REQUIREMENTS.md`
93
+ - Mark all v1 requirements as complete (checkboxes checked)
94
+ - Note requirement outcomes (validated, adjusted, dropped)
95
+ - Delete `.planning/REQUIREMENTS.md` (fresh one created for next milestone)
96
+
97
+ 6. **Update PROJECT.md:**
98
+
99
+ - Add "Current State" section with shipped version
100
+ - Add "Next Milestone Goals" section
101
+ - Archive previous content in `<details>` (if v1.1+)
102
+
103
+ 7. **Commit and tag:**
104
+
105
+ - Stage: MILESTONES.md, PROJECT.md, ROADMAP.md, STATE.md, archive files
106
+ - Commit: `chore: archive v{{version}} milestone`
107
+ - Tag: `git tag -a v{{version}} -m "[milestone summary]"`
108
+ - Ask about pushing tag
109
+
110
+ 8. **Offer next steps:**
111
+ - `/qgsd:new-milestone` — start next milestone (questioning → research → requirements → roadmap)
112
+
113
+ </process>
114
+
115
+ <success_criteria>
116
+
117
+ - Milestone archived to `.planning/milestones/v{{version}}-ROADMAP.md`
118
+ - Requirements archived to `.planning/milestones/v{{version}}-REQUIREMENTS.md`
119
+ - `.planning/REQUIREMENTS.md` deleted (fresh for next milestone)
120
+ - ROADMAP.md collapsed to one-line entry
121
+ - PROJECT.md updated with current state
122
+ - Git tag v{{version}} created
123
+ - Commit successful
124
+ - User knows next steps (including need for fresh requirements)
125
+ </success_criteria>
126
+
127
+ <critical_rules>
128
+
129
+ - **Load workflow first:** Read complete-milestone.md before executing
130
+ - **Verify completion:** All phases must have SUMMARY.md files
131
+ - **User confirmation:** Wait for approval at verification gates
132
+ - **Archive before deleting:** Always create archive files before updating/deleting originals
133
+ - **One-line summary:** Collapsed milestone in ROADMAP.md should be single line with link
134
+ - **Context efficiency:** Archive keeps ROADMAP.md and REQUIREMENTS.md constant size per milestone
135
+ - **Fresh requirements:** Next milestone starts with `/qgsd:new-milestone` which includes requirements definition
136
+ </critical_rules>
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: qgsd:debug
3
+ description: Debug loop with quorum consensus on next step. Feed failure context to 4 quorum workers — each identifies the single most likely root cause and next debugging step. Renders a NEXT STEP table. Call repeatedly: run test → fail → /qgsd:debug → apply step → run test again.
4
+ argument-hint: "[failure context: test output, error trace, or symptom description]"
5
+ allowed-tools:
6
+ - Task
7
+ ---
8
+
9
+ <objective>
10
+ Dispatch the full quorum debug process to a subagent. The main command stays clean — only the dispatch header and the final NEXT STEP table surface to the conversation context. All bundle assembly, quorum worker dispatch, result collection, artifact writing, and execution happen inside the subagent.
11
+ </objective>
12
+
13
+ <process>
14
+
15
+ **Step 1: Show dispatch header**
16
+
17
+ ```
18
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
19
+ QGSD ► QUORUM-DEBUG: Dispatching debug subagent...
20
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
21
+ ```
22
+
23
+ **Step 2: Spawn the quorum debug subagent**
24
+
25
+ Spawn ONE Task with the full failure context and process instructions embedded:
26
+
27
+ ```
28
+ Task(
29
+ subagent_type="general-purpose",
30
+ description="Quorum debug orchestration",
31
+ prompt="""
32
+ You are the QGSD quorum debug orchestrator. Run the full process below for this failure.
33
+
34
+ ARGUMENTS: $ARGUMENTS
35
+
36
+ ---
37
+
38
+ ## PROCESS
39
+
40
+ ### Step A: Collect failure context
41
+
42
+ If ARGUMENTS is non-empty, use it as the initial failure description.
43
+
44
+ Discover test files:
45
+ find . ( -name "*.test.js" -o -name "*.test.cjs" ) -not -path "*/node_modules/*" -not -path "*/.git/*"
46
+
47
+ If test files exist, run them:
48
+ node --test $TEST_FILES 2>&1; echo "EXIT:$?"
49
+
50
+ Store as $TEST_OUTPUT and $EXIT_CODE. If exit code is 0 and ARGUMENTS is empty, stop and return:
51
+
52
+ QUORUM-DEBUG: No failure detected — tests pass (exit 0).
53
+ If you have a symptom not captured by tests, run: /qgsd:debug [describe the symptom]
54
+
55
+ ### Step B: Assemble bundle
56
+
57
+ Compose $BUNDLE:
58
+ FAILURE CONTEXT: $ARGUMENTS
59
+ EXIT CODE: $EXIT_CODE (or "N/A — symptom only" if no test run)
60
+ === TEST OUTPUT ===
61
+ $TEST_OUTPUT (or "N/A" if not a test failure)
62
+
63
+ ### Step C: Dispatch 4 parallel quorum workers
64
+
65
+ Worker prompt template (inline $BUNDLE verbatim in each):
66
+
67
+ You are a debugging advisor for the QGSD project.
68
+
69
+ <bundle>
70
+ $BUNDLE
71
+ </bundle>
72
+
73
+ Given this failure, answer ONLY:
74
+
75
+ root_cause: <the single most likely root cause in one sentence>
76
+ next_step: <the single best next debugging action — be specific: what file to check, what to log, what to run>
77
+ confidence: HIGH | MEDIUM | LOW
78
+
79
+ Rules:
80
+ - Do NOT suggest a fix. Suggest the next investigative step only.
81
+ - Be specific: name the file, function, line range, or command to run.
82
+ - If the bundle lacks enough context to diagnose, say so in root_cause and set confidence: LOW.
83
+
84
+ Dispatch all 4 workers as parallel Task calls:
85
+ - Task(subagent_type="general-purpose", prompt="Call mcp__gemini-cli__gemini with: [worker prompt with $BUNDLE inlined verbatim]")
86
+ - Task(subagent_type="general-purpose", prompt="Call mcp__opencode__opencode with: [worker prompt with $BUNDLE inlined verbatim]")
87
+ - Task(subagent_type="general-purpose", prompt="Call mcp__copilot-cli__ask with: [worker prompt with $BUNDLE inlined verbatim]")
88
+ - Task(subagent_type="general-purpose", prompt="Call mcp__codex-cli__codex with: [worker prompt with $BUNDLE inlined verbatim]")
89
+
90
+ ### Step D: Collect and parse responses
91
+
92
+ Parse each worker response for root_cause:, next_step:, confidence: lines.
93
+ If a worker errored or returned unparseable output, mark as UNAVAIL.
94
+
95
+ Consensus rules:
96
+ - 3+ workers agree on same root cause area → consensus root cause
97
+ - 3+ workers recommend same next step → consensus step
98
+ - Otherwise → list all unique recommendations; note lack of consensus
99
+
100
+ ### Step E: Render NEXT STEP table
101
+
102
+ Return this output:
103
+
104
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
105
+ QGSD ► QUORUM-DEBUG RESULTS
106
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
107
+
108
+ ┌──────────────┬──────────────┬─────────────────────────────────────────────┐
109
+ │ Model │ Confidence │ Next Step │
110
+ ├──────────────┼──────────────┼─────────────────────────────────────────────┤
111
+ │ Gemini │ [confidence] │ [next_step] │
112
+ │ OpenCode │ [confidence] │ [next_step] │
113
+ │ Copilot │ [confidence] │ [next_step] │
114
+ │ Codex │ [confidence] │ [next_step] │
115
+ ├──────────────┼──────────────┼─────────────────────────────────────────────┤
116
+ │ CONSENSUS │ [HIGH/MED/—] │ [consensus step or "No consensus — see above"]│
117
+ └──────────────┴──────────────┴─────────────────────────────────────────────┘
118
+
119
+ Root Cause Hypothesis (consensus): [one-sentence summary or "No consensus"]
120
+
121
+ If models give different next steps, list them all below the table with their root cause hypotheses.
122
+
123
+ ### Step F: Save artifact
124
+
125
+ Write .planning/quick/quorum-debug-latest.md:
126
+
127
+ # quorum-debug artifact
128
+ date: [ISO timestamp]
129
+ failure_context: $ARGUMENTS
130
+ exit_code: $EXIT_CODE
131
+
132
+ ## consensus
133
+ root_cause: [consensus root cause or "no consensus"]
134
+ next_step: [consensus next step or "no consensus"]
135
+
136
+ ## worker responses
137
+ [table as text]
138
+
139
+ ## bundle
140
+ [full $BUNDLE]
141
+
142
+ ### Step G: Execute or escalate
143
+
144
+ IF consensus was reached:
145
+ Execute the consensus next step using available tools (Bash, Read, Grep, etc.)
146
+ Report what was done.
147
+ Then return:
148
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
149
+ Consensus step executed. Run /qgsd:debug again to continue.
150
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
151
+
152
+ IF no consensus:
153
+ Return:
154
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
+ No consensus — review recommendations above and apply the most relevant step.
156
+ Then run /qgsd:debug again with updated output.
157
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
158
+ """
159
+ )
160
+ ```
161
+
162
+ **Step 3: Report result**
163
+
164
+ Return the subagent's NEXT STEP table and conclusion to the user.
165
+
166
+ </process>
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: qgsd:discuss-phase
3
+ description: Gather phase context through adaptive questioning before planning
4
+ argument-hint: "<phase> [--auto]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - AskUserQuestion
12
+ - Task
13
+ ---
14
+
15
+ <objective>
16
+ Extract implementation decisions that downstream agents need — researcher and planner will use CONTEXT.md to know what to investigate and what choices are locked.
17
+
18
+ **How it works:**
19
+ 1. Analyze the phase to identify gray areas (UI, UX, behavior, etc.)
20
+ 2. Present gray areas — user selects which to discuss
21
+ 3. Deep-dive each selected area until satisfied
22
+ 4. Create CONTEXT.md with decisions that guide research and planning
23
+
24
+ **Output:** `{phase_num}-CONTEXT.md` — decisions clear enough that downstream agents can act without asking the user again
25
+ </objective>
26
+
27
+ <execution_context>
28
+ @~/.claude/qgsd/workflows/discuss-phase.md
29
+ @~/.claude/qgsd/templates/context.md
30
+ </execution_context>
31
+
32
+ <context>
33
+ Phase number: $ARGUMENTS (required)
34
+
35
+ Context files are resolved in-workflow using `init phase-op` and roadmap/state tool calls.
36
+ </context>
37
+
38
+ <process>
39
+ 1. Validate phase number (error if missing or not in roadmap)
40
+ 2. Check if CONTEXT.md exists (offer update/view/skip if yes)
41
+ 3. **Analyze phase** — Identify domain and generate phase-specific gray areas
42
+ 4. **Present gray areas** — Multi-select: which to discuss? (NO skip option)
43
+ 5. **Deep-dive each area** — 4 questions per area, then offer more/next
44
+ 6. **Write CONTEXT.md** — Sections match areas discussed
45
+ 7. Offer next steps (research or plan)
46
+
47
+ **CRITICAL: Scope guardrail**
48
+ - Phase boundary from ROADMAP.md is FIXED
49
+ - Discussion clarifies HOW to implement, not WHETHER to add more
50
+ - If user suggests new capabilities: "That's its own phase. I'll note it for later."
51
+ - Capture deferred ideas — don't lose them, don't act on them
52
+
53
+ **Domain-aware gray areas:**
54
+ Gray areas depend on what's being built. Analyze the phase goal:
55
+ - Something users SEE → layout, density, interactions, states
56
+ - Something users CALL → responses, errors, auth, versioning
57
+ - Something users RUN → output format, flags, modes, error handling
58
+ - Something users READ → structure, tone, depth, flow
59
+ - Something being ORGANIZED → criteria, grouping, naming, exceptions
60
+
61
+ Generate 3-4 **phase-specific** gray areas, not generic categories.
62
+
63
+ **Probing depth:**
64
+ - Ask 4 questions per area before checking
65
+ - "More questions about [area], or move to next?"
66
+ - If more → ask 4 more, check again
67
+ - After all areas → "Explore more gray areas" / "I'm ready for context" (loop-back or proceed)
68
+
69
+ **Do NOT ask about (Claude handles these):**
70
+ - Technical implementation
71
+ - Architecture choices
72
+ - Performance concerns
73
+ - Scope expansion
74
+ </process>
75
+
76
+ <success_criteria>
77
+ - Gray areas identified through intelligent analysis
78
+ - User chose which areas to discuss
79
+ - Each selected area explored until satisfied
80
+ - Scope creep redirected to deferred ideas
81
+ - CONTEXT.md captures decisions, not vague vision
82
+ - User knows next steps
83
+ </success_criteria>