@jaguilar87/gaia 5.0.0-rc.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 (621) hide show
  1. package/.claude-plugin/marketplace.json +33 -0
  2. package/.claude-plugin/plugin.json +26 -0
  3. package/ARCHITECTURE.md +335 -0
  4. package/CHANGELOG.md +1298 -0
  5. package/CODE_OF_CONDUCT.md +11 -0
  6. package/CONTRIBUTING.md +146 -0
  7. package/INSTALL.md +436 -0
  8. package/LICENSE +21 -0
  9. package/README.md +222 -0
  10. package/SECURITY.md +47 -0
  11. package/agents/README.md +78 -0
  12. package/agents/cloud-troubleshooter.md +73 -0
  13. package/agents/developer.md +65 -0
  14. package/agents/gaia-operator.md +64 -0
  15. package/agents/gaia-orchestrator.md +111 -0
  16. package/agents/gaia-planner.md +53 -0
  17. package/agents/gaia-system.md +71 -0
  18. package/agents/gitops-operator.md +61 -0
  19. package/agents/terraform-architect.md +63 -0
  20. package/bin/README.md +106 -0
  21. package/bin/cli/__init__.py +1 -0
  22. package/bin/cli/approvals.py +740 -0
  23. package/bin/cli/cleanup.py +562 -0
  24. package/bin/cli/context.py +283 -0
  25. package/bin/cli/doctor.py +651 -0
  26. package/bin/cli/history.py +305 -0
  27. package/bin/cli/memory.py +483 -0
  28. package/bin/cli/metrics.py +1068 -0
  29. package/bin/cli/plans.py +515 -0
  30. package/bin/cli/status.py +302 -0
  31. package/bin/cli/update.py +382 -0
  32. package/bin/gaia +112 -0
  33. package/bin/gaia-cleanup.js +531 -0
  34. package/bin/gaia-doctor.js +635 -0
  35. package/bin/gaia-evidence +126 -0
  36. package/bin/gaia-history.js +251 -0
  37. package/bin/gaia-metrics.js +1278 -0
  38. package/bin/gaia-review.js +269 -0
  39. package/bin/gaia-scan +44 -0
  40. package/bin/gaia-scan.py +589 -0
  41. package/bin/gaia-skills-diagnose.js +929 -0
  42. package/bin/gaia-status.js +278 -0
  43. package/bin/gaia-uninstall.js +111 -0
  44. package/bin/gaia-update.js +919 -0
  45. package/bin/pre-publish-validate.js +610 -0
  46. package/bin/python-detect.js +60 -0
  47. package/bin/validate-sandbox.sh +601 -0
  48. package/commands/README.md +64 -0
  49. package/commands/gaia.md +37 -0
  50. package/commands/scan-project.md +67 -0
  51. package/config/README.md +71 -0
  52. package/config/cloud/aws.json +134 -0
  53. package/config/cloud/gcp.json +139 -0
  54. package/config/context-contracts.json +158 -0
  55. package/config/crons-schema.md +81 -0
  56. package/config/git_standards.json +72 -0
  57. package/config/surface-routing.json +417 -0
  58. package/config/universal-rules.json +102 -0
  59. package/dist/gaia-ops/.claude-plugin/plugin.json +24 -0
  60. package/dist/gaia-ops/README.md +80 -0
  61. package/dist/gaia-ops/agents/cloud-troubleshooter.md +73 -0
  62. package/dist/gaia-ops/agents/developer.md +65 -0
  63. package/dist/gaia-ops/agents/gaia-operator.md +64 -0
  64. package/dist/gaia-ops/agents/gaia-orchestrator.md +111 -0
  65. package/dist/gaia-ops/agents/gaia-planner.md +53 -0
  66. package/dist/gaia-ops/agents/gaia-system.md +71 -0
  67. package/dist/gaia-ops/agents/gitops-operator.md +61 -0
  68. package/dist/gaia-ops/agents/terraform-architect.md +63 -0
  69. package/dist/gaia-ops/commands/gaia.md +37 -0
  70. package/dist/gaia-ops/config/README.md +71 -0
  71. package/dist/gaia-ops/config/cloud/aws.json +134 -0
  72. package/dist/gaia-ops/config/cloud/gcp.json +139 -0
  73. package/dist/gaia-ops/config/context-contracts.json +158 -0
  74. package/dist/gaia-ops/config/crons-schema.md +81 -0
  75. package/dist/gaia-ops/config/git_standards.json +72 -0
  76. package/dist/gaia-ops/config/surface-routing.json +417 -0
  77. package/dist/gaia-ops/config/universal-rules.json +102 -0
  78. package/dist/gaia-ops/hooks/adapters/__init__.py +52 -0
  79. package/dist/gaia-ops/hooks/adapters/base.py +219 -0
  80. package/dist/gaia-ops/hooks/adapters/channel.py +17 -0
  81. package/dist/gaia-ops/hooks/adapters/claude_code.py +1890 -0
  82. package/dist/gaia-ops/hooks/adapters/types.py +194 -0
  83. package/dist/gaia-ops/hooks/adapters/utils.py +25 -0
  84. package/dist/gaia-ops/hooks/hooks.json +192 -0
  85. package/dist/gaia-ops/hooks/modules/__init__.py +15 -0
  86. package/dist/gaia-ops/hooks/modules/agents/__init__.py +29 -0
  87. package/dist/gaia-ops/hooks/modules/agents/contract_validator.py +647 -0
  88. package/dist/gaia-ops/hooks/modules/agents/response_contract.py +496 -0
  89. package/dist/gaia-ops/hooks/modules/agents/skill_injection_verifier.py +120 -0
  90. package/dist/gaia-ops/hooks/modules/agents/state_tracker.py +267 -0
  91. package/dist/gaia-ops/hooks/modules/agents/task_info_builder.py +74 -0
  92. package/dist/gaia-ops/hooks/modules/agents/transcript_analyzer.py +458 -0
  93. package/dist/gaia-ops/hooks/modules/agents/transcript_reader.py +152 -0
  94. package/dist/gaia-ops/hooks/modules/audit/__init__.py +28 -0
  95. package/dist/gaia-ops/hooks/modules/audit/event_detector.py +168 -0
  96. package/dist/gaia-ops/hooks/modules/audit/logger.py +131 -0
  97. package/dist/gaia-ops/hooks/modules/audit/metrics.py +134 -0
  98. package/dist/gaia-ops/hooks/modules/audit/workflow_auditor.py +611 -0
  99. package/dist/gaia-ops/hooks/modules/audit/workflow_recorder.py +296 -0
  100. package/dist/gaia-ops/hooks/modules/context/__init__.py +11 -0
  101. package/dist/gaia-ops/hooks/modules/context/agentic_loop_detector.py +165 -0
  102. package/dist/gaia-ops/hooks/modules/context/anchor_tracker.py +317 -0
  103. package/dist/gaia-ops/hooks/modules/context/compact_context_builder.py +218 -0
  104. package/dist/gaia-ops/hooks/modules/context/context_freshness.py +145 -0
  105. package/dist/gaia-ops/hooks/modules/context/context_injector.py +558 -0
  106. package/dist/gaia-ops/hooks/modules/context/context_writer.py +530 -0
  107. package/dist/gaia-ops/hooks/modules/context/contracts_loader.py +161 -0
  108. package/dist/gaia-ops/hooks/modules/core/__init__.py +40 -0
  109. package/dist/gaia-ops/hooks/modules/core/hook_entry.py +78 -0
  110. package/dist/gaia-ops/hooks/modules/core/paths.py +160 -0
  111. package/dist/gaia-ops/hooks/modules/core/plugin_mode.py +149 -0
  112. package/dist/gaia-ops/hooks/modules/core/plugin_setup.py +577 -0
  113. package/dist/gaia-ops/hooks/modules/core/state.py +179 -0
  114. package/dist/gaia-ops/hooks/modules/core/stdin.py +24 -0
  115. package/dist/gaia-ops/hooks/modules/events/__init__.py +1 -0
  116. package/dist/gaia-ops/hooks/modules/events/event_writer.py +210 -0
  117. package/dist/gaia-ops/hooks/modules/memory/__init__.py +8 -0
  118. package/dist/gaia-ops/hooks/modules/memory/episode_writer.py +216 -0
  119. package/dist/gaia-ops/hooks/modules/orchestrator/__init__.py +1 -0
  120. package/dist/gaia-ops/hooks/modules/orchestrator/delegate_mode.py +122 -0
  121. package/dist/gaia-ops/hooks/modules/scanning/__init__.py +8 -0
  122. package/dist/gaia-ops/hooks/modules/scanning/scan_trigger.py +84 -0
  123. package/dist/gaia-ops/hooks/modules/security/__init__.py +120 -0
  124. package/dist/gaia-ops/hooks/modules/security/approval_cleanup.py +87 -0
  125. package/dist/gaia-ops/hooks/modules/security/approval_constants.py +23 -0
  126. package/dist/gaia-ops/hooks/modules/security/approval_grants.py +1638 -0
  127. package/dist/gaia-ops/hooks/modules/security/approval_messages.py +71 -0
  128. package/dist/gaia-ops/hooks/modules/security/approval_scopes.py +222 -0
  129. package/dist/gaia-ops/hooks/modules/security/blocked_commands.py +595 -0
  130. package/dist/gaia-ops/hooks/modules/security/blocked_message_formatter.py +87 -0
  131. package/dist/gaia-ops/hooks/modules/security/command_semantics.py +181 -0
  132. package/dist/gaia-ops/hooks/modules/security/composition_rules.py +547 -0
  133. package/dist/gaia-ops/hooks/modules/security/flag_classifiers.py +873 -0
  134. package/dist/gaia-ops/hooks/modules/security/gitops_validator.py +179 -0
  135. package/dist/gaia-ops/hooks/modules/security/mutative_verbs.py +1131 -0
  136. package/dist/gaia-ops/hooks/modules/security/network_hosts.py +481 -0
  137. package/dist/gaia-ops/hooks/modules/security/prompt_validator.py +40 -0
  138. package/dist/gaia-ops/hooks/modules/security/shell_unwrapper.py +165 -0
  139. package/dist/gaia-ops/hooks/modules/security/tiers.py +196 -0
  140. package/dist/gaia-ops/hooks/modules/session/__init__.py +10 -0
  141. package/dist/gaia-ops/hooks/modules/session/pending_scanner.py +174 -0
  142. package/dist/gaia-ops/hooks/modules/session/session_context_writer.py +100 -0
  143. package/dist/gaia-ops/hooks/modules/session/session_event_injector.py +160 -0
  144. package/dist/gaia-ops/hooks/modules/session/session_manager.py +31 -0
  145. package/dist/gaia-ops/hooks/modules/session/session_registry.py +333 -0
  146. package/dist/gaia-ops/hooks/modules/tools/__init__.py +29 -0
  147. package/dist/gaia-ops/hooks/modules/tools/bash_validator.py +1008 -0
  148. package/dist/gaia-ops/hooks/modules/tools/cloud_pipe_validator.py +231 -0
  149. package/dist/gaia-ops/hooks/modules/tools/hook_response.py +55 -0
  150. package/dist/gaia-ops/hooks/modules/tools/shell_parser.py +227 -0
  151. package/dist/gaia-ops/hooks/modules/tools/stage_decomposer.py +315 -0
  152. package/dist/gaia-ops/hooks/modules/tools/task_validator.py +294 -0
  153. package/dist/gaia-ops/hooks/modules/validation/__init__.py +23 -0
  154. package/dist/gaia-ops/hooks/modules/validation/commit_validator.py +380 -0
  155. package/dist/gaia-ops/hooks/post_compact.py +43 -0
  156. package/dist/gaia-ops/hooks/post_tool_use.py +54 -0
  157. package/dist/gaia-ops/hooks/pre_compact.py +60 -0
  158. package/dist/gaia-ops/hooks/pre_tool_use.py +413 -0
  159. package/dist/gaia-ops/hooks/session_end_hook.py +77 -0
  160. package/dist/gaia-ops/hooks/session_start.py +81 -0
  161. package/dist/gaia-ops/hooks/stop_hook.py +70 -0
  162. package/dist/gaia-ops/hooks/subagent_start.py +71 -0
  163. package/dist/gaia-ops/hooks/subagent_stop.py +295 -0
  164. package/dist/gaia-ops/hooks/task_completed.py +70 -0
  165. package/dist/gaia-ops/hooks/user_prompt_submit.py +246 -0
  166. package/dist/gaia-ops/settings.json +72 -0
  167. package/dist/gaia-ops/skills/README.md +158 -0
  168. package/dist/gaia-ops/skills/agent-creation/SKILL.md +87 -0
  169. package/dist/gaia-ops/skills/agent-creation/examples.md +170 -0
  170. package/dist/gaia-ops/skills/agent-creation/reference.md +191 -0
  171. package/dist/gaia-ops/skills/agent-protocol/SKILL.md +93 -0
  172. package/dist/gaia-ops/skills/agent-protocol/examples.md +223 -0
  173. package/dist/gaia-ops/skills/agent-response/SKILL.md +69 -0
  174. package/dist/gaia-ops/skills/agentic-loop/SKILL.md +80 -0
  175. package/dist/gaia-ops/skills/agentic-loop/reference.md +378 -0
  176. package/dist/gaia-ops/skills/blog-writing/SKILL.md +98 -0
  177. package/dist/gaia-ops/skills/blog-writing/reference.md +130 -0
  178. package/dist/gaia-ops/skills/brief-spec/SKILL.md +185 -0
  179. package/dist/gaia-ops/skills/command-execution/SKILL.md +64 -0
  180. package/dist/gaia-ops/skills/command-execution/reference.md +83 -0
  181. package/dist/gaia-ops/skills/context-updater/SKILL.md +87 -0
  182. package/dist/gaia-ops/skills/context-updater/examples.md +71 -0
  183. package/dist/gaia-ops/skills/developer-patterns/SKILL.md +50 -0
  184. package/dist/gaia-ops/skills/developer-patterns/reference.md +112 -0
  185. package/dist/gaia-ops/skills/execution/SKILL.md +99 -0
  186. package/dist/gaia-ops/skills/fast-queries/SKILL.md +43 -0
  187. package/dist/gaia-ops/skills/gaia-compact/SKILL.md +74 -0
  188. package/dist/gaia-ops/skills/gaia-patterns/SKILL.md +108 -0
  189. package/dist/gaia-ops/skills/gaia-patterns/reference.md +395 -0
  190. package/dist/gaia-ops/skills/gaia-planner/SKILL.md +37 -0
  191. package/dist/gaia-ops/skills/gaia-planner/reference.md +107 -0
  192. package/dist/gaia-ops/skills/gaia-release/SKILL.md +85 -0
  193. package/dist/gaia-ops/skills/gaia-release/reference.md +92 -0
  194. package/dist/gaia-ops/skills/gaia-self-check/SKILL.md +114 -0
  195. package/dist/gaia-ops/skills/gaia-self-check/reference.md +453 -0
  196. package/dist/gaia-ops/skills/gaia-verify/SKILL.md +77 -0
  197. package/dist/gaia-ops/skills/gaia-verify/reference.md +80 -0
  198. package/dist/gaia-ops/skills/git-conventions/SKILL.md +47 -0
  199. package/dist/gaia-ops/skills/gitops-patterns/SKILL.md +60 -0
  200. package/dist/gaia-ops/skills/gitops-patterns/reference.md +183 -0
  201. package/dist/gaia-ops/skills/gmail-policy/SKILL.md +200 -0
  202. package/dist/gaia-ops/skills/gmail-policy/reference.md +150 -0
  203. package/dist/gaia-ops/skills/gmail-triage/SKILL.md +100 -0
  204. package/dist/gaia-ops/skills/gws-setup/SKILL.md +99 -0
  205. package/dist/gaia-ops/skills/gws-setup/reference.md +73 -0
  206. package/dist/gaia-ops/skills/investigation/SKILL.md +100 -0
  207. package/dist/gaia-ops/skills/memory-curation/SKILL.md +83 -0
  208. package/dist/gaia-ops/skills/memory-search/SKILL.md +88 -0
  209. package/dist/gaia-ops/skills/orchestrator-approval/SKILL.md +160 -0
  210. package/dist/gaia-ops/skills/orchestrator-approval/reference.md +174 -0
  211. package/dist/gaia-ops/skills/pending-approvals/SKILL.md +72 -0
  212. package/dist/gaia-ops/skills/pending-approvals/reference.md +214 -0
  213. package/dist/gaia-ops/skills/readme-writing/SKILL.md +71 -0
  214. package/dist/gaia-ops/skills/readme-writing/reference.md +188 -0
  215. package/dist/gaia-ops/skills/reference.md +135 -0
  216. package/dist/gaia-ops/skills/request-approval/SKILL.md +140 -0
  217. package/dist/gaia-ops/skills/request-approval/examples.md +140 -0
  218. package/dist/gaia-ops/skills/request-approval/reference.md +57 -0
  219. package/dist/gaia-ops/skills/schedule-task/SKILL.md +64 -0
  220. package/dist/gaia-ops/skills/schedule-task/reference.md +233 -0
  221. package/dist/gaia-ops/skills/security-tiers/SKILL.md +141 -0
  222. package/dist/gaia-ops/skills/security-tiers/destructive-commands-reference.md +623 -0
  223. package/dist/gaia-ops/skills/security-tiers/reference.md +39 -0
  224. package/dist/gaia-ops/skills/session-reflection/SKILL.md +69 -0
  225. package/dist/gaia-ops/skills/skill-creation/SKILL.md +92 -0
  226. package/dist/gaia-ops/skills/skill-creation/reference.md +29 -0
  227. package/dist/gaia-ops/skills/terraform-patterns/SKILL.md +89 -0
  228. package/dist/gaia-ops/skills/terraform-patterns/reference.md +93 -0
  229. package/dist/gaia-ops/tools/__init__.py +9 -0
  230. package/dist/gaia-ops/tools/agentic-loop/decide-status.py +210 -0
  231. package/dist/gaia-ops/tools/agentic-loop/parse-metric.py +106 -0
  232. package/dist/gaia-ops/tools/agentic-loop/record-iteration.py +221 -0
  233. package/dist/gaia-ops/tools/context/README.md +132 -0
  234. package/dist/gaia-ops/tools/context/__init__.py +42 -0
  235. package/dist/gaia-ops/tools/context/_paths.py +20 -0
  236. package/dist/gaia-ops/tools/context/context_provider.py +721 -0
  237. package/dist/gaia-ops/tools/context/context_section_reader.py +342 -0
  238. package/dist/gaia-ops/tools/context/deep_merge.py +159 -0
  239. package/dist/gaia-ops/tools/context/pending_updates.py +760 -0
  240. package/dist/gaia-ops/tools/context/surface_router.py +278 -0
  241. package/dist/gaia-ops/tools/fast-queries/README.md +65 -0
  242. package/dist/gaia-ops/tools/fast-queries/__init__.py +30 -0
  243. package/dist/gaia-ops/tools/fast-queries/appservices/quicktriage_devops_developer.sh +75 -0
  244. package/dist/gaia-ops/tools/fast-queries/cloud/aws/quicktriage_aws_troubleshooter.sh +32 -0
  245. package/dist/gaia-ops/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh +88 -0
  246. package/dist/gaia-ops/tools/fast-queries/gitops/quicktriage_gitops_operator.sh +48 -0
  247. package/dist/gaia-ops/tools/fast-queries/run_triage.sh +59 -0
  248. package/dist/gaia-ops/tools/fast-queries/terraform/quicktriage_terraform_architect.sh +80 -0
  249. package/dist/gaia-ops/tools/gaia_simulator/__init__.py +33 -0
  250. package/dist/gaia-ops/tools/gaia_simulator/cli.py +354 -0
  251. package/dist/gaia-ops/tools/gaia_simulator/extractor.py +457 -0
  252. package/dist/gaia-ops/tools/gaia_simulator/reporter.py +258 -0
  253. package/dist/gaia-ops/tools/gaia_simulator/routing_simulator.py +334 -0
  254. package/dist/gaia-ops/tools/gaia_simulator/runner.py +539 -0
  255. package/dist/gaia-ops/tools/gaia_simulator/skills_mapper.py +264 -0
  256. package/dist/gaia-ops/tools/memory/README.md +0 -0
  257. package/dist/gaia-ops/tools/memory/__init__.py +20 -0
  258. package/dist/gaia-ops/tools/memory/backfill_fts5.py +107 -0
  259. package/dist/gaia-ops/tools/memory/conflict_detector.py +295 -0
  260. package/dist/gaia-ops/tools/memory/episodic.py +1210 -0
  261. package/dist/gaia-ops/tools/memory/git_invalidator.py +262 -0
  262. package/dist/gaia-ops/tools/memory/paths.py +102 -0
  263. package/dist/gaia-ops/tools/memory/scoring.py +193 -0
  264. package/dist/gaia-ops/tools/memory/search_store.py +375 -0
  265. package/dist/gaia-ops/tools/persist_transcript_analysis.py +85 -0
  266. package/dist/gaia-ops/tools/review/__init__.py +1 -0
  267. package/dist/gaia-ops/tools/review/review_engine.py +157 -0
  268. package/dist/gaia-ops/tools/scan/__init__.py +35 -0
  269. package/dist/gaia-ops/tools/scan/config.py +247 -0
  270. package/dist/gaia-ops/tools/scan/merge.py +212 -0
  271. package/dist/gaia-ops/tools/scan/orchestrator.py +549 -0
  272. package/dist/gaia-ops/tools/scan/registry.py +127 -0
  273. package/dist/gaia-ops/tools/scan/scanners/__init__.py +18 -0
  274. package/dist/gaia-ops/tools/scan/scanners/base.py +137 -0
  275. package/dist/gaia-ops/tools/scan/scanners/environment.py +349 -0
  276. package/dist/gaia-ops/tools/scan/scanners/git.py +570 -0
  277. package/dist/gaia-ops/tools/scan/scanners/infrastructure.py +875 -0
  278. package/dist/gaia-ops/tools/scan/scanners/orchestration.py +600 -0
  279. package/dist/gaia-ops/tools/scan/scanners/stack.py +1085 -0
  280. package/dist/gaia-ops/tools/scan/scanners/tools.py +260 -0
  281. package/dist/gaia-ops/tools/scan/setup.py +686 -0
  282. package/dist/gaia-ops/tools/scan/tests/__init__.py +1 -0
  283. package/dist/gaia-ops/tools/scan/tests/conftest.py +796 -0
  284. package/dist/gaia-ops/tools/scan/tests/test_environment.py +323 -0
  285. package/dist/gaia-ops/tools/scan/tests/test_git.py +419 -0
  286. package/dist/gaia-ops/tools/scan/tests/test_infrastructure.py +382 -0
  287. package/dist/gaia-ops/tools/scan/tests/test_integration.py +920 -0
  288. package/dist/gaia-ops/tools/scan/tests/test_merge.py +269 -0
  289. package/dist/gaia-ops/tools/scan/tests/test_orchestration.py +304 -0
  290. package/dist/gaia-ops/tools/scan/tests/test_stack.py +604 -0
  291. package/dist/gaia-ops/tools/scan/tests/test_tools.py +349 -0
  292. package/dist/gaia-ops/tools/scan/ui.py +624 -0
  293. package/dist/gaia-ops/tools/scan/verify.py +270 -0
  294. package/dist/gaia-ops/tools/scan/walk.py +118 -0
  295. package/dist/gaia-ops/tools/scan/workspace.py +85 -0
  296. package/dist/gaia-ops/tools/validation/README.md +244 -0
  297. package/dist/gaia-ops/tools/validation/__init__.py +17 -0
  298. package/dist/gaia-ops/tools/validation/approval_gate.py +321 -0
  299. package/dist/gaia-ops/tools/validation/validate_skills.py +189 -0
  300. package/dist/gaia-security/.claude-plugin/plugin.json +24 -0
  301. package/dist/gaia-security/README.md +90 -0
  302. package/dist/gaia-security/config/universal-rules.json +102 -0
  303. package/dist/gaia-security/hooks/adapters/__init__.py +52 -0
  304. package/dist/gaia-security/hooks/adapters/base.py +219 -0
  305. package/dist/gaia-security/hooks/adapters/channel.py +17 -0
  306. package/dist/gaia-security/hooks/adapters/claude_code.py +1890 -0
  307. package/dist/gaia-security/hooks/adapters/types.py +194 -0
  308. package/dist/gaia-security/hooks/adapters/utils.py +25 -0
  309. package/dist/gaia-security/hooks/hooks.json +113 -0
  310. package/dist/gaia-security/hooks/modules/__init__.py +15 -0
  311. package/dist/gaia-security/hooks/modules/agents/__init__.py +29 -0
  312. package/dist/gaia-security/hooks/modules/agents/contract_validator.py +647 -0
  313. package/dist/gaia-security/hooks/modules/agents/response_contract.py +496 -0
  314. package/dist/gaia-security/hooks/modules/agents/skill_injection_verifier.py +120 -0
  315. package/dist/gaia-security/hooks/modules/agents/state_tracker.py +267 -0
  316. package/dist/gaia-security/hooks/modules/agents/task_info_builder.py +74 -0
  317. package/dist/gaia-security/hooks/modules/agents/transcript_analyzer.py +458 -0
  318. package/dist/gaia-security/hooks/modules/agents/transcript_reader.py +152 -0
  319. package/dist/gaia-security/hooks/modules/audit/__init__.py +28 -0
  320. package/dist/gaia-security/hooks/modules/audit/event_detector.py +168 -0
  321. package/dist/gaia-security/hooks/modules/audit/logger.py +131 -0
  322. package/dist/gaia-security/hooks/modules/audit/metrics.py +134 -0
  323. package/dist/gaia-security/hooks/modules/audit/workflow_auditor.py +611 -0
  324. package/dist/gaia-security/hooks/modules/audit/workflow_recorder.py +296 -0
  325. package/dist/gaia-security/hooks/modules/context/__init__.py +11 -0
  326. package/dist/gaia-security/hooks/modules/context/agentic_loop_detector.py +165 -0
  327. package/dist/gaia-security/hooks/modules/context/anchor_tracker.py +317 -0
  328. package/dist/gaia-security/hooks/modules/context/compact_context_builder.py +218 -0
  329. package/dist/gaia-security/hooks/modules/context/context_freshness.py +145 -0
  330. package/dist/gaia-security/hooks/modules/context/context_injector.py +558 -0
  331. package/dist/gaia-security/hooks/modules/context/context_writer.py +530 -0
  332. package/dist/gaia-security/hooks/modules/context/contracts_loader.py +161 -0
  333. package/dist/gaia-security/hooks/modules/core/__init__.py +40 -0
  334. package/dist/gaia-security/hooks/modules/core/hook_entry.py +78 -0
  335. package/dist/gaia-security/hooks/modules/core/paths.py +160 -0
  336. package/dist/gaia-security/hooks/modules/core/plugin_mode.py +149 -0
  337. package/dist/gaia-security/hooks/modules/core/plugin_setup.py +577 -0
  338. package/dist/gaia-security/hooks/modules/core/state.py +179 -0
  339. package/dist/gaia-security/hooks/modules/core/stdin.py +24 -0
  340. package/dist/gaia-security/hooks/modules/events/__init__.py +1 -0
  341. package/dist/gaia-security/hooks/modules/events/event_writer.py +210 -0
  342. package/dist/gaia-security/hooks/modules/memory/__init__.py +8 -0
  343. package/dist/gaia-security/hooks/modules/memory/episode_writer.py +216 -0
  344. package/dist/gaia-security/hooks/modules/orchestrator/__init__.py +1 -0
  345. package/dist/gaia-security/hooks/modules/orchestrator/delegate_mode.py +122 -0
  346. package/dist/gaia-security/hooks/modules/scanning/__init__.py +8 -0
  347. package/dist/gaia-security/hooks/modules/scanning/scan_trigger.py +84 -0
  348. package/dist/gaia-security/hooks/modules/security/__init__.py +120 -0
  349. package/dist/gaia-security/hooks/modules/security/approval_cleanup.py +87 -0
  350. package/dist/gaia-security/hooks/modules/security/approval_constants.py +23 -0
  351. package/dist/gaia-security/hooks/modules/security/approval_grants.py +1638 -0
  352. package/dist/gaia-security/hooks/modules/security/approval_messages.py +71 -0
  353. package/dist/gaia-security/hooks/modules/security/approval_scopes.py +222 -0
  354. package/dist/gaia-security/hooks/modules/security/blocked_commands.py +595 -0
  355. package/dist/gaia-security/hooks/modules/security/blocked_message_formatter.py +87 -0
  356. package/dist/gaia-security/hooks/modules/security/command_semantics.py +181 -0
  357. package/dist/gaia-security/hooks/modules/security/composition_rules.py +547 -0
  358. package/dist/gaia-security/hooks/modules/security/flag_classifiers.py +873 -0
  359. package/dist/gaia-security/hooks/modules/security/gitops_validator.py +179 -0
  360. package/dist/gaia-security/hooks/modules/security/mutative_verbs.py +1131 -0
  361. package/dist/gaia-security/hooks/modules/security/network_hosts.py +481 -0
  362. package/dist/gaia-security/hooks/modules/security/prompt_validator.py +40 -0
  363. package/dist/gaia-security/hooks/modules/security/shell_unwrapper.py +165 -0
  364. package/dist/gaia-security/hooks/modules/security/tiers.py +196 -0
  365. package/dist/gaia-security/hooks/modules/session/__init__.py +10 -0
  366. package/dist/gaia-security/hooks/modules/session/pending_scanner.py +174 -0
  367. package/dist/gaia-security/hooks/modules/session/session_context_writer.py +100 -0
  368. package/dist/gaia-security/hooks/modules/session/session_event_injector.py +160 -0
  369. package/dist/gaia-security/hooks/modules/session/session_manager.py +31 -0
  370. package/dist/gaia-security/hooks/modules/session/session_registry.py +333 -0
  371. package/dist/gaia-security/hooks/modules/tools/__init__.py +29 -0
  372. package/dist/gaia-security/hooks/modules/tools/bash_validator.py +1008 -0
  373. package/dist/gaia-security/hooks/modules/tools/cloud_pipe_validator.py +231 -0
  374. package/dist/gaia-security/hooks/modules/tools/hook_response.py +55 -0
  375. package/dist/gaia-security/hooks/modules/tools/shell_parser.py +227 -0
  376. package/dist/gaia-security/hooks/modules/tools/stage_decomposer.py +315 -0
  377. package/dist/gaia-security/hooks/modules/tools/task_validator.py +294 -0
  378. package/dist/gaia-security/hooks/modules/validation/__init__.py +23 -0
  379. package/dist/gaia-security/hooks/modules/validation/commit_validator.py +380 -0
  380. package/dist/gaia-security/hooks/post_tool_use.py +54 -0
  381. package/dist/gaia-security/hooks/pre_tool_use.py +413 -0
  382. package/dist/gaia-security/hooks/session_end_hook.py +77 -0
  383. package/dist/gaia-security/hooks/session_start.py +81 -0
  384. package/dist/gaia-security/hooks/stop_hook.py +70 -0
  385. package/dist/gaia-security/hooks/user_prompt_submit.py +246 -0
  386. package/dist/gaia-security/settings.json +58 -0
  387. package/git-hooks/commit-msg +41 -0
  388. package/hooks/README.md +100 -0
  389. package/hooks/adapters/__init__.py +52 -0
  390. package/hooks/adapters/base.py +219 -0
  391. package/hooks/adapters/channel.py +17 -0
  392. package/hooks/adapters/claude_code.py +1890 -0
  393. package/hooks/adapters/types.py +194 -0
  394. package/hooks/adapters/utils.py +25 -0
  395. package/hooks/elicitation_result.py +179 -0
  396. package/hooks/hooks.json +84 -0
  397. package/hooks/modules/README.md +189 -0
  398. package/hooks/modules/__init__.py +15 -0
  399. package/hooks/modules/agents/__init__.py +29 -0
  400. package/hooks/modules/agents/contract_validator.py +647 -0
  401. package/hooks/modules/agents/response_contract.py +496 -0
  402. package/hooks/modules/agents/skill_injection_verifier.py +120 -0
  403. package/hooks/modules/agents/state_tracker.py +267 -0
  404. package/hooks/modules/agents/task_info_builder.py +74 -0
  405. package/hooks/modules/agents/transcript_analyzer.py +458 -0
  406. package/hooks/modules/agents/transcript_reader.py +152 -0
  407. package/hooks/modules/audit/__init__.py +28 -0
  408. package/hooks/modules/audit/event_detector.py +168 -0
  409. package/hooks/modules/audit/logger.py +131 -0
  410. package/hooks/modules/audit/metrics.py +134 -0
  411. package/hooks/modules/audit/workflow_auditor.py +611 -0
  412. package/hooks/modules/audit/workflow_recorder.py +296 -0
  413. package/hooks/modules/context/__init__.py +11 -0
  414. package/hooks/modules/context/agentic_loop_detector.py +165 -0
  415. package/hooks/modules/context/anchor_tracker.py +317 -0
  416. package/hooks/modules/context/compact_context_builder.py +218 -0
  417. package/hooks/modules/context/context_freshness.py +145 -0
  418. package/hooks/modules/context/context_injector.py +558 -0
  419. package/hooks/modules/context/context_writer.py +530 -0
  420. package/hooks/modules/context/contracts_loader.py +161 -0
  421. package/hooks/modules/core/__init__.py +40 -0
  422. package/hooks/modules/core/hook_entry.py +78 -0
  423. package/hooks/modules/core/paths.py +160 -0
  424. package/hooks/modules/core/plugin_mode.py +149 -0
  425. package/hooks/modules/core/plugin_setup.py +577 -0
  426. package/hooks/modules/core/state.py +179 -0
  427. package/hooks/modules/core/stdin.py +24 -0
  428. package/hooks/modules/events/__init__.py +1 -0
  429. package/hooks/modules/events/event_writer.py +210 -0
  430. package/hooks/modules/evidence/__init__.py +34 -0
  431. package/hooks/modules/evidence/assertions.py +137 -0
  432. package/hooks/modules/evidence/index_writer.py +57 -0
  433. package/hooks/modules/evidence/loader.py +126 -0
  434. package/hooks/modules/evidence/runner.py +241 -0
  435. package/hooks/modules/memory/__init__.py +8 -0
  436. package/hooks/modules/memory/episode_writer.py +216 -0
  437. package/hooks/modules/orchestrator/__init__.py +1 -0
  438. package/hooks/modules/orchestrator/delegate_mode.py +122 -0
  439. package/hooks/modules/scanning/__init__.py +8 -0
  440. package/hooks/modules/scanning/scan_trigger.py +84 -0
  441. package/hooks/modules/security/__init__.py +120 -0
  442. package/hooks/modules/security/approval_cleanup.py +87 -0
  443. package/hooks/modules/security/approval_constants.py +23 -0
  444. package/hooks/modules/security/approval_grants.py +1638 -0
  445. package/hooks/modules/security/approval_messages.py +71 -0
  446. package/hooks/modules/security/approval_scopes.py +222 -0
  447. package/hooks/modules/security/blocked_commands.py +595 -0
  448. package/hooks/modules/security/blocked_message_formatter.py +87 -0
  449. package/hooks/modules/security/command_semantics.py +181 -0
  450. package/hooks/modules/security/composition_rules.py +547 -0
  451. package/hooks/modules/security/flag_classifiers.py +873 -0
  452. package/hooks/modules/security/gitops_validator.py +179 -0
  453. package/hooks/modules/security/mutative_verbs.py +1131 -0
  454. package/hooks/modules/security/network_hosts.py +481 -0
  455. package/hooks/modules/security/prompt_validator.py +40 -0
  456. package/hooks/modules/security/shell_unwrapper.py +165 -0
  457. package/hooks/modules/security/tiers.py +196 -0
  458. package/hooks/modules/session/__init__.py +10 -0
  459. package/hooks/modules/session/pending_scanner.py +174 -0
  460. package/hooks/modules/session/session_context_writer.py +100 -0
  461. package/hooks/modules/session/session_event_injector.py +160 -0
  462. package/hooks/modules/session/session_manager.py +31 -0
  463. package/hooks/modules/session/session_registry.py +333 -0
  464. package/hooks/modules/tools/__init__.py +29 -0
  465. package/hooks/modules/tools/bash_validator.py +1008 -0
  466. package/hooks/modules/tools/cloud_pipe_validator.py +231 -0
  467. package/hooks/modules/tools/hook_response.py +55 -0
  468. package/hooks/modules/tools/shell_parser.py +227 -0
  469. package/hooks/modules/tools/stage_decomposer.py +315 -0
  470. package/hooks/modules/tools/task_validator.py +294 -0
  471. package/hooks/modules/validation/__init__.py +23 -0
  472. package/hooks/modules/validation/commit_validator.py +380 -0
  473. package/hooks/post_compact.py +43 -0
  474. package/hooks/post_tool_use.py +54 -0
  475. package/hooks/pre_compact.py +60 -0
  476. package/hooks/pre_tool_use.py +413 -0
  477. package/hooks/session_end_hook.py +77 -0
  478. package/hooks/session_start.py +81 -0
  479. package/hooks/stop_hook.py +70 -0
  480. package/hooks/subagent_start.py +71 -0
  481. package/hooks/subagent_stop.py +295 -0
  482. package/hooks/task_completed.py +70 -0
  483. package/hooks/user_prompt_submit.py +246 -0
  484. package/index.js +83 -0
  485. package/package.json +103 -0
  486. package/pyproject.toml +32 -0
  487. package/skills/README.md +158 -0
  488. package/skills/agent-creation/SKILL.md +87 -0
  489. package/skills/agent-creation/examples.md +170 -0
  490. package/skills/agent-creation/reference.md +191 -0
  491. package/skills/agent-protocol/SKILL.md +93 -0
  492. package/skills/agent-protocol/examples.md +223 -0
  493. package/skills/agent-response/SKILL.md +69 -0
  494. package/skills/agentic-loop/SKILL.md +80 -0
  495. package/skills/agentic-loop/reference.md +378 -0
  496. package/skills/blog-writing/SKILL.md +98 -0
  497. package/skills/blog-writing/reference.md +130 -0
  498. package/skills/brief-spec/SKILL.md +185 -0
  499. package/skills/command-execution/SKILL.md +64 -0
  500. package/skills/command-execution/reference.md +83 -0
  501. package/skills/context-updater/SKILL.md +87 -0
  502. package/skills/context-updater/examples.md +71 -0
  503. package/skills/developer-patterns/SKILL.md +50 -0
  504. package/skills/developer-patterns/reference.md +112 -0
  505. package/skills/execution/SKILL.md +99 -0
  506. package/skills/fast-queries/SKILL.md +43 -0
  507. package/skills/gaia-compact/SKILL.md +74 -0
  508. package/skills/gaia-patterns/SKILL.md +108 -0
  509. package/skills/gaia-patterns/reference.md +395 -0
  510. package/skills/gaia-planner/SKILL.md +37 -0
  511. package/skills/gaia-planner/reference.md +107 -0
  512. package/skills/gaia-release/SKILL.md +85 -0
  513. package/skills/gaia-release/reference.md +92 -0
  514. package/skills/gaia-self-check/SKILL.md +114 -0
  515. package/skills/gaia-self-check/reference.md +453 -0
  516. package/skills/gaia-verify/SKILL.md +77 -0
  517. package/skills/gaia-verify/reference.md +80 -0
  518. package/skills/git-conventions/SKILL.md +47 -0
  519. package/skills/gitops-patterns/SKILL.md +60 -0
  520. package/skills/gitops-patterns/reference.md +183 -0
  521. package/skills/gmail-policy/SKILL.md +200 -0
  522. package/skills/gmail-policy/reference.md +150 -0
  523. package/skills/gmail-triage/SKILL.md +100 -0
  524. package/skills/gws-setup/SKILL.md +99 -0
  525. package/skills/gws-setup/reference.md +73 -0
  526. package/skills/investigation/SKILL.md +100 -0
  527. package/skills/memory-curation/SKILL.md +83 -0
  528. package/skills/memory-search/SKILL.md +88 -0
  529. package/skills/orchestrator-approval/SKILL.md +160 -0
  530. package/skills/orchestrator-approval/reference.md +174 -0
  531. package/skills/pending-approvals/SKILL.md +72 -0
  532. package/skills/pending-approvals/reference.md +214 -0
  533. package/skills/readme-writing/SKILL.md +71 -0
  534. package/skills/readme-writing/reference.md +188 -0
  535. package/skills/reference.md +135 -0
  536. package/skills/request-approval/SKILL.md +140 -0
  537. package/skills/request-approval/examples.md +140 -0
  538. package/skills/request-approval/reference.md +57 -0
  539. package/skills/schedule-task/SKILL.md +64 -0
  540. package/skills/schedule-task/reference.md +233 -0
  541. package/skills/security-tiers/SKILL.md +141 -0
  542. package/skills/security-tiers/destructive-commands-reference.md +623 -0
  543. package/skills/security-tiers/reference.md +39 -0
  544. package/skills/session-reflection/SKILL.md +69 -0
  545. package/skills/skill-creation/SKILL.md +92 -0
  546. package/skills/skill-creation/reference.md +29 -0
  547. package/skills/terraform-patterns/SKILL.md +89 -0
  548. package/skills/terraform-patterns/reference.md +93 -0
  549. package/templates/README.md +69 -0
  550. package/templates/managed-settings.template.json +43 -0
  551. package/tools/__init__.py +9 -0
  552. package/tools/agentic-loop/decide-status.py +210 -0
  553. package/tools/agentic-loop/parse-metric.py +106 -0
  554. package/tools/agentic-loop/record-iteration.py +221 -0
  555. package/tools/context/README.md +132 -0
  556. package/tools/context/__init__.py +42 -0
  557. package/tools/context/_paths.py +20 -0
  558. package/tools/context/context_provider.py +721 -0
  559. package/tools/context/context_section_reader.py +342 -0
  560. package/tools/context/deep_merge.py +159 -0
  561. package/tools/context/pending_updates.py +760 -0
  562. package/tools/context/surface_router.py +278 -0
  563. package/tools/fast-queries/README.md +65 -0
  564. package/tools/fast-queries/__init__.py +30 -0
  565. package/tools/fast-queries/appservices/quicktriage_devops_developer.sh +75 -0
  566. package/tools/fast-queries/cloud/aws/quicktriage_aws_troubleshooter.sh +32 -0
  567. package/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh +88 -0
  568. package/tools/fast-queries/gitops/quicktriage_gitops_operator.sh +48 -0
  569. package/tools/fast-queries/run_triage.sh +59 -0
  570. package/tools/fast-queries/terraform/quicktriage_terraform_architect.sh +80 -0
  571. package/tools/gaia_simulator/__init__.py +33 -0
  572. package/tools/gaia_simulator/cli.py +354 -0
  573. package/tools/gaia_simulator/extractor.py +457 -0
  574. package/tools/gaia_simulator/reporter.py +258 -0
  575. package/tools/gaia_simulator/routing_simulator.py +334 -0
  576. package/tools/gaia_simulator/runner.py +539 -0
  577. package/tools/gaia_simulator/skills_mapper.py +264 -0
  578. package/tools/memory/README.md +0 -0
  579. package/tools/memory/__init__.py +20 -0
  580. package/tools/memory/backfill_fts5.py +107 -0
  581. package/tools/memory/conflict_detector.py +295 -0
  582. package/tools/memory/episodic.py +1210 -0
  583. package/tools/memory/git_invalidator.py +262 -0
  584. package/tools/memory/paths.py +102 -0
  585. package/tools/memory/scoring.py +193 -0
  586. package/tools/memory/search_store.py +375 -0
  587. package/tools/persist_transcript_analysis.py +85 -0
  588. package/tools/review/__init__.py +1 -0
  589. package/tools/review/review_engine.py +157 -0
  590. package/tools/scan/__init__.py +35 -0
  591. package/tools/scan/config.py +247 -0
  592. package/tools/scan/merge.py +212 -0
  593. package/tools/scan/orchestrator.py +549 -0
  594. package/tools/scan/registry.py +127 -0
  595. package/tools/scan/scanners/__init__.py +18 -0
  596. package/tools/scan/scanners/base.py +137 -0
  597. package/tools/scan/scanners/environment.py +349 -0
  598. package/tools/scan/scanners/git.py +570 -0
  599. package/tools/scan/scanners/infrastructure.py +875 -0
  600. package/tools/scan/scanners/orchestration.py +600 -0
  601. package/tools/scan/scanners/stack.py +1085 -0
  602. package/tools/scan/scanners/tools.py +260 -0
  603. package/tools/scan/setup.py +686 -0
  604. package/tools/scan/tests/__init__.py +1 -0
  605. package/tools/scan/tests/conftest.py +796 -0
  606. package/tools/scan/tests/test_environment.py +323 -0
  607. package/tools/scan/tests/test_git.py +419 -0
  608. package/tools/scan/tests/test_infrastructure.py +382 -0
  609. package/tools/scan/tests/test_integration.py +920 -0
  610. package/tools/scan/tests/test_merge.py +269 -0
  611. package/tools/scan/tests/test_orchestration.py +304 -0
  612. package/tools/scan/tests/test_stack.py +604 -0
  613. package/tools/scan/tests/test_tools.py +349 -0
  614. package/tools/scan/ui.py +624 -0
  615. package/tools/scan/verify.py +270 -0
  616. package/tools/scan/walk.py +118 -0
  617. package/tools/scan/workspace.py +85 -0
  618. package/tools/validation/README.md +244 -0
  619. package/tools/validation/__init__.py +17 -0
  620. package/tools/validation/approval_gate.py +321 -0
  621. package/tools/validation/validate_skills.py +189 -0
@@ -0,0 +1,92 @@
1
+ # Gaia Release Reference
2
+
3
+ Detailed commands for dry-run, beta, and release modes. Read on-demand during release validation.
4
+
5
+ ## Dry-Run Steps (LOCAL)
6
+
7
+ The fastest path is `npm run gaia:verify-install:local` -- it packs, installs into `/tmp/gaia-sandbox-<ts>/`, runs the 8-check harness, and cleans up. Use the manual sequence below only when you need to poke at the sandbox interactively.
8
+
9
+ 1. Build both plugins:
10
+ `npm run build:plugins`
11
+ 2. Validate build:
12
+ `npm run pre-publish:validate`
13
+ 3. Run the harness (does pack + install + checks):
14
+ `npm run gaia:verify-install:local`
15
+ - Or for a registry version: `npm run gaia:verify-install:rc` / `gaia:verify-install:latest`
16
+ - Harness uses `$WORKSPACE/node_modules/.bin/gaia` directly via PATH (no `npx` indirection).
17
+ 4. For manual inspection, run with `--stay` to keep the sandbox:
18
+ ```
19
+ npm pack
20
+ bash bin/validate-sandbox.sh --tarball ./jaguilar87-gaia-*.tgz --target sandbox --stay
21
+ ```
22
+ Sandbox path prints on exit; inspect `.claude/`, rerun checks, then `rm -rf` manually.
23
+ 5. Test BOTH modes (requires restarting `claude` in the sandbox dir):
24
+ - Default (ops): start `claude`, verify orchestrator, delegation, T3 nonce approval
25
+ - Security: `GAIA_PLUGIN_MODE=security claude`, verify no agents, native T3 dialog
26
+ 6. Test plugin channel (if applicable):
27
+ `claude --plugin-dir /path/to/gaia-ops-dev/dist/gaia-ops`
28
+ 7. Run test pyramid:
29
+ - L1: `npm test` (from gaia-ops-dev, not test project)
30
+ - Routing: `python3 tools/gaia_simulator/cli.py "<test prompt>"`
31
+
32
+ **Default path:** `/tmp/gaia-sandbox-<unix-ts>-<pid>/` (created by harness).
33
+ **Cleanup:** Automatic unless `--stay` is passed.
34
+
35
+ ## Beta Steps (PIPELINE)
36
+
37
+ 1. All dry-run steps must pass locally first
38
+ 2. Version bump with pre-release tag:
39
+ `npm version preminor --preid=beta` (or `premajor` for breaking changes)
40
+ 3. Commit and push the version bump (PR or direct to main)
41
+ 4. Create a GitHub Release:
42
+ - Tag: the version from package.json (e.g., `v5.3.0-beta.0`)
43
+ - Title: version number
44
+ - Mark as pre-release
45
+ 5. `publish.yml` triggers automatically and publishes with `--tag beta`
46
+ 6. Verify from npm (harness path -- installs into `/tmp/` sandbox and runs the 8 checks):
47
+ ```
48
+ bash bin/validate-sandbox.sh --version "@jaguilar87/gaia@beta" --target sandbox
49
+ ```
50
+
51
+ **To promote beta to latest:** `npm dist-tag add @jaguilar87/gaia@X.Y.Z latest`
52
+
53
+ ## Release Steps (PIPELINE)
54
+
55
+ 1. All dry-run steps must pass locally first
56
+ 2. Version bump:
57
+ `npm version minor` (or `major` / `patch` as appropriate)
58
+ 3. Commit and push the version bump to main
59
+ 4. Create a GitHub Release:
60
+ - Tag: the version from package.json (e.g., `v5.3.0`)
61
+ - Title: version number
62
+ - Generate release notes from commits
63
+ 5. `publish.yml` triggers automatically and publishes with `--tag latest`
64
+ 6. Verify from npm (harness path -- installs into `/tmp/` sandbox and runs the 8 checks):
65
+ ```
66
+ npm run gaia:verify-install:latest
67
+ ```
68
+
69
+ ## Pipeline Details
70
+
71
+ The `publish.yml` workflow (`.github/workflows/publish.yml`) runs on every GitHub Release event. It:
72
+ - Checks out the exact tagged commit
73
+ - Installs deps with `npm ci`
74
+ - Builds plugins with `npm run build:plugins`
75
+ - Verifies all expected artifacts in `dist/`
76
+ - Commits built artifacts back if changed
77
+ - Runs `npm run pre-publish:validate`
78
+ - Auto-detects npm tag from version string:
79
+ - `*-beta.*` -> `--tag beta`
80
+ - `*-rc.*` -> `--tag rc`
81
+ - `*-alpha.*` -> `--tag alpha`
82
+ - everything else -> `--tag latest`
83
+ - Publishes with `npm publish --access public --tag <detected>`
84
+ - `NPM_TOKEN` is stored in GitHub Secrets (never local)
85
+
86
+ ## Path Defaults
87
+
88
+ | User says | Path used |
89
+ |-----------|-----------|
90
+ | "here" / "this session" / "this project" / live mode | Nearest `.claude/` ancestor of cwd with a Gaia marker, falling back to `$HOME/ws/me/` if present |
91
+ | "in project X" / specific path | Pass `--workspace /absolute/path/to/project` to `bin/validate-sandbox.sh` (bypasses auto-detect) |
92
+ | Nothing specified (dry-run/beta verify) | `/tmp/gaia-sandbox-<unix-ts>-<pid>/` (auto-cleanup unless `--stay`) |
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: gaia-self-check
3
+ description: Use when the user asks to validate Gaia internal consistency, audit the local installation, or check that skills, agents, and commands in .claude/ are coherent
4
+ metadata:
5
+ user-invocable: true
6
+ type: technique
7
+ ---
8
+
9
+ # Gaia Self-Check
10
+
11
+ ## Overview
12
+
13
+ Validates the internal consistency of a Gaia installation by inspecting only
14
+ `.claude/` on disk. The skill has one job: inventory the components, compare
15
+ their declared state against their physical state, and surface discrepancies.
16
+ It never reaches outside the installation -- no external repo, no network, no
17
+ cloud API.
18
+
19
+ The principle that keeps this skill safe is **ask-before-fix**: the skill may
20
+ detect a broken cross-reference and know exactly how to repair it, but it
21
+ never applies the fix on its own. Every proposed change is presented to the
22
+ user as a concrete propuesta and waits for explicit aprobación before any
23
+ edit happens.
24
+
25
+ ## When to activate
26
+
27
+ The user says things like:
28
+ - "check gaia", "valida consistencia", "audita la instalación"
29
+ - "mis skills están rotas?", "hay referencias colgantes?"
30
+ - "gaia self-check", "self-check", "sanity check de .claude"
31
+
32
+ If the intent is to verify the install **pipeline** (npm, dry-run, beta,
33
+ release), that is `gaia-verify`, not this skill. If the intent is to diagnose
34
+ a symlink or path problem at the CLI level, that is `gaia-doctor`.
35
+
36
+ ## The 3-step cycle
37
+
38
+ Every run follows the same three phases. Detailed operational instructions
39
+ for each phase live in `reference.md`.
40
+
41
+ ### 1. Inventario
42
+
43
+ Walk `.claude/skills/`, `.claude/agents/`, `.claude/commands/` and build a
44
+ list of every component present. Read each component's frontmatter and
45
+ record declared metadata (name, description, references). Hooks are only
46
+ inventoried if `settings.json` references them. Nothing outside `.claude/`
47
+ is touched.
48
+
49
+ *[expanded in T2 -- details on which directories to scan and how to parse
50
+ frontmatter tolerantly]*
51
+
52
+ ### 2. Checks de consistencia
53
+
54
+ For each component, compare declared state against physical state. The
55
+ categories of checks are:
56
+
57
+ - **Frontmatter validity** -- YAML parses, required fields present.
58
+ - **Name vs dirname** -- the `name` field matches the directory or file name.
59
+ - **Cross-references** -- skill-to-skill or agent-to-skill references point
60
+ to components that exist physically.
61
+ - **Routing consistency** -- agents mentioned in routing config exist.
62
+ - **README listings** -- if a README exists, listed files are present and
63
+ present files are listed.
64
+
65
+ *[expanded in T2 -- full per-category check rules and report format]*
66
+
67
+ ### 3. Propuesta con aprobación
68
+
69
+ For every inconsistency found, build a concrete propuesta: which file, what
70
+ change, what effect. Present the list to the user and wait for explicit
71
+ aprobación per item (or a global confirmation if the mechanism does not
72
+ support per-item). Record which fixes were aprobado and which were rechazado.
73
+ Never apply a change without this approval step -- that is the
74
+ ask-before-fix guard.
75
+
76
+ *[expanded in T3 -- full propuesta format, approval mechanism, handling of
77
+ ambiguous cases]*
78
+
79
+ ## Operating principle: ask-before-fix
80
+
81
+ The skill is allowed to be wrong. A proposed fix may misread the user's
82
+ intent, may touch a file the user wanted stale on purpose, or may conflict
83
+ with an in-flight change. The ask-before-fix principle exists precisely
84
+ because the skill cannot distinguish "inconsistency" from "deliberate
85
+ deviation" on its own.
86
+
87
+ Practical consequence: the output of this skill is always a **report + a
88
+ list of propuestas**, never a mutated file. The skill surfaces findings and
89
+ waits. The user decides.
90
+
91
+ ## Output shape
92
+
93
+ The terminal output is the report. Structure and examples live in
94
+ `reference.md` under "Output Format". The short version: one table per
95
+ category, columns for component, type, inconsistencia, and fix propuesto.
96
+
97
+ ## Out of scope
98
+
99
+ - Anything outside `.claude/` -- no cloning repos, no fetching remotes.
100
+ - Running tests or builds -- consistency checks only, no execution.
101
+ - Applying fixes automatically -- ask-before-fix applies always.
102
+ - Network access of any kind.
103
+
104
+ ## Anti-patterns
105
+
106
+ - **Auto-fixing "obvious" issues** -- every auto-fix bypasses ask-before-fix
107
+ and teaches the skill that some categories of change are safe to take
108
+ unilaterally. None are.
109
+ - **Hard-failing on one bad frontmatter** -- one malformed YAML should be
110
+ reported as an inconsistency, not stop the whole scan.
111
+ - **Cross-referencing external state** -- the moment the skill reads outside
112
+ `.claude/`, it stops being a self-check and becomes an environment audit.
113
+ - **Silent propuestas** -- a fix that is not shown to the user in
114
+ human-readable form cannot be aprobado with informed consent.
@@ -0,0 +1,453 @@
1
+ # Gaia Self-Check -- Reference
2
+
3
+ Operational detail for the three phases of the self-check cycle. The main
4
+ SKILL.md defines the cycle and the ask-before-fix principle; this file
5
+ holds the per-category check rules, output format, and propuesta mechanics.
6
+
7
+ This reference is intentionally a scaffold. T2 expands the per-category
8
+ check rules. T3 expands the propuesta + aprobación flow. Placeholders below
9
+ mark where each expansion lands.
10
+
11
+ ## Scope
12
+
13
+ The skill operates exclusively on `.claude/`. The inventory walk covers:
14
+
15
+ | Directory | Component | Always scanned |
16
+ |-----------|-----------|----------------|
17
+ | `.claude/skills/` | Skills | Yes |
18
+ | `.claude/agents/` | Agents | Yes |
19
+ | `.claude/commands/` | Slash commands | Yes |
20
+ | `.claude/hooks/` | Hooks | Yes |
21
+
22
+ No path outside `.claude/` is read, regardless of what a component's
23
+ frontmatter references.
24
+
25
+ ## Output Format
26
+
27
+ The report is terminal-friendly markdown: one section per category, each
28
+ with a table. Empty categories are reported as "OK" so the user can see
29
+ the scan covered them.
30
+
31
+ Columns:
32
+
33
+ | Column | Meaning |
34
+ |--------|---------|
35
+ | Componente | File or directory name |
36
+ | Tipo | Skill / Agent / Command / Hook |
37
+ | Inconsistencia | One-line description of what is wrong |
38
+ | Fix propuesto | One-line description of the proposed change |
39
+
40
+ Each category section below contains a concrete example table. An empty
41
+ category (no findings) is reported as a single "OK" row so the user can
42
+ confirm the scan covered it.
43
+
44
+ At the end of the report, a summary line: `N inconsistencias encontradas
45
+ en M componentes. Propuesta pendiente de aprobación.`
46
+
47
+ ## Categorías de checks
48
+
49
+ Each category describes: what to verify, how to detect it, and what a
50
+ positive finding (inconsistency) looks like. The agent reads the relevant
51
+ files using Read and Glob tools -- no shell commands, no external state.
52
+
53
+ ### Frontmatter validity
54
+
55
+ **Qué verifica:** Every `SKILL.md` (in `skills/*/`), `*.md` agent file (in
56
+ `agents/`), and `*.md` command file (in `commands/`) must have a YAML
57
+ frontmatter block delimited by `---` that parses without error.
58
+
59
+ **Cómo detectarlo:**
60
+
61
+ ```
62
+ for each component file:
63
+ content = Read(file)
64
+ if content does not contain '---' at start and again later:
65
+ FINDING: missing frontmatter block
66
+ else:
67
+ block = text between first and second '---'
68
+ try parse as YAML:
69
+ if parse error: FINDING: malformed YAML frontmatter
70
+ if required fields missing (name, description):
71
+ FINDING: missing required field <field>
72
+ ```
73
+
74
+ Required fields by component type:
75
+
76
+ | Type | Required fields | Notes |
77
+ |------|----------------|-------|
78
+ | Skill (`SKILL.md`) | `name`, `description` | |
79
+ | Agent (`agents/*.md`) | `name`, `description`, `tools` | `tools` is the correct field; `allowed-tools` is not valid here |
80
+ | Command (`commands/*.md`) | `name`, `description` | Commands use `allowed-tools` (not `tools`) for tool restrictions -- both field names are valid depending on whether the command is a CC slash command or an agent-facing command |
81
+
82
+ **Convención `tools` vs `allowed-tools`:** Agent frontmatters declare their tool access with `tools`. Command frontmatters (slash commands) use `allowed-tools` when restricting tool access. These are two distinct conventions for two distinct component types. When validating frontmatter, apply the correct expected field per component type -- flagging `allowed-tools` in a command as "wrong field" is a false positive.
83
+
84
+ **Ejemplo de finding:**
85
+
86
+ | Componente | Tipo | Inconsistencia | Fix propuesto |
87
+ |------------|------|----------------|---------------|
88
+ | `skills/my-skill/SKILL.md` | Skill | Frontmatter YAML inválido: mapping values not allowed here (line 3) | Corregir indentación YAML en el frontmatter |
89
+ | `agents/my-agent.md` | Agent | Campo requerido `tools` ausente del frontmatter | Agregar `tools:` con la lista de herramientas del agent |
90
+
91
+ ---
92
+
93
+ ### Name-directory match (dirname)
94
+
95
+ **Qué verifica:** The `name` field in the frontmatter must match the
96
+ component's directory name (for skills) or file stem (for agents and
97
+ commands).
98
+
99
+ **Cómo detectarlo:**
100
+
101
+ ```
102
+ skills:
103
+ for each dir in .claude/skills/ (skip README.md, reference.md):
104
+ skill_file = dir / SKILL.md
105
+ name_in_frontmatter = yaml(skill_file).get('name')
106
+ expected = dir.name # e.g. "gaia-self-check"
107
+ if name_in_frontmatter != expected:
108
+ FINDING: name mismatch
109
+
110
+ agents:
111
+ for each file in .claude/agents/*.md:
112
+ name_in_frontmatter = yaml(file).get('name')
113
+ expected = file.stem # e.g. "gaia-system" from "gaia-system.md"
114
+ if name_in_frontmatter != expected:
115
+ FINDING: name mismatch
116
+
117
+ commands: same pattern as agents
118
+ ```
119
+
120
+ **Ejemplo de finding:**
121
+
122
+ | Componente | Tipo | Inconsistencia | Fix propuesto |
123
+ |------------|------|----------------|---------------|
124
+ | `skills/gaia-ops/SKILL.md` | Skill | `name: gaia_ops` en frontmatter, directorio es `gaia-ops` | Cambiar `name` a `gaia-ops` en el frontmatter |
125
+ | `agents/terraform.md` | Agent | `name: terraform-architect` en frontmatter, archivo es `terraform.md` | Renombrar archivo a `terraform-architect.md` o corregir `name` |
126
+
127
+ ---
128
+
129
+ ### Cross-references resolvables (cross-reference)
130
+
131
+ **Qué verifica:** References from a component's frontmatter to other skills
132
+ must point to directories that exist physically in `.claude/skills/`. This
133
+ catches renamed or deleted skills that are still listed as dependencies.
134
+
135
+ **Cómo detectarlo:**
136
+
137
+ ```
138
+ for each SKILL.md:
139
+ yaml_data = parse frontmatter
140
+ refs = yaml_data.get('skills', []) # list of skill names
141
+ for each ref in refs:
142
+ target = .claude/skills/<ref>/
143
+ if target directory does not exist:
144
+ FINDING: cross-reference to missing skill
145
+ ```
146
+
147
+ Also check narrative cross-references in the body: if the file body
148
+ mentions a `skills/<name>/` path, verify that path exists under `.claude/`.
149
+ This is best-effort -- report only paths that look like structured
150
+ references (e.g., `` `skills/foo/SKILL.md` ``), not every mention of a name.
151
+
152
+ **Ejemplo de finding:**
153
+
154
+ | Componente | Tipo | Inconsistencia | Fix propuesto |
155
+ |------------|------|----------------|---------------|
156
+ | `agents/gaia-system.md` | Agent | Skill `nah-patterns` referenciada en frontmatter no existe en `.claude/skills/` | Eliminar `nah-patterns` del frontmatter o crear la skill |
157
+
158
+ ---
159
+
160
+ ### Orphan/listed consistency (routing)
161
+
162
+ **Qué verifica:** Three independent sub-checks. Each sub-check targets a
163
+ distinct source of truth that drifts independently.
164
+
165
+ #### Sub-check A: Orphan detection (skills)
166
+
167
+ A skill is an orphan only when it meets both conditions simultaneously:
168
+
169
+ 1. No agent frontmatter anywhere in `.claude/agents/` lists it under `skills:`.
170
+ 2. It is absent from the directory tree in `skills/README.md`.
171
+
172
+ If the skill appears in at least one agent's `skills:` list, it is a
173
+ **referenced skill** -- not an orphan. It may still be missing from the README
174
+ tree (that is doc drift, see Sub-check B), but it is not orphaned.
175
+
176
+ ```
177
+ skills_on_disk = {dir.name for dir in .claude/skills/ if (dir/SKILL.md).exists()}
178
+ agent_referenced = {skill for each agent in .claude/agents/*.md
179
+ for skill in yaml(agent).get('skills', [])}
180
+ skills_in_tree = {name parsed from directory tree section of skills/README.md}
181
+
182
+ orphans = skills_on_disk - agent_referenced - skills_in_tree
183
+ doc_drift = (skills_on_disk & agent_referenced) - skills_in_tree
184
+ ```
185
+
186
+ `orphans` -> FINDING: skill not referenced by any agent and absent from README
187
+ `doc_drift` -> FINDING (lower severity): skill is referenced by agents but missing from README tree
188
+
189
+ #### Sub-check B: README sources of truth
190
+
191
+ `skills/README.md` contains two distinct structures that drift independently:
192
+
193
+ 1. **Directory tree**: the visual listing of skill directories.
194
+ 2. **Skill-to-agent assignment matrix**: which skills are assigned to which agents.
195
+
196
+ Verify both explicitly:
197
+
198
+ ```
199
+ # Tree check
200
+ skills_in_tree = {name from directory tree section}
201
+ skills_on_disk = {dir.name for dir in .claude/skills/ if (dir/SKILL.md).exists()}
202
+ missing_from_tree = skills_on_disk - skills_in_tree
203
+ stale_in_tree = skills_in_tree - skills_on_disk
204
+
205
+ # Matrix check
206
+ skills_in_matrix = {name from each row of the assignment table}
207
+ for each skill in skills_in_matrix:
208
+ if skill not in skills_on_disk:
209
+ FINDING: matrix references skill that does not exist on disk
210
+ ```
211
+
212
+ Report tree drift and matrix drift as separate findings -- they require
213
+ different fixes (update the tree listing vs update the assignment table).
214
+
215
+ The same two-source check applies to `agents/README.md` and
216
+ `commands/README.md`: each surface has its own README and each may contain
217
+ both a directory listing and cross-reference tables.
218
+
219
+ #### Sub-check C: READMEs for all three surfaces
220
+
221
+ The check covers all three surface READMEs explicitly:
222
+
223
+ | README | Surface | What to check |
224
+ |--------|---------|---------------|
225
+ | `skills/README.md` | Skills | Directory tree + assignment matrix |
226
+ | `agents/README.md` | Agents | Directory listing vs `.claude/agents/*.md` |
227
+ | `commands/README.md` | Commands | Directory listing vs `.claude/commands/*.md` |
228
+
229
+ If a README does not exist for a surface, report "README absent for
230
+ `<surface>/`" rather than skipping silently.
231
+
232
+ #### Sub-check D: Routing config
233
+
234
+ If `.claude/config/surface-routing.json` exists, each `primary_agent` value
235
+ must match a file stem in `.claude/agents/`. A routing entry pointing to a
236
+ non-existent agent is a broken cross-reference between config and agents.
237
+
238
+ ```
239
+ routing = parse .claude/config/surface-routing.json
240
+ agents_on_disk = {f.stem for f in .claude/agents/*.md}
241
+ for each surface in routing.surfaces:
242
+ agent = surface.primary_agent
243
+ if agent not in agents_on_disk:
244
+ FINDING: routing references missing agent
245
+ ```
246
+
247
+ **Ejemplo de finding:**
248
+
249
+ | Componente | Tipo | Inconsistencia | Fix propuesto |
250
+ |------------|------|----------------|---------------|
251
+ | `skills/gaia-self-check/` | Skill | En disco y referenciada por agents, ausente del árbol en `skills/README.md` | Agregar al árbol de directorios en `skills/README.md` (doc drift, no orphan) |
252
+ | `skills/draft-skill/` | Skill | En disco, sin referencias en ningún agent, ausente del README | requires_human_review: ¿skill en construcción o puede eliminarse? |
253
+ | `skills/README.md` | Doc | `nah-skill` en la matriz de asignación pero directorio ausente en disco | Eliminar `nah-skill` de la matriz o restaurar la skill |
254
+ | `skills/old-skill/` | Skill | Listado en árbol del README pero directorio ausente en disco | Eliminar entrada del árbol en el README o restaurar la skill |
255
+ | `agents/README.md` | Doc | README ausente para la superficie `agents/` | Crear `agents/README.md` con listado de agents |
256
+ | `config/surface-routing.json` | Config | `primary_agent: ghost-agent` no existe en `.claude/agents/` | Actualizar `primary_agent` o crear `ghost-agent.md` |
257
+
258
+ ---
259
+
260
+ ### hooks/ (siempre)
261
+
262
+ **Qué verifica:** Hooks are always part of the scan. Two directions:
263
+
264
+ 1. **settings.json -> disk**: Every hook file declared in `settings.json`
265
+ must exist on disk. A hook registered but missing on disk causes silent
266
+ runtime failures -- the harness calls the hook and gets a file-not-found
267
+ error.
268
+ 2. **disk -> settings.json**: Every file under `.claude/hooks/` must be
269
+ registered in `settings.json`. A hook file present on disk but not
270
+ registered is dead code -- it runs nowhere.
271
+
272
+ **Cómo detectarlo:**
273
+
274
+ ```
275
+ # Parse settings.json (may not exist)
276
+ if .claude/settings.json does not exist:
277
+ report: "no active hooks detected -- settings.json absent"
278
+ skip hooks check
279
+ else:
280
+ settings = parse .claude/settings.json
281
+ hooks_in_settings = {resolve path from each hook entry in settings.hooks}
282
+
283
+ # Direction 1: registered -> disk
284
+ for each path in hooks_in_settings:
285
+ if file does not exist at path:
286
+ FINDING: hook registered in settings.json but file missing on disk
287
+
288
+ # Direction 2: disk -> registered
289
+ hooks_on_disk = {f for f in .claude/hooks/*.py}
290
+ for each file in hooks_on_disk:
291
+ if file not in hooks_in_settings:
292
+ FINDING: hook file on disk but not registered in settings.json
293
+
294
+ if hooks_in_settings is empty:
295
+ report: "no active hooks detected -- settings.json present but no hooks entries"
296
+ ```
297
+
298
+ **Ejemplo de finding:**
299
+
300
+ | Componente | Tipo | Inconsistencia | Fix propuesto |
301
+ |------------|------|----------------|---------------|
302
+ | `settings.json` | Config | Hook `.claude/hooks/post_tool_use.py` registrado pero archivo no existe en disco | Crear el archivo del hook o eliminar la entrada de `settings.json` |
303
+ | `hooks/pre_tool_use.py` | Hook | Archivo presente en disco pero no registrado en `settings.json` | Agregar entrada en `settings.json` o eliminar el archivo |
304
+
305
+ ## Propuesta y Aprobación
306
+
307
+ The ask-before-fix principle governs every corrective action the skill
308
+ might take. The skill is allowed to detect, describe, and propose --
309
+ never to apply. Aprobación explícita del usuario is the only gate that
310
+ unlocks a fix. This section operationalizes that principle into a
311
+ repeatable flow.
312
+
313
+ ### El flujo completo
314
+
315
+ ```
316
+ Inconsistencia detectada
317
+ |
318
+ v
319
+ Construir propuesta (qué archivo, qué cambio exacto, qué efecto)
320
+ |
321
+ v
322
+ Presentar al usuario via AskUserQuestion (una por finding)
323
+ |
324
+ v
325
+ aprobado? ----yes----> Aplicar fix + registrar como aprobado
326
+ |
327
+ no
328
+ |
329
+ v
330
+ Sin cambios + registrar como "ignored by user"
331
+ ```
332
+
333
+ One approval per delta. Each finding is its own propuesta -- no bulk
334
+ approval. If the user approves items 1 and 3 but rejects item 2, fixes
335
+ 1 and 3 are applied and item 2 is left untouched.
336
+
337
+ ### Plantilla de propuesta
338
+
339
+ Every propuesta presented to the user must include these fields:
340
+
341
+ ```
342
+ Finding: <one-line description of the inconsistency detected>
343
+ Archivo: <absolute path of the file to be modified>
344
+ Fix: <exact change -- field value to set, line to add/remove, etc.>
345
+ Efecto: <what changes after the fix is applied>
346
+ Rollback: <how to undo -- typically "revert <field> to previous value">
347
+ ```
348
+
349
+ Do not omit any field. A propuesta missing "Rollback" or "Efecto" cannot
350
+ be aprobado with informed consent -- silent propuestas violate
351
+ ask-before-fix as much as auto-fixes do.
352
+
353
+ ### Ejemplo concreto
354
+
355
+ The agent detects that `skills/gaia-ops/SKILL.md` has `name: gaia_ops`
356
+ but the directory is named `gaia-ops`. The propuesta presented to the
357
+ user looks like this:
358
+
359
+ ---
360
+
361
+ **Propuesta 1 de 3**
362
+
363
+ ```
364
+ Finding: name en frontmatter no coincide con el nombre del directorio
365
+ Archivo: /home/jorge/.claude/skills/gaia-ops/SKILL.md
366
+ Fix: Cambiar `name: gaia_ops` a `name: gaia-ops` en el frontmatter
367
+ Efecto: El self-check ya no reportará este mismatch; cross-references
368
+ que usen "gaia-ops" resolverán correctamente
369
+ Rollback: Revertir `name` a `gaia_ops` en el frontmatter
370
+ ```
371
+
372
+ Aprobar este fix? [s/n]
373
+
374
+ ---
375
+
376
+ That message block is the minimum. The agent may add context (e.g., "this
377
+ field is used by the orchestrator to route skill injection") but must not
378
+ omit any of the 5 fields.
379
+
380
+ ### Mecanismo de aprobación
381
+
382
+ **Preferred:** `AskUserQuestion` per finding. The agent pauses after each
383
+ propuesta and waits for the user's answer before moving to the next.
384
+
385
+ **Fallback (when per-item mechanism is unavailable):** Present all
386
+ propuestas as a numbered list in a single message, then ask the user to
387
+ reply with the numbers they approve (e.g., "Apruebo: 1, 3"). Items not
388
+ listed are treated as rechazado.
389
+
390
+ Never apply any fix before receiving the user's answer. The skill must
391
+ wait -- it cannot infer "likely approved" from silence or from the fact
392
+ that the fix looks trivial.
393
+
394
+ ### Estado post-flow
395
+
396
+ After all propuestas have been answered:
397
+
398
+ | Resultado | Acción | Registro |
399
+ |-----------|--------|----------|
400
+ | `aprobado` | Aplicar el fix (Edit/Write) | Log: "Fix aplicado: <finding>" |
401
+ | `rechazado` | Nada se toca | Log: "Ignored by user: <finding>" |
402
+
403
+ The final report summary line must reflect both counts:
404
+
405
+ ```
406
+ Fixes aplicados: N aprobados, M ignorados por el usuario.
407
+ ```
408
+
409
+ If a fix fails after aprobación (e.g., the file changed between scan and
410
+ apply), report the failure explicitly and stop. Do not silently skip.
411
+
412
+ ### Edge cases: requires_human_review
413
+
414
+ Some findings are ambiguous -- the skill cannot determine the correct fix
415
+ without context only the user has. In these cases the skill must not
416
+ propose a fix at all. Instead, mark the finding as `requires_human_review`
417
+ in the report and describe what is unclear.
418
+
419
+ Situations that trigger `requires_human_review`:
420
+
421
+ | Situation | Why it is ambiguous |
422
+ |-----------|---------------------|
423
+ | Orphan skill directory (has `SKILL.md`, not referenced in any agent frontmatter, absent from README) | Could be deliberate (WIP skill not yet published) or a forgotten leftover |
424
+ | Agent `name` vs file stem mismatch where both the name and the stem look intentional | Renaming the file or the field both produce valid results -- only the user knows the intent |
425
+ | Cross-reference to a skill that existed and was deleted (deletion was recent per git blame) | Could be a stale ref or could be that the user intends to restore the skill |
426
+ | Routing entry for an agent with no skills list | Might be a new agent mid-construction or a misconfiguration |
427
+
428
+ When marking `requires_human_review`, the report row looks like:
429
+
430
+ | Componente | Tipo | Inconsistencia | Fix propuesto |
431
+ |------------|------|----------------|---------------|
432
+ | `skills/draft-skill/` | Skill | Directorio presente en disco, ausente del README -- propósito incierto | requires_human_review: ¿es una skill en construcción o puede eliminarse? |
433
+
434
+ The agent should describe the ambiguity in plain language so the user can
435
+ make an informed decision. After the user clarifies, the agent may
436
+ construct and present a normal propuesta for the now-unambiguous fix.
437
+
438
+ ### Cross-reference
439
+
440
+ The approval mechanism used here is semantically equivalent to the one
441
+ in `skills/request-approval/SKILL.md` (operation / exact_content /
442
+ scope / risk / rollback fields). The difference is context: `request-
443
+ approval` handles hook-blocked Bash commands; this flow handles
444
+ documentation and frontmatter fixes. The same informed-consent principle
445
+ applies to both.
446
+
447
+ ## Notes
448
+
449
+ - Tolerance: a malformed frontmatter is itself an inconsistency, not a
450
+ fatal error. The scan continues and reports the component as broken.
451
+ - No external state: the skill never reads outside `.claude/`. Any
452
+ reference to an external path is reported as an inconsistency, not
453
+ followed.