@jaguilar87/gaia-ops 4.4.0 → 4.7.2

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 (371) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +12 -3
  3. package/ARCHITECTURE.md +9 -8
  4. package/CHANGELOG.md +34 -0
  5. package/README.md +43 -11
  6. package/agents/terraform-architect.md +1 -1
  7. package/bin/README.md +2 -2
  8. package/bin/gaia-doctor.js +18 -5
  9. package/bin/gaia-history.js +0 -1
  10. package/bin/gaia-metrics.js +2 -2
  11. package/bin/gaia-scan.py +23 -1
  12. package/bin/gaia-update.js +346 -54
  13. package/bin/pre-publish-validate.js +33 -10
  14. package/commands/gaia.md +37 -0
  15. package/config/README.md +3 -9
  16. package/config/context-contracts.json +47 -15
  17. package/config/surface-routing.json +9 -1
  18. package/dist/gaia-ops/.claude-plugin/plugin.json +22 -0
  19. package/dist/gaia-ops/agents/cloud-troubleshooter.md +73 -0
  20. package/dist/gaia-ops/agents/devops-developer.md +57 -0
  21. package/dist/gaia-ops/agents/gaia-system.md +58 -0
  22. package/dist/gaia-ops/agents/gitops-operator.md +60 -0
  23. package/dist/gaia-ops/agents/speckit-planner.md +71 -0
  24. package/dist/gaia-ops/agents/terraform-architect.md +60 -0
  25. package/dist/gaia-ops/commands/gaia.md +37 -0
  26. package/dist/gaia-ops/config/README.md +58 -0
  27. package/dist/gaia-ops/config/cloud/aws.json +140 -0
  28. package/dist/gaia-ops/config/cloud/gcp.json +145 -0
  29. package/dist/gaia-ops/config/context-contracts.json +131 -0
  30. package/dist/gaia-ops/config/git_standards.json +72 -0
  31. package/dist/gaia-ops/config/surface-routing.json +197 -0
  32. package/dist/gaia-ops/config/universal-rules.json +10 -0
  33. package/dist/gaia-ops/hooks/adapters/__init__.py +52 -0
  34. package/dist/gaia-ops/hooks/adapters/base.py +219 -0
  35. package/dist/gaia-ops/hooks/adapters/channel.py +17 -0
  36. package/dist/gaia-ops/hooks/adapters/claude_code.py +1477 -0
  37. package/dist/gaia-ops/hooks/adapters/types.py +194 -0
  38. package/dist/gaia-ops/hooks/adapters/utils.py +25 -0
  39. package/dist/gaia-ops/hooks/hooks.json +126 -0
  40. package/dist/gaia-ops/hooks/modules/__init__.py +15 -0
  41. package/dist/gaia-ops/hooks/modules/agents/__init__.py +29 -0
  42. package/dist/gaia-ops/hooks/modules/agents/contract_validator.py +647 -0
  43. package/dist/gaia-ops/hooks/modules/agents/response_contract.py +496 -0
  44. package/dist/gaia-ops/hooks/modules/agents/skill_injection_verifier.py +124 -0
  45. package/dist/gaia-ops/hooks/modules/agents/task_info_builder.py +74 -0
  46. package/dist/gaia-ops/hooks/modules/agents/transcript_analyzer.py +458 -0
  47. package/dist/gaia-ops/hooks/modules/agents/transcript_reader.py +152 -0
  48. package/dist/gaia-ops/hooks/modules/audit/__init__.py +28 -0
  49. package/dist/gaia-ops/hooks/modules/audit/event_detector.py +168 -0
  50. package/dist/gaia-ops/hooks/modules/audit/logger.py +131 -0
  51. package/dist/gaia-ops/hooks/modules/audit/metrics.py +134 -0
  52. package/dist/gaia-ops/hooks/modules/audit/workflow_auditor.py +576 -0
  53. package/dist/gaia-ops/hooks/modules/audit/workflow_recorder.py +296 -0
  54. package/dist/gaia-ops/hooks/modules/context/__init__.py +11 -0
  55. package/dist/gaia-ops/hooks/modules/context/anchor_tracker.py +317 -0
  56. package/dist/gaia-ops/hooks/modules/context/compact_context_builder.py +215 -0
  57. package/dist/gaia-ops/hooks/modules/context/context_cache.py +129 -0
  58. package/dist/gaia-ops/hooks/modules/context/context_freshness.py +145 -0
  59. package/dist/gaia-ops/hooks/modules/context/context_injector.py +427 -0
  60. package/dist/gaia-ops/hooks/modules/context/context_writer.py +518 -0
  61. package/dist/gaia-ops/hooks/modules/context/contracts_loader.py +161 -0
  62. package/dist/gaia-ops/hooks/modules/core/__init__.py +40 -0
  63. package/dist/gaia-ops/hooks/modules/core/hook_entry.py +78 -0
  64. package/dist/gaia-ops/hooks/modules/core/paths.py +160 -0
  65. package/dist/gaia-ops/hooks/modules/core/plugin_mode.py +149 -0
  66. package/dist/gaia-ops/hooks/modules/core/plugin_setup.py +558 -0
  67. package/dist/gaia-ops/hooks/modules/core/state.py +179 -0
  68. package/dist/gaia-ops/hooks/modules/core/stdin.py +24 -0
  69. package/dist/gaia-ops/hooks/modules/events/__init__.py +1 -0
  70. package/dist/gaia-ops/hooks/modules/events/event_writer.py +210 -0
  71. package/dist/gaia-ops/hooks/modules/identity/__init__.py +0 -0
  72. package/dist/gaia-ops/hooks/modules/identity/identity_provider.py +21 -0
  73. package/dist/gaia-ops/hooks/modules/identity/ops_identity.py +34 -0
  74. package/dist/gaia-ops/hooks/modules/identity/security_identity.py +10 -0
  75. package/dist/gaia-ops/hooks/modules/memory/__init__.py +8 -0
  76. package/dist/gaia-ops/hooks/modules/memory/episode_writer.py +227 -0
  77. package/dist/gaia-ops/hooks/modules/orchestrator/__init__.py +1 -0
  78. package/dist/gaia-ops/hooks/modules/orchestrator/delegate_mode.py +128 -0
  79. package/dist/gaia-ops/hooks/modules/scanning/__init__.py +8 -0
  80. package/dist/gaia-ops/hooks/modules/scanning/scan_trigger.py +84 -0
  81. package/dist/gaia-ops/hooks/modules/security/__init__.py +89 -0
  82. package/dist/gaia-ops/hooks/modules/security/approval_cleanup.py +87 -0
  83. package/dist/gaia-ops/hooks/modules/security/approval_constants.py +23 -0
  84. package/dist/gaia-ops/hooks/modules/security/approval_grants.py +912 -0
  85. package/dist/gaia-ops/hooks/modules/security/approval_messages.py +71 -0
  86. package/dist/gaia-ops/hooks/modules/security/approval_scopes.py +153 -0
  87. package/dist/gaia-ops/hooks/modules/security/blocked_commands.py +584 -0
  88. package/dist/gaia-ops/hooks/modules/security/blocked_message_formatter.py +86 -0
  89. package/dist/gaia-ops/hooks/modules/security/command_semantics.py +130 -0
  90. package/dist/gaia-ops/hooks/modules/security/gitops_validator.py +179 -0
  91. package/dist/gaia-ops/hooks/modules/security/mutative_verbs.py +850 -0
  92. package/dist/gaia-ops/hooks/modules/security/prompt_validator.py +40 -0
  93. package/dist/gaia-ops/hooks/modules/security/tiers.py +196 -0
  94. package/dist/gaia-ops/hooks/modules/session/__init__.py +10 -0
  95. package/dist/gaia-ops/hooks/modules/session/session_context_writer.py +100 -0
  96. package/dist/gaia-ops/hooks/modules/session/session_event_injector.py +158 -0
  97. package/dist/gaia-ops/hooks/modules/session/session_manager.py +31 -0
  98. package/dist/gaia-ops/hooks/modules/tools/__init__.py +25 -0
  99. package/dist/gaia-ops/hooks/modules/tools/bash_validator.py +708 -0
  100. package/dist/gaia-ops/hooks/modules/tools/cloud_pipe_validator.py +181 -0
  101. package/dist/gaia-ops/hooks/modules/tools/hook_response.py +55 -0
  102. package/dist/gaia-ops/hooks/modules/tools/shell_parser.py +227 -0
  103. package/dist/gaia-ops/hooks/modules/tools/task_validator.py +283 -0
  104. package/dist/gaia-ops/hooks/modules/validation/__init__.py +23 -0
  105. package/dist/gaia-ops/hooks/modules/validation/commit_validator.py +380 -0
  106. package/dist/gaia-ops/hooks/post_compact.py +43 -0
  107. package/dist/gaia-ops/hooks/post_tool_use.py +54 -0
  108. package/dist/gaia-ops/hooks/pre_tool_use.py +383 -0
  109. package/dist/gaia-ops/hooks/session_start.py +69 -0
  110. package/dist/gaia-ops/hooks/stop_hook.py +69 -0
  111. package/dist/gaia-ops/hooks/subagent_start.py +71 -0
  112. package/dist/gaia-ops/hooks/subagent_stop.py +288 -0
  113. package/dist/gaia-ops/hooks/task_completed.py +70 -0
  114. package/dist/gaia-ops/hooks/user_prompt_submit.py +177 -0
  115. package/dist/gaia-ops/settings.json +72 -0
  116. package/dist/gaia-ops/skills/README.md +109 -0
  117. package/dist/gaia-ops/skills/agent-protocol/SKILL.md +105 -0
  118. package/dist/gaia-ops/skills/agent-protocol/examples.md +170 -0
  119. package/dist/gaia-ops/skills/agent-response/SKILL.md +53 -0
  120. package/dist/gaia-ops/skills/approval/SKILL.md +85 -0
  121. package/dist/gaia-ops/skills/approval/examples.md +140 -0
  122. package/dist/gaia-ops/skills/approval/reference.md +57 -0
  123. package/dist/gaia-ops/skills/command-execution/SKILL.md +64 -0
  124. package/dist/gaia-ops/skills/command-execution/reference.md +83 -0
  125. package/dist/gaia-ops/skills/context-updater/SKILL.md +76 -0
  126. package/dist/gaia-ops/skills/context-updater/examples.md +71 -0
  127. package/dist/gaia-ops/skills/developer-patterns/SKILL.md +93 -0
  128. package/dist/gaia-ops/skills/developer-patterns/reference.md +112 -0
  129. package/dist/gaia-ops/skills/execution/SKILL.md +66 -0
  130. package/dist/gaia-ops/skills/fast-queries/SKILL.md +47 -0
  131. package/dist/gaia-ops/skills/gaia-patterns/SKILL.md +92 -0
  132. package/dist/gaia-ops/skills/gaia-patterns/reference.md +22 -0
  133. package/dist/gaia-ops/skills/git-conventions/SKILL.md +48 -0
  134. package/dist/gaia-ops/skills/gitops-patterns/SKILL.md +73 -0
  135. package/dist/gaia-ops/skills/gitops-patterns/reference.md +183 -0
  136. package/dist/gaia-ops/skills/investigation/SKILL.md +77 -0
  137. package/dist/gaia-ops/skills/orchestrator-approval/SKILL.md +64 -0
  138. package/dist/gaia-ops/skills/reference.md +134 -0
  139. package/dist/gaia-ops/skills/security-tiers/SKILL.md +61 -0
  140. package/dist/gaia-ops/skills/security-tiers/destructive-commands-reference.md +623 -0
  141. package/dist/gaia-ops/skills/security-tiers/reference.md +39 -0
  142. package/dist/gaia-ops/skills/skill-creation/SKILL.md +119 -0
  143. package/dist/gaia-ops/skills/specification/SKILL.md +186 -0
  144. package/dist/gaia-ops/skills/speckit-workflow/SKILL.md +165 -0
  145. package/dist/gaia-ops/skills/speckit-workflow/reference.md +117 -0
  146. package/dist/gaia-ops/skills/terraform-patterns/SKILL.md +63 -0
  147. package/dist/gaia-ops/skills/terraform-patterns/reference.md +93 -0
  148. package/dist/gaia-ops/speckit/README.md +516 -0
  149. package/dist/gaia-ops/speckit/scripts/.gitkeep +0 -0
  150. package/dist/gaia-ops/speckit/templates/adr-template.md +118 -0
  151. package/dist/gaia-ops/speckit/templates/agent-file-template.md +23 -0
  152. package/dist/gaia-ops/speckit/templates/plan-template.md +227 -0
  153. package/dist/gaia-ops/speckit/templates/spec-template.md +140 -0
  154. package/dist/gaia-ops/speckit/templates/tasks-template.md +257 -0
  155. package/dist/gaia-ops/tools/context/README.md +132 -0
  156. package/dist/gaia-ops/tools/context/__init__.py +42 -0
  157. package/dist/gaia-ops/tools/context/_paths.py +20 -0
  158. package/dist/gaia-ops/tools/context/context_provider.py +476 -0
  159. package/dist/gaia-ops/tools/context/context_section_reader.py +330 -0
  160. package/dist/gaia-ops/tools/context/deep_merge.py +159 -0
  161. package/dist/gaia-ops/tools/context/pending_updates.py +760 -0
  162. package/dist/gaia-ops/tools/context/surface_router.py +278 -0
  163. package/dist/gaia-ops/tools/fast-queries/README.md +65 -0
  164. package/dist/gaia-ops/tools/fast-queries/__init__.py +30 -0
  165. package/dist/gaia-ops/tools/fast-queries/appservices/quicktriage_devops_developer.sh +75 -0
  166. package/dist/gaia-ops/tools/fast-queries/cloud/aws/quicktriage_aws_troubleshooter.sh +32 -0
  167. package/dist/gaia-ops/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh +88 -0
  168. package/dist/gaia-ops/tools/fast-queries/gitops/quicktriage_gitops_operator.sh +48 -0
  169. package/dist/gaia-ops/tools/fast-queries/run_triage.sh +59 -0
  170. package/dist/gaia-ops/tools/fast-queries/terraform/quicktriage_terraform_architect.sh +80 -0
  171. package/dist/gaia-ops/tools/gaia_simulator/__init__.py +33 -0
  172. package/dist/gaia-ops/tools/gaia_simulator/cli.py +354 -0
  173. package/dist/gaia-ops/tools/gaia_simulator/extractor.py +457 -0
  174. package/dist/gaia-ops/tools/gaia_simulator/reporter.py +258 -0
  175. package/dist/gaia-ops/tools/gaia_simulator/routing_simulator.py +334 -0
  176. package/dist/gaia-ops/tools/gaia_simulator/runner.py +539 -0
  177. package/dist/gaia-ops/tools/gaia_simulator/skills_mapper.py +262 -0
  178. package/dist/gaia-ops/tools/memory/README.md +0 -0
  179. package/dist/gaia-ops/tools/memory/__init__.py +20 -0
  180. package/dist/gaia-ops/tools/memory/episodic.py +1196 -0
  181. package/dist/gaia-ops/tools/persist_transcript_analysis.py +85 -0
  182. package/dist/gaia-ops/tools/review/__init__.py +1 -0
  183. package/dist/gaia-ops/tools/review/review_engine.py +157 -0
  184. package/dist/gaia-ops/tools/scan/__init__.py +35 -0
  185. package/dist/gaia-ops/tools/scan/config.py +247 -0
  186. package/dist/gaia-ops/tools/scan/merge.py +212 -0
  187. package/dist/gaia-ops/tools/scan/orchestrator.py +549 -0
  188. package/dist/gaia-ops/tools/scan/registry.py +127 -0
  189. package/dist/gaia-ops/tools/scan/scanners/__init__.py +18 -0
  190. package/dist/gaia-ops/tools/scan/scanners/base.py +137 -0
  191. package/dist/gaia-ops/tools/scan/scanners/environment.py +324 -0
  192. package/dist/gaia-ops/tools/scan/scanners/git.py +570 -0
  193. package/dist/gaia-ops/tools/scan/scanners/infrastructure.py +875 -0
  194. package/dist/gaia-ops/tools/scan/scanners/orchestration.py +600 -0
  195. package/dist/gaia-ops/tools/scan/scanners/stack.py +1085 -0
  196. package/dist/gaia-ops/tools/scan/scanners/tools.py +260 -0
  197. package/dist/gaia-ops/tools/scan/setup.py +753 -0
  198. package/dist/gaia-ops/tools/scan/tests/__init__.py +1 -0
  199. package/dist/gaia-ops/tools/scan/tests/conftest.py +796 -0
  200. package/dist/gaia-ops/tools/scan/tests/test_environment.py +323 -0
  201. package/dist/gaia-ops/tools/scan/tests/test_git.py +419 -0
  202. package/dist/gaia-ops/tools/scan/tests/test_infrastructure.py +382 -0
  203. package/dist/gaia-ops/tools/scan/tests/test_integration.py +920 -0
  204. package/dist/gaia-ops/tools/scan/tests/test_merge.py +269 -0
  205. package/dist/gaia-ops/tools/scan/tests/test_orchestration.py +304 -0
  206. package/dist/gaia-ops/tools/scan/tests/test_stack.py +604 -0
  207. package/dist/gaia-ops/tools/scan/tests/test_tools.py +349 -0
  208. package/dist/gaia-ops/tools/scan/ui.py +624 -0
  209. package/dist/gaia-ops/tools/scan/verify.py +266 -0
  210. package/dist/gaia-ops/tools/scan/walk.py +118 -0
  211. package/dist/gaia-ops/tools/scan/workspace.py +85 -0
  212. package/dist/gaia-ops/tools/validation/README.md +244 -0
  213. package/dist/gaia-ops/tools/validation/__init__.py +17 -0
  214. package/dist/gaia-ops/tools/validation/approval_gate.py +321 -0
  215. package/dist/gaia-ops/tools/validation/validate_skills.py +189 -0
  216. package/dist/gaia-security/.claude-plugin/plugin.json +22 -0
  217. package/dist/gaia-security/config/universal-rules.json +10 -0
  218. package/dist/gaia-security/hooks/adapters/__init__.py +52 -0
  219. package/dist/gaia-security/hooks/adapters/base.py +219 -0
  220. package/dist/gaia-security/hooks/adapters/channel.py +17 -0
  221. package/dist/gaia-security/hooks/adapters/claude_code.py +1477 -0
  222. package/dist/gaia-security/hooks/adapters/types.py +194 -0
  223. package/dist/gaia-security/hooks/adapters/utils.py +25 -0
  224. package/dist/gaia-security/hooks/hooks.json +57 -0
  225. package/dist/gaia-security/hooks/modules/__init__.py +15 -0
  226. package/dist/gaia-security/hooks/modules/agents/__init__.py +29 -0
  227. package/dist/gaia-security/hooks/modules/agents/contract_validator.py +647 -0
  228. package/dist/gaia-security/hooks/modules/agents/response_contract.py +496 -0
  229. package/dist/gaia-security/hooks/modules/agents/skill_injection_verifier.py +124 -0
  230. package/dist/gaia-security/hooks/modules/agents/task_info_builder.py +74 -0
  231. package/dist/gaia-security/hooks/modules/agents/transcript_analyzer.py +458 -0
  232. package/dist/gaia-security/hooks/modules/agents/transcript_reader.py +152 -0
  233. package/dist/gaia-security/hooks/modules/audit/__init__.py +28 -0
  234. package/dist/gaia-security/hooks/modules/audit/event_detector.py +168 -0
  235. package/dist/gaia-security/hooks/modules/audit/logger.py +131 -0
  236. package/dist/gaia-security/hooks/modules/audit/metrics.py +134 -0
  237. package/dist/gaia-security/hooks/modules/audit/workflow_auditor.py +576 -0
  238. package/dist/gaia-security/hooks/modules/audit/workflow_recorder.py +296 -0
  239. package/dist/gaia-security/hooks/modules/context/__init__.py +11 -0
  240. package/dist/gaia-security/hooks/modules/context/anchor_tracker.py +317 -0
  241. package/dist/gaia-security/hooks/modules/context/compact_context_builder.py +215 -0
  242. package/dist/gaia-security/hooks/modules/context/context_cache.py +129 -0
  243. package/dist/gaia-security/hooks/modules/context/context_freshness.py +145 -0
  244. package/dist/gaia-security/hooks/modules/context/context_injector.py +427 -0
  245. package/dist/gaia-security/hooks/modules/context/context_writer.py +518 -0
  246. package/dist/gaia-security/hooks/modules/context/contracts_loader.py +161 -0
  247. package/dist/gaia-security/hooks/modules/core/__init__.py +40 -0
  248. package/dist/gaia-security/hooks/modules/core/hook_entry.py +78 -0
  249. package/dist/gaia-security/hooks/modules/core/paths.py +160 -0
  250. package/dist/gaia-security/hooks/modules/core/plugin_mode.py +149 -0
  251. package/dist/gaia-security/hooks/modules/core/plugin_setup.py +558 -0
  252. package/dist/gaia-security/hooks/modules/core/state.py +179 -0
  253. package/dist/gaia-security/hooks/modules/core/stdin.py +24 -0
  254. package/dist/gaia-security/hooks/modules/events/__init__.py +1 -0
  255. package/dist/gaia-security/hooks/modules/events/event_writer.py +210 -0
  256. package/dist/gaia-security/hooks/modules/identity/__init__.py +0 -0
  257. package/dist/gaia-security/hooks/modules/identity/identity_provider.py +21 -0
  258. package/dist/gaia-security/hooks/modules/identity/ops_identity.py +34 -0
  259. package/dist/gaia-security/hooks/modules/identity/security_identity.py +10 -0
  260. package/dist/gaia-security/hooks/modules/memory/__init__.py +8 -0
  261. package/dist/gaia-security/hooks/modules/memory/episode_writer.py +227 -0
  262. package/dist/gaia-security/hooks/modules/orchestrator/__init__.py +1 -0
  263. package/dist/gaia-security/hooks/modules/orchestrator/delegate_mode.py +128 -0
  264. package/dist/gaia-security/hooks/modules/scanning/__init__.py +8 -0
  265. package/dist/gaia-security/hooks/modules/scanning/scan_trigger.py +84 -0
  266. package/dist/gaia-security/hooks/modules/security/__init__.py +89 -0
  267. package/dist/gaia-security/hooks/modules/security/approval_cleanup.py +87 -0
  268. package/dist/gaia-security/hooks/modules/security/approval_constants.py +23 -0
  269. package/dist/gaia-security/hooks/modules/security/approval_grants.py +912 -0
  270. package/dist/gaia-security/hooks/modules/security/approval_messages.py +71 -0
  271. package/dist/gaia-security/hooks/modules/security/approval_scopes.py +153 -0
  272. package/dist/gaia-security/hooks/modules/security/blocked_commands.py +584 -0
  273. package/dist/gaia-security/hooks/modules/security/blocked_message_formatter.py +86 -0
  274. package/dist/gaia-security/hooks/modules/security/command_semantics.py +130 -0
  275. package/dist/gaia-security/hooks/modules/security/gitops_validator.py +179 -0
  276. package/dist/gaia-security/hooks/modules/security/mutative_verbs.py +850 -0
  277. package/dist/gaia-security/hooks/modules/security/prompt_validator.py +40 -0
  278. package/dist/gaia-security/hooks/modules/security/tiers.py +196 -0
  279. package/dist/gaia-security/hooks/modules/session/__init__.py +10 -0
  280. package/dist/gaia-security/hooks/modules/session/session_context_writer.py +100 -0
  281. package/dist/gaia-security/hooks/modules/session/session_event_injector.py +158 -0
  282. package/dist/gaia-security/hooks/modules/session/session_manager.py +31 -0
  283. package/dist/gaia-security/hooks/modules/tools/__init__.py +25 -0
  284. package/dist/gaia-security/hooks/modules/tools/bash_validator.py +708 -0
  285. package/dist/gaia-security/hooks/modules/tools/cloud_pipe_validator.py +181 -0
  286. package/dist/gaia-security/hooks/modules/tools/hook_response.py +55 -0
  287. package/dist/gaia-security/hooks/modules/tools/shell_parser.py +227 -0
  288. package/dist/gaia-security/hooks/modules/tools/task_validator.py +283 -0
  289. package/dist/gaia-security/hooks/modules/validation/__init__.py +23 -0
  290. package/dist/gaia-security/hooks/modules/validation/commit_validator.py +380 -0
  291. package/dist/gaia-security/hooks/post_tool_use.py +54 -0
  292. package/dist/gaia-security/hooks/pre_tool_use.py +383 -0
  293. package/dist/gaia-security/hooks/session_start.py +69 -0
  294. package/dist/gaia-security/hooks/stop_hook.py +69 -0
  295. package/dist/gaia-security/hooks/user_prompt_submit.py +177 -0
  296. package/dist/gaia-security/settings.json +58 -0
  297. package/git-hooks/commit-msg +41 -0
  298. package/hooks/README.md +8 -6
  299. package/hooks/adapters/channel.py +0 -25
  300. package/hooks/adapters/claude_code.py +364 -125
  301. package/hooks/elicitation_result.py +132 -0
  302. package/hooks/hooks.json +10 -1
  303. package/hooks/modules/README.md +3 -2
  304. package/hooks/modules/agents/contract_validator.py +3 -51
  305. package/hooks/modules/agents/response_contract.py +4 -8
  306. package/hooks/modules/agents/transcript_reader.py +4 -5
  307. package/hooks/modules/audit/__init__.py +4 -6
  308. package/hooks/modules/audit/event_detector.py +0 -2
  309. package/hooks/modules/audit/metrics.py +108 -187
  310. package/hooks/modules/audit/workflow_auditor.py +0 -4
  311. package/hooks/modules/audit/workflow_recorder.py +0 -5
  312. package/hooks/modules/context/compact_context_builder.py +1 -0
  313. package/hooks/modules/context/context_cache.py +129 -0
  314. package/hooks/modules/context/context_injector.py +18 -40
  315. package/hooks/modules/context/context_writer.py +1 -25
  316. package/hooks/modules/context/contracts_loader.py +7 -10
  317. package/hooks/modules/core/hook_entry.py +1 -0
  318. package/hooks/modules/core/paths.py +12 -13
  319. package/hooks/modules/core/plugin_mode.py +74 -4
  320. package/hooks/modules/core/plugin_setup.py +395 -23
  321. package/hooks/modules/events/__init__.py +1 -0
  322. package/hooks/modules/events/event_writer.py +210 -0
  323. package/hooks/modules/identity/ops_identity.py +18 -27
  324. package/hooks/modules/memory/episode_writer.py +1 -6
  325. package/hooks/modules/orchestrator/__init__.py +1 -0
  326. package/hooks/modules/orchestrator/delegate_mode.py +128 -0
  327. package/hooks/modules/security/__init__.py +2 -4
  328. package/hooks/modules/security/approval_constants.py +5 -1
  329. package/hooks/modules/security/approval_grants.py +189 -6
  330. package/hooks/modules/security/approval_messages.py +9 -21
  331. package/hooks/modules/security/blocked_commands.py +98 -34
  332. package/hooks/modules/security/command_semantics.py +0 -4
  333. package/hooks/modules/security/gitops_validator.py +1 -11
  334. package/hooks/modules/security/mutative_verbs.py +179 -38
  335. package/hooks/modules/security/tiers.py +1 -19
  336. package/hooks/modules/session/session_event_injector.py +1 -25
  337. package/hooks/modules/tools/bash_validator.py +310 -94
  338. package/hooks/modules/tools/shell_parser.py +0 -1
  339. package/hooks/modules/tools/task_validator.py +9 -29
  340. package/hooks/post_tool_use.py +0 -72
  341. package/hooks/pre_tool_use.py +42 -102
  342. package/hooks/session_start.py +4 -2
  343. package/hooks/subagent_start.py +6 -2
  344. package/hooks/subagent_stop.py +1 -13
  345. package/hooks/user_prompt_submit.py +119 -37
  346. package/index.js +1 -1
  347. package/package.json +5 -3
  348. package/skills/README.md +3 -5
  349. package/skills/agent-protocol/SKILL.md +17 -16
  350. package/skills/agent-protocol/examples.md +6 -6
  351. package/skills/agent-response/SKILL.md +11 -14
  352. package/skills/approval/SKILL.md +28 -13
  353. package/skills/approval/reference.md +2 -2
  354. package/skills/execution/SKILL.md +1 -1
  355. package/skills/gaia-patterns/SKILL.md +2 -3
  356. package/skills/orchestrator-approval/SKILL.md +22 -50
  357. package/skills/security-tiers/SKILL.md +1 -1
  358. package/templates/README.md +9 -9
  359. package/templates/managed-settings.template.json +43 -0
  360. package/tools/gaia_simulator/runner.py +34 -1
  361. package/tools/scan/orchestrator.py +13 -0
  362. package/tools/scan/scanners/base.py +8 -0
  363. package/tools/scan/scanners/git.py +78 -0
  364. package/tools/scan/scanners/infrastructure.py +65 -0
  365. package/tools/scan/scanners/stack.py +110 -0
  366. package/tools/scan/setup.py +120 -13
  367. package/tools/scan/workspace.py +85 -0
  368. package/config/context-contracts.aws.json +0 -42
  369. package/config/context-contracts.gcp.json +0 -39
  370. package/skills/project-dispatch/SKILL.md +0 -34
  371. package/templates/settings.template.json +0 -226
@@ -0,0 +1,39 @@
1
+ # Security Tiers -- Reference
2
+
3
+ Read on-demand by infrastructure agents. Not injected automatically.
4
+
5
+ ## Cloud-Specific Classification Examples
6
+
7
+ ### T0 -- Read-Only
8
+
9
+ - `kubectl get pods`, `kubectl get svc`, `kubectl describe node`
10
+ - `terraform show`, `terraform output`
11
+ - `gcloud describe`, `gcloud sql instances describe`, `gcloud container clusters list`
12
+ - `helm status`, `helm list`
13
+ - `flux get kustomizations`, `flux get sources`
14
+
15
+ ### T1 -- Validation
16
+
17
+ - `terraform validate`
18
+ - `helm lint`
19
+ - `tflint`
20
+ - `kustomize build`
21
+
22
+ ### T2 -- Simulation
23
+
24
+ - `terraform plan` / `terragrunt plan`
25
+ - `kubectl diff -f manifest.yaml`
26
+ - `helm upgrade --dry-run`
27
+ - `kubectl apply --dry-run=server`
28
+
29
+ ### Conditional (T0 or T3 depending on flags)
30
+
31
+ - `git branch` -- T0 for listing (no args or `--list`), T3 with `-D`, `-d`, `-m`, `-M`, `--delete`, `--move`
32
+
33
+ ### T3 -- Realization
34
+
35
+ - `terraform apply` / `terragrunt apply`
36
+ - `kubectl apply -f manifest.yaml`
37
+ - `helm upgrade` (without `--dry-run`)
38
+ - `flux reconcile` (write operations)
39
+ - `git commit`, `git push` (any branch)
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: skill-creation
3
+ description: Use when creating a new skill, improving an existing skill, or deciding what a skill should contain and how it should be structured
4
+ metadata:
5
+ user-invocable: false
6
+ type: technique
7
+ ---
8
+
9
+ # Skill Creation
10
+
11
+ ## What is a skill?
12
+
13
+ Injected procedural knowledge — the "how" for agents. The agent brings identity and domain knowledge. The skill brings process and protocol. They never duplicate each other.
14
+
15
+ ## Step 1: Choose the type
16
+
17
+ Type determines structure. Choose before writing anything.
18
+
19
+ | Type | Purpose | When it applies |
20
+ |------|---------|-----------------|
21
+ | **Discipline** | Enforces rules the agent will rationalize around under pressure | command-execution, execution |
22
+ | **Technique** | How to think about or approach a class of problem | investigation, approval |
23
+ | **Reference** | Lookup tables, classifications, format specifications | security-tiers, output-format, git-conventions |
24
+ | **Domain** | Project-specific patterns for a technical area | terraform-patterns, gitops-patterns |
25
+ | **Protocol** | System operating contract — state machines, mandatory formats | agent-protocol |
26
+
27
+ ## Step 2: Apply the type structure
28
+
29
+ ### Discipline
30
+ Iron Law → Mental Model → Rules → Traps → Anti-patterns
31
+
32
+ Discipline skills enforce behavior agents will try to avoid. Every trap you don't name explicitly is a loophole.
33
+
34
+ **Checklist:**
35
+ - [ ] Iron Law in a code block at the top — the rule, stated bluntly
36
+ - [ ] Mental model explains WHY (not just what not to do)
37
+ - [ ] Rules — the concrete constraints
38
+ - [ ] Traps table — "If you're thinking X → the reality is Y" (fuses red flags + rationalizations)
39
+ - [ ] Anti-patterns with real code examples
40
+
41
+ ### Technique
42
+ Overview (core principle + when to use) → Process (numbered steps) → Anti-patterns
43
+
44
+ ### Reference
45
+ Quick-scan table at top → Examples → Edge cases / special rules
46
+
47
+ ### Domain
48
+ Conventions (naming, structure) → Examples/snippets → Key rules → links to reference files
49
+
50
+ ### Protocol
51
+ State machine / flow → Mandatory format → State transitions → Error handling
52
+
53
+ ---
54
+
55
+ ## Step 3: Write the description field (CSO)
56
+
57
+ The description determines when the agent reads the skill. It must contain **triggering conditions only** — never summarize the process.
58
+
59
+ If the description says what the skill does step by step, the agent follows the description and skips reading the content.
60
+
61
+ ```yaml
62
+ # ❌ BAD — summarizes process, agent skips content
63
+ description: Defensive command execution - timeout protection, pipe avoidance, safe shell patterns
64
+
65
+ # ✅ GOOD — triggering conditions only
66
+ description: Use when executing any bash command, cloud CLI, or shell operation
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Step 4: Respect the line budget
72
+
73
+ | Injection method | Budget | Reason |
74
+ |-----------------|--------|--------|
75
+ | Frontmatter (always loaded) | < 100 lines | Loaded on every agent call |
76
+ | On-demand (read from disk) | < 500 lines | Loaded only when explicitly needed |
77
+
78
+ Heavy reference material → move to `reference.md` (read on-demand).
79
+ Concrete examples → move to `examples.md` (read on-demand).
80
+ Executable tools → `scripts/` directory.
81
+
82
+ ```
83
+ skill-name/
84
+ ├── SKILL.md ← main content (always loaded)
85
+ ├── reference.md ← heavy docs (on-demand)
86
+ ├── examples.md ← concrete examples (on-demand)
87
+ └── scripts/ ← executable tools
88
+ ```
89
+
90
+ ---
91
+
92
+ ## When to create vs update
93
+
94
+ **Create new skill:**
95
+ - Distinct behavioral concern not covered by any existing skill
96
+ - Domain knowledge living inline in an agent that applies to multiple agents
97
+
98
+ **Update existing skill:**
99
+ - Agent ignores a rule the skill already defines → strengthen with Red Flags
100
+ - Skill is missing a type-appropriate section
101
+
102
+ **Do NOT create a skill — put elsewhere:**
103
+ - Project-specific config → CLAUDE.md or agent inline
104
+ - Single-agent-only behavior → keep inline in that agent
105
+ - Knowledge the LLM covers well from training → not needed
106
+
107
+ ---
108
+
109
+ ## Anti-Patterns
110
+
111
+ **❌ Description summarizes process** — agent follows the description and skips reading the skill body
112
+
113
+ **❌ Discipline skill without Red Flags** — agents are smart; they rationalize. Every unnamed loophole gets used.
114
+
115
+ **❌ Too generic** — "be careful with commands" teaches nothing. Skills need specific, concrete rules.
116
+
117
+ **❌ Duplicates agent content** — two sources of truth both become stale. Pick one place.
118
+
119
+ **❌ Single responsibility violated** — if a skill needs to cover two distinct behaviors, split it into two skills.
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: specification
3
+ description: Use when the user describes a feature, problem, or need and a structured spec does not yet exist
4
+ metadata:
5
+ user-invocable: false
6
+ type: technique
7
+ ---
8
+
9
+ # Specification
10
+
11
+ **Orchestrator-only skill.** This skill is executed by the orchestrator, which
12
+ cannot read files, write files, or run commands. Every file I/O step must name
13
+ the delegation target (agent) explicitly. The orchestrator drives spec creation
14
+ through dialogue -- it never delegates spec authoring to an agent.
15
+
16
+ A spec captures WHAT to build and WHY.
17
+
18
+ **The line between spec and plan:**
19
+ - Technologies as problem context = OK in the spec. "The service needs a Cloud SQL
20
+ database for transaction storage" describes WHAT.
21
+ - Implementation details = NOT OK. "Create a Cloud SQL instance with db-f1-micro
22
+ tier in us-central1 using Terraform module google_sql_database_instance" is HOW.
23
+
24
+ The user will naturally mention technologies -- "deploy to GKE", "use Flux CD",
25
+ "set up a Cloud SQL database." That is part of the problem domain. Accept it.
26
+ What does NOT belong is file paths, class names, config values, or step-by-step
27
+ instructions.
28
+
29
+ ## When to Activate
30
+
31
+ Activate when ANY of these are true:
32
+ - User describes a feature, capability, or change they want
33
+ - User says "I want to build..." / "we need..." / "what if we..."
34
+ - User pastes a ticket, issue, or informal requirements
35
+ - The `planning_specs` surface is active and no `spec.md` exists yet
36
+
37
+ Do NOT activate when:
38
+ - A spec.md already exists and the user wants to plan or implement
39
+ - The user is asking about live infrastructure or runtime state
40
+
41
+ ## Step 1: Load Context and Constraints
42
+
43
+ Before asking the first question, delegate to the `gaia` agent to read:
44
+ - `governance.md` from the speckit root -- architectural principles, stack constraints
45
+ - `project-context.json` -- existing services, infrastructure, paths
46
+
47
+ **Discovering `speckit_root`:** The path is stored in `project-context.json` at
48
+ `paths.speckit_root`. The `gaia` agent resolves this during the read above. If
49
+ the key is missing, default to `specs/` relative to project root; if that also
50
+ does not exist, set status `BLOCKED` and ask the user for the path.
51
+
52
+ Extract:
53
+ - Mandatory architectural principles (GitOps, Workload Identity, etc.)
54
+ - Technology stack constraints (cloud provider, orchestration, IaC tool)
55
+ - Existing services and infrastructure that may overlap with the request
56
+
57
+ These feed your critical thinking. Do not dump them to the user -- use them
58
+ to ask better questions and catch problems early.
59
+
60
+ ## Step 2: Capture the Raw Idea
61
+
62
+ Let the user talk. This is brainstorming -- messy and nonlinear is fine.
63
+ Collect everything they say without restructuring yet.
64
+
65
+ Identify from their words:
66
+ - **Who benefits** -- the actor or stakeholder
67
+ - **What problem** they face today
68
+ - **What outcome** they want
69
+ - **What triggers** the need (event, pain point, dependency)
70
+
71
+ If any of these four are missing after the user's initial description,
72
+ ask ONE focused question to fill the biggest gap. Do not interrogate.
73
+ Prefer "What problem does this solve?" over a list of five questions.
74
+
75
+ ## Step 3: Challenge and Clarify
76
+
77
+ This is where the orchestrator earns its keep. Do not just transcribe --
78
+ think critically about what the user is asking.
79
+
80
+ **Proactive checks (run these against loaded context):**
81
+ - Does an existing service already cover this? Alert: "The project already
82
+ has a payment service at services/payments/ -- is this replacing it or
83
+ something separate?"
84
+ - Does the request conflict with governance? Alert: "Governance mandates
85
+ ArgoCD but you mentioned Flux -- is there a reason to diverge?"
86
+ - Is there unnecessary complexity? Push back: "Do you really need a separate
87
+ microservice, or could this be a module in the existing order service?"
88
+ - Do stated requirements match the acceptance criteria? Challenge: "You said
89
+ real-time notifications, but the acceptance criteria suggest hourly batches
90
+ would satisfy the users. Which is it?"
91
+
92
+ **Say NO when something does not make sense.** If the request contradicts
93
+ governance, duplicates existing work, or introduces unjustified complexity,
94
+ surface that clearly. The user can override, but they should do it consciously.
95
+
96
+ **Clarifying questions** -- ask at most 3 rounds. Each round: one question,
97
+ wait for the answer, integrate it. Stop asking when:
98
+ - You can write a problem statement without guessing
99
+ - You can list at least 2 acceptance scenarios
100
+ - Scope boundaries are clear (what is IN, what is OUT)
101
+
102
+ Good clarifying questions:
103
+ - "What should happen when [edge case]?"
104
+ - "Is [adjacent feature] in scope or separate?"
105
+ - "Who else uses this besides [primary actor]?"
106
+ - "What does success look like from the user's perspective?"
107
+
108
+ Bad clarifying questions (never ask these):
109
+ - "How should the database schema look?" (implementation detail)
110
+ - "What API endpoints do you need?" (implementation detail)
111
+ - "Which Terraform module should we use?" (implementation detail)
112
+
113
+ ## Step 4: Draft the Spec
114
+
115
+ Organize findings into this structure. Use the spec template from
116
+ `speckit/templates/spec-template.md` as the canonical format.
117
+
118
+ **Mandatory sections:**
119
+
120
+ 1. **Problem Statement** -- 2-3 sentences. The pain point and who feels it.
121
+
122
+ 2. **User Stories** -- "As [actor], I want [goal], so that [benefit]."
123
+ Minimum 1, maximum 5. Each must name a real actor, not "the system."
124
+
125
+ 3. **Acceptance Criteria** -- Given/When/Then format. At least one per
126
+ user story. These are the contract the implementation must satisfy.
127
+
128
+ 4. **Scope Boundaries** -- Two columns: IN scope / OUT of scope.
129
+ Explicit exclusions prevent scope creep during planning.
130
+
131
+ 5. **Constraints** -- Pull from governance.md. Only list constraints
132
+ that are relevant to this feature. Do not dump the entire governance.
133
+
134
+ 6. **Key Entities** -- If the feature involves data, name the entities
135
+ and their relationships in plain language. No field types, no schemas.
136
+
137
+ **Optional sections** (include only when relevant):
138
+
139
+ - **Edge Cases** -- What happens when [boundary condition]?
140
+ - **Security Considerations** -- If the feature handles auth, PII, or secrets
141
+ - **Performance Expectations** -- Only if the user stated targets
142
+
143
+ Mark anything uncertain with `[NEEDS CLARIFICATION: specific question]`.
144
+
145
+ ## Step 5: Present for Review
146
+
147
+ Show the full draft spec to the user. Ask:
148
+ - "Does this capture what you want?"
149
+ - "Anything missing or wrong?"
150
+ - "Are the scope boundaries right?"
151
+
152
+ Iterate until the user approves. Each iteration: apply their feedback,
153
+ show the updated section (not the full spec again), confirm.
154
+
155
+ ## Step 6: Save
156
+
157
+ When the user approves, delegate to the `devops-developer` agent to save
158
+ `spec.md` in the feature directory: `{speckit_root}/{feature-name}/spec.md`.
159
+
160
+ The feature directory name: lowercase, hyphenated, descriptive.
161
+ Example: `payment-gateway`, `user-notifications`, `report-export`.
162
+
163
+ After saving, suggest: "The spec is ready. Want me to start planning?"
164
+ This transitions to the `speckit-planner` agent via the `/speckit.plan` skill
165
+ invocation (not a shell command -- it is a slash-command that the orchestrator
166
+ dispatches as a skill).
167
+
168
+ ## Quality Checks
169
+
170
+ Before presenting the draft, verify:
171
+ - [ ] Every user story names a real actor (not "the system")
172
+ - [ ] Every acceptance criterion is testable without knowing the implementation
173
+ - [ ] Technologies appear only as problem context, never as implementation instructions
174
+ - [ ] Scope boundaries explicitly exclude at least one adjacent concern
175
+ - [ ] Constraints come from governance, not from assumptions
176
+ - [ ] Problem statement explains WHY, not WHAT to build
177
+
178
+ ## Anti-Patterns
179
+
180
+ - **Agreeable transcriber** -- just writing down what the user says without questioning it. The orchestrator guides, challenges, and shapes.
181
+ - **Interrogation** -- asking 10 questions before writing anything. Capture first, clarify gaps.
182
+ - **Premature structure** -- forcing the user into Given/When/Then before they have finished describing the idea.
183
+ - **Technology ban** -- rejecting all technology mentions. "Deploy to GKE with Flux CD" is problem context, not implementation detail.
184
+ - **Completionism** -- trying to spec every edge case. The plan phase handles depth.
185
+ - **Skipping governance** -- writing a spec that violates known constraints, wasting plan time.
186
+ - **Ignoring existing state** -- not checking project-context for services or infrastructure that overlap with the request.
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: speckit-workflow
3
+ description: Use when planning features using the Spec-Kit framework (plan, tasks)
4
+ metadata:
5
+ user-invocable: false
6
+ ---
7
+
8
+ # Spec-Kit Workflow
9
+
10
+ Domain workflow for feature planning. Artifacts go to `{speckit_root}/{feature-name}/`.
11
+ Templates live at `{project-root}/speckit/templates/`. Read the template before generating any artifact.
12
+
13
+ **Path resolution:** `speckit_root` comes from project-context.json `paths.speckit_root`. Default: `specs/` relative to project root. The agent definition's Context Resolution section is authoritative for path resolution.
14
+
15
+ ## Flow
16
+
17
+ ```
18
+ Completed spec.md (from orchestrator)
19
+ |
20
+ Plan -> plan.md + research.md + data-model.md + contracts/
21
+ |
22
+ Tasks -> tasks.md (enriched, self-contained)
23
+ |
24
+ Return to orchestrator (routes tasks to agents)
25
+ ```
26
+
27
+ ## Phase 0: Governance Sync (MANDATORY before any phase)
28
+
29
+ 1. Read `project-context.json`. Missing -> BLOCKED, ask user for `npx gaia-scan`.
30
+ 2. Update `## Stack Definition` in `{speckit_root}/governance.md` from project-context.
31
+ Missing governance.md -> create from template. Exists -> update Stack Definition only.
32
+ 3. Read updated governance.md -- this is your working context for all phases.
33
+
34
+ ---
35
+
36
+ ## Phase 1: Plan
37
+
38
+ **Input:** Validated `spec.md` (no unresolved `[NEEDS CLARIFICATION]`).
39
+ **Output:** `plan.md`, `research.md`, `data-model.md`, `contracts/`, `quickstart.md`.
40
+ **Template:** Read `speckit/templates/plan-template.md` FIRST.
41
+
42
+ ### Procedure
43
+
44
+ 1. **Verify prerequisite.** Read spec.md. If missing -> BLOCKED, ask orchestrator to provide a completed spec. If unresolved
45
+ `[NEEDS CLARIFICATION]` markers remain -> STOP, resolve them first.
46
+
47
+ 2. **Initialize plan.md** from the plan template. If plan.md already exists, skip (do not overwrite).
48
+
49
+ 3. **Clarify planning ambiguities** (max 5 questions):
50
+ - Scan for: functional scope, data model gaps, non-functional targets,
51
+ integration unknowns, edge cases, vague terminology.
52
+ - Ask one question at a time. Integrate answers into spec.md immediately.
53
+
54
+ 4. **Fill Technical Context** in plan.md:
55
+ - Language/version, dependencies, storage, testing framework, target platform.
56
+ - Ask user for anything you cannot infer.
57
+
58
+ 5. **Run Constitution Check** against governance.md:
59
+ - GitOps patterns enforced? HTTPS for external endpoints? Health checks?
60
+ No `:latest` image tags? Scope boundaries respected?
61
+ - Violations -> document in Complexity Tracking with justification.
62
+ - Unjustifiable violations -> ERROR "Simplify approach first."
63
+
64
+ 6. **Phase 0 -- Research.** For each unknown or technology choice:
65
+ - Research best practices. Consolidate in `research.md` with:
66
+ Decision, Rationale, Alternatives considered.
67
+
68
+ 7. **Phase 1 -- Design.** From spec + research:
69
+ - Extract entities -> `data-model.md` (fields, relationships, validations).
70
+ - Generate API contracts from functional requirements -> `contracts/` directory.
71
+ - Generate failing contract tests (one per endpoint).
72
+ - Extract test scenarios from user stories -> `quickstart.md`.
73
+
74
+ 8. **Re-run Constitution Check.** New violations -> refactor, return to step 7.
75
+
76
+ 9. **Describe Phase 2 task approach** in plan.md -- do NOT create tasks.md.
77
+
78
+ 10. **STOP.** Plan phase is complete. Suggest next step: `/speckit.tasks`.
79
+
80
+ ---
81
+
82
+ ## Phase 2: Tasks
83
+
84
+ **Input:** `plan.md` + available design docs (`data-model.md`, `contracts/`, `research.md`).
85
+ **Output:** `{feature-dir}/tasks.md`.
86
+ **Template:** Read `speckit/templates/tasks-template.md` FIRST.
87
+
88
+ ### Procedure
89
+
90
+ 1. **Verify prerequisite.** plan.md must exist. If missing -> ERROR.
91
+
92
+ 2. **Load all available design documents:**
93
+ - plan.md (REQUIRED) -- tech stack, architecture, file structure.
94
+ - data-model.md (if exists) -- entities and relationships.
95
+ - contracts/ (if exists) -- API specifications.
96
+ - research.md (if exists) -- technical decisions.
97
+ - quickstart.md (if exists) -- test scenarios.
98
+
99
+ 3. **Read the tasks template** from `speckit/templates/tasks-template.md`.
100
+
101
+ 4. **Generate tasks by category:**
102
+ - **Setup:** Project init, dependencies, linting, config.
103
+ - **Tests [P]:** One per contract, one per integration scenario (TDD -- tests first).
104
+ - **Core:** One per entity model, one per service, one per endpoint/command.
105
+ - **Integration:** DB connections, middleware, logging, external services.
106
+ - **Polish [P]:** Unit tests, performance tests, docs, cleanup.
107
+
108
+ 5. **Apply parallelism rules:**
109
+ - Different files with no shared dependencies -> mark `[P]`.
110
+ - Same file -> sequential (no `[P]`).
111
+
112
+ 6. **Order by dependency:**
113
+ Setup -> Tests -> Models -> Services -> Endpoints -> Integration -> Polish.
114
+
115
+ 7. **Enrich EVERY task with inline metadata:**
116
+ ```markdown
117
+ - [ ] T001 Description
118
+ - context: relevant plan slice (tech stack, architecture decisions)
119
+ - files: expected file paths
120
+ - depends-on: task IDs or `none`
121
+ - exit-criteria: `command` expected outcome
122
+ - suggested-agent: {agent}
123
+ - tier: {T0|T1|T2|T3}
124
+ <!-- Tags: #tag1 #tag2 -->
125
+ ```
126
+ - **Agent:** terraform keywords -> `terraform-architect`, kubectl/helm -> `gitops-operator`,
127
+ code/test/build -> `devops-developer`, logs/monitoring -> `cloud-troubleshooter`.
128
+ - **Tier:** T0 (read), T1 (validate), T2 (simulate), T3 (mutate).
129
+ - **Tags:** tech (#terraform, #kubernetes), domain (#database, #security), type (#setup, #test).
130
+ - **T2/T3 tasks** get: `<!-- HIGH RISK: Analyze before execution -->`.
131
+
132
+ 8. **CRITICAL -- every task MUST include:**
133
+ - An `exit-criteria:` line with a command or observable outcome.
134
+ - Enough context for the executing agent to work without loading multiple files.
135
+
136
+ 9. **Generate dependency graph** in YAML at the bottom of tasks.md.
137
+
138
+ 10. **Cross-artifact validation:**
139
+ - All spec requirements covered by at least one task?
140
+ - All contracts have test tasks? All entities have model tasks?
141
+ - CRITICAL gaps -> pause, require user approval.
142
+ - LOW/MEDIUM gaps -> add notes to Dependencies section.
143
+
144
+ 11. **Report** with: task count, coverage percentage, any issues found.
145
+ Tasks are returned to the orchestrator for execution.
146
+
147
+ ---
148
+
149
+ ## Task Enrichment Rules (applies to Phase 2)
150
+
151
+ Every task gets automatic metadata:
152
+ - **Agent:** detect from keywords (terraform -> `terraform-architect`, kubectl -> `gitops-operator`,
153
+ code/test -> `devops-developer`, monitoring/logs -> `cloud-troubleshooter`).
154
+ - **Security Tier:** classify using `security-tiers` skill.
155
+ - **Tags:** technology (#terraform, #kubernetes), domain (#database, #security), type (#setup, #test).
156
+ - **Exit criteria:** a command or observable outcome confirming completion.
157
+ - **Context slice:** relevant portion of the plan so the task is self-contained.
158
+
159
+ ## Critical Rules
160
+
161
+ 1. **Always read templates** from `speckit/templates/` before generating any artifact.
162
+ 2. Every task MUST include: exit criteria + enough inline context to be self-contained.
163
+ 3. Tasks must be **self-contained** -- executable by the assigned agent without SpecKit knowledge.
164
+ 4. Each phase STOPS at its boundary. Do not auto-advance to the next phase.
165
+ 5. Spec is WHAT (no implementation details). Plan is HOW. Tasks are DO.
@@ -0,0 +1,117 @@
1
+ # Spec-Kit Workflow -- Reference
2
+
3
+ For full templates, read from `{project-root}/speckit/templates/`. The templates below are summaries only.
4
+
5
+ ## Template Paths
6
+
7
+ | Artifact | Template path |
8
+ |----------|---------------|
9
+ | spec.md | `speckit/templates/spec-template.md` |
10
+ | plan.md | `speckit/templates/plan-template.md` |
11
+ | tasks.md | `speckit/templates/tasks-template.md` |
12
+
13
+ ## Artifact Summary: spec.md
14
+
15
+ Spec creation is handled conversationally by the orchestrator. The speckit-planner receives a completed spec.md as input.
16
+
17
+ ```markdown
18
+ # Feature Specification: [FEATURE NAME]
19
+
20
+ **Feature Branch**: `[###-feature-name]`
21
+ **Created**: [DATE]
22
+ **Status**: Draft
23
+
24
+ ## User Scenarios & Testing *(mandatory)*
25
+ ### Primary User Story
26
+ ### Acceptance Scenarios (Given/When/Then)
27
+ ### Edge Cases
28
+
29
+ ## Requirements *(mandatory)*
30
+ ### Functional Requirements (FR-001, FR-002...)
31
+ ### Key Entities *(if data involved)*
32
+
33
+ ## Review Checklist
34
+ - [ ] No implementation details
35
+ - [ ] Requirements testable and unambiguous
36
+ - [ ] All [NEEDS CLARIFICATION] resolved
37
+ ```
38
+
39
+ ## Artifact Summary: plan.md
40
+
41
+ ```markdown
42
+ # Implementation Plan: [FEATURE]
43
+
44
+ ## Summary
45
+ ## Technical Context (Language, Dependencies, Storage, Testing)
46
+ ## Constitution Check (GitOps, Security, Scope)
47
+ ## Project Structure (docs + source code layout)
48
+ ## Phase 0: Research -> research.md
49
+ ## Phase 1: Design -> data-model.md, contracts/, quickstart.md
50
+ ## Phase 2: Task Planning Approach (describe only, do NOT create tasks.md)
51
+ ## Progress Tracking
52
+ ```
53
+
54
+ ## Artifact Summary: tasks.md
55
+
56
+ Every task MUST include exit criteria and enough inline context to be self-contained.
57
+
58
+ ```markdown
59
+ # Tasks: [FEATURE NAME]
60
+
61
+ ## Phase 1: Setup
62
+ - [ ] T001 Create project structure
63
+ - context: NestJS project, TypeScript 5.x, PostgreSQL
64
+ - files: src/modules/auth/{controller,service,module}.ts
65
+ - depends-on: none
66
+ - exit-criteria: `ls src/modules/auth/` shows controller.ts, service.ts, module.ts
67
+ - suggested-agent: devops-developer
68
+ - tier: T0
69
+ <!-- Tags: #setup #config -->
70
+
71
+ ## Phase 2: Tests First (TDD)
72
+ - [ ] T004 [P] Contract test POST /api/users
73
+ - context: REST API, Jest testing framework
74
+ - files: tests/contract/test_users_post.py
75
+ - depends-on: T001
76
+ - exit-criteria: `pytest tests/contract/test_users_post.py` runs (fails before impl)
77
+ - suggested-agent: devops-developer
78
+ - tier: T1
79
+ <!-- Tags: #test #api -->
80
+
81
+ ## Phase 3: Core Implementation
82
+ ## Phase 4: Integration
83
+ ## Phase 5: Polish
84
+ ## Dependencies (YAML dependency graph)
85
+ ```
86
+
87
+ **High-risk tasks (T2/T3):**
88
+
89
+ ```markdown
90
+ - [ ] T042 Apply Terraform changes to production
91
+ - context: VPC module, shared networking layer
92
+ - files: terraform/modules/vpc/main.tf
93
+ - depends-on: T041
94
+ - exit-criteria: `terraform show` confirms expected resources
95
+ - suggested-agent: terraform-architect
96
+ - tier: T3
97
+ <!-- Tags: #terraform #infrastructure #production -->
98
+ <!-- HIGH RISK: Analyze before execution -->
99
+ ```
100
+
101
+ ## Agent Routing Signals
102
+
103
+ | Signals in task | Agent |
104
+ |-----------------|-------|
105
+ | terraform, .tf, vpc, gke, iam | `terraform-architect` |
106
+ | kubectl, helm, flux, k8s, deployment | `gitops-operator` |
107
+ | gcloud, cloud logging, runtime drift | `cloud-troubleshooter` |
108
+ | docker, npm, build, test, CI, code | `devops-developer` |
109
+
110
+ ## Security Tier Detection
111
+
112
+ | Tier | Verbs |
113
+ |------|-------|
114
+ | T0 | describe, get, show, list, logs, read |
115
+ | T1 | validate, lint, template, format |
116
+ | T2 | plan, dry-run, diff |
117
+ | T3 | apply, push, create, delete, deploy |
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: terraform-patterns
3
+ description: Use when creating, modifying, or reviewing Terraform or Terragrunt configuration files
4
+ metadata:
5
+ user-invocable: false
6
+ type: domain
7
+ ---
8
+
9
+ # Terraform Patterns
10
+
11
+ Project-specific conventions. Use values from your injected project-context — never hardcode project IDs, regions, or account identifiers.
12
+
13
+ For HCL examples (remote state, component structure, labels, outputs), read `reference.md` in this directory.
14
+
15
+ ## Directory Structure
16
+
17
+ ```
18
+ terraform/
19
+ └── [module-name]/
20
+ ├── main.tf # Resource definitions
21
+ ├── variables.tf # Input variables
22
+ ├── outputs.tf # Output values (snake_case, with descriptions)
23
+ └── provider.tf # Provider config (if module-level)
24
+
25
+ features/infra/[env]/
26
+ ├── terragrunt.hcl # Root: remote state config
27
+ └── [component]/
28
+ └── terragrunt.hcl # Component: inputs + dependency references
29
+ ```
30
+
31
+ ## Naming Convention
32
+
33
+ | Resource | Pattern | Notes |
34
+ |----------|---------|-------|
35
+ | Network/VPC | `{app}-{env}-vpc` | From context: project + env |
36
+ | Cluster | `{app}-{env}-cluster-{n}` | Match context cluster_name |
37
+ | Database | `{app}-{env}-{engine}-instance` | Engine: postgres, mysql |
38
+ | Secret | `{service}-secret` | Matches app service name |
39
+ | Service Account | `{resource}-sa` | Scope: resource it serves |
40
+
41
+ ## Module Sourcing
42
+
43
+ - **Local modules** (preferred for GCP): `../../../../../terraform//{module-name}`
44
+ - **Registry modules** (preferred for AWS): `tfr:///terraform-aws-modules/{module}/aws?version=x.y.z`
45
+ - **Always pin exact versions** — never `latest`, never unpinned
46
+
47
+ ## Key Rules
48
+
49
+ 1. **Prefer Terragrunt** — prefer `terragrunt` commands for all environment operations; raw `terraform` is acceptable for module development and testing only
50
+ 2. **Dependencies via blocks** — never hardcode IDs, always `dependency.x.outputs.y`
51
+ 3. **Version pinning** — exact versions for modules, `~>` for providers
52
+ 4. **Tags on everything** — all resources get the standard label block
53
+ 5. **snake_case outputs** — descriptive names with `description` field
54
+ 6. **mock_outputs on dependencies** — required for `validate` and `plan` to work offline
55
+
56
+ ## Reference Docs
57
+
58
+ Use `WebFetch` when a resource or attribute is unknown or ambiguous. Do not use WebFetch to discover patterns — the codebase always wins over external docs.
59
+
60
+ | Need | URL |
61
+ |------|-----|
62
+ | Google provider resources | `https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/{resource}` |
63
+ | Terragrunt config blocks | `https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes` |