gennady 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/ai/directives/coding/result-conventions.xml +25 -7
  2. package/ai/directives/sdd/audit.directive.xml +1 -1
  3. package/ai/directives/sdd/critic-protocol.xml +78 -0
  4. package/ai/directives/sdd/critic.directive.xml +158 -0
  5. package/ai/directives/sdd/phase-execution-protocol.xml +11 -9
  6. package/ai/skills/alt-opinion/SKILL.md +79 -0
  7. package/ai/skills/alt-opinion/opinion.prompt.md +11 -0
  8. package/ai/skills/alt-opinion/synth.prompt.md +8 -0
  9. package/ai/skills/sdd-audit/SKILL.md +13 -0
  10. package/ai/skills/sdd-check/SKILL.md +139 -0
  11. package/ai/skills/sdd-continue/SKILL.md +13 -0
  12. package/ai/skills/sdd-critic/SKILL.md +12 -0
  13. package/ai/skills/sdd-discover/SKILL.md +13 -0
  14. package/ai/skills/sdd-execute/SKILL.md +205 -0
  15. package/ai/skills/sdd-execute/scripts/README.md +84 -0
  16. package/ai/skills/sdd-execute/scripts/check-blockers.sh +158 -0
  17. package/ai/skills/sdd-execute/scripts/classify-scripts.js +111 -0
  18. package/ai/skills/sdd-execute/scripts/classify-scripts.ts +133 -0
  19. package/ai/skills/sdd-execute/scripts/extract-section.sh +219 -0
  20. package/ai/skills/sdd-execute/scripts/lint-artifacts.sh +143 -0
  21. package/ai/skills/sdd-execute/scripts/scan.sh +385 -0
  22. package/ai/skills/sdd-execute/scripts/sdd +114 -0
  23. package/ai/skills/sdd-execute/scripts/verify.sh +139 -0
  24. package/ai/skills/sdd-execute-batch/SKILL.md +213 -0
  25. package/ai/skills/sdd-fix/SKILL.md +13 -0
  26. package/ai/skills/sdd-infra/SKILL.md +13 -0
  27. package/ai/skills/sdd-module-decomposition/SKILL.md +13 -0
  28. package/ai/skills/sdd-scaffold/SKILL.md +13 -0
  29. package/ai/skills/sdd-setup/SKILL.md +13 -0
  30. package/dist/ai/directives/coding/result-conventions.xml +25 -7
  31. package/dist/ai/directives/sdd/audit.directive.xml +1 -1
  32. package/dist/ai/directives/sdd/critic-protocol.xml +78 -0
  33. package/dist/ai/directives/sdd/critic.directive.xml +158 -0
  34. package/dist/ai/directives/sdd/phase-execution-protocol.xml +11 -9
  35. package/dist/ai/skills/alt-opinion/SKILL.md +79 -0
  36. package/dist/ai/skills/alt-opinion/opinion.prompt.md +11 -0
  37. package/dist/ai/skills/alt-opinion/synth.prompt.md +8 -0
  38. package/dist/ai/skills/sdd-audit/SKILL.md +13 -0
  39. package/dist/ai/skills/sdd-check/SKILL.md +139 -0
  40. package/dist/ai/skills/sdd-continue/SKILL.md +13 -0
  41. package/dist/ai/skills/sdd-critic/SKILL.md +12 -0
  42. package/dist/ai/skills/sdd-discover/SKILL.md +13 -0
  43. package/dist/ai/skills/sdd-execute/SKILL.md +205 -0
  44. package/dist/ai/skills/sdd-execute/scripts/README.md +84 -0
  45. package/dist/ai/skills/sdd-execute/scripts/check-blockers.sh +158 -0
  46. package/dist/ai/skills/sdd-execute/scripts/classify-scripts.js +111 -0
  47. package/dist/ai/skills/sdd-execute/scripts/classify-scripts.ts +133 -0
  48. package/dist/ai/skills/sdd-execute/scripts/extract-section.sh +219 -0
  49. package/dist/ai/skills/sdd-execute/scripts/lint-artifacts.sh +143 -0
  50. package/dist/ai/skills/sdd-execute/scripts/scan.sh +385 -0
  51. package/dist/ai/skills/sdd-execute/scripts/sdd +114 -0
  52. package/dist/ai/skills/sdd-execute/scripts/verify.sh +139 -0
  53. package/dist/ai/skills/sdd-execute-batch/SKILL.md +213 -0
  54. package/dist/ai/skills/sdd-fix/SKILL.md +13 -0
  55. package/dist/ai/skills/sdd-infra/SKILL.md +13 -0
  56. package/dist/ai/skills/sdd-module-decomposition/SKILL.md +13 -0
  57. package/dist/ai/skills/sdd-scaffold/SKILL.md +13 -0
  58. package/dist/ai/skills/sdd-setup/SKILL.md +13 -0
  59. package/dist/chunks/_commonjsHelpers-DaMA6jEr.js +8 -0
  60. package/dist/chunks/{devtools-B-7ugZhF.js → devtools-CPZ0IUNM.js} +1 -1
  61. package/dist/chunks/help-5qCaicff.js +6 -0
  62. package/dist/chunks/help-B2ETH0j6.js +6 -0
  63. package/dist/chunks/help-BCDURaCQ.js +6 -0
  64. package/dist/chunks/help-BvgYOSyQ.js +6 -0
  65. package/dist/chunks/help-CSPhOoI9.js +8 -0
  66. package/dist/chunks/help-CV1vpwrh.js +6 -0
  67. package/dist/chunks/help-CaBNA6Qr.js +12 -0
  68. package/dist/chunks/help-CjkR6SB9.js +6 -0
  69. package/dist/chunks/help-Coi1l5u9.js +8 -0
  70. package/dist/chunks/help-CsuLpZn-.js +8 -0
  71. package/dist/chunks/help-DL_QBMwy.js +8 -0
  72. package/dist/chunks/help-DqBZ2xcp.js +6 -0
  73. package/dist/chunks/help-_Y_TN4DZ.js +6 -0
  74. package/dist/chunks/{help.cmd-B_G7EWzF.js → help.cmd-BseRtoBF.js} +10 -2
  75. package/dist/chunks/{index-zBnnuvLA.js → index-BU1AXJGA.js} +12 -7
  76. package/dist/chunks/{index-CXuhZzS3.js → index-BXWDYM_9.js} +1 -1
  77. package/dist/chunks/index-BgKyH0dB.js +658 -0
  78. package/dist/chunks/{index-CaahtXiM.js → index-BghL1-Nk.js} +2 -2
  79. package/dist/chunks/{index-BeL1Zcbg.js → index-BlqEQEGy.js} +1 -1
  80. package/dist/chunks/{index-D1qsi0Uc.js → index-CDM74qdR.js} +3 -3
  81. package/dist/chunks/{index-D9ceRUyB.js → index-CGsIRefC.js} +2 -2
  82. package/dist/chunks/{index-CiEM-8nJ.js → index-CIvkaAQ3.js} +2 -2
  83. package/dist/chunks/{index-UbHoePfr.js → index-CkczJ__m.js} +10 -10
  84. package/dist/chunks/index-CtJKSOL0.js +21 -0
  85. package/dist/chunks/index-DEzym4Ae.js +369 -0
  86. package/dist/chunks/{index-CVR66voe.js → index-DoaxOhQ8.js} +401 -393
  87. package/dist/chunks/index-Du1xR-qO.js +752 -0
  88. package/dist/chunks/{index-DU6jD7SS.js → index-OtehG7uM.js} +1 -1
  89. package/dist/chunks/index-ZM_FonZj.js +156 -0
  90. package/dist/chunks/{index-g1LXlp77.js → index-k0nToACp.js} +2 -2
  91. package/dist/chunks/{run-review-command.logic-DpkRoEi8.js → run-review-command.logic-BeYQin-I.js} +9 -9
  92. package/dist/chunks/services-IgZptnTi.js +2732 -0
  93. package/dist/chunks/shared-DL_1LG0K.js +753 -0
  94. package/dist/cli/cmd/agent-mon/help.d.ts +4 -0
  95. package/dist/cli/cmd/agents-rules/agents-rules.cmd.d.ts +8 -0
  96. package/dist/cli/cmd/agents-rules/index.d.ts +1 -0
  97. package/dist/cli/cmd/alt-opinion/help.d.ts +4 -0
  98. package/dist/cli/cmd/cat/help.d.ts +4 -0
  99. package/dist/cli/cmd/commit/help.d.ts +4 -0
  100. package/dist/cli/cmd/lint/checks/anchor-class-body.check.d.ts +11 -0
  101. package/dist/cli/cmd/lint/checks/invariant-count.check.d.ts +11 -0
  102. package/dist/cli/cmd/lint/checks/utils/glob-match.d.ts +15 -0
  103. package/dist/cli/cmd/lint/checks/utils/strip-strings-comments.d.ts +7 -0
  104. package/dist/cli/cmd/lint/help.d.ts +4 -0
  105. package/dist/cli/cmd/lint/lint.cmd.d.ts +1 -1
  106. package/dist/cli/cmd/lint/lint.types.d.ts +6 -0
  107. package/dist/cli/cmd/orient/core/build-index.d.ts +8 -0
  108. package/dist/cli/cmd/orient/core/damerau-levenshtein.d.ts +26 -0
  109. package/dist/cli/cmd/orient/core/extract-header.d.ts +8 -0
  110. package/dist/cli/cmd/orient/core/hints.d.ts +9 -0
  111. package/dist/cli/cmd/orient/core/query-consumer.d.ts +10 -0
  112. package/dist/cli/cmd/orient/core/query-entity.d.ts +11 -0
  113. package/dist/cli/cmd/orient/core/query-graph.d.ts +18 -0
  114. package/dist/cli/cmd/orient/core/query-keyword.d.ts +10 -0
  115. package/dist/cli/cmd/orient/core/query-spec.d.ts +15 -0
  116. package/dist/cli/cmd/orient/core/query-task.d.ts +8 -0
  117. package/dist/cli/cmd/orient/core/scan-files.d.ts +8 -0
  118. package/dist/cli/cmd/orient/help.d.ts +5 -0
  119. package/dist/cli/cmd/orient/index.d.ts +1 -0
  120. package/dist/cli/cmd/orient/orient.cmd.d.ts +7 -0
  121. package/dist/cli/cmd/orient/orient.types.d.ts +136 -0
  122. package/dist/cli/cmd/orient/render/render-detail.d.ts +10 -0
  123. package/dist/cli/cmd/orient/render/render-file-list.d.ts +15 -0
  124. package/dist/cli/cmd/orient/render/render-graph.d.ts +13 -0
  125. package/dist/cli/cmd/orient/render/render-search.d.ts +8 -0
  126. package/dist/cli/cmd/orient/render/render-specs.d.ts +13 -0
  127. package/dist/cli/cmd/orient/render/render-tree.d.ts +13 -0
  128. package/dist/cli/cmd/remote-console/help.d.ts +4 -0
  129. package/dist/cli/cmd/resolve-conflicts/help.d.ts +4 -0
  130. package/dist/cli/cmd/review/help.d.ts +4 -0
  131. package/dist/cli/cmd/review-issues/help.d.ts +4 -0
  132. package/dist/cli/cmd/review-verify/help.d.ts +4 -0
  133. package/dist/cli/cmd/sync/help.d.ts +4 -0
  134. package/dist/cli/cmd/sync/sync-core.d.ts +3 -2
  135. package/dist/cli/cmd/sync/sync-formatter.d.ts +8 -9
  136. package/dist/cli/cmd/sync/sync.cmd.d.ts +2 -21
  137. package/dist/cli/cmd/sync-skills/index.d.ts +1 -0
  138. package/dist/cli/cmd/sync-skills/sync-skills-core.d.ts +50 -0
  139. package/dist/cli/cmd/sync-skills/sync-skills-formatter.d.ts +13 -0
  140. package/dist/cli/cmd/sync-skills/sync-skills.cmd.d.ts +14 -0
  141. package/dist/cli/cmd/sync-skills/sync-skills.types.d.ts +56 -0
  142. package/dist/cli/cmd/vcs-reply/help.d.ts +4 -0
  143. package/dist/gennady.js +73 -18
  144. package/dist/index.js +5 -5
  145. package/dist/services/dbc/linter/implementations/ts/dbc-ts-ast-adapter.d.ts +3 -2
  146. package/dist/shared/common/sync/path-normalizer.d.ts +22 -0
  147. package/dist/shared/common/sync/sync-core.shared.d.ts +14 -0
  148. package/dist/shared/common/sync/sync-deps.type.d.ts +66 -0
  149. package/dist/shared/common/sync/sync-formatter.shared.d.ts +19 -0
  150. package/package.json +6 -5
  151. package/dist/chunks/index-DJpVmyp2.js +0 -176
  152. package/dist/chunks/index-KxSZKmZn.js +0 -540
  153. package/dist/chunks/services-CaLOhuLV.js +0 -2889
  154. package/dist/chunks/shared-Bjy30TeM.js +0 -665
@@ -71,14 +71,11 @@
71
71
 
72
72
  <Axiom id="AX_PERMITTED_BASH_COMMANDS">
73
73
  Phase agent may ONLY run these bash commands:
74
- - **Must run:** verification commands from ticket 5 that match this phase's Rules (per `AX_VERIFICATION_BEFORE_HANDOFF`).
74
+ - **Must run:** `<sdd-path> verify <target-files>` — MANDATORY. Auto-discovers and runs typecheck, gennady DBC lint, linter, tests, and format check for the project. Runs before §5 commands. **RUN-ALL**: every gate executes regardless of previous failures; failures accumulate. **SUPPRESS-ON-SUCCESS**: passing gates produce zero output; only failed gates dump their command, exit code, and captured output. On all-pass: single summary line. Failing gate → fix and re-run before EMIT_HANDOFF. Log each passing gate on a separate `ver` line.
75
+ - **Must run:** verification commands from ticket §5 that match this phase's Rules (per `AX_VERIFICATION_BEFORE_HANDOFF`).
75
76
  - **May run:** `ls <dir>` for targeted recon (NOT `-la` or recursive); `tsc --noEmit` after code changes; `node --test <specific test file>` for test-kind phases; `date -u +%Y-%m-%dT%H:%M:%SZ` for timestamps.
76
- - **May run for config-kind only:** `npm view <pkg> version`, `cat node_modules/<pkg>/package.json`, `cat node_modules/<pkg>/CHANGELOG.md`.
77
- - **May run SDD helper tooling SUPPLEMENTALLY**, if provided by the dispatching skill. The orchestrator passes an absolute path (e.g. `~/.claude/skills/sdd-execute/scripts/sdd`) in the dispatch prompt. Available subcommands:
78
- - `<sdd-path> extract <file> <NAME>` — extract anchored section from ticket/spec
79
- - `<sdd-path> lint <file>...` — gennady DBC AST contract lint (parses output reliably)
80
- - `<sdd-path> verify <file>...` — narrower gate: typecheck + DBC lint + forbidden-construct grep
81
- - **These tools NEVER replace ticket §5 verification commands** (see `AX_VERIFICATION_BEFORE_HANDOFF` — Canonical Gate Rule). They are diagnostic supplements: useful for catching DBC violations (`@param`/`@returns`, JSDoc tag order, anchor pairing) that `npm run check` does not catch, but the ticket §5 command MUST still execute verbatim and its actual output MUST be the value logged in `ver`.
77
+ - **May run:** `<sdd-path> extract <file> <NAME>` — extract anchored section from ticket/spec.
78
+ - **May run:** `<sdd-path> lint <file>...` — gennady DBC AST contract lint for narrow diagnostic (already covered by `sdd verify`, use only for quick iterations).
82
79
 
83
80
  **Forbidden:** `git` ANY subcommand (status, branch, log, diff, add, commit); `npm run lint` alone (overkill — use `sdd verify` or `tsc --noEmit` for narrower checks); `npm run format`; `prettier` directly; any recursive or project-wide file scan; any command that reads unrelated files for «context».
84
81
 
@@ -243,9 +240,14 @@
243
240
  </Step>
244
241
 
245
242
  <Step id="STEP_5_VERIFY">
246
- <Goal>Run verification commands AS LISTED IN TICKET §5. Log only the final result, not each retry.</Goal>
243
+ <Goal>Run MANDATORY sdd verify on target files, then ticket §5 commands. Log only final results.</Goal>
247
244
  <Action>
248
- 1. Identify ticket §5 Verification rows whose `Required by` rule-ids overlap with this phase's Rules.
245
+ 1. **MANDATORY — sdd verify gate:** Run `<sdd-path> verify <target-files>`. This auto-discovers and executes typecheck, gennady DBC lint, linter, tests, and format check from package.json scripts. **RUN-ALL**: every gate executes regardless of previous failures; failures accumulate. **SUPPRESS-ON-SUCCESS**: passing gates produce zero output; only failed gates dump their command, exit code, and captured output. On all-pass: single summary line. If any gate fails → fix ALL failures and re-run the full `sdd verify` again. Do NOT proceed to EMIT_HANDOFF until all gates pass.
246
+
247
+ **⚠️ ERROR OWNERSHIP (MANDATORY):** Every error surfaced by `<sdd-path> verify` is an error of the current session. The agent is the sole actor in this repository during the session. No error may be dismissed as «not my file», «pre-existing», «someone else's problem», or «out of scope». If `<sdd-path> verify` reports a failure in ANY file — edited, created, never touched, outside Target Files, config, spec, task, generated — the agent owns it and MUST fix it. There is no «their error». There are only errors the agent has not yet fixed. Verification is holistic; so is ownership. Fix everything.
248
+
249
+ Each passing gate gets its own `ver` line.
250
+ 2. Then run ticket §5 commands per existing logic below.
249
251
  2. **MANDATORY (PROTOCOL):** Execute EACH such §5 command **verbatim — the exact string from the ticket**. No substitutions, no "equivalents", no narrower variants. If §5 says `npm run check`, run `npm run check` (not `npx vitest`, not `tsc --noEmit`, not `<sdd-path> verify`). This is the Canonical Gate (per `AX_VERIFICATION_BEFORE_HANDOFF`); fabrication is a BLOCKER-class finding at audit.
250
252
  3. **Supplemental (OPTIONAL):** You MAY additionally run `<sdd-path> verify <Target Files>` or `tsc --noEmit` for narrower diagnostics — useful for fast feedback or DBC lint. These do NOT replace §5; they add to it. Each supplemental run is logged on its own `ver` line with its real command.
251
253
  4. On the FINAL successful run of each §5 command, log: `<ts> ver <exact-§5-command> → pass exit=<N>`. The `<cmd>` MUST be the literal string actually invoked in your bash call — not a paraphrase, not a synonym. Intermediate failed runs are NOT logged as separate `ver` lines — capture fix-cycles via `tried` lines.
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: alt-opinion
3
+ description: Multi-model alternative opinion via CLI (gennady alt-opinion). Runs 2+ models in parallel against a spec or session context, synthesizes via a third model. Use when user says "оцени", "мнение", "разбор", "audit", "проверь спецификацию", "alt-opinion", "alternative opinion". DEFAULT MODE (no args): auto-audits current conversation context.
4
+ license: MIT
5
+ compatibility: opencode
6
+ ---
7
+
8
+ # alt-opinion — Multi-Model Alternative Opinion
9
+
10
+ Делегирует CLI `gennady alt-opinion`. Не изобретает пайплайн — использует готовый.
11
+
12
+ ## Два режима
13
+
14
+ ### Режим 1: С аргументами
15
+
16
+ Пользователь: «оцени спеку /path/spec.md с директивой /path/directive.md»
17
+
18
+ Извлеки SPEC (первый путь). Если есть второй путь — DIRECTIVE. Если директивы нет — используй `~/.config/opencode/alt-opinion/directive-template.md`.
19
+
20
+ ### Режим 2: Без аргументов (default)
21
+
22
+ Пользователь: «alt-opinion», «оцени», «мнение», «разбор»
23
+
24
+ Сформируй артефакт: резюме сессии + ключевые артефакты из контекста. Сохрани в `~/.config/opencode/alt-opinion/session-artifact.md`.
25
+
26
+ ## Процесс (строго по шагам)
27
+
28
+ ### Шаг 1: Подготовь артефакт
29
+
30
+ - **Если передан путь к файлу:** используй его напрямую.
31
+ - **Если передан текст:** запиши в `~/.config/opencode/alt-opinion/`.
32
+ - **Если аргументов нет:** запиши резюме сессии в `~/.config/opencode/alt-opinion/session-artifact.md`.
33
+
34
+ ### Шаг 2: Запусти CLI
35
+
36
+ ОДИН вызов bash. Модели по умолчанию: `kimi-k2.6` (эксперт 1), `glm-5.1` (эксперт 2), `deepseek-v4-pro` (синтез).
37
+
38
+ Синтаксис:
39
+
40
+ ```bash
41
+ npx tsx ~/Developer/gennady/cli alt-opinion \
42
+ --model="llmproxy/kimi-k2.6" \
43
+ --model="llmproxy/glm-5.1" \
44
+ --synthModel="llmproxy/deepseek-v4-pro" \
45
+ --file="<path-to-artifact>"
46
+ ```
47
+
48
+ Или через stdin:
49
+
50
+ ```bash
51
+ cat <path-to-artifact> | npx tsx ~/Developer/gennady/cli alt-opinion \
52
+ --model="llmproxy/kimi-k2.6" \
53
+ --model="llmproxy/glm-5.1" \
54
+ --synthModel="llmproxy/deepseek-v4-pro"
55
+ ```
56
+
57
+ ### Шаг 3: Покажи результат
58
+
59
+ CLI возвращает готовый синтез-блок с телеметрией. Покажи пользователю как есть.
60
+
61
+ ## Кастомные промпты
62
+
63
+ - `--modelPrompt=<path>` — общий промпт для всех моделей
64
+ - `--synthPrompt=<path>` — промпт для синтеза
65
+ - `--model="llmproxy/model::./custom.prompt.md"` — per-model промпт
66
+
67
+ ## Env vars (обязательно)
68
+
69
+ ```
70
+ LLM_PROXY_API_KEY=<key>
71
+ LLM_PROXY_BASE_URL=https://llm-proxy.example.com/v1
72
+ ```
73
+
74
+ ## Важные правила
75
+
76
+ - **Из корневой сессии — только ОДИН bash** (CLI сам делает параллельный опрос, синтез, форматирование).
77
+ - Не создавай промежуточные оркестраторы/сабагенты — CLI уже содержит всю логику.
78
+ - Абсолютные пути для всех файлов.
79
+ - Не добавляй комментариев к выводу — CLI форматирует результат сам.
@@ -0,0 +1,11 @@
1
+ Ты — независимый эксперт-инженер. К тебе обращается AI-агент, который работает над задачей и обычно задал бы этот вопрос своему оператору-человеку. Вместо человека отвечаешь ты.
2
+
3
+ Дай ответ:
4
+
5
+ - Конкретный, практический, actionable.
6
+ - Без воды, без подтверждения очевидного.
7
+ - Если в артефакте недостаточно контекста для уверенного ответа — назови чего не хватает (1–2 пункта), не выдумывай.
8
+ - Если видишь риски или ошибки в подходе агента — назови их явно, не сглаживай.
9
+ - Финальная строка — твоя рекомендация в одно предложение.
10
+
11
+ Формат: 3–5 пунктов, последний — рекомендация. Без преамбулы.
@@ -0,0 +1,8 @@
1
+ Ниже — два независимых ответа двух экспертов на один вопрос AI-агента. Синтезируй ОДНО консолидированное мнение:
2
+
3
+ - **Точки согласия** — что оба эксперта подтвердили (если есть).
4
+ - **Существенные расхождения** — если эксперты не согласны, выбери более обоснованное мнение и объясни почему в одном предложении.
5
+ - **Слепые пятна** — то, что упустили оба (если видишь).
6
+ - **Финальная рекомендация** — одно предложение для агента: что делать дальше.
7
+
8
+ Без повторов отдельных мнений. Без воды. Компактный итог.
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: sdd-audit
3
+ description: Fresh-eyes audit of ONE completed SDD task (or epic across many). Read ticket, read spec, git diff, mechanical lint, verify rules. Detects drift across closed-world inventory, runtime backing, rules cascade, BDD coverage, task-id integrity, execution log completeness, stale-after-pivot. Findings routed to artifacts (spec edits, ticket reopens, Decision Log) — no audit files created. Use when operator says "audit TSK-NN" or after execute DONE.
4
+ compatibility: opencode
5
+ ---
6
+
7
+ 1. **Extract intent.** Operator wants audit of {TSK-NN | full tree | current changes}. If ambiguous — ask.
8
+
9
+ 2. **Load & activate directive.** Read in full: `~/Developer/gennady/ai/directives/sdd/audit.directive.xml`
10
+ Announce: `🔒 DIRECTIVE ACTIVATED: SddAudit`
11
+ You ARE this directive now.
12
+
13
+ 3. **Apply directive to intent.** Mode auto-detected per `AX_AUDIT_MODES`. First run deterministic lint: `npx tsx ~/Developer/gennady/cli/gennady.ts lint` on changed .ts files (`git diff --name-only`). Feed output into the directive's finding pipeline. Then follow Execution_Plan end-to-end. Do not deviate.
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: sdd-check
3
+ description: Verify entire SDD workflow integrity — specs linked, trackers synced, execution logs complete, DAGs consistent, file headers correct, tests passing. Read-only, no modifications.
4
+ license: MIT
5
+ compatibility: opencode
6
+ ---
7
+
8
+ <SddCheck role="verifier-only">
9
+ You are a VERIFIER. You CHECK the entire SDD artifact tree. You do NOT modify anything — no edits, no writes, no code generation. You report problems with exact locations.
10
+
11
+ **Environment: macOS.** No `grep -P` → use `rg`. No `sed -i` (GNU) → use `sed -i ''`. `find` POSIX-compatible only.
12
+
13
+ <Step0_SelfReflection>
14
+ **BEFORE reading any file, ask yourself:**
15
+
16
+ 1. **What did I just do in this session?** List every action: code written, specs changed, tasks executed, audits dispatched.
17
+ 2. **Did I follow SDD flow for each change?**
18
+ - New feature → discovery → module-decomp → scaffold → execute → audit?
19
+ - Bug fix → task ticket → execute → audit?
20
+ - Refinement → refine spec → scaffold → execute → audit?
21
+ 3. **Did I skip any step?** Audit missing? Execution Log empty? Tracker not synced? Spec not updated with insights?
22
+ 4. **Did I work WITHOUT a task ticket?** If code was written or specs changed outside a formal task — that's a protocol violation. Flag it.
23
+ 5. **Did I run `sdd-execute` or `sdd-execute-batch` properly?** Were phases dispatched? Was audit run after each round close?
24
+
25
+ Output: a compact self-assessment table before proceeding to mechanical checks.
26
+
27
+ ```
28
+ 🔍 SDD Self-Reflection
29
+
30
+ | Action | Followed Flow? | Task? | Audit? | Log? | Issue |
31
+ |---|---|---|---|---|---|
32
+ | Fix _reorderTags */ boundary | ❌ | TSK-20 (created after) | ❌ | ❌ initially | Code written before task created |
33
+ | Type alias contract validation | ❌ | TSK-19 (created after) | ❌ | ❌ | Same — code then task |
34
+ | ... | | | | | |
35
+
36
+ 📊 Protocol violations: <N>
37
+ ⏭️ Proceeding to mechanical checks...
38
+ ```
39
+
40
+ </Step0_SelfReflection>
41
+
42
+ <ExecutionStrategy>
43
+ **BATCH ALL READS.** Use the SDD scan tool for one-shot snapshot, then targeted reads.
44
+
45
+ 1. **One bash call** to get comprehensive snapshot:
46
+ `~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd scan <project-root>`
47
+ This emits [HEADER] [TASKS] [TRACKERS] [SPECS] [WARNINGS] [SUMMARY] in a single call — replaces multiple find/grep commands.
48
+
49
+ 2. **Concurrent reads** of all key files: Portal, scope specs (from SPECS list), trackers with issues (from WARNINGS). Do NOT read module specs initially — only if Check 2 needs them.
50
+
51
+ 3. **Do NOT run npm test.** Check 7 only verifies test FILES exist, not that they pass. Running tests is the developer's responsibility.
52
+
53
+ 4. **Do NOT scan code files.** Check 6 samples at most 3 files.
54
+
55
+ Total: ≤5 tool calls for all 8 checks. Target: <15 seconds.
56
+ </ExecutionStrategy>
57
+
58
+ <Checks>
59
+ Run these checks in order using BATCHED reads. Each check produces PASS / FAIL with location.
60
+
61
+ ### Check 1 — Portal Integrity (1 read)
62
+
63
+ Read `specs/README.md`. Verify: scopes table entries match `specs/<scope>/<scope>.spec.md` existence. Graph nodes match table. Status emoji matches file presence.
64
+
65
+ ### Check 2 — Spec Linking (read scope specs only)
66
+
67
+ For each scope spec 9/7: module paths resolve to files. Module spec 1 links to parent. Cross-scope references resolve.
68
+
69
+ ### Check 3 — Tracker Sync (1 grep)
70
+
71
+ `grep -rn "\[x\] DONE\|\[ \] TODO\|\[~\] IN_PROGRESS\|\[!\] BLOCKED" tasks/README.md tasks/*/README.md`. Compare counts.
72
+
73
+ ### Check 4 — DAG Consistency (parse from tracker)
74
+
75
+ Parse `Dependencies:` from each task ticket planning surface. Topological sort. No cycles.
76
+
77
+ ### Check 5 — Execution Log Completeness
78
+
79
+ From scan [TASKS] output: check `placeholders` column for any task with >0. Flag tasks where placeholders > 0 even if status DONE. Also inspect `warnings` column for `no-execlog-section` or `anchors-mismatch`.
80
+
81
+ ### Check 6 — File Headers (sample 3 files)
82
+
83
+ Pick 3 recently modified .ts files from `git diff --name-only HEAD~3`. Check for `@file:`, `@consumers:`, `@tasks:`.
84
+
85
+ ### Check 7 — Test Coverage (1 find)
86
+
87
+ `find tasks -name '*.task-*.md' -type f` — for each task with kind=test phase, check Target Test Files exist.
88
+
89
+ ### Check 8 — Decision Log (read scope specs only)
90
+
91
+ Parse D-NNN from all scope specs. Check uniqueness, supersedes links.</Checks>
92
+
93
+ <Output>
94
+ First: Self-Reflection. Then: Mechanical Checks. Use compact single-line-per-check format.
95
+
96
+ ```
97
+ 🔍 SDD CHECK · <N> scopes · <M> tasks
98
+
99
+ ▸ SELF-REFLECTION
100
+ ✅ discovery → execute cli (TSK-12..18)
101
+ ✅ refine → execute dbc content option (TSK-11)
102
+ ❌ code before task TSK-19 type alias contracts
103
+ ❌ code before task TSK-20 _reorderTags fix
104
+ ❌ no audit TSK-22 vcs-client
105
+ ⚠️ audit paperwork TSK-11 (tracker/log gaps)
106
+
107
+ ▸ MECHANICAL
108
+ ✅ Portal 4 scopes, graph ↔ table
109
+ ✅ Spec linking all modules → parent, cross-scope refs resolve
110
+ ✅ Tracker sync dbc 13/13 cli 7/7 vcs 1/1
111
+ ✅ DAG no cycles, all deps satisfied
112
+ ✅ Execution Log no <YYYY-MM-DD> placeholders in tasks
113
+ ✅ File headers 21 files scanned, all have @file: + @consumers:
114
+ — Test coverage not checked
115
+ — Decision Log not checked
116
+
117
+ ▸ SUMMARY
118
+ Pass: 6/6 checks
119
+ Protocol: 3 violations, 1 audit missing
120
+
121
+ ▸ VERDICT
122
+ ❌ NOT READY — fix protocol violations before next execute
123
+ ```
124
+
125
+ Rules for VERDICT line:
126
+
127
+ - All 8 checks PASS AND 0 protocol violations → `✅ CLEAN — artifact tree is consistent, next pickable: TSK-NN`
128
+ - All 8 checks PASS AND 0 violations but some tasks deferred/TODO → `✅ CLEAN — <N> tasks remaining in queue`
129
+ - Any FAIL check OR protocol violations → `❌ NOT READY — <N> issue(s) require attention`
130
+ - Checks skipped (marked `—`) → treat as PASS for verdict unless evidence of gap exists
131
+ </Output>
132
+
133
+ <HardForbidden>
134
+ - Writing, editing, or modifying ANY file. Read-only.
135
+ - Running `git add`, `git commit`, or any other mutating git command.
136
+ - Running `npm install` or any package-manager mutation.
137
+ - Generating code or spec content. Only report.
138
+ </HardForbidden>
139
+ </SddCheck>
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: sdd-continue
3
+ description: Continue evolving an existing scope spec — extend (add requirements/tools/contracts) or pivot (replace decisions). Auto-resolves the scope spec. Use when operator says "продолжить", "доработать", "extend", "pivot", "add to scope", "change architecture". Mode (refine vs pivot) auto-detected from intake verb.
4
+ compatibility: opencode
5
+ ---
6
+
7
+ 1. **Extract intent.** Operator wants to evolve existing scope spec — refine or pivot. Resolve scope: ask if not given, then `ls specs/<scope-name>/<scope-name>.spec.md` to verify it exists.
8
+
9
+ 2. **Load & activate directive.** Read in full: `~/Developer/gennady/ai/directives/sdd/discovery.directive.xml`
10
+ Announce: `🔒 DIRECTIVE ACTIVATED: SddDiscovery | continue`
11
+ You ARE this directive now.
12
+
13
+ 3. **Apply directive to intent.** Treat resolved scope spec as authoritative intake (per `AX_SPEC_IS_SOLE_SOURCE`). Mode MUST be `refine` or `pivot` — `greenfield` is forbidden in this skill. Follow Execution_Plan end-to-end.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: sdd-critic
3
+ description: Autonomous multi-round critique of SDD artifacts — scope specs or task tickets. Dispatches isolated critic subagent, evaluates feedback, edits artifact, re-dispatches until clean (max 5 rounds). Use when user says "покритикуй", "проверь спеку", "проверь таск", "sdd-critic", "проревьюй", "найди слепые пятна", "шлифуй".
4
+ license: MIT
5
+ compatibility: opencode
6
+ ---
7
+
8
+ 1. Extract intent. Resolve artifact path — spec or task. If ambiguous, ask.
9
+
10
+ 2. Load directive: `ai/directives/sdd/critic.directive.xml`. Announce: `🔒 SddCritic`. You ARE this directive.
11
+
12
+ 3. Apply. Follow Execution_Plan. Do not deviate.
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: sdd-discover
3
+ description: Start or evolve a scope spec — for any scope-type (infrastructure, contracts, library, product). Creates specs/<scope>/<scope>.spec.md. Use when designing a new scope or refining/pivoting an existing scope's vision, requirements, or architecture. Modes auto-detected: greenfield (no spec), refine (add to existing), pivot (replace decisions).
4
+ compatibility: opencode
5
+ ---
6
+
7
+ 1. **Extract intent.** Operator wants {greenfield | refine | pivot} for scope `<name>` (`<scope-type>` if greenfield). If `<name>` missing — ask.
8
+
9
+ 2. **Load & activate directive.** Read in full: `~/Developer/gennady/ai/directives/sdd/discovery.directive.xml`
10
+ Announce: `🔒 DIRECTIVE ACTIVATED: SddDiscovery`
11
+ You ARE this directive now.
12
+
13
+ 3. **Apply directive to intent.** Mode auto-detected per `AX_MODE_AUTO_DETECT_OR_HALT`. Follow Execution_Plan end-to-end. Do not deviate.
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: sdd-execute
3
+ description: Execute ONE task ticket end-to-end. Reads ticket header + Phases Overview + Execution Log to plan; dispatches one phase-subagent per pending phase (sequential), threading typed Handoff between them; closes Round and dispatches audit-subagent (fresh-eyes). On audit FAIL — re-runs ONLY failing-phases as `fix` kind, max 1 retry. Use when operator passes a Task-ID, ticket path, or "next" / "следующую" / "выбери" / "pick one".
4
+ license: MIT
5
+ compatibility: opencode
6
+ ---
7
+
8
+ <SddExecuteOrchestrator role="orchestrator-only">
9
+ You are an ORCHESTRATOR. You PLAN and DISPATCH; you do NOT execute phases yourself, do NOT operate under phase-execution-protocol or audit directive, do NOT write code.
10
+
11
+ **Environment: macOS.** All bash commands dispatched to subagents must be macOS-compatible. No `grep -P` → use `rg`. No GNU-only flags.
12
+
13
+ You DO read the ticket — but only its planning surface: section 1 Meta, section 2 Phases Overview, current Round of section 7 Execution Log. You do NOT read section 3 Phases bodies, section 4 BDD, section 5 Verification, section 6 Coverage — phase subagents read those.
14
+
15
+ Each subagent runs in a FRESH ISOLATED CONTEXT.
16
+
17
+ <ProgressReporting>
18
+ Black-box: subagents are opaque to the orchestrator. Emit one progress line per state transition.
19
+
20
+ Format: `[<bar>] <pct>% | TSK-NN | <stage>`
21
+
22
+ Stages:
23
+
24
+ - `0% ⏳ resolving + planning`
25
+ - `<pct>% 🔧 phase <P<N>> (<kind>) executing`
26
+ - `<pct>% ✅ phase <P<N>> done → next`
27
+ - `<pct>% ✅ all phases done → 🔍 audit`
28
+ - `100% ✅ audit PASS`
29
+
30
+ Retry path:
31
+
32
+ - `<pct>% ❌ audit FAIL → 🔄 re-run phases <list> as fix`
33
+ - `<pct>% ✅ phases re-run done → 🔍 audit R2`
34
+ - `100% ✅ audit R2 PASS — OR — ❌ FAIL after 2 attempts (manual intervention)`
35
+
36
+ Pause path (distinguish from failure — skill is awaiting operator, not broken):
37
+
38
+ - `<pct>% ✋ PAUSED awaiting operator decision` — unresolved BLOCKER in Execution Log per AX_BLOCKER_RESOLUTION_TRAIL, or phase returned BLOCKED. NOT a skill failure. Operator must mark resolution in Execution Log (append `✅ RESOLVED <ref>` line) or provide unblock decision; then re-run `/sdd-execute`.
39
+ </ProgressReporting>
40
+
41
+ <Protocol>
42
+ 1. **Resolve task:**
43
+ - Operator passed Task-ID or ticket path → use it.
44
+ - Operator said "next" / "следующую" / "выбери" / "pick one" / no pointer → read tasks/README.md, compute pickable (Status `[ ] TODO` AND every Dependency `[x] DONE`), single match → confirm; multiple → shortlist; zero → halt with state report.
45
+ - No `tasks/` directory → halt: "No tasks/ — wrong cwd or scaffolding not done".
46
+
47
+ 2. **Plan:** Read ONLY ticket sections 1, 2, and 7-current-Round.
48
+ - **Preflight: scan for unresolved blockers** (per `AX_BLOCKER_RESOLUTION_TRAIL`). Skill ships its own helper scripts at `~/Developer/gennady/ai/skills/sdd-execute/scripts/`. Run `~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd check-blockers <ticket-path>`.
49
+ - exit 0 (CLEAR) → continue to state detection.
50
+ - exit 2 (UNRESOLVED_BLOCKERS) → emit **✋ AWAITING OPERATOR DECISION** message with the script's output, then halt. This is a PAUSED state, NOT a skill failure — be clear in the message. Operator must either (a) mark resolution in Execution Log if blocker is no longer active, or (b) provide unblock decision.
51
+ - State detection from Phases Overview Status column:
52
+ - all `[ ]` → fresh task; plan = all phases in declared order respecting `Deps`.
53
+ - some `[x]`, some `[ ]` → resume; plan = remaining phases in declared order.
54
+ - all `[x]` AND no audit yet → plan = audit only.
55
+ - all `[x]` AND audit PASS in current Round → halt: "nothing to do".
56
+ - any `[!] BLOCKED` → emit **✋ AWAITING OPERATOR DECISION** (paused, not failed); operator must unblock.
57
+ - Open new Round in section 7 if this is a fresh attempt or resume after closure: append `### Round N — <YYYY-MM-DD>, <reason>`. Reason for Round 1 = `initial`. Subsequent rounds: `audit-driven fix`, `late-detected bug`, etc.
58
+
59
+ 3. **Phase dispatch loop** — sequential, one phase at a time:
60
+
61
+ For each phase in plan:
62
+
63
+ a. Dispatch PHASE subagent (`subagent_type: general-purpose`, **`model: "sonnet"`** — phase work requires capable code-generation model; haiku-class is insufficient for structured JSDoc/anchor discipline and was empirically observed to skip closing anchors and put @param on type declarations), fresh context, with prompt:
64
+
65
+ ````
66
+ Step 1 — Read the directive. Use Read tool directly on:
67
+ ai/directives/sdd/phase-execution-protocol.xml
68
+ On failure → halt, report exact path.
69
+
70
+ Step 2 — Activate. Announce: "🔒 DIRECTIVE ACTIVATED: SddPhaseExecution"
71
+ You ARE this directive.
72
+
73
+ Step 3 — Apply to intent.
74
+ Ticket: <absolute ticket path>
75
+ Phase: <P<N>>, kind: <kind>
76
+ Reason: <"initial" | "fix: address audit findings F-NNN, F-MMM" | "resume after blocker">
77
+ Inputs: <verbatim prior Handoff lines OR "none — first phase">
78
+ SDD tooling available at: ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd
79
+ (run "~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd help" for surface; use these
80
+ for any extraction/lint/verify operations the directive references).
81
+ MANDATORY before EMIT_HANDOFF: sdd verify <target-files> — auto-discovers and runs
82
+ typecheck, gennady lint, linter, tests, and format check for the project.
83
+
84
+ Follow the directive. This ONE phase only. Do not invoke audit.
85
+ ```
86
+
87
+ b. Branch on phase status:
88
+ - `BLOCKED` or `FAIL` → STOP loop. Audit not invoked (round not closed). Show operator the blocker. Done.
89
+ - `DONE` → record Handoff (artifacts, decisions, open). Continue to next phase.
90
+
91
+ c. Thread next phase's Inputs from this phase's Handoff (verbatim).
92
+
93
+ ````
94
+
95
+ 4. **Close Round** — append to ticket section 7:
96
+ ```
97
+ #### Round close
98
+ - [x] `<ts>` sync <scope>+root
99
+ - [x] `<ts>` DONE
100
+ ```
101
+ Set ticket Meta Status → `[x] DONE`.
102
+
103
+ 4a. **Sync Trackers** (MANDATORY, cannot skip):
104
+
105
+ - Read `tasks/<scope>/README.md`. Find the Tracker row for this Task-ID. Set its Status → `[x] DONE`. Write back.
106
+ - Read `tasks/README.md` Tracker Index. Update the scope's aggregate counts (done/total). Write back.
107
+ - Verify: re-read both files, confirm the changes took effect. If not → retry once.
108
+
109
+ 5. **Dispatch AUDIT** (MANDATORY, always runs). Dispatch ONE subagent (`subagent_type: general-purpose`, **`model: "haiku"`** — audit is mechanical verification + fact-checking against artifacts; sonnet capability is overkill, haiku is faster and cheaper for this read-heavy task). Include in prompt the SDD tooling location: `~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd` (audit may use `lint`, `verify`, `check-blockers` subcommands). With this prompt:
110
+
111
+ ```
112
+ Step 1 — Read the directive. Use Read tool directly on:
113
+ ai/directives/sdd/audit.directive.xml
114
+ On failure → halt, report exact path.
115
+
116
+ Step 2 — Activate. Announce: "🔒 DIRECTIVE ACTIVATED: SddAudit"
117
+ You ARE this directive. Operate under its Mission, Belief_State, Halt_Conditions, Execution_Plan, Output_Contracts.
118
+
119
+ Step 3 — Apply to intent.
120
+ Task: <TSK-NN>
121
+ Ticket: <absolute ticket path>
122
+ Round: <N>
123
+ Artifacts: <union of all phase Handoff artifacts>
124
+ Mode: per-task
125
+
126
+ Follow the directive's Execution_Plan. Report findings per AUDIT_SESSION_SUMMARY_FORMAT.
127
+ ```
128
+
129
+ Wait for return. If dispatch fails → retry once. If fails again → mark task FAILED.
130
+
131
+ 6. **Branch on audit status:**
132
+ - `PASS` or `PASS_WITH_ACKNOWLEDGED_RISKS` → ticket verified; jump to step 9 (summary).
133
+ - `FAIL` AND `audit_attempt = 1` → step 7 (resolve findings).
134
+ - `FAIL` AND `audit_attempt = 2` → STOP; jump to step 9 (summary with FAIL after 2 attempts).
135
+
136
+ 7. **Resolve audit findings (max one retry, total 2 audit attempts):**
137
+
138
+ Two resolution paths depending on `phases_to_fix`:
139
+
140
+ **Path A — phases_to_fix is non-empty** (findings require code changes):
141
+ Show: "Audit FAIL: <top findings>. Auto re-running phases <phases_to_fix> as fix."
142
+ Open new Round: `### Round N — <YYYY-MM-DD>, audit-driven fix: F-NNN, F-MMM`.
143
+ For each phase in `phases_to_fix` (sequential, declared-order subset):
144
+ Dispatch PHASE subagent (fresh context) with same shape as step 3a, but: - Reason: `fix: address audit findings F-NNN, F-MMM` - Inputs include audit findings relevant to this phase's Target Files.
145
+ Wait. BLOCKED/FAIL → STOP; jump to step 9. DONE → continue.
146
+ After all fix phases DONE → close Round (step 4) → dispatch AUDIT R2 → return to step 6.
147
+
148
+ **Path B — phases_to_fix is EMPTY** (findings are ticket-update / spec-edit only):
149
+ Do NOT open a new Round. Apply fixes DIRECTLY:
150
+ - For each finding with `route=ticket-update`: edit the ticket file yourself (add missing intro/cov lines, fix tracker sync, update Meta fields).
151
+ - For each finding with `route=spec-edit`: edit the spec file yourself (update entity surface, DbC contract, add missing parameter).
152
+ - For each finding with `route=decision-log`: add Decision Log entry to scope spec.
153
+ After all fixes applied → dispatch AUDIT subagent again (round 2, fresh context). Return to step 6.
154
+ Rationale: these are paper-fixes that don't need a phase subagent. Dispatching a phase agent for "add intro line to ticket" wastes 15-30s and an isolated context. The orchestrator owns the tracker and can edit tickets/specs directly per `AX_PORTAL_PRIMARY_OWNER` and `AX_TICKET_WRITE_SCOPE` exceptions for administrative fixes.
155
+
156
+ 8. **Aggregate TELEMETRY and present to operator:**
157
+ Collect TELEMETRY blocks from all phase and audit subagents. Compute:
158
+ - `wall_total` = sum of all phase `wall_ms` + audit time
159
+ - `tools_total` = sum of all `tools`
160
+ - Aggregate problems from all phases
161
+ - List any phase where `ok=false` with the `why` explanation
162
+
163
+ 9. **Final summary to operator:**
164
+
165
+ ````
166
+ 📊 Task <TSK-NN> — Execute + Audit Summary
167
+
168
+ 🔧 Round 1 phases:
169
+ P1 (impl) ✅ DONE | 4.2s | r=5 b=2 w=1 | ok=true
170
+ P2 (test) ✅ DONE | 8.1s | r=7 b=3 w=2 | problems=P1:test-failed-on-first-run
171
+ 🔍 Round 1 audit: <✅ PASS | ❌ FAIL — 🔴 N · 🟠 M>
172
+ audit: ✅ PASS | 3.5s | r=8 b=4 w=0
173
+
174
+ 🔄 Round 2 (if any):
175
+ P2 (fix) ✅ DONE | 2.1s | r=3 b=1 w=1 | ok=true
176
+ 🔍 Round 2 audit: ✅ PASS
177
+
178
+ 📊 Final: <✅ PASS | ⚠️ PASS_RISK | ❌ FAIL>
179
+
180
+ ⏱️ Total wall time: 17.9s across 4 subagents
181
+
182
+ 📍 Files touched:
183
+ ✏️ src/foo.ts (2 edits)
184
+ ✏️ src/foo.test.ts (3 edits)
185
+
186
+ ⚠️ Problems encountered:
187
+ P1: test failed on first run — missing null guard, fixed in same phase
188
+ ```
189
+
190
+ </Protocol>
191
+ ````
192
+
193
+ <HardForbidden>
194
+ - Reading phase-execution-protocol.xml or audit.directive.xml yourself. (Subagents do.)
195
+ - Reading ticket sections 3 (Phases bodies), 4 (BDD), 5 (Verification), 6 (Coverage). Phase subagents do.
196
+ - Reading specs, rule files, or code. (Subagents do.)
197
+ - Writing code, audit reports, or phase blocks in Execution Log. (Subagents do.)
198
+ - Skipping audit after all phases DONE. Audit dispatch is mandatory; this is the safety net.
199
+ - Sharing context between phase subagents and audit subagent. Each gets a fresh prompt; orchestrator threads only typed Handoff payloads.
200
+ - Audit retry beyond 2 total attempts. Hard cap.
201
+ - Re-running phases not flagged in `phases_to_fix`. The map finding-location → phase is the contract; do not "just re-run everything".
202
+ - Auto-reopening on phase BLOCKED/FAIL. Only on audit FAIL after all phases DONE the retry kicks in.
203
+ - Parallel dispatch of phases of the SAME task. Phases are sequential by declared `Deps`. Cross-task parallelism is the job of `sdd-execute-batch`.
204
+ </HardForbidden>
205
+ </SddExecuteOrchestrator>
@@ -0,0 +1,84 @@
1
+ # sdd-execute / scripts
2
+
3
+ Helper scripts bundled with the `sdd-execute` skill. They live alongside the skill, not in any project — invoke via absolute path `~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd`.
4
+
5
+ All scripts honor the contract: **never produce silent empty output**. On miss, they emit actionable diagnostic instructions and a non-zero exit code. Phase agents and audit agents can therefore rely on either content-on-stdout (exit 0) or instruction-on-stdout (exit ≠ 0) to drive their next decision.
6
+
7
+ ## Entry point — `sdd` dispatcher
8
+
9
+ ```bash
10
+ ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd help # surface
11
+ ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd extract <file> <SECTION_NAME> # extract anchored section
12
+ ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd lint <file>... # gennady DBC AST contract lint
13
+ ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd verify <file>... # comprehensive gate (typecheck + lint + grep)
14
+ ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd check-blockers <ticket-file> # scan Execution Log per AX_BLOCKER_RESOLUTION_TRAIL
15
+ ~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd scan [project-root] # one-shot rich snapshot for triage skills
16
+ ```
17
+
18
+ Single permission rule covers all subcommands:
19
+
20
+ ```json
21
+ "Bash(~/Developer/gennady/ai/skills/sdd-execute/scripts/sdd *)"
22
+ ```
23
+
24
+ Or broader:
25
+
26
+ ```json
27
+ "Bash(~/Developer/gennady/ai/skills/sdd-execute/scripts/*)"
28
+ ```
29
+
30
+ ## Files
31
+
32
+ | File | Purpose |
33
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | `sdd` | Command dispatcher (single entry point) |
35
+ | `extract-section.sh` | Extract `<!--SECTION:NAME-->...<!--/SECTION:NAME-->` block from markdown |
36
+ | `lint-artifacts.sh` | Run gennady DBC AST contract lint; parse output reliably |
37
+ | `verify.sh` | Three-gate verification: typecheck + gennady DBC lint + forbidden-construct grep |
38
+ | `check-blockers.sh` | Detect unresolved BLOCKER entries in ticket Execution Log per `AX_BLOCKER_RESOLUTION_TRAIL` |
39
+ | `scan.sh` | Emit comprehensive project snapshot ([HEADER]/[TASKS]/[TRACKERS]/[SPECS]/[WARNINGS]/[SUMMARY]). Designed so triage skills make ONE call instead of many ad-hoc find/grep. Surfaces suspicious states automatically (DONE+placeholders, DONE+active-blocker, anchor mismatch, unparseable Status, broken spec links). |
40
+
41
+ ## Anchor convention (used by `extract`)
42
+
43
+ Markdown sections delimited by HTML-comment anchors:
44
+
45
+ ```markdown
46
+ <!--SECTION:META-->
47
+
48
+ ## 1. Meta
49
+
50
+ ...
51
+
52
+ <!--/SECTION:META-->
53
+ ```
54
+
55
+ Grammar:
56
+
57
+ - Open: `<!--SECTION:<NAME>-->`
58
+ - Close: `<!--/SECTION:<NAME>-->`
59
+ - `<NAME>` matches `^[A-Z][A-Z0-9_]*$`
60
+
61
+ Canonical names: `META`, `PHASES_OVERVIEW`, `PHASE_P<N>`, `BDD`, `VERIFICATION`, `TEST_COVERAGE`, `EXECUTION_LOG`.
62
+
63
+ ## Blocker resolution convention (used by `check-blockers`)
64
+
65
+ A BLOCKER entry (line containing `🛑` and `BLOCKED`) is considered RESOLVED if a later Round entry contains both `✅` and `RESOLVED`. The script verifies the latest marker is `✅` and counts match, otherwise reports unresolved.
66
+
67
+ To resolve a blocker, append to ticket Execution Log:
68
+
69
+ ```markdown
70
+ ### Round N — <date>, <reason>
71
+
72
+ - ✅ `<timestamp>` RESOLVED Round M BLOCKER (<short reference>): <reason for resolution>
73
+ ```
74
+
75
+ ## Project-agnostic by design
76
+
77
+ These scripts know nothing about any specific project. They expect:
78
+
79
+ - A markdown file with anchored sections (for `extract`).
80
+ - A TypeScript file to lint (for `lint`).
81
+ - A ticket file with `## 7. Execution Log` section (for `check-blockers`).
82
+ - A working directory with `npm` and `tsc` available (for `verify`).
83
+
84
+ If the project doesn't satisfy these expectations, scripts emit actionable diagnostics; they never silently fail.