aiox-core 5.0.5 → 5.0.8

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 (2374) hide show
  1. package/.aiox-core/cli/commands/pro/buyer.js +379 -0
  2. package/.aiox-core/cli/commands/pro/index.js +191 -52
  3. package/.aiox-core/cli/commands/validate/index.js +2 -0
  4. package/.aiox-core/core/code-intel/helpers/dev-helper.js +1 -1
  5. package/.aiox-core/core/code-intel/helpers/devops-helper.js +0 -1
  6. package/.aiox-core/core/code-intel/helpers/planning-helper.js +1 -1
  7. package/.aiox-core/core/code-intel/helpers/qa-helper.js +2 -2
  8. package/.aiox-core/core/config/schemas/framework-config.schema.json +1 -0
  9. package/.aiox-core/core/config/template-overrides.js +1 -1
  10. package/.aiox-core/core/doctor/checks/ide-sync.js +81 -25
  11. package/.aiox-core/core/doctor/checks/rules-files.js +0 -1
  12. package/.aiox-core/core/doctor/checks/skills-count.js +83 -15
  13. package/.aiox-core/core/graph-dashboard/cli.js +1 -2
  14. package/.aiox-core/core/graph-dashboard/data-sources/code-intel-source.js +1 -1
  15. package/.aiox-core/core/ids/layer-classifier.js +1 -1
  16. package/.aiox-core/core/pro/pro-updater.js +578 -0
  17. package/.aiox-core/core/synapse/context/context-tracker.js +107 -9
  18. package/.aiox-core/core/synapse/layers/layer-processor.js +1 -1
  19. package/.aiox-core/core-config.yaml +15 -1
  20. package/.aiox-core/data/capability-detection.js +15 -15
  21. package/.aiox-core/data/entity-registry.yaml +18 -2
  22. package/.aiox-core/data/registry-update-log.jsonl +5 -0
  23. package/.aiox-core/data/tok3-token-comparison.js +0 -4
  24. package/.aiox-core/data/tool-search-validation.js +1 -1
  25. package/.aiox-core/development/agents/aiox-master.md +44 -6
  26. package/.aiox-core/development/agents/data-engineer.md +4 -4
  27. package/.aiox-core/development/agents/devops.md +52 -2
  28. package/.aiox-core/development/agents/po.md +1 -1
  29. package/.aiox-core/development/agents/qa.md +5 -11
  30. package/.aiox-core/development/agents/sm.md +3 -3
  31. package/.aiox-core/development/agents/ux-design-expert.md +1 -1
  32. package/.aiox-core/development/scripts/unified-activation-pipeline.js +29 -3
  33. package/.aiox-core/development/tasks/dev-develop-story.md +46 -7
  34. package/.aiox-core/development/tasks/devops-pro-access-grant.md +93 -0
  35. package/.aiox-core/development/tasks/devops-pro-activate.md +42 -0
  36. package/.aiox-core/development/tasks/devops-pro-check-access.md +34 -0
  37. package/.aiox-core/development/tasks/devops-pro-request-reset.md +34 -0
  38. package/.aiox-core/development/tasks/devops-pro-resend-verification.md +32 -0
  39. package/.aiox-core/development/tasks/devops-pro-reset-password.md +36 -0
  40. package/.aiox-core/development/tasks/devops-pro-validate-login.md +36 -0
  41. package/.aiox-core/development/tasks/devops-pro-verify-status.md +33 -0
  42. package/.aiox-core/development/tasks/qa-gate.md +54 -4
  43. package/.aiox-core/development/tasks/validate-next-story.md +39 -2
  44. package/.aiox-core/framework-config.yaml +1 -0
  45. package/.aiox-core/infrastructure/scripts/codex-skills-sync/README.md +69 -0
  46. package/.aiox-core/infrastructure/scripts/codex-skills-sync/bootstrap.js +727 -0
  47. package/.aiox-core/infrastructure/scripts/codex-skills-sync/index.js +10 -0
  48. package/.aiox-core/infrastructure/scripts/codex-skills-sync/validate.js +65 -4
  49. package/.aiox-core/infrastructure/scripts/generate-settings-json.js +29 -4
  50. package/.aiox-core/infrastructure/scripts/ide-sync/agent-parser.js +4 -0
  51. package/.aiox-core/infrastructure/scripts/ide-sync/index.js +67 -7
  52. package/.aiox-core/infrastructure/scripts/ide-sync/transformers/claude-code.js +145 -3
  53. package/.aiox-core/infrastructure/scripts/repair-agent-references.js +263 -0
  54. package/.aiox-core/infrastructure/scripts/validate-claude-integration.js +60 -8
  55. package/.aiox-core/infrastructure/scripts/validate-paths.js +13 -0
  56. package/.aiox-core/install-manifest.yaml +134 -82
  57. package/.aiox-core/utils/filters/index.js +2 -1
  58. package/.claude/commands/AIOX/agents/aiox-master.md +21 -0
  59. package/.claude/commands/AIOX/agents/analyst.md +21 -0
  60. package/.claude/commands/AIOX/agents/architect.md +21 -0
  61. package/.claude/commands/AIOX/agents/data-engineer.md +21 -0
  62. package/.claude/commands/AIOX/agents/dev.md +21 -0
  63. package/.claude/commands/AIOX/agents/devops.md +21 -0
  64. package/.claude/commands/AIOX/agents/pm.md +21 -0
  65. package/.claude/commands/AIOX/agents/po.md +21 -0
  66. package/.claude/commands/AIOX/agents/qa.md +21 -0
  67. package/.claude/commands/AIOX/agents/sm.md +21 -0
  68. package/.claude/commands/AIOX/agents/squad-creator.md +21 -0
  69. package/.claude/commands/AIOX/agents/ux-design-expert.md +21 -0
  70. package/.claude/commands/AIOX/scripts/agent-config-loader.js +624 -0
  71. package/.claude/commands/AIOX/scripts/generate-greeting.js +160 -0
  72. package/.claude/commands/AIOX/scripts/greeting-builder.js +866 -0
  73. package/.claude/commands/AIOX/scripts/session-context-loader.js +286 -0
  74. package/.claude/commands/AIOX/stories/story-6.1.4.md +1404 -0
  75. package/.claude/commands/cohort-squad/agents/cohort-manager.md +156 -0
  76. package/.claude/commands/design-system/agents/brad-frost.md +1097 -0
  77. package/.claude/commands/design-system/agents/dan-mall.md +857 -0
  78. package/.claude/commands/design-system/agents/dave-malouf.md +2272 -0
  79. package/.claude/commands/design-system/agents/design-chief.md +102 -0
  80. package/.claude/commands/design-system/agents/nano-banana-generator.md +162 -0
  81. package/.claude/commands/greet.md +101 -0
  82. package/.claude/commands/synapse/manager.md +75 -0
  83. package/.claude/commands/synapse/tasks/add-rule.md +94 -0
  84. package/.claude/commands/synapse/tasks/create-command.md +109 -0
  85. package/.claude/commands/synapse/tasks/create-domain.md +127 -0
  86. package/.claude/commands/synapse/tasks/diagnose-synapse.md +245 -0
  87. package/.claude/commands/synapse/tasks/edit-rule.md +109 -0
  88. package/.claude/commands/synapse/tasks/suggest-domain.md +116 -0
  89. package/.claude/commands/synapse/tasks/toggle-domain.md +83 -0
  90. package/.claude/commands/synapse/templates/domain-template +8 -0
  91. package/.claude/commands/synapse/templates/manifest-entry-template +4 -0
  92. package/.claude/commands/synapse/utils/manifest-parser-reference.md +134 -0
  93. package/.claude/hooks/precompact-session-digest.cjs +2 -2
  94. package/.claude/skills/AIOX/agents/aiox-master/SKILL.md +511 -0
  95. package/.claude/skills/AIOX/agents/analyst/SKILL.md +281 -0
  96. package/.claude/skills/AIOX/agents/architect/SKILL.md +482 -0
  97. package/.claude/skills/AIOX/agents/data-engineer/SKILL.md +503 -0
  98. package/.claude/skills/AIOX/agents/dev/SKILL.md +568 -0
  99. package/.claude/skills/AIOX/agents/devops/SKILL.md +597 -0
  100. package/.claude/skills/AIOX/agents/pm/SKILL.md +385 -0
  101. package/.claude/skills/AIOX/agents/po/SKILL.md +343 -0
  102. package/.claude/skills/AIOX/agents/qa/SKILL.md +451 -0
  103. package/.claude/skills/AIOX/agents/sm/SKILL.md +295 -0
  104. package/.claude/skills/AIOX/agents/squad-creator/SKILL.md +352 -0
  105. package/.claude/skills/AIOX/agents/ux-design-expert/SKILL.md +503 -0
  106. package/.claude/skills/architect-first/SKILL.md +275 -0
  107. package/.claude/skills/architect-first/assets/architecture-template.md +505 -0
  108. package/.claude/skills/architect-first/assets/config-template.yaml +351 -0
  109. package/.claude/skills/architect-first/references/architecture-checklist.md +216 -0
  110. package/.claude/skills/architect-first/references/pre-implementation-checklist.md +119 -0
  111. package/.claude/skills/architect-first/references/stop-rules-guide.md +291 -0
  112. package/.claude/skills/architect-first/references/testing-strategy-guide.md +477 -0
  113. package/.claude/skills/architect-first/scripts/architecture_validator.py +490 -0
  114. package/.claude/skills/architect-first/scripts/check_coupling.py +306 -0
  115. package/.claude/skills/architect-first/scripts/validate_risk_mitigation.py +382 -0
  116. package/.claude/skills/checklist-runner/SKILL.md +113 -0
  117. package/.claude/skills/clone-mind.md +329 -0
  118. package/.claude/skills/coderabbit-review/SKILL.md +106 -0
  119. package/.claude/skills/course-generation-workflow.md +76 -0
  120. package/.claude/skills/enhance-workflow.md +466 -0
  121. package/.claude/skills/mcp-builder/LICENSE.txt +202 -0
  122. package/.claude/skills/mcp-builder/SKILL.md +328 -0
  123. package/.claude/skills/mcp-builder/reference/evaluation.md +602 -0
  124. package/.claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
  125. package/.claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
  126. package/.claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
  127. package/.claude/skills/mcp-builder/scripts/connections.py +151 -0
  128. package/.claude/skills/mcp-builder/scripts/evaluation.py +373 -0
  129. package/.claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  130. package/.claude/skills/mcp-builder/scripts/requirements.txt +2 -0
  131. package/.claude/skills/ralph.md +181 -0
  132. package/.claude/skills/skill-creator/LICENSE.txt +202 -0
  133. package/.claude/skills/skill-creator/SKILL.md +209 -0
  134. package/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  135. package/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  136. package/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
  137. package/.claude/skills/squad.md +301 -0
  138. package/.claude/skills/synapse/SKILL.md +132 -0
  139. package/.claude/skills/synapse/assets/README.md +50 -0
  140. package/.claude/skills/synapse/references/brackets.md +100 -0
  141. package/.claude/skills/synapse/references/commands.md +118 -0
  142. package/.claude/skills/synapse/references/domains.md +126 -0
  143. package/.claude/skills/synapse/references/layers.md +186 -0
  144. package/.claude/skills/synapse/references/manifest.md +142 -0
  145. package/.claude/skills/tech-search/SKILL.md +431 -0
  146. package/.claude/skills/tech-search/prompts/page-extract.md +133 -0
  147. package/README.en.md +2 -2
  148. package/README.md +8 -2
  149. package/bin/aiox.js +55 -4
  150. package/bin/utils/framework-guard.js +4 -2
  151. package/bin/utils/pro-detector.js +119 -28
  152. package/bin/utils/validate-publish.js +2 -1
  153. package/docs/aiox-agent-flows/devops-system.md +18 -0
  154. package/docs/aiox-workflows/README.md +1 -0
  155. package/docs/aiox-workflows/pro-access-grant-workflow.md +218 -0
  156. package/docs/guides/pro/access-grant-ops-playbook.md +370 -0
  157. package/docs/guides/pro/install-gate-setup.md +12 -6
  158. package/docs/guides/pro/squad-creator-handoff-pro-access-ops.md +134 -0
  159. package/docs/guides/supabase-ops-handoff.md +768 -0
  160. package/package.json +12 -1
  161. package/packages/aiox-pro-cli/bin/aiox-pro.js +33 -12
  162. package/packages/installer/src/config/configure-environment.js +118 -50
  163. package/packages/installer/src/installer/aiox-core-installer.js +124 -27
  164. package/packages/installer/src/installer/brownfield-upgrader.js +66 -9
  165. package/packages/installer/src/installer/dependency-installer.js +4 -0
  166. package/packages/installer/src/pro/pro-scaffolder.js +5 -5
  167. package/packages/installer/src/updater/index.js +151 -10
  168. package/packages/installer/src/wizard/ide-config-generator.js +73 -7
  169. package/packages/installer/src/wizard/index.js +119 -31
  170. package/packages/installer/src/wizard/pro-setup.js +117 -45
  171. package/packages/installer/src/wizard/validation/validators/dependency-validator.js +32 -25
  172. package/packages/installer/src/wizard/validation/validators/file-structure-validator.js +26 -0
  173. package/packages/installer/tests/unit/artifact-copy-pipeline/artifact-copy-pipeline.test.js +84 -1
  174. package/packages/installer/tests/unit/claude-md-template-v5/claude-md-template-v5.test.js +1 -1
  175. package/packages/installer/tests/unit/doctor/doctor-checks.test.js +85 -19
  176. package/packages/installer/tests/unit/entity-registry-bootstrap.test.js +4 -4
  177. package/packages/installer/tests/unit/generate-settings-json/generate-settings-json.test.js +5 -5
  178. package/packages/installer/tests/unit/ide-sync-integration/ide-sync-integration.test.js +4 -4
  179. package/packages/installer/tests/unit/merger/yaml-merger.test.js +11 -11
  180. package/pro/README.md +77 -0
  181. package/pro/feature-registry.yaml +225 -0
  182. package/pro/license/degradation.js +220 -0
  183. package/pro/license/errors.js +450 -0
  184. package/pro/license/feature-gate.js +354 -0
  185. package/pro/license/index.js +173 -0
  186. package/pro/license/license-api.js +704 -0
  187. package/pro/license/license-cache.js +627 -0
  188. package/pro/license/license-crypto.js +359 -0
  189. package/pro/package.json +53 -0
  190. package/pro/pro-config.yaml +63 -0
  191. package/pro/squads/README.md +42 -0
  192. package/pro/squads/aiox-sop/ARCHITECTURE.md +86 -0
  193. package/pro/squads/aiox-sop/CHANGELOG.md +27 -0
  194. package/pro/squads/aiox-sop/HEADLINE.md +3 -0
  195. package/pro/squads/aiox-sop/README.md +77 -0
  196. package/pro/squads/aiox-sop/agents/sop-analyst.md +363 -0
  197. package/pro/squads/aiox-sop/agents/sop-auditor.md +294 -0
  198. package/pro/squads/aiox-sop/agents/sop-chief.md +279 -0
  199. package/pro/squads/aiox-sop/agents/sop-creator.md +322 -0
  200. package/pro/squads/aiox-sop/agents/sop-extractor.md +246 -0
  201. package/pro/squads/aiox-sop/agents/sop-ml-architect.md +310 -0
  202. package/pro/squads/aiox-sop/checklists/14-point-crosby-checklist.md +84 -0
  203. package/pro/squads/aiox-sop/checklists/extraction-completeness-checklist.md +78 -0
  204. package/pro/squads/aiox-sop/checklists/sop-completeness-checklist.md +283 -0
  205. package/pro/squads/aiox-sop/checklists/sop-ml-validation-checklist.md +157 -0
  206. package/pro/squads/aiox-sop/checklists/sop-quality-checklist.md +138 -0
  207. package/pro/squads/aiox-sop/checklists/stranger-test-checklist.md +108 -0
  208. package/pro/squads/aiox-sop/config.yaml +460 -0
  209. package/pro/squads/aiox-sop/data/category-map.yaml +647 -0
  210. package/pro/squads/aiox-sop/data/confidence-levels.yaml +133 -0
  211. package/pro/squads/aiox-sop/data/infrastructure-connections.yaml +730 -0
  212. package/pro/squads/aiox-sop/data/market-categories.yaml +65 -0
  213. package/pro/squads/aiox-sop/data/risk-register.yaml +90 -0
  214. package/pro/squads/aiox-sop/data/sop-ml-schema-examples.yaml +420 -0
  215. package/pro/squads/aiox-sop/data/sop-ml-schema.yaml +780 -0
  216. package/pro/squads/aiox-sop/data/sop-registry.yaml +42 -0
  217. package/pro/squads/aiox-sop/data/sop-scoring-rubric.yaml +601 -0
  218. package/pro/squads/aiox-sop/data/sop-standards-reference.yaml +475 -0
  219. package/pro/squads/aiox-sop/data/task-definitions.yaml +1602 -0
  220. package/pro/squads/aiox-sop/data/token-assignments.yaml +304 -0
  221. package/pro/squads/aiox-sop/data/verdict-thresholds.yaml +117 -0
  222. package/pro/squads/aiox-sop/data/workflow-quality-rubric.yaml +579 -0
  223. package/pro/squads/aiox-sop/docs/README.md +10 -0
  224. package/pro/squads/aiox-sop/docs/optimization-doc-drift-2026-03-18.json +20 -0
  225. package/pro/squads/aiox-sop/docs/optimization-economy-2026-03-18.md +40 -0
  226. package/pro/squads/aiox-sop/docs/optimization-environment-2026-03-18.json +24 -0
  227. package/pro/squads/aiox-sop/docs/optimization-material-inventory-2026-03-18.yaml +73 -0
  228. package/pro/squads/aiox-sop/docs/optimization-repo-baseline-2026-03-18.json +38 -0
  229. package/pro/squads/aiox-sop/docs/optimization-runtime-smoke-2026-03-18.json +57 -0
  230. package/pro/squads/aiox-sop/docs/optimization-split-verdict-2026-03-18.json +21 -0
  231. package/pro/squads/aiox-sop/docs/optimization-validation-2026-03-18.json +53 -0
  232. package/pro/squads/aiox-sop/docs/optimization-validation-fallback-2026-03-18.json +6 -0
  233. package/pro/squads/aiox-sop/docs/optimization-workflow-contracts-2026-03-18.json +81 -0
  234. package/pro/squads/aiox-sop/docs/optimization-yolo-plan-2026-03-18.md +177 -0
  235. package/pro/squads/aiox-sop/docs/optimization-yolo-report-2026-03-18.md +181 -0
  236. package/pro/squads/aiox-sop/docs/scaling-strategy.md +129 -0
  237. package/pro/squads/aiox-sop/examples/README.md +14 -0
  238. package/pro/squads/aiox-sop/examples/sample-human-sop.md +11 -0
  239. package/pro/squads/aiox-sop/examples/sample-ml-sop.yaml +14 -0
  240. package/pro/squads/aiox-sop/outputs/README.md +20 -0
  241. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-001.md +864 -0
  242. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-001.yaml +1225 -0
  243. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-002.md +904 -0
  244. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-002.yaml +431 -0
  245. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-003.md +964 -0
  246. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-003.yaml +392 -0
  247. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-004.md +975 -0
  248. package/pro/squads/aiox-sop/outputs/SOP-SLIDES-004.yaml +786 -0
  249. package/pro/squads/aiox-sop/protocols/sop-workflow-integration.md +209 -0
  250. package/pro/squads/aiox-sop/scripts/convert-sop-format-worker.py +299 -0
  251. package/pro/squads/aiox-sop/scripts/load-workspace-context.cjs +296 -0
  252. package/pro/squads/aiox-sop/scripts/normalize-thiagoroas-vsl-extractions.cjs +1448 -0
  253. package/pro/squads/aiox-sop/scripts/refresh-sop-registry.cjs +331 -0
  254. package/pro/squads/aiox-sop/scripts/resolve-environment-contract.cjs +107 -0
  255. package/pro/squads/aiox-sop/scripts/test-load-workspace-context.cjs +100 -0
  256. package/pro/squads/aiox-sop/scripts/test-resolve-environment-contract.cjs +159 -0
  257. package/pro/squads/aiox-sop/tasks/analyze-sop.md +464 -0
  258. package/pro/squads/aiox-sop/tasks/analyze-squad.md +317 -0
  259. package/pro/squads/aiox-sop/tasks/analyze-workflow.md +343 -0
  260. package/pro/squads/aiox-sop/tasks/audit-batch.md +354 -0
  261. package/pro/squads/aiox-sop/tasks/audit-sop.md +528 -0
  262. package/pro/squads/aiox-sop/tasks/benchmark-sop.md +408 -0
  263. package/pro/squads/aiox-sop/tasks/certify-sop.md +193 -0
  264. package/pro/squads/aiox-sop/tasks/check-environment.md +47 -0
  265. package/pro/squads/aiox-sop/tasks/compliance-check.md +84 -0
  266. package/pro/squads/aiox-sop/tasks/convert-sop-format.md +413 -0
  267. package/pro/squads/aiox-sop/tasks/create-checklist.md +267 -0
  268. package/pro/squads/aiox-sop/tasks/create-sop-human.md +306 -0
  269. package/pro/squads/aiox-sop/tasks/create-sop-ml.md +313 -0
  270. package/pro/squads/aiox-sop/tasks/create-sop-operations-suite.md +177 -0
  271. package/pro/squads/aiox-sop/tasks/delete-aiox-sop.md +38 -0
  272. package/pro/squads/aiox-sop/tasks/extract-from-video.md +354 -0
  273. package/pro/squads/aiox-sop/tasks/extract-sop.md +389 -0
  274. package/pro/squads/aiox-sop/tasks/load-workspace-context.md +112 -0
  275. package/pro/squads/aiox-sop/tasks/map-core-sop-backlog.md +651 -0
  276. package/pro/squads/aiox-sop/tasks/re-audit.md +97 -0
  277. package/pro/squads/aiox-sop/tasks/structured-interview.md +243 -0
  278. package/pro/squads/aiox-sop/tasks/update-aiox-sop.md +39 -0
  279. package/pro/squads/aiox-sop/templates/audit-report-template.md +119 -0
  280. package/pro/squads/aiox-sop/templates/certification-template.md +31 -0
  281. package/pro/squads/aiox-sop/templates/checklist-from-sop-tmpl.md +142 -0
  282. package/pro/squads/aiox-sop/templates/decision-tree-template.yaml +209 -0
  283. package/pro/squads/aiox-sop/templates/extraction-output-template.md +150 -0
  284. package/pro/squads/aiox-sop/templates/handoff-tmpl.yaml +85 -0
  285. package/pro/squads/aiox-sop/templates/ml-sop-json-template.json +208 -0
  286. package/pro/squads/aiox-sop/templates/ml-sop-yaml-template.yaml +204 -0
  287. package/pro/squads/aiox-sop/templates/nonconformity-register-template.md +85 -0
  288. package/pro/squads/aiox-sop/templates/sop-analysis-report-tmpl.md +378 -0
  289. package/pro/squads/aiox-sop/templates/sop-human-tmpl.md +385 -0
  290. package/pro/squads/aiox-sop/templates/sop-ml-tmpl.md +352 -0
  291. package/pro/squads/aiox-sop/templates/sop-scorecard-tmpl.md +123 -0
  292. package/pro/squads/aiox-sop/templates/state-machine-template.yaml +232 -0
  293. package/pro/squads/aiox-sop/templates/tool-binding-template.yaml +255 -0
  294. package/pro/squads/aiox-sop/templates/workflow-gap-report-tmpl.yaml +227 -0
  295. package/pro/squads/aiox-sop/workflows/wf-sop-audit-pipeline.yaml +381 -0
  296. package/pro/squads/aiox-sop/workflows/wf-sop-audit-pipeline.yaml.bak +332 -0
  297. package/pro/squads/aiox-sop/workflows/wf-sop-creation-pipeline.yaml +200 -0
  298. package/pro/squads/aiox-sop/workflows/wf-sop-creation-pipeline.yaml.bak +147 -0
  299. package/pro/squads/aiox-sop/workflows/wf-sop-extraction-pipeline.yaml +476 -0
  300. package/pro/squads/aiox-sop/workflows/wf-sop-extraction-pipeline.yaml.bak +441 -0
  301. package/pro/squads/aiox-sop/workflows/wf-sop-pipeline-definition.yaml +813 -0
  302. package/pro/squads/aiox-sop/workflows/wf-sop-quality-gates.yaml +473 -0
  303. package/pro/squads/brand/ARCHITECTURE.md +79 -0
  304. package/pro/squads/brand/CHANGELOG.md +38 -0
  305. package/pro/squads/brand/README.md +213 -0
  306. package/pro/squads/brand/agents/aaker-brand-identity.md +475 -0
  307. package/pro/squads/brand/agents/archetype-consultant.md +424 -0
  308. package/pro/squads/brand/agents/brand-chief.md +502 -0
  309. package/pro/squads/brand/agents/brand-strategist.md +661 -0
  310. package/pro/squads/brand/agents/domain-scout.md +412 -0
  311. package/pro/squads/brand/agents/heyward-dtc-brand.md +399 -0
  312. package/pro/squads/brand/agents/keller-brand-equity.md +390 -0
  313. package/pro/squads/brand/agents/miller-sticky-brand.md +510 -0
  314. package/pro/squads/brand/agents/naming-strategist.md +638 -0
  315. package/pro/squads/brand/agents/nano-banana-generator.md +38 -0
  316. package/pro/squads/brand/agents/neumeier-differentiation.md +390 -0
  317. package/pro/squads/brand/agents/ries-positioning.md +413 -0
  318. package/pro/squads/brand/agents/sharp-brand-science.md +444 -0
  319. package/pro/squads/brand/agents/storybrand-narrator.md +442 -0
  320. package/pro/squads/brand/agents/wheeler-brand-design.md +700 -0
  321. package/pro/squads/brand/agents/yohn-brand-culture.md +391 -0
  322. package/pro/squads/brand/checklists/brand-naming-checklist.md +46 -0
  323. package/pro/squads/brand/checklists/brand-quality-gate.md +58 -0
  324. package/pro/squads/brand/config/veto-conditions.yaml +54 -0
  325. package/pro/squads/brand/config.yaml +634 -0
  326. package/pro/squads/brand/data/brand-mappings.yaml +140 -0
  327. package/pro/squads/brand/data/logo-scds-templates.yaml +224 -0
  328. package/pro/squads/brand/data/logo-style-library.yaml +226 -0
  329. package/pro/squads/brand/data/swipe-file.yaml +282 -0
  330. package/pro/squads/brand/docs/optimization-economy-2026-03-10.md +25 -0
  331. package/pro/squads/brand/docs/optimization-material-inventory-2026-03-10.yaml +40 -0
  332. package/pro/squads/brand/docs/optimization-validation-2026-03-10.json +26 -0
  333. package/pro/squads/brand/docs/optimization-yolo-plan-2026-03-10.md +80 -0
  334. package/pro/squads/brand/docs/optimization-yolo-report-2026-03-10.md +158 -0
  335. package/pro/squads/brand/scripts/bootstrap-brand-workspace.sh +47 -0
  336. package/pro/squads/brand/scripts/validate-brand-essentials.sh +289 -0
  337. package/pro/squads/brand/tasks/brand-activation.md +86 -0
  338. package/pro/squads/brand/tasks/brand-book.md +224 -0
  339. package/pro/squads/brand/tasks/brand-consulting.md +189 -0
  340. package/pro/squads/brand/tasks/brand-diagnosis.md +81 -0
  341. package/pro/squads/brand/tasks/brand-identity.md +255 -0
  342. package/pro/squads/brand/tasks/brand-messaging.md +226 -0
  343. package/pro/squads/brand/tasks/brand-quality-gate.md +213 -0
  344. package/pro/squads/brand/tasks/create-brand-epic.md +129 -0
  345. package/pro/squads/brand/tasks/create-brand-story.md +155 -0
  346. package/pro/squads/brand/tasks/delete-brand.md +56 -0
  347. package/pro/squads/brand/tasks/domain-check.md +120 -0
  348. package/pro/squads/brand/tasks/load-workspace-context.md +112 -0
  349. package/pro/squads/brand/tasks/logo-curate.md +180 -0
  350. package/pro/squads/brand/tasks/logo-deliverable.md +210 -0
  351. package/pro/squads/brand/tasks/logo-generate.md +143 -0
  352. package/pro/squads/brand/tasks/logo-intake.md +151 -0
  353. package/pro/squads/brand/tasks/logo-prompt-engineering.md +151 -0
  354. package/pro/squads/brand/tasks/logo-refine.md +156 -0
  355. package/pro/squads/brand/tasks/logo-strategic-direction.md +160 -0
  356. package/pro/squads/brand/tasks/naming-generation.md +118 -0
  357. package/pro/squads/brand/tasks/positioning-narrative.md +93 -0
  358. package/pro/squads/brand/tasks/update-brand.md +52 -0
  359. package/pro/squads/brand/templates/brand-epic-tmpl.md +124 -0
  360. package/pro/squads/brand/templates/brand-story-tmpl.md +133 -0
  361. package/pro/squads/brand/templates/brandbook-tmpl.yaml +38 -0
  362. package/pro/squads/brand/templates/naming-report-tmpl.md +36 -0
  363. package/pro/squads/brand/workflows/wf-brand-activation-system.yaml +148 -0
  364. package/pro/squads/brand/workflows/wf-brand-all-hands.yaml +368 -0
  365. package/pro/squads/brand/workflows/wf-brand-complete.yaml +223 -0
  366. package/pro/squads/brand/workflows/wf-brand-consulting.yaml +301 -0
  367. package/pro/squads/brand/workflows/wf-brand-foundations.yaml +129 -0
  368. package/pro/squads/brand/workflows/wf-brand-mockup-generation.yaml +247 -0
  369. package/pro/squads/brand/workflows/wf-brand-positioning-narrative.yaml +146 -0
  370. package/pro/squads/brand/workflows/wf-logo-brainstorm.yaml +297 -0
  371. package/pro/squads/brand/workflows/wf-naming-to-domain.yaml +152 -0
  372. package/pro/squads/claude-code-mastery/ARCHITECTURE.md +224 -0
  373. package/pro/squads/claude-code-mastery/CHANGELOG.md +41 -0
  374. package/pro/squads/claude-code-mastery/README.md +146 -0
  375. package/pro/squads/claude-code-mastery/agents/claude-mastery-chief.md +542 -0
  376. package/pro/squads/claude-code-mastery/agents/config-engineer.md +1051 -0
  377. package/pro/squads/claude-code-mastery/agents/hooks-architect.md +1088 -0
  378. package/pro/squads/claude-code-mastery/agents/mcp-integrator.md +790 -0
  379. package/pro/squads/claude-code-mastery/agents/project-integrator.md +1184 -0
  380. package/pro/squads/claude-code-mastery/agents/roadmap-sentinel.md +922 -0
  381. package/pro/squads/claude-code-mastery/agents/skill-craftsman.md +1302 -0
  382. package/pro/squads/claude-code-mastery/agents/swarm-orchestrator.md +1072 -0
  383. package/pro/squads/claude-code-mastery/checklists/agent-team-readiness-checklist.md +88 -0
  384. package/pro/squads/claude-code-mastery/checklists/brownfield-readiness-checklist.md +91 -0
  385. package/pro/squads/claude-code-mastery/checklists/change-checklist.md +75 -0
  386. package/pro/squads/claude-code-mastery/checklists/context-rot-checklist.md +116 -0
  387. package/pro/squads/claude-code-mastery/checklists/integration-audit-checklist.md +104 -0
  388. package/pro/squads/claude-code-mastery/checklists/multi-agent-review-checklist.md +77 -0
  389. package/pro/squads/claude-code-mastery/checklists/pre-push-checklist.md +79 -0
  390. package/pro/squads/claude-code-mastery/config.yaml +351 -0
  391. package/pro/squads/claude-code-mastery/data/cc-architecture-map.yaml +217 -0
  392. package/pro/squads/claude-code-mastery/data/cc-permission-rules.yaml +281 -0
  393. package/pro/squads/claude-code-mastery/data/ci-cd-patterns.yaml +412 -0
  394. package/pro/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +436 -0
  395. package/pro/squads/claude-code-mastery/data/frontmatter-schemas.yaml +395 -0
  396. package/pro/squads/claude-code-mastery/data/hook-patterns.yaml +799 -0
  397. package/pro/squads/claude-code-mastery/data/infrastructure-map.yaml +53 -0
  398. package/pro/squads/claude-code-mastery/data/journey-log-events.yaml +115 -0
  399. package/pro/squads/claude-code-mastery/data/mcp-integration-catalog.yaml +323 -0
  400. package/pro/squads/claude-code-mastery/data/project-type-signatures.yaml +335 -0
  401. package/pro/squads/claude-code-mastery/data/quality-gates.yaml +43 -0
  402. package/pro/squads/claude-code-mastery/data/swarm-agent-schema.yaml +35 -0
  403. package/pro/squads/claude-code-mastery/data/token-registry.yaml +213 -0
  404. package/pro/squads/claude-code-mastery/docs/.gitkeep +0 -0
  405. package/pro/squads/claude-code-mastery/scripts/README-Permission-Sync.md +38 -0
  406. package/pro/squads/claude-code-mastery/scripts/generate-tool-allowlists.js +232 -0
  407. package/pro/squads/claude-code-mastery/scripts/inject-accountability-tokens.js +91 -0
  408. package/pro/squads/claude-code-mastery/scripts/inject-output-schemas.js +131 -0
  409. package/pro/squads/claude-code-mastery/scripts/inject-swarm-fields.js +92 -0
  410. package/pro/squads/claude-code-mastery/scripts/prepare-claude-runtime.sh +26 -0
  411. package/pro/squads/claude-code-mastery/scripts/publish-mastery-report.sh +17 -0
  412. package/pro/squads/claude-code-mastery/scripts/session-usage-report.py +982 -0
  413. package/pro/squads/claude-code-mastery/scripts/session_usage_report_cache.py +163 -0
  414. package/pro/squads/claude-code-mastery/scripts/session_usage_report_claude_adapter.py +375 -0
  415. package/pro/squads/claude-code-mastery/scripts/session_usage_report_facets.py +1128 -0
  416. package/pro/squads/claude-code-mastery/scripts/session_usage_report_html.py +989 -0
  417. package/pro/squads/claude-code-mastery/scripts/session_usage_report_inventory.py +66 -0
  418. package/pro/squads/claude-code-mastery/scripts/session_usage_report_markdown.py +506 -0
  419. package/pro/squads/claude-code-mastery/scripts/session_usage_report_mock_insights_adapter.py +277 -0
  420. package/pro/squads/claude-code-mastery/scripts/session_usage_report_pipeline.py +519 -0
  421. package/pro/squads/claude-code-mastery/scripts/session_usage_report_recommendations.py +317 -0
  422. package/pro/squads/claude-code-mastery/scripts/session_usage_report_usage.py +235 -0
  423. package/pro/squads/claude-code-mastery/scripts/test_session_usage_report.py +1910 -0
  424. package/pro/squads/claude-code-mastery/scripts/validate-setup.js +597 -0
  425. package/pro/squads/claude-code-mastery/squad-io.yaml +151 -0
  426. package/pro/squads/claude-code-mastery/tasks/align-memory-context.md +212 -0
  427. package/pro/squads/claude-code-mastery/tasks/audit-integration.md +252 -0
  428. package/pro/squads/claude-code-mastery/tasks/audit-settings.md +239 -0
  429. package/pro/squads/claude-code-mastery/tasks/audit-setup.md +258 -0
  430. package/pro/squads/claude-code-mastery/tasks/brownfield-setup.md +355 -0
  431. package/pro/squads/claude-code-mastery/tasks/ci-cd-setup.md +368 -0
  432. package/pro/squads/claude-code-mastery/tasks/claude-md-engineer.md +367 -0
  433. package/pro/squads/claude-code-mastery/tasks/configure-claude-code.md +248 -0
  434. package/pro/squads/claude-code-mastery/tasks/context-rot-audit.md +363 -0
  435. package/pro/squads/claude-code-mastery/tasks/create-agent-definition.md +311 -0
  436. package/pro/squads/claude-code-mastery/tasks/create-rules.md +239 -0
  437. package/pro/squads/claude-code-mastery/tasks/create-team-topology.md +291 -0
  438. package/pro/squads/claude-code-mastery/tasks/delete-claude-code-mastery.md +224 -0
  439. package/pro/squads/claude-code-mastery/tasks/diagnose.md +199 -0
  440. package/pro/squads/claude-code-mastery/tasks/enterprise-config.md +379 -0
  441. package/pro/squads/claude-code-mastery/tasks/hook-designer.md +315 -0
  442. package/pro/squads/claude-code-mastery/tasks/integrate-project.md +337 -0
  443. package/pro/squads/claude-code-mastery/tasks/mcp-integration-plan.md +284 -0
  444. package/pro/squads/claude-code-mastery/tasks/mcp-workflow.md +330 -0
  445. package/pro/squads/claude-code-mastery/tasks/multi-project-setup.md +261 -0
  446. package/pro/squads/claude-code-mastery/tasks/optimize-context.md +250 -0
  447. package/pro/squads/claude-code-mastery/tasks/optimize-workflow.md +270 -0
  448. package/pro/squads/claude-code-mastery/tasks/parallel-decomposition.md +326 -0
  449. package/pro/squads/claude-code-mastery/tasks/permission-strategy.md +315 -0
  450. package/pro/squads/claude-code-mastery/tasks/rebuild-runtime-validator.md +234 -0
  451. package/pro/squads/claude-code-mastery/tasks/refresh-runtime-contract.md +235 -0
  452. package/pro/squads/claude-code-mastery/tasks/sandbox-setup.md +312 -0
  453. package/pro/squads/claude-code-mastery/tasks/setup-repository.md +263 -0
  454. package/pro/squads/claude-code-mastery/tasks/setup-wizard.md +269 -0
  455. package/pro/squads/claude-code-mastery/tasks/update-claude-code-mastery.md +227 -0
  456. package/pro/squads/claude-code-mastery/tasks/worktree-strategy.md +353 -0
  457. package/pro/squads/claude-code-mastery/templates/baseline-kpis-tmpl.yaml +0 -0
  458. package/pro/squads/claude-code-mastery/templates/claude-md-fullstack.md +147 -0
  459. package/pro/squads/claude-code-mastery/templates/claude-md-library.md +175 -0
  460. package/pro/squads/claude-code-mastery/templates/claude-md-microservices.md +186 -0
  461. package/pro/squads/claude-code-mastery/templates/claude-md-mobile.md +198 -0
  462. package/pro/squads/claude-code-mastery/templates/claude-md-monorepo.md +139 -0
  463. package/pro/squads/claude-code-mastery/templates/concept-mapping-tmpl.yaml +0 -0
  464. package/pro/squads/claude-code-mastery/templates/cross-domain-handoff-tmpl.yaml +15 -0
  465. package/pro/squads/claude-code-mastery/templates/github-actions-claude-ci.yml +348 -0
  466. package/pro/squads/claude-code-mastery/templates/github-actions-claude-review.yml +179 -0
  467. package/pro/squads/claude-code-mastery/templates/hook-implementation-tmpl.md +24 -0
  468. package/pro/squads/claude-code-mastery/templates/mcp-config-tmpl.yaml +18 -0
  469. package/pro/squads/claude-code-mastery/templates/session-usage-report-page.css +591 -0
  470. package/pro/squads/claude-code-mastery/templates/session-usage-report-page.html +32 -0
  471. package/pro/squads/claude-code-mastery/templates/session-usage-report-tmpl.yaml +224 -0
  472. package/pro/squads/claude-code-mastery/templates/skill-definition-tmpl.md +67 -0
  473. package/pro/squads/claude-code-mastery/templates/violations-log-tmpl.jsonl +0 -0
  474. package/pro/squads/claude-code-mastery/workflows/wf-audit-complete.yaml +178 -0
  475. package/pro/squads/claude-code-mastery/workflows/wf-knowledge-update.yaml +447 -0
  476. package/pro/squads/claude-code-mastery/workflows/wf-project-setup.yaml +236 -0
  477. package/pro/squads/data/HEADLINE.md +3 -0
  478. package/pro/squads/data/README.md +292 -0
  479. package/pro/squads/data/agents/avinash-kaushik.md +1117 -0
  480. package/pro/squads/data/agents/data-chief.md +1035 -0
  481. package/pro/squads/data/agents/david-spinks.md +1896 -0
  482. package/pro/squads/data/agents/nick-mehta.md +1338 -0
  483. package/pro/squads/data/agents/peter-fader.md +1815 -0
  484. package/pro/squads/data/agents/sean-ellis.md +2460 -0
  485. package/pro/squads/data/agents/wes-kao.md +2124 -0
  486. package/pro/squads/data/checklists/cbc-readiness-checklist.md +155 -0
  487. package/pro/squads/data/checklists/community-health-checklist.md +131 -0
  488. package/pro/squads/data/checklists/customer-360-checklist.md +997 -0
  489. package/pro/squads/data/checklists/customer-centricity-checklist.md +105 -0
  490. package/pro/squads/data/checklists/health-score-checklist.md +984 -0
  491. package/pro/squads/data/checklists/pre-implementation-checklist.md +291 -0
  492. package/pro/squads/data/checklists/so-what-checklist.md +326 -0
  493. package/pro/squads/data/config.yaml +705 -0
  494. package/pro/squads/data/data/.gitkeep +0 -0
  495. package/pro/squads/data/data/README.md +84 -0
  496. package/pro/squads/data/data/framework/01_arquitetura_geral.md +134 -0
  497. package/pro/squads/data/data/framework/02_tier0_fundacao.md +198 -0
  498. package/pro/squads/data/data/framework/03_tier0_fundamentadores.md +297 -0
  499. package/pro/squads/data/data/framework/04_tier1_operacionalizadores.md +447 -0
  500. package/pro/squads/data/data/framework/05_tier2_comunicadores.md +297 -0
  501. package/pro/squads/data/data/framework/06_matriz_decisao.md +328 -0
  502. package/pro/squads/data/data/framework/07_workflows.md +552 -0
  503. package/pro/squads/data/data/framework/08_cheatsheet.md +216 -0
  504. package/pro/squads/data/examples/cohorts-diagnostic-sample-output.yaml +10 -0
  505. package/pro/squads/data/outputs/workspace-hardening-summary.md +12 -0
  506. package/pro/squads/data/projects/data-v1-setup/prd.json +440 -0
  507. package/pro/squads/data/projects/data-v1-setup/prompt.md +184 -0
  508. package/pro/squads/data/scripts/bootstrap-data-workspace.sh +186 -0
  509. package/pro/squads/data/scripts/validate-data-essentials.sh +237 -0
  510. package/pro/squads/data/tasks/analyze-cohort.md +1777 -0
  511. package/pro/squads/data/tasks/build-attribution.md +1695 -0
  512. package/pro/squads/data/tasks/calculate-clv.md +1660 -0
  513. package/pro/squads/data/tasks/create-dashboard.md +2305 -0
  514. package/pro/squads/data/tasks/define-north-star.md +1779 -0
  515. package/pro/squads/data/tasks/design-health-score.md +1952 -0
  516. package/pro/squads/data/tasks/design-learning-outcomes.md +2122 -0
  517. package/pro/squads/data/tasks/load-workspace-context.md +115 -0
  518. package/pro/squads/data/tasks/measure-community.md +1376 -0
  519. package/pro/squads/data/tasks/predict-churn.md +1979 -0
  520. package/pro/squads/data/tasks/run-growth-experiment.md +1863 -0
  521. package/pro/squads/data/tasks/run-pmf-test.md +1514 -0
  522. package/pro/squads/data/tasks/segment-rfm.md +2070 -0
  523. package/pro/squads/data/templates/attribution-report-tmpl.yaml +94 -0
  524. package/pro/squads/data/templates/churn-alert-tmpl.yaml +529 -0
  525. package/pro/squads/data/templates/clv-report-tmpl.yaml +818 -0
  526. package/pro/squads/data/templates/cohort-analysis-tmpl.yaml +72 -0
  527. package/pro/squads/data/templates/cohorts/community-health-cohort-tmpl.yaml +60 -0
  528. package/pro/squads/data/templates/cohorts/executive-summary-tmpl.yaml +54 -0
  529. package/pro/squads/data/templates/cohorts/icp-deep-analysis-tmpl.yaml +49 -0
  530. package/pro/squads/data/templates/cohorts/learning-journey-tmpl.yaml +52 -0
  531. package/pro/squads/data/templates/cohorts/segmentation-rfm-tmpl.yaml +48 -0
  532. package/pro/squads/data/templates/cohorts/student-health-score-tmpl.yaml +50 -0
  533. package/pro/squads/data/templates/community-health-tmpl.yaml +106 -0
  534. package/pro/squads/data/templates/customer-360-tmpl.yaml +80 -0
  535. package/pro/squads/data/templates/dmmm-tmpl.yaml +134 -0
  536. package/pro/squads/data/templates/executive-report-tmpl.yaml +432 -0
  537. package/pro/squads/data/templates/health-score-report-tmpl.yaml +644 -0
  538. package/pro/squads/data/templates/learning-outcomes-tmpl.yaml +112 -0
  539. package/pro/squads/data/workflows/cohort-analysis-workflow.md +356 -0
  540. package/pro/squads/data/workflows/cohorts-diagnostic.md +96 -0
  541. package/pro/squads/data/workflows/create-churn-system.md +354 -0
  542. package/pro/squads/data/workflows/fix-completion-rate.md +436 -0
  543. package/pro/squads/data/workflows/implement-attribution.md +371 -0
  544. package/pro/squads/data/workflows/implement-customer-360.md +297 -0
  545. package/pro/squads/data/workflows/optimize-community-workflow.md +463 -0
  546. package/pro/squads/data/workspace-hardening-state.json +6 -0
  547. package/pro/squads/db-sage/README.md +331 -0
  548. package/pro/squads/db-sage/agents/db-sage.md +317 -0
  549. package/pro/squads/db-sage/checklists/database-design-checklist.md +79 -0
  550. package/pro/squads/db-sage/checklists/database-migration-documentation-checklist.md +348 -0
  551. package/pro/squads/db-sage/checklists/db-kiss-validation-checklist.md +246 -0
  552. package/pro/squads/db-sage/checklists/dba-predeploy-checklist.md +276 -0
  553. package/pro/squads/db-sage/checklists/dba-rollback-checklist.md +65 -0
  554. package/pro/squads/db-sage/checklists/migration-validation-checklist.md +195 -0
  555. package/pro/squads/db-sage/checklists/supabase-best-practices-audit.md +256 -0
  556. package/pro/squads/db-sage/config.yaml +165 -0
  557. package/pro/squads/db-sage/data/database-best-practices.md +42 -0
  558. package/pro/squads/db-sage/data/migration-safety-guide.md +64 -0
  559. package/pro/squads/db-sage/data/postgres-tuning-guide.md +39 -0
  560. package/pro/squads/db-sage/data/rls-security-patterns.md +46 -0
  561. package/pro/squads/db-sage/data/supabase-agent-skills.md +970 -0
  562. package/pro/squads/db-sage/data/supabase-patterns.md +482 -0
  563. package/pro/squads/db-sage/docs/.gitkeep +0 -0
  564. package/pro/squads/db-sage/scripts/database-adapters/detect-database.sh +113 -0
  565. package/pro/squads/db-sage/scripts/database-adapters/postgresql-schema-loader.sh +334 -0
  566. package/pro/squads/db-sage/scripts/database-adapters/unified-db-loader.sh +176 -0
  567. package/pro/squads/db-sage/scripts/database-operations/README.md +638 -0
  568. package/pro/squads/db-sage/scripts/database-operations/backup-manager.sh +341 -0
  569. package/pro/squads/db-sage/scripts/database-operations/connection-monitor.sh +433 -0
  570. package/pro/squads/db-sage/scripts/database-operations/constraint-validator.sh +588 -0
  571. package/pro/squads/db-sage/scripts/database-operations/data-anonymizer.sh +446 -0
  572. package/pro/squads/db-sage/scripts/database-operations/data-loader.sh +346 -0
  573. package/pro/squads/db-sage/scripts/database-operations/explain-analyzer.sh +285 -0
  574. package/pro/squads/db-sage/scripts/database-operations/health-checker.sh +512 -0
  575. package/pro/squads/db-sage/scripts/database-operations/index-manager.sh +380 -0
  576. package/pro/squads/db-sage/scripts/database-operations/migration-generator.sh +490 -0
  577. package/pro/squads/db-sage/scripts/database-operations/migration-safe-runner.sh +228 -0
  578. package/pro/squads/db-sage/scripts/database-operations/permission-auditor.sh +513 -0
  579. package/pro/squads/db-sage/scripts/database-operations/query-killer.sh +306 -0
  580. package/pro/squads/db-sage/scripts/database-operations/replication-monitor.sh +366 -0
  581. package/pro/squads/db-sage/scripts/database-operations/rls-policy-installer.sh +480 -0
  582. package/pro/squads/db-sage/scripts/database-operations/rls-test-suite.sh +172 -0
  583. package/pro/squads/db-sage/scripts/database-operations/schema-differ.sh +265 -0
  584. package/pro/squads/db-sage/scripts/database-operations/security-scanner.sh +683 -0
  585. package/pro/squads/db-sage/scripts/database-operations/setup-pgpass.sh +185 -0
  586. package/pro/squads/db-sage/scripts/database-operations/vacuum-optimizer.sh +448 -0
  587. package/pro/squads/db-sage/scripts/db-ops/backup-manager.sh +321 -0
  588. package/pro/squads/db-sage/scripts/db-ops/best-practices-auditor.sh +534 -0
  589. package/pro/squads/db-sage/scripts/db-ops/bootstrap-runner.sh +255 -0
  590. package/pro/squads/db-sage/scripts/db-ops/data-loader.sh +616 -0
  591. package/pro/squads/db-sage/scripts/db-ops/detect-database.sh +25 -0
  592. package/pro/squads/db-sage/scripts/db-ops/explain-analyzer.sh +90 -0
  593. package/pro/squads/db-sage/scripts/db-ops/health-checker.sh +323 -0
  594. package/pro/squads/db-sage/scripts/db-ops/migration-runner.sh +308 -0
  595. package/pro/squads/db-sage/scripts/db-ops/query-runner.sh +171 -0
  596. package/pro/squads/db-sage/scripts/db-ops/rls-policy-installer.sh +46 -0
  597. package/pro/squads/db-sage/scripts/db-ops/rls-test-suite.sh +38 -0
  598. package/pro/squads/db-sage/scripts/db-ops/schema-context-loader.sh +25 -0
  599. package/pro/squads/db-sage/scripts/db-ops/squad-integration-preflight.sh +155 -0
  600. package/pro/squads/db-sage/tasks/create-doc.md +107 -0
  601. package/pro/squads/db-sage/tasks/db-analyze-hotpaths.md +406 -0
  602. package/pro/squads/db-sage/tasks/db-apply-migration.md +206 -0
  603. package/pro/squads/db-sage/tasks/db-best-practices-audit.md +523 -0
  604. package/pro/squads/db-sage/tasks/db-bootstrap.md +464 -0
  605. package/pro/squads/db-sage/tasks/db-dry-run.md +122 -0
  606. package/pro/squads/db-sage/tasks/db-env-check.md +94 -0
  607. package/pro/squads/db-sage/tasks/db-explain.md +461 -0
  608. package/pro/squads/db-sage/tasks/db-impersonate.md +326 -0
  609. package/pro/squads/db-sage/tasks/db-load-csv.md +433 -0
  610. package/pro/squads/db-sage/tasks/db-policy-apply.md +464 -0
  611. package/pro/squads/db-sage/tasks/db-rls-audit.md +241 -0
  612. package/pro/squads/db-sage/tasks/db-rollback.md +573 -0
  613. package/pro/squads/db-sage/tasks/db-run-sql.md +453 -0
  614. package/pro/squads/db-sage/tasks/db-seed.md +230 -0
  615. package/pro/squads/db-sage/tasks/db-smoke-test.md +181 -0
  616. package/pro/squads/db-sage/tasks/db-snapshot.md +403 -0
  617. package/pro/squads/db-sage/tasks/db-squad-integration.md +487 -0
  618. package/pro/squads/db-sage/tasks/db-verify-order.md +344 -0
  619. package/pro/squads/db-sage/tasks/domain-modeling.md +517 -0
  620. package/pro/squads/db-sage/tasks/execute-checklist.md +99 -0
  621. package/pro/squads/db-sage/tasks/kiss.md +129 -0
  622. package/pro/squads/db-sage/tasks/query-optimization.md +599 -0
  623. package/pro/squads/db-sage/tasks/schema-audit.md +833 -0
  624. package/pro/squads/db-sage/tasks/supabase-setup.md +536 -0
  625. package/pro/squads/db-sage/templates/backup-metadata.json.tmpl +7 -0
  626. package/pro/squads/db-sage/templates/db-analysis-template.yaml +291 -0
  627. package/pro/squads/db-sage/templates/index-strategy-tmpl.yaml +53 -0
  628. package/pro/squads/db-sage/templates/migration-plan-tmpl.yaml +1022 -0
  629. package/pro/squads/db-sage/templates/migration.sql.tmpl +9 -0
  630. package/pro/squads/db-sage/templates/rls-policies-tmpl.yaml +1201 -0
  631. package/pro/squads/db-sage/templates/rollback.sql.tmpl +9 -0
  632. package/pro/squads/db-sage/templates/schema-design-tmpl.yaml +426 -0
  633. package/pro/squads/db-sage/workflows/analyze-data-workflow.yaml +407 -0
  634. package/pro/squads/db-sage/workflows/backup-restore-workflow.yaml +121 -0
  635. package/pro/squads/db-sage/workflows/kiss-gate-workflow.yaml +143 -0
  636. package/pro/squads/db-sage/workflows/modify-schema-workflow.yaml +440 -0
  637. package/pro/squads/db-sage/workflows/performance-tuning-workflow.yaml +104 -0
  638. package/pro/squads/db-sage/workflows/query-database-workflow.yaml +394 -0
  639. package/pro/squads/db-sage/workflows/setup-database-workflow.yaml +428 -0
  640. package/pro/squads/design/HEADLINE.md +3 -0
  641. package/pro/squads/design/README.md +109 -0
  642. package/pro/squads/design/agents/brad-frost.md +1097 -0
  643. package/pro/squads/design/agents/dan-mall.md +857 -0
  644. package/pro/squads/design/agents/dave-malouf.md +2272 -0
  645. package/pro/squads/design/agents/design-chief.md +114 -0
  646. package/pro/squads/design/agents/ds-foundations-lead.md +194 -0
  647. package/pro/squads/design/agents/ds-token-architect.md +361 -0
  648. package/pro/squads/design/agents/nano-banana-generator.md +162 -0
  649. package/pro/squads/design/agents/storybook-expert.md +809 -0
  650. package/pro/squads/design/checklists/atomic-refactor-checklist.md +299 -0
  651. package/pro/squads/design/checklists/component-adaptation-checklist.md +81 -0
  652. package/pro/squads/design/checklists/design-fidelity-checklist.md +283 -0
  653. package/pro/squads/design/checklists/design-handoff-checklist.md +55 -0
  654. package/pro/squads/design/checklists/design-team-health-checklist.md +454 -0
  655. package/pro/squads/design/checklists/designops-maturity-checklist.md +518 -0
  656. package/pro/squads/design/checklists/ds-a11y-release-gate-checklist.md +45 -0
  657. package/pro/squads/design/checklists/ds-accessibility-wcag-checklist.md +147 -0
  658. package/pro/squads/design/checklists/ds-component-quality-checklist.md +150 -0
  659. package/pro/squads/design/checklists/ds-critical-eye-review-checklist.md +147 -0
  660. package/pro/squads/design/checklists/ds-migration-readiness-checklist.md +99 -0
  661. package/pro/squads/design/checklists/ds-pattern-audit-checklist.md +164 -0
  662. package/pro/squads/design/checklists/reading-accessibility-checklist.md +275 -0
  663. package/pro/squads/design/checklists/token-mapping-checklist.md +107 -0
  664. package/pro/squads/design/config/coding-standards.md +286 -0
  665. package/pro/squads/design/config/source-tree.md +59 -0
  666. package/pro/squads/design/config/tech-stack.md +48 -0
  667. package/pro/squads/design/config.yaml +207 -0
  668. package/pro/squads/design/data/agentic-design-systems-guide.md +46 -0
  669. package/pro/squads/design/data/agentic-ds-principles.md +100 -0
  670. package/pro/squads/design/data/atomic-design-principles.md +108 -0
  671. package/pro/squads/design/data/atomic-refactor-rules.md +582 -0
  672. package/pro/squads/design/data/base-component-specs.md +972 -0
  673. package/pro/squads/design/data/brad-frost-analysis-extract-implicit.yaml +270 -0
  674. package/pro/squads/design/data/brad-frost-analysis-find-0.8.yaml +176 -0
  675. package/pro/squads/design/data/brad-frost-analysis-qa-report.yaml +168 -0
  676. package/pro/squads/design/data/brad-frost-dna.yaml +713 -0
  677. package/pro/squads/design/data/capability-tools.yaml +124 -0
  678. package/pro/squads/design/data/component-adaptation-changelog.md +318 -0
  679. package/pro/squads/design/data/consolidation-algorithms.md +168 -0
  680. package/pro/squads/design/data/critical-eye-scoring-rules.yaml +240 -0
  681. package/pro/squads/design/data/design-token-best-practices.md +107 -0
  682. package/pro/squads/design/data/design-tokens-spec.yaml +418 -0
  683. package/pro/squads/design/data/ds-reference-architectures.md +93 -0
  684. package/pro/squads/design/data/f2-qa-report.md +168 -0
  685. package/pro/squads/design/data/f3-derived-components-changelog.md +100 -0
  686. package/pro/squads/design/data/f3-qa-report.md +208 -0
  687. package/pro/squads/design/data/figma-base-components-raw.md +102 -0
  688. package/pro/squads/design/data/figma-tokens-raw.md +1549 -0
  689. package/pro/squads/design/data/fluent2-design-principles.md +114 -0
  690. package/pro/squads/design/data/high-retention-reading-guide.md +349 -0
  691. package/pro/squads/design/data/integration-patterns.md +207 -0
  692. package/pro/squads/design/data/internal-quality-chain.yaml +48 -0
  693. package/pro/squads/design/data/motion-tokens-guide.md +202 -0
  694. package/pro/squads/design/data/roi-calculation-guide.md +142 -0
  695. package/pro/squads/design/data/token-mapping-reference.md +213 -0
  696. package/pro/squads/design/data/w3c-dtcg-spec-reference.md +149 -0
  697. package/pro/squads/design/data/wcag-compliance-guide.md +267 -0
  698. package/pro/squads/design/docs/AUDIT_REPORT.md +97 -0
  699. package/pro/squads/design/docs/DS-CURATION-PIPELINE-PROPOSAL.md +577 -0
  700. package/pro/squads/design/docs/UPGRADE_PLAN.md +618 -0
  701. package/pro/squads/design/docs/brad-frost-research-validation.md +372 -0
  702. package/pro/squads/design/docs/dave-malouf-research-validation.md +391 -0
  703. package/pro/squads/design/docs/tool-discovery-report.md +87 -0
  704. package/pro/squads/design/docs/tool-integration-plan.md +44 -0
  705. package/pro/squads/design/protocols/ai-first-governance.md +56 -0
  706. package/pro/squads/design/protocols/governance-execution-boundary.md +59 -0
  707. package/pro/squads/design/protocols/handoff.md +60 -0
  708. package/pro/squads/design/rules/.claude-rules.md +88 -0
  709. package/pro/squads/design/scripts/design-system/curate_colors.cjs +447 -0
  710. package/pro/squads/design/scripts/design-system/curate_components.cjs +217 -0
  711. package/pro/squads/design/scripts/design-system/curate_radius.cjs +190 -0
  712. package/pro/squads/design/scripts/design-system/curate_shadows.cjs +208 -0
  713. package/pro/squads/design/scripts/design-system/curate_spacing.cjs +243 -0
  714. package/pro/squads/design/scripts/design-system/curate_typography.cjs +404 -0
  715. package/pro/squads/design/scripts/design-system/design-system-metadata.test.js +49 -0
  716. package/pro/squads/design/scripts/design-system/design_manifest_lib.cjs +142 -0
  717. package/pro/squads/design/scripts/design-system/fetch_page_images.cjs +195 -0
  718. package/pro/squads/design/scripts/design-system/generate_components_metadata.cjs +114 -0
  719. package/pro/squads/design/scripts/design-system/generate_curation_report.cjs +258 -0
  720. package/pro/squads/design/scripts/design-system/generate_tokens.cjs +342 -0
  721. package/pro/squads/design/scripts/design-system/sync_design_manifest.cjs +27 -0
  722. package/pro/squads/design/scripts/design-system/test_mcp_tools.cjs +232 -0
  723. package/pro/squads/design/scripts/design-system/validate_components_metadata.cjs +96 -0
  724. package/pro/squads/design/scripts/design-system/validate_curation.cjs +226 -0
  725. package/pro/squads/design/scripts/design-system/validate_design_manifest_drift.cjs +72 -0
  726. package/pro/squads/design/scripts/design-system/validate_mcp_skeleton.cjs +38 -0
  727. package/pro/squads/design/scripts/design-system/validate_registry.cjs +186 -0
  728. package/pro/squads/design/scripts/design-system/validate_task_checklist_bindings.cjs +78 -0
  729. package/pro/squads/design/scripts/dissect-artifact.cjs +806 -0
  730. package/pro/squads/design/scripts/validate-a11y-integration.cjs +40 -0
  731. package/pro/squads/design/scripts/validate-design-squad.py +411 -0
  732. package/pro/squads/design/squad.yaml +714 -0
  733. package/pro/squads/design/tasks/a11y-audit.md +340 -0
  734. package/pro/squads/design/tasks/aria-audit.md +525 -0
  735. package/pro/squads/design/tasks/atomic-refactor-execute.md +391 -0
  736. package/pro/squads/design/tasks/atomic-refactor-plan.md +262 -0
  737. package/pro/squads/design/tasks/audit-reading-experience.md +350 -0
  738. package/pro/squads/design/tasks/audit-tailwind-config.md +101 -0
  739. package/pro/squads/design/tasks/bootstrap-shadcn-library.md +96 -0
  740. package/pro/squads/design/tasks/bundle-audit.md +245 -0
  741. package/pro/squads/design/tasks/contrast-matrix.md +373 -0
  742. package/pro/squads/design/tasks/create-doc.md +135 -0
  743. package/pro/squads/design/tasks/dead-code-detection.md +329 -0
  744. package/pro/squads/design/tasks/design-compare.md +414 -0
  745. package/pro/squads/design/tasks/design-process-optimization.md +407 -0
  746. package/pro/squads/design/tasks/design-review-orchestration.md +99 -0
  747. package/pro/squads/design/tasks/design-team-scaling.md +407 -0
  748. package/pro/squads/design/tasks/design-tooling-audit.md +404 -0
  749. package/pro/squads/design/tasks/design-triage.md +89 -0
  750. package/pro/squads/design/tasks/designops-maturity-assessment.md +364 -0
  751. package/pro/squads/design/tasks/designops-metrics-setup.md +465 -0
  752. package/pro/squads/design/tasks/ds-agentic-audit.md +100 -0
  753. package/pro/squads/design/tasks/ds-agentic-setup.md +103 -0
  754. package/pro/squads/design/tasks/ds-audit-codebase.md +273 -0
  755. package/pro/squads/design/tasks/ds-build-component.md +349 -0
  756. package/pro/squads/design/tasks/ds-build-mcp-server.md +84 -0
  757. package/pro/squads/design/tasks/ds-calculate-roi.md +282 -0
  758. package/pro/squads/design/tasks/ds-compose-molecule.md +106 -0
  759. package/pro/squads/design/tasks/ds-consolidate-patterns.md +253 -0
  760. package/pro/squads/design/tasks/ds-context-contract.md +194 -0
  761. package/pro/squads/design/tasks/ds-critical-eye-compare.md +130 -0
  762. package/pro/squads/design/tasks/ds-critical-eye-decide.md +139 -0
  763. package/pro/squads/design/tasks/ds-critical-eye-inventory.md +111 -0
  764. package/pro/squads/design/tasks/ds-critical-eye-report.md +101 -0
  765. package/pro/squads/design/tasks/ds-critical-eye-score.md +109 -0
  766. package/pro/squads/design/tasks/ds-designops.md +99 -0
  767. package/pro/squads/design/tasks/ds-extend-pattern.md +91 -0
  768. package/pro/squads/design/tasks/ds-extract-tokens.md +312 -0
  769. package/pro/squads/design/tasks/ds-figma-pipeline.md +95 -0
  770. package/pro/squads/design/tasks/ds-fluent-audit.md +105 -0
  771. package/pro/squads/design/tasks/ds-fluent-build.md +110 -0
  772. package/pro/squads/design/tasks/ds-generate-ai-metadata.md +81 -0
  773. package/pro/squads/design/tasks/ds-generate-cursor-rules.md +74 -0
  774. package/pro/squads/design/tasks/ds-generate-documentation.md +101 -0
  775. package/pro/squads/design/tasks/ds-generate-migration-strategy.md +331 -0
  776. package/pro/squads/design/tasks/ds-generate-shock-report.md +323 -0
  777. package/pro/squads/design/tasks/ds-govern-a11y-compliance.md +93 -0
  778. package/pro/squads/design/tasks/ds-governance.md +187 -0
  779. package/pro/squads/design/tasks/ds-health-metrics.md +278 -0
  780. package/pro/squads/design/tasks/ds-integrate-squad.md +130 -0
  781. package/pro/squads/design/tasks/ds-integrate-workspace.md +100 -0
  782. package/pro/squads/design/tasks/ds-legacy-modernization.md +302 -0
  783. package/pro/squads/design/tasks/ds-mcp-status.md +65 -0
  784. package/pro/squads/design/tasks/ds-motion-audit.md +118 -0
  785. package/pro/squads/design/tasks/ds-multi-framework.md +96 -0
  786. package/pro/squads/design/tasks/ds-parallelization-gate.md +246 -0
  787. package/pro/squads/design/tasks/ds-query.md +90 -0
  788. package/pro/squads/design/tasks/ds-rebuild-artifact.md +369 -0
  789. package/pro/squads/design/tasks/ds-reverse-engineer.md +194 -0
  790. package/pro/squads/design/tasks/ds-scan-artifact.md +131 -0
  791. package/pro/squads/design/tasks/ds-setup-design-system.md +297 -0
  792. package/pro/squads/design/tasks/ds-sync-registry.md +287 -0
  793. package/pro/squads/design/tasks/ds-theme-multi-brand.md +90 -0
  794. package/pro/squads/design/tasks/ds-token-modes.md +108 -0
  795. package/pro/squads/design/tasks/ds-token-w3c-extract.md +105 -0
  796. package/pro/squads/design/tasks/ds-validate-ai-readiness.md +69 -0
  797. package/pro/squads/design/tasks/ds-visual-regression.md +130 -0
  798. package/pro/squads/design/tasks/execute-checklist.md +141 -0
  799. package/pro/squads/design/tasks/export-design-tokens-dtcg.md +97 -0
  800. package/pro/squads/design/tasks/f1-apply-foundations.md +154 -0
  801. package/pro/squads/design/tasks/f1-ingest-figma-tokens.md +130 -0
  802. package/pro/squads/design/tasks/f1-map-tokens-to-shadcn.md +145 -0
  803. package/pro/squads/design/tasks/f1-qa-foundations.md +95 -0
  804. package/pro/squads/design/tasks/f2-adapt-shadcn-components.md +155 -0
  805. package/pro/squads/design/tasks/f2-ingest-base-components.md +148 -0
  806. package/pro/squads/design/tasks/f2-qa-base-components.md +98 -0
  807. package/pro/squads/design/tasks/f3-derive-components.md +145 -0
  808. package/pro/squads/design/tasks/f3-qa-derived-components.md +101 -0
  809. package/pro/squads/design/tasks/focus-order-audit.md +450 -0
  810. package/pro/squads/design/tasks/sb-brownfield-migrate.md +367 -0
  811. package/pro/squads/design/tasks/sb-brownfield-scan.md +318 -0
  812. package/pro/squads/design/tasks/sb-configure.md +230 -0
  813. package/pro/squads/design/tasks/sb-expand-shadcn.md +213 -0
  814. package/pro/squads/design/tasks/sb-generate-all-stories.md +288 -0
  815. package/pro/squads/design/tasks/sb-install.md +152 -0
  816. package/pro/squads/design/tasks/sb-sync-workspace.md +239 -0
  817. package/pro/squads/design/tasks/sb-verify.md +203 -0
  818. package/pro/squads/design/tasks/tailwind-upgrade.md +117 -0
  819. package/pro/squads/design/tasks/token-usage-analytics.md +262 -0
  820. package/pro/squads/design/tasks/ux-rewrite-sixth-grade.md +82 -0
  821. package/pro/squads/design/tasks/validate-design-fidelity.md +222 -0
  822. package/pro/squads/design/templates/agent-template.yaml +46 -0
  823. package/pro/squads/design/templates/clone-mind-template.md +352 -0
  824. package/pro/squads/design/templates/component-prompt-injection-tmpl.md +236 -0
  825. package/pro/squads/design/templates/component-visual-spec-tmpl.md +378 -0
  826. package/pro/squads/design/templates/critical-eye-cycle-report-tmpl.md +165 -0
  827. package/pro/squads/design/templates/design-fidelity-report-tmpl.md +155 -0
  828. package/pro/squads/design/templates/ds-ai-component-metadata-schema-tmpl.json +138 -0
  829. package/pro/squads/design/templates/ds-artifact-analysis.md +70 -0
  830. package/pro/squads/design/templates/ds-health-report-tmpl.md +236 -0
  831. package/pro/squads/design/templates/ds-migration-strategy-tmpl.md +524 -0
  832. package/pro/squads/design/templates/ds-state-persistence-tmpl.yaml +194 -0
  833. package/pro/squads/design/templates/ds-tokens-schema-tmpl.yaml +139 -0
  834. package/pro/squads/design/templates/migration-strategy-tmpl.md +524 -0
  835. package/pro/squads/design/templates/reading-design-tokens.css +26 -0
  836. package/pro/squads/design/templates/state-persistence-tmpl.yaml +219 -0
  837. package/pro/squads/design/templates/tokens-schema-tmpl.yaml +305 -0
  838. package/pro/squads/design/workflows/agentic-readiness.yaml +83 -0
  839. package/pro/squads/design/workflows/audit-only.yaml +198 -0
  840. package/pro/squads/design/workflows/brownfield-complete.yaml +257 -0
  841. package/pro/squads/design/workflows/critical-eye.yaml +184 -0
  842. package/pro/squads/design/workflows/dtcg-tokens-governance.yaml +64 -0
  843. package/pro/squads/design/workflows/foundations-pipeline.yaml +192 -0
  844. package/pro/squads/design/workflows/greenfield-new.yaml +192 -0
  845. package/pro/squads/design/workflows/motion-quality.yaml +65 -0
  846. package/pro/squads/design/workflows/self-healing-workflow.yaml +237 -0
  847. package/pro/squads/design/workflows/storybook-brownfield-migration.yaml +400 -0
  848. package/pro/squads/design/workflows/storybook-full-setup.yaml +280 -0
  849. package/pro/squads/etl-ops/HEADLINE.md +3 -0
  850. package/pro/squads/etl-ops/README.md +121 -0
  851. package/pro/squads/etl-ops/agents/etl-chief.md +440 -0
  852. package/pro/squads/etl-ops/agents/etl-extractor.md +352 -0
  853. package/pro/squads/etl-ops/agents/etl-transformer.md +409 -0
  854. package/pro/squads/etl-ops/checklists/.gitkeep +0 -0
  855. package/pro/squads/etl-ops/checklists/README.md +1 -0
  856. package/pro/squads/etl-ops/config.yaml +405 -0
  857. package/pro/squads/etl-ops/data/checkpoints.yaml +92 -0
  858. package/pro/squads/etl-ops/data/enriched-transcript.schema.json +107 -0
  859. package/pro/squads/etl-ops/data/infrastructure-map.yaml +27 -0
  860. package/pro/squads/etl-ops/data/output-contract.yaml +85 -0
  861. package/pro/squads/etl-ops/data/process.schema.json +293 -0
  862. package/pro/squads/etl-ops/data/quality-gates.yaml +40 -0
  863. package/pro/squads/etl-ops/data/routing-profiles.yaml +239 -0
  864. package/pro/squads/etl-ops/data/service-catalog.yaml +13 -0
  865. package/pro/squads/etl-ops/data/token-registry.yaml +58 -0
  866. package/pro/squads/etl-ops/docs/.gitkeep +0 -0
  867. package/pro/squads/etl-ops/scripts/bootstrap-etl-workspace.sh +42 -0
  868. package/pro/squads/etl-ops/scripts/etl-env-bootstrap.sh +876 -0
  869. package/pro/squads/etl-ops/scripts/validate-etl-essentials.sh +164 -0
  870. package/pro/squads/etl-ops/squad-io.yaml +61 -0
  871. package/pro/squads/etl-ops/tasks/compile.md +191 -0
  872. package/pro/squads/etl-ops/tasks/enrich.md +236 -0
  873. package/pro/squads/etl-ops/tasks/etl-env-bootstrap.md +140 -0
  874. package/pro/squads/etl-ops/tasks/extract-keyframes.md +318 -0
  875. package/pro/squads/etl-ops/tasks/extract-podcast.md +146 -0
  876. package/pro/squads/etl-ops/tasks/load-workspace-context.md +140 -0
  877. package/pro/squads/etl-ops/tasks/process.md +185 -0
  878. package/pro/squads/etl-ops/tasks/summarize-book.md +121 -0
  879. package/pro/squads/etl-ops/templates/cross-domain-handoff-tmpl.yaml +9 -0
  880. package/pro/squads/etl-ops/workflows/etl-pipeline.yaml +25 -0
  881. package/pro/squads/etl-ops/workflows/etl-thresholds.yaml +15 -0
  882. package/pro/squads/hormozi/HEADLINE.md +3 -0
  883. package/pro/squads/hormozi/README.md +313 -0
  884. package/pro/squads/hormozi/agents/hormozi-ads.md +1863 -0
  885. package/pro/squads/hormozi/agents/hormozi-advisor.md +1866 -0
  886. package/pro/squads/hormozi/agents/hormozi-audit.md +2301 -0
  887. package/pro/squads/hormozi/agents/hormozi-chief.md +1671 -0
  888. package/pro/squads/hormozi/agents/hormozi-closer.md +2631 -0
  889. package/pro/squads/hormozi/agents/hormozi-content.md +2148 -0
  890. package/pro/squads/hormozi/agents/hormozi-copy.md +2000 -0
  891. package/pro/squads/hormozi/agents/hormozi-hooks.md +1790 -0
  892. package/pro/squads/hormozi/agents/hormozi-launch.md +1734 -0
  893. package/pro/squads/hormozi/agents/hormozi-leads.md +1022 -0
  894. package/pro/squads/hormozi/agents/hormozi-models.md +1429 -0
  895. package/pro/squads/hormozi/agents/hormozi-offers.md +2228 -0
  896. package/pro/squads/hormozi/agents/hormozi-pricing.md +1784 -0
  897. package/pro/squads/hormozi/agents/hormozi-retention.md +1467 -0
  898. package/pro/squads/hormozi/agents/hormozi-scale.md +2312 -0
  899. package/pro/squads/hormozi/agents/hormozi-workshop.md +2715 -0
  900. package/pro/squads/hormozi/checklists/5-horsemen-checklist.md +188 -0
  901. package/pro/squads/hormozi/checklists/activation-point-checklist.md +156 -0
  902. package/pro/squads/hormozi/checklists/ad-angles-checklist.md +395 -0
  903. package/pro/squads/hormozi/checklists/affiliates-referrals-checklist.md +411 -0
  904. package/pro/squads/hormozi/checklists/antipattern-screening.md +319 -0
  905. package/pro/squads/hormozi/checklists/bonuses-checklist.md +282 -0
  906. package/pro/squads/hormozi/checklists/branding-checklist.md +547 -0
  907. package/pro/squads/hormozi/checklists/churn-diagnosis-checklist.md +148 -0
  908. package/pro/squads/hormozi/checklists/content-creation-checklist.md +598 -0
  909. package/pro/squads/hormozi/checklists/core-four-checklist.md +543 -0
  910. package/pro/squads/hormozi/checklists/customer-journey-checklist.md +207 -0
  911. package/pro/squads/hormozi/checklists/downsell-strategy-checklist.md +306 -0
  912. package/pro/squads/hormozi/checklists/email-campaign-checklist.md +484 -0
  913. package/pro/squads/hormozi/checklists/engagement-scoring-checklist.md +227 -0
  914. package/pro/squads/hormozi/checklists/exit-interview-checklist.md +206 -0
  915. package/pro/squads/hormozi/checklists/fast-cash-checklist.md +434 -0
  916. package/pro/squads/hormozi/checklists/goated-ads-checklist.md +558 -0
  917. package/pro/squads/hormozi/checklists/golden-ratios-veto.md +340 -0
  918. package/pro/squads/hormozi/checklists/guarantees-checklist.md +312 -0
  919. package/pro/squads/hormozi/checklists/hooks-checklist.md +621 -0
  920. package/pro/squads/hormozi/checklists/landing-page-checklist.md +514 -0
  921. package/pro/squads/hormozi/checklists/launch-checklist.md +1033 -0
  922. package/pro/squads/hormozi/checklists/lead-magnet-checklist.md +421 -0
  923. package/pro/squads/hormozi/checklists/lead-nurture-checklist.md +730 -0
  924. package/pro/squads/hormozi/checklists/ltv-checklist.md +953 -0
  925. package/pro/squads/hormozi/checklists/market-validation-veto.md +248 -0
  926. package/pro/squads/hormozi/checklists/marketing-machine-checklist.md +570 -0
  927. package/pro/squads/hormozi/checklists/money-model-checklist.md +226 -0
  928. package/pro/squads/hormozi/checklists/naming-framework-checklist.md +325 -0
  929. package/pro/squads/hormozi/checklists/offer-architecture-checklist.md +542 -0
  930. package/pro/squads/hormozi/checklists/onboarding-30-day-checklist.md +223 -0
  931. package/pro/squads/hormozi/checklists/price-raise-checklist.md +399 -0
  932. package/pro/squads/hormozi/checklists/pricing-checklist.md +228 -0
  933. package/pro/squads/hormozi/checklists/pricing-framework-checklist.md +627 -0
  934. package/pro/squads/hormozi/checklists/registration-page-checklist.md +429 -0
  935. package/pro/squads/hormozi/checklists/retention-checklist.md +977 -0
  936. package/pro/squads/hormozi/checklists/sales-page-checklist.md +682 -0
  937. package/pro/squads/hormozi/checklists/scarcity-urgency-checklist.md +423 -0
  938. package/pro/squads/hormozi/checklists/subscription-model-checklist.md +342 -0
  939. package/pro/squads/hormozi/checklists/upsell-page-checklist.md +374 -0
  940. package/pro/squads/hormozi/checklists/upsell-sequence-checklist.md +217 -0
  941. package/pro/squads/hormozi/checklists/upsell-strategy-checklist.md +424 -0
  942. package/pro/squads/hormozi/checklists/value-equation-checklist.md +387 -0
  943. package/pro/squads/hormozi/checklists/vsl-script-checklist.md +464 -0
  944. package/pro/squads/hormozi/checklists/workshop-launch-checklist.md +585 -0
  945. package/pro/squads/hormozi/config/veto-conditions.yaml +324 -0
  946. package/pro/squads/hormozi/config.yaml +617 -0
  947. package/pro/squads/hormozi/data/antipatterns-database.yaml +402 -0
  948. package/pro/squads/hormozi/data/hormozi-case-library.yaml +469 -0
  949. package/pro/squads/hormozi/data/hormozi-infrastructure-map.yaml +16 -0
  950. package/pro/squads/hormozi/data/hormozi-service-catalog.yaml +14 -0
  951. package/pro/squads/hormozi/data/minds/hormozi-ads_dna.yaml +75 -0
  952. package/pro/squads/hormozi/data/minds/hormozi-advisor_dna.yaml +112 -0
  953. package/pro/squads/hormozi/data/minds/hormozi-audit_dna.yaml +124 -0
  954. package/pro/squads/hormozi/data/minds/hormozi-closer_dna.yaml +109 -0
  955. package/pro/squads/hormozi/data/minds/hormozi-content_dna.yaml +112 -0
  956. package/pro/squads/hormozi/data/minds/hormozi-copy_dna.yaml +115 -0
  957. package/pro/squads/hormozi/data/minds/hormozi-hooks_dna.yaml +134 -0
  958. package/pro/squads/hormozi/data/minds/hormozi-launch_dna.yaml +122 -0
  959. package/pro/squads/hormozi/data/minds/hormozi-leads_dna.yaml +64 -0
  960. package/pro/squads/hormozi/data/minds/hormozi-models_dna.yaml +111 -0
  961. package/pro/squads/hormozi/data/minds/hormozi-offers_dna.yaml +100 -0
  962. package/pro/squads/hormozi/data/minds/hormozi-pricing_dna.yaml +129 -0
  963. package/pro/squads/hormozi/data/minds/hormozi-retention_dna.yaml +120 -0
  964. package/pro/squads/hormozi/data/minds/hormozi-scale_dna.yaml +112 -0
  965. package/pro/squads/hormozi/data/minds/hormozi-thinking-dna.yaml +421 -0
  966. package/pro/squads/hormozi/data/minds/hormozi-voice-dna.yaml +548 -0
  967. package/pro/squads/hormozi/data/minds/hormozi-workshop_dna.yaml +109 -0
  968. package/pro/squads/hormozi/data/quality-gates.yaml +76 -0
  969. package/pro/squads/hormozi/data/scaling-by-business-type.yaml +166 -0
  970. package/pro/squads/hormozi/data/source-index.yaml +215 -0
  971. package/pro/squads/hormozi/data/swipefiles/ads-swipefile.yaml +378 -0
  972. package/pro/squads/hormozi/data/swipefiles/blueprint-swipefile.yaml +1223 -0
  973. package/pro/squads/hormozi/data/swipefiles/branding-swipefile.yaml +142 -0
  974. package/pro/squads/hormozi/data/swipefiles/closing-swipefile.yaml +716 -0
  975. package/pro/squads/hormozi/data/swipefiles/content-swipefile.yaml +579 -0
  976. package/pro/squads/hormozi/data/swipefiles/copy-sales-swipefile.yaml +1085 -0
  977. package/pro/squads/hormozi/data/swipefiles/fast-cash-swipefile.yaml +190 -0
  978. package/pro/squads/hormozi/data/swipefiles/goated-ads-swipefile.yaml +770 -0
  979. package/pro/squads/hormozi/data/swipefiles/hooks-swipefile.yaml +1982 -0
  980. package/pro/squads/hormozi/data/swipefiles/lead-nurture-swipefile.yaml +191 -0
  981. package/pro/squads/hormozi/data/swipefiles/ltv-swipefile.yaml +216 -0
  982. package/pro/squads/hormozi/data/swipefiles/marketing-machine-swipefile.yaml +191 -0
  983. package/pro/squads/hormozi/data/swipefiles/naming-swipefile-brasil.yaml +596 -0
  984. package/pro/squads/hormozi/data/swipefiles/naming-swipefile-global.yaml +543 -0
  985. package/pro/squads/hormozi/data/swipefiles/price-raise-swipefile.yaml +213 -0
  986. package/pro/squads/hormozi/data/swipefiles/pricing-swipefile.yaml +203 -0
  987. package/pro/squads/hormozi/data/swipefiles/proof-swipefile.yaml +443 -0
  988. package/pro/squads/hormozi/data/swipefiles/retention-swipefile.yaml +245 -0
  989. package/pro/squads/hormozi/data/swipefiles/scaling-roadmap-swipefile.yaml +529 -0
  990. package/pro/squads/hormozi/data/swipefiles/workshop-launch-swipefile.yaml +912 -0
  991. package/pro/squads/hormozi/data/token-registry.yaml +89 -0
  992. package/pro/squads/hormozi/docs/MIGRATION-PLAN-AGENT-CONFORMITY.md +326 -0
  993. package/pro/squads/hormozi/docs/frameworks/100m-offers-framework.md +363 -0
  994. package/pro/squads/hormozi/docs/frameworks/attraction-offers-framework.md +720 -0
  995. package/pro/squads/hormozi/docs/frameworks/bonuses-framework.md +501 -0
  996. package/pro/squads/hormozi/docs/frameworks/core-four-framework.md +685 -0
  997. package/pro/squads/hormozi/docs/frameworks/goated-ads-framework.md +916 -0
  998. package/pro/squads/hormozi/docs/frameworks/guarantees-framework.md +709 -0
  999. package/pro/squads/hormozi/docs/frameworks/hooks-framework.md +1007 -0
  1000. package/pro/squads/hormozi/docs/frameworks/lead-magnet-framework.md +485 -0
  1001. package/pro/squads/hormozi/docs/frameworks/money-models-framework.md +891 -0
  1002. package/pro/squads/hormozi/docs/frameworks/scarcity-framework.md +793 -0
  1003. package/pro/squads/hormozi/docs/frameworks/urgency-framework.md +533 -0
  1004. package/pro/squads/hormozi/docs/frameworks/value-equation-framework.md +428 -0
  1005. package/pro/squads/hormozi/docs/frameworks/workshop-framework.md +289 -0
  1006. package/pro/squads/hormozi/docs/sops/.parallel-execution-plan-batch2.md +344 -0
  1007. package/pro/squads/hormozi/docs/sops/.parallel-execution-plan-batch3.md +331 -0
  1008. package/pro/squads/hormozi/docs/sops/.parallel-execution-plan.md +558 -0
  1009. package/pro/squads/hormozi/docs/sops/ad-angles-sop.md +1247 -0
  1010. package/pro/squads/hormozi/docs/sops/ad-angles-squad-blueprint.yaml +739 -0
  1011. package/pro/squads/hormozi/docs/sops/affiliates-referrals-sop.md +1105 -0
  1012. package/pro/squads/hormozi/docs/sops/affiliates-referrals-squad-blueprint.yaml +1131 -0
  1013. package/pro/squads/hormozi/docs/sops/bonuses-sop.md +1014 -0
  1014. package/pro/squads/hormozi/docs/sops/bonuses-squad-blueprint.yaml +994 -0
  1015. package/pro/squads/hormozi/docs/sops/branding-sop.md +870 -0
  1016. package/pro/squads/hormozi/docs/sops/branding-squad-blueprint.yaml +1107 -0
  1017. package/pro/squads/hormozi/docs/sops/content-creation-sop.md +877 -0
  1018. package/pro/squads/hormozi/docs/sops/content-creation-squad-blueprint.yaml +1362 -0
  1019. package/pro/squads/hormozi/docs/sops/core-four-sop.md +1231 -0
  1020. package/pro/squads/hormozi/docs/sops/core-four-squad-blueprint.yaml +1205 -0
  1021. package/pro/squads/hormozi/docs/sops/downsell-strategy-sop.md +832 -0
  1022. package/pro/squads/hormozi/docs/sops/downsell-strategy-squad-blueprint.yaml +1230 -0
  1023. package/pro/squads/hormozi/docs/sops/email-campaign-sop.md +1547 -0
  1024. package/pro/squads/hormozi/docs/sops/email-campaign-squad-blueprint.yaml +1150 -0
  1025. package/pro/squads/hormozi/docs/sops/fast-cash-sop.md +1224 -0
  1026. package/pro/squads/hormozi/docs/sops/fast-cash-squad-blueprint.yaml +1128 -0
  1027. package/pro/squads/hormozi/docs/sops/goated-ads-sop.md +671 -0
  1028. package/pro/squads/hormozi/docs/sops/goated-ads-squad-blueprint.yaml +627 -0
  1029. package/pro/squads/hormozi/docs/sops/guarantees-sop.md +1017 -0
  1030. package/pro/squads/hormozi/docs/sops/guarantees-squad-blueprint.yaml +1252 -0
  1031. package/pro/squads/hormozi/docs/sops/hooks-sop.md +958 -0
  1032. package/pro/squads/hormozi/docs/sops/hooks-squad-blueprint.yaml +740 -0
  1033. package/pro/squads/hormozi/docs/sops/landing-page-sop.md +1079 -0
  1034. package/pro/squads/hormozi/docs/sops/landing-page-squad-blueprint.yaml +1373 -0
  1035. package/pro/squads/hormozi/docs/sops/launch-sop.md +1055 -0
  1036. package/pro/squads/hormozi/docs/sops/launch-squad-blueprint.yaml +1276 -0
  1037. package/pro/squads/hormozi/docs/sops/lead-magnet-sop.md +807 -0
  1038. package/pro/squads/hormozi/docs/sops/lead-magnet-squad-blueprint.yaml +1144 -0
  1039. package/pro/squads/hormozi/docs/sops/lead-nurture-sop.md +867 -0
  1040. package/pro/squads/hormozi/docs/sops/lead-nurture-squad-blueprint.yaml +1168 -0
  1041. package/pro/squads/hormozi/docs/sops/ltv-sop.md +897 -0
  1042. package/pro/squads/hormozi/docs/sops/ltv-squad-blueprint.yaml +1286 -0
  1043. package/pro/squads/hormozi/docs/sops/marketing-machine-sop.md +1257 -0
  1044. package/pro/squads/hormozi/docs/sops/marketing-machine-squad-blueprint.yaml +1433 -0
  1045. package/pro/squads/hormozi/docs/sops/naming-framework-sop.md +1006 -0
  1046. package/pro/squads/hormozi/docs/sops/naming-framework-squad-blueprint.yaml +543 -0
  1047. package/pro/squads/hormozi/docs/sops/offer-architecture-sop.md +843 -0
  1048. package/pro/squads/hormozi/docs/sops/offer-architecture-squad-blueprint.yaml +794 -0
  1049. package/pro/squads/hormozi/docs/sops/price-raise-sop.md +983 -0
  1050. package/pro/squads/hormozi/docs/sops/price-raise-squad-blueprint.yaml +919 -0
  1051. package/pro/squads/hormozi/docs/sops/pricing-framework-sop.md +459 -0
  1052. package/pro/squads/hormozi/docs/sops/pricing-squad-blueprint.yaml +517 -0
  1053. package/pro/squads/hormozi/docs/sops/registration-page-sop.md +1111 -0
  1054. package/pro/squads/hormozi/docs/sops/registration-page-squad-blueprint.yaml +762 -0
  1055. package/pro/squads/hormozi/docs/sops/retention-sop.md +1065 -0
  1056. package/pro/squads/hormozi/docs/sops/retention-squad-blueprint.yaml +1356 -0
  1057. package/pro/squads/hormozi/docs/sops/sales-page-sop.md +924 -0
  1058. package/pro/squads/hormozi/docs/sops/sales-page-squad-blueprint.yaml +1096 -0
  1059. package/pro/squads/hormozi/docs/sops/scarcity-urgency-sop.md +1092 -0
  1060. package/pro/squads/hormozi/docs/sops/scarcity-urgency-squad-blueprint.yaml +1206 -0
  1061. package/pro/squads/hormozi/docs/sops/subscription-model-sop.md +1077 -0
  1062. package/pro/squads/hormozi/docs/sops/subscription-model-squad-blueprint.yaml +1007 -0
  1063. package/pro/squads/hormozi/docs/sops/upsell-page-sop.md +886 -0
  1064. package/pro/squads/hormozi/docs/sops/upsell-page-squad-blueprint.yaml +1100 -0
  1065. package/pro/squads/hormozi/docs/sops/upsell-strategy-sop.md +1265 -0
  1066. package/pro/squads/hormozi/docs/sops/upsell-strategy-squad-blueprint.yaml +1245 -0
  1067. package/pro/squads/hormozi/docs/sops/value-equation-sop.md +793 -0
  1068. package/pro/squads/hormozi/docs/sops/value-equation-squad-blueprint.yaml +777 -0
  1069. package/pro/squads/hormozi/docs/sops/vsl-script-sop.md +1145 -0
  1070. package/pro/squads/hormozi/docs/sops/vsl-script-squad-blueprint.yaml +777 -0
  1071. package/pro/squads/hormozi/docs/sops/workshop-launch-sop.md +1273 -0
  1072. package/pro/squads/hormozi/docs/sops/workshop-launch-squad-blueprint.yaml +1292 -0
  1073. package/pro/squads/hormozi/docs/validation-report-2026-02-10.md +79 -0
  1074. package/pro/squads/hormozi/scripts/generate-hormozi-greeting.cjs +132 -0
  1075. package/pro/squads/hormozi/scripts/load-context.cjs +139 -0
  1076. package/pro/squads/hormozi/scripts/resolve-readiness.cjs +45 -0
  1077. package/pro/squads/hormozi/scripts/runtime-paths.cjs +44 -0
  1078. package/pro/squads/hormozi/scripts/set-active-context.cjs +104 -0
  1079. package/pro/squads/hormozi/scripts/show-context.cjs +22 -0
  1080. package/pro/squads/hormozi/scripts/validate-antipattern.py +287 -0
  1081. package/pro/squads/hormozi/scripts/validate-handoff.py +166 -0
  1082. package/pro/squads/hormozi/scripts/validate-mvn.py +198 -0
  1083. package/pro/squads/hormozi/sops/pricing-squad-blueprint.yaml +1445 -0
  1084. package/pro/squads/hormozi/squad-io.yaml +917 -0
  1085. package/pro/squads/hormozi/tasks/architect-offer-stack.md +228 -0
  1086. package/pro/squads/hormozi/tasks/build-marketing-machine.md +205 -0
  1087. package/pro/squads/hormozi/tasks/build-scaling-team.md +271 -0
  1088. package/pro/squads/hormozi/tasks/calculate-30-day-profit.md +418 -0
  1089. package/pro/squads/hormozi/tasks/calculate-ppd.md +200 -0
  1090. package/pro/squads/hormozi/tasks/create-ad-angles.md +182 -0
  1091. package/pro/squads/hormozi/tasks/create-ad-campaign.md +399 -0
  1092. package/pro/squads/hormozi/tasks/create-bonus-stack.md +287 -0
  1093. package/pro/squads/hormozi/tasks/create-closer-script.md +240 -0
  1094. package/pro/squads/hormozi/tasks/create-content-unit.md +176 -0
  1095. package/pro/squads/hormozi/tasks/create-contingency-plan.md +426 -0
  1096. package/pro/squads/hormozi/tasks/create-downsell-sequence.md +427 -0
  1097. package/pro/squads/hormozi/tasks/create-email-sequence.md +196 -0
  1098. package/pro/squads/hormozi/tasks/create-engagement-scoring.md +484 -0
  1099. package/pro/squads/hormozi/tasks/create-exit-interview-system.md +382 -0
  1100. package/pro/squads/hormozi/tasks/create-grand-slam-offer.md +499 -0
  1101. package/pro/squads/hormozi/tasks/create-guarantee-stack.md +246 -0
  1102. package/pro/squads/hormozi/tasks/create-hook-set.md +368 -0
  1103. package/pro/squads/hormozi/tasks/create-landing-page.md +130 -0
  1104. package/pro/squads/hormozi/tasks/create-launch-narrative.md +406 -0
  1105. package/pro/squads/hormozi/tasks/create-launch-timeline.md +473 -0
  1106. package/pro/squads/hormozi/tasks/create-lead-magnet.md +479 -0
  1107. package/pro/squads/hormozi/tasks/create-nurture-sequence.md +207 -0
  1108. package/pro/squads/hormozi/tasks/create-offer-name.md +165 -0
  1109. package/pro/squads/hormozi/tasks/create-pricing-strategy.md +177 -0
  1110. package/pro/squads/hormozi/tasks/create-registration-page.md +190 -0
  1111. package/pro/squads/hormozi/tasks/create-sales-page.md +157 -0
  1112. package/pro/squads/hormozi/tasks/create-upsell-page.md +138 -0
  1113. package/pro/squads/hormozi/tasks/create-upsell-sequence.md +449 -0
  1114. package/pro/squads/hormozi/tasks/create-vsl-script.md +175 -0
  1115. package/pro/squads/hormozi/tasks/design-brand-identity.md +186 -0
  1116. package/pro/squads/hormozi/tasks/design-continuity-offer.md +462 -0
  1117. package/pro/squads/hormozi/tasks/design-core-four-strategy.md +733 -0
  1118. package/pro/squads/hormozi/tasks/design-customer-journey.md +426 -0
  1119. package/pro/squads/hormozi/tasks/design-launch-value-stack.md +379 -0
  1120. package/pro/squads/hormozi/tasks/design-money-model.md +391 -0
  1121. package/pro/squads/hormozi/tasks/design-onboarding-sequence.md +380 -0
  1122. package/pro/squads/hormozi/tasks/design-scarcity-urgency.md +216 -0
  1123. package/pro/squads/hormozi/tasks/design-subscription-model.md +162 -0
  1124. package/pro/squads/hormozi/tasks/design-systems-automation.md +234 -0
  1125. package/pro/squads/hormozi/tasks/design-workshop.md +167 -0
  1126. package/pro/squads/hormozi/tasks/diagnose-business-stage.md +323 -0
  1127. package/pro/squads/hormozi/tasks/diagnose-cfa-level.md +198 -0
  1128. package/pro/squads/hormozi/tasks/diagnose-churn-rate.md +265 -0
  1129. package/pro/squads/hormozi/tasks/diagnose-scaling-constraint.md +257 -0
  1130. package/pro/squads/hormozi/tasks/diagnose-value-equation.md +431 -0
  1131. package/pro/squads/hormozi/tasks/discover-activation-points.md +329 -0
  1132. package/pro/squads/hormozi/tasks/execute-price-raise.md +221 -0
  1133. package/pro/squads/hormozi/tasks/execute-rule-of-100.md +423 -0
  1134. package/pro/squads/hormozi/tasks/generate-fast-cash.md +217 -0
  1135. package/pro/squads/hormozi/tasks/implement-5-horsemen.md +430 -0
  1136. package/pro/squads/hormozi/tasks/optimize-ltv-cac-ratio.md +505 -0
  1137. package/pro/squads/hormozi/tasks/plan-launch-evento.md +395 -0
  1138. package/pro/squads/hormozi/tasks/run-launch-post-mortem.md +461 -0
  1139. package/pro/squads/hormozi/tasks/setup-affiliate-program.md +406 -0
  1140. package/pro/squads/hormozi/tasks/setup-war-room.md +407 -0
  1141. package/pro/squads/hormozi/tasks/validate-market-selection.md +331 -0
  1142. package/pro/squads/hormozi/templates/capacity-planning-worksheet.yaml +151 -0
  1143. package/pro/squads/hormozi/templates/grand-slam-offer-output.yaml +462 -0
  1144. package/pro/squads/hormozi/templates/grand-slam-offer-tmpl.md +34 -0
  1145. package/pro/squads/hormozi/templates/handoff-context-tmpl.yaml +215 -0
  1146. package/pro/squads/hormozi/templates/money-model-tmpl.md +29 -0
  1147. package/pro/squads/hormozi/templates/offer-analysis-tmpl.md +33 -0
  1148. package/pro/squads/hormozi/templates/value-equation-scorecard.md +267 -0
  1149. package/pro/squads/hormozi/workflows/wf-context-diagnosis.yaml +569 -0
  1150. package/pro/squads/hormozi/workflows/wf-full-launch-sequence.yaml +995 -0
  1151. package/pro/squads/hormozi/workflows/wf-grand-slam-offer.yaml +1138 -0
  1152. package/pro/squads/hormozi/workflows/wf-growth-decision.yaml +135 -0
  1153. package/pro/squads/hormozi/workflows/wf-lead-magnet-pipeline.yaml +1147 -0
  1154. package/pro/squads/hormozi/workflows/wf-money-model-design.yaml +1168 -0
  1155. package/pro/squads/hormozi/workflows/wf-opportunity-screening.yaml +511 -0
  1156. package/pro/squads/hormozi/workflows/wf-paid-ads-campaign.yaml +1204 -0
  1157. package/pro/squads/hormozi/workflows/wf-scaling-diagnostic.yaml +636 -0
  1158. package/pro/squads/index.js +145 -0
  1159. package/pro/squads/spy/HEADLINE.md +3 -0
  1160. package/pro/squads/spy/README.md +115 -0
  1161. package/pro/squads/spy/agents/bench-analyst.md +654 -0
  1162. package/pro/squads/spy/agents/research-head.md +673 -0
  1163. package/pro/squads/spy/agents/spy.md +498 -0
  1164. package/pro/squads/spy/checklists/bench-quality-checklist.md +119 -0
  1165. package/pro/squads/spy/checklists/content-creation-checklist.md +136 -0
  1166. package/pro/squads/spy/config.yaml +587 -0
  1167. package/pro/squads/spy/data/bench-data-sources.yaml +46 -0
  1168. package/pro/squads/spy/data/bench-dimension-packs.yaml +182 -0
  1169. package/pro/squads/spy/data/bench-output-formats.yaml +44 -0
  1170. package/pro/squads/spy/data/bench-skeleton.md +184 -0
  1171. package/pro/squads/spy/data/capability-tools.yaml +109 -0
  1172. package/pro/squads/spy/data/knowledge-base.md +337 -0
  1173. package/pro/squads/spy/data/quality-gates.yaml +48 -0
  1174. package/pro/squads/spy/data/spy-infrastructure-map.yaml +27 -0
  1175. package/pro/squads/spy/data/spy-service-catalog.yaml +13 -0
  1176. package/pro/squads/spy/data/token-registry.yaml +57 -0
  1177. package/pro/squads/spy/data/viral-content-framework.md +304 -0
  1178. package/pro/squads/spy/docs/tool-discovery-report.md +110 -0
  1179. package/pro/squads/spy/docs/tool-integration-plan.md +47 -0
  1180. package/pro/squads/spy/scripts/prepare-benchmark-workspace.sh +14 -0
  1181. package/pro/squads/spy/scripts/publish-benchmark-report.sh +16 -0
  1182. package/pro/squads/spy/squad-io.yaml +24 -0
  1183. package/pro/squads/spy/tasks/bench-absorb.md +266 -0
  1184. package/pro/squads/spy/tasks/bench-battle-card.md +398 -0
  1185. package/pro/squads/spy/tasks/bench-codebase-recon.md +339 -0
  1186. package/pro/squads/spy/tasks/bench-company-intel.md +360 -0
  1187. package/pro/squads/spy/tasks/bench-deep-compare.md +573 -0
  1188. package/pro/squads/spy/tasks/bench-detect.md +349 -0
  1189. package/pro/squads/spy/tasks/bench-framework.md +105 -0
  1190. package/pro/squads/spy/tasks/bench-gap-analysis.md +168 -0
  1191. package/pro/squads/spy/tasks/bench-gap-company.md +48 -0
  1192. package/pro/squads/spy/tasks/bench-gap-llm.md +48 -0
  1193. package/pro/squads/spy/tasks/bench-gap-product.md +48 -0
  1194. package/pro/squads/spy/tasks/bench-gap-technology.md +48 -0
  1195. package/pro/squads/spy/tasks/bench-gap.md +78 -0
  1196. package/pro/squads/spy/tasks/bench-hooks.md +209 -0
  1197. package/pro/squads/spy/tasks/bench-inventory.md +98 -0
  1198. package/pro/squads/spy/tasks/bench-llm-eval.md +359 -0
  1199. package/pro/squads/spy/tasks/bench-matrix-codebase.md +50 -0
  1200. package/pro/squads/spy/tasks/bench-matrix-company.md +50 -0
  1201. package/pro/squads/spy/tasks/bench-matrix-llm.md +50 -0
  1202. package/pro/squads/spy/tasks/bench-matrix-product.md +50 -0
  1203. package/pro/squads/spy/tasks/bench-matrix-technology.md +50 -0
  1204. package/pro/squads/spy/tasks/bench-matrix.md +78 -0
  1205. package/pro/squads/spy/tasks/bench-migrate.md +207 -0
  1206. package/pro/squads/spy/tasks/bench-product-research.md +370 -0
  1207. package/pro/squads/spy/tasks/bench-quick-compare.md +287 -0
  1208. package/pro/squads/spy/tasks/bench-report-load-evidence.md +49 -0
  1209. package/pro/squads/spy/tasks/bench-report-publish.md +49 -0
  1210. package/pro/squads/spy/tasks/bench-report-synthesize-findings.md +48 -0
  1211. package/pro/squads/spy/tasks/bench-report.md +70 -0
  1212. package/pro/squads/spy/tasks/bench-score.md +406 -0
  1213. package/pro/squads/spy/tasks/bench-synergy.md +248 -0
  1214. package/pro/squads/spy/tasks/bench-tech-eval.md +417 -0
  1215. package/pro/squads/spy/tasks/bench-traceability.md +225 -0
  1216. package/pro/squads/spy/tasks/deep-research-collect.md +50 -0
  1217. package/pro/squads/spy/tasks/deep-research-comments.md +48 -0
  1218. package/pro/squads/spy/tasks/deep-research-patterns.md +49 -0
  1219. package/pro/squads/spy/tasks/deep-research-publish.md +49 -0
  1220. package/pro/squads/spy/tasks/deep-research-select.md +48 -0
  1221. package/pro/squads/spy/tasks/deep-research-synthesis.md +49 -0
  1222. package/pro/squads/spy/tasks/deep-research-transcribe.md +48 -0
  1223. package/pro/squads/spy/tasks/deep-research.md +116 -0
  1224. package/pro/squads/spy/tasks/quick-analysis.md +130 -0
  1225. package/pro/squads/spy/templates/bench-battle-card-tmpl.md +52 -0
  1226. package/pro/squads/spy/templates/bench-codebase-comparativo-tmpl.md +84 -0
  1227. package/pro/squads/spy/templates/bench-codebase-scores-tmpl.md +41 -0
  1228. package/pro/squads/spy/templates/bench-comparativo-tmpl.md +86 -0
  1229. package/pro/squads/spy/templates/bench-deep-compare-tmpl.md +117 -0
  1230. package/pro/squads/spy/templates/bench-gap-tmpl.md +194 -0
  1231. package/pro/squads/spy/templates/bench-matrix-tmpl.md +130 -0
  1232. package/pro/squads/spy/templates/bench-migration-tmpl.md +127 -0
  1233. package/pro/squads/spy/templates/bench-quadrant-tmpl.md +227 -0
  1234. package/pro/squads/spy/templates/bench-report-tmpl.md +167 -0
  1235. package/pro/squads/spy/templates/bench-scorecard-tmpl.md +113 -0
  1236. package/pro/squads/spy/templates/bench-scores-tmpl.md +43 -0
  1237. package/pro/squads/spy/templates/bench-synergy-tmpl.md +381 -0
  1238. package/pro/squads/spy/templates/cross-domain-handoff-tmpl.yaml +9 -0
  1239. package/pro/squads/spy/templates/player-analysis-tmpl.md +145 -0
  1240. package/pro/squads/spy/workflows/bench-comparison-pipeline.yaml +1193 -0
  1241. package/pro/squads/squad-creator/CHANGELOG.md +162 -0
  1242. package/pro/squads/squad-creator/HEADLINE.md +3 -0
  1243. package/pro/squads/squad-creator/README.md +1176 -0
  1244. package/pro/squads/squad-creator/agents/squad-chief.md +1449 -0
  1245. package/pro/squads/squad-creator/checklists/agent-quality-gate.md +433 -0
  1246. package/pro/squads/squad-creator/checklists/analysis-quality-checklist.md +70 -0
  1247. package/pro/squads/squad-creator/checklists/create-agent-checklist.md +239 -0
  1248. package/pro/squads/squad-creator/checklists/create-squad-checklist.md +326 -0
  1249. package/pro/squads/squad-creator/checklists/create-task-checklist.md +225 -0
  1250. package/pro/squads/squad-creator/checklists/create-workflow-checklist.md +243 -0
  1251. package/pro/squads/squad-creator/checklists/greeting-script-checklist.md +110 -0
  1252. package/pro/squads/squad-creator/checklists/install-skills-checklist.md +197 -0
  1253. package/pro/squads/squad-creator/checklists/pipeline-runner-checklist.md +135 -0
  1254. package/pro/squads/squad-creator/checklists/report-quality-checklist.md +49 -0
  1255. package/pro/squads/squad-creator/checklists/smoke-test-agent.md +313 -0
  1256. package/pro/squads/squad-creator/checklists/squad-checklist.md +1000 -0
  1257. package/pro/squads/squad-creator/checklists/squad-consistency-patterns.md +134 -0
  1258. package/pro/squads/squad-creator/checklists/squad-overview-checklist.md +381 -0
  1259. package/pro/squads/squad-creator/checklists/squad-structural-completeness.md +394 -0
  1260. package/pro/squads/squad-creator/checklists/task-anatomy-checklist.md +687 -0
  1261. package/pro/squads/squad-creator/checklists/upgrade-squad-checklist.md +222 -0
  1262. package/pro/squads/squad-creator/config/squad-config.yaml +202 -0
  1263. package/pro/squads/squad-creator/config/workflow-yaml-schema.yaml +323 -0
  1264. package/pro/squads/squad-creator/config.yaml +429 -0
  1265. package/pro/squads/squad-creator/data/base-core-contract.yaml +22 -0
  1266. package/pro/squads/squad-creator/data/baselines/ecosystem-baseline.yaml +88 -0
  1267. package/pro/squads/squad-creator/data/baselines/initial-radar.yaml +89 -0
  1268. package/pro/squads/squad-creator/data/best-practices.md +986 -0
  1269. package/pro/squads/squad-creator/data/cc-agent-schema-ref.yaml +405 -0
  1270. package/pro/squads/squad-creator/data/core-heuristics.md +510 -0
  1271. package/pro/squads/squad-creator/data/decision-heuristics-framework.md +695 -0
  1272. package/pro/squads/squad-creator/data/design-heuristics-diagnostic-systems.md +140 -0
  1273. package/pro/squads/squad-creator/data/executor-decision-tree.md +774 -0
  1274. package/pro/squads/squad-creator/data/executor-matrix-framework.md +441 -0
  1275. package/pro/squads/squad-creator/data/hybridops-patterns.md +1351 -0
  1276. package/pro/squads/squad-creator/data/journey-log-events.yaml +72 -0
  1277. package/pro/squads/squad-creator/data/kaizen-legacy/kaizen-infrastructure-map.yaml +16 -0
  1278. package/pro/squads/squad-creator/data/kpi-baseline.yaml +72 -0
  1279. package/pro/squads/squad-creator/data/pipeline-patterns.md +352 -0
  1280. package/pro/squads/squad-creator/data/process-token-map.yaml +225 -0
  1281. package/pro/squads/squad-creator/data/quality-dimensions-framework.md +405 -0
  1282. package/pro/squads/squad-creator/data/quality-gates.yaml +135 -0
  1283. package/pro/squads/squad-creator/data/radar/initial-radar.yaml +76 -0
  1284. package/pro/squads/squad-creator/data/recommendation-tracker.yaml +53 -0
  1285. package/pro/squads/squad-creator/data/reports/self-improve-2026-02-15.md +111 -0
  1286. package/pro/squads/squad-creator/data/reports/week-07-2026-02-15.md +210 -0
  1287. package/pro/squads/squad-creator/data/reports/week-09-2026-02-28.md +295 -0
  1288. package/pro/squads/squad-creator/data/reports/week-14-2026-04-04.md +234 -0
  1289. package/pro/squads/squad-creator/data/squad-analytics-guide.md +252 -0
  1290. package/pro/squads/squad-creator/data/squad-creator-infrastructure-map.yaml +36 -0
  1291. package/pro/squads/squad-creator/data/squad-creator-service-catalog.yaml +17 -0
  1292. package/pro/squads/squad-creator/data/squad-kb.md +987 -0
  1293. package/pro/squads/squad-creator/data/squad-registry.yaml +14 -0
  1294. package/pro/squads/squad-creator/data/squad-type-definitions.yaml +578 -0
  1295. package/pro/squads/squad-creator/data/tier-system-framework.md +475 -0
  1296. package/pro/squads/squad-creator/data/tool-discovery-sources.yaml +68 -0
  1297. package/pro/squads/squad-creator/docs/ADR-001-model-tier-qualification.md +344 -0
  1298. package/pro/squads/squad-creator/docs/AGENT-COLLABORATION.md +820 -0
  1299. package/pro/squads/squad-creator/docs/COMMANDS.md +895 -0
  1300. package/pro/squads/squad-creator/docs/CONCEPTS.md +979 -0
  1301. package/pro/squads/squad-creator/docs/FAQ.md +773 -0
  1302. package/pro/squads/squad-creator/docs/HITL-FLOW.md +406 -0
  1303. package/pro/squads/squad-creator/docs/MODEL-TIER-QUALIFICATION.md +337 -0
  1304. package/pro/squads/squad-creator/docs/PATTERN-LIBRARY.md +620 -0
  1305. package/pro/squads/squad-creator/docs/PEDRO-VALERIO-ARCHITECTURE.md +456 -0
  1306. package/pro/squads/squad-creator/docs/POR-ONDE-COMECAR.md +211 -0
  1307. package/pro/squads/squad-creator/docs/QUICK-START.md +205 -0
  1308. package/pro/squads/squad-creator/docs/TROUBLESHOOTING.md +412 -0
  1309. package/pro/squads/squad-creator/docs/TUTORIAL-COMPLETO.md +458 -0
  1310. package/pro/squads/squad-creator/docs/sop-extraction-process.md +675 -0
  1311. package/pro/squads/squad-creator/docs/squad-free-vs-open.md +596 -0
  1312. package/pro/squads/squad-creator/docs/task-optimization-framework.md +229 -0
  1313. package/pro/squads/squad-creator/package-lock.json +38 -0
  1314. package/pro/squads/squad-creator/package.json +27 -0
  1315. package/pro/squads/squad-creator/protocols/ai-first-governance.md +63 -0
  1316. package/pro/squads/squad-creator/requirements.txt +1 -0
  1317. package/pro/squads/squad-creator/rules/agent-naming-convention.md +58 -0
  1318. package/pro/squads/squad-creator/rules/recommendation-defensibility.md +161 -0
  1319. package/pro/squads/squad-creator/schemas/agent-persona.schema.json +64 -0
  1320. package/pro/squads/squad-creator/schemas/squad-config.schema.json +92 -0
  1321. package/pro/squads/squad-creator/schemas/validation-report.schema.json +158 -0
  1322. package/pro/squads/squad-creator/scripts/README.md +262 -0
  1323. package/pro/squads/squad-creator/scripts/checklist_validator.py +451 -0
  1324. package/pro/squads/squad-creator/scripts/coherence-validator.py +62 -0
  1325. package/pro/squads/squad-creator/scripts/dependency_check.py +341 -0
  1326. package/pro/squads/squad-creator/scripts/detect-environment-contract.cjs +583 -0
  1327. package/pro/squads/squad-creator/scripts/export-antigravity-workflows.cjs +199 -0
  1328. package/pro/squads/squad-creator/scripts/generate-squad-greeting.js +1150 -0
  1329. package/pro/squads/squad-creator/scripts/generate-squad-guide.js +596 -0
  1330. package/pro/squads/squad-creator/scripts/inventory.py +286 -0
  1331. package/pro/squads/squad-creator/scripts/kaizen/kaizen-trigger.sh +126 -0
  1332. package/pro/squads/squad-creator/scripts/lib/config-loader.js +151 -0
  1333. package/pro/squads/squad-creator/scripts/lib/doom-loop-detector.js +120 -0
  1334. package/pro/squads/squad-creator/scripts/lib/squad-runtime-paths.cjs +187 -0
  1335. package/pro/squads/squad-creator/scripts/lib/validate-runtime-state.cjs +271 -0
  1336. package/pro/squads/squad-creator/scripts/naming_validator.py +303 -0
  1337. package/pro/squads/squad-creator/scripts/on-specialist-complete.py +98 -0
  1338. package/pro/squads/squad-creator/scripts/refresh-registry.py +933 -0
  1339. package/pro/squads/squad-creator/scripts/rename-squad.sh +395 -0
  1340. package/pro/squads/squad-creator/scripts/scaffold-squad.cjs +317 -0
  1341. package/pro/squads/squad-creator/scripts/scoring.py +65 -0
  1342. package/pro/squads/squad-creator/scripts/security_scanner.py +378 -0
  1343. package/pro/squads/squad-creator/scripts/squad-analytics.py +810 -0
  1344. package/pro/squads/squad-creator/scripts/squad_utils.py +267 -0
  1345. package/pro/squads/squad-creator/scripts/sync-chief-codex-skill.js +242 -0
  1346. package/pro/squads/squad-creator/scripts/sync-ide-skills.py +705 -0
  1347. package/pro/squads/squad-creator/scripts/tests/__init__.py +1 -0
  1348. package/pro/squads/squad-creator/scripts/tests/test_adapters.py +73 -0
  1349. package/pro/squads/squad-creator/scripts/tests/test_assess_sources.sh +216 -0
  1350. package/pro/squads/squad-creator/scripts/tests/test_clone_review.sh +239 -0
  1351. package/pro/squads/squad-creator/scripts/tests/test_fidelity_score.sh +298 -0
  1352. package/pro/squads/squad-creator/scripts/tests/test_refresh_registry_contract.py +110 -0
  1353. package/pro/squads/squad-creator/scripts/tests/test_squad_analytics.py +332 -0
  1354. package/pro/squads/squad-creator/scripts/tests/test_validate_squad_contextual_lifecycle.py +111 -0
  1355. package/pro/squads/squad-creator/scripts/tests/test_validate_squad_tested_inference.py +102 -0
  1356. package/pro/squads/squad-creator/scripts/tests/test_validate_squad_yolo_warning.py +108 -0
  1357. package/pro/squads/squad-creator/scripts/update-aiox-sync-config.py +144 -0
  1358. package/pro/squads/squad-creator/scripts/update-claude-command-registry.py +171 -0
  1359. package/pro/squads/squad-creator/scripts/validate-all.sh +49 -0
  1360. package/pro/squads/squad-creator/scripts/validate-report.sh +98 -0
  1361. package/pro/squads/squad-creator/scripts/validate-squad-deep.sh +318 -0
  1362. package/pro/squads/squad-creator/scripts/validate-squad-quality.py +514 -0
  1363. package/pro/squads/squad-creator/scripts/validate-squad-structure.py +881 -0
  1364. package/pro/squads/squad-creator/scripts/validate-squad.sh +4340 -0
  1365. package/pro/squads/squad-creator/scripts/validate-tokens.sh +178 -0
  1366. package/pro/squads/squad-creator/scripts/verify-squad-completeness.sh +294 -0
  1367. package/pro/squads/squad-creator/scripts/yaml_validator.py +528 -0
  1368. package/pro/squads/squad-creator/squad-io.yaml +71 -0
  1369. package/pro/squads/squad-creator/tasks/audit-output-quality.md +135 -0
  1370. package/pro/squads/squad-creator/tasks/auto-heal-close.md +134 -0
  1371. package/pro/squads/squad-creator/tasks/auto-heal-resolve.md +128 -0
  1372. package/pro/squads/squad-creator/tasks/auto-heal.md +86 -0
  1373. package/pro/squads/squad-creator/tasks/auto-healing-gate.md +166 -0
  1374. package/pro/squads/squad-creator/tasks/cost-analysis.md +117 -0
  1375. package/pro/squads/squad-creator/tasks/create-agent-commands.md +197 -0
  1376. package/pro/squads/squad-creator/tasks/create-agent-generate.md +224 -0
  1377. package/pro/squads/squad-creator/tasks/create-agent-persona.md +207 -0
  1378. package/pro/squads/squad-creator/tasks/create-agent-publish.md +136 -0
  1379. package/pro/squads/squad-creator/tasks/create-agent-research.md +201 -0
  1380. package/pro/squads/squad-creator/tasks/create-agent-validate.md +213 -0
  1381. package/pro/squads/squad-creator/tasks/create-agent.md +145 -0
  1382. package/pro/squads/squad-creator/tasks/create-documentation.md +284 -0
  1383. package/pro/squads/squad-creator/tasks/create-greeting-script-discovery.md +59 -0
  1384. package/pro/squads/squad-creator/tasks/create-greeting-script-gap-map.md +59 -0
  1385. package/pro/squads/squad-creator/tasks/create-greeting-script-generate.md +60 -0
  1386. package/pro/squads/squad-creator/tasks/create-greeting-script-integrate.md +59 -0
  1387. package/pro/squads/squad-creator/tasks/create-greeting-script-validate.md +59 -0
  1388. package/pro/squads/squad-creator/tasks/create-greeting-script.md +130 -0
  1389. package/pro/squads/squad-creator/tasks/create-pipeline-design.md +143 -0
  1390. package/pro/squads/squad-creator/tasks/create-pipeline-persist.md +100 -0
  1391. package/pro/squads/squad-creator/tasks/create-pipeline-qualify.md +103 -0
  1392. package/pro/squads/squad-creator/tasks/create-pipeline-render.md +296 -0
  1393. package/pro/squads/squad-creator/tasks/create-pipeline-validate.md +121 -0
  1394. package/pro/squads/squad-creator/tasks/create-pipeline.md +171 -0
  1395. package/pro/squads/squad-creator/tasks/create-squad-build.md +383 -0
  1396. package/pro/squads/squad-creator/tasks/create-squad-design.md +349 -0
  1397. package/pro/squads/squad-creator/tasks/create-squad-discover.md +392 -0
  1398. package/pro/squads/squad-creator/tasks/create-squad-publish.md +225 -0
  1399. package/pro/squads/squad-creator/tasks/create-squad-validate.md +327 -0
  1400. package/pro/squads/squad-creator/tasks/create-squad.md +113 -0
  1401. package/pro/squads/squad-creator/tasks/create-task-anatomy.md +273 -0
  1402. package/pro/squads/squad-creator/tasks/create-task-classify.md +222 -0
  1403. package/pro/squads/squad-creator/tasks/create-task-executor.md +205 -0
  1404. package/pro/squads/squad-creator/tasks/create-task-generate.md +224 -0
  1405. package/pro/squads/squad-creator/tasks/create-task-register.md +192 -0
  1406. package/pro/squads/squad-creator/tasks/create-task-validate.md +232 -0
  1407. package/pro/squads/squad-creator/tasks/create-task.md +113 -0
  1408. package/pro/squads/squad-creator/tasks/create-template-elicitation.md +59 -0
  1409. package/pro/squads/squad-creator/tasks/create-template-identity.md +59 -0
  1410. package/pro/squads/squad-creator/tasks/create-template-register.md +58 -0
  1411. package/pro/squads/squad-creator/tasks/create-template-structure.md +59 -0
  1412. package/pro/squads/squad-creator/tasks/create-template-validate.md +59 -0
  1413. package/pro/squads/squad-creator/tasks/create-template.md +95 -0
  1414. package/pro/squads/squad-creator/tasks/create-workflow-classify.md +213 -0
  1415. package/pro/squads/squad-creator/tasks/create-workflow-design.md +494 -0
  1416. package/pro/squads/squad-creator/tasks/create-workflow-from-sop.md +301 -0
  1417. package/pro/squads/squad-creator/tasks/create-workflow-generate.md +262 -0
  1418. package/pro/squads/squad-creator/tasks/create-workflow.md +108 -0
  1419. package/pro/squads/squad-creator/tasks/detect-gaps.md +116 -0
  1420. package/pro/squads/squad-creator/tasks/detect-operational-mode-classify.md +112 -0
  1421. package/pro/squads/squad-creator/tasks/detect-operational-mode-infrastructure.md +104 -0
  1422. package/pro/squads/squad-creator/tasks/detect-operational-mode-outputs.md +94 -0
  1423. package/pro/squads/squad-creator/tasks/detect-operational-mode-systems.md +91 -0
  1424. package/pro/squads/squad-creator/tasks/detect-operational-mode-verbs.md +94 -0
  1425. package/pro/squads/squad-creator/tasks/detect-operational-mode.md +115 -0
  1426. package/pro/squads/squad-creator/tasks/detect-squad-context.md +120 -0
  1427. package/pro/squads/squad-creator/tasks/discover-tools-classify.md +191 -0
  1428. package/pro/squads/squad-creator/tasks/discover-tools-evaluate.md +173 -0
  1429. package/pro/squads/squad-creator/tasks/discover-tools-recommend.md +180 -0
  1430. package/pro/squads/squad-creator/tasks/discover-tools-report.md +184 -0
  1431. package/pro/squads/squad-creator/tasks/discover-tools-scan.md +188 -0
  1432. package/pro/squads/squad-creator/tasks/discover-tools.md +139 -0
  1433. package/pro/squads/squad-creator/tasks/generate-recommendations.md +162 -0
  1434. package/pro/squads/squad-creator/tasks/improve-workflow-from-report.md +127 -0
  1435. package/pro/squads/squad-creator/tasks/improve-workflow-report-apply-p1.md +59 -0
  1436. package/pro/squads/squad-creator/tasks/improve-workflow-report-apply-secondary.md +59 -0
  1437. package/pro/squads/squad-creator/tasks/improve-workflow-report-backup.md +59 -0
  1438. package/pro/squads/squad-creator/tasks/improve-workflow-report-ingest.md +59 -0
  1439. package/pro/squads/squad-creator/tasks/improve-workflow-report-target.md +59 -0
  1440. package/pro/squads/squad-creator/tasks/improve-workflow-report-validate-report.md +59 -0
  1441. package/pro/squads/squad-creator/tasks/install-skills-finalize.md +415 -0
  1442. package/pro/squads/squad-creator/tasks/install-skills-prepare.md +353 -0
  1443. package/pro/squads/squad-creator/tasks/install-skills-write.md +395 -0
  1444. package/pro/squads/squad-creator/tasks/install-skills.md +282 -0
  1445. package/pro/squads/squad-creator/tasks/next-squad-ranking.md +58 -0
  1446. package/pro/squads/squad-creator/tasks/next-squad-registry.md +58 -0
  1447. package/pro/squads/squad-creator/tasks/next-squad-report.md +59 -0
  1448. package/pro/squads/squad-creator/tasks/next-squad-scoring.md +59 -0
  1449. package/pro/squads/squad-creator/tasks/next-squad-signals.md +58 -0
  1450. package/pro/squads/squad-creator/tasks/next-squad.md +98 -0
  1451. package/pro/squads/squad-creator/tasks/operational-test-baseline.md +69 -0
  1452. package/pro/squads/squad-creator/tasks/operational-test-preflight.md +70 -0
  1453. package/pro/squads/squad-creator/tasks/operational-test-report.md +71 -0
  1454. package/pro/squads/squad-creator/tasks/operational-test-smoke.md +72 -0
  1455. package/pro/squads/squad-creator/tasks/operational-test-target.md +71 -0
  1456. package/pro/squads/squad-creator/tasks/operational-test.md +102 -0
  1457. package/pro/squads/squad-creator/tasks/performance-dashboard.md +118 -0
  1458. package/pro/squads/squad-creator/tasks/qa-after-creation.md +129 -0
  1459. package/pro/squads/squad-creator/tasks/qa-check-compatibility.md +191 -0
  1460. package/pro/squads/squad-creator/tasks/qa-check-completeness.md +218 -0
  1461. package/pro/squads/squad-creator/tasks/qa-check-references.md +172 -0
  1462. package/pro/squads/squad-creator/tasks/qa-check-schema.md +190 -0
  1463. package/pro/squads/squad-creator/tasks/qa-check-structure.md +176 -0
  1464. package/pro/squads/squad-creator/tasks/qa-generate-report.md +240 -0
  1465. package/pro/squads/squad-creator/tasks/qualify-provider-baseline.md +122 -0
  1466. package/pro/squads/squad-creator/tasks/qualify-provider-compare.md +159 -0
  1467. package/pro/squads/squad-creator/tasks/qualify-provider-preflight.md +143 -0
  1468. package/pro/squads/squad-creator/tasks/qualify-provider-ptbr.md +166 -0
  1469. package/pro/squads/squad-creator/tasks/qualify-provider-reliability.md +140 -0
  1470. package/pro/squads/squad-creator/tasks/qualify-provider-report.md +178 -0
  1471. package/pro/squads/squad-creator/tasks/reexecute-squad-phase.md +97 -0
  1472. package/pro/squads/squad-creator/tasks/refresh-registry.md +299 -0
  1473. package/pro/squads/squad-creator/tasks/rename-squad-map.md +59 -0
  1474. package/pro/squads/squad-creator/tasks/rename-squad-propagate.md +59 -0
  1475. package/pro/squads/squad-creator/tasks/rename-squad-structural.md +59 -0
  1476. package/pro/squads/squad-creator/tasks/rename-squad-validate.md +59 -0
  1477. package/pro/squads/squad-creator/tasks/rename-squad.md +118 -0
  1478. package/pro/squads/squad-creator/tasks/self-improve.md +107 -0
  1479. package/pro/squads/squad-creator/tasks/setup-runtime-handoff.md +74 -0
  1480. package/pro/squads/squad-creator/tasks/setup-runtime-persist.md +81 -0
  1481. package/pro/squads/squad-creator/tasks/setup-runtime-requirements.md +84 -0
  1482. package/pro/squads/squad-creator/tasks/setup-runtime-validate.md +82 -0
  1483. package/pro/squads/squad-creator/tasks/setup-runtime-wizard.md +84 -0
  1484. package/pro/squads/squad-creator/tasks/setup-runtime.md +103 -0
  1485. package/pro/squads/squad-creator/tasks/squad-analytics.md +276 -0
  1486. package/pro/squads/squad-creator/tasks/squad-overview-agents.md +110 -0
  1487. package/pro/squads/squad-creator/tasks/squad-overview-generate.md +102 -0
  1488. package/pro/squads/squad-creator/tasks/squad-overview-metadata.md +121 -0
  1489. package/pro/squads/squad-creator/tasks/squad-overview-minds.md +100 -0
  1490. package/pro/squads/squad-creator/tasks/squad-overview-structure.md +106 -0
  1491. package/pro/squads/squad-creator/tasks/squad-overview-write.md +103 -0
  1492. package/pro/squads/squad-creator/tasks/squad-overview.md +117 -0
  1493. package/pro/squads/squad-creator/tasks/sync-chief-codex-skill.md +73 -0
  1494. package/pro/squads/squad-creator/tasks/sync-ide-skills.md +240 -0
  1495. package/pro/squads/squad-creator/tasks/update-radar.md +151 -0
  1496. package/pro/squads/squad-creator/tasks/upgrade-squad-apply.md +187 -0
  1497. package/pro/squads/squad-creator/tasks/upgrade-squad-gap.md +203 -0
  1498. package/pro/squads/squad-creator/tasks/upgrade-squad-inventory.md +186 -0
  1499. package/pro/squads/squad-creator/tasks/upgrade-squad-plan.md +163 -0
  1500. package/pro/squads/squad-creator/tasks/upgrade-squad-verify.md +178 -0
  1501. package/pro/squads/squad-creator/tasks/upgrade-squad.md +138 -0
  1502. package/pro/squads/squad-creator/tasks/validate-final-artifacts.md +104 -0
  1503. package/pro/squads/squad-creator/tasks/validate-squad-classify.md +335 -0
  1504. package/pro/squads/squad-creator/tasks/validate-squad-deep-review.md +226 -0
  1505. package/pro/squads/squad-creator/tasks/validate-squad-preflight.md +189 -0
  1506. package/pro/squads/squad-creator/tasks/validate-squad-verdict.md +442 -0
  1507. package/pro/squads/squad-creator/tasks/validate-squad.md +117 -0
  1508. package/pro/squads/squad-creator/templates/agent-flow-doc-tmpl.md +512 -0
  1509. package/pro/squads/squad-creator/templates/agent-tmpl.md +703 -0
  1510. package/pro/squads/squad-creator/templates/auto-heal-task-tmpl.md +417 -0
  1511. package/pro/squads/squad-creator/templates/capability-map-tmpl.md +95 -0
  1512. package/pro/squads/squad-creator/templates/config-tmpl.yaml +534 -0
  1513. package/pro/squads/squad-creator/templates/cross-domain-handoff-tmpl.yaml +18 -0
  1514. package/pro/squads/squad-creator/templates/ecosystem-health-tmpl.md +19 -0
  1515. package/pro/squads/squad-creator/templates/gap-analysis-tmpl.md +13 -0
  1516. package/pro/squads/squad-creator/templates/greeting-script-tmpl.cjs +169 -0
  1517. package/pro/squads/squad-creator/templates/handoff-insumos-tmpl.yaml +112 -0
  1518. package/pro/squads/squad-creator/templates/journey-log-tmpl.yaml +93 -0
  1519. package/pro/squads/squad-creator/templates/operational-test-task-tmpl.md +514 -0
  1520. package/pro/squads/squad-creator/templates/orchestrator-tmpl.md +74 -0
  1521. package/pro/squads/squad-creator/templates/performance-dashboard-tmpl.md +77 -0
  1522. package/pro/squads/squad-creator/templates/pipeline-progress-tmpl.py +373 -0
  1523. package/pro/squads/squad-creator/templates/pipeline-prompt-tmpl.md +94 -0
  1524. package/pro/squads/squad-creator/templates/pipeline-runner-tmpl.py +444 -0
  1525. package/pro/squads/squad-creator/templates/pipeline-state-tmpl.py +413 -0
  1526. package/pro/squads/squad-creator/templates/pop-extractor-prompt.md +549 -0
  1527. package/pro/squads/squad-creator/templates/quality-dashboard-tmpl.md +286 -0
  1528. package/pro/squads/squad-creator/templates/quality-gate-tmpl.yaml +589 -0
  1529. package/pro/squads/squad-creator/templates/readme-tmpl.md +254 -0
  1530. package/pro/squads/squad-creator/templates/research-output-tmpl.md +625 -0
  1531. package/pro/squads/squad-creator/templates/research-prompt-tmpl.md +479 -0
  1532. package/pro/squads/squad-creator/templates/setup-runtime-task-tmpl.md +627 -0
  1533. package/pro/squads/squad-creator/templates/squad-mappings-tmpl.yaml +71 -0
  1534. package/pro/squads/squad-creator/templates/squad-prd-tmpl.md +488 -0
  1535. package/pro/squads/squad-creator/templates/squad-readme-tmpl.md +170 -0
  1536. package/pro/squads/squad-creator/templates/story-create-agent-tmpl.md +284 -0
  1537. package/pro/squads/squad-creator/templates/task-tmpl.md +533 -0
  1538. package/pro/squads/squad-creator/templates/tech-radar-tmpl.md +73 -0
  1539. package/pro/squads/squad-creator/templates/template-tmpl.yaml +227 -0
  1540. package/pro/squads/squad-creator/templates/weekly-digest-tmpl.md +11 -0
  1541. package/pro/squads/squad-creator/templates/weekly-report-tmpl.md +155 -0
  1542. package/pro/squads/squad-creator/templates/workflow-doc-tmpl.md +860 -0
  1543. package/pro/squads/squad-creator/templates/workflow-tmpl.yaml +486 -0
  1544. package/pro/squads/squad-creator/test-cases/an-assess-sources/TEST-REPORT-v2.1.md +351 -0
  1545. package/pro/squads/squad-creator/test-cases/an-assess-sources/formal-qualification-report.yaml +389 -0
  1546. package/pro/squads/squad-creator/test-cases/an-clone-review/opus-baseline.yaml +566 -0
  1547. package/pro/squads/squad-creator/test-cases/pv-axioma-assessment/opus-baseline.yaml +96 -0
  1548. package/pro/squads/squad-creator/test-cases/pv-modernization-score/opus-baseline.yaml +488 -0
  1549. package/pro/squads/squad-creator/test-cases/smoke-test-model-routing/test-case.yaml +100 -0
  1550. package/pro/squads/squad-creator/workflows/wf-auto-heal.yaml +33 -0
  1551. package/pro/squads/squad-creator/workflows/wf-create-agent.yaml +252 -0
  1552. package/pro/squads/squad-creator/workflows/wf-create-greeting-script.yaml +60 -0
  1553. package/pro/squads/squad-creator/workflows/wf-create-pipeline.yaml +60 -0
  1554. package/pro/squads/squad-creator/workflows/wf-create-squad.yaml +1916 -0
  1555. package/pro/squads/squad-creator/workflows/wf-create-task.yaml +172 -0
  1556. package/pro/squads/squad-creator/workflows/wf-create-template.yaml +60 -0
  1557. package/pro/squads/squad-creator/workflows/wf-create-workflow.yaml +138 -0
  1558. package/pro/squads/squad-creator/workflows/wf-cross-provider-qualification.yaml +769 -0
  1559. package/pro/squads/squad-creator/workflows/wf-detect-operational-mode.yaml +112 -0
  1560. package/pro/squads/squad-creator/workflows/wf-discover-tools.yaml +1695 -0
  1561. package/pro/squads/squad-creator/workflows/wf-ecosystem-analysis.yaml +338 -0
  1562. package/pro/squads/squad-creator/workflows/wf-improve-workflow-from-report.yaml +69 -0
  1563. package/pro/squads/squad-creator/workflows/wf-install-skills.yaml +52 -0
  1564. package/pro/squads/squad-creator/workflows/wf-next-squad.yaml +60 -0
  1565. package/pro/squads/squad-creator/workflows/wf-operational-test.yaml +86 -0
  1566. package/pro/squads/squad-creator/workflows/wf-qa-after-creation.yaml +339 -0
  1567. package/pro/squads/squad-creator/workflows/wf-rename-squad.yaml +51 -0
  1568. package/pro/squads/squad-creator/workflows/wf-self-improve.yaml +206 -0
  1569. package/pro/squads/squad-creator/workflows/wf-setup-runtime.yaml +86 -0
  1570. package/pro/squads/squad-creator/workflows/wf-squad-overview.yaml +100 -0
  1571. package/pro/squads/squad-creator/workflows/wf-sync-ide-skills.yaml +24 -0
  1572. package/pro/squads/squad-creator/workflows/wf-upgrade-squad.yaml +236 -0
  1573. package/pro/squads/squad-creator/workflows/wf-weekly-report.yaml +139 -0
  1574. package/pro/squads/squad-creator-pro/.state.json +32 -0
  1575. package/pro/squads/squad-creator-pro/ARCHITECTURE.md +37 -0
  1576. package/pro/squads/squad-creator-pro/CHANGELOG.md +275 -0
  1577. package/pro/squads/squad-creator-pro/README.md +1061 -0
  1578. package/pro/squads/squad-creator-pro/agents/ecosystem-analyst.md +989 -0
  1579. package/pro/squads/squad-creator-pro/agents/heuristic-ops.md +369 -0
  1580. package/pro/squads/squad-creator-pro/agents/oalanicolas.md +998 -0
  1581. package/pro/squads/squad-creator-pro/agents/pedro-valerio.md +1291 -0
  1582. package/pro/squads/squad-creator-pro/agents/squad-chief.md +1819 -0
  1583. package/pro/squads/squad-creator-pro/agents/thiago_finch.md +986 -0
  1584. package/pro/squads/squad-creator-pro/benchmarks/golden/hormozi-golden.yaml +382 -0
  1585. package/pro/squads/squad-creator-pro/benchmarks/scripts/run-benchmark.sh +363 -0
  1586. package/pro/squads/squad-creator-pro/checklists/.gitkeep +1 -0
  1587. package/pro/squads/squad-creator-pro/checklists/agent-depth-checklist.md +244 -0
  1588. package/pro/squads/squad-creator-pro/checklists/agent-quality-gate.md +434 -0
  1589. package/pro/squads/squad-creator-pro/checklists/create-squad-checklist.md +291 -0
  1590. package/pro/squads/squad-creator-pro/checklists/deep-research-quality.md +505 -0
  1591. package/pro/squads/squad-creator-pro/checklists/executor-matrix-checklist.md +260 -0
  1592. package/pro/squads/squad-creator-pro/checklists/mental-model-integration-checklist.md +95 -0
  1593. package/pro/squads/squad-creator-pro/checklists/mind-validation.md +373 -0
  1594. package/pro/squads/squad-creator-pro/checklists/pipeline-quality-checklist.md +84 -0
  1595. package/pro/squads/squad-creator-pro/checklists/quality-gate-checklist.md +385 -0
  1596. package/pro/squads/squad-creator-pro/checklists/session-heuristics-extraction.md +65 -0
  1597. package/pro/squads/squad-creator-pro/checklists/sop-validation.md +250 -0
  1598. package/pro/squads/squad-creator-pro/checklists/squad-checklist.md +1014 -0
  1599. package/pro/squads/squad-creator-pro/checklists/task-anatomy-checklist.md +626 -0
  1600. package/pro/squads/squad-creator-pro/config/.gitkeep +1 -0
  1601. package/pro/squads/squad-creator-pro/config/axioma-validator.yaml +371 -0
  1602. package/pro/squads/squad-creator-pro/config/heuristic-watcher-rubric.yaml +300 -0
  1603. package/pro/squads/squad-creator-pro/config/heuristics.yaml +937 -0
  1604. package/pro/squads/squad-creator-pro/config/model-routing.yaml +693 -0
  1605. package/pro/squads/squad-creator-pro/config/quality-gates.yaml +415 -0
  1606. package/pro/squads/squad-creator-pro/config/scoring-rubric.yaml +199 -0
  1607. package/pro/squads/squad-creator-pro/config/squad-config.yaml +165 -0
  1608. package/pro/squads/squad-creator-pro/config/task-anatomy.yaml +263 -0
  1609. package/pro/squads/squad-creator-pro/config/veto-conditions.yaml +455 -0
  1610. package/pro/squads/squad-creator-pro/config.yaml +455 -0
  1611. package/pro/squads/squad-creator-pro/data/.gitkeep +1 -0
  1612. package/pro/squads/squad-creator-pro/data/an-anchor-words.yaml +78 -0
  1613. package/pro/squads/squad-creator-pro/data/an-clone-anti-patterns.yaml +148 -0
  1614. package/pro/squads/squad-creator-pro/data/an-clone-validation.yaml +190 -0
  1615. package/pro/squads/squad-creator-pro/data/an-diagnostic-framework.yaml +164 -0
  1616. package/pro/squads/squad-creator-pro/data/an-output-examples.yaml +102 -0
  1617. package/pro/squads/squad-creator-pro/data/an-source-signals.yaml +98 -0
  1618. package/pro/squads/squad-creator-pro/data/an-source-tiers.yaml +119 -0
  1619. package/pro/squads/squad-creator-pro/data/best-practices.md +986 -0
  1620. package/pro/squads/squad-creator-pro/data/core-heuristics.md +510 -0
  1621. package/pro/squads/squad-creator-pro/data/decision-heuristics-framework.md +620 -0
  1622. package/pro/squads/squad-creator-pro/data/executor-matrix-framework.md +441 -0
  1623. package/pro/squads/squad-creator-pro/data/extraction-mentoria-processos-dec19.yaml +337 -0
  1624. package/pro/squads/squad-creator-pro/data/fusion-decision-points-analysis.md +397 -0
  1625. package/pro/squads/squad-creator-pro/data/fusion-dry-runs/traffic-masters-absorve-_traffic-2026-03-09.md +135 -0
  1626. package/pro/squads/squad-creator-pro/data/fusion-executor-analysis.md +677 -0
  1627. package/pro/squads/squad-creator-pro/data/hybridops-patterns.md +1351 -0
  1628. package/pro/squads/squad-creator-pro/data/internal-infrastructure-library.yaml +103 -0
  1629. package/pro/squads/squad-creator-pro/data/mental-model-task-matrix.yaml +692 -0
  1630. package/pro/squads/squad-creator-pro/data/pm-best-practices.md +504 -0
  1631. package/pro/squads/squad-creator-pro/data/pv-anchor-words.yaml +64 -0
  1632. package/pro/squads/squad-creator-pro/data/pv-authenticity-markers.yaml +200 -0
  1633. package/pro/squads/squad-creator-pro/data/pv-meta-axiomas.yaml +162 -0
  1634. package/pro/squads/squad-creator-pro/data/pv-output-examples.yaml +342 -0
  1635. package/pro/squads/squad-creator-pro/data/pv-workflow-validation.yaml +318 -0
  1636. package/pro/squads/squad-creator-pro/data/quality-dimensions-framework.md +405 -0
  1637. package/pro/squads/squad-creator-pro/data/quality-gate-coverage.yaml +169 -0
  1638. package/pro/squads/squad-creator-pro/data/squad-analytics-guide.md +252 -0
  1639. package/pro/squads/squad-creator-pro/data/squad-kb.md +987 -0
  1640. package/pro/squads/squad-creator-pro/data/squad-kpis.yaml +60 -0
  1641. package/pro/squads/squad-creator-pro/data/squad-registry.yaml +4900 -0
  1642. package/pro/squads/squad-creator-pro/data/tier-system-framework.md +475 -0
  1643. package/pro/squads/squad-creator-pro/data/token-registry.yaml +386 -0
  1644. package/pro/squads/squad-creator-pro/data/tool-evaluation-framework.md +847 -0
  1645. package/pro/squads/squad-creator-pro/data/tool-registry.yaml +816 -0
  1646. package/pro/squads/squad-creator-pro/docs/ARCHITECTURE-DIAGRAMS.md +1466 -0
  1647. package/pro/squads/squad-creator-pro/docs/COMMANDS.md +544 -0
  1648. package/pro/squads/squad-creator-pro/docs/CONCEPTS.md +584 -0
  1649. package/pro/squads/squad-creator-pro/docs/FAQ.md +731 -0
  1650. package/pro/squads/squad-creator-pro/docs/HITL-FLOW.md +255 -0
  1651. package/pro/squads/squad-creator-pro/docs/PATTERN-LIBRARY.md +341 -0
  1652. package/pro/squads/squad-creator-pro/docs/PEDRO-VALERIO-ARCHITECTURE.md +456 -0
  1653. package/pro/squads/squad-creator-pro/docs/POR-ONDE-COMECAR.md +210 -0
  1654. package/pro/squads/squad-creator-pro/docs/QUICK-START.md +205 -0
  1655. package/pro/squads/squad-creator-pro/docs/TOOL-RECOMMENDATIONS.md +381 -0
  1656. package/pro/squads/squad-creator-pro/docs/TUTORIAL-COMPLETO.md +458 -0
  1657. package/pro/squads/squad-creator-pro/docs/sop-extraction-process.md +674 -0
  1658. package/pro/squads/squad-creator-pro/docs/squad-chief-agent-flow.md +981 -0
  1659. package/pro/squads/squad-creator-pro/docs/squad-creation-pipeline-workflow.md +937 -0
  1660. package/pro/squads/squad-creator-pro/minds/oalanicolas/artifacts/HANDOFF_PROTOCOL.md +269 -0
  1661. package/pro/squads/squad-creator-pro/minds/oalanicolas/artifacts/SOURCE_CLASSIFICATION.md +258 -0
  1662. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_001.md +117 -0
  1663. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_002.md +115 -0
  1664. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_003.md +110 -0
  1665. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_004.md +109 -0
  1666. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_005.md +116 -0
  1667. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_006.md +183 -0
  1668. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_007.md +273 -0
  1669. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_008.md +204 -0
  1670. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_009.md +246 -0
  1671. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_010.md +265 -0
  1672. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_011.md +72 -0
  1673. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_012.md +59 -0
  1674. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_013.md +69 -0
  1675. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_014.md +69 -0
  1676. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_015.md +83 -0
  1677. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_016.md +67 -0
  1678. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_017.md +64 -0
  1679. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_018.md +79 -0
  1680. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_019.md +69 -0
  1681. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_020.md +67 -0
  1682. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_021.md +114 -0
  1683. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_022.md +75 -0
  1684. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_023.md +60 -0
  1685. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_024.md +66 -0
  1686. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_025.md +81 -0
  1687. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_026.md +82 -0
  1688. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_027.md +85 -0
  1689. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_028.md +74 -0
  1690. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_029.md +73 -0
  1691. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_030.md +80 -0
  1692. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_031.md +78 -0
  1693. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_032.md +81 -0
  1694. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_033.md +69 -0
  1695. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_034.md +119 -0
  1696. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_035.md +120 -0
  1697. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_036.md +134 -0
  1698. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_037.md +123 -0
  1699. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_038.md +85 -0
  1700. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_039.md +74 -0
  1701. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_040.md +130 -0
  1702. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_041.md +87 -0
  1703. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_042.md +89 -0
  1704. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_043.md +78 -0
  1705. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_044.md +97 -0
  1706. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_045.md +82 -0
  1707. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_046.md +83 -0
  1708. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_047.md +77 -0
  1709. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_048.md +83 -0
  1710. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_049.md +102 -0
  1711. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_050.md +85 -0
  1712. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_051.md +90 -0
  1713. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_052.md +84 -0
  1714. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_053.md +83 -0
  1715. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_054.md +96 -0
  1716. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_055.md +137 -0
  1717. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_056.md +114 -0
  1718. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_057.md +82 -0
  1719. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_058.md +79 -0
  1720. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_059.md +88 -0
  1721. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_060.md +78 -0
  1722. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_061.md +79 -0
  1723. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_062.md +99 -0
  1724. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_063.md +73 -0
  1725. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_064.md +106 -0
  1726. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_065.md +87 -0
  1727. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_066.md +66 -0
  1728. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_067.md +65 -0
  1729. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_068.md +70 -0
  1730. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_069.md +69 -0
  1731. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_070.md +67 -0
  1732. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_071.md +87 -0
  1733. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_072.md +84 -0
  1734. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_073.md +89 -0
  1735. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_074.md +60 -0
  1736. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_075.md +87 -0
  1737. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_076.md +107 -0
  1738. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_077.md +98 -0
  1739. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_078.md +66 -0
  1740. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_079.md +91 -0
  1741. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_080.md +59 -0
  1742. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_081.md +64 -0
  1743. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_082.md +71 -0
  1744. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_083.md +62 -0
  1745. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_084.md +66 -0
  1746. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_085.md +62 -0
  1747. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_086.md +69 -0
  1748. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_087.md +74 -0
  1749. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_088.md +89 -0
  1750. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_089.md +88 -0
  1751. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_090.md +74 -0
  1752. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_091.md +76 -0
  1753. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_092.md +61 -0
  1754. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_093.md +69 -0
  1755. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_094.md +58 -0
  1756. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_095.md +58 -0
  1757. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_096.md +65 -0
  1758. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_097.md +63 -0
  1759. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_098.md +98 -0
  1760. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_099.md +97 -0
  1761. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_100.md +100 -0
  1762. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_101.md +62 -0
  1763. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_102.md +65 -0
  1764. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_103.md +60 -0
  1765. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_104.md +60 -0
  1766. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_105.md +67 -0
  1767. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_106.md +64 -0
  1768. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_107.md +63 -0
  1769. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_108.md +60 -0
  1770. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_109.md +62 -0
  1771. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_110.md +58 -0
  1772. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_111.md +88 -0
  1773. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_112.md +60 -0
  1774. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_113.md +74 -0
  1775. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_114.md +55 -0
  1776. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_115.md +126 -0
  1777. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_116.md +76 -0
  1778. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_117.md +65 -0
  1779. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_118.md +72 -0
  1780. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_119.md +58 -0
  1781. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_120.md +77 -0
  1782. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_121.md +65 -0
  1783. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_122.md +57 -0
  1784. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_123.md +63 -0
  1785. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_124.md +69 -0
  1786. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_125.md +73 -0
  1787. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_126.md +81 -0
  1788. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_127.md +77 -0
  1789. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_128.md +76 -0
  1790. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_129.md +81 -0
  1791. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_130.md +88 -0
  1792. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_131.md +85 -0
  1793. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_132.md +81 -0
  1794. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/AN_KE_133.md +86 -0
  1795. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/decision-cards.yaml +1010 -0
  1796. package/pro/squads/squad-creator-pro/minds/oalanicolas/heuristics/heuristic-analytics.md +24 -0
  1797. package/pro/squads/squad-creator-pro/minds/pedro_valerio/artifacts/Assinatura_Linguistica.md +355 -0
  1798. package/pro/squads/squad-creator-pro/minds/pedro_valerio/artifacts/META_AXIOMAS.md +277 -0
  1799. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_BS_001.md +151 -0
  1800. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_041.md +80 -0
  1801. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_042.md +79 -0
  1802. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_043.md +81 -0
  1803. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_044.md +83 -0
  1804. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_045.md +82 -0
  1805. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_046.md +82 -0
  1806. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_047.md +81 -0
  1807. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_048.md +77 -0
  1808. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_049.md +81 -0
  1809. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_050.md +79 -0
  1810. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_051.md +81 -0
  1811. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_052.md +81 -0
  1812. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_053.md +79 -0
  1813. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_054.md +74 -0
  1814. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_055.md +78 -0
  1815. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_056.md +78 -0
  1816. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_057.md +78 -0
  1817. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_058.md +81 -0
  1818. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_059.md +81 -0
  1819. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_060.md +82 -0
  1820. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_061.md +74 -0
  1821. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_062.md +75 -0
  1822. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_063.md +80 -0
  1823. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_064.md +75 -0
  1824. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_065.md +74 -0
  1825. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_066.md +76 -0
  1826. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_067.md +75 -0
  1827. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_068.md +78 -0
  1828. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_069.md +78 -0
  1829. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_070.md +75 -0
  1830. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_071.md +77 -0
  1831. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_072.md +76 -0
  1832. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_073.md +82 -0
  1833. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_074.md +80 -0
  1834. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_075.md +85 -0
  1835. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_076.md +81 -0
  1836. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_077.md +77 -0
  1837. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_078.md +81 -0
  1838. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_079.md +77 -0
  1839. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_080.md +81 -0
  1840. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_081.md +76 -0
  1841. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_082.md +84 -0
  1842. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_083.md +78 -0
  1843. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_084.md +76 -0
  1844. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_085.md +83 -0
  1845. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_086.md +74 -0
  1846. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_087.md +87 -0
  1847. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_088.md +75 -0
  1848. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_089.md +79 -0
  1849. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_090.md +75 -0
  1850. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_091.md +77 -0
  1851. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_092.md +81 -0
  1852. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_093.md +74 -0
  1853. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_094.md +73 -0
  1854. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_095.md +84 -0
  1855. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_096.md +78 -0
  1856. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_097.md +79 -0
  1857. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_098.md +85 -0
  1858. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_099.md +82 -0
  1859. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_100.md +81 -0
  1860. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_KE_101.md +61 -0
  1861. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_001.md +197 -0
  1862. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_002.md +165 -0
  1863. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_003.md +164 -0
  1864. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_004.md +163 -0
  1865. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_005.md +161 -0
  1866. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_006.md +164 -0
  1867. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_007.md +162 -0
  1868. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_008.md +156 -0
  1869. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_009.md +157 -0
  1870. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_010.md +166 -0
  1871. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_011.md +161 -0
  1872. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_012.md +80 -0
  1873. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_013.md +66 -0
  1874. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_014.md +64 -0
  1875. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_015.md +61 -0
  1876. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_016.md +60 -0
  1877. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_017.md +66 -0
  1878. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_018.md +56 -0
  1879. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_019.md +63 -0
  1880. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_020.md +64 -0
  1881. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_021.md +71 -0
  1882. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_022.md +69 -0
  1883. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_023.md +56 -0
  1884. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_024.md +61 -0
  1885. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_025.md +60 -0
  1886. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_026.md +71 -0
  1887. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_027.md +65 -0
  1888. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_028.md +61 -0
  1889. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_029.md +62 -0
  1890. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_030.md +62 -0
  1891. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_031.md +62 -0
  1892. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_032.md +59 -0
  1893. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_033.md +64 -0
  1894. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_034.md +65 -0
  1895. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_035.md +62 -0
  1896. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_036.md +63 -0
  1897. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_037.md +60 -0
  1898. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_038.md +78 -0
  1899. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_039.md +58 -0
  1900. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_040.md +62 -0
  1901. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PA_041.md +61 -0
  1902. package/pro/squads/squad-creator-pro/minds/pedro_valerio/heuristics/PV_PM_001.md +198 -0
  1903. package/pro/squads/squad-creator-pro/package-lock.json +38 -0
  1904. package/pro/squads/squad-creator-pro/package.json +30 -0
  1905. package/pro/squads/squad-creator-pro/requirements.txt +1 -0
  1906. package/pro/squads/squad-creator-pro/schemas/agent-persona.schema.json +78 -0
  1907. package/pro/squads/squad-creator-pro/schemas/squad-config.schema.json +146 -0
  1908. package/pro/squads/squad-creator-pro/scripts/README.md +166 -0
  1909. package/pro/squads/squad-creator-pro/scripts/WAVE-LOOP.md +157 -0
  1910. package/pro/squads/squad-creator-pro/scripts/assess-sources.sh +443 -0
  1911. package/pro/squads/squad-creator-pro/scripts/checklist_validator.py +59 -0
  1912. package/pro/squads/squad-creator-pro/scripts/clone-review.sh +394 -0
  1913. package/pro/squads/squad-creator-pro/scripts/coherence-validator.py +836 -0
  1914. package/pro/squads/squad-creator-pro/scripts/create-agent-preflight.py +243 -0
  1915. package/pro/squads/squad-creator-pro/scripts/cross-mind-linker.py +143 -0
  1916. package/pro/squads/squad-creator-pro/scripts/cross-provider/compare-results.js +281 -0
  1917. package/pro/squads/squad-creator-pro/scripts/cross-provider/cross-provider-runner.js +462 -0
  1918. package/pro/squads/squad-creator-pro/scripts/cross_map.json +338 -0
  1919. package/pro/squads/squad-creator-pro/scripts/dependency_check.py +337 -0
  1920. package/pro/squads/squad-creator-pro/scripts/detect-environment-contract.cjs +37 -0
  1921. package/pro/squads/squad-creator-pro/scripts/export-antigravity-workflows.cjs +12 -0
  1922. package/pro/squads/squad-creator-pro/scripts/fidelity-score.sh +519 -0
  1923. package/pro/squads/squad-creator-pro/scripts/generate-heuristic-registry.py +83 -0
  1924. package/pro/squads/squad-creator-pro/scripts/generate-squad-greeting.js +426 -0
  1925. package/pro/squads/squad-creator-pro/scripts/generate-squad-guide.js +38 -0
  1926. package/pro/squads/squad-creator-pro/scripts/inventory.py +59 -0
  1927. package/pro/squads/squad-creator-pro/scripts/lib/config-loader.js +12 -0
  1928. package/pro/squads/squad-creator-pro/scripts/lib/squad-runtime-paths.cjs +14 -0
  1929. package/pro/squads/squad-creator-pro/scripts/lib/validate-runtime-state.cjs +14 -0
  1930. package/pro/squads/squad-creator-pro/scripts/load-business-sops.cjs +460 -0
  1931. package/pro/squads/squad-creator-pro/scripts/model-tier-validator.cjs +369 -0
  1932. package/pro/squads/squad-creator-pro/scripts/model-usage-logger.cjs +245 -0
  1933. package/pro/squads/squad-creator-pro/scripts/modernization-score.sh +308 -0
  1934. package/pro/squads/squad-creator-pro/scripts/naming_validator.py +59 -0
  1935. package/pro/squads/squad-creator-pro/scripts/on-specialist-complete.py +152 -0
  1936. package/pro/squads/squad-creator-pro/scripts/quality_gate.py +413 -0
  1937. package/pro/squads/squad-creator-pro/scripts/refresh-registry.py +425 -0
  1938. package/pro/squads/squad-creator-pro/scripts/rename-squad.sh +8 -0
  1939. package/pro/squads/squad-creator-pro/scripts/save-session-metrics.py +189 -0
  1940. package/pro/squads/squad-creator-pro/scripts/scaffold-squad.cjs +12 -0
  1941. package/pro/squads/squad-creator-pro/scripts/scoring.py +395 -0
  1942. package/pro/squads/squad-creator-pro/scripts/security_scanner.py +59 -0
  1943. package/pro/squads/squad-creator-pro/scripts/squad-analytics.py +59 -0
  1944. package/pro/squads/squad-creator-pro/scripts/squad-context-loader.cjs +232 -0
  1945. package/pro/squads/squad-creator-pro/scripts/squad-state-manager.cjs +707 -0
  1946. package/pro/squads/squad-creator-pro/scripts/squad-workflow-runner.cjs +884 -0
  1947. package/pro/squads/squad-creator-pro/scripts/squad_utils.py +59 -0
  1948. package/pro/squads/squad-creator-pro/scripts/sync-chief-codex-skill.js +242 -0
  1949. package/pro/squads/squad-creator-pro/scripts/sync-ide-skills.py +59 -0
  1950. package/pro/squads/squad-creator-pro/scripts/tests/__init__.py +1 -0
  1951. package/pro/squads/squad-creator-pro/scripts/tests/conftest.py +309 -0
  1952. package/pro/squads/squad-creator-pro/scripts/tests/run_bash_tests.sh +29 -0
  1953. package/pro/squads/squad-creator-pro/scripts/tests/test_assess_sources.sh +216 -0
  1954. package/pro/squads/squad-creator-pro/scripts/tests/test_checklist_validator.py +396 -0
  1955. package/pro/squads/squad-creator-pro/scripts/tests/test_clone_review.sh +239 -0
  1956. package/pro/squads/squad-creator-pro/scripts/tests/test_coherence_validator.py +212 -0
  1957. package/pro/squads/squad-creator-pro/scripts/tests/test_dependency_check.py +361 -0
  1958. package/pro/squads/squad-creator-pro/scripts/tests/test_fidelity_score.sh +298 -0
  1959. package/pro/squads/squad-creator-pro/scripts/tests/test_inventory.py +307 -0
  1960. package/pro/squads/squad-creator-pro/scripts/tests/test_load_business_sops.cjs +158 -0
  1961. package/pro/squads/squad-creator-pro/scripts/tests/test_modernization_score.sh +211 -0
  1962. package/pro/squads/squad-creator-pro/scripts/tests/test_naming_validator.py +373 -0
  1963. package/pro/squads/squad-creator-pro/scripts/tests/test_quality_gate.py +280 -0
  1964. package/pro/squads/squad-creator-pro/scripts/tests/test_refresh_registry.py +328 -0
  1965. package/pro/squads/squad-creator-pro/scripts/tests/test_scoring.py +366 -0
  1966. package/pro/squads/squad-creator-pro/scripts/tests/test_security_scanner.py +354 -0
  1967. package/pro/squads/squad-creator-pro/scripts/tests/test_squad_analytics.py +309 -0
  1968. package/pro/squads/squad-creator-pro/scripts/tests/test_squad_runtime_pipeline_e2e.cjs +267 -0
  1969. package/pro/squads/squad-creator-pro/scripts/tests/test_validate_clone.sh +252 -0
  1970. package/pro/squads/squad-creator-pro/scripts/tests/test_validate_squad_runtime_state_e2e.cjs +99 -0
  1971. package/pro/squads/squad-creator-pro/scripts/tests/test_wave_loop_runtime_e2e.cjs +216 -0
  1972. package/pro/squads/squad-creator-pro/scripts/tests/test_wave_loop_runtime_unit.cjs +336 -0
  1973. package/pro/squads/squad-creator-pro/scripts/tests/test_yaml_validator.py +412 -0
  1974. package/pro/squads/squad-creator-pro/scripts/validate-agent-output.py +115 -0
  1975. package/pro/squads/squad-creator-pro/scripts/validate-all.sh +49 -0
  1976. package/pro/squads/squad-creator-pro/scripts/validate-clone.sh +345 -0
  1977. package/pro/squads/squad-creator-pro/scripts/validate-squad-structure.py +59 -0
  1978. package/pro/squads/squad-creator-pro/scripts/validate-squad.sh +12 -0
  1979. package/pro/squads/squad-creator-pro/scripts/validate-workspace-contract.py +204 -0
  1980. package/pro/squads/squad-creator-pro/scripts/verify-squad-completeness.sh +8 -0
  1981. package/pro/squads/squad-creator-pro/scripts/wave-loop.cjs +911 -0
  1982. package/pro/squads/squad-creator-pro/scripts/wave-loop.sh +5 -0
  1983. package/pro/squads/squad-creator-pro/scripts/yaml_validator.py +59 -0
  1984. package/pro/squads/squad-creator-pro/skills/fidelity-score.md +245 -0
  1985. package/pro/squads/squad-creator-pro/skills/squad.md +294 -0
  1986. package/pro/squads/squad-creator-pro/squad-io.yaml +49 -0
  1987. package/pro/squads/squad-creator-pro/tasks/CHANGELOG.md +118 -0
  1988. package/pro/squads/squad-creator-pro/tasks/an-assess-sources-collect.md +197 -0
  1989. package/pro/squads/squad-creator-pro/tasks/an-assess-sources-score.md +471 -0
  1990. package/pro/squads/squad-creator-pro/tasks/an-assess-sources.md +177 -0
  1991. package/pro/squads/squad-creator-pro/tasks/an-clone-review-report.md +171 -0
  1992. package/pro/squads/squad-creator-pro/tasks/an-clone-review-source-trinity.md +227 -0
  1993. package/pro/squads/squad-creator-pro/tasks/an-clone-review-stages-fidelity.md +158 -0
  1994. package/pro/squads/squad-creator-pro/tasks/an-clone-review.md +173 -0
  1995. package/pro/squads/squad-creator-pro/tasks/an-compare-outputs-score.md +340 -0
  1996. package/pro/squads/squad-creator-pro/tasks/an-compare-outputs.md +154 -0
  1997. package/pro/squads/squad-creator-pro/tasks/an-design-clone-blueprint.md +51 -0
  1998. package/pro/squads/squad-creator-pro/tasks/an-design-clone-contexts.md +48 -0
  1999. package/pro/squads/squad-creator-pro/tasks/an-design-clone-memory.md +49 -0
  2000. package/pro/squads/squad-creator-pro/tasks/an-design-clone-stages.md +48 -0
  2001. package/pro/squads/squad-creator-pro/tasks/an-design-clone-trinity.md +49 -0
  2002. package/pro/squads/squad-creator-pro/tasks/an-design-clone.md +106 -0
  2003. package/pro/squads/squad-creator-pro/tasks/an-diagnose-clone-prescribe.md +147 -0
  2004. package/pro/squads/squad-creator-pro/tasks/an-diagnose-clone-symptoms.md +147 -0
  2005. package/pro/squads/squad-creator-pro/tasks/an-diagnose-clone-verify-trinity.md +200 -0
  2006. package/pro/squads/squad-creator-pro/tasks/an-diagnose-clone.md +132 -0
  2007. package/pro/squads/squad-creator-pro/tasks/an-extract-dna-layer-extraction.md +54 -0
  2008. package/pro/squads/squad-creator-pro/tasks/an-extract-dna-report.md +55 -0
  2009. package/pro/squads/squad-creator-pro/tasks/an-extract-dna-source-assessment.md +54 -0
  2010. package/pro/squads/squad-creator-pro/tasks/an-extract-dna-thinking-dna.md +54 -0
  2011. package/pro/squads/squad-creator-pro/tasks/an-extract-dna-voice-dna.md +54 -0
  2012. package/pro/squads/squad-creator-pro/tasks/an-extract-dna.md +106 -0
  2013. package/pro/squads/squad-creator-pro/tasks/an-extract-framework-analyze.md +178 -0
  2014. package/pro/squads/squad-creator-pro/tasks/an-extract-framework-integrate.md +239 -0
  2015. package/pro/squads/squad-creator-pro/tasks/an-extract-framework-trinity.md +206 -0
  2016. package/pro/squads/squad-creator-pro/tasks/an-extract-framework.md +144 -0
  2017. package/pro/squads/squad-creator-pro/tasks/an-extract-heuristics.md +560 -0
  2018. package/pro/squads/squad-creator-pro/tasks/an-extract-session-heuristics.md +633 -0
  2019. package/pro/squads/squad-creator-pro/tasks/an-fidelity-score-calculate.md +317 -0
  2020. package/pro/squads/squad-creator-pro/tasks/an-fidelity-score.md +132 -0
  2021. package/pro/squads/squad-creator-pro/tasks/an-validate-clone-hackability.md +346 -0
  2022. package/pro/squads/squad-creator-pro/tasks/an-validate-clone.md +107 -0
  2023. package/pro/squads/squad-creator-pro/tasks/auto-acquire-sources-consolidate.md +186 -0
  2024. package/pro/squads/squad-creator-pro/tasks/auto-acquire-sources-expand.md +173 -0
  2025. package/pro/squads/squad-creator-pro/tasks/auto-acquire-sources-search.md +200 -0
  2026. package/pro/squads/squad-creator-pro/tasks/auto-acquire-sources.md +167 -0
  2027. package/pro/squads/squad-creator-pro/tasks/batch-closeout.md +96 -0
  2028. package/pro/squads/squad-creator-pro/tasks/clone-mind-quality-dashboard.md +142 -0
  2029. package/pro/squads/squad-creator-pro/tasks/clone-mind-smoke-test.md +137 -0
  2030. package/pro/squads/squad-creator-pro/tasks/clone-mind-synthesis.md +147 -0
  2031. package/pro/squads/squad-creator-pro/tasks/collect-sources-classify.md +209 -0
  2032. package/pro/squads/squad-creator-pro/tasks/collect-sources-discover.md +244 -0
  2033. package/pro/squads/squad-creator-pro/tasks/collect-sources-gap-analysis.md +201 -0
  2034. package/pro/squads/squad-creator-pro/tasks/collect-sources-quality-gate.md +227 -0
  2035. package/pro/squads/squad-creator-pro/tasks/collect-sources-validate.md +234 -0
  2036. package/pro/squads/squad-creator-pro/tasks/collect-sources.md +178 -0
  2037. package/pro/squads/squad-creator-pro/tasks/create-agent.md +122 -0
  2038. package/pro/squads/squad-creator-pro/tasks/create-documentation.md +202 -0
  2039. package/pro/squads/squad-creator-pro/tasks/create-from-sop-brief.md +139 -0
  2040. package/pro/squads/squad-creator-pro/tasks/create-from-sop-load-classify.md +173 -0
  2041. package/pro/squads/squad-creator-pro/tasks/create-from-sop-map-workflow.md +172 -0
  2042. package/pro/squads/squad-creator-pro/tasks/create-from-sop.md +130 -0
  2043. package/pro/squads/squad-creator-pro/tasks/create-greeting-script.md +148 -0
  2044. package/pro/squads/squad-creator-pro/tasks/create-pipeline.md +107 -0
  2045. package/pro/squads/squad-creator-pro/tasks/create-squad.md +141 -0
  2046. package/pro/squads/squad-creator-pro/tasks/create-task.md +125 -0
  2047. package/pro/squads/squad-creator-pro/tasks/create-template.md +105 -0
  2048. package/pro/squads/squad-creator-pro/tasks/create-workflow.md +130 -0
  2049. package/pro/squads/squad-creator-pro/tasks/deconstruct-extract.md +221 -0
  2050. package/pro/squads/squad-creator-pro/tasks/deconstruct-synthesize.md +154 -0
  2051. package/pro/squads/squad-creator-pro/tasks/deconstruct.md +123 -0
  2052. package/pro/squads/squad-creator-pro/tasks/deep-research-check-local-knowledge.md +164 -0
  2053. package/pro/squads/squad-creator-pro/tasks/deep-research-execute.md +200 -0
  2054. package/pro/squads/squad-creator-pro/tasks/deep-research-generate-prompt.md +245 -0
  2055. package/pro/squads/squad-creator-pro/tasks/deep-research-pre-agent.md +168 -0
  2056. package/pro/squads/squad-creator-pro/tasks/deep-research-validate.md +192 -0
  2057. package/pro/squads/squad-creator-pro/tasks/delete-squad.md +104 -0
  2058. package/pro/squads/squad-creator-pro/tasks/discover-tools-execute.md +293 -0
  2059. package/pro/squads/squad-creator-pro/tasks/discover-tools.md +201 -0
  2060. package/pro/squads/squad-creator-pro/tasks/etd-assemble-output.md +183 -0
  2061. package/pro/squads/squad-creator-pro/tasks/etd-discovery.md +216 -0
  2062. package/pro/squads/squad-creator-pro/tasks/etd-extract-and-classify.md +250 -0
  2063. package/pro/squads/squad-creator-pro/tasks/etd-extract-heuristics.md +173 -0
  2064. package/pro/squads/squad-creator-pro/tasks/etd-handoff-triggers.md +166 -0
  2065. package/pro/squads/squad-creator-pro/tasks/etd-l4-card-generation.md +224 -0
  2066. package/pro/squads/squad-creator-pro/tasks/etd-objection-handling.md +167 -0
  2067. package/pro/squads/squad-creator-pro/tasks/etd-resolve-and-consolidate.md +158 -0
  2068. package/pro/squads/squad-creator-pro/tasks/evd-assemble-voice-dna.md +218 -0
  2069. package/pro/squads/squad-creator-pro/tasks/evd-collect-sources.md +176 -0
  2070. package/pro/squads/squad-creator-pro/tasks/evd-extract-dimensions.md +667 -0
  2071. package/pro/squads/squad-creator-pro/tasks/extract-expert-gold-context-load.md +180 -0
  2072. package/pro/squads/squad-creator-pro/tasks/extract-expert-gold-enrichment.md +181 -0
  2073. package/pro/squads/squad-creator-pro/tasks/extract-expert-gold-filter.md +192 -0
  2074. package/pro/squads/squad-creator-pro/tasks/extract-expert-gold-multi-lense.md +158 -0
  2075. package/pro/squads/squad-creator-pro/tasks/extract-expert-gold-validation.md +167 -0
  2076. package/pro/squads/squad-creator-pro/tasks/extract-expert-gold.md +185 -0
  2077. package/pro/squads/squad-creator-pro/tasks/extract-implicit-analyze.md +192 -0
  2078. package/pro/squads/squad-creator-pro/tasks/extract-implicit-prioritize.md +212 -0
  2079. package/pro/squads/squad-creator-pro/tasks/extract-implicit-scan.md +231 -0
  2080. package/pro/squads/squad-creator-pro/tasks/extract-implicit-synthesize.md +176 -0
  2081. package/pro/squads/squad-creator-pro/tasks/extract-implicit-validate.md +234 -0
  2082. package/pro/squads/squad-creator-pro/tasks/extract-implicit.md +172 -0
  2083. package/pro/squads/squad-creator-pro/tasks/extract-knowledge-checklist.md +220 -0
  2084. package/pro/squads/squad-creator-pro/tasks/extract-knowledge-framework.md +244 -0
  2085. package/pro/squads/squad-creator-pro/tasks/extract-knowledge-sop.md +244 -0
  2086. package/pro/squads/squad-creator-pro/tasks/extract-knowledge-source-validation.md +191 -0
  2087. package/pro/squads/squad-creator-pro/tasks/extract-knowledge-validation.md +224 -0
  2088. package/pro/squads/squad-creator-pro/tasks/extract-knowledge.md +193 -0
  2089. package/pro/squads/squad-creator-pro/tasks/extract-sop-analyze.md +180 -0
  2090. package/pro/squads/squad-creator-pro/tasks/extract-sop-assemble.md +184 -0
  2091. package/pro/squads/squad-creator-pro/tasks/extract-sop-extract.md +178 -0
  2092. package/pro/squads/squad-creator-pro/tasks/extract-sop-prepare.md +189 -0
  2093. package/pro/squads/squad-creator-pro/tasks/extract-sop.md +182 -0
  2094. package/pro/squads/squad-creator-pro/tasks/extract-thinking-dna.md +160 -0
  2095. package/pro/squads/squad-creator-pro/tasks/extract-voice-dna.md +170 -0
  2096. package/pro/squads/squad-creator-pro/tasks/find-0-8-classify.md +203 -0
  2097. package/pro/squads/squad-creator-pro/tasks/find-0-8-recommend.md +166 -0
  2098. package/pro/squads/squad-creator-pro/tasks/find-0-8.md +136 -0
  2099. package/pro/squads/squad-creator-pro/tasks/ics-audit.md +211 -0
  2100. package/pro/squads/squad-creator-pro/tasks/ics-domain-mapping.md +172 -0
  2101. package/pro/squads/squad-creator-pro/tasks/ics-generate-scripts.md +241 -0
  2102. package/pro/squads/squad-creator-pro/tasks/ics-integration.md +182 -0
  2103. package/pro/squads/squad-creator-pro/tasks/ics-validation.md +181 -0
  2104. package/pro/squads/squad-creator-pro/tasks/install-context-stack.md +228 -0
  2105. package/pro/squads/squad-creator-pro/tasks/install-skills.md +180 -0
  2106. package/pro/squads/squad-creator-pro/tasks/lookup-model.md +139 -0
  2107. package/pro/squads/squad-creator-pro/tasks/migrate-workflows-analyze.md +154 -0
  2108. package/pro/squads/squad-creator-pro/tasks/migrate-workflows-archive.md +162 -0
  2109. package/pro/squads/squad-creator-pro/tasks/migrate-workflows-convert.md +167 -0
  2110. package/pro/squads/squad-creator-pro/tasks/migrate-workflows-to-yaml.md +97 -0
  2111. package/pro/squads/squad-creator-pro/tasks/modernize-squad.md +338 -0
  2112. package/pro/squads/squad-creator-pro/tasks/next-action-discovery.md +191 -0
  2113. package/pro/squads/squad-creator-pro/tasks/next-action-gap-map.md +220 -0
  2114. package/pro/squads/squad-creator-pro/tasks/next-action-implement.md +183 -0
  2115. package/pro/squads/squad-creator-pro/tasks/next-action.md +149 -0
  2116. package/pro/squads/squad-creator-pro/tasks/optimize-binary-checkpoints.md +114 -0
  2117. package/pro/squads/squad-creator-pro/tasks/optimize-determinism-analysis.md +164 -0
  2118. package/pro/squads/squad-creator-pro/tasks/optimize-empirical-validation.md +138 -0
  2119. package/pro/squads/squad-creator-pro/tasks/optimize-gap-zero.md +111 -0
  2120. package/pro/squads/squad-creator-pro/tasks/optimize-gatekeeper-detection.md +113 -0
  2121. package/pro/squads/squad-creator-pro/tasks/optimize-hybrid-executor.md +117 -0
  2122. package/pro/squads/squad-creator-pro/tasks/optimize-post-economy.md +158 -0
  2123. package/pro/squads/squad-creator-pro/tasks/optimize-scope-clarification.md +110 -0
  2124. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-apply.md +142 -0
  2125. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-checkpoints.md +108 -0
  2126. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-executor-distribution.md +107 -0
  2127. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-gap-zero.md +113 -0
  2128. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-parallelization.md +107 -0
  2129. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-phase-necessity.md +139 -0
  2130. package/pro/squads/squad-creator-pro/tasks/optimize-workflow-report.md +146 -0
  2131. package/pro/squads/squad-creator-pro/tasks/optimize-workflow.md +139 -0
  2132. package/pro/squads/squad-creator-pro/tasks/optimize.md +172 -0
  2133. package/pro/squads/squad-creator-pro/tasks/parallel-discovery.md +111 -0
  2134. package/pro/squads/squad-creator-pro/tasks/plan-squad-architecture.md +34 -0
  2135. package/pro/squads/squad-creator-pro/tasks/plan-squad-challenge-reorder.md +34 -0
  2136. package/pro/squads/squad-creator-pro/tasks/plan-squad-contract.md +38 -0
  2137. package/pro/squads/squad-creator-pro/tasks/plan-squad-depth-calibration.md +34 -0
  2138. package/pro/squads/squad-creator-pro/tasks/plan-squad-domain-mapping.md +32 -0
  2139. package/pro/squads/squad-creator-pro/tasks/plan-squad-prd-assembly.md +37 -0
  2140. package/pro/squads/squad-creator-pro/tasks/plan-squad-roadmap.md +32 -0
  2141. package/pro/squads/squad-creator-pro/tasks/plan-squad.md +90 -0
  2142. package/pro/squads/squad-creator-pro/tasks/pv-audit-deep-dive.md +157 -0
  2143. package/pro/squads/squad-creator-pro/tasks/pv-audit-overview.md +157 -0
  2144. package/pro/squads/squad-creator-pro/tasks/pv-audit-sample.md +188 -0
  2145. package/pro/squads/squad-creator-pro/tasks/pv-audit.md +171 -0
  2146. package/pro/squads/squad-creator-pro/tasks/pv-axioma-assessment.md +172 -0
  2147. package/pro/squads/squad-creator-pro/tasks/pv-modernization-score.md +162 -0
  2148. package/pro/squads/squad-creator-pro/tasks/qa-after-creation.md +114 -0
  2149. package/pro/squads/squad-creator-pro/tasks/qualify-task.md +117 -0
  2150. package/pro/squads/squad-creator-pro/tasks/refresh-registry-enrich.md +171 -0
  2151. package/pro/squads/squad-creator-pro/tasks/refresh-registry-scan.md +173 -0
  2152. package/pro/squads/squad-creator-pro/tasks/refresh-registry-write.md +192 -0
  2153. package/pro/squads/squad-creator-pro/tasks/refresh-registry.md +163 -0
  2154. package/pro/squads/squad-creator-pro/tasks/smoke-test-model-routing-comparison.md +49 -0
  2155. package/pro/squads/squad-creator-pro/tasks/smoke-test-model-routing-execution.md +49 -0
  2156. package/pro/squads/squad-creator-pro/tasks/smoke-test-model-routing-lookup.md +49 -0
  2157. package/pro/squads/squad-creator-pro/tasks/smoke-test-model-routing-preflight.md +48 -0
  2158. package/pro/squads/squad-creator-pro/tasks/smoke-test-model-routing-report.md +51 -0
  2159. package/pro/squads/squad-creator-pro/tasks/smoke-test-model-routing.md +105 -0
  2160. package/pro/squads/squad-creator-pro/tasks/squad-analytics.md +192 -0
  2161. package/pro/squads/squad-creator-pro/tasks/squad-fusion-cleanup.md +93 -0
  2162. package/pro/squads/squad-creator-pro/tasks/squad-fusion-command-sync.md +97 -0
  2163. package/pro/squads/squad-creator-pro/tasks/squad-fusion-deduplication.md +234 -0
  2164. package/pro/squads/squad-creator-pro/tasks/squad-fusion-discovery.md +98 -0
  2165. package/pro/squads/squad-creator-pro/tasks/squad-fusion-execution.md +246 -0
  2166. package/pro/squads/squad-creator-pro/tasks/squad-fusion-initialize.md +247 -0
  2167. package/pro/squads/squad-creator-pro/tasks/squad-fusion-integration.md +95 -0
  2168. package/pro/squads/squad-creator-pro/tasks/squad-fusion-resolution.md +205 -0
  2169. package/pro/squads/squad-creator-pro/tasks/squad-fusion-scope.md +95 -0
  2170. package/pro/squads/squad-creator-pro/tasks/squad-fusion-structure.md +128 -0
  2171. package/pro/squads/squad-creator-pro/tasks/squad-fusion-validation.md +96 -0
  2172. package/pro/squads/squad-creator-pro/tasks/squad-fusion.md +148 -0
  2173. package/pro/squads/squad-creator-pro/tasks/sync-chief-codex-skill.md +107 -0
  2174. package/pro/squads/squad-creator-pro/tasks/sync-ide-skills.md +192 -0
  2175. package/pro/squads/squad-creator-pro/tasks/update-mind-apply.md +207 -0
  2176. package/pro/squads/squad-creator-pro/tasks/update-mind-extract-merge.md +257 -0
  2177. package/pro/squads/squad-creator-pro/tasks/update-mind-extract.md +201 -0
  2178. package/pro/squads/squad-creator-pro/tasks/update-mind-load-snapshot.md +177 -0
  2179. package/pro/squads/squad-creator-pro/tasks/update-mind-load.md +173 -0
  2180. package/pro/squads/squad-creator-pro/tasks/update-mind-merge.md +193 -0
  2181. package/pro/squads/squad-creator-pro/tasks/update-mind.md +177 -0
  2182. package/pro/squads/squad-creator-pro/tasks/upgrade-squad-apply.md +104 -0
  2183. package/pro/squads/squad-creator-pro/tasks/upgrade-squad-gap.md +110 -0
  2184. package/pro/squads/squad-creator-pro/tasks/upgrade-squad-inventory.md +110 -0
  2185. package/pro/squads/squad-creator-pro/tasks/upgrade-squad-plan.md +107 -0
  2186. package/pro/squads/squad-creator-pro/tasks/upgrade-squad-qualitative.md +104 -0
  2187. package/pro/squads/squad-creator-pro/tasks/upgrade-squad-verify.md +106 -0
  2188. package/pro/squads/squad-creator-pro/tasks/upgrade-squad.md +155 -0
  2189. package/pro/squads/squad-creator-pro/tasks/validate-extraction-adversarial.md +182 -0
  2190. package/pro/squads/squad-creator-pro/tasks/validate-extraction-checklist.md +155 -0
  2191. package/pro/squads/squad-creator-pro/tasks/validate-extraction-gate.md +175 -0
  2192. package/pro/squads/squad-creator-pro/tasks/validate-extraction.md +151 -0
  2193. package/pro/squads/squad-creator-pro/tasks/validate-squad-contextual.md +120 -0
  2194. package/pro/squads/squad-creator-pro/tasks/validate-squad-cross-references.md +122 -0
  2195. package/pro/squads/squad-creator-pro/tasks/validate-squad-deterministic.md +261 -0
  2196. package/pro/squads/squad-creator-pro/tasks/validate-squad-quality.md +138 -0
  2197. package/pro/squads/squad-creator-pro/tasks/validate-squad-verdict.md +183 -0
  2198. package/pro/squads/squad-creator-pro/tasks/validate-squad.md +135 -0
  2199. package/pro/squads/squad-creator-pro/tasks/workspace-integration-hardening.md +187 -0
  2200. package/pro/squads/squad-creator-pro/templates/.gitkeep +1 -0
  2201. package/pro/squads/squad-creator-pro/templates/agent-flow-doc-tmpl.md +512 -0
  2202. package/pro/squads/squad-creator-pro/templates/agent-tmpl.md +697 -0
  2203. package/pro/squads/squad-creator-pro/templates/config-tmpl.yaml +434 -0
  2204. package/pro/squads/squad-creator-pro/templates/cross-domain-handoff-tmpl.yaml +17 -0
  2205. package/pro/squads/squad-creator-pro/templates/journey-log-tmpl.yaml +75 -0
  2206. package/pro/squads/squad-creator-pro/templates/pop-extractor-prompt.md +549 -0
  2207. package/pro/squads/squad-creator-pro/templates/quality-gate-tmpl.yaml +589 -0
  2208. package/pro/squads/squad-creator-pro/templates/readme-tmpl.md +231 -0
  2209. package/pro/squads/squad-creator-pro/templates/report-tmpl.yaml +14 -0
  2210. package/pro/squads/squad-creator-pro/templates/research-output-tmpl.md +625 -0
  2211. package/pro/squads/squad-creator-pro/templates/research-prompt-tmpl.md +479 -0
  2212. package/pro/squads/squad-creator-pro/templates/session-heuristic-tmpl.md +100 -0
  2213. package/pro/squads/squad-creator-pro/templates/squad-prd-deep-tmpl.md +434 -0
  2214. package/pro/squads/squad-creator-pro/templates/squad-prd-tmpl.md +464 -0
  2215. package/pro/squads/squad-creator-pro/templates/story-create-agent-tmpl.md +284 -0
  2216. package/pro/squads/squad-creator-pro/templates/task-tmpl.md +461 -0
  2217. package/pro/squads/squad-creator-pro/templates/template-tmpl.yaml +227 -0
  2218. package/pro/squads/squad-creator-pro/templates/workflow-doc-tmpl.md +860 -0
  2219. package/pro/squads/squad-creator-pro/templates/workflow-tmpl.yaml +394 -0
  2220. package/pro/squads/squad-creator-pro/test-cases/BATCH-PROGRESS.md +268 -0
  2221. package/pro/squads/squad-creator-pro/test-cases/QUALIFICATION-DASHBOARD.yaml +13 -0
  2222. package/pro/squads/squad-creator-pro/test-cases/_template.yaml +147 -0
  2223. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/ASSESSMENT-SUMMARY.md +275 -0
  2224. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/ASSESSMENT_SUMMARY.md +140 -0
  2225. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/CHECKPOINT_MATRIX.md +202 -0
  2226. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/EXECUTION-REPORT.md +413 -0
  2227. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/EXECUTION_NOTES.md +358 -0
  2228. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/README-v2.2.2.md +299 -0
  2229. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/README.md +320 -0
  2230. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/TEST-REPORT-v2.1.md +351 -0
  2231. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/VERIFICATION-CHECKLIST.txt +247 -0
  2232. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/formal-qualification-report.yaml +389 -0
  2233. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/opus-baseline.yaml +517 -0
  2234. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/qualification-report.yaml +213 -0
  2235. package/pro/squads/squad-creator-pro/test-cases/an-assess-sources/test-case.yaml +69 -0
  2236. package/pro/squads/squad-creator-pro/test-cases/an-clone-review/opus-baseline.yaml +566 -0
  2237. package/pro/squads/squad-creator-pro/test-cases/an-clone-review/qualification-report.yaml +82 -0
  2238. package/pro/squads/squad-creator-pro/test-cases/an-design-clone/test-case.yaml +102 -0
  2239. package/pro/squads/squad-creator-pro/test-cases/an-extract-dna/test-case.yaml +105 -0
  2240. package/pro/squads/squad-creator-pro/test-cases/an-fidelity-score/opus-baseline.yaml +266 -0
  2241. package/pro/squads/squad-creator-pro/test-cases/an-fidelity-score/qualification-report.yaml +94 -0
  2242. package/pro/squads/squad-creator-pro/test-cases/an-validate-clone/opus-baseline.yaml +470 -0
  2243. package/pro/squads/squad-creator-pro/test-cases/an-validate-clone/qualification-report.yaml +106 -0
  2244. package/pro/squads/squad-creator-pro/test-cases/collect-sources/test-case.yaml +105 -0
  2245. package/pro/squads/squad-creator-pro/test-cases/create-task/test-case.yaml +104 -0
  2246. package/pro/squads/squad-creator-pro/test-cases/cross-provider/DASHBOARD.yaml +11 -0
  2247. package/pro/squads/squad-creator-pro/test-cases/pv-audit/test-case.yaml +106 -0
  2248. package/pro/squads/squad-creator-pro/test-cases/pv-axioma-assessment/opus-baseline.yaml +96 -0
  2249. package/pro/squads/squad-creator-pro/test-cases/pv-axioma-assessment/sonnet-output.yaml +30 -0
  2250. package/pro/squads/squad-creator-pro/test-cases/pv-axioma-assessment/test-case.yaml +129 -0
  2251. package/pro/squads/squad-creator-pro/test-cases/pv-modernization-score/comparison-round-1.yaml +242 -0
  2252. package/pro/squads/squad-creator-pro/test-cases/pv-modernization-score/opus-baseline.yaml +488 -0
  2253. package/pro/squads/squad-creator-pro/test-cases/pv-modernization-score/qualification-report.yaml +74 -0
  2254. package/pro/squads/squad-creator-pro/test-cases/qa-after-creation/opus-baseline.yaml +603 -0
  2255. package/pro/squads/squad-creator-pro/test-cases/qa-after-creation/qualification-report.yaml +97 -0
  2256. package/pro/squads/squad-creator-pro/test-cases/smoke-test-model-routing/test-case.yaml +100 -0
  2257. package/pro/squads/squad-creator-pro/test-cases/upgrade-squad/test-case.yaml +106 -0
  2258. package/pro/squads/squad-creator-pro/test-cases/validate-squad/comparison-round-1.yaml +223 -0
  2259. package/pro/squads/squad-creator-pro/test-cases/validate-squad/opus-baseline.yaml +529 -0
  2260. package/pro/squads/squad-creator-pro/test-cases/validate-squad/opus-round-3-v4-task.yaml +132 -0
  2261. package/pro/squads/squad-creator-pro/test-cases/validate-squad/qualification-report.yaml +104 -0
  2262. package/pro/squads/squad-creator-pro/test-cases/wf-clone-mind/opus-baseline.yaml +112 -0
  2263. package/pro/squads/squad-creator-pro/utils/.gitkeep +1 -0
  2264. package/pro/squads/squad-creator-pro/workflows/.gitkeep +1 -0
  2265. package/pro/squads/squad-creator-pro/workflows/create-squad.yaml +300 -0
  2266. package/pro/squads/squad-creator-pro/workflows/modules/module-discovery.yaml +16 -0
  2267. package/pro/squads/squad-creator-pro/workflows/modules/module-integration.yaml +34 -0
  2268. package/pro/squads/squad-creator-pro/workflows/modules/module-quality-gates.yaml +20 -0
  2269. package/pro/squads/squad-creator-pro/workflows/validate-squad.yaml +552 -0
  2270. package/pro/squads/squad-creator-pro/workflows/wf-assess-sources.yaml +62 -0
  2271. package/pro/squads/squad-creator-pro/workflows/wf-auto-acquire-sources.yaml +520 -0
  2272. package/pro/squads/squad-creator-pro/workflows/wf-brownfield-upgrade-squad.yaml +142 -0
  2273. package/pro/squads/squad-creator-pro/workflows/wf-clone-mind.yaml +607 -0
  2274. package/pro/squads/squad-creator-pro/workflows/wf-clone-review.yaml +111 -0
  2275. package/pro/squads/squad-creator-pro/workflows/wf-collect-sources.yaml +104 -0
  2276. package/pro/squads/squad-creator-pro/workflows/wf-compare-outputs.yaml +77 -0
  2277. package/pro/squads/squad-creator-pro/workflows/wf-context-aware-create-squad.yaml +177 -0
  2278. package/pro/squads/squad-creator-pro/workflows/wf-create-from-sop.yaml +117 -0
  2279. package/pro/squads/squad-creator-pro/workflows/wf-create-pipeline.yaml +19 -0
  2280. package/pro/squads/squad-creator-pro/workflows/wf-create-squad.yaml +1763 -0
  2281. package/pro/squads/squad-creator-pro/workflows/wf-create-task.yaml +22 -0
  2282. package/pro/squads/squad-creator-pro/workflows/wf-create-template.yaml +17 -0
  2283. package/pro/squads/squad-creator-pro/workflows/wf-create-workflow.yaml +22 -0
  2284. package/pro/squads/squad-creator-pro/workflows/wf-cross-provider-qualification.yaml +660 -0
  2285. package/pro/squads/squad-creator-pro/workflows/wf-deconstruct.yaml +92 -0
  2286. package/pro/squads/squad-creator-pro/workflows/wf-deep-research.yaml +148 -0
  2287. package/pro/squads/squad-creator-pro/workflows/wf-design-clone.yaml +103 -0
  2288. package/pro/squads/squad-creator-pro/workflows/wf-diagnose-clone.yaml +115 -0
  2289. package/pro/squads/squad-creator-pro/workflows/wf-discover-tools.yaml +1711 -0
  2290. package/pro/squads/squad-creator-pro/workflows/wf-extract-dna.yaml +103 -0
  2291. package/pro/squads/squad-creator-pro/workflows/wf-extract-expert-gold.yaml +101 -0
  2292. package/pro/squads/squad-creator-pro/workflows/wf-extract-framework.yaml +108 -0
  2293. package/pro/squads/squad-creator-pro/workflows/wf-extract-implicit.yaml +101 -0
  2294. package/pro/squads/squad-creator-pro/workflows/wf-extract-knowledge.yaml +162 -0
  2295. package/pro/squads/squad-creator-pro/workflows/wf-extract-sop.yaml +143 -0
  2296. package/pro/squads/squad-creator-pro/workflows/wf-extract-thinking-dna.yaml +210 -0
  2297. package/pro/squads/squad-creator-pro/workflows/wf-extract-voice-dna.yaml +76 -0
  2298. package/pro/squads/squad-creator-pro/workflows/wf-extraction-pipeline.yaml +475 -0
  2299. package/pro/squads/squad-creator-pro/workflows/wf-fidelity-score.yaml +88 -0
  2300. package/pro/squads/squad-creator-pro/workflows/wf-find-08.yaml +71 -0
  2301. package/pro/squads/squad-creator-pro/workflows/wf-install-context-stack.yaml +88 -0
  2302. package/pro/squads/squad-creator-pro/workflows/wf-install-workspace-context.yaml +764 -0
  2303. package/pro/squads/squad-creator-pro/workflows/wf-migrate-workflows.yaml +103 -0
  2304. package/pro/squads/squad-creator-pro/workflows/wf-mind-research-loop.yaml +671 -0
  2305. package/pro/squads/squad-creator-pro/workflows/wf-model-tier-qualification.yaml +737 -0
  2306. package/pro/squads/squad-creator-pro/workflows/wf-modernize-squad.yaml +178 -0
  2307. package/pro/squads/squad-creator-pro/workflows/wf-next-action.yaml +113 -0
  2308. package/pro/squads/squad-creator-pro/workflows/wf-optimize-squad.yaml +761 -0
  2309. package/pro/squads/squad-creator-pro/workflows/wf-optimize-workflow.yaml +122 -0
  2310. package/pro/squads/squad-creator-pro/workflows/wf-optimize-yolo.yaml +595 -0
  2311. package/pro/squads/squad-creator-pro/workflows/wf-plan-squad.yaml +255 -0
  2312. package/pro/squads/squad-creator-pro/workflows/wf-pv-audit.yaml +115 -0
  2313. package/pro/squads/squad-creator-pro/workflows/wf-refresh-registry.yaml +110 -0
  2314. package/pro/squads/squad-creator-pro/workflows/wf-research-then-create-agent.yaml +858 -0
  2315. package/pro/squads/squad-creator-pro/workflows/wf-smoke-test-model-routing.yaml +103 -0
  2316. package/pro/squads/squad-creator-pro/workflows/wf-squad-fusion.yaml +1691 -0
  2317. package/pro/squads/squad-creator-pro/workflows/wf-update-mind.yaml +148 -0
  2318. package/pro/squads/squad-creator-pro/workflows/wf-upgrade-squad.yaml +141 -0
  2319. package/pro/squads/squad-creator-pro/workflows/wf-validate-clone.yaml +120 -0
  2320. package/pro/squads/squad-creator-pro/workflows/wf-validate-extraction.yaml +111 -0
  2321. package/pro/squads/squad-creator-pro/workflows/wf-workspace-integration-hardening.yaml +119 -0
  2322. package/pro/squads/storytelling/CHANGELOG.md +30 -0
  2323. package/pro/squads/storytelling/HEADLINE.md +3 -0
  2324. package/pro/squads/storytelling/README.md +137 -0
  2325. package/pro/squads/storytelling/agents/blake-snyder.md +451 -0
  2326. package/pro/squads/storytelling/agents/dan-harmon.md +742 -0
  2327. package/pro/squads/storytelling/agents/donald-miller.md +662 -0
  2328. package/pro/squads/storytelling/agents/joseph-campbell.md +625 -0
  2329. package/pro/squads/storytelling/agents/keith-johnstone.md +467 -0
  2330. package/pro/squads/storytelling/agents/kindra-hall.md +953 -0
  2331. package/pro/squads/storytelling/agents/marshall-ganz.md +473 -0
  2332. package/pro/squads/storytelling/agents/matthew-dicks.md +526 -0
  2333. package/pro/squads/storytelling/agents/nancy-duarte.md +528 -0
  2334. package/pro/squads/storytelling/agents/oren-klaff.md +785 -0
  2335. package/pro/squads/storytelling/agents/park-howell.md +807 -0
  2336. package/pro/squads/storytelling/agents/shawn-coyne.md +540 -0
  2337. package/pro/squads/storytelling/agents/story-chief.md +409 -0
  2338. package/pro/squads/storytelling/checklists/story-quality-checklist.md +100 -0
  2339. package/pro/squads/storytelling/config.yaml +248 -0
  2340. package/pro/squads/storytelling/data/story-mappings.yaml +200 -0
  2341. package/pro/squads/storytelling/docs/.gitkeep +0 -0
  2342. package/pro/squads/storytelling/research/blake-snyder-save-the-cat-research.md +958 -0
  2343. package/pro/squads/storytelling/research/donald-miller-storybrand-research.md +1205 -0
  2344. package/pro/squads/storytelling/research/joseph-campbell-heros-journey-research.md +1170 -0
  2345. package/pro/squads/storytelling/research/keith-johnstone-improv-spontaneity-research.md +574 -0
  2346. package/pro/squads/storytelling/research/marshall-ganz-public-narrative-research.md +658 -0
  2347. package/pro/squads/storytelling/research/nancy-duarte-sparkline-research.md +892 -0
  2348. package/pro/squads/storytelling/research/shawn-coyne-story-grid-research.md +760 -0
  2349. package/pro/squads/storytelling/scripts/generate-story-greeting.cjs +140 -0
  2350. package/pro/squads/storytelling/scripts/load-context.cjs +141 -0
  2351. package/pro/squads/storytelling/scripts/resolve-readiness.cjs +45 -0
  2352. package/pro/squads/storytelling/scripts/runtime-paths.cjs +44 -0
  2353. package/pro/squads/storytelling/scripts/set-active-context.cjs +108 -0
  2354. package/pro/squads/storytelling/scripts/show-context.cjs +22 -0
  2355. package/pro/squads/storytelling/squad-io.yaml +573 -0
  2356. package/pro/squads/storytelling/tasks/apply-abt.md +856 -0
  2357. package/pro/squads/storytelling/tasks/apply-beat-sheet.md +1245 -0
  2358. package/pro/squads/storytelling/tasks/apply-heros-journey.md +1100 -0
  2359. package/pro/squads/storytelling/tasks/apply-save-the-cat.md +1075 -0
  2360. package/pro/squads/storytelling/tasks/apply-story-circle.md +1116 -0
  2361. package/pro/squads/storytelling/tasks/craft-personal-story.md +1004 -0
  2362. package/pro/squads/storytelling/tasks/craft-public-narrative.md +1193 -0
  2363. package/pro/squads/storytelling/tasks/craft-ted-talk.md +773 -0
  2364. package/pro/squads/storytelling/tasks/create-brandscript.md +1376 -0
  2365. package/pro/squads/storytelling/tasks/create-business-story.md +1472 -0
  2366. package/pro/squads/storytelling/tasks/create-pitch.md +1128 -0
  2367. package/pro/squads/storytelling/tasks/diagnose-story-grid.md +979 -0
  2368. package/pro/squads/storytelling/tasks/improvise-story.md +772 -0
  2369. package/pro/squads/storytelling/templates/narrative-output-tmpl.md +44 -0
  2370. package/pro/squads/storytelling/workflows/story-creation.yaml +80 -0
  2371. package/scripts/e2e/installed-skills-smoke.js +264 -0
  2372. package/scripts/package-synapse.js +3 -3
  2373. package/scripts/validate-package-completeness.js +7 -7
  2374. package/.aiox-core/lib/build.json +0 -1
@@ -0,0 +1,4340 @@
1
+ #!/usr/bin/env bash
2
+ # ═══════════════════════════════════════════════════════════════════════════════
3
+ # VALIDATE-SQUAD.SH - Hybrid Squad Validation Script
4
+ # ═══════════════════════════════════════════════════════════════════════════════
5
+ # Version: 4.0.0 - Dimensional Validation
6
+ # Compatibility: bash 3.2+ (macOS compatible)
7
+ # Purpose: Hybrid validation - bash for deterministic, Claude for qualitative
8
+ # Usage: ./validate-squad.sh <squad-name> [--verbose] [--quick] [--json]
9
+ #
10
+ # HYBRID APPROACH:
11
+ # BASH (deterministic):
12
+ # - File/directory existence
13
+ # - Security scan (grep patterns)
14
+ # - Cross-reference validation
15
+ # - Metrics collection (counts, ratios)
16
+ #
17
+ # CLAUDE CLI (qualitative):
18
+ # - Prompt quality analysis
19
+ # - Pipeline coherence evaluation
20
+ # - Voice consistency check
21
+ # - Overall assessment & recommendations
22
+ #
23
+ # Exit codes:
24
+ # 0 = PASS (score >= 7.0, no blocking issues)
25
+ # 1 = FAIL (score < 7.0 or blocking issues)
26
+ # 2 = ERROR (script error, invalid input)
27
+ # ═══════════════════════════════════════════════════════════════════════════════
28
+
29
+ set -uo pipefail
30
+
31
+ # Force C locale for numeric operations (awk/printf decimal separator)
32
+ export LC_NUMERIC=C
33
+
34
+ # ═══════════════════════════════════════════════════════════════════════════════
35
+ # CONFIGURATION
36
+ # ═══════════════════════════════════════════════════════════════════════════════
37
+
38
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
39
+ SQUAD_CREATOR_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
40
+ WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
41
+ SQUADS_DIR="$WORKSPACE_ROOT/squads"
42
+ RUNTIME_STATE_HELPER="$SCRIPT_DIR/lib/validate-runtime-state.cjs"
43
+ C_LEVEL_WORKSPACE_DIR="$SQUADS_DIR/c-level"
44
+ WORKFLOW_CONTRACT_VALIDATOR="$WORKSPACE_ROOT/infrastructure/scripts/squads/validate_workflow_contracts.cjs"
45
+ # ── Bootstrap all shared libs (runner-lib v2 + validator-lib) ──
46
+ RUNNER_LIB_DIR="$WORKSPACE_ROOT/infrastructure/scripts/runner-lib"
47
+ source "$RUNNER_LIB_DIR/pipeline-bootstrap.sh"
48
+ HAS_RUNTIME_LIB="${RUNNER_LIB_RUNTIME:-false}"
49
+ HAS_METRICS_LIB="${RUNNER_LIB_METRICS:-false}"
50
+
51
+ # Model configuration
52
+ MODEL_DEFAULT="" # Resolved from runner-lib model catalog
53
+ MODEL_FAST="" # Resolved from runner-lib model catalog
54
+ MODEL_QUALITY=""
55
+ MODEL_SELECTION_MODE="default"
56
+ SELECTED_RUNTIME="claude" # Default runtime
57
+
58
+ refresh_runtime_models() {
59
+ case "$SELECTED_RUNTIME" in
60
+ claude)
61
+ MODEL_DEFAULT="opus"
62
+ MODEL_FAST="haiku"
63
+ ;;
64
+ codex)
65
+ MODEL_DEFAULT="gpt-5.4"
66
+ MODEL_FAST="gpt-5.4-mini"
67
+ ;;
68
+ gemini)
69
+ MODEL_DEFAULT="gemini-3.1-pro-preview"
70
+ MODEL_FAST="gemini-2.5-flash"
71
+ ;;
72
+ esac
73
+
74
+ if declare -f get_quality_model >/dev/null 2>&1; then
75
+ MODEL_DEFAULT="$(get_quality_model "$SELECTED_RUNTIME")"
76
+ MODEL_FAST="$(get_fast_model "$SELECTED_RUNTIME")"
77
+ fi
78
+ }
79
+
80
+ apply_runtime_selection() {
81
+ local runtime="$1"
82
+ SELECTED_RUNTIME="$runtime"
83
+ refresh_runtime_models
84
+
85
+ case "$MODEL_SELECTION_MODE" in
86
+ fast)
87
+ MODEL_QUALITY="$MODEL_FAST"
88
+ ;;
89
+ explicit)
90
+ ;;
91
+ *)
92
+ MODEL_QUALITY="$MODEL_DEFAULT"
93
+ ;;
94
+ esac
95
+ }
96
+
97
+ apply_runtime_selection "$SELECTED_RUNTIME"
98
+ REQUESTED_RUNTIME="$SELECTED_RUNTIME"
99
+
100
+ # LLM runtime config (used by runtime.sh run_llm_prompt)
101
+ LLM_TIMEOUT_SECONDS="${SINKRA_LLM_TIMEOUT:-3600}"
102
+ RETRY_MAX_ATTEMPTS="${SINKRA_RETRY_MAX_ATTEMPTS:-2}"
103
+ RETRY_BASE_DELAY_SECONDS="${SINKRA_RETRY_BASE_DELAY:-3}"
104
+ export LLM_TIMEOUT_SECONDS RETRY_MAX_ATTEMPTS RETRY_BASE_DELAY_SECONDS SELECTED_RUNTIME
105
+
106
+ # Guards integrados em run_llm_prompt() (Story 101.12 AC8)
107
+ export COST_CAP_GUARD=true
108
+ export CIRCUIT_BREAKER_THRESHOLD=3
109
+ export HEADLESS_TRUNCATE_BYTES=12000
110
+ export HEADLESS_FILTER=true
111
+
112
+ # Replan-on-failure: validators use max 1 attempt (Story 101.10 AC9)
113
+ PHASE_REPLAN="${PHASE_REPLAN:-true}"
114
+ REPLAN_MAX_ATTEMPTS="${REPLAN_MAX_ATTEMPTS:-1}"
115
+ export PHASE_REPLAN REPLAN_MAX_ATTEMPTS
116
+ VALIDATION_SESSION_ID=""
117
+ VALIDATION_STATE_FILE=""
118
+
119
+ # Progress log path (set after SQUAD_NAME is known)
120
+ PROGRESS_LOG=""
121
+
122
+ # Append to progress log
123
+ _progress_log() {
124
+ [[ -n "$PROGRESS_LOG" ]] && echo "$@" >> "$PROGRESS_LOG"
125
+ }
126
+
127
+ # Get historical scores from previous validation runs for LLM calibration
128
+ _get_historical_scores() {
129
+ local history_dir="$WORKSPACE_ROOT/outputs/squad-validations/${SQUAD_NAME:-unknown}"
130
+ if [[ ! -d "$history_dir" ]]; then
131
+ echo "(no prior runs)"
132
+ return
133
+ fi
134
+ local found=0
135
+ for run_dir in "$history_dir"/2*; do
136
+ [[ -d "$run_dir" && -f "$run_dir/score_card.yaml" ]] || continue
137
+ local run_id
138
+ run_id=$(basename "$run_dir")
139
+ local prev_score
140
+ prev_score=$(python3 -c "
141
+ import yaml
142
+ with open('$run_dir/score_card.yaml') as f:
143
+ d = yaml.safe_load(f) or {}
144
+ s = d.get('scores',{})
145
+ print(f'{s.get(\"final\",\"?\")}/10 ({s.get(\"verdict\",\"?\")})')
146
+ " 2>/dev/null || echo "?")
147
+ echo "- $run_id: $prev_score"
148
+ found=$((found + 1))
149
+ [[ "$found" -ge 5 ]] && break
150
+ done
151
+ [[ "$found" -eq 0 ]] && echo "(no prior runs)"
152
+ }
153
+
154
+ # _run_llm() removed — Story 101.12 AC8
155
+ # Guards (cost cap, circuit breaker, truncate, filter) now integrated in run_llm_prompt() via env vars.
156
+ # Call sites migrated to run_llm_prompt() direto.
157
+ # Note: _exec_runtime call at L4157 (evaluator) is intentionally left unchanged.
158
+
159
+ # Colors — provided by validator-lib/colors.sh if available, fallback inline
160
+ if [[ "${VALIDATOR_LIB_COLORS:-false}" != "true" ]]; then
161
+ RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'
162
+ BLUE='\033[0;34m'; CYAN='\033[0;36m'; BOLD='\033[1m'; NC='\033[0m'
163
+ fi
164
+ MAGENTA='\033[0;36m' # Using cyan — magenta/purple is unreadable on dark terminals
165
+
166
+ # Counters
167
+ PASS_COUNT=0
168
+ FAIL_COUNT=0
169
+ WARN_COUNT=0
170
+ DRY_RUN=false
171
+
172
+ # Results arrays
173
+ BLOCKING_ISSUES=""
174
+ WARNINGS=""
175
+
176
+ # Metrics (simple variables for bash 3.x compatibility)
177
+ M_AGENT_COUNT=0
178
+ M_TASK_COUNT=0
179
+ M_CHECKLIST_COUNT=0
180
+ M_TEMPLATE_COUNT=0
181
+ M_DATA_COUNT=0
182
+ M_TOTAL_LINES=0
183
+ M_SECURITY_ISSUES=0
184
+ M_XREF_ISSUES=0
185
+ M_OPG_WARNINGS=0
186
+ M_SQUAD_TYPE="unknown"
187
+ M_TYPE_CONFIDENCE=0
188
+ M_PROMPT_QUALITY=""
189
+ M_STRUCTURE_COHERENCE=""
190
+ M_COVERAGE_SCORE=""
191
+ M_DOCUMENTATION=""
192
+ M_QUALITY_SCORE="N/A"
193
+ M_IMPROVEMENTS=""
194
+ M_IMPROVEMENTS_REPORT=""
195
+ M_PROD_SCORE=0
196
+ M_WORKFLOW_CONTRACT_FILES=0
197
+ M_WORKFLOW_CONTRACT_ERRORS=0
198
+ M_WORKFLOW_CONTRACT_WARNINGS=0
199
+ CONFIG_TASK_IDS=""
200
+
201
+ # New dimensional metrics
202
+ M_AGNOSTICISM_VIOLATIONS=0
203
+ M_AGNOSTICISM_DETAILS=""
204
+ M_AGENT_QUALITY_GAPS=0
205
+ M_VERSION_CONSISTENT="true"
206
+ M_VERSION_DETAILS=""
207
+ M_STRUCT_COMPLETENESS_PASS=0
208
+ M_STRUCT_COMPLETENESS_TOTAL=0
209
+ M_CONTEXTUAL_LIFECYCLE_PASS=0
210
+ M_CONTEXTUAL_LIFECYCLE_TOTAL=0
211
+ M_CONTEXTUAL_LIFECYCLE_WARNINGS=0
212
+ M_HAS_TESTED_FLAG="false"
213
+ M_HAS_ARCHITECTURE_DOC="false"
214
+ M_HAS_UPDATE_TASK="false"
215
+ M_HAS_DELETE_TASK="false"
216
+
217
+ # Claude dimensional scores (populated by Phase 6)
218
+ CLAUDE_STRUCTURAL_COMPLETENESS=""
219
+ CLAUDE_SECURITY_AUDIT=""
220
+ CLAUDE_WORKFLOW_ANALYSIS=""
221
+ CLAUDE_AGENT_QUALITY=""
222
+ CLAUDE_SQUAD_AGNOSTICISM=""
223
+ CLAUDE_CONFIG_QUALITY=""
224
+ CLAUDE_PRODUCTION_EVIDENCE=""
225
+ CLAUDE_EXEC_SUMMARY=""
226
+ CLAUDE_EXEC_SUMMARY_REPORT=""
227
+ CLAUDE_BLOCKING_ANALYSIS=""
228
+ CLAUDE_RAW_JSON=""
229
+ CLAUDE_REPORT_JSON=""
230
+ SCORING_CAP_REASONS=""
231
+ FINAL_SCORE_RAW="0.00"
232
+ DIM_FUNCTIONALITY_NOTE=""
233
+ DIM_SECURITY_NOTE=""
234
+ DIM_WORKFLOW_CONTRACT_NOTE=""
235
+ DIM_STRUCTURAL_NOTE=""
236
+ DIM_AGENT_QUALITY_NOTE=""
237
+ DIM_AGNOSTICISM_NOTE=""
238
+ DIM_PRODUCTION_NOTE=""
239
+ DIM_CONFIG_NOTE=""
240
+ DIM_DOCUMENTATION_NOTE=""
241
+
242
+ # Phase results
243
+ TIER1_FAIL=0
244
+ SEC_FAIL=0
245
+ XREF_FAIL=0
246
+ WF_CONTRACT_FAIL=0
247
+ PROD_SCORE=0
248
+ PROD_MAX=5
249
+ FINAL_SCORE=0
250
+ ENTRY_AGENT=""
251
+ VALIDATION_RESULT="FAIL"
252
+ EXIT_CODE=1
253
+ CURRENT_PHASE="init"
254
+ REPORT_LANG="auto"
255
+ REPORT_LANG_RESOLVED="en"
256
+ REPORT_LANGUAGE_NAME="English"
257
+ ANALYSIS_LANG="en"
258
+ ANALYSIS_LANGUAGE_NAME="English"
259
+ LOCALIZED_REPORT_AVAILABLE="false"
260
+
261
+ normalize_lang_code() {
262
+ local raw
263
+ raw=$(printf '%s' "${1:-}" | tr '[:upper:]' '[:lower:]' | tr '_' '-')
264
+ case "$raw" in
265
+ ""|auto)
266
+ echo "auto"
267
+ ;;
268
+ pt|pt-br|pt-pt|pt-*)
269
+ echo "pt-br"
270
+ ;;
271
+ en|en-us|en-gb|en-*)
272
+ echo "en"
273
+ ;;
274
+ *)
275
+ echo "$raw"
276
+ ;;
277
+ esac
278
+ }
279
+
280
+ resolve_report_language() {
281
+ local requested detected
282
+ requested=$(normalize_lang_code "${REPORT_LANG:-auto}")
283
+ detected="$requested"
284
+
285
+ if [[ "$requested" == "auto" ]]; then
286
+ detected=$(normalize_lang_code "${AIOX_VALIDATION_LANG:-${LANG:-${LC_MESSAGES:-${LC_ALL:-en}}}}")
287
+ fi
288
+
289
+ case "$detected" in
290
+ pt-br)
291
+ REPORT_LANG_RESOLVED="pt-br"
292
+ REPORT_LANGUAGE_NAME="português brasileiro"
293
+ ;;
294
+ *)
295
+ REPORT_LANG_RESOLVED="en"
296
+ REPORT_LANGUAGE_NAME="English"
297
+ ;;
298
+ esac
299
+ }
300
+
301
+ t() {
302
+ local key="$1"
303
+ case "${REPORT_LANG_RESOLVED}:${key}" in
304
+ pt-br:help_usage) echo "Uso: ./validate-squad.sh <squad-name> [opções]" ;;
305
+ pt-br:help_arguments) echo "Argumentos:" ;;
306
+ pt-br:help_arg_squad) echo "Nome do squad para validar (ex.: \"my-squad\", \"new-squad\")" ;;
307
+ pt-br:help_options) echo "Opções:" ;;
308
+ pt-br:help_verbose) echo "Mostra todos os checks e detalhes da análise profunda" ;;
309
+ pt-br:help_quick) echo "Pula a análise do reviewer CLI (somente determinístico)" ;;
310
+ pt-br:help_fast) echo "Usa Haiku em vez de Opus (mais barato e rápido)" ;;
311
+ pt-br:help_json) echo "Emite resultados em JSON" ;;
312
+ pt-br:help_lang) echo "Define idioma de saída: auto, pt-br, en" ;;
313
+ pt-br:help_help) echo "Mostra esta ajuda" ;;
314
+ pt-br:help_examples) echo "Exemplos:" ;;
315
+ pt-br:help_example_full) echo "Validação completa com Opus" ;;
316
+ pt-br:help_example_verbose) echo "Saída verbosa" ;;
317
+ pt-br:help_example_quick) echo "Somente determinístico (sem reviewer CLI)" ;;
318
+ pt-br:help_example_fast) echo "Validação rápida com Haiku" ;;
319
+ pt-br:help_example_lang) echo "Força relatório em português" ;;
320
+ pt-br:help_exit_codes) echo "Códigos de saída:" ;;
321
+ pt-br:help_exit_pass) echo "PASS Nota >= 7.0, sem issues bloqueantes" ;;
322
+ pt-br:help_exit_fail) echo "FAIL Nota < 7.0 ou com issues bloqueantes" ;;
323
+ pt-br:help_exit_error) echo "ERROR Input inválido ou erro do script" ;;
324
+ pt-br:unknown_option) echo "Opção desconhecida: %s" ;;
325
+ pt-br:error_squad_required) echo "Erro: nome do squad é obrigatório" ;;
326
+ pt-br:error_usage_simple) echo "Uso: ./validate-squad.sh <squad-name>" ;;
327
+ pt-br:error_squad_not_found) echo "Erro: squad não encontrado: %s" ;;
328
+ pt-br:main_title) echo "🔍 VALIDATE-SQUAD v4.0 - Validação Dimensional" ;;
329
+ pt-br:label_squad) echo "Squad" ;;
330
+ pt-br:label_path) echo "Caminho" ;;
331
+ pt-br:label_mode) echo "Modo" ;;
332
+ pt-br:label_model) echo "Modelo" ;;
333
+ pt-br:mode_quick) echo "rápido (sem reviewer CLI)" ;;
334
+ pt-br:mode_hybrid) echo "híbrido" ;;
335
+ pt-br:phase6_title) echo "PHASE 6: Análise Profunda de Qualidade (Claude CLI)" ;;
336
+ pt-br:phase6_skip) echo "Pulando análise do reviewer CLI (--quick mode)" ;;
337
+ pt-br:phase6_running) echo "Executando análise profunda com Claude usando %s..." ;;
338
+ pt-br:phase6_prompt_written) echo "Prompt gravado em arquivo temporário (%s bytes)" ;;
339
+ pt-br:phase6_result) echo "Resultado da Análise Profunda do Claude:" ;;
340
+ pt-br:phase6_failed) echo "Análise do reviewer CLI falhou; usando score determinístico" ;;
341
+ pt-br:phase6_complete) echo "Análise profunda do reviewer concluída" ;;
342
+ pt-br:phase6_language_state) echo "Artefato canônico: %s | Relatório: %s" ;;
343
+ pt-br:phase6_localization_fallback) echo "Localização do reviewer indisponível; exibindo artefato canônico em inglês" ;;
344
+ pt-br:phase7_title) echo "PHASE 7: Pontuação Final (Dimensional)" ;;
345
+ pt-br:scoring_breakdown) echo "Composição da pontuação:" ;;
346
+ pt-br:weighted_avg) echo "Média ponderada (pré-penalidade): %s" ;;
347
+ pt-br:penalty) echo "Penalidade: -%s" ;;
348
+ pt-br:after_penalty) echo "Após penalidade: %s" ;;
349
+ pt-br:after_caps) echo "Após caps: %s" ;;
350
+ pt-br:cap_reasons) echo "Motivos do cap: %s" ;;
351
+ pt-br:final_rounded) echo "Final (arredondado): %s/10" ;;
352
+ pt-br:validation_passed) echo "VALIDAÇÃO APROVADA" ;;
353
+ pt-br:validation_conditional) echo "APROVAÇÃO CONDICIONAL" ;;
354
+ pt-br:validation_failed) echo "VALIDAÇÃO REPROVADA" ;;
355
+ pt-br:verdict_pass) echo "APROVADO" ;;
356
+ pt-br:verdict_conditional) echo "CONDICIONAL" ;;
357
+ pt-br:verdict_fail) echo "REPROVADO" ;;
358
+ pt-br:label_type) echo "Tipo" ;;
359
+ pt-br:label_final) echo "Final" ;;
360
+ pt-br:label_raw) echo "Bruto" ;;
361
+ pt-br:label_verdict) echo "Veredicto" ;;
362
+ pt-br:label_analysis_language) echo "Idioma da Análise" ;;
363
+ pt-br:label_report_language) echo "Idioma do Relatório" ;;
364
+ pt-br:dimensional_scores) echo "Pontuação por Dimensão" ;;
365
+ pt-br:table_dimension) echo "Dimensão" ;;
366
+ pt-br:table_score) echo "Nota" ;;
367
+ pt-br:table_weight) echo "Peso" ;;
368
+ pt-br:weight_high) echo "ALTO" ;;
369
+ pt-br:weight_medium) echo "MÉDIO" ;;
370
+ pt-br:weight_low) echo "BAIXO" ;;
371
+ pt-br:dimension_notes) echo "Notas por Dimensão (<10)" ;;
372
+ pt-br:blocking_issues) echo "Issues Bloqueantes" ;;
373
+ pt-br:score_guardrails) echo "Guardrails de Pontuação" ;;
374
+ pt-br:deterministic_findings) echo "Achados Determinísticos" ;;
375
+ pt-br:table_check) echo "Check" ;;
376
+ pt-br:table_count) echo "Contagem" ;;
377
+ pt-br:version_consistency) echo "Consistência de Versão" ;;
378
+ pt-br:version_mismatch) echo "DIVERGÊNCIA" ;;
379
+ pt-br:priority_fixes) echo "Correções Prioritárias" ;;
380
+ pt-br:improvements) echo "Melhorias" ;;
381
+ pt-br:production_none) echo "Sem evidência de uso real — nota máxima limitada a 5/10" ;;
382
+ pt-br:production_limited) echo "Evidência de produção limitada — nota máxima limitada a 7/10" ;;
383
+ pt-br:production_good) echo "Boa evidência de produção" ;;
384
+ pt-br:functionality_label) echo "Funcionalidade/Pipeline" ;;
385
+ pt-br:security_label) echo "Segurança" ;;
386
+ pt-br:agnosticism_label) echo "Agnosticismo do Squad" ;;
387
+ pt-br:production_label) echo "Evidência de Produção" ;;
388
+ pt-br:workflow_contract_label) echo "Contrato de Workflow" ;;
389
+ pt-br:structural_label) echo "Completude Estrutural" ;;
390
+ pt-br:agent_quality_label) echo "Qualidade do Agente" ;;
391
+ pt-br:config_quality_label) echo "Qualidade da Configuração" ;;
392
+ pt-br:documentation_label) echo "Documentação" ;;
393
+ pt-br:check_tier1) echo "Falhas TIER1" ;;
394
+ pt-br:check_security) echo "Issues de Segurança" ;;
395
+ pt-br:check_xref) echo "Referências Quebradas" ;;
396
+ pt-br:check_workflow_contract) echo "Erros de Contrato de Workflow" ;;
397
+ pt-br:check_agnosticism) echo "Violações de Agnosticismo" ;;
398
+ pt-br:check_agent_quality) echo "Gaps de Qualidade do Agente" ;;
399
+ pt-br:check_structural) echo "Estrutural Obrigatório" ;;
400
+ pt-br:check_contextual_lifecycle) echo "Lifecycle Contextual" ;;
401
+ pt-br:check_warnings) echo "Warnings" ;;
402
+ pt-br:note_functionality_deep) echo "deep review retornou workflow_analysis=%s/10" ;;
403
+ pt-br:note_functionality_quick_max) echo "fallback do quick mode limita Funcionalidade a 9/10 sem análise profunda" ;;
404
+ pt-br:note_functionality_quick_reduced) echo "fallback do quick mode reduziu Funcionalidade por %s" ;;
405
+ pt-br:note_security_deep) echo "deep review retornou security_audit=%s/10" ;;
406
+ pt-br:note_security_deterministic) echo "fallback determinístico de Segurança baseado em security_fail=%s" ;;
407
+ pt-br:note_workflow_neutral) echo "sem diretório de workflows; contrato de workflow ficou neutro em 5/10" ;;
408
+ pt-br:note_workflow_deterministic) echo "nota do contrato de workflow refletiu errors=%s, warnings=%s" ;;
409
+ pt-br:note_structural_deep) echo "deep review retornou structural_completeness=%s/10" ;;
410
+ pt-br:note_structural_deterministic) echo "nota estrutural determinística baseada em checks obrigatórios=%s/%s e tier1_fail=%s" ;;
411
+ pt-br:note_agent_deep) echo "deep review retornou agent_quality=%s/10" ;;
412
+ pt-br:note_agent_deterministic) echo "entry agent sem %s de 5 seções estruturais" ;;
413
+ pt-br:note_agnosticism_deep) echo "deep review retornou squad_agnosticism=%s/10" ;;
414
+ pt-br:note_agnosticism_deterministic) echo "nota determinística de agnosticismo baseada em violations=%s" ;;
415
+ pt-br:note_production_deep) echo "deep review retornou production_evidence=%s/10" ;;
416
+ pt-br:note_production_deterministic) echo "nota determinística de produção baseada em evidência=%s/%s" ;;
417
+ pt-br:note_config_deep) echo "deep review retornou config_quality=%s/10" ;;
418
+ pt-br:note_config_missing) echo "rubrica determinística de configuração com lacunas: %s (%s/%s sinais)" ;;
419
+ pt-br:note_config_generic) echo "rubrica determinística de configuração não atingiu 10/10" ;;
420
+ pt-br:note_documentation_deep) echo "deep review retornou documentation=%s/10" ;;
421
+ pt-br:note_documentation_deterministic) echo "nota determinística de documentação com lacunas: %s" ;;
422
+ pt-br:guardrail_prod_5) echo "cap de produção: score <= 5 sem evidência de produção" ;;
423
+ pt-br:guardrail_prod_7) echo "cap de produção: score <= 7 com evidência limitada" ;;
424
+ pt-br:guardrail_prod_9) echo "cap de produção: score <= 9 sem evidência completa" ;;
425
+ pt-br:guardrail_blocking) echo "issues bloqueantes abertos impõem score <= 6" ;;
426
+ pt-br:guardrail_combined) echo "dívida combinada em dimensões críticas impõe score <= 5" ;;
427
+ pt-br:guardrail_high) echo "dívida grave em dimensão HIGH impõe score <= 6" ;;
428
+ pt-br:guardrail_medium) echo "múltiplas dívidas graves em dimensões MEDIUM impõem score <= 6" ;;
429
+ pt-br:guardrail_critical_dimension) echo "dimensão crítica %s=%s" ;;
430
+ en:help_usage) echo "Usage: ./validate-squad.sh <squad-name> [options]" ;;
431
+ en:help_arguments) echo "Arguments:" ;;
432
+ en:help_arg_squad) echo "Name of squad to validate (e.g., \"my-squad\", \"new-squad\")" ;;
433
+ en:help_options) echo "Options:" ;;
434
+ en:help_verbose) echo "Show all checks and deep analysis details" ;;
435
+ en:help_quick) echo "Skip reviewer CLI analysis (deterministic only)" ;;
436
+ en:help_fast) echo "Use Haiku instead of Opus (cheaper, faster)" ;;
437
+ en:help_json) echo "Output results as JSON" ;;
438
+ en:help_lang) echo "Set output language: auto, pt-br, en" ;;
439
+ en:help_help) echo "Show this help message" ;;
440
+ en:help_examples) echo "Examples:" ;;
441
+ en:help_example_full) echo "Full validation with Opus" ;;
442
+ en:help_example_verbose) echo "Verbose output" ;;
443
+ en:help_example_quick) echo "Deterministic only (no reviewer CLI)" ;;
444
+ en:help_example_fast) echo "Quick validation with Haiku" ;;
445
+ en:help_example_lang) echo "Force English report" ;;
446
+ en:help_exit_codes) echo "Exit Codes:" ;;
447
+ en:help_exit_pass) echo "PASS Score >= 7.0, no blocking issues" ;;
448
+ en:help_exit_fail) echo "FAIL Score < 7.0 or blocking issues found" ;;
449
+ en:help_exit_error) echo "ERROR Invalid input or script error" ;;
450
+ en:unknown_option) echo "Unknown option: %s" ;;
451
+ en:error_squad_required) echo "Error: Squad name required" ;;
452
+ en:error_usage_simple) echo "Usage: ./validate-squad.sh <squad-name>" ;;
453
+ en:error_squad_not_found) echo "Error: Squad not found: %s" ;;
454
+ en:main_title) echo "🔍 VALIDATE-SQUAD v4.0 - Dimensional Validation" ;;
455
+ en:label_squad) echo "Squad" ;;
456
+ en:label_path) echo "Path" ;;
457
+ en:label_mode) echo "Mode" ;;
458
+ en:label_model) echo "Model" ;;
459
+ en:mode_quick) echo "quick (no reviewer CLI)" ;;
460
+ en:mode_hybrid) echo "hybrid" ;;
461
+ en:phase6_title) echo "PHASE 6: Deep Quality Analysis (Claude CLI)" ;;
462
+ en:phase6_skip) echo "Skipping reviewer CLI analysis (--quick mode)" ;;
463
+ en:phase6_running) echo "Running Claude deep analysis with %s..." ;;
464
+ en:phase6_prompt_written) echo "Prompt written to temp file (%s bytes)" ;;
465
+ en:phase6_result) echo "Claude Deep Analysis Result:" ;;
466
+ en:phase6_failed) echo "Reviewer CLI analysis failed; using deterministic score only" ;;
467
+ en:phase6_complete) echo "Reviewer CLI deep analysis complete" ;;
468
+ en:phase6_language_state) echo "Canonical artifact: %s | Report: %s" ;;
469
+ en:phase6_localization_fallback) echo "Reviewer localization unavailable; showing canonical English artifact" ;;
470
+ en:phase7_title) echo "PHASE 7: Final Scoring (Dimensional)" ;;
471
+ en:scoring_breakdown) echo "Scoring breakdown:" ;;
472
+ en:weighted_avg) echo "Weighted avg (pre-penalty): %s" ;;
473
+ en:penalty) echo "Penalty: -%s" ;;
474
+ en:after_penalty) echo "After penalty: %s" ;;
475
+ en:after_caps) echo "After caps: %s" ;;
476
+ en:cap_reasons) echo "Cap reasons: %s" ;;
477
+ en:final_rounded) echo "Final (rounded): %s/10" ;;
478
+ en:validation_passed) echo "VALIDATION PASSED" ;;
479
+ en:validation_conditional) echo "CONDITIONAL PASS" ;;
480
+ en:validation_failed) echo "VALIDATION FAILED" ;;
481
+ en:verdict_pass) echo "PASS" ;;
482
+ en:verdict_conditional) echo "CONDITIONAL" ;;
483
+ en:verdict_fail) echo "FAIL" ;;
484
+ en:label_type) echo "Type" ;;
485
+ en:label_final) echo "Final" ;;
486
+ en:label_raw) echo "Raw" ;;
487
+ en:label_verdict) echo "Verdict" ;;
488
+ en:label_analysis_language) echo "Analysis Language" ;;
489
+ en:label_report_language) echo "Report Language" ;;
490
+ en:dimensional_scores) echo "Dimensional Scores" ;;
491
+ en:table_dimension) echo "Dimension" ;;
492
+ en:table_score) echo "Score" ;;
493
+ en:table_weight) echo "Weight" ;;
494
+ en:weight_high) echo "HIGH" ;;
495
+ en:weight_medium) echo "MEDIUM" ;;
496
+ en:weight_low) echo "LOW" ;;
497
+ en:dimension_notes) echo "Dimension Notes (<10)" ;;
498
+ en:blocking_issues) echo "Blocking Issues" ;;
499
+ en:score_guardrails) echo "Score Guardrails" ;;
500
+ en:deterministic_findings) echo "Deterministic Findings" ;;
501
+ en:table_check) echo "Check" ;;
502
+ en:table_count) echo "Count" ;;
503
+ en:version_consistency) echo "Version Consistency" ;;
504
+ en:version_mismatch) echo "MISMATCH" ;;
505
+ en:priority_fixes) echo "Priority Fixes" ;;
506
+ en:improvements) echo "Improvements" ;;
507
+ en:production_none) echo "No evidence of real usage — max possible score capped at 5/10" ;;
508
+ en:production_limited) echo "Limited production evidence — max possible score capped at 7/10" ;;
509
+ en:production_good) echo "Good production evidence" ;;
510
+ en:functionality_label) echo "Functionality/Pipeline" ;;
511
+ en:security_label) echo "Security" ;;
512
+ en:agnosticism_label) echo "Squad Agnosticism" ;;
513
+ en:production_label) echo "Production Evidence" ;;
514
+ en:workflow_contract_label) echo "Workflow Contract" ;;
515
+ en:structural_label) echo "Structural Completeness" ;;
516
+ en:agent_quality_label) echo "Agent Quality" ;;
517
+ en:config_quality_label) echo "Config Quality" ;;
518
+ en:documentation_label) echo "Documentation" ;;
519
+ en:check_tier1) echo "TIER1 Failures" ;;
520
+ en:check_security) echo "Security Issues" ;;
521
+ en:check_xref) echo "Cross-Ref Broken" ;;
522
+ en:check_workflow_contract) echo "Workflow Contract Errors" ;;
523
+ en:check_agnosticism) echo "Agnosticism Violations" ;;
524
+ en:check_agent_quality) echo "Agent Quality Gaps" ;;
525
+ en:check_structural) echo "Mandatory Structural" ;;
526
+ en:check_contextual_lifecycle) echo "Contextual Lifecycle" ;;
527
+ en:check_warnings) echo "Warnings" ;;
528
+ en:note_functionality_deep) echo "deep review returned workflow_analysis=%s/10" ;;
529
+ en:note_functionality_quick_max) echo "quick-mode fallback maxes at 9/10 without deep review" ;;
530
+ en:note_functionality_quick_reduced) echo "quick-mode fallback reduced by %s" ;;
531
+ en:note_security_deep) echo "deep review returned security_audit=%s/10" ;;
532
+ en:note_security_deterministic) echo "deterministic security fallback based on security_fail=%s" ;;
533
+ en:note_workflow_neutral) echo "no workflows directory detected; workflow contract kept neutral at 5/10" ;;
534
+ en:note_workflow_deterministic) echo "workflow contract score reflects errors=%s, warnings=%s" ;;
535
+ en:note_structural_deep) echo "deep review returned structural_completeness=%s/10" ;;
536
+ en:note_structural_deterministic) echo "deterministic structural score from mandatory checks=%s/%s and tier1_fail=%s" ;;
537
+ en:note_agent_deep) echo "deep review returned agent_quality=%s/10" ;;
538
+ en:note_agent_deterministic) echo "entry agent missing %s of 5 structural sections" ;;
539
+ en:note_agnosticism_deep) echo "deep review returned squad_agnosticism=%s/10" ;;
540
+ en:note_agnosticism_deterministic) echo "deterministic agnosticism score based on violations=%s" ;;
541
+ en:note_production_deep) echo "deep review returned production_evidence=%s/10" ;;
542
+ en:note_production_deterministic) echo "deterministic production score based on production evidence=%s/%s" ;;
543
+ en:note_config_deep) echo "deep review returned config_quality=%s/10" ;;
544
+ en:note_config_missing) echo "deterministic config rubric missing or weak: %s (%s/%s signals)" ;;
545
+ en:note_config_generic) echo "deterministic config rubric did not reach 10/10" ;;
546
+ en:note_documentation_deep) echo "deep review returned documentation=%s/10" ;;
547
+ en:note_documentation_deterministic) echo "deterministic documentation score missing or weak: %s" ;;
548
+ en:guardrail_prod_5) echo "production cap: score <= 5 without production evidence" ;;
549
+ en:guardrail_prod_7) echo "production cap: score <= 7 with limited evidence" ;;
550
+ en:guardrail_prod_9) echo "production cap: score <= 9 without full evidence" ;;
551
+ en:guardrail_blocking) echo "open blocking issues force score <= 6" ;;
552
+ en:guardrail_combined) echo "combined critical dimension debt forces score <= 5" ;;
553
+ en:guardrail_high) echo "critical HIGH dimension debt forces score <= 6" ;;
554
+ en:guardrail_medium) echo "multiple critical MEDIUM dimension debts force score <= 6" ;;
555
+ en:guardrail_critical_dimension) echo "critical dimension %s=%s" ;;
556
+ *)
557
+ echo "$key"
558
+ ;;
559
+ esac
560
+ }
561
+
562
+ fmt_t() {
563
+ local key="$1"
564
+ shift
565
+ local format
566
+ format=$(t "$key")
567
+ printf "$format" "$@"
568
+ }
569
+
570
+ dimension_label() {
571
+ case "$1" in
572
+ functionality) t "functionality_label" ;;
573
+ security) t "security_label" ;;
574
+ squad_agnosticism) t "agnosticism_label" ;;
575
+ production_evidence) t "production_label" ;;
576
+ workflow_contract) t "workflow_contract_label" ;;
577
+ structural_completeness) t "structural_label" ;;
578
+ agent_quality) t "agent_quality_label" ;;
579
+ config_quality) t "config_quality_label" ;;
580
+ documentation) t "documentation_label" ;;
581
+ *) printf '%s' "$1" ;;
582
+ esac
583
+ }
584
+
585
+ weight_label() {
586
+ case "$1" in
587
+ HIGH) t "weight_high" ;;
588
+ MEDIUM) t "weight_medium" ;;
589
+ LOW) t "weight_low" ;;
590
+ *) printf '%s' "$1" ;;
591
+ esac
592
+ }
593
+
594
+ deterministic_check_label() {
595
+ case "$1" in
596
+ tier1) t "check_tier1" ;;
597
+ security) t "check_security" ;;
598
+ xref) t "check_xref" ;;
599
+ workflow_contract) t "check_workflow_contract" ;;
600
+ agnosticism) t "check_agnosticism" ;;
601
+ agent_quality) t "check_agent_quality" ;;
602
+ structural) t "check_structural" ;;
603
+ contextual_lifecycle) t "check_contextual_lifecycle" ;;
604
+ warnings) t "check_warnings" ;;
605
+ *) printf '%s' "$1" ;;
606
+ esac
607
+ }
608
+
609
+ translate_guardrail_reason() {
610
+ local reason="$1"
611
+ case "$reason" in
612
+ "production_cap:score<=5_without_production") t "guardrail_prod_5" ;;
613
+ "production_cap:score<=7_with_limited_evidence") t "guardrail_prod_7" ;;
614
+ "production_cap:score<=9_without_full_evidence") t "guardrail_prod_9" ;;
615
+ "blocking_issues_open:score<=6") t "guardrail_blocking" ;;
616
+ "combined_critical_dimension_debt:score<=5") t "guardrail_combined" ;;
617
+ "critical_high_dimension_debt:score<=6") t "guardrail_high" ;;
618
+ "multiple_medium_dimension_debt:score<=6") t "guardrail_medium" ;;
619
+ critical_dimension:*=*)
620
+ local name="${reason#critical_dimension:}"
621
+ local value="${name#*=}"
622
+ name="${name%%=*}"
623
+ fmt_t "guardrail_critical_dimension" "$(dimension_label "$name")" "$value"
624
+ ;;
625
+ *)
626
+ printf '%s' "$reason"
627
+ ;;
628
+ esac
629
+ }
630
+
631
+ # ═══════════════════════════════════════════════════════════════════════════════
632
+ # ARGUMENT PARSING
633
+ # ═══════════════════════════════════════════════════════════════════════════════
634
+
635
+ show_help() {
636
+ resolve_report_language
637
+ echo "╔══════════════════════════════════════════════════════════════╗"
638
+ printf "║ %-60s ║\n" "$(t main_title)"
639
+ echo "╚══════════════════════════════════════════════════════════════╝"
640
+ echo ""
641
+ echo "$(t help_usage)"
642
+ echo ""
643
+ echo "$(t help_arguments)"
644
+ printf " squad-name %s\n" "$(t help_arg_squad)"
645
+ echo ""
646
+ echo "$(t help_options)"
647
+ printf " --verbose %s\n" "$(t help_verbose)"
648
+ printf " --quick %s\n" "$(t help_quick)"
649
+ printf " --fast %s\n" "$(t help_fast)"
650
+ printf " --json %s\n" "$(t help_json)"
651
+ printf " --lang %s\n" "$(t help_lang)"
652
+ printf " --help %s\n" "$(t help_help)"
653
+ echo ""
654
+ echo "$(t help_examples)"
655
+ printf " ./validate-squad.sh {squad-name} # %s\n" "$(t help_example_full)"
656
+ printf " ./validate-squad.sh {squad-name} --verbose # %s\n" "$(t help_example_verbose)"
657
+ printf " ./validate-squad.sh {squad-name} --quick # %s\n" "$(t help_example_quick)"
658
+ printf " ./validate-squad.sh {squad-name} --fast # %s\n" "$(t help_example_fast)"
659
+ printf " ./validate-squad.sh {squad-name} --lang pt-br # %s\n" "$(t help_example_lang)"
660
+ echo ""
661
+ echo "$(t help_exit_codes)"
662
+ printf " 0 %s\n" "$(t help_exit_pass)"
663
+ printf " 1 %s\n" "$(t help_exit_fail)"
664
+ printf " 2 %s\n" "$(t help_exit_error)"
665
+ exit 0
666
+ }
667
+
668
+ SQUAD_NAME=""
669
+ VERBOSE=false
670
+ QUICK_MODE=false
671
+ JSON_OUTPUT=false
672
+ FAST_MODE=false
673
+
674
+ handle_extra_args() {
675
+ POSITIONAL_ARGS=()
676
+ while [[ $# -gt 0 ]]; do
677
+ case "$1" in
678
+ --fast|-f)
679
+ FAST_MODE=true
680
+ MODEL_SELECTION_MODE="fast"
681
+ shift
682
+ ;;
683
+ --lang)
684
+ if [[ $# -lt 2 ]]; then
685
+ resolve_report_language
686
+ echo "$(t error_usage_simple)"
687
+ exit 2
688
+ fi
689
+ REPORT_LANG="$2"
690
+ shift 2
691
+ ;;
692
+ -*)
693
+ resolve_report_language
694
+ fmt_t "unknown_option" "$1"
695
+ echo ""
696
+ exit 2
697
+ ;;
698
+ *)
699
+ POSITIONAL_ARGS+=("$1")
700
+ shift
701
+ ;;
702
+ esac
703
+ done
704
+ }
705
+
706
+ parse_common_args "$@"
707
+ parse_extra_flags "${POSITIONAL_ARGS[@]}"
708
+
709
+ QUICK_MODE="$QUICK"
710
+ if [[ -n "${REQUESTED_RUNTIME:-}" ]]; then
711
+ apply_runtime_selection "$REQUESTED_RUNTIME"
712
+ fi
713
+ if [[ "$FAST_MODE" == "true" ]]; then
714
+ MODEL_QUALITY="$MODEL_FAST"
715
+ fi
716
+ if [[ -n "${RUNNER_MODEL:-}" ]]; then
717
+ MODEL_QUALITY="$RUNNER_MODEL"
718
+ MODEL_SELECTION_MODE="explicit"
719
+ fi
720
+ if [[ ${#POSITIONAL_ARGS[@]} -gt 1 ]]; then
721
+ resolve_report_language
722
+ fmt_t "unknown_option" "${POSITIONAL_ARGS[1]}"
723
+ echo ""
724
+ exit 2
725
+ fi
726
+ SQUAD_NAME="${POSITIONAL_ARGS[0]:-}"
727
+
728
+ # Validate and export runtime for libs
729
+ export SELECTED_RUNTIME
730
+ if [[ "$HAS_RUNTIME_LIB" == "true" ]]; then
731
+ validate_runtime "$SELECTED_RUNTIME"
732
+ fi
733
+
734
+ REPORT_LANG=$(normalize_lang_code "${REPORT_LANG:-auto}")
735
+ resolve_report_language
736
+
737
+ case "$REPORT_LANG" in
738
+ auto|"")
739
+ ;;
740
+ pt|pt-br|en)
741
+ ;;
742
+ *)
743
+ fmt_t "unknown_option" "--lang $REPORT_LANG"
744
+ echo ""
745
+ exit 2
746
+ ;;
747
+ esac
748
+
749
+ if [[ -z "$SQUAD_NAME" ]]; then
750
+ echo "$(t error_squad_required)"
751
+ echo "$(t error_usage_simple)"
752
+ exit 2
753
+ fi
754
+
755
+ SQUAD_DIR="$SQUADS_DIR/$SQUAD_NAME"
756
+
757
+ # Initialize progress log and metrics
758
+ PROGRESS_LOG="$WORKSPACE_ROOT/outputs/squad-validations/$SQUAD_NAME/progress.txt"
759
+ METRICS_FILE="$WORKSPACE_ROOT/outputs/squad-validations/$SQUAD_NAME/metrics.jsonl"
760
+ MAX_COST="${SINKRA_MAX_COST:-5.00}"
761
+ export METRICS_FILE MAX_COST
762
+ mkdir -p "$(dirname "$PROGRESS_LOG")"
763
+ VALIDATION_STATE_FILE="$WORKSPACE_ROOT/outputs/squad-validations/$SQUAD_NAME/validation-state.json"
764
+ if declare -f state_init >/dev/null 2>&1; then
765
+ state_init "$VALIDATION_STATE_FILE" "$SQUAD_NAME" "squad-validation" "{\"runtime\":\"$SELECTED_RUNTIME\"}" || true
766
+ state_phase_update "$VALIDATION_STATE_FILE" "validation" "running" "validate-squad" || true
767
+ fi
768
+ if declare -f session_start >/dev/null 2>&1; then
769
+ VALIDATION_SESSION_ID="$(session_start "squad-creator" "validate-squad" "$SQUAD_NAME" "$MODEL_QUALITY" "$SELECTED_RUNTIME" "$PROGRESS_LOG" "{\"type\":\"squad-validation\"}" 2>/dev/null || true)"
770
+ fi
771
+
772
+ validate_squad_cleanup() {
773
+ local exit_code=$?
774
+ if declare -f state_phase_update >/dev/null 2>&1 && [[ -n "$VALIDATION_STATE_FILE" ]]; then
775
+ state_phase_update "$VALIDATION_STATE_FILE" "validation" "$([[ "$exit_code" -eq 0 ]] && echo complete || echo failed)" "validate-squad" >/dev/null 2>&1 || true
776
+ fi
777
+ if declare -f session_end >/dev/null 2>&1 && [[ -n "$VALIDATION_SESSION_ID" ]]; then
778
+ session_end "$VALIDATION_SESSION_ID" "$exit_code" >/dev/null 2>&1 || true
779
+ fi
780
+ }
781
+ trap validate_squad_cleanup EXIT
782
+
783
+ {
784
+ echo ""
785
+ echo "--- Validation session: $(date -Iseconds) ---"
786
+ echo "Squad: $SQUAD_NAME | Runtime: $SELECTED_RUNTIME | Model: $MODEL_QUALITY"
787
+ } >> "$PROGRESS_LOG"
788
+
789
+ if [[ ! -d "$SQUAD_DIR" ]]; then
790
+ fmt_t "error_squad_not_found" "$SQUAD_DIR"
791
+ echo ""
792
+ exit 2
793
+ fi
794
+
795
+ INHERITED_SQUAD=""
796
+ INHERITED_SQUAD_DIR=""
797
+ if [[ -f "$SQUAD_DIR/config.yaml" ]]; then
798
+ INHERITED_SQUAD=$(grep -E '^[[:space:]]*enhances:[[:space:]]*' "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 | sed 's/.*enhances:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs || true)
799
+ if [[ -z "$INHERITED_SQUAD" ]]; then
800
+ INHERITED_SQUAD=$(grep -E '^[[:space:]]*enhances:[[:space:]]*' "$SQUAD_DIR/config.yaml" 2>/dev/null | tail -1 | sed 's/.*enhances:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs || true)
801
+ fi
802
+ if [[ -n "$INHERITED_SQUAD" ]] && [[ -d "$SQUADS_DIR/$INHERITED_SQUAD" ]]; then
803
+ INHERITED_SQUAD_DIR="$SQUADS_DIR/$INHERITED_SQUAD"
804
+ fi
805
+ fi
806
+
807
+ # ═══════════════════════════════════════════════════════════════════════════════
808
+ # LOGGING HELPERS
809
+ # ═══════════════════════════════════════════════════════════════════════════════
810
+
811
+ log_pass() {
812
+ PASS_COUNT=$((PASS_COUNT + 1))
813
+ if [[ "$VERBOSE" == "true" ]]; then
814
+ echo -e " ${GREEN}✓${NC} $1"
815
+ fi
816
+ }
817
+
818
+ log_fail() {
819
+ FAIL_COUNT=$((FAIL_COUNT + 1))
820
+ echo -e " ${RED}✗${NC} $1"
821
+ BLOCKING_ISSUES="${BLOCKING_ISSUES}${1}"$'\n'
822
+ }
823
+
824
+ log_warn() {
825
+ WARN_COUNT=$((WARN_COUNT + 1))
826
+ echo -e " ${YELLOW}⚠${NC} $1"
827
+ WARNINGS="${WARNINGS}${1}"$'\n'
828
+ }
829
+
830
+ log_info() {
831
+ if [[ "$VERBOSE" == "true" ]]; then
832
+ echo -e " ${CYAN}ℹ${NC} $1"
833
+ fi
834
+ }
835
+
836
+ asset_exists() {
837
+ local asset_type="$1"
838
+ local asset_name="$2"
839
+
840
+ if [[ -f "$SQUAD_DIR/$asset_type/$asset_name" ]]; then
841
+ return 0
842
+ fi
843
+
844
+ if [[ -n "$INHERITED_SQUAD_DIR" ]] && [[ -f "$INHERITED_SQUAD_DIR/$asset_type/$asset_name" ]]; then
845
+ return 0
846
+ fi
847
+
848
+ return 1
849
+ }
850
+
851
+ log_section() {
852
+ echo ""
853
+ echo -e "${BOLD}${BLUE}═══ $1 ═══${NC}"
854
+ }
855
+
856
+ log_subsection() {
857
+ echo -e "${CYAN}--- $1 ---${NC}"
858
+ }
859
+
860
+ # Runtime state helper (best-effort, non-blocking)
861
+ runtime_state_call() {
862
+ if [[ ! -f "$RUNTIME_STATE_HELPER" ]]; then
863
+ return 0
864
+ fi
865
+
866
+ if ! node "$RUNTIME_STATE_HELPER" "$@" >/dev/null 2>&1; then
867
+ echo -e "${YELLOW}⚠ Runtime state update failed (${*})${NC}" >&2
868
+ return 1
869
+ fi
870
+
871
+ return 0
872
+ }
873
+
874
+ runtime_state_start() {
875
+ local mode="hybrid"
876
+ if [[ "$QUICK_MODE" == "true" ]]; then
877
+ mode="quick"
878
+ fi
879
+
880
+ runtime_state_call start \
881
+ --squad "$SQUAD_NAME" \
882
+ --mode "$mode" \
883
+ --model "$MODEL_QUALITY" \
884
+ --quick "$QUICK_MODE" \
885
+ --verbose "$VERBOSE" \
886
+ --json "$JSON_OUTPUT"
887
+ }
888
+
889
+ runtime_state_phase_start() {
890
+ local phase="$1"
891
+ CURRENT_PHASE="$phase"
892
+ runtime_state_call phase --squad "$SQUAD_NAME" --phase "$phase" --status in_progress
893
+ }
894
+
895
+ runtime_state_phase_complete() {
896
+ local phase="$1"
897
+ local status="${2:-completed}"
898
+ runtime_state_call phase --squad "$SQUAD_NAME" --phase "$phase" --status "$status"
899
+ }
900
+
901
+ runtime_state_complete() {
902
+ local status="$1"
903
+ runtime_state_call complete \
904
+ --squad "$SQUAD_NAME" \
905
+ --status "$status" \
906
+ --result "$VALIDATION_RESULT" \
907
+ --final-score "$FINAL_SCORE" \
908
+ --exit-code "$EXIT_CODE" \
909
+ --warnings "$WARN_COUNT" \
910
+ --tier1-fail "$TIER1_FAIL" \
911
+ --security-fail "$SEC_FAIL" \
912
+ --workflow-contract-fail "$WF_CONTRACT_FAIL" \
913
+ --xref-fail "$XREF_FAIL" \
914
+ --phase "$CURRENT_PHASE"
915
+ }
916
+
917
+ # ═══════════════════════════════════════════════════════════════════════════════
918
+ # SCORING/JSON HELPERS
919
+ # ═══════════════════════════════════════════════════════════════════════════════
920
+
921
+ is_numeric_score() {
922
+ [[ "$1" =~ ^[0-9]+([.][0-9]+)?$ ]]
923
+ }
924
+
925
+ clamp_score_0_10() {
926
+ awk -v n="$1" 'BEGIN { if (n < 0) n = 0; if (n > 10) n = 10; printf "%.2f", n }'
927
+ }
928
+
929
+ round_score_0_10_int() {
930
+ awk -v n="$1" 'BEGIN { if (n < 0) n = 0; if (n > 10) n = 10; printf "%d", int(n + 0.5) }'
931
+ }
932
+
933
+ extract_first_json_object() {
934
+ # Read piped data into variable, then pass via env var to avoid
935
+ # stdin conflict with heredoc (heredoc consumes stdin, breaking pipe input).
936
+ local input
937
+ input=$(cat)
938
+ if [[ "${RUNNER_LIB_JSON_VALIDATOR:-false}" == "true" ]]; then
939
+ local extracted=""
940
+ extracted=$(json_extract "$input" 2>/dev/null || true)
941
+ if [[ -n "$extracted" ]] && json_validate "$extracted"; then
942
+ printf '%s' "$extracted"
943
+ return 0
944
+ fi
945
+ fi
946
+ __JSON_EXTRACT_INPUT="$input" python3 <<'PY'
947
+ import json
948
+ import os
949
+ import re
950
+
951
+ text = os.environ.get('__JSON_EXTRACT_INPUT', '')
952
+ text = re.sub(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', '', text)
953
+ text = text.replace("```json", "```").replace("```JSON", "```")
954
+
955
+ decoder = json.JSONDecoder()
956
+ for index, char in enumerate(text):
957
+ if char != "{":
958
+ continue
959
+ try:
960
+ obj, _ = decoder.raw_decode(text[index:])
961
+ except Exception:
962
+ continue
963
+ if isinstance(obj, dict):
964
+ print(json.dumps(obj, ensure_ascii=False))
965
+ exit(0)
966
+
967
+ print("{}")
968
+ PY
969
+ }
970
+
971
+ parse_claude_metrics() {
972
+ local input
973
+ input=$(cat)
974
+ __PARSE_INPUT="$input" python3 <<'PY'
975
+ import json
976
+ import os
977
+
978
+ raw = os.environ.get('__PARSE_INPUT', '').strip()
979
+ try:
980
+ data = json.loads(raw) if raw else {}
981
+ except Exception:
982
+ data = {}
983
+
984
+ def clamp_score(value):
985
+ try:
986
+ number = float(value)
987
+ except Exception:
988
+ return None
989
+ if number < 0:
990
+ number = 0.0
991
+ if number > 10:
992
+ number = 10.0
993
+ return number
994
+
995
+ def format_score(value):
996
+ number = clamp_score(value)
997
+ if number is None:
998
+ return "0"
999
+ return f"{number:.2f}".rstrip("0").rstrip(".") or "0"
1000
+
1001
+ quality = clamp_score(data.get("overall_score"))
1002
+ quality_value = "N/A" if quality is None else (f"{quality:.2f}".rstrip("0").rstrip(".") or "0")
1003
+
1004
+ improvements = data.get("improvements", "")
1005
+ if isinstance(improvements, list):
1006
+ improvements = "; ".join(str(item).strip() for item in improvements if str(item).strip())
1007
+ elif improvements is None:
1008
+ improvements = ""
1009
+ else:
1010
+ improvements = str(improvements).strip()
1011
+
1012
+ improvements = improvements.replace("\n", " ").replace("\t", " ").strip()
1013
+
1014
+ fields = {
1015
+ "prompt_quality": format_score(data.get("prompt_quality", 0)),
1016
+ "structure_coherence": format_score(data.get("structure_coherence", 0)),
1017
+ "coverage": format_score(data.get("coverage", 0)),
1018
+ "documentation": format_score(data.get("documentation", 0)),
1019
+ "quality_score": quality_value,
1020
+ "improvements": improvements,
1021
+ }
1022
+
1023
+ for key, value in fields.items():
1024
+ print(f"{key}\t{value}")
1025
+ PY
1026
+ }
1027
+
1028
+ extract_review_fields() {
1029
+ local input_json="$1"
1030
+ printf "%s" "$input_json" | python3 -c '
1031
+ import json, sys
1032
+ import base64
1033
+ raw = sys.stdin.read().strip()
1034
+ try:
1035
+ d = json.loads(raw) if raw else {}
1036
+ except Exception:
1037
+ d = {}
1038
+
1039
+ def gs(obj, key):
1040
+ v = obj.get(key)
1041
+ if v is None:
1042
+ return None
1043
+ if isinstance(v, dict):
1044
+ score = v.get("score")
1045
+ if score is None:
1046
+ return None
1047
+ return score
1048
+ return None
1049
+
1050
+ def clamp(v, lo=0, hi=10):
1051
+ if v is None:
1052
+ return None
1053
+ try:
1054
+ n = float(v)
1055
+ except Exception:
1056
+ return None
1057
+ return max(lo, min(hi, n))
1058
+
1059
+ def fmt(v):
1060
+ if v is None:
1061
+ return ""
1062
+ return f"{v:.1f}".rstrip("0").rstrip(".") or "0"
1063
+
1064
+ def b64(v):
1065
+ return base64.b64encode((v or "").encode("utf-8")).decode("ascii")
1066
+
1067
+ sc = clamp(gs(d, "structural_completeness"))
1068
+ sec = clamp(gs(d, "security_audit"))
1069
+ wf = clamp(gs(d, "workflow_analysis"))
1070
+ aq = clamp(gs(d, "agent_quality"))
1071
+ agn = clamp(gs(d, "squad_agnosticism"))
1072
+ cq = clamp(gs(d, "config_quality"))
1073
+ pe = clamp(gs(d, "production_evidence"))
1074
+
1075
+ es = d.get("executive_summary", {})
1076
+ if not isinstance(es, dict):
1077
+ es = {}
1078
+ overall = clamp(es.get("overall_score"))
1079
+ improvements = es.get("improvements", [])
1080
+ if isinstance(improvements, list):
1081
+ improvements = "\n".join(str(x).strip() for x in improvements if str(x).strip())
1082
+ else:
1083
+ improvements = str(improvements or "")
1084
+ priority_fixes = es.get("priority_fixes", [])
1085
+ if isinstance(priority_fixes, list):
1086
+ priority_fixes = "\n".join(str(x).strip() for x in priority_fixes if str(x).strip())
1087
+ else:
1088
+ priority_fixes = str(priority_fixes or "")
1089
+
1090
+ fp = 0
1091
+ sec_data = d.get("security_audit", {})
1092
+ if isinstance(sec_data, dict):
1093
+ fp_val = sec_data.get("false_positive_count", 0)
1094
+ if isinstance(fp_val, (int, float)):
1095
+ fp = int(fp_val)
1096
+ else:
1097
+ checks = sec_data.get("checks", [])
1098
+ if isinstance(checks, list):
1099
+ fp = sum(1 for c in checks if isinstance(c, dict) and c.get("status", "").upper() == "FALSE_POSITIVE")
1100
+
1101
+ for k, v in [
1102
+ ("structural_completeness", fmt(sc)),
1103
+ ("security_audit", fmt(sec)),
1104
+ ("workflow_analysis", fmt(wf)),
1105
+ ("agent_quality", fmt(aq)),
1106
+ ("squad_agnosticism", fmt(agn)),
1107
+ ("config_quality", fmt(cq)),
1108
+ ("production_evidence", fmt(pe)),
1109
+ ("overall_score", fmt(overall)),
1110
+ ("improvements_b64", b64(improvements)),
1111
+ ("priority_fixes_b64", b64(priority_fixes)),
1112
+ ("false_positive_count", fp),
1113
+ ]:
1114
+ print(f"{k}\t{v}")
1115
+ ' 2>/dev/null || true
1116
+ }
1117
+
1118
+ localize_review_json_for_report() {
1119
+ local input_json="$1"
1120
+ LOCALIZED_REPORT_AVAILABLE="false"
1121
+
1122
+ if [[ -z "$input_json" ]] || [[ "$input_json" == "{}" ]]; then
1123
+ printf '%s' "$input_json"
1124
+ return 0
1125
+ fi
1126
+
1127
+ if [[ "$REPORT_LANG_RESOLVED" == "$ANALYSIS_LANG" ]]; then
1128
+ LOCALIZED_REPORT_AVAILABLE="true"
1129
+ printf '%s' "$input_json"
1130
+ return 0
1131
+ fi
1132
+
1133
+ local translate_prompt
1134
+ translate_prompt="Translate every human-readable string value in the JSON below to ${REPORT_LANGUAGE_NAME}.
1135
+
1136
+ Rules:
1137
+ - Keep JSON keys exactly unchanged.
1138
+ - Keep numeric values exactly unchanged.
1139
+ - Keep booleans, nulls, arrays, and object structure exactly unchanged.
1140
+ - Keep IDs like WF-001, AGENT-001, CONFIG-001, SEC-002 exactly unchanged.
1141
+ - Keep machine statuses exactly unchanged when they are enum-like: PASS, FAIL, WARN, PARTIAL, FALSE_POSITIVE, REAL, CONDITIONAL.
1142
+ - Translate only human-readable prose and labels.
1143
+ - Output ONLY valid JSON.
1144
+
1145
+ JSON:
1146
+ \`\`\`json
1147
+ $input_json
1148
+ \`\`\`"
1149
+
1150
+ local translated_raw translated_json
1151
+ if translated_raw=$(run_llm_prompt_with_replan "$MODEL_QUALITY" "$translate_prompt" "${PROGRESS_LOG:-/dev/null}" "translate" 2>/dev/null); then
1152
+ translated_json=$(printf '%s' "$translated_raw" | extract_first_json_object)
1153
+ if [[ -n "$translated_json" ]] && [[ "$translated_json" != "{}" ]]; then
1154
+ LOCALIZED_REPORT_AVAILABLE="true"
1155
+ printf '%s' "$translated_json"
1156
+ return 0
1157
+ fi
1158
+ fi
1159
+
1160
+ printf '%s' "$input_json"
1161
+ }
1162
+
1163
+ extract_structure_fields() {
1164
+ local input_json="$1"
1165
+ printf "%s" "$input_json" | python3 -c '
1166
+ import json, sys, base64
1167
+ raw = sys.stdin.read().strip()
1168
+ try:
1169
+ d = json.loads(raw) if raw else {}
1170
+ except Exception:
1171
+ d = {}
1172
+
1173
+ coverage = d.get("coverage") or {}
1174
+ def b64_join(items):
1175
+ if not isinstance(items, list):
1176
+ items = []
1177
+ text = "\n".join(str(x).strip() for x in items if str(x).strip())
1178
+ return base64.b64encode(text.encode("utf-8")).decode("ascii")
1179
+
1180
+ fields = {
1181
+ "squad_type": d.get("squad_type", "unknown"),
1182
+ "type_confidence": d.get("type_confidence", 0),
1183
+ "agents": coverage.get("agents", 0),
1184
+ "tasks": coverage.get("tasks", 0),
1185
+ "workflows": coverage.get("workflows", 0),
1186
+ "checklists": coverage.get("checklists", 0),
1187
+ "structure_valid": "true" if d.get("structure_valid") else "false",
1188
+ "blocking_issue_count": d.get("blocking_issue_count", 0),
1189
+ "warning_count": d.get("warning_count", 0),
1190
+ "security_issue_count": d.get("security_issue_count", 0),
1191
+ "non_security_blocking_count": d.get("non_security_blocking_count", 0),
1192
+ "blocking_issues_b64": b64_join(d.get("blocking_issues") or []),
1193
+ "warnings_b64": b64_join(d.get("warnings") or []),
1194
+ }
1195
+
1196
+ for k, v in fields.items():
1197
+ print(f"{k}\t{v}")
1198
+ ' 2>/dev/null || true
1199
+ }
1200
+
1201
+ extract_deep_analysis_payload() {
1202
+ local input_json="$1"
1203
+ printf "%s" "$input_json" | python3 -c '
1204
+ import json, sys
1205
+ raw = sys.stdin.read().strip()
1206
+ try:
1207
+ d = json.loads(raw) if raw else {}
1208
+ except Exception:
1209
+ d = {}
1210
+ analysis = d.get("analysis", {})
1211
+ if not isinstance(analysis, dict):
1212
+ analysis = {}
1213
+ print(json.dumps(analysis))
1214
+ ' 2>/dev/null || printf '{}'
1215
+ }
1216
+
1217
+ collect_orchestrator_baseline() {
1218
+ local config_version=""
1219
+ local readme_version=""
1220
+ local agent_version=""
1221
+ local version_mismatch=""
1222
+ local sc_pass=0
1223
+ local sc_total=2
1224
+ local lifecycle_pass=0
1225
+ local lifecycle_total=2
1226
+ local agent_quality_gaps=0
1227
+
1228
+ M_AGENT_COUNT=$(find "$SQUAD_DIR/agents" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
1229
+ M_TASK_COUNT=$(find "$SQUAD_DIR/tasks" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
1230
+ M_CHECKLIST_COUNT=$(find "$SQUAD_DIR/checklists" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
1231
+ M_TEMPLATE_COUNT=$(find "$SQUAD_DIR/templates" -type f 2>/dev/null | wc -l | tr -d ' ')
1232
+ M_DATA_COUNT=$(find "$SQUAD_DIR/data" -type f 2>/dev/null | wc -l | tr -d ' ')
1233
+ M_TOTAL_LINES=$(find "$SQUAD_DIR" -type f \( -name "*.md" -o -name "*.yaml" \) -exec cat {} + 2>/dev/null | wc -l | tr -d ' ')
1234
+
1235
+ ENTRY_AGENT=""
1236
+ if [[ -f "$SQUAD_DIR/config.yaml" ]]; then
1237
+ if grep -q "entry_agent:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1238
+ ENTRY_AGENT=$(grep "entry_agent:" "$SQUAD_DIR/config.yaml" | head -1 | sed 's/.*entry_agent:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs)
1239
+ elif grep -qE "^[[:space:]]+- id:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1240
+ ENTRY_AGENT=$(grep -E "^[[:space:]]+- id:" "$SQUAD_DIR/config.yaml" | head -1 | sed 's/.*- id:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs)
1241
+ fi
1242
+ fi
1243
+
1244
+ CONFIG_TASK_IDS=$(awk '
1245
+ /^tasks:/ { in_tasks=1; next }
1246
+ in_tasks && /^[^[:space:]]/ { in_tasks=0 }
1247
+ in_tasks && $1 == "-" && $2 == "id:" {
1248
+ gsub(/"/, "", $3)
1249
+ print $3
1250
+ }
1251
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true)
1252
+
1253
+ M_HAS_TESTED_FLAG="false"
1254
+ if grep -qE "^tested:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1255
+ sc_pass=$((sc_pass + 1))
1256
+ M_HAS_TESTED_FLAG="true"
1257
+ fi
1258
+
1259
+ M_HAS_ARCHITECTURE_DOC="false"
1260
+ if [[ -f "$SQUAD_DIR/ARCHITECTURE.md" ]]; then
1261
+ sc_pass=$((sc_pass + 1))
1262
+ M_HAS_ARCHITECTURE_DOC="true"
1263
+ fi
1264
+
1265
+ M_HAS_UPDATE_TASK="false"
1266
+ if [[ -d "$SQUAD_DIR/tasks" ]]; then
1267
+ local update_tasks
1268
+ update_tasks=$(find "$SQUAD_DIR/tasks" -maxdepth 1 -name "update-*.md" 2>/dev/null | wc -l | tr -d ' ')
1269
+ if [[ "$update_tasks" -gt 0 ]]; then
1270
+ lifecycle_pass=$((lifecycle_pass + 1))
1271
+ M_HAS_UPDATE_TASK="true"
1272
+ fi
1273
+ fi
1274
+
1275
+ M_HAS_DELETE_TASK="false"
1276
+ if [[ -d "$SQUAD_DIR/tasks" ]]; then
1277
+ local delete_tasks
1278
+ delete_tasks=$(find "$SQUAD_DIR/tasks" -maxdepth 1 -name "delete-*.md" 2>/dev/null | wc -l | tr -d ' ')
1279
+ if [[ "$delete_tasks" -gt 0 ]]; then
1280
+ lifecycle_pass=$((lifecycle_pass + 1))
1281
+ M_HAS_DELETE_TASK="true"
1282
+ fi
1283
+ fi
1284
+
1285
+ M_STRUCT_COMPLETENESS_PASS=$sc_pass
1286
+ M_STRUCT_COMPLETENESS_TOTAL=$sc_total
1287
+ M_CONTEXTUAL_LIFECYCLE_PASS=$lifecycle_pass
1288
+ M_CONTEXTUAL_LIFECYCLE_TOTAL=$lifecycle_total
1289
+ M_CONTEXTUAL_LIFECYCLE_WARNINGS=$((lifecycle_total - lifecycle_pass))
1290
+
1291
+ M_VERSION_CONSISTENT="true"
1292
+ M_VERSION_DETAILS=""
1293
+ config_version=$(grep -E "^version:" "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 | sed 's/version:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs 2>/dev/null || true)
1294
+ if [[ -z "$config_version" ]]; then
1295
+ config_version=$(grep -E "^[[:space:]]+version:" "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 | sed 's/.*version:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs 2>/dev/null || true)
1296
+ fi
1297
+ if [[ -f "$SQUAD_DIR/README.md" ]]; then
1298
+ readme_version=$(grep -oE "[Vv]ersion[[:space:]]*:?[[:space:]]*[0-9]+\.[0-9]+(\.[0-9]+)?" "$SQUAD_DIR/README.md" 2>/dev/null | head -1 | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?" || true)
1299
+ fi
1300
+ if [[ -n "${ENTRY_AGENT:-}" ]]; then
1301
+ local agent_file=""
1302
+ if [[ -f "$SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1303
+ agent_file="$SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1304
+ elif [[ -n "$INHERITED_SQUAD_DIR" ]] && [[ -f "$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1305
+ agent_file="$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1306
+ fi
1307
+ if [[ -n "$agent_file" ]]; then
1308
+ agent_version=$(grep -oE "[Vv]ersion[[:space:]]*:?[[:space:]]*[0-9]+\.[0-9]+(\.[0-9]+)?" "$agent_file" 2>/dev/null | head -1 | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?" || true)
1309
+ fi
1310
+ fi
1311
+ if [[ -n "$config_version" ]]; then
1312
+ if [[ -n "$readme_version" ]] && [[ "$readme_version" != "$config_version" ]]; then
1313
+ version_mismatch="config=$config_version vs README=$readme_version"
1314
+ M_VERSION_CONSISTENT="false"
1315
+ fi
1316
+ if [[ -n "$agent_version" ]] && [[ "$agent_version" != "$config_version" ]]; then
1317
+ version_mismatch="${version_mismatch:+$version_mismatch; }config=$config_version vs agent=$agent_version"
1318
+ M_VERSION_CONSISTENT="false"
1319
+ fi
1320
+ else
1321
+ M_VERSION_CONSISTENT="unknown"
1322
+ fi
1323
+ M_VERSION_DETAILS="$version_mismatch"
1324
+
1325
+ if [[ -n "${ENTRY_AGENT:-}" ]]; then
1326
+ local entry_agent_file=""
1327
+ if [[ -f "$SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1328
+ entry_agent_file="$SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1329
+ elif [[ -n "$INHERITED_SQUAD_DIR" ]] && [[ -f "$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1330
+ entry_agent_file="$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1331
+ fi
1332
+ if [[ -n "$entry_agent_file" ]]; then
1333
+ grep -qiE "smoke.?tests?" "$entry_agent_file" 2>/dev/null || agent_quality_gaps=$((agent_quality_gaps + 1))
1334
+ grep -qiE "output.?examples?" "$entry_agent_file" 2>/dev/null || agent_quality_gaps=$((agent_quality_gaps + 1))
1335
+ grep -qiE "anti.?patterns?" "$entry_agent_file" 2>/dev/null || agent_quality_gaps=$((agent_quality_gaps + 1))
1336
+ grep -qiE "heuristic" "$entry_agent_file" 2>/dev/null || agent_quality_gaps=$((agent_quality_gaps + 1))
1337
+ grep -qiE "handoff" "$entry_agent_file" 2>/dev/null || agent_quality_gaps=$((agent_quality_gaps + 1))
1338
+ fi
1339
+ fi
1340
+ M_AGENT_QUALITY_GAPS=$agent_quality_gaps
1341
+ }
1342
+
1343
+ hydrate_deep_review_from_envelope() {
1344
+ local deep_envelope="$1"
1345
+ local analysis_json=""
1346
+ local parsed_scores=""
1347
+
1348
+ analysis_json=$(extract_deep_analysis_payload "$deep_envelope")
1349
+ CLAUDE_RAW_JSON="$analysis_json"
1350
+ CLAUDE_REPORT_JSON=$(localize_review_json_for_report "$analysis_json")
1351
+
1352
+ parsed_scores=$(extract_review_fields "$analysis_json")
1353
+ while IFS=$'\t' read -r key value; do
1354
+ case "$key" in
1355
+ structural_completeness) CLAUDE_STRUCTURAL_COMPLETENESS="$value" ;;
1356
+ security_audit) CLAUDE_SECURITY_AUDIT="$value" ;;
1357
+ workflow_analysis) CLAUDE_WORKFLOW_ANALYSIS="$value" ;;
1358
+ agent_quality) CLAUDE_AGENT_QUALITY="$value" ;;
1359
+ squad_agnosticism) CLAUDE_SQUAD_AGNOSTICISM="$value" ;;
1360
+ config_quality) CLAUDE_CONFIG_QUALITY="$value" ;;
1361
+ production_evidence) CLAUDE_PRODUCTION_EVIDENCE="$value" ;;
1362
+ overall_score) M_QUALITY_SCORE="$value" ;;
1363
+ improvements_b64)
1364
+ M_IMPROVEMENTS=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "")' 2>/dev/null || printf '%s' "$value")
1365
+ M_IMPROVEMENTS_REPORT="$M_IMPROVEMENTS"
1366
+ ;;
1367
+ priority_fixes_b64)
1368
+ CLAUDE_EXEC_SUMMARY=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "")' 2>/dev/null || printf '%s' "$value")
1369
+ CLAUDE_EXEC_SUMMARY_REPORT="$CLAUDE_EXEC_SUMMARY"
1370
+ ;;
1371
+ false_positive_count)
1372
+ local fp_count="${value%%.*}"
1373
+ if [[ "$fp_count" =~ ^[0-9]+$ ]] && [[ "$fp_count" -gt 0 ]]; then
1374
+ local adjusted=$((SEC_FAIL - fp_count))
1375
+ if [[ $adjusted -lt 0 ]]; then adjusted=0; fi
1376
+ SEC_FAIL=$adjusted
1377
+ fi
1378
+ ;;
1379
+ esac
1380
+ done <<< "$parsed_scores"
1381
+
1382
+ if ! is_numeric_score "${M_QUALITY_SCORE:-}"; then
1383
+ M_QUALITY_SCORE="N/A"
1384
+ else
1385
+ M_QUALITY_SCORE=$(clamp_score_0_10 "$M_QUALITY_SCORE")
1386
+ fi
1387
+ }
1388
+
1389
+ extract_declared_output_root() {
1390
+ local shared_output_root=""
1391
+ local base_path_line=""
1392
+ local raw_root=""
1393
+ local trimmed=""
1394
+
1395
+ shared_output_root=$(awk '
1396
+ BEGIN { in_distribution=0 }
1397
+ /^distribution_contract:[[:space:]]*$/ { in_distribution=1; next }
1398
+ in_distribution && /^[^[:space:]]/ { in_distribution=0 }
1399
+ in_distribution && /^[[:space:]]*shared_safe_outputs_root:[[:space:]]*/ {
1400
+ gsub(/^[[:space:]]*shared_safe_outputs_root:[[:space:]]*/, "", $0)
1401
+ gsub(/["'\'']/, "", $0)
1402
+ gsub(/[[:space:]]+$/, "", $0)
1403
+ print $0
1404
+ exit
1405
+ }
1406
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true)
1407
+
1408
+ if [[ -n "$shared_output_root" ]]; then
1409
+ raw_root="$shared_output_root"
1410
+ else
1411
+ base_path_line=$(grep -E '^[[:space:]]*base_path:[[:space:]]*' "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 || true)
1412
+ [[ -z "$base_path_line" ]] && return 1
1413
+ raw_root=$(printf "%s" "$base_path_line" | sed 's/^[^:]*:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs)
1414
+ fi
1415
+
1416
+ [[ -z "$raw_root" ]] && return 1
1417
+
1418
+ trimmed="${raw_root%%\{*}"
1419
+ trimmed="${trimmed#./}"
1420
+ trimmed="${trimmed%/}"
1421
+
1422
+ [[ -z "$trimmed" ]] && return 1
1423
+ printf "%s\n" "$trimmed"
1424
+ }
1425
+
1426
+ count_declared_output_files() {
1427
+ local output_root=""
1428
+ output_root=$(extract_declared_output_root) || return 1
1429
+
1430
+ local absolute_root="$WORKSPACE_ROOT/$output_root"
1431
+ [[ ! -d "$absolute_root" ]] && return 1
1432
+
1433
+ find "$absolute_root" -type f 2>/dev/null | wc -l | tr -d ' '
1434
+ }
1435
+
1436
+ count_usage_evidence_output_files() {
1437
+ local output_root=""
1438
+ output_root=$(extract_declared_output_root) || return 1
1439
+
1440
+ local absolute_root="$WORKSPACE_ROOT/$output_root"
1441
+ [[ ! -d "$absolute_root" ]] && return 1
1442
+
1443
+ find "$absolute_root" -type f \
1444
+ ! -path '*/.*' \
1445
+ ! -name '.DS_Store' \
1446
+ 2>/dev/null | wc -l | tr -d ' '
1447
+ }
1448
+
1449
+ extract_config_scalar() {
1450
+ local key="$1"
1451
+ awk -v key="$key" '
1452
+ $0 ~ ("^" key ":[[:space:]]*") {
1453
+ sub(/^[^:]+:[[:space:]]*/, "", $0)
1454
+ gsub(/["'\'']/, "", $0)
1455
+ gsub(/[[:space:]]+$/, "", $0)
1456
+ print $0
1457
+ exit
1458
+ }
1459
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true
1460
+ }
1461
+
1462
+ extract_workspace_integration_level() {
1463
+ awk '
1464
+ BEGIN { in_ws=0 }
1465
+ /^workspace_integration_level:[[:space:]]*/ {
1466
+ gsub(/^workspace_integration_level:[[:space:]]*/, "", $0);
1467
+ gsub(/["'\'']/, "", $0);
1468
+ gsub(/[[:space:]]/, "", $0);
1469
+ print $0;
1470
+ exit;
1471
+ }
1472
+ /^workspace_integration:[[:space:]]*$/ { in_ws=1; next }
1473
+ in_ws && /^[^[:space:]]/ { in_ws=0 }
1474
+ in_ws && /^[[:space:]]*level:[[:space:]]*/ {
1475
+ gsub(/^[[:space:]]*level:[[:space:]]*/, "", $0);
1476
+ gsub(/["'\'']/, "", $0);
1477
+ gsub(/[[:space:]]/, "", $0);
1478
+ print $0;
1479
+ exit;
1480
+ }
1481
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true
1482
+ }
1483
+
1484
+ collect_agnosticism_excluded_dirs() {
1485
+ python3 - "$SQUAD_DIR/config.yaml" <<'PY'
1486
+ import sys
1487
+ from pathlib import Path
1488
+
1489
+ import yaml
1490
+
1491
+ config_path = Path(sys.argv[1])
1492
+ if not config_path.exists():
1493
+ raise SystemExit(0)
1494
+
1495
+ raw = yaml.safe_load(config_path.read_text(encoding="utf-8")) or {}
1496
+ items = raw.get("agnosticism_exceptions") or []
1497
+ seen = set()
1498
+
1499
+ for item in items:
1500
+ if not isinstance(item, dict):
1501
+ continue
1502
+ scope = item.get("scope")
1503
+ if not isinstance(scope, str) or "/" not in scope:
1504
+ continue
1505
+ head = scope.split("/", 1)[0].strip()
1506
+ if not head or "*" in head or head in seen:
1507
+ continue
1508
+ seen.add(head)
1509
+ print(head)
1510
+ PY
1511
+ }
1512
+
1513
+ count_contract_test_files() {
1514
+ local test_count=0
1515
+ local infra_count=0
1516
+ local slug_hyphen="$SQUAD_NAME"
1517
+ local slug_underscore="${SQUAD_NAME//-/_}"
1518
+
1519
+ if [[ -d "$SQUAD_DIR/tests" ]]; then
1520
+ test_count=$(find "$SQUAD_DIR/tests" -type f \( -name "*.bats" -o -name "*.cjs" -o -name "*.js" -o -name "*.mjs" \) 2>/dev/null | wc -l | tr -d ' ')
1521
+ fi
1522
+
1523
+ infra_count=$(find "$WORKSPACE_ROOT/infrastructure/scripts/squads" -type f \
1524
+ \( -name "*${slug_hyphen}*.cjs" -o -name "*${slug_hyphen}*.js" -o -name "*${slug_hyphen}*.mjs" \
1525
+ -o -name "*${slug_underscore}*.cjs" -o -name "*${slug_underscore}*.js" -o -name "*${slug_underscore}*.mjs" \) \
1526
+ 2>/dev/null | wc -l | tr -d ' ')
1527
+
1528
+ echo $((test_count + infra_count))
1529
+ }
1530
+
1531
+ count_operational_story_files() {
1532
+ local roots=()
1533
+ local count=0
1534
+
1535
+ [[ -d "$WORKSPACE_ROOT/docs/stories" ]] && roots+=("$WORKSPACE_ROOT/docs/stories")
1536
+ [[ -d "$SQUAD_DIR/docs/stories" ]] && roots+=("$SQUAD_DIR/docs/stories")
1537
+
1538
+ if [[ ${#roots[@]} -eq 0 ]]; then
1539
+ echo 0
1540
+ return 0
1541
+ fi
1542
+
1543
+ count=$(grep -RIlE --include="*.md" \
1544
+ "(${SQUAD_NAME}|squads/${SQUAD_NAME}/|validate-squad[[:space:]]+${SQUAD_NAME}|test_[[:alnum:]_-]*${SQUAD_NAME//-/_})" \
1545
+ "${roots[@]}" 2>/dev/null | wc -l | tr -d ' ')
1546
+
1547
+ echo "$count"
1548
+ }
1549
+
1550
+ parse_workflow_contract_totals() {
1551
+ node -e '
1552
+ const fs = require("fs");
1553
+ const raw = fs.readFileSync(0, "utf8").trim();
1554
+ const ansiStripped = raw.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
1555
+
1556
+ function extractFirstJsonObject(text) {
1557
+ for (let start = 0; start < text.length; start += 1) {
1558
+ if (text[start] !== "{") continue;
1559
+ let depth = 0;
1560
+ let inString = false;
1561
+ let escaped = false;
1562
+ for (let i = start; i < text.length; i += 1) {
1563
+ const ch = text[i];
1564
+ if (inString) {
1565
+ if (escaped) {
1566
+ escaped = false;
1567
+ } else if (ch === "\\\\") {
1568
+ escaped = true;
1569
+ } else if (ch === "\"") {
1570
+ inString = false;
1571
+ }
1572
+ continue;
1573
+ }
1574
+ if (ch === "\"") {
1575
+ inString = true;
1576
+ continue;
1577
+ }
1578
+ if (ch === "{") depth += 1;
1579
+ if (ch === "}") {
1580
+ depth -= 1;
1581
+ if (depth === 0) return text.slice(start, i + 1);
1582
+ }
1583
+ }
1584
+ }
1585
+ return "{}";
1586
+ }
1587
+
1588
+ let data = {};
1589
+ const firstObject = extractFirstJsonObject(ansiStripped);
1590
+ try {
1591
+ data = firstObject ? JSON.parse(firstObject) : {};
1592
+ } catch {
1593
+ data = {};
1594
+ }
1595
+ const totals = data.totals || {};
1596
+ const fields = {
1597
+ files_checked: Number(totals.files_checked) || 0,
1598
+ errors: Number(totals.errors) || 0,
1599
+ warnings: Number(totals.warnings) || 0,
1600
+ invalid_files: Number(totals.invalid_files) || 0,
1601
+ };
1602
+ for (const [key, value] of Object.entries(fields)) {
1603
+ console.log(`${key}\t${value}`);
1604
+ }
1605
+ '
1606
+ }
1607
+
1608
+ # ═══════════════════════════════════════════════════════════════════════════════
1609
+ # PHASE 1: STRUCTURE (Deterministic - Bash)
1610
+ # ═══════════════════════════════════════════════════════════════════════════════
1611
+
1612
+ check_structure() {
1613
+ log_section "PHASE 1: Structure Validation (Bash)"
1614
+ local tier1_fail=0
1615
+
1616
+ # 1.1 Config file
1617
+ log_subsection "1.1 Configuration"
1618
+ if [[ -f "$SQUAD_DIR/config.yaml" ]]; then
1619
+ log_pass "config.yaml exists"
1620
+
1621
+ # Check for name (top-level or under squad:/pack:)
1622
+ if grep -qE "^name:|^[[:space:]]+name:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1623
+ log_pass "config.yaml has 'name' field"
1624
+ else
1625
+ log_fail "config.yaml missing 'name' field"
1626
+ tier1_fail=$((tier1_fail + 1))
1627
+ fi
1628
+
1629
+ # Check for version (top-level or under squad:/pack:)
1630
+ if grep -qE "^version:|^[[:space:]]+version:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1631
+ log_pass "config.yaml has 'version' field"
1632
+ else
1633
+ log_fail "config.yaml missing 'version' field"
1634
+ tier1_fail=$((tier1_fail + 1))
1635
+ fi
1636
+
1637
+ # Check for entry_agent (top-level, under squad:/pack:, or in agents list)
1638
+ if grep -q "entry_agent:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1639
+ log_pass "config.yaml has 'entry_agent' field"
1640
+ ENTRY_AGENT=$(grep "entry_agent:" "$SQUAD_DIR/config.yaml" | head -1 | sed 's/.*entry_agent:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs)
1641
+ elif grep -qE "^[[:space:]]+- id:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1642
+ # Has agents list, extract first agent as entry point
1643
+ ENTRY_AGENT=$(grep -E "^[[:space:]]+- id:" "$SQUAD_DIR/config.yaml" | head -1 | sed 's/.*- id:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs)
1644
+ log_warn "No entry_agent defined, using first agent: $ENTRY_AGENT"
1645
+ else
1646
+ log_warn "config.yaml missing 'entry_agent' field (non-blocking)"
1647
+ fi
1648
+ else
1649
+ log_fail "config.yaml not found"
1650
+ tier1_fail=$((tier1_fail + 1))
1651
+ fi
1652
+
1653
+ # 1.2 Entry agent
1654
+ log_subsection "1.2 Entry Point"
1655
+ if [[ -n "${ENTRY_AGENT:-}" ]]; then
1656
+ if asset_exists "agents" "${ENTRY_AGENT}.md"; then
1657
+ log_pass "Entry agent exists: agents/${ENTRY_AGENT}.md"
1658
+ else
1659
+ log_fail "Entry agent not found: agents/${ENTRY_AGENT}.md"
1660
+ tier1_fail=$((tier1_fail + 1))
1661
+ fi
1662
+ fi
1663
+
1664
+ # 1.2b Config task registry integrity
1665
+ local config_task_ids=""
1666
+ config_task_ids=$(awk '
1667
+ /^tasks:/ { in_tasks=1; next }
1668
+ in_tasks && /^[^[:space:]]/ { in_tasks=0 }
1669
+ in_tasks && $1 == "-" && $2 == "id:" {
1670
+ gsub(/"/, "", $3)
1671
+ print $3
1672
+ }
1673
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true)
1674
+ if [[ -n "$config_task_ids" ]]; then
1675
+ CONFIG_TASK_IDS="$config_task_ids"
1676
+ local missing_config_tasks=0
1677
+ while IFS= read -r task_id; do
1678
+ [[ -n "$task_id" ]] || continue
1679
+ if [[ -f "$SQUAD_DIR/tasks/${task_id}.md" ]]; then
1680
+ log_pass "CONFIG-002: Task declared in config exists: $task_id"
1681
+ else
1682
+ log_fail "CONFIG-002: Task declared in config missing file: $task_id"
1683
+ tier1_fail=$((tier1_fail + 1))
1684
+ missing_config_tasks=$((missing_config_tasks + 1))
1685
+ fi
1686
+ done <<< "$config_task_ids"
1687
+ if [[ "$missing_config_tasks" -eq 0 ]]; then
1688
+ log_pass "CONFIG-002: Config task registry has no ghost task IDs"
1689
+ fi
1690
+ fi
1691
+
1692
+ # 1.3 Workspace integration governance
1693
+ log_subsection "1.3 Workspace Integration Governance"
1694
+ local workspace_level=""
1695
+ workspace_level=$(awk '
1696
+ BEGIN { in_ws=0 }
1697
+ /^workspace_integration_level:[[:space:]]*/ {
1698
+ gsub(/^workspace_integration_level:[[:space:]]*/, "", $0);
1699
+ gsub(/["'\'']/, "", $0);
1700
+ gsub(/[[:space:]]/, "", $0);
1701
+ print $0;
1702
+ exit;
1703
+ }
1704
+ /^workspace_integration:[[:space:]]*$/ { in_ws=1; next }
1705
+ in_ws && /^[^[:space:]]/ { in_ws=0 }
1706
+ in_ws && /^[[:space:]]*level:[[:space:]]*/ {
1707
+ gsub(/^[[:space:]]*level:[[:space:]]*/, "", $0);
1708
+ gsub(/["'\'']/, "", $0);
1709
+ gsub(/[[:space:]]/, "", $0);
1710
+ print $0;
1711
+ exit;
1712
+ }
1713
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true)
1714
+
1715
+ case "$workspace_level" in
1716
+ none|read_only|controlled_runtime_consumer|workspace_first)
1717
+ log_pass "workspace integration level declared: $workspace_level"
1718
+ ;;
1719
+ "")
1720
+ log_fail "config.yaml missing workspace integration level (workspace_integration.level)"
1721
+ tier1_fail=$((tier1_fail + 1))
1722
+ ;;
1723
+ *)
1724
+ log_fail "invalid workspace integration level: '$workspace_level'"
1725
+ tier1_fail=$((tier1_fail + 1))
1726
+ ;;
1727
+ esac
1728
+
1729
+ if [[ -n "$workspace_level" && "$workspace_level" != "none" ]]; then
1730
+ # Build list of existing paths to search (avoid rg exit 2 on missing files)
1731
+ local ws_search_paths=()
1732
+ [[ -d "$SQUAD_DIR/agents" ]] && ws_search_paths+=("$SQUAD_DIR/agents")
1733
+ [[ -d "$SQUAD_DIR/tasks" ]] && ws_search_paths+=("$SQUAD_DIR/tasks")
1734
+ [[ -d "$SQUAD_DIR/workflows" ]] && ws_search_paths+=("$SQUAD_DIR/workflows")
1735
+ [[ -f "$SQUAD_DIR/config.yaml" ]] && ws_search_paths+=("$SQUAD_DIR/config.yaml")
1736
+
1737
+ if [[ ${#ws_search_paths[@]} -gt 0 ]] && grep -rn "workspace/" "${ws_search_paths[@]}" >/dev/null 2>&1; then
1738
+ log_pass "workspace references found for integration level '$workspace_level'"
1739
+ else
1740
+ log_fail "workspace integration level '$workspace_level' declared but no workspace paths found"
1741
+ tier1_fail=$((tier1_fail + 1))
1742
+ fi
1743
+ fi
1744
+
1745
+ if [[ "$workspace_level" == "controlled_runtime_consumer" || "$workspace_level" == "workspace_first" ]]; then
1746
+ if [[ -d "$C_LEVEL_WORKSPACE_DIR" ]]; then
1747
+ log_pass "workspace governance squad present for level '$workspace_level'"
1748
+ else
1749
+ log_fail "workspace level '$workspace_level' requires workspace governance squad (squads/c-level) to exist"
1750
+ tier1_fail=$((tier1_fail + 1))
1751
+ fi
1752
+ # Build list of existing paths (README.md may not exist yet)
1753
+ local coo_search_paths=()
1754
+ [[ -f "$SQUAD_DIR/README.md" ]] && coo_search_paths+=("$SQUAD_DIR/README.md")
1755
+ [[ -d "$SQUAD_DIR/tasks" ]] && coo_search_paths+=("$SQUAD_DIR/tasks")
1756
+ [[ -d "$SQUAD_DIR/workflows" ]] && coo_search_paths+=("$SQUAD_DIR/workflows")
1757
+ [[ -f "$SQUAD_DIR/config.yaml" ]] && coo_search_paths+=("$SQUAD_DIR/config.yaml")
1758
+
1759
+ if [[ ${#coo_search_paths[@]} -gt 0 ]] && grep -rn -E "@coo|COO|c-level|workspace-chief|readiness_owner|workspace-handoff\\.yaml|handoff.*workspace" \
1760
+ "${coo_search_paths[@]}" >/dev/null 2>&1; then
1761
+ log_pass "workspace write integration delegates to workspace governance"
1762
+ else
1763
+ log_fail "workspace level '$workspace_level' requires explicit COO/workspace governance handoff"
1764
+ tier1_fail=$((tier1_fail + 1))
1765
+ fi
1766
+ fi
1767
+
1768
+ if [[ "$workspace_level" == "workspace_first" ]]; then
1769
+ local bootstrap_count=0
1770
+ local essentials_count=0
1771
+ bootstrap_count=$(find "$SQUAD_DIR/scripts" -maxdepth 1 -type f -name "bootstrap-*-workspace.sh" 2>/dev/null | wc -l | tr -d ' ')
1772
+ essentials_count=$(find "$SQUAD_DIR/scripts" -maxdepth 1 -type f -name "validate-*-essentials.sh" 2>/dev/null | wc -l | tr -d ' ')
1773
+ if [[ "$bootstrap_count" -gt 0 ]]; then
1774
+ log_pass "workspace_first has bootstrap script"
1775
+ else
1776
+ log_fail "workspace_first requires scripts/bootstrap-*-workspace.sh"
1777
+ tier1_fail=$((tier1_fail + 1))
1778
+ fi
1779
+ if [[ "$essentials_count" -gt 0 ]]; then
1780
+ log_pass "workspace_first has essentials validator script"
1781
+ else
1782
+ log_fail "workspace_first requires scripts/validate-*-essentials.sh"
1783
+ tier1_fail=$((tier1_fail + 1))
1784
+ fi
1785
+ fi
1786
+
1787
+ # 1.4 Directory structure
1788
+ log_subsection "1.4 Directory Structure"
1789
+ local found_dirs=0
1790
+ for dir in agents tasks checklists templates data; do
1791
+ if [[ -d "$SQUAD_DIR/$dir" ]]; then
1792
+ local count=$(find "$SQUAD_DIR/$dir" -type f \( -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) 2>/dev/null | wc -l | tr -d ' ')
1793
+ log_pass "$dir/ exists ($count files)"
1794
+ found_dirs=$((found_dirs + 1))
1795
+ else
1796
+ log_info "$dir/ not found (optional)"
1797
+ fi
1798
+ done
1799
+
1800
+ # 1.5 Collect metrics
1801
+ log_subsection "1.5 Metrics Collection"
1802
+ M_AGENT_COUNT=$(find "$SQUAD_DIR/agents" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
1803
+ M_TASK_COUNT=$(find "$SQUAD_DIR/tasks" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
1804
+ M_CHECKLIST_COUNT=$(find "$SQUAD_DIR/checklists" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
1805
+ M_TEMPLATE_COUNT=$(find "$SQUAD_DIR/templates" -type f 2>/dev/null | wc -l | tr -d ' ')
1806
+ M_DATA_COUNT=$(find "$SQUAD_DIR/data" -type f 2>/dev/null | wc -l | tr -d ' ')
1807
+ M_TOTAL_LINES=$(find "$SQUAD_DIR" -type f \( -name "*.md" -o -name "*.yaml" \) -exec cat {} + 2>/dev/null | wc -l | tr -d ' ')
1808
+
1809
+ log_info "Agents: $M_AGENT_COUNT, Tasks: $M_TASK_COUNT, Checklists: $M_CHECKLIST_COUNT"
1810
+ log_info "Total lines: $M_TOTAL_LINES"
1811
+
1812
+ # 1.6 Stub/placeholder guard (ghost artifacts)
1813
+ log_subsection "1.6 Stub/Placeholder Guard"
1814
+ local stub_hits=0
1815
+ local stub_scope=(
1816
+ "$SQUAD_DIR/agents"
1817
+ "$SQUAD_DIR/tasks"
1818
+ "$SQUAD_DIR/checklists"
1819
+ "$SQUAD_DIR/templates"
1820
+ "$SQUAD_DIR/workflows"
1821
+ "$SQUAD_DIR/data"
1822
+ )
1823
+ local stub_matches
1824
+ stub_matches=$(grep -RInE --include="*.md" --include="*.yaml" --include="*.yml" \
1825
+ "(TODO for later completion|AUTO-GENERATED STUB|\\[STUB\\]|placeholder artifact|stub file)" \
1826
+ "${stub_scope[@]}" 2>/dev/null || true)
1827
+ if [[ -n "$stub_matches" ]]; then
1828
+ log_fail "STRUCT-007: Stub/placeholder artifacts found (remove placeholders before PASS)"
1829
+ tier1_fail=$((tier1_fail + 1))
1830
+ if [[ "$VERBOSE" == "true" ]]; then
1831
+ echo "$stub_matches" | head -n 10
1832
+ fi
1833
+ else
1834
+ log_pass "STRUCT-007: No stub/placeholder artifact markers found"
1835
+ fi
1836
+
1837
+ # 1.7 Structural Completeness (SC_STRUCT_001)
1838
+ log_subsection "1.7 Structural Completeness (SC_STRUCT_001)"
1839
+ local sc_pass=0
1840
+ local sc_total=2
1841
+
1842
+ # Check tested: flag in config.yaml
1843
+ if grep -qE "^tested:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
1844
+ log_pass "SC_STRUCT_001: tested: flag present in config.yaml"
1845
+ sc_pass=$((sc_pass + 1))
1846
+ M_HAS_TESTED_FLAG="true"
1847
+ else
1848
+ log_warn "SC_STRUCT_001: Missing tested: flag in config.yaml"
1849
+ fi
1850
+
1851
+ # Check ARCHITECTURE.md exists
1852
+ if [[ -f "$SQUAD_DIR/ARCHITECTURE.md" ]]; then
1853
+ log_pass "SC_STRUCT_001: ARCHITECTURE.md exists"
1854
+ sc_pass=$((sc_pass + 1))
1855
+ M_HAS_ARCHITECTURE_DOC="true"
1856
+ else
1857
+ log_warn "SC_STRUCT_001: Missing ARCHITECTURE.md"
1858
+ fi
1859
+
1860
+ # Check update-*.md task exists
1861
+ local has_update_task=false
1862
+ local lifecycle_pass=0
1863
+ local lifecycle_total=2
1864
+ if [[ -d "$SQUAD_DIR/tasks" ]]; then
1865
+ local update_tasks
1866
+ update_tasks=$(find "$SQUAD_DIR/tasks" -maxdepth 1 -name "update-*.md" 2>/dev/null | wc -l | tr -d ' ')
1867
+ if [[ "$update_tasks" -gt 0 ]]; then
1868
+ log_pass "SC_STRUCT_001: update-*.md task exists ($update_tasks found, lifecycle contextual)"
1869
+ has_update_task=true
1870
+ lifecycle_pass=$((lifecycle_pass + 1))
1871
+ M_HAS_UPDATE_TASK="true"
1872
+ fi
1873
+ fi
1874
+ if [[ "$has_update_task" == "false" ]]; then
1875
+ log_warn "SC_STRUCT_001: Missing update-*.md task (contextual lifecycle warning, not structural debt)"
1876
+ fi
1877
+
1878
+ # Check delete-*.md task exists
1879
+ local has_delete_task=false
1880
+ if [[ -d "$SQUAD_DIR/tasks" ]]; then
1881
+ local delete_tasks
1882
+ delete_tasks=$(find "$SQUAD_DIR/tasks" -maxdepth 1 -name "delete-*.md" 2>/dev/null | wc -l | tr -d ' ')
1883
+ if [[ "$delete_tasks" -gt 0 ]]; then
1884
+ log_pass "SC_STRUCT_001: delete-*.md task exists ($delete_tasks found, lifecycle contextual)"
1885
+ has_delete_task=true
1886
+ lifecycle_pass=$((lifecycle_pass + 1))
1887
+ M_HAS_DELETE_TASK="true"
1888
+ fi
1889
+ fi
1890
+ if [[ "$has_delete_task" == "false" ]]; then
1891
+ log_warn "SC_STRUCT_001: Missing delete-*.md task (contextual lifecycle warning, not structural debt)"
1892
+ fi
1893
+
1894
+ M_STRUCT_COMPLETENESS_PASS=$sc_pass
1895
+ M_STRUCT_COMPLETENESS_TOTAL=$sc_total
1896
+ M_CONTEXTUAL_LIFECYCLE_PASS=$lifecycle_pass
1897
+ M_CONTEXTUAL_LIFECYCLE_TOTAL=$lifecycle_total
1898
+ M_CONTEXTUAL_LIFECYCLE_WARNINGS=$((lifecycle_total - lifecycle_pass))
1899
+ log_info "Structural completeness: $sc_pass/$sc_total"
1900
+
1901
+ # 1.8 Version Consistency
1902
+ log_subsection "1.8 Version Consistency"
1903
+ local config_version=""
1904
+ local readme_version=""
1905
+ local agent_version=""
1906
+ local version_mismatch=""
1907
+
1908
+ # Try root-level first (brand style), then nested under squad:/pack: (books/copy/hormozi style)
1909
+ config_version=$(grep -E "^version:" "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 | sed 's/version:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs 2>/dev/null || true)
1910
+ if [[ -z "$config_version" ]]; then
1911
+ config_version=$(grep -E "^[[:space:]]+version:" "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 | sed 's/.*version:[[:space:]]*//' | tr -d '"' | tr -d "'" | xargs 2>/dev/null || true)
1912
+ fi
1913
+
1914
+ if [[ -f "$SQUAD_DIR/README.md" ]]; then
1915
+ readme_version=$(grep -oE "[Vv]ersion[[:space:]]*:?[[:space:]]*[0-9]+\.[0-9]+(\.[0-9]+)?" "$SQUAD_DIR/README.md" 2>/dev/null | head -1 | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?" || true)
1916
+ fi
1917
+
1918
+ if [[ -n "${ENTRY_AGENT:-}" ]]; then
1919
+ local agent_file=""
1920
+ if [[ -f "$SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1921
+ agent_file="$SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1922
+ elif [[ -n "$INHERITED_SQUAD_DIR" ]] && [[ -f "$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1923
+ agent_file="$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1924
+ fi
1925
+ if [[ -n "$agent_file" ]]; then
1926
+ agent_version=$(grep -oE "[Vv]ersion[[:space:]]*:?[[:space:]]*[0-9]+\.[0-9]+(\.[0-9]+)?" "$agent_file" 2>/dev/null | head -1 | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?" || true)
1927
+ fi
1928
+ fi
1929
+
1930
+ if [[ -n "$config_version" ]]; then
1931
+ log_info "config.yaml version: $config_version"
1932
+ if [[ -n "$readme_version" ]] && [[ "$readme_version" != "$config_version" ]]; then
1933
+ log_warn "Version mismatch: config.yaml=$config_version, README.md=$readme_version"
1934
+ version_mismatch="config=$config_version vs README=$readme_version"
1935
+ M_VERSION_CONSISTENT="false"
1936
+ fi
1937
+ if [[ -n "$agent_version" ]] && [[ "$agent_version" != "$config_version" ]]; then
1938
+ log_warn "Version mismatch: config.yaml=$config_version, entry agent=$agent_version"
1939
+ version_mismatch="${version_mismatch:+$version_mismatch; }config=$config_version vs agent=$agent_version"
1940
+ M_VERSION_CONSISTENT="false"
1941
+ fi
1942
+ if [[ "$M_VERSION_CONSISTENT" == "true" ]]; then
1943
+ log_pass "Version consistent across sources"
1944
+ fi
1945
+ else
1946
+ log_warn "No version found in config.yaml to compare"
1947
+ M_VERSION_CONSISTENT="unknown"
1948
+ fi
1949
+ M_VERSION_DETAILS="$version_mismatch"
1950
+
1951
+ # 1.9 Agent Structure (Entry Agent)
1952
+ log_subsection "1.9 Agent Structure (Entry Agent)"
1953
+ local agent_quality_gaps=0
1954
+ if [[ -n "${ENTRY_AGENT:-}" ]]; then
1955
+ local entry_agent_file=""
1956
+ if [[ -f "$SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1957
+ entry_agent_file="$SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1958
+ elif [[ -n "$INHERITED_SQUAD_DIR" ]] && [[ -f "$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
1959
+ entry_agent_file="$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md"
1960
+ fi
1961
+
1962
+ if [[ -n "$entry_agent_file" ]]; then
1963
+ # Check for smoke_tests / smoke-tests
1964
+ if grep -qiE "smoke.?tests?" "$entry_agent_file" 2>/dev/null; then
1965
+ log_pass "Entry agent has smoke_tests section"
1966
+ else
1967
+ log_warn "Entry agent missing smoke_tests section"
1968
+ agent_quality_gaps=$((agent_quality_gaps + 1))
1969
+ fi
1970
+
1971
+ # Check for output_examples / output-examples
1972
+ if grep -qiE "output.?examples?" "$entry_agent_file" 2>/dev/null; then
1973
+ log_pass "Entry agent has output_examples section"
1974
+ else
1975
+ log_warn "Entry agent missing output_examples section"
1976
+ agent_quality_gaps=$((agent_quality_gaps + 1))
1977
+ fi
1978
+
1979
+ # Check for anti_patterns / anti-patterns
1980
+ if grep -qiE "anti.?patterns?" "$entry_agent_file" 2>/dev/null; then
1981
+ log_pass "Entry agent has anti_patterns section"
1982
+ else
1983
+ log_warn "Entry agent missing anti_patterns section"
1984
+ agent_quality_gaps=$((agent_quality_gaps + 1))
1985
+ fi
1986
+
1987
+ # Check for heuristics (with WHEN/SE/QUANDO)
1988
+ if grep -qiE "heuristic" "$entry_agent_file" 2>/dev/null; then
1989
+ log_pass "Entry agent has heuristics section"
1990
+ else
1991
+ log_warn "Entry agent missing heuristics section"
1992
+ agent_quality_gaps=$((agent_quality_gaps + 1))
1993
+ fi
1994
+
1995
+ # Check for handoff_to / handoffs
1996
+ if grep -qiE "handoff" "$entry_agent_file" 2>/dev/null; then
1997
+ log_pass "Entry agent has handoff section"
1998
+ else
1999
+ log_warn "Entry agent missing handoff section"
2000
+ agent_quality_gaps=$((agent_quality_gaps + 1))
2001
+ fi
2002
+ fi
2003
+ fi
2004
+ M_AGENT_QUALITY_GAPS=$agent_quality_gaps
2005
+ log_info "Agent quality gaps: $agent_quality_gaps/5"
2006
+
2007
+ # 1.10 pack: section check (CI parity — same check as CI validate-squads)
2008
+ log_subsection "1.10 pack: Section Check (CI Parity)"
2009
+ local config="$SQUAD_DIR/config.yaml"
2010
+ if [[ -f "$config" ]]; then
2011
+ if grep -q "^pack:" "$config"; then
2012
+ log_pass "CI-PAR-001: config.yaml has 'pack:' section"
2013
+ else
2014
+ log_fail "CI-PAR-001: config.yaml missing 'pack:' section (CI hard-mandatory)"
2015
+ tier1_fail=$((tier1_fail + 1))
2016
+ fi
2017
+ fi
2018
+
2019
+ # 1.11 YAML syntax check (CI parity — mirrors GrantBirki json-yaml-validate action)
2020
+ log_subsection "1.11 YAML Syntax Validation (CI Parity)"
2021
+ if command -v python3 >/dev/null 2>&1 && python3 -c "import yaml" 2>/dev/null; then
2022
+ local yaml_errors=0
2023
+ while IFS= read -r yaml_file; do
2024
+ [[ -z "$yaml_file" ]] && continue
2025
+ local yaml_err
2026
+ yaml_err=$(python3 -c "
2027
+ import yaml, sys
2028
+ try:
2029
+ yaml.safe_load(open('$yaml_file'))
2030
+ except yaml.YAMLError as e:
2031
+ print(str(e))
2032
+ sys.exit(1)
2033
+ " 2>&1) || {
2034
+ log_fail "CI-PAR-002: Invalid YAML syntax: $yaml_file — $yaml_err"
2035
+ tier1_fail=$((tier1_fail + 1))
2036
+ yaml_errors=$((yaml_errors + 1))
2037
+ }
2038
+ done < <(find "$SQUAD_DIR" -name "*.yaml" -o -name "*.yml" 2>/dev/null)
2039
+ if [[ "$yaml_errors" -eq 0 ]]; then
2040
+ log_pass "CI-PAR-002: All YAML files have valid syntax"
2041
+ fi
2042
+ else
2043
+ log_warn "CI-PAR-002: python3/pyyaml not available — YAML syntax check skipped (install python3 + pyyaml for full CI parity)"
2044
+ fi
2045
+
2046
+ TIER1_FAIL=$tier1_fail
2047
+ }
2048
+
2049
+ # ═══════════════════════════════════════════════════════════════════════════════
2050
+ # PHASE 2: SECURITY SCAN (Deterministic - Bash)
2051
+ # ═══════════════════════════════════════════════════════════════════════════════
2052
+
2053
+ check_security() {
2054
+ log_section "PHASE 2: Security Scan (Bash)"
2055
+ local sec_fail=0
2056
+
2057
+ log_subsection "2.1 API Keys & Tokens"
2058
+
2059
+ if [[ -n "$(scan_dir_api_keys "$SQUAD_DIR")" ]]; then
2060
+ log_fail "SEC-001: Potential API keys found"
2061
+ sec_fail=$((sec_fail + 1))
2062
+ else
2063
+ log_pass "SEC-001: No hardcoded API keys"
2064
+ fi
2065
+
2066
+ if [[ -n "$(scan_dir_secrets "$SQUAD_DIR")" ]]; then
2067
+ log_fail "SEC-002: Potential secrets found"
2068
+ sec_fail=$((sec_fail + 1))
2069
+ else
2070
+ log_pass "SEC-002: No hardcoded secrets"
2071
+ fi
2072
+
2073
+ log_subsection "2.2 Cloud Credentials"
2074
+
2075
+ if [[ -n "$(scan_dir_aws_keys "$SQUAD_DIR")" ]]; then
2076
+ log_fail "SEC-003: AWS Access Key found"
2077
+ sec_fail=$((sec_fail + 1))
2078
+ else
2079
+ log_pass "SEC-003: No AWS Access Keys"
2080
+ fi
2081
+
2082
+ if [[ -n "$(scan_dir_gcp_service_accounts "$SQUAD_DIR")" ]]; then
2083
+ log_fail "SEC-004: GCP Service Account found"
2084
+ sec_fail=$((sec_fail + 1))
2085
+ else
2086
+ log_pass "SEC-004: No GCP Service Accounts"
2087
+ fi
2088
+
2089
+ log_subsection "2.3 Private Keys"
2090
+
2091
+ if [[ -n "$(scan_dir_private_keys "$SQUAD_DIR")" ]]; then
2092
+ log_fail "SEC-005: Private key content found"
2093
+ sec_fail=$((sec_fail + 1))
2094
+ else
2095
+ log_pass "SEC-005: No private key content"
2096
+ fi
2097
+
2098
+ if [[ -n "$(scan_dir_key_files "$SQUAD_DIR")" ]]; then
2099
+ log_fail "SEC-006: Private key files found"
2100
+ sec_fail=$((sec_fail + 1))
2101
+ else
2102
+ log_pass "SEC-006: No private key files"
2103
+ fi
2104
+
2105
+ log_subsection "2.4 Database & Sensitive Files"
2106
+
2107
+ if [[ -n "$(scan_dir_db_urls "$SQUAD_DIR")" ]]; then
2108
+ log_fail "SEC-007: Database URL with password found"
2109
+ sec_fail=$((sec_fail + 1))
2110
+ else
2111
+ log_pass "SEC-007: No database URLs with passwords"
2112
+ fi
2113
+
2114
+ if [[ -n "$(scan_dir_env_files "$SQUAD_DIR")" ]]; then
2115
+ log_fail "SEC-008: .env files found"
2116
+ sec_fail=$((sec_fail + 1))
2117
+ else
2118
+ log_pass "SEC-008: No .env files"
2119
+ fi
2120
+
2121
+ SEC_FAIL=$sec_fail
2122
+ M_SECURITY_ISSUES=$sec_fail
2123
+
2124
+ if [[ $sec_fail -gt 0 ]]; then
2125
+ echo -e "\n${RED}⚠️ SECURITY: $sec_fail HIGH severity issues${NC}"
2126
+ else
2127
+ echo -e "\n${GREEN}✓ Security scan passed${NC}"
2128
+ fi
2129
+ }
2130
+
2131
+ # ═══════════════════════════════════════════════════════════════════════════════
2132
+ # PHASE 2.5: SQUAD AGNOSTICISM CHECK (Deterministic - Bash)
2133
+ # ═══════════════════════════════════════════════════════════════════════════════
2134
+
2135
+ check_squad_agnosticism() {
2136
+ log_section "PHASE 2.5: Squad Agnosticism Check"
2137
+ local agn_violations=0
2138
+ local agn_details=""
2139
+ local agn_exclude_args=(
2140
+ --exclude-dir=.git
2141
+ --exclude-dir=node_modules
2142
+ --exclude-dir=tests
2143
+ --exclude-dir=docs
2144
+ --exclude-dir=data
2145
+ --exclude-dir=scripts
2146
+ --exclude-dir=lib
2147
+ --exclude-dir=server
2148
+ )
2149
+
2150
+ if [[ ! -f "$SQUAD_DIR/config.yaml" ]]; then
2151
+ log_info "No config.yaml, skipping agnosticism check"
2152
+ return 0
2153
+ fi
2154
+
2155
+ while IFS= read -r excluded_dir; do
2156
+ [[ -n "$excluded_dir" ]] || continue
2157
+ agn_exclude_args+=("--exclude-dir=$excluded_dir")
2158
+ done < <(collect_agnosticism_excluded_dirs)
2159
+
2160
+ # 1. Check for hardcoded URLs (excluding generic/platform/documentation URLs)
2161
+ # Scans config, agents, tasks, workflows, templates, checklists (core squad files)
2162
+ # Excludes: docs/ (historical handoffs), data/ (operational logs), scripts/ (implementation)
2163
+ local url_hits=""
2164
+ url_hits=$(grep -rInE \
2165
+ --include="*.yaml" --include="*.yml" --include="*.md" \
2166
+ "${agn_exclude_args[@]}" \
2167
+ "https?://[^ )'\">{}\`]+" "$SQUAD_DIR" \
2168
+ 2>/dev/null \
2169
+ | grep -vE "(github\.com|npmjs\.com|docs\.|documentation|wikipedia|example\.com|localhost|127\.0\.0\.1|schema\.org|json-schema|yaml\.org|commonmark|youtube\.com|youtu\.be|cloud\.google\.com|amazon\.com|goodreads\.com|ted\.com|supabase\.co|supabase\.com|googleapis\.com|stackoverflow\.com|medium\.com|apple\.com|spotify\.com|oprah\.com|podcasts\.|\"https://\.\.\.\"|lewishowes\.com|\[X\].*https://)" \
2170
+ || true)
2171
+ if [[ -n "$url_hits" ]]; then
2172
+ local url_count
2173
+ url_count=$(echo "$url_hits" | wc -l | tr -d ' ')
2174
+ log_warn "AGN-001: Found $url_count potentially business-specific URLs"
2175
+ agn_violations=$((agn_violations + url_count))
2176
+ agn_details="${agn_details}AGN-001: $url_count specific URLs found\n"
2177
+ if [[ "$VERBOSE" == "true" ]]; then
2178
+ echo "$url_hits" | head -5
2179
+ fi
2180
+ else
2181
+ log_pass "AGN-001: No business-specific URLs found"
2182
+ fi
2183
+
2184
+ # 2. Check for personal names in team section of config.yaml
2185
+ local team_names=""
2186
+ team_names=$(awk '
2187
+ BEGIN { in_team=0 }
2188
+ /^team:/ { in_team=1; next }
2189
+ in_team && /^[^[:space:]]/ { in_team=0 }
2190
+ in_team && /owner:|reviewer|lead:/ {
2191
+ gsub(/^[[:space:]]*[a-z_]+:[[:space:]]*/, "", $0)
2192
+ gsub(/["'\'']/, "", $0)
2193
+ gsub(/[[:space:]]+$/, "", $0)
2194
+ if ($0 != "" && $0 !~ /^@/ && $0 !~ /^(TBD|tbd|none|N\/A)$/) print $0
2195
+ }
2196
+ ' "$SQUAD_DIR/config.yaml" 2>/dev/null || true)
2197
+ if [[ -n "$team_names" ]]; then
2198
+ local name_count
2199
+ name_count=$(echo "$team_names" | wc -l | tr -d ' ')
2200
+ log_warn "AGN-002: Found $name_count personal names in team section (squads should be agnostic)"
2201
+ agn_violations=$((agn_violations + name_count))
2202
+ agn_details="${agn_details}AGN-002: $name_count personal names in team section\n"
2203
+ else
2204
+ log_pass "AGN-002: No personal names in team section"
2205
+ fi
2206
+
2207
+ # 3. Check for hardcoded project/account IDs
2208
+ local id_hits=""
2209
+ id_hits=$(grep -rInE \
2210
+ --include="*.yaml" --include="*.yml" \
2211
+ "${agn_exclude_args[@]}" \
2212
+ "(project_id|account_id|client_id|tenant_id)[[:space:]]*:[[:space:]]*['\"]?[A-Za-z0-9_-]{6,}" "$SQUAD_DIR" \
2213
+ 2>/dev/null \
2214
+ | grep -vE "(\{\{|\\\$\{|<|placeholder|example|YOUR_)" \
2215
+ || true)
2216
+ if [[ -n "$id_hits" ]]; then
2217
+ local id_count
2218
+ id_count=$(echo "$id_hits" | wc -l | tr -d ' ')
2219
+ log_warn "AGN-003: Found $id_count hardcoded project/account IDs"
2220
+ agn_violations=$((agn_violations + id_count))
2221
+ agn_details="${agn_details}AGN-003: $id_count hardcoded IDs\n"
2222
+ else
2223
+ log_pass "AGN-003: No hardcoded project/account IDs"
2224
+ fi
2225
+
2226
+ # 4. Check for business-specific pricing, product names in non-data files
2227
+ local biz_hits=""
2228
+ biz_hits=$(grep -rInE \
2229
+ --include="*.yaml" --include="*.yml" --include="*.md" \
2230
+ "${agn_exclude_args[@]}" \
2231
+ --exclude-dir=examples --exclude-dir=sources --exclude-dir=data \
2232
+ "(R\\\$[[:space:]]*[0-9]+|US\\\$[[:space:]]*[0-9]+|\\$[0-9]{2,}[.,][0-9]{2})" "$SQUAD_DIR" \
2233
+ 2>/dev/null \
2234
+ | grep -vE "(example|template|placeholder|mock|sample|docs/)" \
2235
+ || true)
2236
+ if [[ -n "$biz_hits" ]]; then
2237
+ local biz_count
2238
+ biz_count=$(echo "$biz_hits" | wc -l | tr -d ' ')
2239
+ log_warn "AGN-004: Found $biz_count potential business-specific pricing references"
2240
+ agn_violations=$((agn_violations + biz_count))
2241
+ agn_details="${agn_details}AGN-004: $biz_count pricing references\n"
2242
+ else
2243
+ log_pass "AGN-004: No business-specific pricing"
2244
+ fi
2245
+
2246
+ M_AGNOSTICISM_VIOLATIONS=$agn_violations
2247
+ M_AGNOSTICISM_DETAILS="$agn_details"
2248
+
2249
+ if [[ $agn_violations -gt 0 ]]; then
2250
+ echo -e "\n${YELLOW}⚠️ AGNOSTICISM: $agn_violations violations found${NC}"
2251
+ else
2252
+ echo -e "\n${GREEN}✓ Squad agnosticism check passed${NC}"
2253
+ fi
2254
+ }
2255
+
2256
+ # ═══════════════════════════════════════════════════════════════════════════════
2257
+ # PHASE 3: CROSS-REFERENCE (Deterministic - Bash)
2258
+ # ═══════════════════════════════════════════════════════════════════════════════
2259
+
2260
+ check_cross_references() {
2261
+ log_section "PHASE 3: Cross-Reference Validation (Bash)"
2262
+ local xref_fail=0
2263
+
2264
+ log_subsection "3.1 Handoff Targets"
2265
+
2266
+ if [[ -d "$SQUAD_DIR/agents" ]]; then
2267
+ for agent_file in "$SQUAD_DIR/agents"/*.md; do
2268
+ [[ -f "$agent_file" ]] || continue
2269
+ local handoffs=$(grep -oE "handoff_to:[[:space:]]*@?[a-z0-9_-]+" "$agent_file" 2>/dev/null | sed 's/handoff_to:[[:space:]]*@*//' || true)
2270
+ for handoff in $handoffs; do
2271
+ if ! asset_exists "agents" "${handoff}.md"; then
2272
+ log_fail "XREF-001: Handoff target not found: $handoff (in $(basename "$agent_file"))"
2273
+ xref_fail=$((xref_fail + 1))
2274
+ else
2275
+ log_pass "XREF-001: Handoff valid: $handoff"
2276
+ fi
2277
+ done
2278
+ done
2279
+ fi
2280
+
2281
+ log_subsection "3.2 Task References"
2282
+ # Check structured task dependencies in agent files
2283
+ if [[ -d "$SQUAD_DIR/agents" ]]; then
2284
+ for agent_file in "$SQUAD_DIR/agents"/*.md; do
2285
+ [[ -f "$agent_file" ]] || continue
2286
+ local in_tasks=0
2287
+ while IFS= read -r line; do
2288
+ if echo "$line" | grep -qE "^[[:space:]]*tasks:[[:space:]]*$"; then
2289
+ in_tasks=1
2290
+ continue
2291
+ fi
2292
+ if echo "$line" | grep -qE "^[[:space:]]*(templates|checklists|data|workflows|agents):[[:space:]]*$"; then
2293
+ in_tasks=0
2294
+ continue
2295
+ fi
2296
+ if [[ "$in_tasks" -eq 1 ]]; then
2297
+ if [[ "$line" =~ ^[[:space:]]*-[[:space:]]+([a-z0-9_-]+)\.md ]]; then
2298
+ local task_ref="${BASH_REMATCH[1]}"
2299
+ if [[ -n "$CONFIG_TASK_IDS" ]]; then
2300
+ if ! echo "$CONFIG_TASK_IDS" | grep -qx "$task_ref"; then
2301
+ continue
2302
+ fi
2303
+ fi
2304
+ if asset_exists "tasks" "${task_ref}.md"; then
2305
+ log_pass "XREF-002: Task exists: $task_ref"
2306
+ else
2307
+ log_warn "XREF-002: Task dependency reference not found: $task_ref (in $(basename "$agent_file"))"
2308
+ fi
2309
+ fi
2310
+ fi
2311
+ done < "$agent_file"
2312
+ done
2313
+ fi
2314
+
2315
+ XREF_FAIL=$xref_fail
2316
+ M_XREF_ISSUES=$xref_fail
2317
+
2318
+ if [[ $xref_fail -gt 0 ]]; then
2319
+ echo -e "\n${RED}⚠️ CROSS-REF: $xref_fail broken references${NC}"
2320
+ else
2321
+ echo -e "\n${GREEN}✓ Cross-references valid${NC}"
2322
+ fi
2323
+ }
2324
+
2325
+ # ═══════════════════════════════════════════════════════════════════════════════
2326
+ # PHASE 3.5: WORKFLOW CONTRACTS (Deterministic - CI parity)
2327
+ # ═══════════════════════════════════════════════════════════════════════════════
2328
+
2329
+ check_workflow_contracts() {
2330
+ log_section "PHASE 3.5: Workflow Contract Validation (CI parity)"
2331
+ local workflow_fail=0
2332
+
2333
+ if [[ ! -d "$SQUAD_DIR/workflows" ]]; then
2334
+ log_info "No workflows/ directory, skipping workflow contract validation"
2335
+ WF_CONTRACT_FAIL=0
2336
+ M_WORKFLOW_CONTRACT_FILES=0
2337
+ M_WORKFLOW_CONTRACT_ERRORS=0
2338
+ M_WORKFLOW_CONTRACT_WARNINGS=0
2339
+ return 0
2340
+ fi
2341
+
2342
+ local workflow_files=0
2343
+ workflow_files=$(find "$SQUAD_DIR/workflows" -maxdepth 1 -type f \( -name "*.yaml" -o -name "*.yml" \) 2>/dev/null | wc -l | tr -d ' ')
2344
+
2345
+ if [[ "$workflow_files" -eq 0 ]]; then
2346
+ log_info "No workflow files found in workflows/, skipping workflow contract validation"
2347
+ WF_CONTRACT_FAIL=0
2348
+ M_WORKFLOW_CONTRACT_FILES=0
2349
+ M_WORKFLOW_CONTRACT_ERRORS=0
2350
+ M_WORKFLOW_CONTRACT_WARNINGS=0
2351
+ return 0
2352
+ fi
2353
+
2354
+ local contract_output=""
2355
+ if contract_output=$(node "$WORKFLOW_CONTRACT_VALIDATOR" --squads "$SQUAD_NAME" --strict --fail-on-warnings --json 2>&1); then
2356
+ :
2357
+ else
2358
+ workflow_fail=1
2359
+ fi
2360
+
2361
+ local files_checked=0
2362
+ local errors_count=0
2363
+ local warnings_count=0
2364
+ local invalid_files_count=0
2365
+ while IFS=$'\t' read -r key value; do
2366
+ case "$key" in
2367
+ files_checked) files_checked="$value" ;;
2368
+ errors) errors_count="$value" ;;
2369
+ warnings) warnings_count="$value" ;;
2370
+ invalid_files) invalid_files_count="$value" ;;
2371
+ esac
2372
+ done < <(printf "%s" "$contract_output" | parse_workflow_contract_totals)
2373
+
2374
+ M_WORKFLOW_CONTRACT_FILES="$files_checked"
2375
+ M_WORKFLOW_CONTRACT_ERRORS="$errors_count"
2376
+ M_WORKFLOW_CONTRACT_WARNINGS="$warnings_count"
2377
+
2378
+ if [[ "$workflow_fail" -eq 0 ]]; then
2379
+ log_pass "WF-001: Workflow contracts valid (files=$files_checked, errors=$errors_count, warnings=$warnings_count)"
2380
+ else
2381
+ log_fail "WF-001: Workflow contract validation failed (files=$files_checked, errors=$errors_count, warnings=$warnings_count, invalid=$invalid_files_count)"
2382
+ if [[ "$VERBOSE" == "true" ]]; then
2383
+ echo "$contract_output"
2384
+ fi
2385
+ fi
2386
+
2387
+ WF_CONTRACT_FAIL="$workflow_fail"
2388
+ }
2389
+
2390
+ # ═══════════════════════════════════════════════════════════════════════════════
2391
+ # PHASE 4: SQUAD TYPE DETECTION (Deterministic - Bash)
2392
+ # ═══════════════════════════════════════════════════════════════════════════════
2393
+
2394
+ detect_squad_type() {
2395
+ log_section "PHASE 4: Squad Type Detection (Bash)"
2396
+
2397
+ local type="general"
2398
+ local confidence=5
2399
+
2400
+ # Check for Expert indicators
2401
+ local has_voice_dna=$(find "$SQUAD_DIR" -name "*voice*" -o -name "*dna*" 2>/dev/null | wc -l | tr -d ' ')
2402
+ local has_clone=$(grep -ril "clone\|emulat\|mind\|persona" "$SQUAD_DIR/agents" 2>/dev/null | wc -l | tr -d ' ')
2403
+
2404
+ # Check for Pipeline indicators
2405
+ local has_workflow=$(find "$SQUAD_DIR" -path "*/workflows/*.yaml" 2>/dev/null | wc -l | tr -d ' ')
2406
+ local has_phases=$(grep -ril "phase\|stage\|step" "$SQUAD_DIR/tasks" 2>/dev/null | wc -l | tr -d ' ')
2407
+
2408
+ # Calculate task ratio
2409
+ local agent_count=${M_AGENT_COUNT:-1}
2410
+ [[ $agent_count -eq 0 ]] && agent_count=1
2411
+ local task_ratio=$((M_TASK_COUNT / agent_count))
2412
+
2413
+ # Check for Hybrid indicators
2414
+ local has_human_exec=$(grep -ril "human\|manual\|executor" "$SQUAD_DIR" 2>/dev/null | wc -l | tr -d ' ')
2415
+
2416
+ # Scoring
2417
+ local expert_score=0
2418
+ local pipeline_score=0
2419
+ local hybrid_score=0
2420
+
2421
+ [[ $has_voice_dna -gt 0 ]] && expert_score=$((expert_score + 3))
2422
+ [[ $has_clone -gt 2 ]] && expert_score=$((expert_score + 2))
2423
+
2424
+ [[ $has_workflow -gt 0 ]] && pipeline_score=$((pipeline_score + 3))
2425
+ [[ $has_phases -gt 3 ]] && pipeline_score=$((pipeline_score + 2))
2426
+ [[ $task_ratio -gt 3 ]] && pipeline_score=$((pipeline_score + 2))
2427
+
2428
+ [[ $has_human_exec -gt 2 ]] && hybrid_score=$((hybrid_score + 3))
2429
+
2430
+ # Determine type
2431
+ if [[ $expert_score -ge 4 ]]; then
2432
+ type="expert"
2433
+ confidence=$expert_score
2434
+ elif [[ $pipeline_score -ge 4 ]]; then
2435
+ type="pipeline"
2436
+ confidence=$pipeline_score
2437
+ elif [[ $hybrid_score -ge 3 ]]; then
2438
+ type="hybrid"
2439
+ confidence=$hybrid_score
2440
+ fi
2441
+
2442
+ M_SQUAD_TYPE="$type"
2443
+ M_TYPE_CONFIDENCE="$confidence"
2444
+
2445
+ log_info "Detected type: $type (confidence: $confidence)"
2446
+ log_info "Expert signals: voice_dna=$has_voice_dna, clone_refs=$has_clone"
2447
+ log_info "Pipeline signals: workflows=$has_workflow, phases=$has_phases, task_ratio=$task_ratio"
2448
+ log_info "Hybrid signals: human_exec=$has_human_exec"
2449
+
2450
+ echo -e "\n${CYAN}Squad Type: ${BOLD}$type${NC} (confidence: $confidence/7)"
2451
+ }
2452
+
2453
+ # ═══════════════════════════════════════════════════════════════════════════════
2454
+ # PHASE 3.7: OUTPUT PATH GOVERNANCE (Deterministic - Bash)
2455
+ # ═══════════════════════════════════════════════════════════════════════════════
2456
+
2457
+ check_output_path_governance() {
2458
+ log_section "PHASE 3.7: Output Path Governance (Bash)"
2459
+ # ═══════════════════════════════════════════════════════════════════════════
2460
+ # Applies Pedro Valerio heuristics:
2461
+ # PV004: "Se o executor CONSEGUE fazer errado, processo esta errado"
2462
+ # → BLOCK contradictions, dont just warn
2463
+ # PV008: "Automacao sem guardrails nao pode rodar"
2464
+ # → 3 guardrails: declaration check, signal check, integration check
2465
+ # Hierarchy: Bloquear > Alertar > Documentar
2466
+ #
2467
+ # 3 checks, escalating severity:
2468
+ # OPG-001 (BLOCKING): Task declares canonical_workspace but path is .aiox/squad-runtime/
2469
+ # OPG-002 (BLOCKING): Squad declares workspace integration but 0 tasks use workspace/
2470
+ # OPG-003 (WARNING): Task has HIGH-VALUE signals + runtime path (heuristic)
2471
+ # ═══════════════════════════════════════════════════════════════════════════
2472
+ local opg_fail=0
2473
+ local opg_warnings=0
2474
+
2475
+ if [[ ! -d "$SQUAD_DIR/tasks" ]]; then
2476
+ log_info "No tasks/ directory, skipping output path governance"
2477
+ return
2478
+ fi
2479
+
2480
+ # ─── GUARDRAIL 1: Declaration contradiction (BLOCKING - PV004) ───
2481
+ # If task explicitly declares output_persistence: canonical_workspace
2482
+ # but path points to .aiox/squad-runtime/, this is a structural contradiction.
2483
+ # "Se o caminho errado e possivel, o processo esta errado."
2484
+ for task_file in "$SQUAD_DIR/tasks"/*.md; do
2485
+ [[ -f "$task_file" ]] || continue
2486
+ local task_name=$(basename "$task_file")
2487
+
2488
+ # Check if task declares canonical_workspace
2489
+ local declares_canonical=$(grep -iE "output_persistence.*canonical_workspace|persistence.*canonical" "$task_file" 2>/dev/null || true)
2490
+ local has_runtime_path=$(grep -iE "path:.*\\.aiox/squad-runtime/" "$task_file" 2>/dev/null || true)
2491
+
2492
+ if [[ -n "$declares_canonical" && -n "$has_runtime_path" ]]; then
2493
+ log_fail "OPG-001: Task $task_name declares output_persistence=canonical_workspace but path uses .aiox/squad-runtime/. PV004 VETO: structural contradiction. Fix path to workspace/businesses/{business}/"
2494
+ opg_fail=$((opg_fail + 1))
2495
+ fi
2496
+
2497
+ # Inverse check: declares transient but path is workspace/
2498
+ local declares_transient=$(grep -iE "output_persistence.*transient_output|persistence.*transient" "$task_file" 2>/dev/null || true)
2499
+ local has_workspace_path=$(grep -iE "path:.*workspace/businesses" "$task_file" 2>/dev/null || true)
2500
+
2501
+ if [[ -n "$declares_transient" && -n "$has_workspace_path" ]]; then
2502
+ log_warn "OPG-001b: Task $task_name declares output_persistence=transient_output but path uses workspace/. Verify classification."
2503
+ opg_warnings=$((opg_warnings + 1))
2504
+ fi
2505
+ done
2506
+
2507
+ # ─── GUARDRAIL 2: Integration level contradiction (BLOCKING - PV004) ───
2508
+ # If config.yaml declares controlled_runtime_consumer or workspace_first
2509
+ # but ALL tasks output to .aiox/squad-runtime/ and ZERO to workspace/, the squad
2510
+ # contradicts its own declared integration level.
2511
+ if [[ -f "$SQUAD_DIR/config.yaml" ]]; then
2512
+ local ws_level=$(grep -E "^\s+level:" "$SQUAD_DIR/config.yaml" 2>/dev/null | head -1 | sed 's/.*level:[[:space:]]*//' | tr -d '"' || true)
2513
+ if [[ "$ws_level" == "controlled_runtime_consumer" || "$ws_level" == "workspace_first" ]]; then
2514
+ local tasks_using_workspace=$(grep -rlE "path:.*workspace/" "$SQUAD_DIR/tasks/" 2>/dev/null | wc -l | tr -d ' ')
2515
+ local tasks_using_runtime=$(grep -rlE "path:.*\\.aiox/squad-runtime/" "$SQUAD_DIR/tasks/" 2>/dev/null | wc -l | tr -d ' ')
2516
+
2517
+ if [[ "$tasks_using_runtime" -gt 0 && "$tasks_using_workspace" -eq 0 ]]; then
2518
+ log_fail "OPG-002: Squad declares workspace_integration.level=$ws_level but ALL task outputs ($tasks_using_runtime) go to .aiox/squad-runtime/, ZERO to workspace/. PV004 VETO: integration level contradicts task paths."
2519
+ opg_fail=$((opg_fail + 1))
2520
+ fi
2521
+ fi
2522
+ fi
2523
+
2524
+ # ─── GUARDRAIL 3: HIGH-VALUE signal heuristic (WARNING) ───
2525
+ # Heuristic fallback for tasks that dont declare output_persistence.
2526
+ # If task outputs to .aiox/squad-runtime/ AND contains HIGH-VALUE signal words,
2527
+ # flag for human review. This is Alertar (not Bloquear) because
2528
+ # the signal is probabilistic, not deterministic.
2529
+ local high_value_signals="score|maturity|health|onboarding|analytics|kpi|scorecard|diagnosis|assessment|strategy|retention|churn|nps|journey|activation"
2530
+
2531
+ for task_file in "$SQUAD_DIR/tasks"/*.md; do
2532
+ [[ -f "$task_file" ]] || continue
2533
+ local task_name=$(basename "$task_file")
2534
+
2535
+ local has_runtime_path=$(grep -iE "path:.*\\.aiox/squad-runtime/" "$task_file" 2>/dev/null || true)
2536
+ if [[ -z "$has_runtime_path" ]]; then
2537
+ continue
2538
+ fi
2539
+
2540
+ # Skip if already caught by GUARDRAIL 1 (has explicit declaration)
2541
+ local has_declaration=$(grep -iE "output_persistence" "$task_file" 2>/dev/null || true)
2542
+ if [[ -n "$has_declaration" ]]; then
2543
+ continue
2544
+ fi
2545
+
2546
+ # No declaration, check signal words
2547
+ if grep -qiE "$high_value_signals" "$task_file" 2>/dev/null; then
2548
+ log_warn "OPG-003: Task $task_name has output path in .aiox/squad-runtime/ with HIGH-VALUE signal words but no output_persistence declaration. Classify as canonical_workspace or transient_output."
2549
+ opg_warnings=$((opg_warnings + 1))
2550
+ fi
2551
+ done
2552
+
2553
+ M_OPG_WARNINGS=$((opg_warnings + opg_fail))
2554
+
2555
+ if [[ $opg_fail -gt 0 ]]; then
2556
+ echo -e "\n${RED}✗ Output Path Governance: $opg_fail BLOCKING violations, $opg_warnings warnings${NC}"
2557
+ elif [[ $opg_warnings -gt 0 ]]; then
2558
+ echo -e "\n${YELLOW}⚠️ Output Path Governance: $opg_warnings warnings (no blocking)${NC}"
2559
+ else
2560
+ echo -e "\n${GREEN}✓ Output path governance passed${NC}"
2561
+ fi
2562
+ }
2563
+
2564
+ # ═══════════════════════════════════════════════════════════════════════════════
2565
+ # PHASE 5: PRODUCTION VALIDATION (Deterministic - Bash)
2566
+ # ═══════════════════════════════════════════════════════════════════════════════
2567
+
2568
+ check_production() {
2569
+ log_section "PHASE 5: Production Validation (Bash)"
2570
+ local prod_score=0
2571
+ local manifest_type=""
2572
+ local workspace_level=""
2573
+ local runtime_evidence_optional=false
2574
+ local contract_test_files=0
2575
+ local operational_story_files=0
2576
+
2577
+ manifest_type=$(extract_config_scalar "type")
2578
+ workspace_level=$(extract_workspace_integration_level)
2579
+ contract_test_files=$(count_contract_test_files 2>/dev/null || echo 0)
2580
+ operational_story_files=$(count_operational_story_files 2>/dev/null || echo 0)
2581
+
2582
+ if [[ "$manifest_type" == "specialist" && "$workspace_level" == "none" ]]; then
2583
+ runtime_evidence_optional=true
2584
+ fi
2585
+
2586
+ log_subsection "5.1 Runtime Evidence"
2587
+ # Canonical runtime evidence, when applicable, must live in .aiox/squad-runtime
2588
+ local has_runtime_evidence=false
2589
+ local runtime_root="${AIOX_RUNTIME_ROOT:-./.aiox/squad-runtime}"
2590
+ if [ -d "$runtime_root" ]; then
2591
+ local squad_runtime_dir
2592
+ squad_runtime_dir=$(find "$runtime_root" -maxdepth 3 -type d -name "$SQUAD_NAME" 2>/dev/null | head -1)
2593
+ if [ -n "$squad_runtime_dir" ] && [ -d "$squad_runtime_dir" ]; then
2594
+ local output_count
2595
+ output_count=$(find "$squad_runtime_dir" -type f 2>/dev/null | wc -l | tr -d ' ')
2596
+ if [ "$output_count" -gt 0 ]; then
2597
+ log_pass "Found runtime evidence in .aiox/squad-runtime ($output_count files)"
2598
+ has_runtime_evidence=true
2599
+ prod_score=$((prod_score + 2))
2600
+ else
2601
+ log_warn "Runtime directory exists but has no files: $squad_runtime_dir"
2602
+ fi
2603
+ fi
2604
+ fi
2605
+
2606
+ if [ "$has_runtime_evidence" = false ]; then
2607
+ if [ "$runtime_evidence_optional" = true ]; then
2608
+ log_info "Runtime evidence optional for type='$manifest_type' with workspace_integration.level='$workspace_level'"
2609
+ else
2610
+ log_warn "No runtime evidence found in .aiox/squad-runtime for squad '$SQUAD_NAME'"
2611
+ fi
2612
+ fi
2613
+
2614
+ log_subsection "5.2 Tested Flag"
2615
+ # Check for tested: true in config.yaml or infer from runtime, declared outputs,
2616
+ # or contract-test evidence for non-runtime specialist squads.
2617
+ if grep -qE "^tested:[[:space:]]*(true|yes)" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
2618
+ log_pass "config.yaml has tested: true"
2619
+ prod_score=$((prod_score + 1))
2620
+ else
2621
+ local inferred_tested=false
2622
+ local declared_output_files=0
2623
+
2624
+ if [ "$has_runtime_evidence" = true ]; then
2625
+ log_pass "config.yaml missing tested flag, but runtime evidence is sufficient to infer tested status"
2626
+ inferred_tested=true
2627
+ else
2628
+ declared_output_files=$(count_declared_output_files 2>/dev/null || echo 0)
2629
+ if [[ "$declared_output_files" -gt 0 ]]; then
2630
+ log_pass "config.yaml missing tested flag, but declared output path contains evidence ($declared_output_files files)"
2631
+ inferred_tested=true
2632
+ elif [[ "$contract_test_files" -gt 0 ]]; then
2633
+ log_pass "config.yaml missing tested flag, but contract/runtime test coverage exists ($contract_test_files files)"
2634
+ inferred_tested=true
2635
+ fi
2636
+ fi
2637
+
2638
+ if [ "$inferred_tested" = true ]; then
2639
+ prod_score=$((prod_score + 1))
2640
+ else
2641
+ log_warn "config.yaml missing 'tested: true' flag and no runtime, output, or test evidence was found to infer it"
2642
+ fi
2643
+ fi
2644
+
2645
+ log_subsection "5.3 Usage Evidence"
2646
+ # YOLO evidence is only required when config declares settings.activation.yolo_required=true.
2647
+ local yolo_required=false
2648
+ if grep -qE '^[[:space:]]*yolo_required:[[:space:]]*(true|yes|1)[[:space:]]*$' "$SQUAD_DIR/config.yaml" 2>/dev/null; then
2649
+ yolo_required=true
2650
+ fi
2651
+
2652
+ if [ "$yolo_required" = true ]; then
2653
+ local state_files
2654
+ state_files=$(find "$SQUAD_DIR" -name "*-state.json" -o -name "progress.txt" -o -name "handoff.md" 2>/dev/null | wc -l | tr -d ' ')
2655
+ if [ "$state_files" -gt 0 ]; then
2656
+ # Verify it's real usage, not just template files
2657
+ local real_state
2658
+ real_state=$(find "$SQUAD_DIR" -name "*-state.json" -exec grep -l '"status"' {} \; 2>/dev/null | wc -l | tr -d ' ')
2659
+ if [ "$real_state" -gt 0 ]; then
2660
+ log_pass "Found $real_state state files with execution history (YOLO mode required)"
2661
+ prod_score=$((prod_score + 1))
2662
+ else
2663
+ log_warn "YOLO required but state files found appear to be templates"
2664
+ fi
2665
+ else
2666
+ log_warn "YOLO required but no state files found (add *-state.json/progress evidence)"
2667
+ fi
2668
+ else
2669
+ log_info "YOLO mode evidence not required (settings.activation.yolo_required=false)"
2670
+ fi
2671
+
2672
+ # Check for user feedback or validation reports
2673
+ local feedback_files=$(find "$SQUAD_DIR" -name "*feedback*" -o -name "*validation-report*" -o -name "*qa-report*" 2>/dev/null | wc -l | tr -d ' ')
2674
+ if [ "$feedback_files" -gt 0 ]; then
2675
+ log_pass "Found $feedback_files feedback/validation files"
2676
+ prod_score=$((prod_score + 1))
2677
+ else
2678
+ local output_usage_files=0
2679
+ output_usage_files=$(count_usage_evidence_output_files 2>/dev/null || echo 0)
2680
+ if [ "$output_usage_files" -gt 0 ]; then
2681
+ log_pass "Found $output_usage_files canonical output artifact(s) in declared output root"
2682
+ prod_score=$((prod_score + 1))
2683
+ fi
2684
+ fi
2685
+
2686
+ log_subsection "5.4 Examples & Operational Evidence"
2687
+ # Check for operational examples in docs, templates, or validation stories.
2688
+ local has_examples=false
2689
+ if [ -d "$SQUAD_DIR/examples" ] || [ -d "$SQUAD_DIR/samples" ]; then
2690
+ log_pass "examples/ or samples/ directory exists"
2691
+ has_examples=true
2692
+ prod_score=$((prod_score + 1))
2693
+ fi
2694
+
2695
+ # Check for output_examples in agents
2696
+ local output_examples=$(grep -rl "output_examples\|example_output\|sample_output" "$SQUAD_DIR/agents" 2>/dev/null | wc -l | tr -d ' ')
2697
+ if [ "$output_examples" -gt 0 ]; then
2698
+ log_pass "Found output examples in $output_examples agent files"
2699
+ if [ "$has_examples" = false ]; then
2700
+ prod_score=$((prod_score + 1))
2701
+ fi
2702
+ has_examples=true
2703
+ fi
2704
+
2705
+ if [ "$has_examples" = false ] && [ "$operational_story_files" -gt 0 ]; then
2706
+ log_pass "Found $operational_story_files operational docs/stories for squad '$SQUAD_NAME'"
2707
+ has_examples=true
2708
+ prod_score=$((prod_score + 1))
2709
+ fi
2710
+
2711
+ if [ "$has_examples" = false ]; then
2712
+ log_warn "No operational examples found (examples/, samples/, output_examples, or relevant docs/stories)"
2713
+ fi
2714
+
2715
+ # Cap at max
2716
+ if [ $prod_score -gt $PROD_MAX ]; then
2717
+ prod_score=$PROD_MAX
2718
+ fi
2719
+
2720
+ PROD_SCORE=$prod_score
2721
+ M_PROD_SCORE=$prod_score
2722
+
2723
+ echo ""
2724
+ if [ $prod_score -eq 0 ]; then
2725
+ echo -e "${RED}⚠️ PRODUCTION: 0/$PROD_MAX - No evidence of real usage${NC}"
2726
+ echo -e "${YELLOW} Max possible score without production evidence: 5/10${NC}"
2727
+ elif [ $prod_score -lt 3 ]; then
2728
+ echo -e "${YELLOW}⚠️ PRODUCTION: $prod_score/$PROD_MAX - Limited production evidence${NC}"
2729
+ else
2730
+ echo -e "${GREEN}✓ Production validation: $prod_score/$PROD_MAX${NC}"
2731
+ fi
2732
+ }
2733
+
2734
+ # ═══════════════════════════════════════════════════════════════════════════════
2735
+ # PHASE 6: QUALITY ANALYSIS (Claude CLI)
2736
+ # ═══════════════════════════════════════════════════════════════════════════════
2737
+
2738
+ analyze_with_claude() {
2739
+ log_section "$(t phase6_title)"
2740
+
2741
+ if [[ "$QUICK_MODE" == "true" ]]; then
2742
+ echo -e "${YELLOW}$(t phase6_skip)${NC}"
2743
+ M_QUALITY_SCORE="N/A"
2744
+ return 0
2745
+ fi
2746
+
2747
+ echo -e "${MAGENTA}$(fmt_t phase6_running "$MODEL_QUALITY")${NC}"
2748
+
2749
+ # Read FULL config.yaml (highest priority)
2750
+ local config_content=""
2751
+ [[ -f "$SQUAD_DIR/config.yaml" ]] && config_content=$(cat "$SQUAD_DIR/config.yaml" 2>/dev/null || true)
2752
+
2753
+ # Read FULL entry agent
2754
+ local agent_content=""
2755
+ local sample_agent=""
2756
+ if [[ -n "${ENTRY_AGENT:-}" ]]; then
2757
+ if [[ -f "$SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
2758
+ sample_agent="$SQUAD_DIR/agents/${ENTRY_AGENT}.md"
2759
+ elif [[ -n "$INHERITED_SQUAD_DIR" ]] && [[ -f "$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md" ]]; then
2760
+ sample_agent="$INHERITED_SQUAD_DIR/agents/${ENTRY_AGENT}.md"
2761
+ fi
2762
+ fi
2763
+ if [[ -z "$sample_agent" ]]; then
2764
+ sample_agent=$(find "$SQUAD_DIR/agents" -name "*.md" 2>/dev/null | head -1)
2765
+ fi
2766
+ [[ -f "$sample_agent" ]] && agent_content=$(cat "$sample_agent" 2>/dev/null || true)
2767
+
2768
+ # Read FULL first workflow
2769
+ local workflow_content=""
2770
+ local sample_workflow
2771
+ sample_workflow=$(find "$SQUAD_DIR/workflows" -name "*.yaml" -o -name "*.yml" 2>/dev/null | head -1)
2772
+ [[ -f "$sample_workflow" ]] && workflow_content=$(cat "$sample_workflow" 2>/dev/null || true)
2773
+
2774
+ # Truncation safety: if config + agent > 15000 chars, truncate agent (config has priority)
2775
+ local config_len=${#config_content}
2776
+ local agent_len=${#agent_content}
2777
+ local workflow_len=${#workflow_content}
2778
+ local max_content=15000
2779
+
2780
+ if [[ $((config_len + agent_len + workflow_len)) -gt $max_content ]]; then
2781
+ # Config always full; split remaining between agent and workflow
2782
+ local remaining=$((max_content - config_len))
2783
+ if [[ $remaining -lt 1000 ]]; then
2784
+ remaining=1000
2785
+ fi
2786
+ local agent_max=$((remaining * 70 / 100))
2787
+ local wf_max=$((remaining * 30 / 100))
2788
+ if [[ $agent_len -gt $agent_max ]]; then
2789
+ agent_content="${agent_content:0:$agent_max}
2790
+
2791
+ ... [TRUNCATED at $agent_max chars — full file: $(basename "$sample_agent")] ..."
2792
+ fi
2793
+ if [[ $workflow_len -gt $wf_max ]]; then
2794
+ workflow_content="${workflow_content:0:$wf_max}
2795
+
2796
+ ... [TRUNCATED at $wf_max chars] ..."
2797
+ fi
2798
+ fi
2799
+
2800
+ # Build findings summary from previous phases
2801
+ local findings_summary="## Previous Phase Findings
2802
+
2803
+ ### Structure (Phase 1)
2804
+ - TIER1 failures: $TIER1_FAIL
2805
+ - Mandatory structural checks: $M_STRUCT_COMPLETENESS_PASS/$M_STRUCT_COMPLETENESS_TOTAL
2806
+ - Contextual lifecycle checks: $M_CONTEXTUAL_LIFECYCLE_PASS/$M_CONTEXTUAL_LIFECYCLE_TOTAL (warnings: $M_CONTEXTUAL_LIFECYCLE_WARNINGS)
2807
+ - Agent quality gaps (entry agent): $M_AGENT_QUALITY_GAPS/5
2808
+ - Version consistent: $M_VERSION_CONSISTENT${M_VERSION_DETAILS:+ ($M_VERSION_DETAILS)}
2809
+
2810
+ ### Security (Phase 2)
2811
+ - Security issues found: $SEC_FAIL
2812
+ $(if [[ -n "$BLOCKING_ISSUES" ]]; then echo "- Blocking issues detail:"; echo -e "$BLOCKING_ISSUES" | grep -E "SEC-" | while read -r line; do [[ -n "$line" ]] && echo " - $line"; done; fi)
2813
+
2814
+ ### Squad Agnosticism (Phase 2.5)
2815
+ - Agnosticism violations: $M_AGNOSTICISM_VIOLATIONS
2816
+ $(if [[ -n "$M_AGNOSTICISM_DETAILS" ]]; then echo -e "$M_AGNOSTICISM_DETAILS" | while read -r line; do [[ -n "$line" ]] && echo " - $line"; done; fi)
2817
+
2818
+ ### Cross-References (Phase 3)
2819
+ - Broken references: $XREF_FAIL
2820
+
2821
+ ### Workflow Contracts (Phase 3.5)
2822
+ - Files checked: $M_WORKFLOW_CONTRACT_FILES
2823
+ - Errors: $M_WORKFLOW_CONTRACT_ERRORS
2824
+ - Warnings: $M_WORKFLOW_CONTRACT_WARNINGS
2825
+
2826
+ ### Production (Phase 5)
2827
+ - Production score: $PROD_SCORE/$PROD_MAX"
2828
+
2829
+ # Build dimensional analysis prompt
2830
+ local ANALYSIS_PROMPT="You are a senior squad quality auditor for the AIOX framework. Perform a deep dimensional analysis.
2831
+
2832
+ IMPORTANT: Respond with ONLY valid JSON. No markdown, no explanation, no code fences.
2833
+ IMPORTANT: Keep the JSON keys exactly as requested below.
2834
+ IMPORTANT: Write every human-readable value in ${ANALYSIS_LANGUAGE_NAME}. This includes diagnosis, recommendation, detail, strengths, improvements, and priority_fixes.
2835
+ IMPORTANT: Do NOT localize the response to the end-user language. This JSON is the canonical internal analysis artifact.
2836
+
2837
+ ## Squad: $SQUAD_NAME
2838
+ Type: $M_SQUAD_TYPE (confidence: $M_TYPE_CONFIDENCE)
2839
+ Agents: $M_AGENT_COUNT | Tasks: $M_TASK_COUNT | Checklists: $M_CHECKLIST_COUNT | Lines: $M_TOTAL_LINES
2840
+
2841
+ $findings_summary
2842
+
2843
+ ## config.yaml (FULL):
2844
+ \`\`\`yaml
2845
+ $config_content
2846
+ \`\`\`
2847
+
2848
+ ## Entry Agent — $(basename "${sample_agent:-unknown}") (FULL):
2849
+ \`\`\`markdown
2850
+ $agent_content
2851
+ \`\`\`
2852
+
2853
+ ## First Workflow (FULL):
2854
+ \`\`\`yaml
2855
+ $workflow_content
2856
+ \`\`\`
2857
+
2858
+ ## Historical Calibration (prior run scores — justify if you diverge significantly)
2859
+ $(_get_historical_scores)
2860
+
2861
+ ## Analysis Instructions
2862
+
2863
+ Score each dimension 0-10. Be STRICT — a score of 7+ means production-ready quality.
2864
+
2865
+ For security findings (SEC-*), evaluate if they are FALSE_POSITIVE (e.g., book excerpts mentioning \"secret\", example patterns) or REAL threats.
2866
+
2867
+ For squad agnosticism, check if the squad contains business-specific data (company names, real pricing, personal names, specific product references) that should live in workspace/ instead.
2868
+
2869
+ ## Required JSON Response:
2870
+ {
2871
+ \"blocking_issues_analysis\": [
2872
+ {\"id\": \"SEC-002\", \"verdict\": \"FALSE_POSITIVE or REAL\", \"diagnosis\": \"why\", \"recommendation\": \"what to do\"}
2873
+ ],
2874
+ \"structural_completeness\": {
2875
+ \"score\": 5,
2876
+ \"items\": [{\"item\": \"tested flag\", \"status\": \"PASS or FAIL\", \"detail\": \"...\"}]
2877
+ },
2878
+ \"security_audit\": {
2879
+ \"score\": 8,
2880
+ \"false_positive_count\": 0,
2881
+ \"real_issue_count\": 0,
2882
+ \"checks\": [{\"id\": \"SEC-001\", \"status\": \"PASS or FALSE_POSITIVE or FAIL\", \"detail\": \"...\"}]
2883
+ },
2884
+ \"workflow_analysis\": {
2885
+ \"score\": 7,
2886
+ \"dimensions\": [{\"name\": \"coherence\", \"score\": 9, \"detail\": \"...\"}]
2887
+ },
2888
+ \"agent_quality\": {
2889
+ \"score\": 5,
2890
+ \"criteria\": [{\"name\": \"smoke_tests\", \"status\": \"PASS or PARTIAL or FAIL\", \"detail\": \"...\"}]
2891
+ },
2892
+ \"squad_agnosticism\": {
2893
+ \"score\": 8,
2894
+ \"violations\": [{\"item\": \"...\", \"detail\": \"...\"}]
2895
+ },
2896
+ \"config_quality\": {
2897
+ \"score\": 7,
2898
+ \"fields\": [{\"name\": \"distribution_contract\", \"status\": \"PASS or WARN or FAIL\"}]
2899
+ },
2900
+ \"production_evidence\": {
2901
+ \"score\": 6,
2902
+ \"signals\": [{\"name\": \"runtime_evidence\", \"status\": \"PASS or FAIL\", \"detail\": \"...\"}]
2903
+ },
2904
+ \"executive_summary\": {
2905
+ \"overall_score\": 5.8,
2906
+ \"verdict\": \"PASS or CONDITIONAL or FAIL\",
2907
+ \"priority_fixes\": [\"1. ...\", \"2. ...\", \"3. ...\"],
2908
+ \"strengths\": [\"...\"],
2909
+ \"improvements\": [\"...\"]
2910
+ }
2911
+ }"
2912
+
2913
+ # Run Claude — write prompt to temp file to avoid ARG_MAX / printf truncation
2914
+ local claude_output
2915
+ log_info "$(fmt_t phase6_prompt_written "${#ANALYSIS_PROMPT}")"
2916
+
2917
+ if claude_output=$(run_llm_prompt_with_replan "$MODEL_QUALITY" "$ANALYSIS_PROMPT" "${PROGRESS_LOG:-/dev/null}" "validate" 2>&1); then
2918
+ local json_result report_json_result
2919
+ json_result=$(printf "%s" "$claude_output" | extract_first_json_object)
2920
+
2921
+ # Store raw JSON for report generation
2922
+ CLAUDE_RAW_JSON="$json_result"
2923
+ report_json_result=$(localize_review_json_for_report "$json_result")
2924
+ CLAUDE_REPORT_JSON="$report_json_result"
2925
+
2926
+ # Extract dimensional scores via python for robustness
2927
+ # Returns empty string for missing dimensions (triggers deterministic fallback)
2928
+ local parsed_scores
2929
+ parsed_scores=$(extract_review_fields "$json_result")
2930
+
2931
+ # Parse dimensional scores
2932
+ while IFS=$'\t' read -r key value; do
2933
+ case "$key" in
2934
+ structural_completeness) CLAUDE_STRUCTURAL_COMPLETENESS="$value" ;;
2935
+ security_audit) CLAUDE_SECURITY_AUDIT="$value" ;;
2936
+ workflow_analysis) CLAUDE_WORKFLOW_ANALYSIS="$value" ;;
2937
+ agent_quality) CLAUDE_AGENT_QUALITY="$value" ;;
2938
+ squad_agnosticism) CLAUDE_SQUAD_AGNOSTICISM="$value" ;;
2939
+ config_quality) CLAUDE_CONFIG_QUALITY="$value" ;;
2940
+ production_evidence) CLAUDE_PRODUCTION_EVIDENCE="$value" ;;
2941
+ overall_score) M_QUALITY_SCORE="$value" ;;
2942
+ improvements_b64)
2943
+ M_IMPROVEMENTS=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "")' 2>/dev/null || printf '%s' "$value")
2944
+ M_IMPROVEMENTS_REPORT="$M_IMPROVEMENTS"
2945
+ ;;
2946
+ priority_fixes_b64)
2947
+ CLAUDE_EXEC_SUMMARY=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "")' 2>/dev/null || printf '%s' "$value")
2948
+ CLAUDE_EXEC_SUMMARY_REPORT="$CLAUDE_EXEC_SUMMARY"
2949
+ ;;
2950
+ false_positive_count)
2951
+ # Adjust SEC_FAIL by subtracting false positives
2952
+ local fp_count="${value%%.*}"
2953
+ if [[ "$fp_count" =~ ^[0-9]+$ ]] && [[ "$fp_count" -gt 0 ]]; then
2954
+ local adjusted=$((SEC_FAIL - fp_count))
2955
+ if [[ $adjusted -lt 0 ]]; then adjusted=0; fi
2956
+ if [[ "$REPORT_LANG_RESOLVED" == "pt-br" ]]; then
2957
+ echo -e " ${CYAN}ℹ${NC} Segurança: $fp_count falso(s) positivo(s) detectado(s) pelo reviewer, ajustando SEC_FAIL: $SEC_FAIL → $adjusted"
2958
+ else
2959
+ echo -e " ${CYAN}ℹ${NC} Security: $fp_count false positive(s) detected by reviewer, adjusting SEC_FAIL: $SEC_FAIL → $adjusted"
2960
+ fi
2961
+ SEC_FAIL=$adjusted
2962
+ fi
2963
+ ;;
2964
+ esac
2965
+ done <<< "$parsed_scores"
2966
+
2967
+ if [[ "$LOCALIZED_REPORT_AVAILABLE" == "true" ]] && [[ "$CLAUDE_REPORT_JSON" != "$CLAUDE_RAW_JSON" ]]; then
2968
+ local localized_fields
2969
+ localized_fields=$(extract_review_fields "$CLAUDE_REPORT_JSON")
2970
+ while IFS=$'\t' read -r key value; do
2971
+ case "$key" in
2972
+ improvements_b64)
2973
+ M_IMPROVEMENTS_REPORT=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "")' 2>/dev/null || printf '%s' "$value")
2974
+ ;;
2975
+ priority_fixes_b64)
2976
+ CLAUDE_EXEC_SUMMARY_REPORT=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "")' 2>/dev/null || printf '%s' "$value")
2977
+ ;;
2978
+ esac
2979
+ done <<< "$localized_fields"
2980
+ fi
2981
+
2982
+ if [[ "$VERBOSE" == "true" ]]; then
2983
+ echo -e "\n${CYAN}$(t phase6_result)${NC}"
2984
+ echo -e " $(fmt_t phase6_language_state "$ANALYSIS_LANG" "$REPORT_LANG_RESOLVED")"
2985
+ if [[ "$REPORT_LANG_RESOLVED" != "$ANALYSIS_LANG" ]] && [[ "$LOCALIZED_REPORT_AVAILABLE" != "true" ]]; then
2986
+ echo -e " ${YELLOW}$(t phase6_localization_fallback)${NC}"
2987
+ fi
2988
+ echo "$CLAUDE_REPORT_JSON" | python3 -m json.tool 2>/dev/null || echo "$CLAUDE_REPORT_JSON"
2989
+ fi
2990
+
2991
+ if ! is_numeric_score "${M_QUALITY_SCORE:-}"; then
2992
+ M_QUALITY_SCORE="N/A"
2993
+ if [[ "$REPORT_LANG_RESOLVED" == "pt-br" ]]; then
2994
+ echo -e "${YELLOW}⚠️ saída do reviewer sem overall_score parseável; usando fallback determinístico${NC}"
2995
+ else
2996
+ echo -e "${YELLOW}⚠️ reviewer output missing parseable overall_score; using deterministic fallback${NC}"
2997
+ fi
2998
+ else
2999
+ M_QUALITY_SCORE=$(clamp_score_0_10 "$M_QUALITY_SCORE")
3000
+ fi
3001
+
3002
+ echo -e "\n${GREEN}✓ $(t phase6_complete)${NC}"
3003
+ if [[ "$REPORT_LANG_RESOLVED" == "pt-br" ]]; then
3004
+ echo -e " Pontuações dimensionais:"
3005
+ [[ -n "$CLAUDE_STRUCTURAL_COMPLETENESS" ]] && echo -e " $(dimension_label structural_completeness): ${BOLD}${CLAUDE_STRUCTURAL_COMPLETENESS}/10${NC}"
3006
+ [[ -n "$CLAUDE_SECURITY_AUDIT" ]] && echo -e " Auditoria de Segurança: ${BOLD}${CLAUDE_SECURITY_AUDIT}/10${NC}"
3007
+ [[ -n "$CLAUDE_WORKFLOW_ANALYSIS" ]] && echo -e " Análise de Workflow: ${BOLD}${CLAUDE_WORKFLOW_ANALYSIS}/10${NC}"
3008
+ [[ -n "$CLAUDE_AGENT_QUALITY" ]] && echo -e " $(dimension_label agent_quality): ${BOLD}${CLAUDE_AGENT_QUALITY}/10${NC}"
3009
+ [[ -n "$CLAUDE_SQUAD_AGNOSTICISM" ]] && echo -e " $(dimension_label squad_agnosticism): ${BOLD}${CLAUDE_SQUAD_AGNOSTICISM}/10${NC}"
3010
+ [[ -n "$CLAUDE_CONFIG_QUALITY" ]] && echo -e " $(dimension_label config_quality): ${BOLD}${CLAUDE_CONFIG_QUALITY}/10${NC}"
3011
+ [[ -n "$CLAUDE_PRODUCTION_EVIDENCE" ]] && echo -e " $(dimension_label production_evidence): ${BOLD}${CLAUDE_PRODUCTION_EVIDENCE}/10${NC}"
3012
+ echo -e " Geral: ${BOLD}${M_QUALITY_SCORE}/10${NC}"
3013
+ else
3014
+ echo -e " Dimensional scores:"
3015
+ [[ -n "$CLAUDE_STRUCTURAL_COMPLETENESS" ]] && echo -e " $(dimension_label structural_completeness): ${BOLD}${CLAUDE_STRUCTURAL_COMPLETENESS}/10${NC}"
3016
+ [[ -n "$CLAUDE_SECURITY_AUDIT" ]] && echo -e " Security Audit: ${BOLD}${CLAUDE_SECURITY_AUDIT}/10${NC}"
3017
+ [[ -n "$CLAUDE_WORKFLOW_ANALYSIS" ]] && echo -e " Workflow Analysis: ${BOLD}${CLAUDE_WORKFLOW_ANALYSIS}/10${NC}"
3018
+ [[ -n "$CLAUDE_AGENT_QUALITY" ]] && echo -e " $(dimension_label agent_quality): ${BOLD}${CLAUDE_AGENT_QUALITY}/10${NC}"
3019
+ [[ -n "$CLAUDE_SQUAD_AGNOSTICISM" ]] && echo -e " $(dimension_label squad_agnosticism): ${BOLD}${CLAUDE_SQUAD_AGNOSTICISM}/10${NC}"
3020
+ [[ -n "$CLAUDE_CONFIG_QUALITY" ]] && echo -e " $(dimension_label config_quality): ${BOLD}${CLAUDE_CONFIG_QUALITY}/10${NC}"
3021
+ [[ -n "$CLAUDE_PRODUCTION_EVIDENCE" ]] && echo -e " $(dimension_label production_evidence): ${BOLD}${CLAUDE_PRODUCTION_EVIDENCE}/10${NC}"
3022
+ echo -e " Overall: ${BOLD}${M_QUALITY_SCORE}/10${NC}"
3023
+ fi
3024
+
3025
+ else
3026
+ rm -f "$prompt_file"
3027
+ echo -e "${YELLOW}⚠️ $(t phase6_failed)${NC}"
3028
+ M_QUALITY_SCORE="N/A"
3029
+ fi
3030
+ }
3031
+
3032
+ # ═══════════════════════════════════════════════════════════════════════════════
3033
+ # PHASE 6: FINAL SCORING & REPORT
3034
+ # ═══════════════════════════════════════════════════════════════════════════════
3035
+
3036
+ calculate_final_score() {
3037
+ log_section "$(t phase7_title)"
3038
+
3039
+ # ═══════════════════════════════════════════════════════════════════════════
3040
+ # DIMENSIONAL SCORING
3041
+ #
3042
+ # 9 dimensions with weights:
3043
+ # HIGH (×1.5): functionality, security, agnosticism, production
3044
+ # MEDIUM (×1.0): workflow_contract, structural, agent_quality, config
3045
+ # LOW (×0.7): documentation
3046
+ #
3047
+ # Formula:
3048
+ # weighted_avg = Σ(score_i × weight_i) / Σ(weight_i)
3049
+ # penalty = blocking_issues × severity_multiplier
3050
+ # final = max(0, weighted_avg - penalty)
3051
+ # If blocking issues > 0: cap at 6/10
3052
+ #
3053
+ # Verdicts:
3054
+ # PASS: score >= 7.0 AND zero blocking
3055
+ # CONDITIONAL: score >= 4.0 OR has blocking
3056
+ # FAIL: score < 4.0
3057
+ # ═══════════════════════════════════════════════════════════════════════════
3058
+
3059
+ # --- Compute deterministic dimension scores ---
3060
+
3061
+ # D1: Functionality/Pipeline (from workflow analysis or fallback)
3062
+ local d_functionality=5
3063
+ if is_numeric_score "${CLAUDE_WORKFLOW_ANALYSIS:-}"; then
3064
+ d_functionality="$CLAUDE_WORKFLOW_ANALYSIS"
3065
+ if awk -v s="$d_functionality" 'BEGIN { exit !(s < 10) }'; then
3066
+ DIM_FUNCTIONALITY_NOTE=$(fmt_t note_functionality_deep "$d_functionality")
3067
+ fi
3068
+ else
3069
+ # Deterministic fallback: based on workflow contract + type detection
3070
+ local wf_base=5
3071
+ local wf_reasons=""
3072
+ [[ "$M_WORKFLOW_CONTRACT_ERRORS" -eq 0 ]] && wf_base=$((wf_base + 2))
3073
+ [[ "$M_WORKFLOW_CONTRACT_WARNINGS" -eq 0 ]] && wf_base=$((wf_base + 1))
3074
+ [[ "$M_TYPE_CONFIDENCE" -ge 5 ]] && wf_base=$((wf_base + 1))
3075
+ [[ "$M_WORKFLOW_CONTRACT_ERRORS" -gt 0 ]] && wf_reasons="${wf_reasons}workflow_contract_errors=${M_WORKFLOW_CONTRACT_ERRORS}, "
3076
+ [[ "$M_WORKFLOW_CONTRACT_WARNINGS" -gt 0 ]] && wf_reasons="${wf_reasons}workflow_contract_warnings=${M_WORKFLOW_CONTRACT_WARNINGS}, "
3077
+ [[ "$M_TYPE_CONFIDENCE" -lt 5 ]] && wf_reasons="${wf_reasons}type_confidence=${M_TYPE_CONFIDENCE}/7, "
3078
+ [[ $wf_base -gt 10 ]] && wf_base=10
3079
+ d_functionality=$wf_base
3080
+ if awk -v s="$d_functionality" 'BEGIN { exit !(s < 10) }'; then
3081
+ if [[ -z "$wf_reasons" ]]; then
3082
+ DIM_FUNCTIONALITY_NOTE=$(t note_functionality_quick_max)
3083
+ else
3084
+ wf_reasons="${wf_reasons%, }"
3085
+ DIM_FUNCTIONALITY_NOTE=$(fmt_t note_functionality_quick_reduced "$wf_reasons")
3086
+ fi
3087
+ fi
3088
+ fi
3089
+
3090
+ # D2: Security (from Claude or deterministic)
3091
+ local d_security=5
3092
+ if is_numeric_score "${CLAUDE_SECURITY_AUDIT:-}"; then
3093
+ d_security="$CLAUDE_SECURITY_AUDIT"
3094
+ if awk -v s="$d_security" 'BEGIN { exit !(s < 10) }'; then
3095
+ DIM_SECURITY_NOTE=$(fmt_t note_security_deep "$d_security")
3096
+ fi
3097
+ else
3098
+ if [[ "$SEC_FAIL" -eq 0 ]]; then
3099
+ d_security=10
3100
+ elif [[ "$SEC_FAIL" -eq 1 ]]; then
3101
+ d_security=6
3102
+ elif [[ "$SEC_FAIL" -le 3 ]]; then
3103
+ d_security=3
3104
+ else
3105
+ d_security=1
3106
+ fi
3107
+ if awk -v s="$d_security" 'BEGIN { exit !(s < 10) }'; then
3108
+ DIM_SECURITY_NOTE=$(fmt_t note_security_deterministic "$SEC_FAIL")
3109
+ fi
3110
+ fi
3111
+
3112
+ # D3: Workflow Contract
3113
+ local d_workflow_contract=5
3114
+ if [[ "$M_WORKFLOW_CONTRACT_FILES" -eq 0 ]] && [[ ! -d "$SQUAD_DIR/workflows" ]]; then
3115
+ d_workflow_contract=5 # N/A, neutral
3116
+ DIM_WORKFLOW_CONTRACT_NOTE=$(t note_workflow_neutral)
3117
+ elif [[ "$WF_CONTRACT_FAIL" -eq 0 ]]; then
3118
+ d_workflow_contract=10
3119
+ else
3120
+ d_workflow_contract=$(awk -v err="$M_WORKFLOW_CONTRACT_ERRORS" -v warn="$M_WORKFLOW_CONTRACT_WARNINGS" \
3121
+ 'BEGIN { s = 10 - (err * 2) - (warn * 0.5); if (s < 0) s = 0; printf "%d", s }')
3122
+ DIM_WORKFLOW_CONTRACT_NOTE=$(fmt_t note_workflow_deterministic "$M_WORKFLOW_CONTRACT_ERRORS" "$M_WORKFLOW_CONTRACT_WARNINGS")
3123
+ fi
3124
+
3125
+ # D4: Structural Completeness (from Claude or deterministic)
3126
+ local d_structural=5
3127
+ if is_numeric_score "${CLAUDE_STRUCTURAL_COMPLETENESS:-}"; then
3128
+ d_structural="$CLAUDE_STRUCTURAL_COMPLETENESS"
3129
+ if awk -v s="$d_structural" 'BEGIN { exit !(s < 10) }'; then
3130
+ DIM_STRUCTURAL_NOTE=$(fmt_t note_structural_deep "$d_structural")
3131
+ fi
3132
+ else
3133
+ if [[ "$M_STRUCT_COMPLETENESS_TOTAL" -gt 0 ]]; then
3134
+ d_structural=$(awk -v p="$M_STRUCT_COMPLETENESS_PASS" -v t="$M_STRUCT_COMPLETENESS_TOTAL" \
3135
+ 'BEGIN { printf "%d", (p / t) * 10 }')
3136
+ fi
3137
+ # Penalize TIER1 failures
3138
+ d_structural=$(awk -v s="$d_structural" -v t1="$TIER1_FAIL" \
3139
+ 'BEGIN { r = s - (t1 * 1.5); if (r < 0) r = 0; printf "%d", r }')
3140
+ if awk -v s="$d_structural" 'BEGIN { exit !(s < 10) }'; then
3141
+ DIM_STRUCTURAL_NOTE=$(fmt_t note_structural_deterministic "$M_STRUCT_COMPLETENESS_PASS" "$M_STRUCT_COMPLETENESS_TOTAL" "$TIER1_FAIL")
3142
+ fi
3143
+ fi
3144
+
3145
+ # D5: Agent Quality (from Claude or deterministic)
3146
+ local d_agent_quality=5
3147
+ if is_numeric_score "${CLAUDE_AGENT_QUALITY:-}"; then
3148
+ d_agent_quality="$CLAUDE_AGENT_QUALITY"
3149
+ if awk -v s="$d_agent_quality" 'BEGIN { exit !(s < 10) }'; then
3150
+ DIM_AGENT_QUALITY_NOTE=$(fmt_t note_agent_deep "$d_agent_quality")
3151
+ fi
3152
+ else
3153
+ # 5 sections checked, each gap = -1.5 from 10
3154
+ d_agent_quality=$(awk -v gaps="$M_AGENT_QUALITY_GAPS" \
3155
+ 'BEGIN { s = 10 - (gaps * 1.5); if (s < 0) s = 0; printf "%d", s }')
3156
+ if awk -v s="$d_agent_quality" 'BEGIN { exit !(s < 10) }'; then
3157
+ DIM_AGENT_QUALITY_NOTE=$(fmt_t note_agent_deterministic "$M_AGENT_QUALITY_GAPS")
3158
+ fi
3159
+ fi
3160
+
3161
+ # D6: Squad Agnosticism (from Claude or deterministic)
3162
+ local d_agnosticism=5
3163
+ if is_numeric_score "${CLAUDE_SQUAD_AGNOSTICISM:-}"; then
3164
+ d_agnosticism="$CLAUDE_SQUAD_AGNOSTICISM"
3165
+ if awk -v s="$d_agnosticism" 'BEGIN { exit !(s < 10) }'; then
3166
+ DIM_AGNOSTICISM_NOTE=$(fmt_t note_agnosticism_deep "$d_agnosticism")
3167
+ fi
3168
+ else
3169
+ if [[ "$M_AGNOSTICISM_VIOLATIONS" -eq 0 ]]; then
3170
+ d_agnosticism=10
3171
+ elif [[ "$M_AGNOSTICISM_VIOLATIONS" -eq 1 ]]; then
3172
+ d_agnosticism=8
3173
+ elif [[ "$M_AGNOSTICISM_VIOLATIONS" -le 2 ]]; then
3174
+ d_agnosticism=6
3175
+ elif [[ "$M_AGNOSTICISM_VIOLATIONS" -le 3 ]]; then
3176
+ d_agnosticism=4
3177
+ else
3178
+ d_agnosticism=2
3179
+ fi
3180
+ if awk -v s="$d_agnosticism" 'BEGIN { exit !(s < 10) }'; then
3181
+ DIM_AGNOSTICISM_NOTE=$(fmt_t note_agnosticism_deterministic "$M_AGNOSTICISM_VIOLATIONS")
3182
+ fi
3183
+ fi
3184
+
3185
+ # D7: Production Evidence (from Claude or deterministic)
3186
+ local d_production=5
3187
+ if is_numeric_score "${CLAUDE_PRODUCTION_EVIDENCE:-}"; then
3188
+ d_production="$CLAUDE_PRODUCTION_EVIDENCE"
3189
+ if awk -v s="$d_production" 'BEGIN { exit !(s < 10) }'; then
3190
+ DIM_PRODUCTION_NOTE=$(fmt_t note_production_deep "$d_production")
3191
+ fi
3192
+ else
3193
+ d_production=$((PROD_SCORE * 2))
3194
+ [[ $d_production -gt 10 ]] && d_production=10
3195
+ if awk -v s="$d_production" 'BEGIN { exit !(s < 10) }'; then
3196
+ DIM_PRODUCTION_NOTE=$(fmt_t note_production_deterministic "$PROD_SCORE" "$PROD_MAX")
3197
+ fi
3198
+ fi
3199
+
3200
+ # D8: Config Quality (from Claude or deterministic)
3201
+ local d_config=5
3202
+ if is_numeric_score "${CLAUDE_CONFIG_QUALITY:-}"; then
3203
+ d_config="$CLAUDE_CONFIG_QUALITY"
3204
+ if awk -v s="$d_config" 'BEGIN { exit !(s < 10) }'; then
3205
+ DIM_CONFIG_NOTE=$(fmt_t note_config_deep "$d_config")
3206
+ fi
3207
+ else
3208
+ local config_score=0
3209
+ local config_missing=""
3210
+ local workspace_level=""
3211
+ local output_root=""
3212
+ local config_total=8
3213
+
3214
+ [[ -f "$SQUAD_DIR/config.yaml" ]] && config_score=$((config_score + 1)) || config_missing="${config_missing}config.yaml, "
3215
+
3216
+ if grep -qE "^name:|^[[:space:]]+name:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
3217
+ config_score=$((config_score + 1))
3218
+ else
3219
+ config_missing="${config_missing}name, "
3220
+ fi
3221
+
3222
+ if grep -qE "^version:|^[[:space:]]+version:" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
3223
+ config_score=$((config_score + 1))
3224
+ else
3225
+ config_missing="${config_missing}version, "
3226
+ fi
3227
+
3228
+ if grep -q "entry_agent:" "$SQUAD_DIR/config.yaml" 2>/dev/null || [[ -n "${ENTRY_AGENT:-}" ]]; then
3229
+ config_score=$((config_score + 1))
3230
+ else
3231
+ config_missing="${config_missing}entry_agent, "
3232
+ fi
3233
+
3234
+ if grep -qE "^tested:[[:space:]]*(true|yes)" "$SQUAD_DIR/config.yaml" 2>/dev/null; then
3235
+ config_score=$((config_score + 1))
3236
+ else
3237
+ config_missing="${config_missing}tested:true, "
3238
+ fi
3239
+
3240
+ workspace_level=$(extract_workspace_integration_level)
3241
+ [[ -n "$workspace_level" ]] && config_score=$((config_score + 1)) || config_missing="${config_missing}workspace_integration.level, "
3242
+
3243
+ output_root=$(extract_declared_output_root 2>/dev/null || true)
3244
+ [[ -n "$output_root" ]] && config_score=$((config_score + 1)) || config_missing="${config_missing}declared_output_root, "
3245
+
3246
+ [[ "$M_VERSION_CONSISTENT" == "true" ]] && config_score=$((config_score + 1)) || config_missing="${config_missing}version_consistency, "
3247
+
3248
+ d_config=$(awk -v p="$config_score" -v t="$config_total" 'BEGIN {
3249
+ if (t <= 0) { print 0; exit }
3250
+ s = (p / t) * 10
3251
+ if (s > 10) s = 10
3252
+ if (s < 0) s = 0
3253
+ printf "%d", int(s + 0.5)
3254
+ }')
3255
+
3256
+ if awk -v s="$d_config" 'BEGIN { exit !(s < 10) }'; then
3257
+ config_missing="${config_missing%, }"
3258
+ if [[ -n "$config_missing" ]]; then
3259
+ DIM_CONFIG_NOTE=$(fmt_t note_config_missing "$config_missing" "$config_score" "$config_total")
3260
+ else
3261
+ DIM_CONFIG_NOTE=$(t note_config_generic)
3262
+ fi
3263
+ fi
3264
+ fi
3265
+
3266
+ # D9: Documentation
3267
+ local d_documentation=5
3268
+ if is_numeric_score "${M_DOCUMENTATION:-}"; then
3269
+ d_documentation="$M_DOCUMENTATION"
3270
+ if awk -v s="$d_documentation" 'BEGIN { exit !(s < 10) }'; then
3271
+ DIM_DOCUMENTATION_NOTE=$(fmt_t note_documentation_deep "$d_documentation")
3272
+ fi
3273
+ else
3274
+ # Deterministic: based on README + ARCHITECTURE
3275
+ d_documentation=3
3276
+ local doc_missing=""
3277
+ [[ -f "$SQUAD_DIR/README.md" ]] && d_documentation=$((d_documentation + 3))
3278
+ [[ ! -f "$SQUAD_DIR/README.md" ]] && doc_missing="${doc_missing}README.md, "
3279
+ [[ -f "$SQUAD_DIR/ARCHITECTURE.md" ]] && d_documentation=$((d_documentation + 2))
3280
+ [[ ! -f "$SQUAD_DIR/ARCHITECTURE.md" ]] && doc_missing="${doc_missing}ARCHITECTURE.md, "
3281
+ [[ "$M_VERSION_CONSISTENT" == "true" ]] && d_documentation=$((d_documentation + 2))
3282
+ [[ "$M_VERSION_CONSISTENT" != "true" ]] && doc_missing="${doc_missing}version_consistency, "
3283
+ [[ $d_documentation -gt 10 ]] && d_documentation=10
3284
+ if awk -v s="$d_documentation" 'BEGIN { exit !(s < 10) }'; then
3285
+ doc_missing="${doc_missing%, }"
3286
+ DIM_DOCUMENTATION_NOTE=$(fmt_t note_documentation_deterministic "$doc_missing")
3287
+ fi
3288
+ fi
3289
+
3290
+ # --- Weighted average ---
3291
+ # HIGH=1.5, MEDIUM=1.0, LOW=0.7
3292
+ local weighted_score
3293
+ weighted_score=$(awk \
3294
+ -v d1="$d_functionality" \
3295
+ -v d2="$d_security" \
3296
+ -v d3="$d_workflow_contract" \
3297
+ -v d4="$d_structural" \
3298
+ -v d5="$d_agent_quality" \
3299
+ -v d6="$d_agnosticism" \
3300
+ -v d7="$d_production" \
3301
+ -v d8="$d_config" \
3302
+ -v d9="$d_documentation" \
3303
+ 'BEGIN {
3304
+ h = 1.5; m = 1.0; l = 0.7
3305
+ num = (d1*h) + (d2*h) + (d3*m) + (d4*m) + (d5*m) + (d6*h) + (d7*h) + (d8*m) + (d9*l)
3306
+ den = h + h + m + m + m + h + h + m + l
3307
+ printf "%.4f", num / den
3308
+ }')
3309
+
3310
+ # --- Blocking issue penalties ---
3311
+ # Penalties are capped at -2.0 max to prevent false positives from destroying scores.
3312
+ # Security "secrets" in expert squads are often false positives (expert names, USD amounts).
3313
+ # TIER1_FAIL: -0.5 each, SEC_FAIL: -0.3 each, WF_CONTRACT_FAIL: -0.5, XREF_FAIL: -1.0 each
3314
+ # Cap: max total penalty = 2.0
3315
+ local penalty
3316
+ penalty=$(awk -v t1="$TIER1_FAIL" -v sec="$SEC_FAIL" -v wf="$WF_CONTRACT_FAIL" -v xr="$XREF_FAIL" \
3317
+ 'BEGIN { p = (t1 * 0.5) + (sec * 0.3) + (wf * 0.5) + (xr * 1.0); if (p > 2.0) p = 2.0; printf "%.4f", p }')
3318
+
3319
+ weighted_score=$(awk -v ws="$weighted_score" -v pen="$penalty" \
3320
+ 'BEGIN { s = ws - pen; if (s < 0) s = 0; printf "%.4f", s }')
3321
+
3322
+ local capped_score="$weighted_score"
3323
+
3324
+ # Cap based on production evidence
3325
+ if [ "$PROD_SCORE" -eq 0 ]; then
3326
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 5) }'; then
3327
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 5) s = 5; printf "%.4f", s }')
3328
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}production_cap:score<=5_without_production;"
3329
+ fi
3330
+ elif [ "$PROD_SCORE" -lt 3 ]; then
3331
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 7) }'; then
3332
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 7) s = 7; printf "%.4f", s }')
3333
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}production_cap:score<=7_with_limited_evidence;"
3334
+ fi
3335
+ elif [ "$PROD_SCORE" -lt 5 ]; then
3336
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 9) }'; then
3337
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 9) s = 9; printf "%.4f", s }')
3338
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}production_cap:score<=9_without_full_evidence;"
3339
+ fi
3340
+ fi
3341
+
3342
+ # CRITICAL: If blocking issues exist, score NEVER > 6
3343
+ if [[ -n "$BLOCKING_ISSUES" ]]; then
3344
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 6) }'; then
3345
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 6) s = 6; printf "%.4f", s }')
3346
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}blocking_issues_open:score<=6;"
3347
+ fi
3348
+ fi
3349
+
3350
+ # PASS guardrails: severe debt in critical dimensions cannot produce PASS.
3351
+ local severe_high_count=0
3352
+ local severe_medium_count=0
3353
+ local severe_reasons=""
3354
+
3355
+ if awk -v s="$d_functionality" 'BEGIN { exit !(s < 4) }'; then
3356
+ severe_high_count=$((severe_high_count + 1))
3357
+ severe_reasons="${severe_reasons}critical_dimension:functionality=${d_functionality};"
3358
+ fi
3359
+ if awk -v s="$d_security" 'BEGIN { exit !(s < 4) }'; then
3360
+ severe_high_count=$((severe_high_count + 1))
3361
+ severe_reasons="${severe_reasons}critical_dimension:security=${d_security};"
3362
+ fi
3363
+ if awk -v s="$d_agnosticism" 'BEGIN { exit !(s < 4) }'; then
3364
+ severe_high_count=$((severe_high_count + 1))
3365
+ severe_reasons="${severe_reasons}critical_dimension:squad_agnosticism=${d_agnosticism};"
3366
+ fi
3367
+ if awk -v s="$d_production" 'BEGIN { exit !(s < 4) }'; then
3368
+ severe_high_count=$((severe_high_count + 1))
3369
+ severe_reasons="${severe_reasons}critical_dimension:production_evidence=${d_production};"
3370
+ fi
3371
+
3372
+ if awk -v s="$d_workflow_contract" 'BEGIN { exit !(s < 3) }'; then
3373
+ severe_medium_count=$((severe_medium_count + 1))
3374
+ severe_reasons="${severe_reasons}critical_dimension:workflow_contract=${d_workflow_contract};"
3375
+ fi
3376
+ if awk -v s="$d_structural" 'BEGIN { exit !(s < 3) }'; then
3377
+ severe_medium_count=$((severe_medium_count + 1))
3378
+ severe_reasons="${severe_reasons}critical_dimension:structural_completeness=${d_structural};"
3379
+ fi
3380
+ if awk -v s="$d_agent_quality" 'BEGIN { exit !(s < 3) }'; then
3381
+ severe_medium_count=$((severe_medium_count + 1))
3382
+ severe_reasons="${severe_reasons}critical_dimension:agent_quality=${d_agent_quality};"
3383
+ fi
3384
+ if awk -v s="$d_config" 'BEGIN { exit !(s < 3) }'; then
3385
+ severe_medium_count=$((severe_medium_count + 1))
3386
+ severe_reasons="${severe_reasons}critical_dimension:config_quality=${d_config};"
3387
+ fi
3388
+
3389
+ if [[ "$severe_high_count" -ge 2 ]] || [[ "$severe_high_count" -ge 1 && "$severe_medium_count" -ge 1 ]]; then
3390
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 5) }'; then
3391
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 5) s = 5; printf "%.4f", s }')
3392
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}combined_critical_dimension_debt:score<=5;${severe_reasons}"
3393
+ fi
3394
+ elif [[ "$severe_high_count" -ge 1 ]]; then
3395
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 6) }'; then
3396
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 6) s = 6; printf "%.4f", s }')
3397
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}critical_high_dimension_debt:score<=6;${severe_reasons}"
3398
+ fi
3399
+ elif [[ "$severe_medium_count" -ge 2 ]]; then
3400
+ if awk -v s="$capped_score" 'BEGIN { exit !(s > 6) }'; then
3401
+ capped_score=$(awk -v s="$capped_score" 'BEGIN { if (s > 6) s = 6; printf "%.4f", s }')
3402
+ SCORING_CAP_REASONS="${SCORING_CAP_REASONS}multiple_medium_dimension_debt:score<=6;${severe_reasons}"
3403
+ fi
3404
+ fi
3405
+
3406
+ FINAL_SCORE_RAW=$(awk -v cs="$capped_score" 'BEGIN { printf "%.2f", cs }')
3407
+ FINAL_SCORE=$(round_score_0_10_int "$capped_score")
3408
+
3409
+ # Store dimension scores for report
3410
+ DIM_FUNCTIONALITY="$d_functionality"
3411
+ DIM_SECURITY="$d_security"
3412
+ DIM_WORKFLOW_CONTRACT="$d_workflow_contract"
3413
+ DIM_STRUCTURAL="$d_structural"
3414
+ DIM_AGENT_QUALITY="$d_agent_quality"
3415
+ DIM_AGNOSTICISM="$d_agnosticism"
3416
+ DIM_PRODUCTION="$d_production"
3417
+ DIM_CONFIG="$d_config"
3418
+ DIM_DOCUMENTATION="$d_documentation"
3419
+
3420
+ if [[ "$VERBOSE" == "true" ]]; then
3421
+ local pre_penalty_display
3422
+ local penalty_display
3423
+ local after_penalty_display
3424
+ local after_caps_display
3425
+ pre_penalty_display=$(awk -v ws="$weighted_score" -v pen="$penalty" 'BEGIN { printf "%.2f", ws + pen }')
3426
+ penalty_display=$(awk -v p="$penalty" 'BEGIN { printf "%.2f", p }')
3427
+ after_penalty_display=$(awk -v ws="$weighted_score" 'BEGIN { printf "%.2f", ws }')
3428
+ after_caps_display=$(awk -v cs="$capped_score" 'BEGIN { printf "%.2f", cs }')
3429
+ echo -e "\n ${CYAN}$(t scoring_breakdown)${NC}"
3430
+ echo -e " $(fmt_t weighted_avg "$pre_penalty_display")"
3431
+ echo -e " $(fmt_t penalty "$penalty_display")"
3432
+ echo -e " $(fmt_t after_penalty "$after_penalty_display")"
3433
+ echo -e " $(fmt_t after_caps "$after_caps_display")"
3434
+ [[ -n "$SCORING_CAP_REASONS" ]] && echo -e " $(fmt_t cap_reasons "$SCORING_CAP_REASONS")"
3435
+ echo -e " $(fmt_t final_rounded "$FINAL_SCORE")"
3436
+ fi
3437
+ }
3438
+
3439
+ generate_report() {
3440
+ local result="FAIL"
3441
+ local result_color=$RED
3442
+ local result_display
3443
+
3444
+ # Coherent verdict logic
3445
+ if [[ $FINAL_SCORE -ge 7 ]] && [[ -z "$BLOCKING_ISSUES" ]]; then
3446
+ result="PASS"
3447
+ result_color=$GREEN
3448
+ elif [[ -n "$BLOCKING_ISSUES" ]] || [[ $FINAL_SCORE -lt 7 ]]; then
3449
+ if [[ $FINAL_SCORE -ge 4 ]]; then
3450
+ result="CONDITIONAL"
3451
+ result_color=$YELLOW
3452
+ else
3453
+ result="FAIL"
3454
+ result_color=$RED
3455
+ fi
3456
+ fi
3457
+
3458
+ case "$result" in
3459
+ PASS) result_display=$(t verdict_pass) ;;
3460
+ CONDITIONAL) result_display=$(t verdict_conditional) ;;
3461
+ *) result_display=$(t verdict_fail) ;;
3462
+ esac
3463
+
3464
+ # Helper: color a score
3465
+ score_color() {
3466
+ local s="$1"
3467
+ local display
3468
+ display=$(awk -v n="$s" '
3469
+ BEGIN {
3470
+ if (n < 0) n = 0;
3471
+ if (n > 10) n = 10;
3472
+ if (n == int(n)) printf "%d", n;
3473
+ else printf "%.1f", n;
3474
+ }')
3475
+ if awk -v n="$s" 'BEGIN { exit !(n >= 7) }'; then
3476
+ echo -e "${GREEN}${display}/10${NC}"
3477
+ elif awk -v n="$s" 'BEGIN { exit !(n >= 4) }'; then
3478
+ echo -e "${YELLOW}${display}/10${NC}"
3479
+ else
3480
+ echo -e "${RED}${display}/10${NC}"
3481
+ fi
3482
+ }
3483
+
3484
+ if [[ "$JSON_OUTPUT" == "true" ]]; then
3485
+ # Escape improvements and priority fixes for JSON safety
3486
+ local json_improvements
3487
+ json_improvements=$(printf '%s' "${M_IMPROVEMENTS:-}" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read().strip()))' 2>/dev/null || echo '""')
3488
+ local json_priority_fixes
3489
+ json_priority_fixes=$(printf '%s' "${CLAUDE_EXEC_SUMMARY:-}" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read().strip()))' 2>/dev/null || echo '""')
3490
+ local json_blocking
3491
+ json_blocking=$(printf '%s' "${BLOCKING_ISSUES:-}" | python3 -c '
3492
+ import json, sys
3493
+ raw = sys.stdin.read().strip()
3494
+ items = [line.strip() for line in raw.splitlines() if line.strip()]
3495
+ print(json.dumps(items, ensure_ascii=False))
3496
+ ' 2>/dev/null || echo '[]')
3497
+ local json_score_guardrails
3498
+ json_score_guardrails=$(printf '%s' "${SCORING_CAP_REASONS:-}" | python3 -c '
3499
+ import json, sys
3500
+ raw = sys.stdin.read().strip()
3501
+ items = [part.strip() for part in raw.split(";") if part.strip()]
3502
+ print(json.dumps(items, ensure_ascii=False))
3503
+ ' 2>/dev/null || echo '[]')
3504
+
3505
+ cat << ENDJSON
3506
+ {
3507
+ "squad": "$SQUAD_NAME",
3508
+ "result": "$result",
3509
+ "analysis_language": "$ANALYSIS_LANG",
3510
+ "report_language": "$REPORT_LANG_RESOLVED",
3511
+ "localized_report_available": $LOCALIZED_REPORT_AVAILABLE,
3512
+ "final_score_raw": $FINAL_SCORE_RAW,
3513
+ "final_score": $FINAL_SCORE,
3514
+ "type": "$M_SQUAD_TYPE",
3515
+ "dimensions": {
3516
+ "functionality": {"score": ${DIM_FUNCTIONALITY:-5}, "weight": "HIGH"},
3517
+ "security": {"score": ${DIM_SECURITY:-5}, "weight": "HIGH"},
3518
+ "workflow_contract": {"score": ${DIM_WORKFLOW_CONTRACT:-5}, "weight": "MEDIUM"},
3519
+ "structural_completeness": {"score": ${DIM_STRUCTURAL:-5}, "weight": "MEDIUM"},
3520
+ "agent_quality": {"score": ${DIM_AGENT_QUALITY:-5}, "weight": "MEDIUM"},
3521
+ "squad_agnosticism": {"score": ${DIM_AGNOSTICISM:-5}, "weight": "HIGH"},
3522
+ "production_evidence": {"score": ${DIM_PRODUCTION:-5}, "weight": "HIGH"},
3523
+ "config_quality": {"score": ${DIM_CONFIG:-5}, "weight": "MEDIUM"},
3524
+ "documentation": {"score": ${DIM_DOCUMENTATION:-5}, "weight": "LOW"}
3525
+ },
3526
+ "metrics": {
3527
+ "agents": $M_AGENT_COUNT,
3528
+ "tasks": $M_TASK_COUNT,
3529
+ "checklists": $M_CHECKLIST_COUNT,
3530
+ "total_lines": $M_TOTAL_LINES
3531
+ },
3532
+ "structure": {
3533
+ "mandatory_checks": {
3534
+ "pass": $M_STRUCT_COMPLETENESS_PASS,
3535
+ "total": $M_STRUCT_COMPLETENESS_TOTAL,
3536
+ "tested_flag_present": $M_HAS_TESTED_FLAG,
3537
+ "architecture_doc_present": $M_HAS_ARCHITECTURE_DOC
3538
+ },
3539
+ "contextual_lifecycle_checks": {
3540
+ "pass": $M_CONTEXTUAL_LIFECYCLE_PASS,
3541
+ "total": $M_CONTEXTUAL_LIFECYCLE_TOTAL,
3542
+ "warnings": $M_CONTEXTUAL_LIFECYCLE_WARNINGS,
3543
+ "update_task_present": $M_HAS_UPDATE_TASK,
3544
+ "delete_task_present": $M_HAS_DELETE_TASK
3545
+ }
3546
+ },
3547
+ "deterministic": {
3548
+ "tier1_fail": $TIER1_FAIL,
3549
+ "security_fail": $SEC_FAIL,
3550
+ "xref_fail": $XREF_FAIL,
3551
+ "workflow_contract_fail": $WF_CONTRACT_FAIL,
3552
+ "agnosticism_violations": $M_AGNOSTICISM_VIOLATIONS,
3553
+ "agent_quality_gaps": $M_AGENT_QUALITY_GAPS,
3554
+ "warnings": $WARN_COUNT
3555
+ },
3556
+ "workflow_contracts": {
3557
+ "files_checked": $M_WORKFLOW_CONTRACT_FILES,
3558
+ "errors": $M_WORKFLOW_CONTRACT_ERRORS,
3559
+ "warnings": $M_WORKFLOW_CONTRACT_WARNINGS
3560
+ },
3561
+ "production": {
3562
+ "score": $PROD_SCORE,
3563
+ "max": $PROD_MAX
3564
+ },
3565
+ "claude_analysis": {
3566
+ "prompt_quality": ${M_PROMPT_QUALITY:-0},
3567
+ "structure_coherence": ${M_STRUCTURE_COHERENCE:-0},
3568
+ "coverage": ${M_COVERAGE_SCORE:-0},
3569
+ "documentation": ${M_DOCUMENTATION:-0},
3570
+ "quality_score": "$M_QUALITY_SCORE",
3571
+ "dimensional_scores": {
3572
+ "structural_completeness": ${CLAUDE_STRUCTURAL_COMPLETENESS:-0},
3573
+ "security_audit": ${CLAUDE_SECURITY_AUDIT:-0},
3574
+ "workflow_analysis": ${CLAUDE_WORKFLOW_ANALYSIS:-0},
3575
+ "agent_quality": ${CLAUDE_AGENT_QUALITY:-0},
3576
+ "squad_agnosticism": ${CLAUDE_SQUAD_AGNOSTICISM:-0},
3577
+ "config_quality": ${CLAUDE_CONFIG_QUALITY:-0},
3578
+ "production_evidence": ${CLAUDE_PRODUCTION_EVIDENCE:-0}
3579
+ }
3580
+ },
3581
+ "blocking_issues": $json_blocking,
3582
+ "score_guardrails": $json_score_guardrails,
3583
+ "improvements": $json_improvements,
3584
+ "priority_fixes": $json_priority_fixes
3585
+ }
3586
+ ENDJSON
3587
+ else
3588
+ # ═══════════════════════════════════════════════════════════════════════
3589
+ # VISUAL REPORT — 9 dimensional sections
3590
+ # ═══════════════════════════════════════════════════════════════════════
3591
+ echo ""
3592
+ echo -e "${BOLD}╔══════════════════════════════════════════════════════════════╗${NC}"
3593
+ if [[ "$result" == "PASS" ]]; then
3594
+ printf "${BOLD}║${result_color}%60s${NC}${BOLD}║${NC}\n" "$(t validation_passed)"
3595
+ elif [[ "$result" == "CONDITIONAL" ]]; then
3596
+ printf "${BOLD}║${result_color}%60s${NC}${BOLD}║${NC}\n" "$(t validation_conditional)"
3597
+ else
3598
+ printf "${BOLD}║${result_color}%60s${NC}${BOLD}║${NC}\n" "$(t validation_failed)"
3599
+ fi
3600
+ echo -e "${BOLD}╚══════════════════════════════════════════════════════════════╝${NC}"
3601
+ echo ""
3602
+ echo -e " $(t label_squad): ${BOLD}$SQUAD_NAME${NC}"
3603
+ if [[ "$REPORT_LANG_RESOLVED" == "pt-br" ]]; then
3604
+ echo -e " $(t label_type): ${CYAN}$M_SQUAD_TYPE${NC} (confiança: $M_TYPE_CONFIDENCE/7)"
3605
+ else
3606
+ echo -e " $(t label_type): ${CYAN}$M_SQUAD_TYPE${NC} (confidence: $M_TYPE_CONFIDENCE/7)"
3607
+ fi
3608
+ echo -e " $(t label_analysis_language): ${ANALYSIS_LANG}"
3609
+ echo -e " $(t label_report_language): ${REPORT_LANG_RESOLVED}"
3610
+ echo -e " $(t label_final): ${BOLD}${result_color}$FINAL_SCORE/10${NC} | $(t label_raw): ${BOLD}$FINAL_SCORE_RAW/10${NC} | $(t label_verdict): ${BOLD}${result_color}$result_display${NC}"
3611
+ echo ""
3612
+
3613
+ # Section 1: Dimensional Scores Table
3614
+ echo -e " ${BOLD}$(t dimensional_scores)${NC}"
3615
+ echo " ┌──────────────────────────────┬────────┬────────┐"
3616
+ printf " │ %-28s │ %-6s │ %-6s │\n" "$(t table_dimension)" "$(t table_score)" "$(t table_weight)"
3617
+ echo " ├──────────────────────────────┼────────┼────────┤"
3618
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label functionality)" "$(score_color "${DIM_FUNCTIONALITY:-5}")" "$(weight_label HIGH)"
3619
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label security)" "$(score_color "${DIM_SECURITY:-5}")" "$(weight_label HIGH)"
3620
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label squad_agnosticism)" "$(score_color "${DIM_AGNOSTICISM:-5}")" "$(weight_label HIGH)"
3621
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label production_evidence)" "$(score_color "${DIM_PRODUCTION:-5}")" "$(weight_label HIGH)"
3622
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label workflow_contract)" "$(score_color "${DIM_WORKFLOW_CONTRACT:-5}")" "$(weight_label MEDIUM)"
3623
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label structural_completeness)" "$(score_color "${DIM_STRUCTURAL:-5}")" "$(weight_label MEDIUM)"
3624
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label agent_quality)" "$(score_color "${DIM_AGENT_QUALITY:-5}")" "$(weight_label MEDIUM)"
3625
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label config_quality)" "$(score_color "${DIM_CONFIG:-5}")" "$(weight_label MEDIUM)"
3626
+ printf " │ %-28s │ %s │ %-6s │\n" "$(dimension_label documentation)" "$(score_color "${DIM_DOCUMENTATION:-5}")" "$(weight_label LOW)"
3627
+ echo " └──────────────────────────────┴────────┴────────┘"
3628
+
3629
+ dimension_note() {
3630
+ local label="$1"
3631
+ case "$label" in
3632
+ functionality) printf "%s" "$DIM_FUNCTIONALITY_NOTE" ;;
3633
+ security) printf "%s" "$DIM_SECURITY_NOTE" ;;
3634
+ workflow_contract) printf "%s" "$DIM_WORKFLOW_CONTRACT_NOTE" ;;
3635
+ structural_completeness) printf "%s" "$DIM_STRUCTURAL_NOTE" ;;
3636
+ agent_quality) printf "%s" "$DIM_AGENT_QUALITY_NOTE" ;;
3637
+ squad_agnosticism) printf "%s" "$DIM_AGNOSTICISM_NOTE" ;;
3638
+ production_evidence) printf "%s" "$DIM_PRODUCTION_NOTE" ;;
3639
+ config_quality) printf "%s" "$DIM_CONFIG_NOTE" ;;
3640
+ documentation) printf "%s" "$DIM_DOCUMENTATION_NOTE" ;;
3641
+ esac
3642
+ }
3643
+
3644
+ local has_dimension_notes=false
3645
+ for dim in functionality security workflow_contract structural_completeness agent_quality squad_agnosticism production_evidence config_quality documentation; do
3646
+ local score_var=""
3647
+ case "$dim" in
3648
+ functionality) score_var="${DIM_FUNCTIONALITY:-5}" ;;
3649
+ security) score_var="${DIM_SECURITY:-5}" ;;
3650
+ workflow_contract) score_var="${DIM_WORKFLOW_CONTRACT:-5}" ;;
3651
+ structural_completeness) score_var="${DIM_STRUCTURAL:-5}" ;;
3652
+ agent_quality) score_var="${DIM_AGENT_QUALITY:-5}" ;;
3653
+ squad_agnosticism) score_var="${DIM_AGNOSTICISM:-5}" ;;
3654
+ production_evidence) score_var="${DIM_PRODUCTION:-5}" ;;
3655
+ config_quality) score_var="${DIM_CONFIG:-5}" ;;
3656
+ documentation) score_var="${DIM_DOCUMENTATION:-5}" ;;
3657
+ esac
3658
+ if awk -v s="$score_var" 'BEGIN { exit !(s < 10) }'; then
3659
+ has_dimension_notes=true
3660
+ break
3661
+ fi
3662
+ done
3663
+
3664
+ if [[ "$has_dimension_notes" == "true" ]]; then
3665
+ echo ""
3666
+ echo -e " ${BOLD}$(t dimension_notes)${NC}"
3667
+ for dim in functionality security workflow_contract structural_completeness agent_quality squad_agnosticism production_evidence config_quality documentation; do
3668
+ local label=""
3669
+ local score_var=""
3670
+ case "$dim" in
3671
+ functionality) label="$(dimension_label functionality)"; score_var="${DIM_FUNCTIONALITY:-5}" ;;
3672
+ security) label="$(dimension_label security)"; score_var="${DIM_SECURITY:-5}" ;;
3673
+ workflow_contract) label="$(dimension_label workflow_contract)"; score_var="${DIM_WORKFLOW_CONTRACT:-5}" ;;
3674
+ structural_completeness) label="$(dimension_label structural_completeness)"; score_var="${DIM_STRUCTURAL:-5}" ;;
3675
+ agent_quality) label="$(dimension_label agent_quality)"; score_var="${DIM_AGENT_QUALITY:-5}" ;;
3676
+ squad_agnosticism) label="$(dimension_label squad_agnosticism)"; score_var="${DIM_AGNOSTICISM:-5}" ;;
3677
+ production_evidence) label="$(dimension_label production_evidence)"; score_var="${DIM_PRODUCTION:-5}" ;;
3678
+ config_quality) label="$(dimension_label config_quality)"; score_var="${DIM_CONFIG:-5}" ;;
3679
+ documentation) label="$(dimension_label documentation)"; score_var="${DIM_DOCUMENTATION:-5}" ;;
3680
+ esac
3681
+ if awk -v s="$score_var" 'BEGIN { exit !(s < 10) }'; then
3682
+ local note=""
3683
+ note=$(dimension_note "$dim")
3684
+ [[ -z "$note" ]] && note="score below 10 without explicit rationale captured"
3685
+ echo -e " ${YELLOW}>${NC} $label: $note"
3686
+ fi
3687
+ done
3688
+ fi
3689
+
3690
+ # Section 2: Blocking Issues
3691
+ if [[ -n "$BLOCKING_ISSUES" ]]; then
3692
+ echo ""
3693
+ echo -e " ${BOLD}${RED}$(t blocking_issues)${NC}"
3694
+ echo -e "$BLOCKING_ISSUES" | while read -r issue; do
3695
+ [[ -n "$issue" ]] && echo -e " ${RED}x${NC} $issue"
3696
+ done
3697
+ fi
3698
+
3699
+ if [[ -n "$SCORING_CAP_REASONS" ]]; then
3700
+ echo ""
3701
+ echo -e " ${BOLD}$(t score_guardrails)${NC}"
3702
+ echo "$SCORING_CAP_REASONS" | tr ';' '\n' | while read -r reason; do
3703
+ reason=$(echo "$reason" | xargs 2>/dev/null || echo "$reason")
3704
+ [[ -n "$reason" ]] && echo -e " ${YELLOW}>${NC} $(translate_guardrail_reason "$reason")"
3705
+ done
3706
+ fi
3707
+
3708
+ # Section 3: Deterministic Findings
3709
+ echo ""
3710
+ echo -e " ${BOLD}$(t deterministic_findings)${NC}"
3711
+ echo " ┌────────────────────────────┬───────┐"
3712
+ printf " │ %-26s │ %-5s │\n" "$(t table_check)" "$(t table_count)"
3713
+ echo " ├────────────────────────────┼───────┤"
3714
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label tier1)" "$TIER1_FAIL"
3715
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label security)" "$SEC_FAIL"
3716
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label xref)" "$XREF_FAIL"
3717
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label workflow_contract)" "$WF_CONTRACT_FAIL"
3718
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label agnosticism)" "$M_AGNOSTICISM_VIOLATIONS"
3719
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label agent_quality)" "$M_AGENT_QUALITY_GAPS/5"
3720
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label structural)" "$M_STRUCT_COMPLETENESS_PASS/$M_STRUCT_COMPLETENESS_TOTAL"
3721
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label contextual_lifecycle)" "$M_CONTEXTUAL_LIFECYCLE_PASS/$M_CONTEXTUAL_LIFECYCLE_TOTAL"
3722
+ printf " │ %-26s │ %-5s │\n" "$(deterministic_check_label warnings)" "$WARN_COUNT"
3723
+ echo " └────────────────────────────┴───────┘"
3724
+
3725
+ # Section 4: Production Evidence
3726
+ echo ""
3727
+ echo -e " ${BOLD}$(dimension_label production_evidence)${NC}: $PROD_SCORE/$PROD_MAX"
3728
+ if [ "$PROD_SCORE" -eq 0 ]; then
3729
+ echo -e " ${RED}$(t production_none)${NC}"
3730
+ elif [ "$PROD_SCORE" -lt 3 ]; then
3731
+ echo -e " ${YELLOW}$(t production_limited)${NC}"
3732
+ else
3733
+ echo -e " ${GREEN}$(t production_good)${NC}"
3734
+ fi
3735
+
3736
+ # Section 5: Version Consistency
3737
+ if [[ "$M_VERSION_CONSISTENT" != "true" ]]; then
3738
+ echo ""
3739
+ echo -e " ${BOLD}$(t version_consistency)${NC}: ${YELLOW}$(t version_mismatch)${NC}"
3740
+ [[ -n "$M_VERSION_DETAILS" ]] && echo -e " $M_VERSION_DETAILS"
3741
+ fi
3742
+
3743
+ # Section 6: Priority Fixes (from Claude or improvements)
3744
+ if [[ -n "$CLAUDE_EXEC_SUMMARY_REPORT" ]]; then
3745
+ echo ""
3746
+ echo -e " ${BOLD}$(t priority_fixes)${NC}"
3747
+ printf '%s\n' "$CLAUDE_EXEC_SUMMARY_REPORT" | while IFS= read -r fix; do
3748
+ fix=$(echo "$fix" | xargs 2>/dev/null || echo "$fix")
3749
+ [[ -n "$fix" ]] && echo -e " ${YELLOW}>${NC} $fix"
3750
+ done
3751
+ fi
3752
+
3753
+ if [[ -n "$M_IMPROVEMENTS_REPORT" ]]; then
3754
+ echo ""
3755
+ echo -e " ${BOLD}$(t improvements)${NC}"
3756
+ printf '%s\n' "$M_IMPROVEMENTS_REPORT" | while IFS= read -r imp; do
3757
+ imp=$(echo "$imp" | xargs 2>/dev/null || echo "$imp")
3758
+ [[ -n "$imp" ]] && echo -e " - $imp"
3759
+ done
3760
+ fi
3761
+
3762
+ echo ""
3763
+ fi
3764
+
3765
+ VALIDATION_RESULT="$result"
3766
+ if [[ "$result" == "PASS" ]]; then
3767
+ EXIT_CODE=0
3768
+ else
3769
+ EXIT_CODE=1
3770
+ fi
3771
+ }
3772
+
3773
+ # ═══════════════════════════════════════════════════════════════════════════════
3774
+ # ORCHESTRATOR MODE
3775
+ # ═══════════════════════════════════════════════════════════════════════════════
3776
+ # When atomic scripts (validate-squad-structure.py, validate-squad-quality.py,
3777
+ # validate-squad-deep.sh) are available, this script delegates to them in
3778
+ # sequence. Falls back to legacy inline implementation if scripts are missing.
3779
+ #
3780
+ # Phases 0-2: validate-squad-structure.py (deterministic)
3781
+ # Phase 3: validate-squad-quality.py (deterministic)
3782
+ # Phases 4-6: validate-squad-deep.sh (Claude CLI)
3783
+ # ═══════════════════════════════════════════════════════════════════════════════
3784
+
3785
+ ATOMIC_STRUCTURE_SCRIPT="$SCRIPT_DIR/validate-squad-structure.py"
3786
+ ATOMIC_QUALITY_SCRIPT="$SCRIPT_DIR/validate-squad-quality.py"
3787
+ ATOMIC_DEEP_SCRIPT="$SCRIPT_DIR/validate-squad-deep.sh"
3788
+
3789
+ orchestrator_mode() {
3790
+ # Check if all atomic scripts exist
3791
+ local has_structure=false
3792
+ local has_quality=false
3793
+ local has_deep=false
3794
+
3795
+ [[ -f "$ATOMIC_STRUCTURE_SCRIPT" ]] && has_structure=true
3796
+ [[ -f "$ATOMIC_QUALITY_SCRIPT" ]] && has_quality=true
3797
+ [[ -f "$ATOMIC_DEEP_SCRIPT" ]] && has_deep=true
3798
+
3799
+ if [[ "$has_structure" == "false" ]] || [[ "$has_quality" == "false" ]]; then
3800
+ return 1 # Signal to use legacy mode
3801
+ fi
3802
+
3803
+ echo ""
3804
+ echo "╔══════════════════════════════════════════════════════════════╗"
3805
+ echo "║ 🔍 VALIDATE-SQUAD v4.0 (Squad Creator) ║"
3806
+ echo "╠══════════════════════════════════════════════════════════════╣"
3807
+ echo "║ ║"
3808
+ echo "║ Squad: $SQUAD_NAME"
3809
+ echo "║ Path: $SQUAD_DIR"
3810
+ echo "║ Runtime: $SELECTED_RUNTIME"
3811
+ echo "║ Model: $MODEL_QUALITY"
3812
+ echo "║ Mode: orchestrator (atomic scripts)"
3813
+ echo "║ ║"
3814
+ echo "╠══════════════════════════════════════════════════════════════╣"
3815
+ echo "║ Execution Plan: ║"
3816
+ echo "║ ┌─────────────────────────────────────────────────────────┐ ║"
3817
+ echo "║ │ Phase 1: Structure (deterministic — Python) │ ║"
3818
+ echo "║ │ ↓ │ ║"
3819
+ echo "║ │ Phase 2: Agnosticism (deterministic — Bash) │ ║"
3820
+ echo "║ │ ↓ │ ║"
3821
+ echo "║ │ Phase 3: Cross-References (deterministic — Bash) │ ║"
3822
+ echo "║ │ ↓ │ ║"
3823
+ echo "║ │ Phase 4: Quality (deterministic — Python) │ ║"
3824
+ echo "║ │ ↓ │ ║"
3825
+ echo "║ │ Phase 5: Deep Review (LLM — $SELECTED_RUNTIME) │ ║"
3826
+ echo "║ │ ↓ │ ║"
3827
+ echo "║ │ Phase 6: Production Evidence (deterministic — Bash) │ ║"
3828
+ echo "║ │ ↓ │ ║"
3829
+ echo "║ │ Phase 7: Final Score (deterministic — Bash) │ ║"
3830
+ echo "║ └─────────────────────────────────────────────────────────┘ ║"
3831
+ echo "║ ║"
3832
+ echo "╚══════════════════════════════════════════════════════════════╝"
3833
+ echo ""
3834
+
3835
+ PIPELINE_START_TIME=$(date +%s)
3836
+
3837
+ # Dry run: show plan and exit
3838
+ if [[ "$DRY_RUN" == "true" ]]; then
3839
+ echo "🔍 DRY RUN — would validate squad: $SQUAD_NAME"
3840
+ echo " Phases: 1 (Structure) → 2 (Agnosticism) → 3 (Cross-Refs) → 4 (Quality) → 5 (Deep Review) → 6 (Production) → 7 (Score)"
3841
+ echo " Runtime: $SELECTED_RUNTIME | Model: $MODEL_QUALITY"
3842
+ exit 0
3843
+ fi
3844
+
3845
+ # ─── Phase 1: Structure ───
3846
+ runtime_state_phase_start "phase_1_structure"
3847
+ echo "╔══════════════════════════════════════════════════════════════╗"
3848
+ echo "║ 📌 PHASE 1/7: Structure — $(date +%H:%M:%S)"
3849
+ echo "╚══════════════════════════════════════════════════════════════╝"
3850
+ local structure_output=""
3851
+ local structure_exit=0
3852
+ local structure_json="{}"
3853
+
3854
+ if structure_output=$(python3 "$ATOMIC_STRUCTURE_SCRIPT" "$SQUAD_DIR" --output json 2>&1); then
3855
+ structure_exit=0
3856
+ echo -e " ${GREEN}✓${NC} Structure validation passed"
3857
+ else
3858
+ structure_exit=$?
3859
+ if [[ $structure_exit -eq 1 ]]; then
3860
+ echo -e " ${RED}✗${NC} Structure validation found issues"
3861
+ else
3862
+ echo -e " ${RED}✗${NC} Structure validation error"
3863
+ fi
3864
+ fi
3865
+
3866
+ structure_json=$(printf "%s" "$structure_output" | extract_first_json_object)
3867
+ if [[ -n "$structure_json" ]] && [[ "$structure_json" != "{}" ]]; then
3868
+ local structure_fields=""
3869
+ structure_fields=$(extract_structure_fields "$structure_json")
3870
+ while IFS=$'\t' read -r key value; do
3871
+ case "$key" in
3872
+ squad_type) M_SQUAD_TYPE="$value" ;;
3873
+ type_confidence) M_TYPE_CONFIDENCE="$value" ;;
3874
+ agents) M_AGENT_COUNT="$value" ;;
3875
+ tasks) M_TASK_COUNT="$value" ;;
3876
+ workflows) : ;;
3877
+ checklists) M_CHECKLIST_COUNT="$value" ;;
3878
+ structure_valid) : ;;
3879
+ blocking_issue_count) : ;;
3880
+ warning_count)
3881
+ if [[ "$value" =~ ^[0-9]+$ ]]; then
3882
+ WARN_COUNT="$value"
3883
+ fi
3884
+ ;;
3885
+ security_issue_count)
3886
+ if [[ "$value" =~ ^[0-9]+$ ]]; then
3887
+ SEC_FAIL="$value"
3888
+ M_SECURITY_ISSUES="$value"
3889
+ fi
3890
+ ;;
3891
+ non_security_blocking_count)
3892
+ if [[ "$value" =~ ^[0-9]+$ ]]; then
3893
+ TIER1_FAIL="$value"
3894
+ fi
3895
+ ;;
3896
+ blocking_issues_b64)
3897
+ BLOCKING_ISSUES=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "", end="")' 2>/dev/null || true)
3898
+ if [[ -n "$BLOCKING_ISSUES" ]] && [[ "${BLOCKING_ISSUES: -1}" != $'\n' ]]; then
3899
+ BLOCKING_ISSUES+=$'\n'
3900
+ fi
3901
+ ;;
3902
+ warnings_b64)
3903
+ WARNINGS=$(printf '%s' "$value" | python3 -c 'import sys,base64; data=sys.stdin.read().strip(); print(base64.b64decode(data).decode("utf-8") if data else "", end="")' 2>/dev/null || true)
3904
+ if [[ -n "$WARNINGS" ]] && [[ "${WARNINGS: -1}" != $'\n' ]]; then
3905
+ WARNINGS+=$'\n'
3906
+ fi
3907
+ ;;
3908
+ esac
3909
+ done <<< "$structure_fields"
3910
+ fi
3911
+
3912
+ collect_orchestrator_baseline
3913
+ runtime_state_phase_complete "phase_1_structure" "$([[ $structure_exit -eq 0 ]] && echo completed || echo failed)"
3914
+
3915
+ if [[ "$VERBOSE" == "true" ]] && [[ -n "$structure_json" ]] && [[ "$structure_json" != "{}" ]]; then
3916
+ python3 -c "
3917
+ import json, sys
3918
+ d = json.loads(sys.stdin.read())
3919
+ c = d.get('coverage', {})
3920
+ print(f' Coverage: {c.get(\"agents\",0)} agents, {c.get(\"tasks\",0)} tasks, {c.get(\"workflows\",0)} workflows, {c.get(\"checklists\",0)} checklists')
3921
+ print(f' Type: {d.get(\"squad_type\",\"?\")} (confidence: {d.get(\"type_confidence\",\"?\")}/7)')
3922
+ print(f' Structure score: {d.get(\"score\",\"?\")}/100')
3923
+ bi = d.get('blocking_issues', [])
3924
+ if bi:
3925
+ print(f' Blocking issues ({len(bi)}):')
3926
+ for i in bi: print(f' - {i}')
3927
+ " <<< "$structure_json" 2>/dev/null || true
3928
+ fi
3929
+
3930
+ # ─── Phase 3: Quality (only if structure passed) ───
3931
+ local quality_exit=1
3932
+ if [[ $structure_exit -ne 2 ]]; then
3933
+ runtime_state_phase_start "phase_6_quality_analysis"
3934
+ echo ""
3935
+ echo "╔══════════════════════════════════════════════════════════════╗"
3936
+ echo "║ 📌 PHASE 4/7: Quality — $(date +%H:%M:%S)"
3937
+ echo "╚══════════════════════════════════════════════════════════════╝"
3938
+ local quality_output=""
3939
+
3940
+ if quality_output=$(python3 "$ATOMIC_QUALITY_SCRIPT" "$SQUAD_DIR" --output json 2>&1); then
3941
+ quality_exit=0
3942
+ echo -e " ${GREEN}✓${NC} Quality analysis passed"
3943
+ else
3944
+ quality_exit=$?
3945
+ echo -e " ${YELLOW}⚠${NC} Quality analysis found issues (exit=$quality_exit)"
3946
+ fi
3947
+
3948
+ if [[ "$VERBOSE" == "true" ]] && [[ -n "$quality_output" ]]; then
3949
+ local quality_json
3950
+ quality_json=$(printf "%s" "$quality_output" | extract_first_json_object 2>/dev/null)
3951
+ if [[ -n "$quality_json" ]] && [[ "$quality_json" != "{}" ]]; then
3952
+ python3 -c "
3953
+ import json, sys
3954
+ d = json.loads(sys.stdin.read())
3955
+ print(f' Task Anatomy: {d.get(\"task_anatomy_coverage\",\"?\")}')
3956
+ print(f' Acceptance Criteria: {d.get(\"acceptance_criteria_coverage\",\"?\")}')
3957
+ print(f' Workflows + State Machine: {d.get(\"workflows_with_state_machine\",\"?\")}')
3958
+ print(f' Workflows + task_ref: {d.get(\"workflows_with_task_ref\",\"?\")}')
3959
+ print(f' Quality score: {d.get(\"score\",\"?\")}/100')
3960
+ issues = [i for i in d.get('issues',[]) if not i.startswith('Monolithic')]
3961
+ if issues:
3962
+ task_issues = [i for i in issues if 'Task missing' in i]
3963
+ other = [i for i in issues if 'Task missing' not in i]
3964
+ if task_issues:
3965
+ print(f' Tasks missing anatomy: {len(task_issues)}')
3966
+ for i in other[:5]: print(f' - {i}')
3967
+ " <<< "$quality_json" 2>/dev/null || true
3968
+ fi
3969
+ fi
3970
+
3971
+ runtime_state_phase_complete "phase_6_quality_analysis" "$([[ $quality_exit -eq 0 ]] && echo completed || echo failed)"
3972
+ else
3973
+ echo ""
3974
+ echo -e "${YELLOW}⚠${NC} Skipping quality analysis (structure validation error)"
3975
+ fi
3976
+
3977
+ # ─── Phases 4-6: Deep Review (only if quality passed or --force-deep) ───
3978
+ if [[ "$has_deep" == "true" ]]; then
3979
+ local run_deep=false
3980
+ if [[ "${FORCE_DEEP:-0}" == "1" ]]; then
3981
+ run_deep=true
3982
+ elif [[ $quality_exit -ne 2 ]] && [[ "$QUICK_MODE" != "true" ]]; then
3983
+ run_deep=true
3984
+ fi
3985
+
3986
+ if [[ "$run_deep" == "true" ]]; then
3987
+ runtime_state_phase_start "phase_6_deep_review"
3988
+ echo ""
3989
+ echo "╔══════════════════════════════════════════════════════════════╗"
3990
+ echo "║ 📌 PHASE 5/7: Deep Review (LLM — $SELECTED_RUNTIME) — $(date +%H:%M:%S)"
3991
+ echo "╚══════════════════════════════════════════════════════════════╝"
3992
+ local deep_output=""
3993
+ local deep_args=("$SQUAD_DIR" "--model" "$MODEL_QUALITY")
3994
+
3995
+ # Build findings file from previous deterministic phases for injection into LLM
3996
+ local findings_tmp
3997
+ findings_tmp=$(mktemp "${TMPDIR:-/tmp}/validate-findings.XXXXXX")
3998
+ cat > "$findings_tmp" << FINDINGS_END
3999
+ ### Structure (Phase 1) — deterministic
4000
+ - Squad type: $M_SQUAD_TYPE (confidence: $M_TYPE_CONFIDENCE/7)
4001
+ - Agents: $M_AGENT_COUNT | Tasks: $M_TASK_COUNT | Checklists: $M_CHECKLIST_COUNT
4002
+ - TIER1 failures: $TIER1_FAIL
4003
+ - Security issues: $SEC_FAIL
4004
+ - Structural checks: $M_STRUCT_COMPLETENESS_PASS/$M_STRUCT_COMPLETENESS_TOTAL
4005
+ - Version consistent: $M_VERSION_CONSISTENT
4006
+
4007
+ ### Quality (Phase 4) — deterministic
4008
+ $(if [[ -n "${quality_output:-}" ]]; then
4009
+ printf "%s" "$quality_output" | python3 -c "
4010
+ import json, sys
4011
+ try:
4012
+ d = json.loads(sys.stdin.read().strip().split('{',1)[1].rsplit('}',1)[0].join(['[{','}]']) if '{' in sys.stdin.read() else '{}')
4013
+ except: d = {}
4014
+ d = json.loads(open('/dev/stdin').read()) if False else {}
4015
+ " 2>/dev/null || true
4016
+ # Simpler: extract key metrics
4017
+ printf "%s" "$quality_output" | python3 -c "
4018
+ import json, sys
4019
+ for line in sys.stdin:
4020
+ line = line.strip()
4021
+ if not line or line[0] != '{': continue
4022
+ try:
4023
+ d = json.loads(line)
4024
+ print(f'- Task Anatomy coverage: {d.get(\"task_anatomy_coverage\",\"?\")}')
4025
+ print(f'- Acceptance Criteria: {d.get(\"acceptance_criteria_coverage\",\"?\")}')
4026
+ print(f'- Workflows + state machine: {d.get(\"workflows_with_state_machine\",\"?\")}')
4027
+ print(f'- Workflows + task_ref: {d.get(\"workflows_with_task_ref\",\"?\")}')
4028
+ print(f'- Quality score: {d.get(\"score\",\"?\")}/100')
4029
+ break
4030
+ except: pass
4031
+ " 2>/dev/null || echo "- (quality output not parseable)"
4032
+ fi)
4033
+
4034
+ ### Agnosticism (Phase 2) — deterministic
4035
+ - Violations: $M_AGNOSTICISM_VIOLATIONS
4036
+
4037
+ ### Cross-References (Phase 3) — deterministic
4038
+ - Broken refs: $XREF_FAIL
4039
+ - Workflow contract errors: $M_WORKFLOW_CONTRACT_ERRORS
4040
+
4041
+ ### Production (Phase 6) — deterministic
4042
+ - Production score: $PROD_SCORE/$PROD_MAX
4043
+ FINDINGS_END
4044
+ deep_args+=("--findings" "$findings_tmp")
4045
+
4046
+ if deep_output=$(bash "$ATOMIC_DEEP_SCRIPT" "${deep_args[@]}" 2>&1); then
4047
+ rm -f "$findings_tmp"
4048
+ echo -e " ${GREEN}✓${NC} Deep review complete"
4049
+ local deep_json="{}"
4050
+ deep_json=$(printf "%s" "$deep_output" | extract_first_json_object)
4051
+ if [[ -n "$deep_json" ]] && [[ "$deep_json" != "{}" ]]; then
4052
+ hydrate_deep_review_from_envelope "$deep_json"
4053
+ fi
4054
+ runtime_state_phase_complete "phase_6_deep_review"
4055
+ else
4056
+ rm -f "$findings_tmp"
4057
+ echo -e " ${YELLOW}⚠${NC} Deep review returned non-zero exit"
4058
+ runtime_state_phase_complete "phase_6_deep_review" "failed"
4059
+ fi
4060
+
4061
+ # Evaluator: cheap LLM validates deep review quality (Haiku/Flash/Spark)
4062
+ if [[ -n "$deep_json" ]] && [[ "$deep_json" != "{}" ]] && [[ "$HAS_RUNTIME_LIB" == "true" ]]; then
4063
+ local eval_model="$MODEL_FAST"
4064
+ local eval_prompt_file
4065
+ eval_prompt_file=$(mktemp)
4066
+ cat > "$eval_prompt_file" << 'EVALEOF'
4067
+ Evaluate this squad validation JSON. Check:
4068
+ 1. All 7 dimension scores are present and between 0-10
4069
+ 2. executive_summary has overall_score, verdict, priority_fixes, strengths
4070
+ 3. No dimension score contradicts its own detail (e.g. score 9 but all items FAIL)
4071
+ Reply with ONLY one word: VALID or INVALID
4072
+ EVALEOF
4073
+ printf '\n\nJSON to evaluate:\n%s' "$(echo "$deep_json" | head -100)" >> "$eval_prompt_file"
4074
+
4075
+ local saved_mt="${PHASE_MAX_TURNS:-}"
4076
+ local saved_at="${PHASE_ALLOWED_TOOLS:-}"
4077
+ PHASE_MAX_TURNS="1"
4078
+ PHASE_ALLOWED_TOOLS=""
4079
+ local eval_out_file
4080
+ eval_out_file=$(mktemp)
4081
+ _exec_runtime "$eval_model" "$eval_prompt_file" "$eval_out_file" 2>/dev/null || true
4082
+ local eval_verdict
4083
+ eval_verdict=$(grep -oiE "VALID|INVALID" "$eval_out_file" | head -1)
4084
+ PHASE_MAX_TURNS="$saved_mt"
4085
+ PHASE_ALLOWED_TOOLS="$saved_at"
4086
+ rm -f "$eval_prompt_file" "$eval_out_file"
4087
+
4088
+ if [[ "$eval_verdict" == "INVALID" ]]; then
4089
+ echo -e " ${YELLOW}🔍 Evaluator ($eval_model): INVALID — deep review may have structural issues${NC}"
4090
+ else
4091
+ echo -e " ${GREEN}🔍 Evaluator ($eval_model): VALID${NC}"
4092
+ fi
4093
+ fi
4094
+
4095
+ if [[ "$VERBOSE" == "true" ]] && [[ -n "$deep_json" ]] && [[ "$deep_json" != "{}" ]]; then
4096
+ python3 -c "
4097
+ import json, sys
4098
+ d = json.loads(sys.stdin.read())
4099
+ a = d.get('analysis', d)
4100
+ for section in ['structural_completeness', 'security_audit', 'workflow_analysis', 'agent_quality', 'squad_agnosticism', 'config_quality', 'production_evidence']:
4101
+ s = a.get(section, {})
4102
+ score = s.get('score', '?')
4103
+ print(f' {section}: {score}/10')
4104
+ es = a.get('executive_summary', {})
4105
+ if es:
4106
+ print(f' Overall: {es.get(\"overall_score\",\"?\")}/10 — {es.get(\"verdict\",\"?\")}')
4107
+ for fix in es.get('priority_fixes', [])[:3]:
4108
+ print(f' → {fix[:80]}')
4109
+ " <<< "$deep_json" 2>/dev/null || true
4110
+ fi
4111
+ elif [[ "$QUICK_MODE" == "true" ]]; then
4112
+ echo ""
4113
+ echo -e "${YELLOW}⚠${NC} Skipping deep review (--quick mode)"
4114
+ else
4115
+ echo ""
4116
+ echo -e "${YELLOW}⚠${NC} Skipping deep review (quality analysis error)"
4117
+ fi
4118
+ fi
4119
+
4120
+ return 0
4121
+ }
4122
+
4123
+ # ═══════════════════════════════════════════════════════════════════════════════
4124
+ # MAIN EXECUTION
4125
+ # ═══════════════════════════════════════════════════════════════════════════════
4126
+
4127
+ main() {
4128
+ runtime_state_start
4129
+
4130
+ # Orchestrator path: consume atomic scripts, then run only supplemental gates
4131
+ if orchestrator_mode 2>/dev/null; then
4132
+ echo ""
4133
+ echo "╔══════════════════════════════════════════════════════════════╗"
4134
+ echo "║ 📌 PHASE 2/7: Squad Agnosticism — $(date +%H:%M:%S)"
4135
+ echo "╚══════════════════════════════════════════════════════════════╝"
4136
+ runtime_state_phase_start "phase_2_5_squad_agnosticism"
4137
+ check_squad_agnosticism
4138
+ runtime_state_phase_complete "phase_2_5_squad_agnosticism"
4139
+
4140
+ echo ""
4141
+ echo "╔══════════════════════════════════════════════════════════════╗"
4142
+ echo "║ 📌 PHASE 3/7: Cross-References — $(date +%H:%M:%S)"
4143
+ echo "╚══════════════════════════════════════════════════════════════╝"
4144
+ runtime_state_phase_start "phase_3_cross_reference"
4145
+ check_cross_references
4146
+ runtime_state_phase_complete "phase_3_cross_reference"
4147
+
4148
+ runtime_state_phase_start "phase_3_5_workflow_contracts"
4149
+ check_workflow_contracts
4150
+ runtime_state_phase_complete "phase_3_5_workflow_contracts"
4151
+
4152
+ echo ""
4153
+ echo "╔══════════════════════════════════════════════════════════════╗"
4154
+ echo "║ 📌 PHASE 6/7: Production Evidence — $(date +%H:%M:%S)"
4155
+ echo "╚══════════════════════════════════════════════════════════════╝"
4156
+ runtime_state_phase_start "phase_5_production_validation"
4157
+ check_production
4158
+ runtime_state_phase_complete "phase_5_production_validation"
4159
+
4160
+ echo ""
4161
+ echo "╔══════════════════════════════════════════════════════════════╗"
4162
+ echo "║ 📌 PHASE 7/7: Final Score — $(date +%H:%M:%S)"
4163
+ echo "╚══════════════════════════════════════════════════════════════╝"
4164
+ runtime_state_phase_start "phase_7_final_scoring"
4165
+ calculate_final_score
4166
+ generate_report
4167
+ runtime_state_phase_complete "phase_7_final_scoring"
4168
+
4169
+ local PIPELINE_END_TIME
4170
+ PIPELINE_END_TIME=$(date +%s)
4171
+ local TOTAL_DURATION=$((PIPELINE_END_TIME - PIPELINE_START_TIME))
4172
+ local TOTAL_MINUTES=$((TOTAL_DURATION / 60))
4173
+ local TOTAL_SECONDS=$((TOTAL_DURATION % 60))
4174
+
4175
+ # ─── Save reports to disk (like sinkra-validate.sh) ─────────────
4176
+ local REPORT_DIR="$WORKSPACE_ROOT/outputs/squad-validations/$SQUAD_NAME/$(date +%Y%m%d-%H%M%S)"
4177
+ mkdir -p "$REPORT_DIR"
4178
+
4179
+ # Save JSON report
4180
+ JSON_OUTPUT=true generate_report > "$REPORT_DIR/score_card.json" 2>/dev/null
4181
+ JSON_OUTPUT=""
4182
+
4183
+ # Save score summary YAML
4184
+ cat > "$REPORT_DIR/score_card.yaml" << SCOREEOF
4185
+ validation:
4186
+ squad: "$SQUAD_NAME"
4187
+ squad_path: "$SQUAD_DIR"
4188
+ validated_by: "validate-squad.sh v4.0"
4189
+ validated_date: "$(date -Iseconds)"
4190
+ runtime: "$SELECTED_RUNTIME"
4191
+ model: "$MODEL_QUALITY"
4192
+ duration_seconds: $TOTAL_DURATION
4193
+
4194
+ scores:
4195
+ final: $FINAL_SCORE
4196
+ raw: $FINAL_SCORE_RAW
4197
+ verdict: "$VALIDATION_RESULT"
4198
+ type: "$M_SQUAD_TYPE"
4199
+
4200
+ dimensions:
4201
+ functionality: ${DIM_FUNCTIONALITY:-5}
4202
+ security: ${DIM_SECURITY:-5}
4203
+ workflow_contract: ${DIM_WORKFLOW_CONTRACT:-5}
4204
+ structural_completeness: ${DIM_STRUCTURAL:-5}
4205
+ agent_quality: ${DIM_AGENT_QUALITY:-5}
4206
+ squad_agnosticism: ${DIM_AGNOSTICISM:-5}
4207
+ production_evidence: ${DIM_PRODUCTION:-5}
4208
+ config_quality: ${DIM_CONFIG:-5}
4209
+ documentation: ${DIM_DOCUMENTATION:-5}
4210
+
4211
+ metrics:
4212
+ agents: $M_AGENT_COUNT
4213
+ tasks: $M_TASK_COUNT
4214
+ checklists: $M_CHECKLIST_COUNT
4215
+ SCOREEOF
4216
+
4217
+ # Save deep review JSON if available
4218
+ if [[ -n "${CLAUDE_RAW_JSON:-}" ]] && [[ "$CLAUDE_RAW_JSON" != "{}" ]]; then
4219
+ printf '%s' "$CLAUDE_RAW_JSON" | python3 -m json.tool > "$REPORT_DIR/deep_review.json" 2>/dev/null || true
4220
+ fi
4221
+
4222
+ # Symlink latest
4223
+ ln -sfn "$(basename "$REPORT_DIR")" "$(dirname "$REPORT_DIR")/latest"
4224
+
4225
+ echo ""
4226
+ echo "╔══════════════════════════════════════════════════════════════╗"
4227
+ echo "║ ║"
4228
+ if [[ "$EXIT_CODE" -eq 0 ]]; then
4229
+ echo "║ ✅ VALIDATION COMPLETE — PASS ║"
4230
+ else
4231
+ echo "║ ⚠️ VALIDATION COMPLETE — ISSUES FOUND ║"
4232
+ fi
4233
+ echo "║ ║"
4234
+ echo "║ Squad: $SQUAD_NAME"
4235
+ echo "║ Score: $FINAL_SCORE/10"
4236
+ echo "║ Verdict: $VALIDATION_RESULT"
4237
+ echo "║ Duration: ${TOTAL_MINUTES}m ${TOTAL_SECONDS}s"
4238
+ echo "║ Report: $REPORT_DIR"
4239
+ echo "║ ║"
4240
+ echo "╚══════════════════════════════════════════════════════════════╝"
4241
+
4242
+ # Show cost summary if metrics lib is loaded
4243
+ if [[ "$HAS_METRICS_LIB" == "true" ]] && type show_cost_summary &>/dev/null; then
4244
+ show_cost_summary
4245
+ fi
4246
+
4247
+ # Append to progress log
4248
+ _progress_log "Result: $FINAL_SCORE/10 ($VALIDATION_RESULT) in ${TOTAL_MINUTES}m${TOTAL_SECONDS}s"
4249
+ _progress_log "Report: $REPORT_DIR"
4250
+
4251
+ if [[ "$EXIT_CODE" -eq 0 ]]; then
4252
+ runtime_state_complete "completed"
4253
+ else
4254
+ runtime_state_complete "failed"
4255
+ fi
4256
+
4257
+ exit "$EXIT_CODE"
4258
+ fi
4259
+
4260
+ echo ""
4261
+ echo -e "${BOLD}╔══════════════════════════════════════════════════════════════╗${NC}"
4262
+ printf "${BOLD}║ %-60s ${NC}${BOLD}║${NC}\n" "$(t main_title)"
4263
+ echo -e "${BOLD}╚══════════════════════════════════════════════════════════════╝${NC}"
4264
+ echo ""
4265
+ echo -e " $(t label_squad): ${CYAN}$SQUAD_NAME${NC}"
4266
+ echo -e " $(t label_path): $SQUAD_DIR"
4267
+ if [[ "$QUICK_MODE" == "true" ]]; then
4268
+ echo -e " $(t label_mode): $(t mode_quick)"
4269
+ else
4270
+ echo -e " $(t label_mode): $(t mode_hybrid)"
4271
+ fi
4272
+ echo -e " $(t label_model): $MODEL_QUALITY"
4273
+
4274
+ # LEGACY: full implementation below -- used as fallback if atomic scripts not found
4275
+ # or for full scoring/reporting which the orchestrator does not handle
4276
+
4277
+ # Phase 1: Structure (Bash)
4278
+ runtime_state_phase_start "phase_1_structure"
4279
+ check_structure
4280
+ runtime_state_phase_complete "phase_1_structure"
4281
+
4282
+ # Phase 2: Security (Bash)
4283
+ runtime_state_phase_start "phase_2_security_scan"
4284
+ check_security
4285
+ runtime_state_phase_complete "phase_2_security_scan"
4286
+
4287
+ # Phase 2.5: Squad Agnosticism (Bash)
4288
+ runtime_state_phase_start "phase_2_5_squad_agnosticism"
4289
+ check_squad_agnosticism
4290
+ runtime_state_phase_complete "phase_2_5_squad_agnosticism"
4291
+
4292
+ # Phase 3: Cross-references (Bash)
4293
+ runtime_state_phase_start "phase_3_cross_reference"
4294
+ check_cross_references
4295
+ runtime_state_phase_complete "phase_3_cross_reference"
4296
+
4297
+ # Phase 3.5: Workflow contracts (same validator as CI)
4298
+ runtime_state_phase_start "phase_3_5_workflow_contracts"
4299
+ check_workflow_contracts
4300
+ runtime_state_phase_complete "phase_3_5_workflow_contracts"
4301
+
4302
+ # Phase 3.7: Output Path Governance (Bash)
4303
+ runtime_state_phase_start "phase_3_7_output_path_governance"
4304
+ check_output_path_governance
4305
+ runtime_state_phase_complete "phase_3_7_output_path_governance"
4306
+
4307
+ # Phase 4: Type detection (Bash)
4308
+ runtime_state_phase_start "phase_4_type_detection"
4309
+ detect_squad_type
4310
+ runtime_state_phase_complete "phase_4_type_detection"
4311
+
4312
+ # Phase 5: Production validation (Bash) - NEW
4313
+ runtime_state_phase_start "phase_5_production_validation"
4314
+ check_production
4315
+ runtime_state_phase_complete "phase_5_production_validation"
4316
+
4317
+ # Phase 6: Quality analysis (Claude CLI)
4318
+ runtime_state_phase_start "phase_6_quality_analysis"
4319
+ analyze_with_claude
4320
+ runtime_state_phase_complete "phase_6_quality_analysis"
4321
+
4322
+ # Phase 7: Final scoring
4323
+ runtime_state_phase_start "phase_7_final_scoring"
4324
+ calculate_final_score
4325
+
4326
+ # Generate report
4327
+ generate_report
4328
+ runtime_state_phase_complete "phase_7_final_scoring"
4329
+
4330
+ if [[ "$EXIT_CODE" -eq 0 ]]; then
4331
+ runtime_state_complete "completed"
4332
+ else
4333
+ runtime_state_complete "failed"
4334
+ fi
4335
+
4336
+ exit "$EXIT_CODE"
4337
+ }
4338
+
4339
+ # Run
4340
+ main