@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,260 @@
1
+ ---
2
+ name: qgsd:observe
3
+ description: Fetch issues and drifts from configured sources, render dual-table output, and write to debt ledger. Replaces /qgsd:triage.
4
+ argument-hint: "[--source github|sentry|sentry-feedback|bash|internal] [--since 24h|7d] [--limit N]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Task
10
+ - AskUserQuestion
11
+ ---
12
+
13
+ <objective>
14
+ Aggregate issues and drifts from all configured sources, deduplicate, render a prioritized dual-table output (Issues + Drifts), write observations to the debt ledger, and route the selected issue to the right QGSD workflow.
15
+
16
+ This command is the project's unified "what's broken right now?" entry point. It replaces `/qgsd:triage` with debt-aware persistence and dual-table rendering.
17
+ </objective>
18
+
19
+ <process>
20
+
21
+ ## Step 1: Parse arguments
22
+
23
+ From `$ARGUMENTS`, extract:
24
+ - `--source <type>` → `$SOURCE_FILTER` (filter to one source type; default: all)
25
+ - `--since <duration>` → `$SINCE_OVERRIDE` (e.g. `24h`, `7d`; overrides per-source config)
26
+ - `--limit <n>` → `$LIMIT_OVERRIDE` (max issues per source; default: 10)
27
+
28
+ ## Step 2: Load source configuration
29
+
30
+ Use `loadObserveConfig()` from `bin/observe-config.cjs` to load sources.
31
+
32
+ ```javascript
33
+ const { loadObserveConfig } = require('./bin/observe-config.cjs');
34
+ const config = loadObserveConfig();
35
+ // config = { sources, configFile, observeConfig, error? }
36
+ ```
37
+
38
+ The loader automatically:
39
+ 1. Tries `.planning/observe-sources.md` first, falls back to `.planning/triage-sources.md` (backward compatible)
40
+ 2. Parses YAML frontmatter to extract sources array
41
+ 3. Infers `issue_type` for known source types (github/sentry/bash → "issue", prometheus/grafana/logstash → "drift")
42
+ 4. Applies default timeout and fail_open settings
43
+
44
+ **If no config file exists or error is returned:**
45
+
46
+ Display:
47
+ ```
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+ QGSD > OBSERVE: No sources configured
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+ Create .planning/observe-sources.md to configure issue sources.
52
+ ```
53
+ Stop.
54
+
55
+ **If `$SOURCE_FILTER` is set**, keep only sources whose `type` matches.
56
+
57
+ **Always-on internal source:** Regardless of config or filters, inject an internal work detection source:
58
+
59
+ ```javascript
60
+ // Inject internal scanner unconditionally (always-on, no config needed)
61
+ const internalSource = { type: 'internal', label: 'Internal Work', issue_type: 'issue' };
62
+ // Add to sources array if not already present and not filtered out by --source
63
+ if (!$SOURCE_FILTER || $SOURCE_FILTER === 'internal') {
64
+ config.sources.push(internalSource);
65
+ }
66
+
67
+ // Critical: check for empty sources AFTER internal injection
68
+ if (config.sources.length === 0) {
69
+ // Display "no sources" message only if sources is empty AFTER internal source injection
70
+ display("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n QGSD > OBSERVE: No sources configured\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nCreate .planning/observe-sources.md to configure issue sources.");
71
+ stop();
72
+ }
73
+ ```
74
+
75
+ This ensures internal work detection runs even if observe-sources.md doesn't exist or if the user filters to `--source internal`.
76
+
77
+ ## Step 3: Register handlers
78
+
79
+ Import handler functions and register them with the registry:
80
+
81
+ ```javascript
82
+ const { registerHandler } = require('./bin/observe-registry.cjs');
83
+ const { handleGitHub, handleSentry, handleSentryFeedback, handleBash, handleInternal } = require('./bin/observe-handlers.cjs');
84
+
85
+ registerHandler('github', handleGitHub);
86
+ registerHandler('sentry', handleSentry);
87
+ registerHandler('sentry-feedback', handleSentryFeedback);
88
+ registerHandler('bash', handleBash);
89
+ registerHandler('internal', handleInternal);
90
+ ```
91
+
92
+ Display dispatch header:
93
+ ```
94
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
95
+ QGSD > OBSERVE: Fetching from N source(s)...
96
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
97
+ ```
98
+
99
+ ## Step 4: Dispatch parallel fetch
100
+
101
+ Call `dispatchAll()` from `bin/observe-registry.cjs` — this dispatches ALL sources uniformly through the registry with per-source timeout. No special-casing per source type at this stage.
102
+
103
+ ```javascript
104
+ const { dispatchAll } = require('./bin/observe-registry.cjs');
105
+ const results = await dispatchAll(config.sources, { sinceOverride: $SINCE_OVERRIDE, limitOverride: $LIMIT_OVERRIDE });
106
+ ```
107
+
108
+ This uses `Promise.allSettled` internally — one source failure does not block others (OBS-08).
109
+
110
+ ## Step 4b: MCP bridge for pending_mcp results
111
+
112
+ After `dispatchAll` returns, iterate over results. For any result with `status: "pending_mcp"`:
113
+
114
+ 1. Read the `_mcp_instruction` object from the result:
115
+ ```javascript
116
+ const { tool, params, mapper } = result._mcp_instruction;
117
+ ```
118
+
119
+ 2. Execute the MCP tool call directly (the observe command runs in Claude context where MCP tools are available). Call the tool named in `_mcp_instruction.tool` with `_mcp_instruction.params`. Try `mcp__sentry__<tool>` first, then `mcp__plugin_sentry_sentry__<tool>` as fallback.
120
+
121
+ 3. Import the mapper function from `bin/observe-handlers.cjs`:
122
+ ```javascript
123
+ const handlers = require('./bin/observe-handlers.cjs');
124
+ const mapperFn = handlers[mapper]; // e.g., mapSentryIssuesToSchema or mapSentryFeedbackToSchema
125
+ ```
126
+
127
+ 4. Call the mapper with the MCP result and the original sourceConfig:
128
+ ```javascript
129
+ const mapped = mapperFn(mcpResult, sourceConfig);
130
+ // mapped = { source_label, source_type, status: "ok", issues: [...] }
131
+ ```
132
+
133
+ 5. Replace the `pending_mcp` result in the results array with the mapped standard schema result.
134
+
135
+ 6. If the MCP call fails, replace with:
136
+ ```javascript
137
+ { source_label, source_type, status: "error", error: "MCP call failed: {message}", issues: [] }
138
+ ```
139
+
140
+ **Key principle:** This pattern keeps handlers as pure testable CJS functions while the observe command (running in Claude context) handles MCP execution. The registry's `dispatchAll` works uniformly — the MCP bridge is a post-processing step.
141
+
142
+ ## Step 5: Collect and render
143
+
144
+ Call `renderObserveOutput()` from `bin/observe-render.cjs`:
145
+
146
+ ```javascript
147
+ const { renderObserveOutput } = require('./bin/observe-render.cjs');
148
+ const output = renderObserveOutput(results);
149
+ ```
150
+
151
+ At this point ALL results are standard schema (pending_mcp results were resolved in Step 4b).
152
+
153
+ The renderer:
154
+ 1. Separates successful results from errors
155
+ 2. Splits issues by `issue_type`: "issue" items and "drift" items
156
+ 3. Sorts each group by severity (error > bug > warning > info), then by age (newest first)
157
+ 4. Renders ISSUES table with columns: #, Title, Source, Sev, Age
158
+ 5. Renders DRIFTS table (if any) with columns: #, Parameter, Formal, Actual, Sev
159
+ 6. Renders error section at bottom listing failed sources
160
+
161
+ Display the output.
162
+
163
+ If total issues = 0 and no drifts:
164
+ ```
165
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
166
+ QGSD > OBSERVE: All clear — no open issues found
167
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
168
+ Sources checked: <list>
169
+ ```
170
+ Stop.
171
+
172
+ ## Step 6a: Write to debt ledger
173
+
174
+ Call `writeObservationsToDebt()` from `bin/observe-debt-writer.cjs`:
175
+
176
+ ```javascript
177
+ const { writeObservationsToDebt } = require('./bin/observe-debt-writer.cjs');
178
+
179
+ // Collect all issues from all successful results
180
+ const allObservations = results
181
+ .filter(r => r.status === 'ok')
182
+ .flatMap(r => r.issues || []);
183
+
184
+ const { written, updated, errors } = writeObservationsToDebt(allObservations, '.planning/formal/debt.json');
185
+ ```
186
+
187
+ Display:
188
+ ```
189
+ Wrote {written} new, updated {updated} existing debt entries.
190
+ ```
191
+
192
+ This upserts all observations by fingerprint (using v0.27-01's `fingerprintIssue` and `fingerprintDrift` functions). Same issues across runs update `occurrences` and `last_seen`, not duplicates.
193
+
194
+ ## Step 6b: Show debt summary
195
+
196
+ Read the debt ledger and display status counts:
197
+
198
+ ```javascript
199
+ const { readDebtLedger } = require('./bin/debt-ledger.cjs');
200
+ const ledger = readDebtLedger('.planning/formal/debt.json');
201
+ const entries = ledger.debt_entries || [];
202
+
203
+ const counts = {
204
+ open: entries.filter(e => e.status === 'open').length,
205
+ acknowledged: entries.filter(e => e.status === 'acknowledged').length,
206
+ resolving: entries.filter(e => e.status === 'resolving').length,
207
+ resolved: entries.filter(e => e.status === 'resolved').length
208
+ };
209
+ ```
210
+
211
+ Display:
212
+ ```
213
+ Debt ledger: {open} open, {acknowledged} acknowledged, {resolving} resolving, {resolved} resolved
214
+ ```
215
+
216
+ ## Step 7: Route to action
217
+
218
+ Prompt the user:
219
+
220
+ ```
221
+ Enter issue # to work on, "ack N" to acknowledge, "solve" for all internal issues, "all" for full details, or press Enter to skip:
222
+ ```
223
+
224
+ **If user enters a number:**
225
+ - Load the full issue details (title, URL, meta) for that index.
226
+ - Determine routing:
227
+ - If the issue has `source_type: 'internal'` and `_route` metadata: use the `_route` value as the suggested action (example: unfinished quick task suggests `/qgsd:quick "original-slug"`, debug session suggests `/qgsd:debug --resume`)
228
+ - Otherwise, routing by severity:
229
+ - `severity: error` or `severity: bug` → suggest `/qgsd:debug`
230
+ - `severity: warning` or `severity: info` → suggest `/qgsd:quick`
231
+ - Display:
232
+ ```
233
+ ◆ Issue: <title>
234
+ URL: <url>
235
+ Meta: <meta>
236
+
237
+ Suggested action: /qgsd:debug "<title> — <meta>"
238
+ Run it? [Y/n]
239
+ ```
240
+ - If confirmed, invoke the suggested skill with the issue as context.
241
+
242
+ **If user enters "solve":**
243
+ - Collect all issues with `source_type: 'internal'`
244
+ - Display: `Routing all internal issues to /qgsd:solve...`
245
+ - Invoke `/qgsd:solve` to address all internal consistency issues at once
246
+
247
+ **If user enters "ack N":**
248
+ - Acknowledge the debt entry for issue #N (transition status from "open" to "acknowledged" via the debt state machine).
249
+ - Display: `Acknowledged: <title>`
250
+
251
+ **If user enters "all":**
252
+ - Print the full metadata for each issue (title, URL, meta, created_at) as a numbered list.
253
+ - Then re-prompt for a number.
254
+
255
+ **If user presses Enter (blank):**
256
+ ```
257
+ Observe complete. Run /qgsd:observe again when ready.
258
+ ```
259
+
260
+ </process>
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: qgsd:pause-work
3
+ description: Create context handoff when pausing work mid-phase
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ ---
9
+
10
+ <objective>
11
+ Create `.continue-here.md` handoff file to preserve complete work state across sessions.
12
+
13
+ Routes to the pause-work workflow which handles:
14
+ - Current phase detection from recent files
15
+ - Complete state gathering (position, completed work, remaining work, decisions, blockers)
16
+ - Handoff file creation with all context sections
17
+ - Git commit as WIP
18
+ - Resume instructions
19
+ </objective>
20
+
21
+ <execution_context>
22
+ @~/.claude/qgsd/workflows/pause-work.md
23
+ </execution_context>
24
+
25
+ <context>
26
+ State and phase progress are gathered in-workflow with targeted reads.
27
+ </context>
28
+
29
+ <process>
30
+ **Follow the pause-work workflow** from `@~/.claude/qgsd/workflows/pause-work.md`.
31
+
32
+ The workflow handles all logic including:
33
+ 1. Phase directory detection
34
+ 2. State gathering with user clarifications
35
+ 3. Handoff file writing with timestamp
36
+ 4. Git commit
37
+ 5. Confirmation with resume instructions
38
+ </process>
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: qgsd:plan-milestone-gaps
3
+ description: Create phases to close all gaps identified by milestone audit
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - AskUserQuestion
11
+ ---
12
+ <objective>
13
+ Create all phases necessary to close gaps identified by `/qgsd:audit-milestone`.
14
+
15
+ Reads MILESTONE-AUDIT.md, groups gaps into logical phases, creates phase entries in ROADMAP.md, and offers to plan each phase.
16
+
17
+ One command creates all fix phases — no manual `/qgsd:add-phase` per gap.
18
+ </objective>
19
+
20
+ <execution_context>
21
+ @~/.claude/qgsd/workflows/plan-milestone-gaps.md
22
+ </execution_context>
23
+
24
+ <context>
25
+ **Audit results:**
26
+ Glob: .planning/milestones/v*-MILESTONE-AUDIT.md or .planning/v*-MILESTONE-AUDIT.md (use most recent)
27
+
28
+ Original intent and current planning state are loaded on demand inside the workflow.
29
+ </context>
30
+
31
+ <process>
32
+ Execute the plan-milestone-gaps workflow from @~/.claude/qgsd/workflows/plan-milestone-gaps.md end-to-end.
33
+ Preserve all workflow gates (audit loading, prioritization, phase grouping, user confirmation, roadmap updates).
34
+ </process>
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: qgsd:plan-phase
3
+ description: Create detailed phase plan (PLAN.md) with verification loop
4
+ argument-hint: "[phase] [--auto] [--research] [--skip-research] [--gaps] [--skip-verify]"
5
+ agent: qgsd-planner
6
+ allowed-tools:
7
+ - Read
8
+ - Write
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Task
13
+ - WebFetch
14
+ - mcp__context7__*
15
+ ---
16
+ <objective>
17
+ Create executable phase prompts (PLAN.md files) for a roadmap phase with integrated research and verification.
18
+
19
+ **Default flow:** Research (if needed) → Plan → Verify → Done
20
+
21
+ **Orchestrator role:** Parse arguments, validate phase, research domain (unless skipped), spawn qgsd-planner, verify with qgsd-plan-checker, iterate until pass or max iterations, present results.
22
+ </objective>
23
+
24
+ <execution_context>
25
+ @~/.claude/qgsd/workflows/plan-phase.md
26
+ @~/.claude/qgsd/references/ui-brand.md
27
+ </execution_context>
28
+
29
+ <context>
30
+ Phase number: $ARGUMENTS (optional — auto-detects next unplanned phase if omitted)
31
+
32
+ **Flags:**
33
+ - `--research` — Force re-research even if RESEARCH.md exists
34
+ - `--skip-research` — Skip research, go straight to planning
35
+ - `--gaps` — Gap closure mode (reads VERIFICATION.md, skips research)
36
+ - `--skip-verify` — Skip verification loop
37
+
38
+ Normalize phase input in step 2 before any directory lookups.
39
+ </context>
40
+
41
+ <process>
42
+ Execute the plan-phase workflow from @~/.claude/qgsd/workflows/plan-phase.md end-to-end.
43
+ Preserve all workflow gates (validation, research, planning, verification loop, routing).
44
+ </process>
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: qgsd:polyrepo
3
+ description: Manage polyrepo groups — register repos that form one product for cross-repo QGSD awareness
4
+ argument-hint: create | add <group> <path> [role] | remove <group> <path> | list [group] | info
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - AskUserQuestion
10
+ ---
11
+
12
+ <objective>
13
+ Manage named polyrepo groups — collections of repositories that together form one product. Supports creating groups, adding/removing repos, listing groups, and checking current repo membership.
14
+
15
+ Global config: ~/.claude/polyrepos/<name>.json
16
+ Per-repo marker: .planning/polyrepo.json
17
+ </objective>
18
+
19
+ <execution_context>
20
+ Self-contained — no external workflow file needed.
21
+ </execution_context>
22
+
23
+ <process>
24
+ Parse $ARGUMENTS for subcommand:
25
+
26
+ **If no arguments or `create`:**
27
+ Interactive flow using AskUserQuestion:
28
+ 1. Ask for group name (lowercase, alphanumeric + hyphens)
29
+ 2. Run `node bin/polyrepo.cjs create <name>` to create an empty group (calls `createGroup(name, [])`)
30
+ 3. Ask for repos to include (one at a time: path, role, planning yes/no)
31
+ 4. For each repo, run `node bin/polyrepo.cjs add <name> <path> <role> [--no-planning]` (calls `addRepo` per repo)
32
+ 5. Ask "Add another repo?" until user says no
33
+ 6. Display summary of created group
34
+
35
+ **If `add <group> <path> [role]`:**
36
+ Run `node bin/polyrepo.cjs add <group> <path> <role> [--no-planning]`
37
+ If role not provided, ask via AskUserQuestion.
38
+
39
+ **If `remove <group> <path>`:**
40
+ Run `node bin/polyrepo.cjs remove <group> <path>`
41
+ Confirm action.
42
+
43
+ **If `list [group]`:**
44
+ Run `node bin/polyrepo.cjs list [group]`
45
+ Display formatted output.
46
+
47
+ **If `info`:**
48
+ Run `node bin/polyrepo.cjs info`
49
+ Display current repo's group membership.
50
+ </process>
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: qgsd:progress
3
+ description: Check project progress, show context, and route to next action (execute or plan)
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Grep
8
+ - Glob
9
+ - SlashCommand
10
+ ---
11
+ <objective>
12
+ Check project progress, summarize recent work and what's ahead, then intelligently route to the next action - either executing an existing plan or creating the next one.
13
+
14
+ Provides situational awareness before continuing work.
15
+ </objective>
16
+
17
+ <execution_context>
18
+ @~/.claude/qgsd/workflows/progress.md
19
+ </execution_context>
20
+
21
+ <process>
22
+ Execute the progress workflow from @~/.claude/qgsd/workflows/progress.md end-to-end.
23
+ Preserve all routing logic (Routes A through F) and edge case handling.
24
+ </process>
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: qgsd:queue
3
+ description: Queue a skill or command to auto-invoke after the next /clear
4
+ argument-hint: <command to queue, e.g. "/qgsd:quick --full">
5
+ allowed-tools:
6
+ - Bash
7
+ - Write
8
+ ---
9
+
10
+ <objective>
11
+ Write a pending-task file so the specified command auto-invokes on the next user prompt
12
+ after a `/clear`. Uses session-scoped file naming to prevent cross-session delivery.
13
+ </objective>
14
+
15
+ <process>
16
+ 1. Get the task from `$ARGUMENTS`. If empty, show usage and stop.
17
+
18
+ 2. Determine the session-scoped filename:
19
+ - Use `CLAUDE_SESSION_ID` env var if set, else use `CLAUDE_INSTANCE_ID`, else fall back to the generic name.
20
+ - Session-scoped: `.claude/pending-task-<sessionId>.txt`
21
+ - Generic fallback: `.claude/pending-task.txt`
22
+
23
+ 3. Write the task text to the file (create `.claude/` dir if needed).
24
+ Overwrite any existing pending task for this session.
25
+
26
+ 4. Confirm to the user:
27
+ ```
28
+ Queued: <task>
29
+ File: .claude/pending-task-<sessionId>.txt (or pending-task.txt)
30
+
31
+ Now run /clear. Your next prompt will auto-invoke: <task>
32
+ ```
33
+
34
+ 5. Do NOT run the task now. Just write the file and confirm.
35
+ </process>
36
+
37
+ <implementation>
38
+ Run this bash to determine the file path and write it:
39
+
40
+ ```bash
41
+ SESSION_ID="${CLAUDE_SESSION_ID:-${CLAUDE_INSTANCE_ID:-}}"
42
+ CLAUDE_DIR=".claude"
43
+ mkdir -p "$CLAUDE_DIR"
44
+ if [ -n "$SESSION_ID" ]; then
45
+ FILE="$CLAUDE_DIR/pending-task-$SESSION_ID.txt"
46
+ else
47
+ FILE="$CLAUDE_DIR/pending-task.txt"
48
+ fi
49
+ printf '%s' '$ARGUMENTS' > "$FILE"
50
+ echo "file=$FILE"
51
+ ```
52
+
53
+ Then confirm to the user with the file path and next step.
54
+ </implementation>
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: qgsd:quick
3
+ description: Execute a quick task with GSD guarantees (atomic commits, state tracking) but skip optional agents
4
+ argument-hint: "[--full]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Glob
10
+ - Grep
11
+ - Bash
12
+ - Task
13
+ - AskUserQuestion
14
+ ---
15
+ <objective>
16
+ Execute small, ad-hoc tasks with GSD guarantees (atomic commits, STATE.md tracking).
17
+
18
+ Quick mode is the same system with a shorter path:
19
+ - Spawns qgsd-planner (quick mode) + qgsd-executor(s)
20
+ - Quick tasks live in `.planning/quick/` separate from planned phases
21
+ - Updates STATE.md "Quick Tasks Completed" table (NOT ROADMAP.md)
22
+
23
+ **Default:** Skips research, plan-checker, verifier. Use when you know exactly what to do.
24
+
25
+ **`--full` flag:** Single-phase rigor tier. Enables:
26
+ - Plan-checking (max 2 iterations) and post-execution verification
27
+ - Formal scope scan: discovers relevant `.planning/formal/spec/*/invariants.md` and injects invariant context into the planner
28
+ - Plan frontmatter must declare `formal_artifacts:` (none | update | create) with .planning/formal/ file targets
29
+ - Executor commits .planning/formal/ files atomically when `formal_artifacts` is non-empty
30
+ - Verifier checks invariant compliance and formal artifact syntax
31
+ - Quorum reviews VERIFICATION.md after passing (can downgrade to "Needs Review")
32
+
33
+ Use when you want quality guarantees with formal correctness properties, without full milestone ceremony.
34
+ </objective>
35
+
36
+ <execution_context>
37
+ @~/.claude/qgsd/workflows/quick.md
38
+ </execution_context>
39
+
40
+ <context>
41
+ $ARGUMENTS
42
+
43
+ Context files are resolved inside the workflow (`init quick`) and delegated via `<files_to_read>` blocks.
44
+ </context>
45
+
46
+ <process>
47
+ Execute the quick workflow from @~/.claude/qgsd/workflows/quick.md end-to-end.
48
+ Preserve all workflow gates (validation, task description, planning, execution, state updates, commits).
49
+ </process>
50
+
51
+ ## Verification Gap Auto-Proceed Override
52
+
53
+ **Scope:** Applies only during Step 6.5 of the GSD quick workflow (post-execution verification, `$FULL_MODE` only). The `passed` and `human_needed` branches from the upstream workflow are unchanged.
54
+
55
+ ### Rule: gaps_found — auto-fix loop (replaces pause-and-ask)
56
+
57
+ When Step 6.5 reaches `gaps_found` status, do NOT pause for user input and do NOT offer "accept as-is." Instead:
58
+
59
+ **1. Display:**
60
+
61
+ ```
62
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
63
+ QGSD ► GAPS FOUND — AUTO-FIX
64
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
65
+
66
+ ◆ Verification found gaps. Spawning fix executor...
67
+ ```
68
+
69
+ **2. Initialize iteration counter:** `$GAP_FIX_ITERATION = 1`. Max iterations = 2.
70
+
71
+ **3. Spawn fix executor** with VERIFICATION.md and PLAN.md as context:
72
+
73
+ ```
74
+ Task(
75
+ prompt="
76
+ Fix gaps identified in verification.
77
+
78
+ <files_to_read>
79
+ - ${QUICK_DIR}/${next_num}-PLAN.md (Original plan)
80
+ - ${QUICK_DIR}/${next_num}-VERIFICATION.md (Gaps to fix)
81
+ - .planning/STATE.md (Project state)
82
+ </files_to_read>
83
+
84
+ <constraints>
85
+ - Address only the gaps listed in VERIFICATION.md
86
+ - Do not re-implement tasks already marked as passing
87
+ - Commit fixes atomically using gsd-tools.cjs commit
88
+ - Return the fix commit hash in your response (format: 'Fix Commit: {hash}')
89
+ </constraints>
90
+ ",
91
+ subagent_type="qgsd-executor",
92
+ model="{executor_model}",
93
+ description="Fix gaps: ${DESCRIPTION}"
94
+ )
95
+ ```
96
+
97
+ **4. After fix executor returns, run quorum-test to verify gaps are closed:**
98
+
99
+ Determine test scope from VERIFICATION.md artifacts. If test files exist (`*.test.js`, `*.test.ts`, etc.), call `/qgsd:quorum-test` with those files. If no test files are present (non-testable gaps), skip quorum-test and proceed directly to step 5 treating the result as PASS.
100
+
101
+ Evaluate quorum-test consensus:
102
+
103
+ | Verdict | Action |
104
+ |---------|--------|
105
+ | **PASS** | Gaps confirmed closed. Set `$VERIFICATION_STATUS = "Verified"`. Proceed to status update. |
106
+ | **REVIEW-NEEDED** | Treat as passing (gap closure confirmed, concerns noted). Set `$VERIFICATION_STATUS = "Verified (Review Noted)"`. Proceed to status update. |
107
+ | **BLOCK** | Gaps not resolved. If `$GAP_FIX_ITERATION < 2`, increment `$GAP_FIX_ITERATION` and repeat from step 3. |
108
+ | **ALL models UNAVAILABLE** | Escalate to human. Display the unavailable-models banner (see below). Wait for human response. |
109
+
110
+ **Unavailable-models banner:**
111
+
112
+ ```
113
+ All quorum models unavailable — cannot verify gap closure automatically.
114
+ Please manually verify and type "verified" to continue, or "skip" to record as Needs Review.
115
+ ```
116
+
117
+ Set `$VERIFICATION_STATUS` based on human response ("verified" → "Verified", "skip" → "Needs Review").
118
+
119
+ **5. If BLOCK after max iterations (2):** Set `$VERIFICATION_STATUS = "Gaps"`. Display:
120
+
121
+ ```
122
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
123
+ QGSD ► AUTO-FIX EXHAUSTED
124
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
125
+
126
+ Max fix iterations reached. Quorum still reports gaps.
127
+
128
+ Options:
129
+ 1. Provide guidance and retry: describe the issue
130
+ 2. Accept current state: type "accept"
131
+ ```
132
+
133
+ Wait for human response.