@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,61 @@
1
+ ---
2
+ name: security-tiers
3
+ description: Use when classifying any operation before executing it, or deciding whether user approval is required
4
+ metadata:
5
+ user-invocable: false
6
+ type: reference
7
+ ---
8
+
9
+ # Security Tiers
10
+
11
+ ## Classification Principle
12
+
13
+ Before executing any command, classify it by asking:
14
+
15
+ 1. **Does it modify live state?** (create, update, delete, apply, push) -- **T3**
16
+ 2. **Does it simulate changes?** (plan, diff, dry-run) -- **T2**
17
+ 3. **Does it validate locally?** (validate, lint, fmt, check) -- **T1**
18
+ 4. **Is it read-only?** (get, list, describe, show, logs) -- **T0**
19
+
20
+ ## Tier Definitions
21
+
22
+ | Tier | Name | Side Effects | Approval |
23
+ |------|------|-------------|----------|
24
+ | **T0** | Read-Only | None | No |
25
+ | **T1** | Validation | None (local only) | No |
26
+ | **T2** | Simulation | None (dry-run) | No |
27
+ | **T3** | Realization | **Modifies state** | **Yes** |
28
+
29
+ ## Examples (anchors, not exhaustive)
30
+
31
+ Classify using your own tools. Common verb patterns:
32
+
33
+ - **T0**: read, get, list, describe, show, logs, status
34
+ - **T1**: validate, lint, fmt, check, build (local)
35
+ - **T2**: plan, diff, dry-run
36
+ - **T3**: apply, create, delete, commit, push, deploy
37
+
38
+ For cloud-specific command examples (kubectl, terraform, gcloud, helm, flux), see `reference.md` in this skill directory.
39
+
40
+ ## Hook Enforcement
41
+
42
+ The pre_tool_use hook is the primary security gate. With `Bash(*)` in the allow list, all commands reach the hook. Two modules, elimination logic:
43
+
44
+ 1. **blocked_commands.py** -- pattern-matched irreversible commands, permanently denied (exit 2)
45
+ 2. **mutative_verbs.py** -- CLI-agnostic verb detection, nonce-based approval flow
46
+
47
+ Everything that is not blocked and not mutative is safe by elimination. There is no separate safe-commands list.
48
+
49
+ Runtime is the single source of truth for nonce handling, grant scope, and
50
+ approval enforcement. This skill teaches classification and decision-making; it
51
+ does not replace the hook contract.
52
+
53
+ Conditional commands like `git branch` are safe for listing but T3 with mutative flags (`-D`, `-d`, `-m`). See `reference.md`.
54
+
55
+ ## T3 Workflow
56
+
57
+ For T3 operations, follow the state flow in `agent-protocol`: IN_PROGRESS -- REVIEW -- IN_PROGRESS -- COMPLETE (plan-first or hook-blocked with approval_id).
58
+
59
+ On-demand workflow skills (read from disk when needed):
60
+ - `.claude/skills/approval/SKILL.md` -- informed-consent plan quality and approval presentation
61
+ - `.claude/skills/execution/SKILL.md` -- post-approval execution discipline and verification
@@ -0,0 +1,623 @@
1
+ # Destructive vs Mutative Command Reference
2
+
3
+ Comprehensive classification of CLI commands across all managed tool families.
4
+ Two categories:
5
+
6
+ - **DESTRUCTIVE (permanently blocked)**: Irreversible damage at scale. Cannot be approved via nonce.
7
+ - **MUTATIVE (approvable T3)**: Modifies state but is a normal operational command. Approved via nonce workflow.
8
+
9
+ ---
10
+
11
+ ## 1. Terraform / Terragrunt
12
+
13
+ ### Verb vocabulary
14
+
15
+ Terraform uses `destroy`, `apply`, `plan`, `init`, `validate`, `show`, `output`, `fmt`, `import`, `state`, `taint`, `untaint`, `refresh`, `force-unlock`.
16
+
17
+ `destroy` is the only CLI in scope that uses the verb "destroy" as a first-class subcommand.
18
+
19
+ ### DESTRUCTIVE (permanently blocked)
20
+
21
+ | Command / Pattern | Reason |
22
+ |---|---|
23
+ | `terraform destroy` (without `-target`) | Destroys entire state -- all resources in the workspace |
24
+ | `terragrunt destroy-all` / `terragrunt run-all destroy` | Recursive destruction of all modules |
25
+ | `terraform state rm` (without specific resource) | Removes resources from state; orphans real infra |
26
+
27
+ ### MUTATIVE (approvable T3)
28
+
29
+ | Command / Pattern | Notes |
30
+ |---|---|
31
+ | `terraform apply` | Normal realization |
32
+ | `terraform destroy -target=<resource>` | Targeted single-resource destroy |
33
+ | `terragrunt apply` | Normal realization |
34
+ | `terraform import` | Imports existing infra into state |
35
+ | `terraform state mv` | Moves resources between state addresses |
36
+ | `terraform taint` / `terraform untaint` | Marks resource for recreation |
37
+ | `terraform force-unlock` | Unlocks stuck state lock |
38
+
39
+ ### Edge cases
40
+
41
+ - `terraform apply` with a saved plan from `terraform plan -destroy` effectively runs a destroy -- but the hook sees `apply`, not `destroy`. This is acceptable because the plan was reviewed at plan time.
42
+ - `terragrunt run-all apply` is mutative (approvable), not destructive, because it applies existing plans.
43
+
44
+ ---
45
+
46
+ ## 2. kubectl
47
+
48
+ ### Verb vocabulary
49
+
50
+ kubectl uses `get`, `describe`, `logs`, `apply`, `create`, `delete`, `patch`, `edit`, `scale`, `rollout`, `exec`, `port-forward`, `drain`, `cordon`, `uncordon`, `taint`, `label`, `annotate`, `top`, `auth`, `explain`, `diff`, `cp`.
51
+
52
+ kubectl uses `delete` -- never `destroy` or `remove`.
53
+
54
+ ### DESTRUCTIVE (permanently blocked)
55
+
56
+ | Command / Pattern | Reason |
57
+ |---|---|
58
+ | `kubectl delete namespace <name>` | Cascading deletion of ALL resources in namespace |
59
+ | `kubectl delete ns <name>` | Short form of above |
60
+ | `kubectl delete node <name>` | Removes node from cluster |
61
+ | `kubectl delete cluster <name>` | Removes entire cluster |
62
+ | `kubectl delete pv <name>` / `persistentvolume` | Data loss -- underlying storage may be deleted |
63
+ | `kubectl delete pvc <name>` / `persistentvolumeclaim` | Triggers PV reclaim policy, potential data loss |
64
+ | `kubectl delete crd <name>` / `customresourcedefinition` | Destroys ALL custom resources of that type cluster-wide |
65
+ | `kubectl delete mutatingwebhookconfiguration <name>` | Breaks admission control |
66
+ | `kubectl delete validatingwebhookconfiguration <name>` | Breaks admission control |
67
+ | `kubectl drain <node>` | Evicts all pods, causes service disruption |
68
+ | `kubectl delete <type> --all --all-namespaces` | Deletes ALL resources of that type across the entire cluster |
69
+ | `kubectl delete all --all` | Deletes all standard resources in current namespace |
70
+
71
+ ### MUTATIVE (approvable T3)
72
+
73
+ | Command / Pattern | Notes |
74
+ |---|---|
75
+ | `kubectl apply -f <manifest>` | Normal desired-state application |
76
+ | `kubectl create <resource>` | Creates individual resource |
77
+ | `kubectl delete pod <name>` | Pod deletion -- pod is recreated by controller |
78
+ | `kubectl delete deployment <name>` | Removes single deployment |
79
+ | `kubectl delete service <name>` | Removes single service |
80
+ | `kubectl delete configmap <name>` | Removes single configmap |
81
+ | `kubectl delete secret <name>` | Removes single secret |
82
+ | `kubectl delete job <name>` | Removes single job |
83
+ | `kubectl delete clusterrole <name>` | RBAC modification, recoverable |
84
+ | `kubectl delete clusterrolebinding <name>` | RBAC modification, recoverable |
85
+ | `kubectl scale deployment <name> --replicas=N` | Scaling |
86
+ | `kubectl rollout restart deployment <name>` | Rolling restart |
87
+ | `kubectl rollout undo deployment <name>` | Rollback |
88
+ | `kubectl patch <resource>` | Partial update |
89
+ | `kubectl edit <resource>` | Interactive edit |
90
+ | `kubectl label <resource>` | Metadata modification |
91
+ | `kubectl annotate <resource>` | Metadata modification |
92
+ | `kubectl cordon <node>` | Marks node unschedulable (no eviction) |
93
+ | `kubectl uncordon <node>` | Marks node schedulable |
94
+ | `kubectl taint <node>` | Node scheduling preference |
95
+ | `kubectl exec <pod> -- <command>` | Runs command in pod |
96
+ | `kubectl cp <src> <dest>` | Copies files to/from pod |
97
+
98
+ ### Dangerous flags that escalate context
99
+
100
+ | Flag | Effect |
101
+ |---|---|
102
+ | `--all` | With destructive verb: deletes all resources of that type |
103
+ | `--all-namespaces` / `-A` | Extends scope to entire cluster |
104
+ | `--force` | Bypasses graceful deletion |
105
+ | `--grace-period=0` | Immediate forced deletion |
106
+ | `--cascade=orphan` | Leaves dependent resources orphaned |
107
+
108
+ ---
109
+
110
+ ## 3. gcloud / gsutil
111
+
112
+ ### Verb vocabulary
113
+
114
+ gcloud uses `create`, `delete`, `update`, `describe`, `list`, `set`, `get`, `deploy`, `disable`, `enable`, `reset`, `start`, `stop`, `resize`, `ssh`, `scp`.
115
+
116
+ gcloud uses `delete` -- never `destroy`, `remove`, or `terminate`.
117
+
118
+ gsutil uses `rm`, `rb`, `cp`, `mv`, `ls`, `cat`, `stat`, `rsync`.
119
+
120
+ ### DESTRUCTIVE (permanently blocked)
121
+
122
+ | Command / Pattern | Reason |
123
+ |---|---|
124
+ | `gcloud projects delete <project>` | Entire project and ALL resources within it |
125
+ | `gcloud container clusters delete <cluster>` | Entire GKE cluster and workloads |
126
+ | `gcloud sql instances delete <instance>` | Database instance and all databases/data |
127
+ | `gcloud sql databases delete <db>` | Database and all data within it |
128
+ | `gcloud services disable <api>` | Can break all dependent resources silently |
129
+ | `gsutil rb gs://<bucket>` | Irreversible bucket removal |
130
+ | `gsutil rm -r gs://<bucket>/*` | Recursive deletion of all objects in bucket |
131
+ | `gcloud organizations delete <org>` | Entire organization (if exposed) |
132
+
133
+ ### MUTATIVE (approvable T3)
134
+
135
+ | Command / Pattern | Notes |
136
+ |---|---|
137
+ | `gcloud compute instances delete <instance>` | Single VM deletion |
138
+ | `gcloud compute instances create <instance>` | VM creation |
139
+ | `gcloud compute instances start/stop <instance>` | Instance lifecycle |
140
+ | `gcloud compute instances reset <instance>` | Instance reboot |
141
+ | `gcloud compute firewall-rules delete <rule>` | Single firewall rule |
142
+ | `gcloud compute firewall-rules create <rule>` | Firewall creation |
143
+ | `gcloud compute networks delete <network>` | Single network (fails if in use) |
144
+ | `gcloud compute disks delete <disk>` | Single disk |
145
+ | `gcloud compute images delete <image>` | Single image |
146
+ | `gcloud compute snapshots delete <snapshot>` | Single snapshot |
147
+ | `gcloud container node-pools delete <pool>` | Single node pool |
148
+ | `gcloud container node-pools create <pool>` | Node pool creation |
149
+ | `gcloud iam roles delete <role>` | IAM role deletion |
150
+ | `gcloud iam service-accounts delete <sa>` | Service account deletion |
151
+ | `gcloud storage rm gs://bucket/object` | Single object deletion |
152
+ | `gcloud functions delete <function>` | Single function deletion |
153
+ | `gcloud run services delete <service>` | Single Cloud Run service |
154
+ | `gcloud dns record-sets delete <record>` | DNS record modification |
155
+ | `gcloud deploy releases promote` | Deployment promotion |
156
+
157
+ ---
158
+
159
+ ## 4. AWS CLI
160
+
161
+ ### Verb vocabulary
162
+
163
+ AWS uses hyphenated subcommands: `create-*`, `delete-*`, `describe-*`, `list-*`, `get-*`, `put-*`, `update-*`, `terminate-*`, `deregister-*`, `detach-*`, `remove-*`, `modify-*`, `start-*`, `stop-*`, `reboot-*`.
164
+
165
+ AWS uses `delete-*` and `terminate-*` -- never `destroy`.
166
+
167
+ ### DESTRUCTIVE (permanently blocked)
168
+
169
+ | Command / Pattern | Reason |
170
+ |---|---|
171
+ | `aws ec2 delete-vpc` | VPC and all networking infra |
172
+ | `aws ec2 delete-subnet` | Subnet removal, network topology change |
173
+ | `aws ec2 delete-internet-gateway` | Breaks internet connectivity for VPC |
174
+ | `aws ec2 delete-route-table` | Breaks routing for VPC |
175
+ | `aws ec2 delete-route` | Breaks specific routing |
176
+ | `aws rds delete-db-instance` | Database instance and data |
177
+ | `aws rds delete-db-cluster` | Aurora cluster and all instances |
178
+ | `aws dynamodb delete-table` | Table and ALL data permanently |
179
+ | `aws s3 rb` | Bucket removal (irreversible) |
180
+ | `aws s3api delete-bucket` | Bucket removal (irreversible) |
181
+ | `aws elasticache delete-cache-cluster` | Cache cluster and data |
182
+ | `aws elasticache delete-replication-group` | Replication group and data |
183
+ | `aws eks delete-cluster` | Entire EKS cluster |
184
+ | `aws ec2 terminate-instances` | Instance termination is irreversible -- use Terraform/Terragrunt |
185
+ | `aws kms schedule-key-deletion` | KMS key -- all encrypted data becomes unrecoverable |
186
+ | `aws organizations delete-organization` | Entire AWS Organization |
187
+ | `aws route53 delete-hosted-zone` | DNS zone and all records |
188
+ | `aws s3 rm --recursive` (entire bucket) | All objects in bucket |
189
+
190
+ ### MUTATIVE (approvable T3)
191
+
192
+ | Command / Pattern | Notes |
193
+ |---|---|
194
+ | `aws ec2 delete-key-pair` | SSH key removal |
195
+ | `aws ec2 delete-snapshot` | Single snapshot |
196
+ | `aws ec2 delete-volume` | Single EBS volume |
197
+ | `aws ec2 delete-security-group` | Single security group |
198
+ | `aws ec2 delete-network-interface` | Single ENI |
199
+ | `aws ec2 run-instances` | Launch instances |
200
+ | `aws ec2 create-*` | Resource creation |
201
+ | `aws iam delete-user` | Single IAM user |
202
+ | `aws iam delete-role` | Single IAM role |
203
+ | `aws iam delete-policy` | Single IAM policy |
204
+ | `aws iam delete-access-key` | Single access key |
205
+ | `aws iam detach-role-policy` | Detach policy from role |
206
+ | `aws iam attach-role-policy` | Attach policy to role |
207
+ | `aws iam create-*` | IAM creation |
208
+ | `aws lambda delete-function` | Single function |
209
+ | `aws lambda create-function` | Function creation |
210
+ | `aws cloudformation delete-stack` | Stack deletion (follows stack policy) |
211
+ | `aws cloudformation create-stack` | Stack creation |
212
+ | `aws cloudformation update-stack` | Stack update |
213
+ | `aws s3 cp` / `aws s3 sync` | Object operations |
214
+ | `aws s3api delete-objects` | Batch object delete (not bucket) |
215
+ | `aws s3api put-object` | Object creation |
216
+ | `aws sns delete-topic` | Single topic |
217
+ | `aws sqs delete-queue` | Single queue |
218
+ | `aws dynamodb delete-item` | Single item (not table) |
219
+ | `aws rds delete-db-parameter-group` | Parameter group |
220
+ | `aws eks delete-nodegroup` | Single node group |
221
+ | `aws eks delete-addon` | Single addon |
222
+ | `aws backup delete-recovery-point` | Single recovery point |
223
+
224
+ ### Edge cases
225
+
226
+ | Command | Status | Notes |
227
+ |---|---|---|
228
+ | `aws kms schedule-key-deletion` | DESTRUCTIVE (blocked) | Added to blocked_commands.py -- renders all encrypted data permanently unrecoverable |
229
+ | `aws route53 delete-hosted-zone` | DESTRUCTIVE (blocked) | Added to blocked_commands.py -- DNS zone loss causes widespread outage |
230
+ | `aws s3 rm --recursive` on entire bucket | Caught by verb detector | Mutative (approvable). Could wipe all data but pattern-specific block not yet implemented. |
231
+
232
+ ---
233
+
234
+ ## 5. git
235
+
236
+ ### Verb vocabulary
237
+
238
+ git uses `add`, `commit`, `push`, `pull`, `fetch`, `merge`, `rebase`, `cherry-pick`, `reset`, `revert`, `checkout`, `switch`, `restore`, `branch`, `tag`, `stash`, `clean`, `log`, `diff`, `show`, `status`, `blame`, `reflog`.
239
+
240
+ git does not use `delete` or `destroy` as subcommands -- it uses flags (`-D`, `-d`, `--delete`) and subcommands (`rm`, `clean`).
241
+
242
+ ### DESTRUCTIVE (permanently blocked)
243
+
244
+ | Command / Pattern | Reason |
245
+ |---|---|
246
+ | `git push --force` / `git push -f` | Rewrites remote history, loses others' commits |
247
+ | `git push --force` to `main`/`master` | Especially catastrophic on default branch |
248
+ | `git reset --hard` | Permanently discards uncommitted changes |
249
+
250
+ ### MUTATIVE (approvable T3)
251
+
252
+ | Command / Pattern | Notes |
253
+ |---|---|
254
+ | `git commit` | Normal commit |
255
+ | `git push` (without force) | Normal push |
256
+ | `git push --force-with-lease` | Safe force push (checks remote state) |
257
+ | `git merge` | Branch merge |
258
+ | `git rebase` | Rebasing |
259
+ | `git cherry-pick` | Cherry-picking |
260
+ | `git stash drop` / `git stash clear` | Stash management |
261
+ | `git branch -d` / `git branch -D` | Branch deletion |
262
+ | `git branch -m` / `git branch -M` | Branch rename |
263
+ | `git tag -d` | Tag deletion |
264
+ | `git reset --soft` / `git reset --mixed` | Safe resets |
265
+ | `git revert` | Creates new commit to undo |
266
+ | `git clean -f` / `git clean -fd` | Removes untracked files (local-only) |
267
+ | `git checkout -- <file>` | Discards working tree changes |
268
+ | `git restore --staged` / `git restore` | Unstage or discard changes |
269
+
270
+ ### Dangerous flags
271
+
272
+ | Flag | Escalation |
273
+ |---|---|
274
+ | `--force` / `-f` (on push) | DESTRUCTIVE -- rewrites remote history |
275
+ | `--force-with-lease` (on push) | MUTATIVE -- checks remote state first |
276
+ | `-D` (on branch) | Force-deletes unmerged branch |
277
+ | `--hard` (on reset) | DESTRUCTIVE -- permanently blocked by blocked_commands.py |
278
+ | `-f` / `-d` (on clean) | Removes untracked files/directories |
279
+
280
+ ---
281
+
282
+ ## 6. Docker
283
+
284
+ ### Verb vocabulary
285
+
286
+ Docker uses `run`, `build`, `pull`, `push`, `create`, `start`, `stop`, `restart`, `kill`, `rm`, `rmi`, `exec`, `logs`, `inspect`, `ps`, `images`, `tag`, `login`, `logout`, `prune`, `volume`, `network`, `system`, `compose`.
287
+
288
+ Docker uses `rm`, `rmi`, `prune`, `kill` -- never `delete` or `destroy`.
289
+
290
+ ### DESTRUCTIVE (permanently blocked)
291
+
292
+ | Command / Pattern | Reason |
293
+ |---|---|
294
+ | `docker system prune -a` / `docker system prune --all` | Removes ALL unused images, containers, networks, build cache |
295
+ | `docker system prune --volumes` | Removes ALL unused volumes (data loss) |
296
+ | `docker volume prune` | Removes ALL unused volumes |
297
+ | `docker image prune -a` | Removes ALL unused images |
298
+
299
+ ### MUTATIVE (approvable T3)
300
+
301
+ | Command / Pattern | Notes |
302
+ |---|---|
303
+ | `docker rm <container>` | Single container removal |
304
+ | `docker rm -f <container>` | Force-stop and remove container |
305
+ | `docker rmi <image>` | Single image removal |
306
+ | `docker kill <container>` | Stop container immediately |
307
+ | `docker stop <container>` | Graceful stop |
308
+ | `docker start <container>` | Start container |
309
+ | `docker restart <container>` | Restart container |
310
+ | `docker run <image>` | Create and start container |
311
+ | `docker build` | Build image |
312
+ | `docker push <image>` | Push image to registry |
313
+ | `docker pull <image>` | Pull image from registry |
314
+ | `docker exec <container> <cmd>` | Execute command in container |
315
+ | `docker volume rm <volume>` | Single volume removal |
316
+ | `docker volume create <volume>` | Volume creation |
317
+ | `docker network rm <network>` | Single network removal |
318
+ | `docker network create <network>` | Network creation |
319
+ | `docker system prune` (without -a/--volumes) | Removes only dangling resources |
320
+ | `docker compose up` / `docker compose down` | Compose lifecycle |
321
+ | `docker tag <image> <tag>` | Tag image |
322
+
323
+ ### Dangerous flags
324
+
325
+ | Flag | Escalation |
326
+ |---|---|
327
+ | `-a` / `--all` (on prune commands) | Extends to ALL unused, not just dangling |
328
+ | `--volumes` (on system prune) | Includes volume deletion |
329
+ | `-f` / `--force` (on rm/rmi) | Skips confirmation, force-removes |
330
+
331
+ ---
332
+
333
+ ## 7. Helm
334
+
335
+ ### Verb vocabulary
336
+
337
+ Helm uses `install`, `upgrade`, `uninstall`, `rollback`, `list`, `status`, `template`, `lint`, `show`, `search`, `repo`, `pull`, `push`, `package`, `create`, `env`, `version`, `get`, `history`, `plugin`, `test`.
338
+
339
+ Helm uses `uninstall` (Helm 3) -- `delete` was Helm 2 syntax. Neither uses `destroy`.
340
+
341
+ ### DESTRUCTIVE (permanently blocked)
342
+
343
+ | Command / Pattern | Reason |
344
+ |---|---|
345
+ | `helm uninstall <release> --no-hooks` | Bypasses cleanup hooks, risks data loss |
346
+
347
+ Note: `helm uninstall` by itself is a borderline case. It removes a release and all its resources, but this is a normal operational action. The recommendation is to classify it as **MUTATIVE** because:
348
+ - It is the standard way to remove a Helm release
349
+ - It respects resource-policy annotations (`helm.sh/resource-policy: keep`)
350
+ - It does NOT remove CRDs, PVCs, or namespaces by default
351
+ - `--dry-run` is available for preview
352
+
353
+ ### MUTATIVE (approvable T3)
354
+
355
+ | Command / Pattern | Notes |
356
+ |---|---|
357
+ | `helm install <release> <chart>` | Install release |
358
+ | `helm upgrade <release> <chart>` | Upgrade release |
359
+ | `helm uninstall <release>` | Remove release (respects hooks and annotations) |
360
+ | `helm rollback <release> <revision>` | Rollback to previous revision |
361
+ | `helm repo add <name> <url>` | Add chart repository |
362
+ | `helm repo remove <name>` | Remove chart repository |
363
+ | `helm repo update` | Update repository index |
364
+ | `helm plugin install <plugin>` | Install plugin |
365
+ | `helm plugin uninstall <plugin>` | Remove plugin |
366
+
367
+ ---
368
+
369
+ ## 8. Flux
370
+
371
+ ### Verb vocabulary
372
+
373
+ Flux uses `bootstrap`, `check`, `create`, `delete`, `diff`, `export`, `get`, `install`, `logs`, `reconcile`, `resume`, `suspend`, `trace`, `tree`, `uninstall`, `version`.
374
+
375
+ Flux uses `delete` and `uninstall` -- never `destroy`.
376
+
377
+ ### DESTRUCTIVE (permanently blocked)
378
+
379
+ | Command / Pattern | Reason |
380
+ |---|---|
381
+ | `flux uninstall` | Removes ALL Flux components from cluster |
382
+ | `flux uninstall --silent` | Same but skips confirmation |
383
+
384
+ ### MUTATIVE (approvable T3)
385
+
386
+ | Command / Pattern | Notes |
387
+ |---|---|
388
+ | `flux create source git <name>` | Create Git source |
389
+ | `flux create kustomization <name>` | Create kustomization |
390
+ | `flux create helmrelease <name>` | Create Helm release |
391
+ | `flux delete source git <name>` | Delete single source |
392
+ | `flux delete kustomization <name>` | Delete single kustomization |
393
+ | `flux delete helmrelease <name>` | Delete single Helm release |
394
+ | `flux reconcile source git <name>` | Trigger reconciliation |
395
+ | `flux reconcile kustomization <name>` | Trigger reconciliation |
396
+ | `flux suspend kustomization <name>` | Suspend reconciliation |
397
+ | `flux resume kustomization <name>` | Resume reconciliation |
398
+ | `flux bootstrap` | Bootstrap Flux to cluster |
399
+ | `flux install` | Install Flux components |
400
+
401
+ ---
402
+
403
+ ## 9. gh (GitHub CLI)
404
+
405
+ ### Verb vocabulary
406
+
407
+ gh uses `create`, `view`, `list`, `close`, `reopen`, `merge`, `delete`, `edit`, `comment`, `review`, `run`, `watch`, `status`, `clone`, `fork`, `sync`, `api`.
408
+
409
+ gh uses `delete` -- never `destroy`.
410
+
411
+ ### DESTRUCTIVE (permanently blocked)
412
+
413
+ | Command / Pattern | Reason |
414
+ |---|---|
415
+ | `gh repo delete <owner/repo>` | Entire repository and history |
416
+ | `gh repo delete --yes` | Same without confirmation |
417
+
418
+ ### MUTATIVE (approvable T3)
419
+
420
+ | Command / Pattern | Notes |
421
+ |---|---|
422
+ | `gh pr create` | Create pull request |
423
+ | `gh pr merge <number>` | Merge pull request |
424
+ | `gh pr close <number>` | Close pull request |
425
+ | `gh pr reopen <number>` | Reopen pull request |
426
+ | `gh pr comment <number>` | Add comment |
427
+ | `gh pr edit <number>` | Edit PR metadata |
428
+ | `gh pr review <number>` | Submit review |
429
+ | `gh issue create` | Create issue |
430
+ | `gh issue close <number>` | Close issue |
431
+ | `gh issue reopen <number>` | Reopen issue |
432
+ | `gh issue delete <number>` | Delete single issue |
433
+ | `gh issue comment <number>` | Add comment |
434
+ | `gh issue edit <number>` | Edit issue |
435
+ | `gh release create <tag>` | Create release |
436
+ | `gh release delete <tag>` | Delete single release |
437
+ | `gh release edit <tag>` | Edit release |
438
+ | `gh run cancel <run-id>` | Cancel workflow run |
439
+ | `gh run rerun <run-id>` | Rerun workflow |
440
+ | `gh repo create` | Create repository |
441
+ | `gh repo fork` | Fork repository |
442
+ | `gh repo clone` | Clone repository |
443
+ | `gh label create <name>` | Create label |
444
+ | `gh label delete <name>` | Delete label |
445
+
446
+ ---
447
+
448
+ ## 10. glab (GitLab CLI)
449
+
450
+ ### Verb vocabulary
451
+
452
+ glab uses `create`, `view`, `list`, `close`, `reopen`, `merge`, `delete`, `update`, `note`, `subscribe`, `approve`.
453
+
454
+ glab uses `delete` -- never `destroy`.
455
+
456
+ ### DESTRUCTIVE (permanently blocked)
457
+
458
+ | Command / Pattern | Reason |
459
+ |---|---|
460
+ | `glab repo delete <project>` | Entire repository deletion (if supported) |
461
+
462
+ ### MUTATIVE (approvable T3)
463
+
464
+ | Command / Pattern | Notes |
465
+ |---|---|
466
+ | `glab mr create` | Create merge request |
467
+ | `glab mr merge <number>` | Merge MR |
468
+ | `glab mr close <number>` | Close MR |
469
+ | `glab mr reopen <number>` | Reopen MR |
470
+ | `glab mr approve <number>` | Approve MR |
471
+ | `glab mr note <number>` | Add comment |
472
+ | `glab mr update <number>` | Update MR metadata |
473
+ | `glab issue create` | Create issue |
474
+ | `glab issue close <number>` | Close issue |
475
+ | `glab issue delete <number>` | Delete single issue |
476
+ | `glab issue note <number>` | Add comment |
477
+ | `glab ci delete <pipeline-id>` | Delete single pipeline |
478
+ | `glab ci run` | Trigger pipeline |
479
+ | `glab ci retry <job-id>` | Retry job |
480
+ | `glab release create <tag>` | Create release |
481
+ | `glab release delete <tag>` | Delete single release |
482
+ | `glab runner delete <runner-id>` | Delete single runner |
483
+ | `glab label create <name>` | Create label |
484
+
485
+ ---
486
+
487
+ ## 11. npm / pip
488
+
489
+ ### Verb vocabulary
490
+
491
+ npm uses `install`, `uninstall`, `update`, `publish`, `unpublish`, `deprecate`, `init`, `run`, `test`, `build`, `ci`, `audit`, `pack`, `version`, `view`, `search`, `ls`, `outdated`.
492
+
493
+ pip uses `install`, `uninstall`, `freeze`, `list`, `show`, `search`, `download`, `check`.
494
+
495
+ ### DESTRUCTIVE (permanently blocked)
496
+
497
+ | Command / Pattern | Reason |
498
+ |---|---|
499
+ | `npm unpublish <package>` (without version) | Removes entire package from public registry -- breaks all dependents |
500
+
501
+ ### MUTATIVE (approvable T3)
502
+
503
+ | Command / Pattern | Notes |
504
+ |---|---|
505
+ | `npm install <package>` | Install package |
506
+ | `npm uninstall <package>` | Uninstall local package |
507
+ | `npm update` | Update packages |
508
+ | `npm publish` | Publish to registry |
509
+ | `npm unpublish <package>@<version>` | Unpublish specific version (within 72h) |
510
+ | `npm deprecate <package>` | Mark package deprecated (preferred over unpublish) |
511
+ | `npm version <semver>` | Bump version |
512
+ | `npm run <script>` | Run script |
513
+ | `npm audit fix` | Fix vulnerabilities |
514
+ | `npm audit fix --force` | Force fix (may break dependencies) |
515
+ | `npm ci` | Clean install from lockfile |
516
+ | `pip install <package>` | Install package |
517
+ | `pip uninstall <package>` | Uninstall local package |
518
+ | `pip install --upgrade <package>` | Upgrade package |
519
+
520
+ ---
521
+
522
+ ## 12. System Commands
523
+
524
+ ### DESTRUCTIVE (permanently blocked)
525
+
526
+ | Command / Pattern | Reason |
527
+ |---|---|
528
+ | `rm -rf /` | Destroys entire filesystem |
529
+ | `rm -rf /*` | Same effect |
530
+ | `dd if=<device> of=<device>` | Low-level disk overwrite |
531
+ | `fdisk <device>` | Disk repartitioning |
532
+ | `mkfs` / `mkfs.ext4` / `mkfs.fat` etc. | Formats device, destroys all data |
533
+
534
+ ### MUTATIVE (approvable T3)
535
+
536
+ | Command / Pattern | Notes |
537
+ |---|---|
538
+ | `rm <file>` | Single file removal |
539
+ | `rm -r <directory>` | Directory removal (if not / or /*) |
540
+ | `mv <src> <dest>` | Move/rename |
541
+ | `cp <src> <dest>` | Copy |
542
+ | `chmod <mode> <file>` | Permission change |
543
+ | `chown <owner> <file>` | Ownership change |
544
+ | `ln -s <target> <link>` | Create symlink |
545
+ | `systemctl start/stop/restart <service>` | Service management |
546
+ | `systemctl enable/disable <service>` | Service autostart |
547
+
548
+ ### Dangerous flags
549
+
550
+ | Flag | Escalation |
551
+ |---|---|
552
+ | `-rf` / `-fr` | ALWAYS dangerous on rm |
553
+ | `--no-preserve-root` | Explicitly bypasses root protection |
554
+ | `-f` (on rm) | Force, no confirmation |
555
+ | `-r` (on rm, cp, chmod) | Recursive operation |
556
+
557
+ ---
558
+
559
+ ## Cross-CLI Verb Mapping
560
+
561
+ This table answers "does `destroy` exist outside of terraform?"
562
+
563
+ | Verb | terraform | kubectl | gcloud | aws | git | docker | helm | flux | gh | glab | npm |
564
+ |---|---|---|---|---|---|---|---|---|---|---|---|
565
+ | `destroy` | YES | no | no | no | no | no | no | no | no | no | no |
566
+ | `delete` | no | YES | YES | YES (`delete-*`) | no | no | no | YES | YES | YES | no |
567
+ | `remove` | no | no | no | YES (`remove-*`) | `rm` (file) | `rm` (container) | `repo remove` | no | no | no | no |
568
+ | `terminate` | no | no | no | YES (`terminate-*`) | no | no | no | no | no | no | no |
569
+ | `uninstall` | no | no | no | no | no | no | YES | YES | no | no | YES |
570
+ | `kill` | no | no | no | no | no | YES | no | no | no | no | no |
571
+ | `prune` | no | no | no | no | `prune` | YES | no | no | no | no | `prune` |
572
+ | `purge` | no | no | no | no | no | no | no | no | no | no | no |
573
+ | `unpublish` | no | no | no | no | no | no | no | no | no | no | YES |
574
+ | `drain` | no | YES | no | no | no | no | no | no | no | no | no |
575
+ | `push --force` | no | no | no | no | YES | no | no | no | no | no | no |
576
+ | `disable` | no | no | YES | no | no | no | no | no | no | no | no |
577
+ | `rb` | no | no | no | YES (s3) | no | no | no | no | no | no | no |
578
+
579
+ ---
580
+
581
+ ## Context-Dependent Classification
582
+
583
+ Commands where the same verb is DESTRUCTIVE in one context and MUTATIVE in another.
584
+
585
+ | Command | Context: DESTRUCTIVE | Context: MUTATIVE |
586
+ |---|---|---|
587
+ | `kubectl delete` | + `namespace`, `node`, `pv`, `pvc`, `crd`, `webhookconfig` | + `pod`, `deployment`, `service`, `configmap`, `job` |
588
+ | `kubectl delete` | + `--all --all-namespaces` | + single named resource |
589
+ | `docker prune` | + `system prune -a`, `volume prune` | + `system prune` (dangling only) |
590
+ | `docker rm` | N/A (always mutative per-container) | Single container |
591
+ | `terraform destroy` | Without `-target` (whole state) | With `-target=<resource>` |
592
+ | `git push` | + `--force` / `-f` | Without force, or with `--force-with-lease` |
593
+ | `git reset` | + `--hard` (permanently blocked) | + `--soft` / `--mixed` |
594
+ | `aws s3 rm` | + `--recursive` on bucket root | Single object |
595
+ | `gsutil rm` | + `-r` (recursive) | Single object |
596
+ | `npm unpublish` | Entire package (no version) | Specific `@version` |
597
+ | `flux uninstall` | Always destructive (removes Flux) | N/A |
598
+ | `helm uninstall` | + `--no-hooks` (skip cleanup) | Normal (respects hooks/annotations) |
599
+
600
+ ---
601
+
602
+ ## Implementation Status
603
+
604
+ ### All recommended commands: IMPLEMENTED
605
+
606
+ The following commands were identified as candidates for permanent blocking and have all been added to `blocked_commands.py`:
607
+
608
+ - `aws kms schedule-key-deletion`, `aws route53 delete-hosted-zone`, `aws organizations delete-organization`
609
+ - `aws ec2 terminate-instances`
610
+ - `docker system prune -a` / `--all` / `--volumes`, `docker volume prune`
611
+ - `flux uninstall`
612
+ - `gh repo delete`, `glab project delete`
613
+ - `terraform destroy` (without `-target`), `terragrunt run-all destroy`
614
+ - `npm unpublish` (without `@version`)
615
+ - `git reset --hard`
616
+
617
+ ### Dangerous flag combinations: OPEN
618
+
619
+ The following flag-based escalations have NOT been implemented as pattern-specific blocks. They are caught by `mutative_verbs.py` as approvable T3 commands:
620
+
621
+ - `--all-namespaces` / `-A` for kubectl with `delete` -- partial coverage via `kubectl delete <type> --all` pattern
622
+ - `--no-hooks` for helm with `uninstall` -- not blocked (normal `helm uninstall` is approvable T3)
623
+ - `--recursive` for `aws s3 rm` -- not pattern-blocked (caught by verb detector as mutative)