@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,117 @@
1
+ ---
2
+ name: qgsd:execute-phase
3
+ description: Execute all plans in a phase with wave parallelization and automated checkpoint:verify gates via quorum-test.
4
+ argument-hint: "<phase-number>"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Glob
10
+ - Grep
11
+ - Bash
12
+ - Task
13
+ - TodoWrite
14
+ - AskUserQuestion
15
+ ---
16
+
17
+ <objective>
18
+ Execute all plans in a phase. Delegates to the gsd:execute-phase workflow for wave-based plan execution. Extends the workflow with automated verification gates: when a plan step has type checkpoint:verify, the executor runs /qgsd:quorum-test instead of waiting for human input. Escalates to checkpoint:human-verify only on failure.
19
+ </objective>
20
+
21
+ <execution_context>
22
+ @~/.claude/qgsd/workflows/execute-phase.md
23
+ </execution_context>
24
+
25
+ <context>
26
+ Phase: $ARGUMENTS
27
+
28
+ **Flags:**
29
+ - `--gaps-only` — Execute only gap closure plans (plans with `gap_closure: true` in frontmatter). Use after verify-work creates fix plans.
30
+ </context>
31
+
32
+ <process>
33
+
34
+ Execute the execute-phase workflow from @~/.claude/qgsd/workflows/execute-phase.md end-to-end, applying the checkpoint type handling rules below at every plan step.
35
+
36
+ ## Agent Substitution (QGSD override)
37
+
38
+ The GSD workflow uses GSD-specific agent types. When following that workflow, substitute:
39
+
40
+ | GSD agent type (in workflow) | Use instead (QGSD) |
41
+ |------------------------------|---------------------|
42
+ | `gsd-executor` | `qgsd-executor` |
43
+ | `gsd-verifier` | `qgsd-verifier` |
44
+
45
+ This applies everywhere the workflow calls `Task(subagent_type="gsd-executor", ...)` or `Task(subagent_type="gsd-verifier", ...)`. All other agent types pass through unchanged.
46
+
47
+ ## Checkpoint Type Handling Rules
48
+
49
+ These rules are applied during plan step execution. Each plan step carries a `type` attribute. Handle checkpoint types as follows:
50
+
51
+ ---
52
+
53
+ ### Rule 1 — checkpoint:verify (automated quorum gate)
54
+
55
+ When the executor reads a plan step whose type is `checkpoint:verify`, it MUST:
56
+
57
+ a. NOT pause for human input.
58
+ b. Identify the test scope from the step's verify section (test file paths or test command).
59
+ c. Call `/qgsd:quorum-test` with that scope.
60
+ d. Evaluate the consensus verdict:
61
+ - **PASS:** log `checkpoint:verify PASSED — quorum consensus` and continue execution.
62
+ - **BLOCK or REVIEW-NEEDED:** enter the debug loop (see Rule 3).
63
+ - **ALL models UNAVAILABLE:** escalate immediately to `checkpoint:human-verify` (see Rule 4).
64
+
65
+ ---
66
+
67
+ ### Rule 2 — checkpoint:human-verify (human gate)
68
+
69
+ When the executor reads a plan step whose type is `checkpoint:human-verify`, it MUST pause and request human confirmation before continuing. This is the standard behavior and the escalation target for Rule 3.
70
+
71
+ ---
72
+
73
+ ### Rule 3 — Debug loop (3 rounds max)
74
+
75
+ Triggered when `/qgsd:quorum-test` returns BLOCK or REVIEW-NEEDED on a `checkpoint:verify` step.
76
+
77
+ Round N (N = 1, 2, 3):
78
+
79
+ 1. Call `/qgsd:debug` with the quorum-test failure context as `$ARGUMENTS`.
80
+ 2. Apply the consensus next step from `/qgsd:debug` (code fix, test correction, or config update as directed by the consensus).
81
+ 3. Re-run `/qgsd:quorum-test` with the same scope.
82
+ 4. If result is PASS: log `checkpoint:verify PASSED after N debug round(s)` and continue.
83
+ 5. If result is still BLOCK/REVIEW-NEEDED and N < 3: increment round, repeat.
84
+
85
+ After 3 rounds with no PASS: escalate to `checkpoint:human-verify` (Rule 4).
86
+
87
+ ---
88
+
89
+ ### Rule 4 — Escalation to checkpoint:human-verify
90
+
91
+ Display a failure summary:
92
+ - The `checkpoint:verify` step that failed
93
+ - Number of `/qgsd:debug` rounds attempted
94
+ - Final quorum-test verdict and concerns from each model
95
+
96
+ Then pause: request human review and corrective action before resuming.
97
+
98
+ ---
99
+
100
+ ## Checkpoint Type Reference Table
101
+
102
+ | Task Type | Who handles it | Escalates to | When used |
103
+ |-------------------------|-------------------|-------------------------|-------------------------------------|
104
+ | `checkpoint:verify` | Executor auto | `checkpoint:human-verify` | Test-suite gates (quorum-testable) |
105
+ | `checkpoint:human-verify` | Human | N/A | Live session / escalation only |
106
+
107
+ ---
108
+
109
+ ## Completion
110
+
111
+ After all plans in the phase complete, display:
112
+
113
+ ```
114
+ All plans complete. Run /qgsd:verify-work to confirm goal achievement.
115
+ ```
116
+
117
+ </process>
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: qgsd:fix-tests
3
+ description: Autonomously discover, batch, run, categorize, and fix test failures across large suites
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Task
12
+ ---
13
+
14
+ <objective>
15
+ Discover all test failures in the project, batch them, run each with flakiness detection,
16
+ stub-categorize each confirmed failure, and iterate until a terminal state is reached.
17
+
18
+ This command is execution-only — it does NOT invoke quorum workers (R2.1 / INTG-03).
19
+ </objective>
20
+
21
+ <execution_context>
22
+ @~/.claude/qgsd/workflows/fix-tests.md
23
+ </execution_context>
24
+
25
+ <process>
26
+ Follow the fix-tests workflow from @~/.claude/qgsd/workflows/fix-tests.md end-to-end.
27
+ </process>
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: qgsd:formal-test-sync
3
+ description: Cross-reference formal model invariants with unit test coverage, validate constants, and generate test stubs
4
+ argument-hint: [--report-only] [--dry-run] [--json] [--stubs-dir=<path>]
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ ---
11
+
12
+ <objective>
13
+ Cross-reference formal model invariants with unit test coverage. Reports gaps where invariants lack test backing, validates formal model constants against runtime config defaults, generates test stubs for uncovered requirements, and updates the traceability matrix with unit test coverage data.
14
+ </objective>
15
+
16
+ <execution_context>
17
+ None required — self-contained script.
18
+ </execution_context>
19
+
20
+ <process>
21
+ Run `node bin/formal-test-sync.cjs $ARGUMENTS` and display results.
22
+
23
+ If no flags are passed, the full sync runs (coverage report + constants validation + stub generation + sidecar update).
24
+
25
+ Use `--report-only` for read-only analysis without generating stubs or updating sidecar files.
26
+
27
+ Use `--json` for machine-readable output.
28
+
29
+ Use `--dry-run` to show what stubs would be generated without writing them.
30
+
31
+ Use `--stubs-dir=<path>` to override the default stub output directory (.planning/formal/generated-stubs/).
32
+ </process>
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: qgsd:health
3
+ description: Diagnose planning directory health and optionally repair issues
4
+ argument-hint: [--repair] [--force]
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Write
9
+ - AskUserQuestion
10
+ ---
11
+ <objective>
12
+ Validate `.planning/` directory integrity and report actionable issues. Checks for missing files, invalid configurations, inconsistent state, and orphaned plans.
13
+ </objective>
14
+
15
+ <execution_context>
16
+ @~/.claude/qgsd/workflows/health.md
17
+ </execution_context>
18
+
19
+ <process>
20
+ Execute the health workflow from @~/.claude/qgsd/workflows/health.md end-to-end.
21
+ Parse --repair flag from arguments and pass to workflow.
22
+ </process>
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: qgsd:help
3
+ description: Show available GSD commands and usage guide
4
+ ---
5
+ <objective>
6
+ Display the complete GSD command reference.
7
+
8
+ Output ONLY the reference content below. Do NOT add:
9
+ - Project-specific analysis
10
+ - Git status or file context
11
+ - Next-step suggestions
12
+ - Any commentary beyond the reference
13
+ </objective>
14
+
15
+ <execution_context>
16
+ @~/.claude/qgsd/workflows/help.md
17
+ </execution_context>
18
+
19
+ <process>
20
+ Output the complete GSD command reference from @~/.claude/qgsd/workflows/help.md.
21
+ Display the reference content directly — no additions or modifications.
22
+ </process>
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: qgsd:insert-phase
3
+ description: Insert urgent work as decimal phase (e.g., 72.1) between existing phases
4
+ argument-hint: <after> <description>
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ ---
10
+
11
+ <objective>
12
+ Insert a decimal phase for urgent work discovered mid-milestone that must be completed between existing integer phases.
13
+
14
+ Uses decimal numbering (72.1, 72.2, etc.) to preserve the logical sequence of planned phases while accommodating urgent insertions.
15
+
16
+ Purpose: Handle urgent work discovered during execution without renumbering entire roadmap.
17
+ </objective>
18
+
19
+ <execution_context>
20
+ @~/.claude/qgsd/workflows/insert-phase.md
21
+ </execution_context>
22
+
23
+ <context>
24
+ Arguments: $ARGUMENTS (format: <after-phase-number> <description>)
25
+
26
+ Roadmap and state are resolved in-workflow via `init phase-op` and targeted tool calls.
27
+ </context>
28
+
29
+ <process>
30
+ Execute the insert-phase workflow from @~/.claude/qgsd/workflows/insert-phase.md end-to-end.
31
+ Preserve all validation gates (argument parsing, phase verification, decimal calculation, roadmap updates).
32
+ </process>
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: qgsd:join-discord
3
+ description: Join the QGSD Discord community
4
+ ---
5
+
6
+ <objective>
7
+ Display the Discord invite link for the QGSD community server.
8
+ </objective>
9
+
10
+ <output>
11
+ # Join the QGSD Discord
12
+
13
+ Connect with other QGSD users, get help, share what you're building, and stay updated.
14
+
15
+ **Server link:** https://discord.com/servers/1474810068636663886
16
+
17
+ Click the link or paste it into your browser to join.
18
+ </output>
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: qgsd:list-phase-assumptions
3
+ description: Surface Claude's assumptions about a phase approach before planning
4
+ argument-hint: "[phase]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Grep
9
+ - Glob
10
+ ---
11
+
12
+ <objective>
13
+ Analyze a phase and present Claude's assumptions about technical approach, implementation order, scope boundaries, risk areas, and dependencies.
14
+
15
+ Purpose: Help users see what Claude thinks BEFORE planning begins - enabling course correction early when assumptions are wrong.
16
+ Output: Conversational output only (no file creation) - ends with "What do you think?" prompt
17
+ </objective>
18
+
19
+ <execution_context>
20
+ @~/.claude/qgsd/workflows/list-phase-assumptions.md
21
+ </execution_context>
22
+
23
+ <context>
24
+ Phase number: $ARGUMENTS (required)
25
+
26
+ Project state and roadmap are loaded in-workflow using targeted reads.
27
+ </context>
28
+
29
+ <process>
30
+ 1. Validate phase number argument (error if missing or invalid)
31
+ 2. Check if phase exists in roadmap
32
+ 3. Follow list-phase-assumptions.md workflow:
33
+ - Analyze roadmap description
34
+ - Surface assumptions about: technical approach, implementation order, scope, risks, dependencies
35
+ - Present assumptions clearly
36
+ - Prompt "What do you think?"
37
+ 4. Gather feedback and offer next steps
38
+ </process>
39
+
40
+ <success_criteria>
41
+
42
+ - Phase validated against roadmap
43
+ - Assumptions surfaced across five areas
44
+ - User prompted for feedback
45
+ - User knows next steps (discuss context, plan phase, or correct assumptions)
46
+ </success_criteria>
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: qgsd:map-codebase
3
+ description: Analyze codebase with parallel mapper agents to produce .planning/codebase/ documents
4
+ argument-hint: "[optional: specific area to map, e.g., 'api' or 'auth']"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Write
11
+ - Task
12
+ ---
13
+
14
+ <objective>
15
+ Analyze existing codebase using parallel qgsd-codebase-mapper agents to produce structured codebase documents.
16
+
17
+ Each mapper agent explores a focus area and **writes documents directly** to `.planning/codebase/`. The orchestrator only receives confirmations, keeping context usage minimal.
18
+
19
+ Output: .planning/codebase/ folder with 7 structured documents about the codebase state.
20
+ </objective>
21
+
22
+ <execution_context>
23
+ @~/.claude/qgsd/workflows/map-codebase.md
24
+ </execution_context>
25
+
26
+ <context>
27
+ Focus area: $ARGUMENTS (optional - if provided, tells agents to focus on specific subsystem)
28
+
29
+ **Load project state if exists:**
30
+ Check for .planning/STATE.md - loads context if project already initialized
31
+
32
+ **This command can run:**
33
+ - Before /qgsd:new-project (brownfield codebases) - creates codebase map first
34
+ - After /qgsd:new-project (greenfield codebases) - updates codebase map as code evolves
35
+ - Anytime to refresh codebase understanding
36
+ </context>
37
+
38
+ <when_to_use>
39
+ **Use map-codebase for:**
40
+ - Brownfield projects before initialization (understand existing code first)
41
+ - Refreshing codebase map after significant changes
42
+ - Onboarding to an unfamiliar codebase
43
+ - Before major refactoring (understand current state)
44
+ - When STATE.md references outdated codebase info
45
+
46
+ **Skip map-codebase for:**
47
+ - Greenfield projects with no code yet (nothing to map)
48
+ - Trivial codebases (<5 files)
49
+ </when_to_use>
50
+
51
+ <process>
52
+ 1. Check if .planning/codebase/ already exists (offer to refresh or skip)
53
+ 2. Create .planning/codebase/ directory structure
54
+ 3. Spawn 4 parallel qgsd-codebase-mapper agents:
55
+ - Agent 1: tech focus → writes STACK.md, INTEGRATIONS.md
56
+ - Agent 2: arch focus → writes ARCHITECTURE.md, STRUCTURE.md
57
+ - Agent 3: quality focus → writes CONVENTIONS.md, TESTING.md
58
+ - Agent 4: concerns focus → writes CONCERNS.md
59
+ 4. Wait for agents to complete, collect confirmations (NOT document contents)
60
+ 5. Verify all 7 documents exist with line counts
61
+ 6. Commit codebase map
62
+ 7. Offer next steps (typically: /qgsd:new-project or /qgsd:plan-phase)
63
+ </process>
64
+
65
+ <success_criteria>
66
+ - [ ] .planning/codebase/ directory created
67
+ - [ ] All 7 codebase documents written by mapper agents
68
+ - [ ] Documents follow template structure
69
+ - [ ] Parallel agents completed without errors
70
+ - [ ] User knows next steps
71
+ </success_criteria>
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: qgsd:map-requirements
3
+ description: Map current and archived milestone requirements into .planning/formal/requirements.json
4
+ argument-hint: [--dry-run] [--skip-archive] [--skip-validate]
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ ---
9
+ <objective>
10
+ Run the requirements mapping pipeline — merges current `.planning/REQUIREMENTS.md` with archived milestone requirements into `.planning/formal/requirements.json`. Shows a summary of requirement counts by source.
11
+ </objective>
12
+
13
+ <execution_context>
14
+ @~/.claude/qgsd/workflows/map-requirements.md
15
+ </execution_context>
16
+
17
+ <process>
18
+ Execute the map-requirements workflow from @~/.claude/qgsd/workflows/map-requirements.md end-to-end.
19
+ Pass through --dry-run and --skip-archive flags from arguments.
20
+ </process>
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: qgsd:mcp-restart
3
+ description: Restart a quorum agent's MCP server process — kills the running process and waits for Claude Code to reconnect automatically
4
+ argument-hint: "<agent>"
5
+ allowed-tools:
6
+ - Bash
7
+ - mcp__codex-cli-1__identity
8
+ - mcp__gemini-cli-1__identity
9
+ - mcp__opencode-1__identity
10
+ - mcp__copilot-1__identity
11
+ - mcp__claude-1__identity
12
+ - mcp__claude-2__identity
13
+ - mcp__claude-3__identity
14
+ - mcp__claude-4__identity
15
+ - mcp__claude-5__identity
16
+ - mcp__claude-6__identity
17
+ ---
18
+
19
+ <objective>
20
+ Restart a named quorum agent's MCP server process. Reads `~/.claude.json` to identify the running process, kills it, and waits for Claude Code to automatically reconnect. Claude Code manages MCP server lifecycles — when a child process dies, Claude Code restarts it automatically. After killing the process, this command waits 2 seconds and calls the agent's identity tool to confirm reconnection.
21
+ </objective>
22
+
23
+ <process>
24
+
25
+ ## Step 1 — Parse arguments
26
+
27
+ Parse `$ARGUMENTS` as one token: `$AGENT`.
28
+
29
+ If `$AGENT` is missing, print usage and stop:
30
+ ```
31
+ Usage: /qgsd:mcp-restart <agent>
32
+
33
+ Valid agents:
34
+ codex-cli-1, gemini-cli-1, opencode-1, copilot-1,
35
+ claude-1, claude-2, claude-3, claude-4, claude-5, claude-6
36
+ ```
37
+
38
+ ## Step 2 — Validate agent name
39
+
40
+ Check `$AGENT` against the known agent list:
41
+ ```
42
+ codex-cli-1, gemini-cli-1, opencode-1, copilot-1,
43
+ claude-1, claude-2, claude-3, claude-4, claude-5, claude-6
44
+ ```
45
+
46
+ If not in the list, print an error and stop:
47
+ ```
48
+ Error: Unknown agent "$AGENT"
49
+
50
+ Valid agents:
51
+ codex-cli-1 gemini-cli-1 opencode-1 copilot-1
52
+ claude-1 claude-2 claude-3 claude-4
53
+ claude-5 claude-6
54
+ ```
55
+
56
+ ## Step 3 — Read process identity from ~/.claude.json
57
+
58
+ Run this inline node script via Bash:
59
+
60
+ ```bash
61
+ node -e "
62
+ const fs = require('fs');
63
+ const path = require('path');
64
+ const os = require('os');
65
+
66
+ const claudeJsonPath = path.join(os.homedir(), '.claude.json');
67
+ let claudeJson;
68
+ try {
69
+ claudeJson = JSON.parse(fs.readFileSync(claudeJsonPath, 'utf8'));
70
+ } catch (e) {
71
+ console.error('Error: Cannot read ~/.claude.json: ' + e.message);
72
+ process.exit(1);
73
+ }
74
+
75
+ const servers = claudeJson.mcpServers || {};
76
+ const agent = process.env.AGENT;
77
+ const serverConfig = servers[agent];
78
+
79
+ if (!serverConfig) {
80
+ console.error('Error: Agent \"' + agent + '\" is not configured in ~/.claude.json mcpServers');
81
+ process.exit(2);
82
+ }
83
+
84
+ const command = serverConfig.command;
85
+ const args = serverConfig.args || [];
86
+
87
+ let result;
88
+ if (command === 'node' && args.length > 0) {
89
+ // local node path: kill by matching argv path
90
+ result = { type: 'local', processPath: args[0] };
91
+ } else if (command === 'npx' || command === 'npm') {
92
+ // npx-based: kill by package name (matches both npm exec and node child)
93
+ const packageName = args[args.length - 1];
94
+ result = { type: 'npx', packageName };
95
+ } else {
96
+ result = { type: 'unknown', command };
97
+ }
98
+
99
+ process.stdout.write(JSON.stringify(result) + '\n');
100
+ " AGENT="$AGENT"
101
+ ```
102
+
103
+ Store output as `$PROCESS_INFO`.
104
+
105
+ If exit code 1 or 2: print the error message and stop.
106
+ If exit code 0: parse `$PROCESS_INFO` JSON.
107
+
108
+ ## Step 4 — Kill the MCP server process
109
+
110
+ Based on the `type` field from `$PROCESS_INFO`:
111
+
112
+ **type = "local":**
113
+
114
+ Kill all node processes whose argv path matches the server path:
115
+ ```bash
116
+ pkill -f "$PROCESS_PATH" 2>/dev/null || true
117
+ ```
118
+ where `$PROCESS_PATH` is `process_info.processPath`.
119
+
120
+ Print: `Sending SIGTERM to processes matching: $PROCESS_PATH`
121
+
122
+ **type = "npx":**
123
+
124
+ Kill both the npm exec parent and the node child subprocess:
125
+ ```bash
126
+ pkill -f "npm exec $PACKAGE_NAME" 2>/dev/null || true
127
+ sleep 0.5
128
+ pkill -f "$PACKAGE_NAME" 2>/dev/null || true
129
+ ```
130
+ where `$PACKAGE_NAME` is `process_info.packageName`.
131
+
132
+ Print: `Sending SIGTERM to npm exec + node processes for: $PACKAGE_NAME`
133
+
134
+ **type = "unknown":**
135
+ Print:
136
+ ```
137
+ Warning: Cannot determine process pattern for $AGENT (command: <command>).
138
+ Cannot restart automatically. Restart Claude Code session to reload this agent.
139
+ ```
140
+ Stop.
141
+
142
+ ## Step 5 — Wait for reconnection
143
+
144
+ Wait 2 seconds:
145
+ ```bash
146
+ sleep 2
147
+ ```
148
+
149
+ Print: `Waiting for Claude Code to reconnect...`
150
+
151
+ ## Step 6 — Verify reconnection via identity tool
152
+
153
+ Call the identity tool for `$AGENT` — one sequential call:
154
+
155
+ `mcp__<$AGENT>__identity`
156
+
157
+ (Replace hyphens in the agent name with hyphens as-is: `codex-cli-1` → `mcp__codex-cli-1__identity`)
158
+
159
+ **If identity tool returns successfully:**
160
+ Parse response. Print:
161
+ ```
162
+ Agent $AGENT restarted and responding
163
+
164
+ Name: <name from identity>
165
+ Version: <version from identity>
166
+ Model: <model from identity>
167
+ ```
168
+
169
+ **If identity tool errors or times out:**
170
+ Print:
171
+ ```
172
+ Processes killed. Claude Code is reconnecting to $AGENT.
173
+ Check status in a few seconds: /qgsd:mcp-status
174
+ ```
175
+
176
+ </process>