@jaguilar87/gaia 5.0.0-rc1 → 5.0.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 (523) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/ARCHITECTURE.md +16 -18
  4. package/CHANGELOG.md +301 -6
  5. package/CONTRIBUTING.md +4 -2
  6. package/INSTALL.md +110 -112
  7. package/README.md +26 -21
  8. package/agents/README.md +3 -3
  9. package/agents/cloud-troubleshooter.md +44 -34
  10. package/agents/developer.md +34 -35
  11. package/agents/gaia-operator.md +55 -25
  12. package/agents/gaia-orchestrator.md +69 -205
  13. package/agents/gaia-planner.md +47 -27
  14. package/agents/gaia-system.md +66 -38
  15. package/agents/gitops-operator.md +41 -34
  16. package/agents/platform-architect.md +68 -0
  17. package/bin/README.md +72 -63
  18. package/bin/cli/_install_helpers.py +556 -0
  19. package/bin/cli/ac.py +322 -0
  20. package/bin/cli/approvals.py +1206 -53
  21. package/bin/cli/brief.py +1025 -0
  22. package/bin/cli/cleanup.py +3 -2
  23. package/bin/cli/context.py +373 -116
  24. package/bin/cli/doctor.py +954 -163
  25. package/bin/cli/evidence.py +393 -0
  26. package/bin/cli/history.py +57 -38
  27. package/bin/cli/install.py +822 -0
  28. package/bin/cli/memory.py +1777 -57
  29. package/bin/cli/metrics.py +12 -9
  30. package/bin/cli/milestone.py +303 -0
  31. package/bin/cli/paths.py +104 -0
  32. package/bin/cli/plan.py +397 -0
  33. package/bin/cli/plans.py +25 -23
  34. package/bin/cli/query.py +267 -0
  35. package/bin/cli/scan.py +463 -0
  36. package/bin/cli/status.py +143 -65
  37. package/bin/cli/task.py +279 -0
  38. package/bin/cli/uninstall.py +389 -0
  39. package/bin/cli/update.py +209 -134
  40. package/bin/cli/workspace.py +211 -0
  41. package/bin/pre-publish-validate.js +93 -0
  42. package/bin/validate-sandbox.sh +772 -0
  43. package/commands/README.md +1 -1
  44. package/commands/gaia.md +1 -1
  45. package/commands/scan-project.md +19 -12
  46. package/config/README.md +12 -15
  47. package/config/surface-routing.json +24 -13
  48. package/dist/gaia-ops/.claude-plugin/plugin.json +192 -2
  49. package/dist/gaia-ops/README.md +11 -12
  50. package/dist/gaia-ops/agents/cloud-troubleshooter.md +44 -34
  51. package/dist/gaia-ops/agents/developer.md +34 -35
  52. package/dist/gaia-ops/agents/gaia-operator.md +55 -25
  53. package/dist/gaia-ops/agents/gaia-orchestrator.md +69 -205
  54. package/dist/gaia-ops/agents/gaia-planner.md +47 -27
  55. package/dist/gaia-ops/agents/gaia-system.md +66 -38
  56. package/dist/gaia-ops/agents/gitops-operator.md +41 -34
  57. package/dist/gaia-ops/agents/platform-architect.md +68 -0
  58. package/dist/gaia-ops/commands/gaia.md +1 -1
  59. package/dist/gaia-ops/config/README.md +12 -15
  60. package/dist/gaia-ops/config/surface-routing.json +24 -13
  61. package/dist/gaia-ops/hooks/adapters/claude_code.py +218 -96
  62. package/dist/gaia-ops/hooks/hooks.json +45 -16
  63. package/dist/gaia-ops/hooks/modules/agents/contract_validator.py +381 -46
  64. package/dist/gaia-ops/hooks/modules/agents/handoff_persister.py +146 -0
  65. package/dist/gaia-ops/hooks/modules/agents/response_contract.py +207 -36
  66. package/dist/gaia-ops/hooks/modules/agents/skill_injection_verifier.py +1 -17
  67. package/dist/gaia-ops/hooks/modules/agents/state_tracker.py +14 -0
  68. package/dist/gaia-ops/hooks/modules/audit/workflow_auditor.py +61 -89
  69. package/dist/gaia-ops/hooks/modules/audit/workflow_recorder.py +48 -71
  70. package/dist/gaia-ops/hooks/modules/context/__init__.py +3 -3
  71. package/dist/gaia-ops/hooks/modules/context/anchor_tracker.py +1 -1
  72. package/dist/gaia-ops/hooks/modules/context/compact_context_builder.py +119 -76
  73. package/dist/gaia-ops/hooks/modules/context/context_freshness.py +67 -71
  74. package/dist/gaia-ops/hooks/modules/context/context_injector.py +135 -207
  75. package/dist/gaia-ops/hooks/modules/context/context_writer.py +366 -444
  76. package/dist/gaia-ops/hooks/modules/context/contracts_loader.py +100 -117
  77. package/dist/gaia-ops/hooks/modules/core/state.py +29 -1
  78. package/dist/gaia-ops/hooks/modules/core/workspace_bootstrap.py +91 -0
  79. package/dist/gaia-ops/hooks/modules/memory/episode_writer.py +8 -1
  80. package/dist/gaia-ops/hooks/modules/scanning/scan_trigger.py +3 -1
  81. package/dist/gaia-ops/hooks/modules/security/approval_cleanup.py +75 -4
  82. package/dist/gaia-ops/hooks/modules/security/approval_grants.py +647 -79
  83. package/dist/gaia-ops/hooks/modules/security/approval_messages.py +41 -1
  84. package/dist/gaia-ops/hooks/modules/security/approval_scopes.py +18 -32
  85. package/dist/gaia-ops/hooks/modules/security/blocked_commands.py +133 -5
  86. package/dist/gaia-ops/hooks/modules/security/blocked_message_formatter.py +3 -3
  87. package/dist/gaia-ops/hooks/modules/security/capability_classes.py +379 -0
  88. package/dist/gaia-ops/hooks/modules/security/command_semantics.py +87 -5
  89. package/dist/gaia-ops/hooks/modules/security/composition_rules.py +69 -0
  90. package/dist/gaia-ops/hooks/modules/security/gaia_db_write_guard.py +97 -0
  91. package/dist/gaia-ops/hooks/modules/security/inline_ast_analyzer.py +339 -0
  92. package/dist/gaia-ops/hooks/modules/security/mutative_verbs.py +563 -11
  93. package/dist/gaia-ops/hooks/modules/session/pending_scanner.py +18 -2
  94. package/dist/gaia-ops/hooks/modules/session/session_event_injector.py +1 -1
  95. package/dist/gaia-ops/hooks/modules/session/session_manifest.py +548 -0
  96. package/dist/gaia-ops/hooks/modules/session/session_registry.py +162 -55
  97. package/dist/gaia-ops/hooks/modules/tools/bash_validator.py +502 -110
  98. package/dist/gaia-ops/hooks/modules/tools/task_validator.py +5 -4
  99. package/dist/gaia-ops/hooks/post_compact.py +5 -1
  100. package/dist/gaia-ops/hooks/post_tool_use.py +5 -1
  101. package/dist/gaia-ops/hooks/pre_compact.py +5 -1
  102. package/dist/gaia-ops/hooks/pre_tool_use.py +5 -1
  103. package/dist/gaia-ops/hooks/session_end_hook.py +81 -0
  104. package/dist/gaia-ops/hooks/session_start.py +157 -7
  105. package/dist/gaia-ops/hooks/stop_hook.py +5 -13
  106. package/dist/gaia-ops/hooks/subagent_start.py +5 -17
  107. package/dist/gaia-ops/hooks/subagent_stop.py +46 -5
  108. package/dist/gaia-ops/hooks/task_completed.py +5 -1
  109. package/dist/gaia-ops/hooks/user_prompt_submit.py +31 -67
  110. package/dist/gaia-ops/skills/README.md +33 -28
  111. package/dist/gaia-ops/skills/agent-approval-protocol/SKILL.md +98 -0
  112. package/dist/gaia-ops/skills/agent-approval-protocol/reference.md +74 -0
  113. package/dist/gaia-ops/skills/agent-contract-handoff/SKILL.md +157 -0
  114. package/dist/gaia-ops/skills/agent-creation/SKILL.md +100 -0
  115. package/dist/gaia-ops/skills/agent-creation/examples.md +177 -0
  116. package/dist/gaia-ops/skills/agent-creation/reference.md +233 -0
  117. package/dist/gaia-ops/skills/agent-protocol/SKILL.md +58 -52
  118. package/dist/gaia-ops/skills/agent-protocol/examples.md +169 -59
  119. package/dist/gaia-ops/skills/agent-response/SKILL.md +42 -44
  120. package/dist/gaia-ops/skills/agentic-loop/SKILL.md +1 -1
  121. package/dist/gaia-ops/skills/brief-spec/SKILL.md +149 -25
  122. package/dist/gaia-ops/skills/command-execution/SKILL.md +12 -12
  123. package/dist/gaia-ops/skills/execution/SKILL.md +21 -13
  124. package/dist/gaia-ops/skills/gaia-audit/SKILL.md +119 -0
  125. package/dist/gaia-ops/skills/gaia-compact/SKILL.md +1 -1
  126. package/dist/gaia-ops/skills/gaia-patterns/SKILL.md +6 -7
  127. package/dist/gaia-ops/skills/gaia-patterns/reference.md +130 -75
  128. package/dist/gaia-ops/skills/gaia-planner/SKILL.md +140 -17
  129. package/dist/gaia-ops/skills/gaia-planner/reference.md +143 -56
  130. package/dist/gaia-ops/skills/gaia-release/SKILL.md +35 -57
  131. package/dist/gaia-ops/skills/gaia-release/reference.md +175 -96
  132. package/dist/gaia-ops/skills/gaia-verify/SKILL.md +6 -6
  133. package/dist/gaia-ops/skills/gaia-verify/reference.md +9 -9
  134. package/dist/gaia-ops/skills/investigation/SKILL.md +86 -87
  135. package/dist/gaia-ops/skills/jira-ticket-writing/SKILL.md +95 -0
  136. package/dist/gaia-ops/skills/jira-ticket-writing/examples.md +109 -0
  137. package/dist/gaia-ops/skills/memory/SKILL.md +399 -0
  138. package/dist/gaia-ops/skills/orchestrator-present-approval/SKILL.md +101 -0
  139. package/dist/gaia-ops/skills/orchestrator-present-approval/reference.md +264 -0
  140. package/dist/gaia-ops/skills/orchestrator-present-approval/template.md +49 -0
  141. package/dist/gaia-ops/skills/pending-approvals/SKILL.md +119 -54
  142. package/dist/gaia-ops/skills/pending-approvals/reference.md +60 -27
  143. package/dist/gaia-ops/skills/readme-writing/reference.md +1 -1
  144. package/dist/gaia-ops/skills/reference.md +1 -2
  145. package/dist/gaia-ops/skills/schedule-task/SKILL.md +1 -1
  146. package/dist/gaia-ops/skills/schedule-task/reference.md +1 -1
  147. package/dist/gaia-ops/skills/security-tiers/SKILL.md +35 -111
  148. package/dist/gaia-ops/skills/security-tiers/destructive-commands-reference.md +5 -4
  149. package/dist/gaia-ops/skills/security-tiers/reference.md +6 -0
  150. package/dist/gaia-ops/skills/session-reflection/SKILL.md +198 -0
  151. package/dist/gaia-ops/skills/skill-creation/SKILL.md +21 -14
  152. package/dist/gaia-ops/skills/skill-creation/examples.md +53 -0
  153. package/dist/gaia-ops/skills/skill-creation/reference.md +3 -19
  154. package/dist/gaia-ops/skills/subagent-request-approval/SKILL.md +86 -0
  155. package/dist/gaia-ops/skills/subagent-request-approval/reference.md +129 -0
  156. package/dist/gaia-ops/tools/agentic-loop/record-iteration.py +2 -0
  157. package/dist/gaia-ops/tools/context/README.md +21 -33
  158. package/dist/gaia-ops/tools/context/__init__.py +0 -2
  159. package/dist/gaia-ops/tools/context/context_provider.py +170 -194
  160. package/dist/gaia-ops/tools/gaia_simulator/runner.py +5 -31
  161. package/dist/gaia-ops/tools/memory/episodic.py +239 -149
  162. package/dist/gaia-ops/tools/memory/search_store.py +17 -2
  163. package/dist/gaia-ops/tools/migration/README.md +95 -0
  164. package/dist/gaia-ops/tools/migration/migrate_01_episodes.py +186 -0
  165. package/dist/gaia-ops/tools/migration/migrate_01_episodes.sh +21 -0
  166. package/dist/gaia-ops/tools/migration/migrate_02_memory.py +179 -0
  167. package/dist/gaia-ops/tools/migration/migrate_02_memory.sh +19 -0
  168. package/dist/gaia-ops/tools/migration/migrate_03_context_contracts.py +103 -0
  169. package/dist/gaia-ops/tools/migration/migrate_03_context_contracts.sh +19 -0
  170. package/dist/gaia-ops/tools/migration/migrate_04_harness_events.py +132 -0
  171. package/dist/gaia-ops/tools/migration/migrate_04_harness_events.sh +23 -0
  172. package/dist/gaia-ops/tools/migration/migrate_05_briefs.py +307 -0
  173. package/dist/gaia-ops/tools/migration/migrate_06_state_machines.py +441 -0
  174. package/dist/gaia-ops/tools/migration/migrate_07_plans_content.py +124 -0
  175. package/dist/gaia-ops/tools/migration/migrate_08_rename_workspace.py +513 -0
  176. package/dist/gaia-ops/tools/migration/validate.sh +68 -0
  177. package/dist/gaia-ops/tools/scan/config.py +6 -28
  178. package/dist/gaia-ops/tools/scan/core.py +441 -0
  179. package/dist/gaia-ops/tools/scan/merge.py +3 -2
  180. package/dist/gaia-ops/tools/scan/migrate_workspace.py +249 -0
  181. package/dist/gaia-ops/tools/scan/orchestrator.py +35 -174
  182. package/dist/gaia-ops/tools/scan/role_detector.py +198 -0
  183. package/dist/gaia-ops/tools/scan/seed_contract_permissions.py +327 -0
  184. package/dist/gaia-ops/tools/scan/store_populator.py +1818 -0
  185. package/dist/gaia-ops/tools/scan/tests/conftest.py +2 -0
  186. package/dist/gaia-ops/tools/scan/tests/test_core.py +190 -0
  187. package/dist/gaia-ops/tools/scan/tests/test_integration.py +42 -113
  188. package/dist/gaia-ops/tools/scan/tests/test_store_populator.py +345 -0
  189. package/dist/gaia-ops/tools/scan/ui.py +31 -12
  190. package/dist/gaia-ops/tools/scan/verify.py +39 -24
  191. package/dist/gaia-ops/tools/scan/workspace.py +33 -8
  192. package/dist/gaia-ops/tools/state/__init__.py +1 -0
  193. package/dist/gaia-ops/tools/state/diff_source_of_truth.py +150 -0
  194. package/dist/gaia-ops/tools/validation/README.md +1 -1
  195. package/dist/gaia-security/.claude-plugin/plugin.json +113 -2
  196. package/dist/gaia-security/README.md +0 -2
  197. package/dist/gaia-security/hooks/adapters/claude_code.py +218 -96
  198. package/dist/gaia-security/hooks/hooks.json +37 -8
  199. package/dist/gaia-security/hooks/modules/agents/contract_validator.py +381 -46
  200. package/dist/gaia-security/hooks/modules/agents/handoff_persister.py +146 -0
  201. package/dist/gaia-security/hooks/modules/agents/response_contract.py +207 -36
  202. package/dist/gaia-security/hooks/modules/agents/skill_injection_verifier.py +1 -17
  203. package/dist/gaia-security/hooks/modules/agents/state_tracker.py +14 -0
  204. package/dist/gaia-security/hooks/modules/audit/workflow_auditor.py +61 -89
  205. package/dist/gaia-security/hooks/modules/audit/workflow_recorder.py +48 -71
  206. package/dist/gaia-security/hooks/modules/context/__init__.py +3 -3
  207. package/dist/gaia-security/hooks/modules/context/anchor_tracker.py +1 -1
  208. package/dist/gaia-security/hooks/modules/context/compact_context_builder.py +119 -76
  209. package/dist/gaia-security/hooks/modules/context/context_freshness.py +67 -71
  210. package/dist/gaia-security/hooks/modules/context/context_injector.py +135 -207
  211. package/dist/gaia-security/hooks/modules/context/context_writer.py +366 -444
  212. package/dist/gaia-security/hooks/modules/context/contracts_loader.py +100 -117
  213. package/dist/gaia-security/hooks/modules/core/state.py +29 -1
  214. package/dist/gaia-security/hooks/modules/core/workspace_bootstrap.py +91 -0
  215. package/dist/gaia-security/hooks/modules/memory/episode_writer.py +8 -1
  216. package/dist/gaia-security/hooks/modules/scanning/scan_trigger.py +3 -1
  217. package/dist/gaia-security/hooks/modules/security/approval_cleanup.py +75 -4
  218. package/dist/gaia-security/hooks/modules/security/approval_grants.py +647 -79
  219. package/dist/gaia-security/hooks/modules/security/approval_messages.py +41 -1
  220. package/dist/gaia-security/hooks/modules/security/approval_scopes.py +18 -32
  221. package/dist/gaia-security/hooks/modules/security/blocked_commands.py +133 -5
  222. package/dist/gaia-security/hooks/modules/security/blocked_message_formatter.py +3 -3
  223. package/dist/gaia-security/hooks/modules/security/capability_classes.py +379 -0
  224. package/dist/gaia-security/hooks/modules/security/command_semantics.py +87 -5
  225. package/dist/gaia-security/hooks/modules/security/composition_rules.py +69 -0
  226. package/dist/gaia-security/hooks/modules/security/gaia_db_write_guard.py +97 -0
  227. package/dist/gaia-security/hooks/modules/security/inline_ast_analyzer.py +339 -0
  228. package/dist/gaia-security/hooks/modules/security/mutative_verbs.py +563 -11
  229. package/dist/gaia-security/hooks/modules/session/pending_scanner.py +18 -2
  230. package/dist/gaia-security/hooks/modules/session/session_event_injector.py +1 -1
  231. package/dist/gaia-security/hooks/modules/session/session_manifest.py +548 -0
  232. package/dist/gaia-security/hooks/modules/session/session_registry.py +162 -55
  233. package/dist/gaia-security/hooks/modules/tools/bash_validator.py +502 -110
  234. package/dist/gaia-security/hooks/modules/tools/task_validator.py +5 -4
  235. package/dist/gaia-security/hooks/post_tool_use.py +5 -1
  236. package/dist/gaia-security/hooks/pre_tool_use.py +5 -1
  237. package/dist/gaia-security/hooks/session_end_hook.py +81 -0
  238. package/dist/gaia-security/hooks/session_start.py +157 -7
  239. package/dist/gaia-security/hooks/stop_hook.py +5 -13
  240. package/dist/gaia-security/hooks/user_prompt_submit.py +31 -67
  241. package/gaia/README.md +136 -0
  242. package/gaia/__init__.py +21 -0
  243. package/gaia/approvals/__init__.py +17 -0
  244. package/gaia/approvals/chain.py +268 -0
  245. package/gaia/approvals/display.py +235 -0
  246. package/gaia/approvals/revert.py +282 -0
  247. package/gaia/approvals/store.py +752 -0
  248. package/gaia/briefs/__init__.py +62 -0
  249. package/gaia/briefs/serializer.py +683 -0
  250. package/gaia/briefs/store.py +1098 -0
  251. package/gaia/evidence/__init__.py +5 -0
  252. package/gaia/evidence/fs.py +123 -0
  253. package/gaia/evidence/store.py +265 -0
  254. package/gaia/paths/README.md +32 -0
  255. package/gaia/paths/__init__.py +65 -0
  256. package/gaia/paths/layout.py +47 -0
  257. package/gaia/paths/resolver.py +107 -0
  258. package/gaia/project.py +314 -0
  259. package/gaia/state/__init__.py +132 -0
  260. package/gaia/state/check_clauses.py +61 -0
  261. package/gaia/state/permissions.py +117 -0
  262. package/gaia/state/transitions.py +140 -0
  263. package/gaia/store/NOTICE.md +49 -0
  264. package/gaia/store/__init__.py +42 -0
  265. package/gaia/store/provider.py +170 -0
  266. package/gaia/store/reader.py +545 -0
  267. package/gaia/store/schema.sql +965 -0
  268. package/gaia/store/writer.py +3595 -0
  269. package/hooks/README.md +20 -9
  270. package/hooks/adapters/claude_code.py +218 -96
  271. package/hooks/elicitation_result.py +35 -3
  272. package/hooks/hooks.json +21 -16
  273. package/hooks/modules/README.md +2 -2
  274. package/hooks/modules/agents/contract_validator.py +381 -46
  275. package/hooks/modules/agents/handoff_persister.py +146 -0
  276. package/hooks/modules/agents/response_contract.py +207 -36
  277. package/hooks/modules/agents/skill_injection_verifier.py +1 -17
  278. package/hooks/modules/agents/state_tracker.py +14 -0
  279. package/hooks/modules/audit/workflow_auditor.py +61 -89
  280. package/hooks/modules/audit/workflow_recorder.py +48 -71
  281. package/hooks/modules/context/__init__.py +3 -3
  282. package/hooks/modules/context/anchor_tracker.py +1 -1
  283. package/hooks/modules/context/compact_context_builder.py +119 -76
  284. package/hooks/modules/context/context_freshness.py +67 -71
  285. package/hooks/modules/context/context_injector.py +135 -207
  286. package/hooks/modules/context/context_writer.py +366 -444
  287. package/hooks/modules/context/contracts_loader.py +100 -117
  288. package/hooks/modules/core/state.py +29 -1
  289. package/hooks/modules/core/workspace_bootstrap.py +91 -0
  290. package/hooks/modules/install_detector.py +186 -0
  291. package/hooks/modules/memory/episode_writer.py +8 -1
  292. package/hooks/modules/scanning/scan_trigger.py +3 -1
  293. package/hooks/modules/security/approval_cleanup.py +75 -4
  294. package/hooks/modules/security/approval_grants.py +647 -79
  295. package/hooks/modules/security/approval_messages.py +41 -1
  296. package/hooks/modules/security/approval_scopes.py +18 -32
  297. package/hooks/modules/security/blocked_commands.py +133 -5
  298. package/hooks/modules/security/blocked_message_formatter.py +3 -3
  299. package/hooks/modules/security/capability_classes.py +379 -0
  300. package/hooks/modules/security/command_semantics.py +87 -5
  301. package/hooks/modules/security/composition_rules.py +69 -0
  302. package/hooks/modules/security/gaia_db_write_guard.py +97 -0
  303. package/hooks/modules/security/inline_ast_analyzer.py +339 -0
  304. package/hooks/modules/security/mutative_verbs.py +563 -11
  305. package/hooks/modules/session/pending_scanner.py +18 -2
  306. package/hooks/modules/session/session_event_injector.py +1 -1
  307. package/hooks/modules/session/session_manifest.py +548 -0
  308. package/hooks/modules/session/session_registry.py +162 -55
  309. package/hooks/modules/tools/bash_validator.py +502 -110
  310. package/hooks/modules/tools/task_validator.py +5 -4
  311. package/hooks/post_compact.py +5 -1
  312. package/hooks/post_tool_use.py +5 -1
  313. package/hooks/pre_compact.py +5 -1
  314. package/hooks/pre_tool_use.py +5 -1
  315. package/hooks/session_end_hook.py +81 -0
  316. package/hooks/session_start.py +157 -7
  317. package/hooks/stop_hook.py +5 -13
  318. package/hooks/subagent_start.py +5 -17
  319. package/hooks/subagent_stop.py +46 -5
  320. package/hooks/task_completed.py +5 -1
  321. package/hooks/user_prompt_submit.py +31 -67
  322. package/package.json +12 -21
  323. package/pyproject.toml +5 -2
  324. package/scripts/bootstrap_database.sh +851 -0
  325. package/scripts/build-plugin.py +439 -0
  326. package/scripts/migrations/README.md +63 -0
  327. package/scripts/migrations/v10_to_v11.sql +170 -0
  328. package/scripts/migrations/v10_to_v11_fresh.sql +18 -0
  329. package/scripts/migrations/v11_to_v12.sql +195 -0
  330. package/scripts/migrations/v11_to_v12_fresh.sql +19 -0
  331. package/scripts/migrations/v12_to_v13.sql +48 -0
  332. package/scripts/migrations/v12_to_v13_fresh.sql +17 -0
  333. package/scripts/migrations/v13_to_v14.sql +44 -0
  334. package/scripts/migrations/v13_to_v14_fresh.sql +17 -0
  335. package/scripts/migrations/v14_to_v15.sql +71 -0
  336. package/scripts/migrations/v14_to_v15_fresh.sql +19 -0
  337. package/scripts/migrations/v15_to_v16.sql +57 -0
  338. package/scripts/migrations/v15_to_v16_fresh.sql +18 -0
  339. package/scripts/migrations/v16_to_v17.sql +51 -0
  340. package/scripts/migrations/v16_to_v17_fresh.sql +18 -0
  341. package/scripts/migrations/v17_to_v18.sql +66 -0
  342. package/scripts/migrations/v17_to_v18_fresh.sql +24 -0
  343. package/scripts/migrations/v1_to_v2.sql +97 -0
  344. package/scripts/migrations/v2_to_v3.sql +68 -0
  345. package/scripts/migrations/v2_to_v3_merge.sql +69 -0
  346. package/scripts/migrations/v3_to_v4.sql +67 -0
  347. package/scripts/migrations/v3_to_v4_fresh.sql +20 -0
  348. package/scripts/migrations/v4_to_v5.sql +55 -0
  349. package/scripts/migrations/v4_to_v5_fresh.sql +20 -0
  350. package/scripts/migrations/v5_to_v6.sql +48 -0
  351. package/scripts/migrations/v5_to_v6_fresh.sql +17 -0
  352. package/scripts/migrations/v6_to_v7.sql +26 -0
  353. package/scripts/migrations/v6_to_v7_fresh.sql +13 -0
  354. package/scripts/migrations/v7_to_v8.sql +44 -0
  355. package/scripts/migrations/v7_to_v8_fresh.sql +14 -0
  356. package/scripts/migrations/v8_to_v9.sql +87 -0
  357. package/scripts/migrations/v8_to_v9_fresh.sql +15 -0
  358. package/scripts/migrations/v9_to_v10.sql +109 -0
  359. package/scripts/migrations/v9_to_v10_episodes_workspace.sql +109 -0
  360. package/scripts/migrations/v9_to_v10_fresh.sql +18 -0
  361. package/scripts/seed_agent_permissions.py +166 -0
  362. package/skills/README.md +33 -28
  363. package/skills/agent-approval-protocol/SKILL.md +98 -0
  364. package/skills/agent-approval-protocol/reference.md +74 -0
  365. package/skills/agent-contract-handoff/SKILL.md +157 -0
  366. package/skills/agent-creation/SKILL.md +100 -0
  367. package/skills/agent-creation/examples.md +177 -0
  368. package/skills/agent-creation/reference.md +233 -0
  369. package/skills/agent-protocol/SKILL.md +58 -52
  370. package/skills/agent-protocol/examples.md +169 -59
  371. package/skills/agent-response/SKILL.md +42 -44
  372. package/skills/agentic-loop/SKILL.md +1 -1
  373. package/skills/brief-spec/SKILL.md +149 -25
  374. package/skills/command-execution/SKILL.md +12 -12
  375. package/skills/execution/SKILL.md +21 -13
  376. package/skills/gaia-audit/SKILL.md +119 -0
  377. package/skills/gaia-compact/SKILL.md +1 -1
  378. package/skills/gaia-patterns/SKILL.md +6 -7
  379. package/skills/gaia-patterns/reference.md +130 -75
  380. package/skills/gaia-planner/SKILL.md +140 -17
  381. package/skills/gaia-planner/reference.md +143 -56
  382. package/skills/gaia-release/SKILL.md +35 -57
  383. package/skills/gaia-release/reference.md +175 -96
  384. package/skills/gaia-verify/SKILL.md +6 -6
  385. package/skills/gaia-verify/reference.md +9 -9
  386. package/skills/investigation/SKILL.md +86 -87
  387. package/skills/jira-ticket-writing/SKILL.md +95 -0
  388. package/skills/jira-ticket-writing/examples.md +109 -0
  389. package/skills/memory/SKILL.md +399 -0
  390. package/skills/orchestrator-present-approval/SKILL.md +101 -0
  391. package/skills/orchestrator-present-approval/reference.md +264 -0
  392. package/skills/orchestrator-present-approval/template.md +49 -0
  393. package/skills/pending-approvals/SKILL.md +119 -54
  394. package/skills/pending-approvals/reference.md +60 -27
  395. package/skills/readme-writing/reference.md +1 -1
  396. package/skills/reference.md +1 -2
  397. package/skills/schedule-task/SKILL.md +1 -1
  398. package/skills/schedule-task/reference.md +1 -1
  399. package/skills/security-tiers/SKILL.md +35 -111
  400. package/skills/security-tiers/destructive-commands-reference.md +5 -4
  401. package/skills/security-tiers/reference.md +6 -0
  402. package/skills/session-reflection/SKILL.md +198 -0
  403. package/skills/skill-creation/SKILL.md +21 -14
  404. package/skills/skill-creation/examples.md +53 -0
  405. package/skills/skill-creation/reference.md +3 -19
  406. package/skills/subagent-request-approval/SKILL.md +86 -0
  407. package/skills/subagent-request-approval/reference.md +129 -0
  408. package/templates/README.md +14 -13
  409. package/tools/agentic-loop/record-iteration.py +2 -0
  410. package/tools/context/README.md +21 -33
  411. package/tools/context/__init__.py +0 -2
  412. package/tools/context/context_provider.py +170 -194
  413. package/tools/gaia_simulator/runner.py +5 -31
  414. package/tools/memory/episodic.py +239 -149
  415. package/tools/memory/search_store.py +17 -2
  416. package/tools/migration/README.md +95 -0
  417. package/tools/migration/migrate_01_episodes.py +186 -0
  418. package/tools/migration/migrate_01_episodes.sh +21 -0
  419. package/tools/migration/migrate_02_memory.py +179 -0
  420. package/tools/migration/migrate_02_memory.sh +19 -0
  421. package/tools/migration/migrate_03_context_contracts.py +103 -0
  422. package/tools/migration/migrate_03_context_contracts.sh +19 -0
  423. package/tools/migration/migrate_04_harness_events.py +132 -0
  424. package/tools/migration/migrate_04_harness_events.sh +23 -0
  425. package/tools/migration/migrate_05_briefs.py +307 -0
  426. package/tools/migration/migrate_06_state_machines.py +441 -0
  427. package/tools/migration/migrate_07_plans_content.py +124 -0
  428. package/tools/migration/migrate_08_rename_workspace.py +513 -0
  429. package/tools/migration/validate.sh +68 -0
  430. package/tools/scan/config.py +6 -28
  431. package/tools/scan/core.py +441 -0
  432. package/tools/scan/merge.py +3 -2
  433. package/tools/scan/migrate_workspace.py +249 -0
  434. package/tools/scan/orchestrator.py +35 -174
  435. package/tools/scan/role_detector.py +198 -0
  436. package/tools/scan/seed_contract_permissions.py +327 -0
  437. package/tools/scan/store_populator.py +1818 -0
  438. package/tools/scan/tests/conftest.py +2 -0
  439. package/tools/scan/tests/test_core.py +190 -0
  440. package/tools/scan/tests/test_integration.py +42 -113
  441. package/tools/scan/tests/test_store_populator.py +345 -0
  442. package/tools/scan/ui.py +31 -12
  443. package/tools/scan/verify.py +39 -24
  444. package/tools/scan/workspace.py +33 -8
  445. package/tools/state/__init__.py +1 -0
  446. package/tools/state/diff_source_of_truth.py +150 -0
  447. package/tools/validation/README.md +1 -1
  448. package/agents/terraform-architect.md +0 -63
  449. package/bin/gaia-cleanup.js +0 -531
  450. package/bin/gaia-doctor.js +0 -635
  451. package/bin/gaia-evidence +0 -126
  452. package/bin/gaia-history.js +0 -251
  453. package/bin/gaia-metrics.js +0 -1278
  454. package/bin/gaia-review.js +0 -269
  455. package/bin/gaia-scan +0 -44
  456. package/bin/gaia-scan.py +0 -589
  457. package/bin/gaia-skills-diagnose.js +0 -929
  458. package/bin/gaia-status.js +0 -278
  459. package/bin/gaia-uninstall.js +0 -111
  460. package/bin/gaia-update.js +0 -816
  461. package/config/cloud/aws.json +0 -134
  462. package/config/cloud/gcp.json +0 -139
  463. package/config/context-contracts.json +0 -158
  464. package/config/universal-rules.json +0 -102
  465. package/dist/gaia-ops/agents/terraform-architect.md +0 -63
  466. package/dist/gaia-ops/config/cloud/aws.json +0 -134
  467. package/dist/gaia-ops/config/cloud/gcp.json +0 -139
  468. package/dist/gaia-ops/config/context-contracts.json +0 -158
  469. package/dist/gaia-ops/config/universal-rules.json +0 -102
  470. package/dist/gaia-ops/settings.json +0 -72
  471. package/dist/gaia-ops/skills/context-updater/SKILL.md +0 -87
  472. package/dist/gaia-ops/skills/context-updater/examples.md +0 -71
  473. package/dist/gaia-ops/skills/developer-patterns/SKILL.md +0 -50
  474. package/dist/gaia-ops/skills/developer-patterns/reference.md +0 -112
  475. package/dist/gaia-ops/skills/gaia-self-check/SKILL.md +0 -114
  476. package/dist/gaia-ops/skills/gaia-self-check/reference.md +0 -453
  477. package/dist/gaia-ops/skills/gitops-patterns/SKILL.md +0 -60
  478. package/dist/gaia-ops/skills/gitops-patterns/reference.md +0 -183
  479. package/dist/gaia-ops/skills/memory-curation/SKILL.md +0 -83
  480. package/dist/gaia-ops/skills/memory-search/SKILL.md +0 -88
  481. package/dist/gaia-ops/skills/orchestrator-approval/SKILL.md +0 -160
  482. package/dist/gaia-ops/skills/orchestrator-approval/reference.md +0 -174
  483. package/dist/gaia-ops/skills/request-approval/SKILL.md +0 -140
  484. package/dist/gaia-ops/skills/request-approval/examples.md +0 -140
  485. package/dist/gaia-ops/skills/request-approval/reference.md +0 -57
  486. package/dist/gaia-ops/skills/terraform-patterns/SKILL.md +0 -89
  487. package/dist/gaia-ops/skills/terraform-patterns/reference.md +0 -93
  488. package/dist/gaia-ops/tools/context/context_section_reader.py +0 -342
  489. package/dist/gaia-ops/tools/context/pending_updates.py +0 -760
  490. package/dist/gaia-ops/tools/persist_transcript_analysis.py +0 -85
  491. package/dist/gaia-ops/tools/review/__init__.py +0 -1
  492. package/dist/gaia-ops/tools/review/review_engine.py +0 -157
  493. package/dist/gaia-ops/tools/scan/setup.py +0 -686
  494. package/dist/gaia-security/config/universal-rules.json +0 -102
  495. package/dist/gaia-security/settings.json +0 -58
  496. package/hooks/modules/evidence/__init__.py +0 -34
  497. package/hooks/modules/evidence/assertions.py +0 -137
  498. package/hooks/modules/evidence/index_writer.py +0 -57
  499. package/hooks/modules/evidence/loader.py +0 -126
  500. package/hooks/modules/evidence/runner.py +0 -241
  501. package/skills/context-updater/SKILL.md +0 -87
  502. package/skills/context-updater/examples.md +0 -71
  503. package/skills/developer-patterns/SKILL.md +0 -50
  504. package/skills/developer-patterns/reference.md +0 -112
  505. package/skills/gaia-self-check/SKILL.md +0 -114
  506. package/skills/gaia-self-check/reference.md +0 -453
  507. package/skills/gitops-patterns/SKILL.md +0 -60
  508. package/skills/gitops-patterns/reference.md +0 -183
  509. package/skills/memory-curation/SKILL.md +0 -83
  510. package/skills/memory-search/SKILL.md +0 -88
  511. package/skills/orchestrator-approval/SKILL.md +0 -160
  512. package/skills/orchestrator-approval/reference.md +0 -174
  513. package/skills/request-approval/SKILL.md +0 -140
  514. package/skills/request-approval/examples.md +0 -140
  515. package/skills/request-approval/reference.md +0 -57
  516. package/skills/terraform-patterns/SKILL.md +0 -89
  517. package/skills/terraform-patterns/reference.md +0 -93
  518. package/tools/context/context_section_reader.py +0 -342
  519. package/tools/context/pending_updates.py +0 -760
  520. package/tools/persist_transcript_analysis.py +0 -85
  521. package/tools/review/__init__.py +0 -1
  522. package/tools/review/review_engine.py +0 -157
  523. package/tools/scan/setup.py +0 -686
@@ -8,7 +8,7 @@
8
8
  {
9
9
  "name": "gaia-ops",
10
10
  "description": "Full DevOps orchestration for Claude Code. Eight specialized agents handle the complete development lifecycle — analysis, planning, execution, and deployment. Gaia-Ops scans your codebase to understand it and injects the right context into each sub-agent. Every command is classified by risk: read-only runs freely, state changes pause for your approval, and irreversible operations are permanently blocked.",
11
- "version": "5.0.0-rc1",
11
+ "version": "5.0.2",
12
12
  "category": "devops",
13
13
  "author": {
14
14
  "name": "jaguilar87",
@@ -20,7 +20,7 @@
20
20
  {
21
21
  "name": "gaia-security",
22
22
  "description": "Keeps you in the loop only when it matters. Gaia Security analyzes every command and classifies it into risk tiers: read-only queries run freely, simulations and validations pass through, and state-changing operations (create, delete, apply, push) pause for your explicit approval before executing. Irreversible commands like dropping databases or deleting cloud infrastructure are permanently blocked.",
23
- "version": "5.0.0-rc1",
23
+ "version": "5.0.2",
24
24
  "category": "security",
25
25
  "author": {
26
26
  "name": "jaguilar87",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaia-ops",
3
- "version": "5.0.0-rc1",
3
+ "version": "5.0.2",
4
4
  "description": "Security-first orchestrator with specialized agents, hooks, and governance for AI coding",
5
5
  "author": {
6
6
  "name": "jaguilar87",
package/ARCHITECTURE.md CHANGED
@@ -38,7 +38,7 @@ pre_tool_use.py (PreToolUse hook)
38
38
  | 4. Validate SendMessage (agent resumption)
39
39
  v
40
40
  Agent executes
41
- | Uses tools, follows skills, emits json:contract
41
+ | Uses tools, follows skills, emits agent_contract_handoff
42
42
  v
43
43
  subagent_stop.py (SubagentStop hook)
44
44
  | 1. Read transcript, extract task description
@@ -46,11 +46,11 @@ subagent_stop.py (SubagentStop hook)
46
46
  | 3. Validate response contract
47
47
  | 4. Detect anomalies
48
48
  | 5. Store episodic memory
49
- | 6. Process CONTEXT_UPDATE blocks
49
+ | 6. Process update_contracts from the agent_contract_handoff envelope
50
50
  v
51
- Orchestrator processes json:contract (via agent-response skill)
51
+ Orchestrator processes agent_contract_handoff (via agent-response skill)
52
52
  | COMPLETE -> summarize to user
53
- | REVIEW (with approval_id) -> get approval -> resume via SendMessage
53
+ | APPROVAL_REQUEST (with approval_id) -> get approval -> resume via SendMessage
54
54
  | NEEDS_INPUT -> ask user -> resume via SendMessage
55
55
  | BLOCKED -> report blocker
56
56
  ```
@@ -108,7 +108,7 @@ Fires after every agent tool completes:
108
108
  4. Detect anomalies --> execution failures, consecutive failures
109
109
  | If anomalies found -> create needs_analysis.flag for Gaia
110
110
  5. Capture episodic memory --> store episode via tools/memory/episodic.py
111
- 6. Process context updates --> apply CONTEXT_UPDATE blocks via context_writer.py
111
+ 6. Process context updates --> apply update_contracts entries from the agent_contract_handoff envelope via context_writer.py (process_update_contracts)
112
112
  ```
113
113
 
114
114
  ## Surface Routing: surface_router.py
@@ -119,9 +119,9 @@ Classifies user tasks into surfaces using signal matching against `config/surfac
119
119
  |---------|--------------|-----------------|
120
120
  | `live_runtime` | cloud-troubleshooter | pods, services, logs, kubectl, gcloud |
121
121
  | `gitops_desired_state` | gitops-operator | manifests, Flux, Helm, Kustomize |
122
- | `terraform_iac` | terraform-architect | Terraform, Terragrunt, IAM, modules |
122
+ | `iac` | platform-architect | Terraform, Terragrunt, IAM, modules |
123
123
  | `app_ci_tooling` | developer | CI/CD, Docker, package tooling |
124
- | `planning_specs` | gaia-planner | briefs, plans, task breakdowns |
124
+ | `planning_specs` | gaia-planner | briefs, plans (materializados cuando una conversación alcanza Cerrar) |
125
125
  | `gaia_system` | gaia-system | hooks, skills, agents/, CLAUDE.md |
126
126
  | `workspace` | gaia-operator | memory, email, schedules, file transfers |
127
127
 
@@ -141,12 +141,11 @@ Assembles the context payload injected into agent prompts by pre_tool_use.py.
141
141
  ```
142
142
  context_provider.py <agent_name> <user_task>
143
143
  |
144
- +--> Load project-context.json
145
- +--> Detect cloud provider (GCP/AWS)
146
- +--> Load base contracts (config/context-contracts.json)
144
+ +--> Load project context from ~/.gaia/gaia.db (project_context_contracts table)
145
+ +--> Detect cloud provider (GCP/AWS) from DB workspace record
146
+ +--> Load base contracts from DB (agent_contract_permissions table)
147
147
  +--> Merge cloud overrides (config/cloud/{provider}.json)
148
148
  +--> Extract contracted sections for this agent (read permissions)
149
- +--> Load universal rules (config/universal-rules.json)
150
149
  +--> Load relevant episodic memory (similarity match)
151
150
  +--> Classify surfaces (surface_router.py)
152
151
  +--> Build investigation brief (surface_router.py)
@@ -172,7 +171,7 @@ Nonce-based T3 approval lifecycle:
172
171
  3. BashValidator generates 128-bit nonce via generate_nonce()
173
172
  4. write_pending_approval() saves pending-{nonce}.json to .claude/cache/approvals/
174
173
  5. Hook returns corrective deny (exit 0) with NONCE:{hex} in message
175
- 6. Agent includes NONCE:{hex} in REVIEW status to orchestrator
174
+ 6. Agent includes NONCE:{hex} in APPROVAL_REQUEST status to orchestrator
176
175
  7. Orchestrator presents plan to user, asks for approval
177
176
  8. User approves -> orchestrator resumes agent with "APPROVE:{nonce}"
178
177
  9. pre_tool_use.py detects APPROVE: prefix, calls activate_pending_approval()
@@ -182,9 +181,9 @@ Nonce-based T3 approval lifecycle:
182
181
 
183
182
  ## Response Contract Validation
184
183
 
185
- Every agent response must end with a `json:contract` block containing `agent_status`. The contract validator (`hooks/modules/agents/contract_validator.py`) enforces:
184
+ Every agent response must end with a `agent_contract_handoff` block containing `agent_status`. The contract validator (`hooks/modules/agents/contract_validator.py`) enforces:
186
185
 
187
- - **AGENT_STATUS**: PLAN_STATUS (from 5 valid states: COMPLETE, NEEDS_INPUT, REVIEW, BLOCKED, IN_PROGRESS), PENDING_STEPS, NEXT_ACTION, AGENT_ID
186
+ - **AGENT_STATUS**: PLAN_STATUS (from 5 valid states: COMPLETE, NEEDS_INPUT, APPROVAL_REQUEST, BLOCKED, IN_PROGRESS), PENDING_STEPS, NEXT_ACTION, AGENT_ID
188
187
  - **EVIDENCE_REPORT**: required for all valid states. Seven fields: PATTERNS_CHECKED, FILES_CHECKED, COMMANDS_RUN, KEY_OUTPUTS, VERBATIM_OUTPUTS, CROSS_LAYER_IMPACTS, OPEN_GAPS
189
188
  - **CONSOLIDATION_REPORT**: required when multi-surface or cross-check. Fields: OWNERSHIP_ASSESSMENT (enum), CONFIRMED_FINDINGS, SUSPECTED_FINDINGS, CONFLICTS, OPEN_GAPS, NEXT_BEST_AGENT
190
189
 
@@ -244,9 +243,9 @@ The adapter layer connects Claude Code's hook protocol to Gaia business logic th
244
243
  |-----------|-------|
245
244
  | **File** | `hooks/subagent_stop.py` |
246
245
  | **Hook event** | SubagentStop |
247
- | **What it does** | Fires after every agent completes. Consumes approval files, captures workflow metrics, validates the response contract (AGENT_STATUS, EVIDENCE_REPORT, CONSOLIDATION_REPORT), detects anomalies, stores episodic memory, and processes CONTEXT_UPDATE blocks. |
246
+ | **What it does** | Fires after every agent completes. Consumes approval files, captures workflow metrics, validates the response contract (AGENT_STATUS, EVIDENCE_REPORT, CONSOLIDATION_REPORT), detects anomalies, stores episodic memory, and processes the update_contracts array from the agent_contract_handoff envelope. |
248
247
  | **Adapter methods called** | `ClaudeCodeAdapter.parse_event()`, `ClaudeCodeAdapter.parse_agent_completion()` |
249
- | **Business logic modules** | `agents/response_contract.py` (`validate_response_contract`, `save_pending_repair`, `clear_pending_repair`), `tools/memory/episodic.py` (`EpisodicMemory.store_episode`), `context/context_writer.py` (`process_agent_output`) |
248
+ | **Business logic modules** | `agents/response_contract.py` (`validate_response_contract`, `save_pending_repair`, `clear_pending_repair`), `tools/memory/episodic.py` (`EpisodicMemory.store_episode`), `context/context_writer.py` (`process_update_contracts`) |
250
249
 
251
250
  ### CP-4: `hooks/modules/tools/hook_response.py` -- Response Formatting
252
251
 
@@ -328,8 +327,7 @@ To support a CLI other than Claude Code (e.g., a hypothetical Cursor or Windsurf
328
327
  | `tools/context/surface_router.py` | Surface classification and investigation briefs |
329
328
  | `tools/memory/episodic.py` | Episodic memory storage |
330
329
  | `config/context-contracts.json` | Agent read/write section permissions |
331
- | `config/universal-rules.json` | Universal and agent-specific rules |
332
330
  | `config/surface-routing.json` | Surface signals and routing config |
333
331
  | `agents/*.md` | Agent identity definitions |
334
332
  | `skills/*/SKILL.md` | Injected procedural knowledge |
335
- | `bin/*.js` | CLI tools (gaia-scan, gaia-doctor, gaia-status, etc.) |
333
+ | `bin/gaia` + `bin/cli/*.py` | Unified `gaia` CLI; subcommands auto-discovered from `bin/cli/` |
package/CHANGELOG.md CHANGED
@@ -7,6 +7,301 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.0.2] - 2026-06-03
11
+
12
+ ### Approval-Flow Hardening, mkdir Reclassification, Jira Skill
13
+
14
+ Patch release accumulating security and approval-flow fixes, one new skill, and a quality-of-life exemption for Gaia's own planning bookkeeping commands. All 4575 tests pass on a clean install.
15
+
16
+ #### Fixed
17
+
18
+ - **Stop double-approval on re-dispatched T3 grants** — a T3 command that was
19
+ re-dispatched after approval could be blocked a second time with a fresh nonce,
20
+ forcing the user to approve the same operation twice. Two gaps caused the grant miss:
21
+ `command_semantics` was not normalizing output-redirect tokens out of the semantic
22
+ signature (causing the retry signature to drift from the approved one), and
23
+ `bash_validator._find_pending_in_db` was matching too narrowly and minting a new
24
+ nonce instead of reusing the granted one. Both gaps are closed; a regression test
25
+ reproduces the redirect-normalization grant miss.
26
+
27
+ - **Flag-classifier grants + cross-session grant matching** — the flag-classifier
28
+ branch in `bash_validator` was never consulting approval grants, so curl-family T3
29
+ commands that had been approved were blocked again on retry. `check_db_semantic_grant`
30
+ is now session-agnostic (session is audit-only); `_find_pending_in_db` accepts
31
+ `all_sessions=True`; grant insert is fingerprint-idempotent so cross-session
32
+ block→approve→retry converges. `matches_approval_signature` derives identity from
33
+ `analyze_command` only; `_normalize_flag_token` binds long `--flag=value` tokens to
34
+ fix a critical over-match. Grant TTL raised from 5 to 60 minutes
35
+ (`APPROVAL_GRANT_TTL_MINUTES`), kept distinct from the 1440-minute pending TTL.
36
+
37
+ - **Unify T3 decision across bash validator classifiers** — mutative-verb,
38
+ `file_to_exec` composition, and flag-mutation classifiers now all route through a
39
+ single `decide_t3_outcome()` keyed on `has_orchestrator_above` (is_subagent AND
40
+ is_ops_mode). `file_to_exec` and curl flag-mutations no longer hardcode the native
41
+ CC approval dialog; in ops+subagent mode they produce `deny+approval_id` like
42
+ mutative verbs, keeping them inside the Gaia approval/audit trail. Local workspace
43
+ data files (`.json`/`.yaml`/`.csv`/`.txt`) are degraded to ALLOW for the
44
+ `file_to_exec` composition; network/decode→exec pipelines still BLOCK.
45
+
46
+ - **`mkdir` reclassified as T0 for non-sensitive working-tree paths** — `mkdir` on
47
+ relative, home-relative, or absolute non-system paths is non-destructive and
48
+ idempotent with `-p`; it no longer triggers T3. `mkdir` targeting kernel
49
+ pseudo-filesystems or privileged OS directories (`/dev`, `/sys`, `/proc`, `/etc`,
50
+ `/boot`, `/usr`, `/bin`, `/sbin`, `/lib`, `/lib64`, `/root`) retains T3. Scratch
51
+ space (`/tmp`, `/run`) is excluded — ephemeral, world-writable by design. Adds
52
+ `MKDIR_SENSITIVE_PATH_PREFIXES` (11 prefixes) and `_mkdir_targets_sensitive_path()`
53
+ in `mutative_verbs.py`.
54
+
55
+ #### Added
56
+
57
+ - **Schema v18 — stable project identity** — `project_identity` column and a partial
58
+ unique index on the `projects` table collapse the same physical repo scanned from
59
+ different vantages into one row. `store_populator.resolve_project_identity()` derives
60
+ stable identity from git-common-dir → normalized remote → realpath. Migration files:
61
+ `scripts/migrations/v17_to_v18.sql` and `v17_to_v18_fresh.sql`.
62
+
63
+ - **Skill `jira-ticket-writing`** — technique skill for writing human-readable Jira
64
+ Stories and Subtasks following Atlassian conventions: structured title formula,
65
+ acceptance criteria, story points, label taxonomy, and worked examples. User-invocable
66
+ (`user-invocable: true`); not injected into any agent frontmatter by default.
67
+
68
+ #### Changed
69
+
70
+ - **`gaia brief` / `gaia ac` exempted from T3 gate** — `gaia brief <verb>` and
71
+ `gaia ac <verb>` (`edit`/`set-status`/`set-field`/`add`/`remove`/`new`/`show`/`list`)
72
+ now classify as non-mutative. Local planning bookkeeping that is reversible and has no
73
+ external side effects is treated like `git commit`. The exemption is anchored to
74
+ `(base_cmd, subcommand)` — not a generic `gaia *` pattern — so the consent layer
75
+ (`gaia approvals approve/revoke`) and other groups (`gaia memory`) remain T3.
76
+ Whole-record destruction (`gaia brief delete`) and dangerous flags (`--force`) still
77
+ re-gate.
78
+
79
+ ## [5.0.0] - 2026-06-02
80
+
81
+ ### Stable Release: Scan Overhaul, Zero-Dep Install, Soft-Delete, DB-Canonical Context
82
+
83
+ Fifth major release of Gaia. Promotes the rc.7 release candidate to stable after passing the full dry-run, CI, and live-install gate. The headline work is a ground-up rewrite of the workspace scanner, a zero-dependency NPM install path, a soft-delete model for projects and workspaces, and the retirement of `project-context.json` in favour of the DB as the single canonical source of project context.
84
+
85
+ #### Added
86
+
87
+ - **Scan overhaul — taxonomy and recursive discovery** — `gaia scan` now classifies
88
+ discovered items across three orthogonal dimensions: *workspace* (the Claude Code
89
+ working environment), *project* (the user's source tree), and *installation* (the
90
+ Gaia artefacts wired into `.claude/`). Discovery walks recursively so nested
91
+ monorepo structures and workspace-within-workspace layouts are captured correctly.
92
+ Taxonomy is defined in `tools/scan/` and tested independently of the CLI.
93
+
94
+ - **On-demand `gaia scan <path>`** — the scan subcommand now accepts an explicit
95
+ target path, enabling agents to scan a directory that is not the current working
96
+ directory without changing cwd. Useful for multi-root workspaces and cross-project
97
+ context enrichment.
98
+
99
+ - **Scan/install separation + scan-core** — the scan pipeline is now split into a
100
+ pure discovery core (`scan-core`) with no install-time side effects, and a
101
+ separate install phase that consumes core output. This makes scan deterministic
102
+ and testable without triggering postinstall hooks, and lets the install phase be
103
+ skipped when scanning for context only.
104
+
105
+ - **Pure-NPM zero-dependency install** — `postinstall` now completes with zero
106
+ runtime npm dependencies. All install-time logic runs through `python3 bin/gaia
107
+ install --postinstall` (Python stdlib only). The devDependencies remain for build
108
+ tooling (`chalk`, `eslint`) but consumers take no transitive runtime deps.
109
+
110
+ - **Soft-delete for projects and workspaces** — `gaia scan` handles pruning
111
+ automatically: when a previously-registered project path is no longer found on
112
+ disk, the prune pass marks it missing; scanning a directory that has no Gaia
113
+ installation demotes the workspace (marks it missing) and tombstones its
114
+ projects. No explicit remove or demote commands exist — lifecycle state flows
115
+ from the scanner. Soft-deleted rows are hidden from list views. Schema migrated
116
+ from v12 to v17 to carry the new columns and the `project_workspace_archive`
117
+ table.
118
+
119
+ - **`project-context.json` retired — DB is canonical** — the on-disk
120
+ `project-context.json` file is no longer written or read by any Gaia component.
121
+ Project context lives exclusively in `~/.gaia/gaia.db` (tables `projects`,
122
+ `workspaces`, `project_resources`). The context provider and all CLI subcommands
123
+ read directly from the DB. Existing `project-context.json` files are ignored on
124
+ upgrade; run `gaia scan` to populate the DB.
125
+
126
+ #### Fixed
127
+
128
+ - **`gaia approvals list` crash** — `bin/cli/approvals.py` raised an unhandled
129
+ exception when the `approval_grants` table contained rows with a `None` nonce
130
+ (rows inserted by older schema versions). Added a null-guard before nonce
131
+ formatting; the command now lists all rows cleanly and marks legacy rows as
132
+ `(no nonce)`.
133
+
134
+ #### Changed
135
+
136
+ - **Schema v12 → v17** — five incremental migrations applied in lockstep with
137
+ `EXPECTED_SCHEMA_VERSION` in `bin/cli/doctor.py` and the bootstrap insert in
138
+ `scripts/bootstrap_database.sh`. The `test_schema_version_lockstep.py` test
139
+ confirms all three agree.
140
+
141
+ - **CI hardening** — `ci.yml` now runs the full pytest suite on Python 3.9, 3.11,
142
+ and 3.12 in parallel, blocks merges on any failure, and verifies `build:plugins`
143
+ produces valid `dist/` artefacts. The `validate-sandbox.sh` harness is wired
144
+ into the publish gate.
145
+
146
+ - **Suite green** — all Layer 1 tests pass on the three supported Python versions.
147
+ The scan-core and soft-delete paths are covered by dedicated test modules.
148
+
149
+ - **`bin/validate-sandbox.sh`** -- harness now drives `gaia` subcommands end
150
+ to end (no `gaia-X.js` callers remain). The 8-check matrix is unchanged.
151
+ Sandbox DB is now isolated via `GAIA_DATA_DIR` so memory checks run against
152
+ a seeded fixture DB rather than the global `~/.gaia/gaia.db`.
153
+
154
+ - **CLI docstrings** -- `bin/cli/*.py` modules dropped the
155
+ "Mirrors gaia-X.js" parity comments now that there is no JS counterpart on
156
+ disk to mirror.
157
+
158
+ #### Removed
159
+
160
+ - **Legacy JS CLI binaries** -- `bin/gaia-doctor.js`, `bin/gaia-status.js`,
161
+ `bin/gaia-history.js`, `bin/gaia-metrics.js`, `bin/gaia-cleanup.js`,
162
+ `bin/gaia-update.js`, `bin/gaia-uninstall.js`, `bin/gaia-skills-diagnose.js`,
163
+ `bin/gaia-review.js`, `bin/gaia-evidence`, `bin/gaia-scan` (Node wrapper),
164
+ and `bin/gaia-scan.py` are gone. The `bin` field in `package.json` now
165
+ exposes a single binary: `gaia`. Every subcommand previously available as
166
+ `npx gaia-X` is now reached through `gaia X` -- subcommands are discovered
167
+ automatically from `bin/cli/*.py` via the `register()` / `cmd_<name>()`
168
+ contract. Lifecycle scripts (`postinstall`, `preuninstall`) call
169
+ `python3 bin/gaia install --postinstall` and `python3 bin/gaia uninstall
170
+ --preuninstall` directly. `gaia-skills-diagnose`, `gaia-review`, and
171
+ `gaia-evidence` had no Python successor and are not migrated; for general
172
+ health checks use `gaia doctor`.
173
+
174
+ #### Internal
175
+
176
+ - Regenerated `dist/gaia-ops/` and `dist/gaia-security/` for 5.0.0.
177
+ - `pyproject.toml` version aligned with `package.json` at `5.0.0`.
178
+
179
+ ---
180
+
181
+ ## [5.0.0-rc.3] - 2026-04-26
182
+
183
+ ### Release Candidate 3: Python 3.9 Compatibility Fix
184
+
185
+ Hotfix for rc.2. The previous release shipped successfully to npm under
186
+ the `@rc` dist-tag but failed its post-publish sandbox harness gate
187
+ because `bin/cli/approvals.py` used PEP 604 union syntax (`X | None`)
188
+ which requires Python 3.10+ at module-import time. The publish.yml
189
+ runner pins Python 3.9, and the `ci.yml` test matrix also includes 3.9.
190
+ The plugin loader caught the resulting `ImportError` and emitted a
191
+ `Warning:` line that leaked into stdout, breaking JSON parsing for
192
+ several `gaia` subcommands on 3.9-only environments.
193
+
194
+ #### Fixed
195
+ - **Python 3.9 compatibility** — added `from __future__ import annotations`
196
+ to 7 files that used PEP 604 union syntax without it. With deferred
197
+ annotation evaluation, the type hints become string literals and no
198
+ longer execute the `|` operator at definition time. A repo-wide audit
199
+ of 21 PEP-604 files confirmed 14 were already safe (had `__future__`)
200
+ and 7 were the actual 3.9 breakers; all 7 are now fixed:
201
+ - `bin/cli/approvals.py` (the publish.yml-failing one)
202
+ - `bin/cli/plans.py`
203
+ - `bin/cli/context.py`
204
+ - `tests/cli/test_gaia_context.py`
205
+ - `tests/cli/test_gaia_plans.py`
206
+ - `tools/scan/tests/conftest.py`
207
+ - `tools/agentic-loop/record-iteration.py`
208
+
209
+ The audit also confirmed no PEP 634 `match` statements, no `TypeAlias`,
210
+ no runtime PEP 604 in `isinstance()`, and no runtime parameterized
211
+ stdlib generics, so the `__future__` route is sufficient — no actual
212
+ type-hint rewrites required.
213
+
214
+ 5.0.0-rc.2 is superseded by this release. Users on Python 3.10+ were
215
+ unaffected by the bug; users on Python 3.9 should upgrade to rc.3.
216
+ Failing run for reference:
217
+ https://github.com/metraton/gaia/actions/runs/24951053090
218
+
219
+ ## [5.0.0-rc.2] - 2026-04-26
220
+
221
+ ### Release Candidate 2: Converger Identity, Session Liveness, Install-Gate Hardening
222
+
223
+ Second release candidate for v5.0.0. Adds the orchestrator's Converger
224
+ ("Cerrar") conversational closure identity, real-PID session liveness in the
225
+ registry, the `agent-creation` and `session-reflection` skills, and an
226
+ end-to-end consumer-install validation harness that now actually exercises the
227
+ gate. Three install-time bugs surfaced and were fixed alongside the harness
228
+ that found them.
229
+
230
+ #### Added
231
+ - **Converger identity for orchestrator** — "Cerrar" conversational closure
232
+ framing. Brief-spec reframed as closure ritual (Size gate removed),
233
+ `planning_specs` surface routing narrowed to explicit artifact keywords,
234
+ architecture docs aligned with closure framing.
235
+ - **session-reflection skill** — conversational session-close ritual. Surfaced
236
+ by orchestrator at session end; complements `gaia-compact`.
237
+ - **agent-creation skill** — coach skill for designing new agents end-to-end:
238
+ identity, tool surface, contract, and verification.
239
+ - **SessionEnd hook + PID liveness** — `session_end_hook.py` for clean
240
+ unregister; session_registry now uses real PID + `/proc` starttime to detect
241
+ liveness across sessions. `Stop` hook no longer mutates the registry (was
242
+ causing premature unregister mid-conversation).
243
+ - **validate-sandbox.sh** — end-to-end consumer-install verification harness.
244
+ Two targets: `--target sandbox` (ephemeral fixture project) and
245
+ `--target local` (real workspace install with `--workspace` override). Eight
246
+ pass/fail checks: version, doctor, status, context show, memory stats,
247
+ memory search, scan, settings preservation. Wired into `publish.yml` so
248
+ every release smoke-tests the published tarball before notifying success.
249
+ - **`gaia:verify-install:{local,rc,latest}` and `gaia:install-local`** scripts
250
+ in package.json for manual local validation against tarballs or registry.
251
+
252
+ #### Changed
253
+ - **REVIEW → APPROVAL_REQUEST** rename across active doctrine (state machine,
254
+ skills, hooks). Comments and references in `hooks/**` updated. The previous
255
+ `REVIEW` state caused confusion with the human review activity; the new name
256
+ reflects what the state actually represents (an agent requesting human
257
+ approval for a specific T3 operation).
258
+ - **Stop hook decoupled from registry** — Stop event no longer mutates
259
+ session_registry. SessionEnd handles unregister cleanly; this avoids the
260
+ Stop-then-resume race where the registry would drop a still-active session.
261
+ - **`publish.yml`** — sandbox harness step added after npm publish; waits for
262
+ registry propagation, then runs validate-sandbox.sh against the freshly
263
+ published tarball as a smoke test.
264
+
265
+ #### Fixed
266
+ - **Sandbox harness on noexec /tmp** — validate-sandbox.sh now detects
267
+ `noexec` mounts via `findmnt` (with `/proc/mounts` fallback) and falls back
268
+ to `$TMPDIR` → `/tmp` → `$HOME/.cache/gaia-sandbox`. Previously the harness
269
+ was unrunnable on WSL/Linux setups with `noexec /tmp` (rc=126 Permission
270
+ denied on the installed bin shims); the gate appeared to validate but never
271
+ actually ran.
272
+ - **`gaia scan` harness check** — was invoking bare `gaia-scan --dry-run`,
273
+ which routes to `gaia-scan.py` whose argparse rejects `--dry-run`. Now uses
274
+ `gaia context scan --dry-run` (the higher-level CLI subcommand that does
275
+ accept `--dry-run`); drops the dead fallback.
276
+ - **doctor `<lambda>` check** — `cmd_doctor` wrapped each check in a bare
277
+ `lambda`, so any exception surfaced as `'<lambda>'` in the JSON output
278
+ hiding which check actually failed. Replaced with `functools.partial` so
279
+ `__name__` resolves to the wrapped function (e.g. `check_project_dirs`).
280
+ - **doctor `check_project_dirs` PosixPath/list TypeError** — code did
281
+ `project_root / dir_path` while iterating `paths.items()`; when a value was
282
+ a list (e.g. `"scan_targets": ["."]`), `Path / list` raised TypeError.
283
+ Values are now normalized to a flat sequence of `(label, str)` pairs before
284
+ joining; list values expand into `label[0]`, `label[1]`, ...
285
+ - **postinstall FTS5 backfill on fresh install** — `maybeBackfillFts5()`
286
+ returned early when `search.db` was missing with comment "doctor --fix will
287
+ create it on first use", but nothing in the install flow runs `doctor --fix`
288
+ automatically. A consumer reinstalling after `gaia uninstall` (which scrubs
289
+ search.db) would have an empty FTS5 index until manual intervention. The
290
+ early return is gone; missing search.db now falls through to `doctor --fix`
291
+ which creates and populates the index.
292
+ - **postinstall dynamic package resolution** — `gaia-update.js` now resolves
293
+ the gaia package name from `node_modules/@jaguilar87/` instead of
294
+ hardcoding, supporting both the v5+ `gaia` name and legacy `gaia-ops`. Also
295
+ detects and repairs symlinks pointing at the legacy path.
296
+ - **memory sentinel return** — sentinel value returned with a surfaced warning
297
+ instead of a silent failure when memory paths fail to resolve.
298
+
299
+ #### Internal
300
+ - **Regenerated plugin artifacts** — `dist/gaia-ops/` and `dist/gaia-security/`
301
+ rebuilt for rc2.
302
+ - **Cross-session liveness test** — real PID isolation in
303
+ `session_registry` test fixtures.
304
+
10
305
  ## [5.0.0-rc1] - 2026-04-21
11
306
 
12
307
  ### Release Candidate: Context Evals, Planner M1-M6, Memory CLI, Security Hardening
@@ -81,7 +376,7 @@ The unified CLI also provides subcommands that did not exist as standalone JS CL
81
376
  | `python3 bin/gaia plans list` | List all feature briefs |
82
377
  | `python3 bin/gaia plans show BRIEF_NAME` | Show a brief and plan |
83
378
  | `python3 bin/gaia context show` | Display project-context.json summary |
84
- | `python3 bin/gaia context scan` | Invoke gaia-scan to refresh context |
379
+ | `python3 bin/gaia context scan` | Refresh project-context via the scanner |
85
380
 
86
381
  #### Deprecation timeline
87
382
 
@@ -174,7 +469,7 @@ Contracts now fully control what context each agent receives. Removed the progre
174
469
  #### Changed
175
470
  - **context_provider.py**: Contracts are the single source of truth -- removed progressive disclosure filtering that overrode contract-defined sections
176
471
  - **context_provider.py**: Simplified output payload -- removed `enrichment` and `progressive_disclosure` keys from response
177
- - **contracts/terraform-architect.json**: Now reads `cluster_details` and `application_services` sections
472
+ - **contracts/platform-architect.json**: Now reads `cluster_details` and `application_services` sections
178
473
  - **contracts/gitops-operator.json**: Now reads `gcp_services` section (GCP overlay)
179
474
  - **pre_tool_use.py**: Updated log message to show sections count and rules count
180
475
  - **templates/CLAUDE.template.md**: Synced agent routing descriptions with CLAUDE.md
@@ -267,8 +562,8 @@ Major redesign of skills and agents. Skills now teach principles instead of enum
267
562
  - **`skills/reference.md`** - Agent template and npm release checklist (moved from gaia agent)
268
563
  - **`skills/terraform-patterns/reference.md`** - Full HCL examples
269
564
  - **`skills/gitops-patterns/reference.md`** - Full YAML examples
270
- - **`investigation` skill** assigned to cloud-troubleshooter, terraform-architect, gitops-operator, devops-developer, gaia
271
- - **`git-conventions` skill** assigned to terraform-architect, gitops-operator, devops-developer
565
+ - **`investigation` skill** assigned to cloud-troubleshooter, platform-architect, gitops-operator, devops-developer, gaia
566
+ - **`git-conventions` skill** assigned to platform-architect, gitops-operator, devops-developer
272
567
  - **`agent-protocol` + `security-tiers` skills** assigned to speckit-planner
273
568
 
274
569
  #### Metrics
@@ -565,7 +860,7 @@ Inspired by [memory-graph](https://github.com/gregorydickson/memory-graph) analy
565
860
  ### Changed - Agent Optimization
566
861
 
567
862
  - **agents/*.md** - All 6 agents reduced by 78%
568
- - terraform-architect: 916 → 183 lines
863
+ - platform-architect: 916 → 183 lines
569
864
  - gitops-operator: 1,238 → 217 lines
570
865
  - gcp-troubleshooter: 600 → 156 lines
571
866
  - aws-troubleshooter: 565 → 142 lines
@@ -649,7 +944,7 @@ Inspired by [memory-graph](https://github.com/gregorydickson/memory-graph) analy
649
944
  - Better Flux CD integration guidance
650
945
  - Enhanced troubleshooting protocols
651
946
 
652
- - **agents/terraform-architect.md** - Enhanced with 47 new lines
947
+ - **agents/platform-architect.md** - Enhanced with 47 new lines
653
948
  - Improved Terragrunt support
654
949
  - Better module design guidance
655
950
  - Enhanced security scanning protocols
package/CONTRIBUTING.md CHANGED
@@ -67,7 +67,7 @@ See [README.md](./README.md) for the full directory tree. Key areas for contribu
67
67
  | `tools/` | Orchestration tools (context provider, memory, validation) |
68
68
  | `config/` | Configuration files (contracts, git standards, rules) |
69
69
  | `tests/` | Test suite organized by layer |
70
- | `bin/` | CLI utilities (`gaia-scan`, `gaia-doctor`, etc.) |
70
+ | `bin/` | Unified `gaia` CLI -- subcommands live in `bin/cli/*.py` |
71
71
 
72
72
  ## Coding Standards
73
73
 
@@ -81,7 +81,9 @@ See [README.md](./README.md) for the full directory tree. Key areas for contribu
81
81
  ### JavaScript / Node.js
82
82
 
83
83
  - ES modules (`import`/`export`), not CommonJS.
84
- - Follow the existing patterns in `bin/` and `index.js`.
84
+ - The CLI surface is now Python (`bin/cli/*.py`); JS lives in `index.js`
85
+ (programmatic API helpers) and `bin/pre-publish-validate.js` /
86
+ `bin/python-detect.js` (tooling).
85
87
 
86
88
  ### Commit Messages
87
89