@jaguilar87/gaia 5.0.0-rc1
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.
- package/.claude-plugin/marketplace.json +33 -0
- package/.claude-plugin/plugin.json +26 -0
- package/ARCHITECTURE.md +335 -0
- package/CHANGELOG.md +1212 -0
- package/CODE_OF_CONDUCT.md +11 -0
- package/CONTRIBUTING.md +146 -0
- package/INSTALL.md +436 -0
- package/LICENSE +21 -0
- package/README.md +222 -0
- package/SECURITY.md +47 -0
- package/agents/README.md +78 -0
- package/agents/cloud-troubleshooter.md +73 -0
- package/agents/developer.md +65 -0
- package/agents/gaia-operator.md +64 -0
- package/agents/gaia-orchestrator.md +237 -0
- package/agents/gaia-planner.md +53 -0
- package/agents/gaia-system.md +70 -0
- package/agents/gitops-operator.md +61 -0
- package/agents/terraform-architect.md +63 -0
- package/bin/README.md +106 -0
- package/bin/cli/__init__.py +1 -0
- package/bin/cli/approvals.py +740 -0
- package/bin/cli/cleanup.py +562 -0
- package/bin/cli/context.py +283 -0
- package/bin/cli/doctor.py +628 -0
- package/bin/cli/history.py +305 -0
- package/bin/cli/memory.py +464 -0
- package/bin/cli/metrics.py +1068 -0
- package/bin/cli/plans.py +515 -0
- package/bin/cli/status.py +302 -0
- package/bin/cli/update.py +382 -0
- package/bin/gaia +112 -0
- package/bin/gaia-cleanup.js +531 -0
- package/bin/gaia-doctor.js +635 -0
- package/bin/gaia-evidence +126 -0
- package/bin/gaia-history.js +251 -0
- package/bin/gaia-metrics.js +1278 -0
- package/bin/gaia-review.js +269 -0
- package/bin/gaia-scan +44 -0
- package/bin/gaia-scan.py +589 -0
- package/bin/gaia-skills-diagnose.js +929 -0
- package/bin/gaia-status.js +278 -0
- package/bin/gaia-uninstall.js +111 -0
- package/bin/gaia-update.js +816 -0
- package/bin/pre-publish-validate.js +610 -0
- package/bin/python-detect.js +60 -0
- package/commands/README.md +64 -0
- package/commands/gaia.md +37 -0
- package/commands/scan-project.md +67 -0
- package/config/README.md +71 -0
- package/config/cloud/aws.json +134 -0
- package/config/cloud/gcp.json +139 -0
- package/config/context-contracts.json +158 -0
- package/config/crons-schema.md +81 -0
- package/config/git_standards.json +72 -0
- package/config/surface-routing.json +421 -0
- package/config/universal-rules.json +102 -0
- package/dist/gaia-ops/.claude-plugin/plugin.json +24 -0
- package/dist/gaia-ops/README.md +80 -0
- package/dist/gaia-ops/agents/cloud-troubleshooter.md +73 -0
- package/dist/gaia-ops/agents/developer.md +65 -0
- package/dist/gaia-ops/agents/gaia-operator.md +64 -0
- package/dist/gaia-ops/agents/gaia-orchestrator.md +237 -0
- package/dist/gaia-ops/agents/gaia-planner.md +53 -0
- package/dist/gaia-ops/agents/gaia-system.md +70 -0
- package/dist/gaia-ops/agents/gitops-operator.md +61 -0
- package/dist/gaia-ops/agents/terraform-architect.md +63 -0
- package/dist/gaia-ops/commands/gaia.md +37 -0
- package/dist/gaia-ops/config/README.md +71 -0
- package/dist/gaia-ops/config/cloud/aws.json +134 -0
- package/dist/gaia-ops/config/cloud/gcp.json +139 -0
- package/dist/gaia-ops/config/context-contracts.json +158 -0
- package/dist/gaia-ops/config/crons-schema.md +81 -0
- package/dist/gaia-ops/config/git_standards.json +72 -0
- package/dist/gaia-ops/config/surface-routing.json +421 -0
- package/dist/gaia-ops/config/universal-rules.json +102 -0
- package/dist/gaia-ops/hooks/adapters/__init__.py +52 -0
- package/dist/gaia-ops/hooks/adapters/base.py +219 -0
- package/dist/gaia-ops/hooks/adapters/channel.py +17 -0
- package/dist/gaia-ops/hooks/adapters/claude_code.py +1890 -0
- package/dist/gaia-ops/hooks/adapters/types.py +194 -0
- package/dist/gaia-ops/hooks/adapters/utils.py +25 -0
- package/dist/gaia-ops/hooks/hooks.json +163 -0
- package/dist/gaia-ops/hooks/modules/__init__.py +15 -0
- package/dist/gaia-ops/hooks/modules/agents/__init__.py +29 -0
- package/dist/gaia-ops/hooks/modules/agents/contract_validator.py +647 -0
- package/dist/gaia-ops/hooks/modules/agents/response_contract.py +496 -0
- package/dist/gaia-ops/hooks/modules/agents/skill_injection_verifier.py +120 -0
- package/dist/gaia-ops/hooks/modules/agents/state_tracker.py +267 -0
- package/dist/gaia-ops/hooks/modules/agents/task_info_builder.py +74 -0
- package/dist/gaia-ops/hooks/modules/agents/transcript_analyzer.py +458 -0
- package/dist/gaia-ops/hooks/modules/agents/transcript_reader.py +152 -0
- package/dist/gaia-ops/hooks/modules/audit/__init__.py +28 -0
- package/dist/gaia-ops/hooks/modules/audit/event_detector.py +168 -0
- package/dist/gaia-ops/hooks/modules/audit/logger.py +131 -0
- package/dist/gaia-ops/hooks/modules/audit/metrics.py +134 -0
- package/dist/gaia-ops/hooks/modules/audit/workflow_auditor.py +611 -0
- package/dist/gaia-ops/hooks/modules/audit/workflow_recorder.py +296 -0
- package/dist/gaia-ops/hooks/modules/context/__init__.py +11 -0
- package/dist/gaia-ops/hooks/modules/context/agentic_loop_detector.py +165 -0
- package/dist/gaia-ops/hooks/modules/context/anchor_tracker.py +317 -0
- package/dist/gaia-ops/hooks/modules/context/compact_context_builder.py +218 -0
- package/dist/gaia-ops/hooks/modules/context/context_freshness.py +145 -0
- package/dist/gaia-ops/hooks/modules/context/context_injector.py +558 -0
- package/dist/gaia-ops/hooks/modules/context/context_writer.py +530 -0
- package/dist/gaia-ops/hooks/modules/context/contracts_loader.py +161 -0
- package/dist/gaia-ops/hooks/modules/core/__init__.py +40 -0
- package/dist/gaia-ops/hooks/modules/core/hook_entry.py +78 -0
- package/dist/gaia-ops/hooks/modules/core/paths.py +160 -0
- package/dist/gaia-ops/hooks/modules/core/plugin_mode.py +149 -0
- package/dist/gaia-ops/hooks/modules/core/plugin_setup.py +577 -0
- package/dist/gaia-ops/hooks/modules/core/state.py +179 -0
- package/dist/gaia-ops/hooks/modules/core/stdin.py +24 -0
- package/dist/gaia-ops/hooks/modules/events/__init__.py +1 -0
- package/dist/gaia-ops/hooks/modules/events/event_writer.py +210 -0
- package/dist/gaia-ops/hooks/modules/memory/__init__.py +8 -0
- package/dist/gaia-ops/hooks/modules/memory/episode_writer.py +216 -0
- package/dist/gaia-ops/hooks/modules/orchestrator/__init__.py +1 -0
- package/dist/gaia-ops/hooks/modules/orchestrator/delegate_mode.py +122 -0
- package/dist/gaia-ops/hooks/modules/scanning/__init__.py +8 -0
- package/dist/gaia-ops/hooks/modules/scanning/scan_trigger.py +84 -0
- package/dist/gaia-ops/hooks/modules/security/__init__.py +120 -0
- package/dist/gaia-ops/hooks/modules/security/approval_cleanup.py +87 -0
- package/dist/gaia-ops/hooks/modules/security/approval_constants.py +23 -0
- package/dist/gaia-ops/hooks/modules/security/approval_grants.py +1638 -0
- package/dist/gaia-ops/hooks/modules/security/approval_messages.py +71 -0
- package/dist/gaia-ops/hooks/modules/security/approval_scopes.py +222 -0
- package/dist/gaia-ops/hooks/modules/security/blocked_commands.py +595 -0
- package/dist/gaia-ops/hooks/modules/security/blocked_message_formatter.py +87 -0
- package/dist/gaia-ops/hooks/modules/security/command_semantics.py +181 -0
- package/dist/gaia-ops/hooks/modules/security/composition_rules.py +547 -0
- package/dist/gaia-ops/hooks/modules/security/flag_classifiers.py +873 -0
- package/dist/gaia-ops/hooks/modules/security/gitops_validator.py +179 -0
- package/dist/gaia-ops/hooks/modules/security/mutative_verbs.py +1131 -0
- package/dist/gaia-ops/hooks/modules/security/network_hosts.py +481 -0
- package/dist/gaia-ops/hooks/modules/security/prompt_validator.py +40 -0
- package/dist/gaia-ops/hooks/modules/security/shell_unwrapper.py +165 -0
- package/dist/gaia-ops/hooks/modules/security/tiers.py +196 -0
- package/dist/gaia-ops/hooks/modules/session/__init__.py +10 -0
- package/dist/gaia-ops/hooks/modules/session/pending_scanner.py +174 -0
- package/dist/gaia-ops/hooks/modules/session/session_context_writer.py +100 -0
- package/dist/gaia-ops/hooks/modules/session/session_event_injector.py +160 -0
- package/dist/gaia-ops/hooks/modules/session/session_manager.py +31 -0
- package/dist/gaia-ops/hooks/modules/session/session_registry.py +232 -0
- package/dist/gaia-ops/hooks/modules/tools/__init__.py +29 -0
- package/dist/gaia-ops/hooks/modules/tools/bash_validator.py +1008 -0
- package/dist/gaia-ops/hooks/modules/tools/cloud_pipe_validator.py +231 -0
- package/dist/gaia-ops/hooks/modules/tools/hook_response.py +55 -0
- package/dist/gaia-ops/hooks/modules/tools/shell_parser.py +227 -0
- package/dist/gaia-ops/hooks/modules/tools/stage_decomposer.py +315 -0
- package/dist/gaia-ops/hooks/modules/tools/task_validator.py +294 -0
- package/dist/gaia-ops/hooks/modules/validation/__init__.py +23 -0
- package/dist/gaia-ops/hooks/modules/validation/commit_validator.py +380 -0
- package/dist/gaia-ops/hooks/post_compact.py +43 -0
- package/dist/gaia-ops/hooks/post_tool_use.py +54 -0
- package/dist/gaia-ops/hooks/pre_compact.py +60 -0
- package/dist/gaia-ops/hooks/pre_tool_use.py +413 -0
- package/dist/gaia-ops/hooks/session_start.py +81 -0
- package/dist/gaia-ops/hooks/stop_hook.py +82 -0
- package/dist/gaia-ops/hooks/subagent_start.py +71 -0
- package/dist/gaia-ops/hooks/subagent_stop.py +295 -0
- package/dist/gaia-ops/hooks/task_completed.py +70 -0
- package/dist/gaia-ops/hooks/user_prompt_submit.py +246 -0
- package/dist/gaia-ops/settings.json +72 -0
- package/dist/gaia-ops/skills/README.md +154 -0
- package/dist/gaia-ops/skills/agent-protocol/SKILL.md +93 -0
- package/dist/gaia-ops/skills/agent-protocol/examples.md +223 -0
- package/dist/gaia-ops/skills/agent-response/SKILL.md +69 -0
- package/dist/gaia-ops/skills/agentic-loop/SKILL.md +80 -0
- package/dist/gaia-ops/skills/agentic-loop/reference.md +378 -0
- package/dist/gaia-ops/skills/blog-writing/SKILL.md +98 -0
- package/dist/gaia-ops/skills/blog-writing/reference.md +130 -0
- package/dist/gaia-ops/skills/brief-spec/SKILL.md +182 -0
- package/dist/gaia-ops/skills/command-execution/SKILL.md +64 -0
- package/dist/gaia-ops/skills/command-execution/reference.md +83 -0
- package/dist/gaia-ops/skills/context-updater/SKILL.md +87 -0
- package/dist/gaia-ops/skills/context-updater/examples.md +71 -0
- package/dist/gaia-ops/skills/developer-patterns/SKILL.md +50 -0
- package/dist/gaia-ops/skills/developer-patterns/reference.md +112 -0
- package/dist/gaia-ops/skills/execution/SKILL.md +99 -0
- package/dist/gaia-ops/skills/fast-queries/SKILL.md +43 -0
- package/dist/gaia-ops/skills/gaia-compact/SKILL.md +74 -0
- package/dist/gaia-ops/skills/gaia-patterns/SKILL.md +108 -0
- package/dist/gaia-ops/skills/gaia-patterns/reference.md +395 -0
- package/dist/gaia-ops/skills/gaia-planner/SKILL.md +37 -0
- package/dist/gaia-ops/skills/gaia-planner/reference.md +107 -0
- package/dist/gaia-ops/skills/gaia-release/SKILL.md +82 -0
- package/dist/gaia-ops/skills/gaia-release/reference.md +102 -0
- package/dist/gaia-ops/skills/gaia-self-check/SKILL.md +114 -0
- package/dist/gaia-ops/skills/gaia-self-check/reference.md +453 -0
- package/dist/gaia-ops/skills/gaia-verify/SKILL.md +77 -0
- package/dist/gaia-ops/skills/gaia-verify/reference.md +80 -0
- package/dist/gaia-ops/skills/git-conventions/SKILL.md +47 -0
- package/dist/gaia-ops/skills/gitops-patterns/SKILL.md +60 -0
- package/dist/gaia-ops/skills/gitops-patterns/reference.md +183 -0
- package/dist/gaia-ops/skills/gmail-policy/SKILL.md +200 -0
- package/dist/gaia-ops/skills/gmail-policy/reference.md +150 -0
- package/dist/gaia-ops/skills/gmail-triage/SKILL.md +100 -0
- package/dist/gaia-ops/skills/gws-setup/SKILL.md +99 -0
- package/dist/gaia-ops/skills/gws-setup/reference.md +73 -0
- package/dist/gaia-ops/skills/investigation/SKILL.md +100 -0
- package/dist/gaia-ops/skills/memory-curation/SKILL.md +83 -0
- package/dist/gaia-ops/skills/memory-search/SKILL.md +88 -0
- package/dist/gaia-ops/skills/orchestrator-approval/SKILL.md +160 -0
- package/dist/gaia-ops/skills/orchestrator-approval/reference.md +174 -0
- package/dist/gaia-ops/skills/pending-approvals/SKILL.md +72 -0
- package/dist/gaia-ops/skills/pending-approvals/reference.md +214 -0
- package/dist/gaia-ops/skills/readme-writing/SKILL.md +71 -0
- package/dist/gaia-ops/skills/readme-writing/reference.md +188 -0
- package/dist/gaia-ops/skills/reference.md +135 -0
- package/dist/gaia-ops/skills/request-approval/SKILL.md +140 -0
- package/dist/gaia-ops/skills/request-approval/examples.md +140 -0
- package/dist/gaia-ops/skills/request-approval/reference.md +57 -0
- package/dist/gaia-ops/skills/schedule-task/SKILL.md +64 -0
- package/dist/gaia-ops/skills/schedule-task/reference.md +233 -0
- package/dist/gaia-ops/skills/security-tiers/SKILL.md +141 -0
- package/dist/gaia-ops/skills/security-tiers/destructive-commands-reference.md +623 -0
- package/dist/gaia-ops/skills/security-tiers/reference.md +39 -0
- package/dist/gaia-ops/skills/skill-creation/SKILL.md +92 -0
- package/dist/gaia-ops/skills/skill-creation/reference.md +29 -0
- package/dist/gaia-ops/skills/terraform-patterns/SKILL.md +89 -0
- package/dist/gaia-ops/skills/terraform-patterns/reference.md +93 -0
- package/dist/gaia-ops/tools/__init__.py +9 -0
- package/dist/gaia-ops/tools/agentic-loop/decide-status.py +210 -0
- package/dist/gaia-ops/tools/agentic-loop/parse-metric.py +106 -0
- package/dist/gaia-ops/tools/agentic-loop/record-iteration.py +221 -0
- package/dist/gaia-ops/tools/context/README.md +132 -0
- package/dist/gaia-ops/tools/context/__init__.py +42 -0
- package/dist/gaia-ops/tools/context/_paths.py +20 -0
- package/dist/gaia-ops/tools/context/context_provider.py +721 -0
- package/dist/gaia-ops/tools/context/context_section_reader.py +342 -0
- package/dist/gaia-ops/tools/context/deep_merge.py +159 -0
- package/dist/gaia-ops/tools/context/pending_updates.py +760 -0
- package/dist/gaia-ops/tools/context/surface_router.py +278 -0
- package/dist/gaia-ops/tools/fast-queries/README.md +65 -0
- package/dist/gaia-ops/tools/fast-queries/__init__.py +30 -0
- package/dist/gaia-ops/tools/fast-queries/appservices/quicktriage_devops_developer.sh +75 -0
- package/dist/gaia-ops/tools/fast-queries/cloud/aws/quicktriage_aws_troubleshooter.sh +32 -0
- package/dist/gaia-ops/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh +88 -0
- package/dist/gaia-ops/tools/fast-queries/gitops/quicktriage_gitops_operator.sh +48 -0
- package/dist/gaia-ops/tools/fast-queries/run_triage.sh +59 -0
- package/dist/gaia-ops/tools/fast-queries/terraform/quicktriage_terraform_architect.sh +80 -0
- package/dist/gaia-ops/tools/gaia_simulator/__init__.py +33 -0
- package/dist/gaia-ops/tools/gaia_simulator/cli.py +354 -0
- package/dist/gaia-ops/tools/gaia_simulator/extractor.py +457 -0
- package/dist/gaia-ops/tools/gaia_simulator/reporter.py +258 -0
- package/dist/gaia-ops/tools/gaia_simulator/routing_simulator.py +334 -0
- package/dist/gaia-ops/tools/gaia_simulator/runner.py +539 -0
- package/dist/gaia-ops/tools/gaia_simulator/skills_mapper.py +264 -0
- package/dist/gaia-ops/tools/memory/README.md +0 -0
- package/dist/gaia-ops/tools/memory/__init__.py +20 -0
- package/dist/gaia-ops/tools/memory/backfill_fts5.py +107 -0
- package/dist/gaia-ops/tools/memory/conflict_detector.py +295 -0
- package/dist/gaia-ops/tools/memory/episodic.py +1210 -0
- package/dist/gaia-ops/tools/memory/git_invalidator.py +262 -0
- package/dist/gaia-ops/tools/memory/paths.py +102 -0
- package/dist/gaia-ops/tools/memory/scoring.py +193 -0
- package/dist/gaia-ops/tools/memory/search_store.py +360 -0
- package/dist/gaia-ops/tools/persist_transcript_analysis.py +85 -0
- package/dist/gaia-ops/tools/review/__init__.py +1 -0
- package/dist/gaia-ops/tools/review/review_engine.py +157 -0
- package/dist/gaia-ops/tools/scan/__init__.py +35 -0
- package/dist/gaia-ops/tools/scan/config.py +247 -0
- package/dist/gaia-ops/tools/scan/merge.py +212 -0
- package/dist/gaia-ops/tools/scan/orchestrator.py +549 -0
- package/dist/gaia-ops/tools/scan/registry.py +127 -0
- package/dist/gaia-ops/tools/scan/scanners/__init__.py +18 -0
- package/dist/gaia-ops/tools/scan/scanners/base.py +137 -0
- package/dist/gaia-ops/tools/scan/scanners/environment.py +349 -0
- package/dist/gaia-ops/tools/scan/scanners/git.py +570 -0
- package/dist/gaia-ops/tools/scan/scanners/infrastructure.py +875 -0
- package/dist/gaia-ops/tools/scan/scanners/orchestration.py +600 -0
- package/dist/gaia-ops/tools/scan/scanners/stack.py +1085 -0
- package/dist/gaia-ops/tools/scan/scanners/tools.py +260 -0
- package/dist/gaia-ops/tools/scan/setup.py +686 -0
- package/dist/gaia-ops/tools/scan/tests/__init__.py +1 -0
- package/dist/gaia-ops/tools/scan/tests/conftest.py +796 -0
- package/dist/gaia-ops/tools/scan/tests/test_environment.py +323 -0
- package/dist/gaia-ops/tools/scan/tests/test_git.py +419 -0
- package/dist/gaia-ops/tools/scan/tests/test_infrastructure.py +382 -0
- package/dist/gaia-ops/tools/scan/tests/test_integration.py +920 -0
- package/dist/gaia-ops/tools/scan/tests/test_merge.py +269 -0
- package/dist/gaia-ops/tools/scan/tests/test_orchestration.py +304 -0
- package/dist/gaia-ops/tools/scan/tests/test_stack.py +604 -0
- package/dist/gaia-ops/tools/scan/tests/test_tools.py +349 -0
- package/dist/gaia-ops/tools/scan/ui.py +624 -0
- package/dist/gaia-ops/tools/scan/verify.py +270 -0
- package/dist/gaia-ops/tools/scan/walk.py +118 -0
- package/dist/gaia-ops/tools/scan/workspace.py +85 -0
- package/dist/gaia-ops/tools/validation/README.md +244 -0
- package/dist/gaia-ops/tools/validation/__init__.py +17 -0
- package/dist/gaia-ops/tools/validation/approval_gate.py +321 -0
- package/dist/gaia-ops/tools/validation/validate_skills.py +189 -0
- package/dist/gaia-security/.claude-plugin/plugin.json +24 -0
- package/dist/gaia-security/README.md +90 -0
- package/dist/gaia-security/config/universal-rules.json +102 -0
- package/dist/gaia-security/hooks/adapters/__init__.py +52 -0
- package/dist/gaia-security/hooks/adapters/base.py +219 -0
- package/dist/gaia-security/hooks/adapters/channel.py +17 -0
- package/dist/gaia-security/hooks/adapters/claude_code.py +1890 -0
- package/dist/gaia-security/hooks/adapters/types.py +194 -0
- package/dist/gaia-security/hooks/adapters/utils.py +25 -0
- package/dist/gaia-security/hooks/hooks.json +84 -0
- package/dist/gaia-security/hooks/modules/__init__.py +15 -0
- package/dist/gaia-security/hooks/modules/agents/__init__.py +29 -0
- package/dist/gaia-security/hooks/modules/agents/contract_validator.py +647 -0
- package/dist/gaia-security/hooks/modules/agents/response_contract.py +496 -0
- package/dist/gaia-security/hooks/modules/agents/skill_injection_verifier.py +120 -0
- package/dist/gaia-security/hooks/modules/agents/state_tracker.py +267 -0
- package/dist/gaia-security/hooks/modules/agents/task_info_builder.py +74 -0
- package/dist/gaia-security/hooks/modules/agents/transcript_analyzer.py +458 -0
- package/dist/gaia-security/hooks/modules/agents/transcript_reader.py +152 -0
- package/dist/gaia-security/hooks/modules/audit/__init__.py +28 -0
- package/dist/gaia-security/hooks/modules/audit/event_detector.py +168 -0
- package/dist/gaia-security/hooks/modules/audit/logger.py +131 -0
- package/dist/gaia-security/hooks/modules/audit/metrics.py +134 -0
- package/dist/gaia-security/hooks/modules/audit/workflow_auditor.py +611 -0
- package/dist/gaia-security/hooks/modules/audit/workflow_recorder.py +296 -0
- package/dist/gaia-security/hooks/modules/context/__init__.py +11 -0
- package/dist/gaia-security/hooks/modules/context/agentic_loop_detector.py +165 -0
- package/dist/gaia-security/hooks/modules/context/anchor_tracker.py +317 -0
- package/dist/gaia-security/hooks/modules/context/compact_context_builder.py +218 -0
- package/dist/gaia-security/hooks/modules/context/context_freshness.py +145 -0
- package/dist/gaia-security/hooks/modules/context/context_injector.py +558 -0
- package/dist/gaia-security/hooks/modules/context/context_writer.py +530 -0
- package/dist/gaia-security/hooks/modules/context/contracts_loader.py +161 -0
- package/dist/gaia-security/hooks/modules/core/__init__.py +40 -0
- package/dist/gaia-security/hooks/modules/core/hook_entry.py +78 -0
- package/dist/gaia-security/hooks/modules/core/paths.py +160 -0
- package/dist/gaia-security/hooks/modules/core/plugin_mode.py +149 -0
- package/dist/gaia-security/hooks/modules/core/plugin_setup.py +577 -0
- package/dist/gaia-security/hooks/modules/core/state.py +179 -0
- package/dist/gaia-security/hooks/modules/core/stdin.py +24 -0
- package/dist/gaia-security/hooks/modules/events/__init__.py +1 -0
- package/dist/gaia-security/hooks/modules/events/event_writer.py +210 -0
- package/dist/gaia-security/hooks/modules/memory/__init__.py +8 -0
- package/dist/gaia-security/hooks/modules/memory/episode_writer.py +216 -0
- package/dist/gaia-security/hooks/modules/orchestrator/__init__.py +1 -0
- package/dist/gaia-security/hooks/modules/orchestrator/delegate_mode.py +122 -0
- package/dist/gaia-security/hooks/modules/scanning/__init__.py +8 -0
- package/dist/gaia-security/hooks/modules/scanning/scan_trigger.py +84 -0
- package/dist/gaia-security/hooks/modules/security/__init__.py +120 -0
- package/dist/gaia-security/hooks/modules/security/approval_cleanup.py +87 -0
- package/dist/gaia-security/hooks/modules/security/approval_constants.py +23 -0
- package/dist/gaia-security/hooks/modules/security/approval_grants.py +1638 -0
- package/dist/gaia-security/hooks/modules/security/approval_messages.py +71 -0
- package/dist/gaia-security/hooks/modules/security/approval_scopes.py +222 -0
- package/dist/gaia-security/hooks/modules/security/blocked_commands.py +595 -0
- package/dist/gaia-security/hooks/modules/security/blocked_message_formatter.py +87 -0
- package/dist/gaia-security/hooks/modules/security/command_semantics.py +181 -0
- package/dist/gaia-security/hooks/modules/security/composition_rules.py +547 -0
- package/dist/gaia-security/hooks/modules/security/flag_classifiers.py +873 -0
- package/dist/gaia-security/hooks/modules/security/gitops_validator.py +179 -0
- package/dist/gaia-security/hooks/modules/security/mutative_verbs.py +1131 -0
- package/dist/gaia-security/hooks/modules/security/network_hosts.py +481 -0
- package/dist/gaia-security/hooks/modules/security/prompt_validator.py +40 -0
- package/dist/gaia-security/hooks/modules/security/shell_unwrapper.py +165 -0
- package/dist/gaia-security/hooks/modules/security/tiers.py +196 -0
- package/dist/gaia-security/hooks/modules/session/__init__.py +10 -0
- package/dist/gaia-security/hooks/modules/session/pending_scanner.py +174 -0
- package/dist/gaia-security/hooks/modules/session/session_context_writer.py +100 -0
- package/dist/gaia-security/hooks/modules/session/session_event_injector.py +160 -0
- package/dist/gaia-security/hooks/modules/session/session_manager.py +31 -0
- package/dist/gaia-security/hooks/modules/session/session_registry.py +232 -0
- package/dist/gaia-security/hooks/modules/tools/__init__.py +29 -0
- package/dist/gaia-security/hooks/modules/tools/bash_validator.py +1008 -0
- package/dist/gaia-security/hooks/modules/tools/cloud_pipe_validator.py +231 -0
- package/dist/gaia-security/hooks/modules/tools/hook_response.py +55 -0
- package/dist/gaia-security/hooks/modules/tools/shell_parser.py +227 -0
- package/dist/gaia-security/hooks/modules/tools/stage_decomposer.py +315 -0
- package/dist/gaia-security/hooks/modules/tools/task_validator.py +294 -0
- package/dist/gaia-security/hooks/modules/validation/__init__.py +23 -0
- package/dist/gaia-security/hooks/modules/validation/commit_validator.py +380 -0
- package/dist/gaia-security/hooks/post_tool_use.py +54 -0
- package/dist/gaia-security/hooks/pre_tool_use.py +413 -0
- package/dist/gaia-security/hooks/session_start.py +81 -0
- package/dist/gaia-security/hooks/stop_hook.py +82 -0
- package/dist/gaia-security/hooks/user_prompt_submit.py +246 -0
- package/dist/gaia-security/settings.json +58 -0
- package/git-hooks/commit-msg +41 -0
- package/hooks/README.md +100 -0
- package/hooks/adapters/__init__.py +52 -0
- package/hooks/adapters/base.py +219 -0
- package/hooks/adapters/channel.py +17 -0
- package/hooks/adapters/claude_code.py +1890 -0
- package/hooks/adapters/types.py +194 -0
- package/hooks/adapters/utils.py +25 -0
- package/hooks/elicitation_result.py +179 -0
- package/hooks/hooks.json +84 -0
- package/hooks/modules/README.md +189 -0
- package/hooks/modules/__init__.py +15 -0
- package/hooks/modules/agents/__init__.py +29 -0
- package/hooks/modules/agents/contract_validator.py +647 -0
- package/hooks/modules/agents/response_contract.py +496 -0
- package/hooks/modules/agents/skill_injection_verifier.py +120 -0
- package/hooks/modules/agents/state_tracker.py +267 -0
- package/hooks/modules/agents/task_info_builder.py +74 -0
- package/hooks/modules/agents/transcript_analyzer.py +458 -0
- package/hooks/modules/agents/transcript_reader.py +152 -0
- package/hooks/modules/audit/__init__.py +28 -0
- package/hooks/modules/audit/event_detector.py +168 -0
- package/hooks/modules/audit/logger.py +131 -0
- package/hooks/modules/audit/metrics.py +134 -0
- package/hooks/modules/audit/workflow_auditor.py +611 -0
- package/hooks/modules/audit/workflow_recorder.py +296 -0
- package/hooks/modules/context/__init__.py +11 -0
- package/hooks/modules/context/agentic_loop_detector.py +165 -0
- package/hooks/modules/context/anchor_tracker.py +317 -0
- package/hooks/modules/context/compact_context_builder.py +218 -0
- package/hooks/modules/context/context_freshness.py +145 -0
- package/hooks/modules/context/context_injector.py +558 -0
- package/hooks/modules/context/context_writer.py +530 -0
- package/hooks/modules/context/contracts_loader.py +161 -0
- package/hooks/modules/core/__init__.py +40 -0
- package/hooks/modules/core/hook_entry.py +78 -0
- package/hooks/modules/core/paths.py +160 -0
- package/hooks/modules/core/plugin_mode.py +149 -0
- package/hooks/modules/core/plugin_setup.py +577 -0
- package/hooks/modules/core/state.py +179 -0
- package/hooks/modules/core/stdin.py +24 -0
- package/hooks/modules/events/__init__.py +1 -0
- package/hooks/modules/events/event_writer.py +210 -0
- package/hooks/modules/evidence/__init__.py +34 -0
- package/hooks/modules/evidence/assertions.py +137 -0
- package/hooks/modules/evidence/index_writer.py +57 -0
- package/hooks/modules/evidence/loader.py +126 -0
- package/hooks/modules/evidence/runner.py +241 -0
- package/hooks/modules/memory/__init__.py +8 -0
- package/hooks/modules/memory/episode_writer.py +216 -0
- package/hooks/modules/orchestrator/__init__.py +1 -0
- package/hooks/modules/orchestrator/delegate_mode.py +122 -0
- package/hooks/modules/scanning/__init__.py +8 -0
- package/hooks/modules/scanning/scan_trigger.py +84 -0
- package/hooks/modules/security/__init__.py +120 -0
- package/hooks/modules/security/approval_cleanup.py +87 -0
- package/hooks/modules/security/approval_constants.py +23 -0
- package/hooks/modules/security/approval_grants.py +1638 -0
- package/hooks/modules/security/approval_messages.py +71 -0
- package/hooks/modules/security/approval_scopes.py +222 -0
- package/hooks/modules/security/blocked_commands.py +595 -0
- package/hooks/modules/security/blocked_message_formatter.py +87 -0
- package/hooks/modules/security/command_semantics.py +181 -0
- package/hooks/modules/security/composition_rules.py +547 -0
- package/hooks/modules/security/flag_classifiers.py +873 -0
- package/hooks/modules/security/gitops_validator.py +179 -0
- package/hooks/modules/security/mutative_verbs.py +1131 -0
- package/hooks/modules/security/network_hosts.py +481 -0
- package/hooks/modules/security/prompt_validator.py +40 -0
- package/hooks/modules/security/shell_unwrapper.py +165 -0
- package/hooks/modules/security/tiers.py +196 -0
- package/hooks/modules/session/__init__.py +10 -0
- package/hooks/modules/session/pending_scanner.py +174 -0
- package/hooks/modules/session/session_context_writer.py +100 -0
- package/hooks/modules/session/session_event_injector.py +160 -0
- package/hooks/modules/session/session_manager.py +31 -0
- package/hooks/modules/session/session_registry.py +232 -0
- package/hooks/modules/tools/__init__.py +29 -0
- package/hooks/modules/tools/bash_validator.py +1008 -0
- package/hooks/modules/tools/cloud_pipe_validator.py +231 -0
- package/hooks/modules/tools/hook_response.py +55 -0
- package/hooks/modules/tools/shell_parser.py +227 -0
- package/hooks/modules/tools/stage_decomposer.py +315 -0
- package/hooks/modules/tools/task_validator.py +294 -0
- package/hooks/modules/validation/__init__.py +23 -0
- package/hooks/modules/validation/commit_validator.py +380 -0
- package/hooks/post_compact.py +43 -0
- package/hooks/post_tool_use.py +54 -0
- package/hooks/pre_compact.py +60 -0
- package/hooks/pre_tool_use.py +413 -0
- package/hooks/session_start.py +81 -0
- package/hooks/stop_hook.py +82 -0
- package/hooks/subagent_start.py +71 -0
- package/hooks/subagent_stop.py +295 -0
- package/hooks/task_completed.py +70 -0
- package/hooks/user_prompt_submit.py +246 -0
- package/index.js +83 -0
- package/package.json +99 -0
- package/pyproject.toml +32 -0
- package/skills/README.md +154 -0
- package/skills/agent-protocol/SKILL.md +93 -0
- package/skills/agent-protocol/examples.md +223 -0
- package/skills/agent-response/SKILL.md +69 -0
- package/skills/agentic-loop/SKILL.md +80 -0
- package/skills/agentic-loop/reference.md +378 -0
- package/skills/blog-writing/SKILL.md +98 -0
- package/skills/blog-writing/reference.md +130 -0
- package/skills/brief-spec/SKILL.md +182 -0
- package/skills/command-execution/SKILL.md +64 -0
- package/skills/command-execution/reference.md +83 -0
- package/skills/context-updater/SKILL.md +87 -0
- package/skills/context-updater/examples.md +71 -0
- package/skills/developer-patterns/SKILL.md +50 -0
- package/skills/developer-patterns/reference.md +112 -0
- package/skills/execution/SKILL.md +99 -0
- package/skills/fast-queries/SKILL.md +43 -0
- package/skills/gaia-compact/SKILL.md +74 -0
- package/skills/gaia-patterns/SKILL.md +108 -0
- package/skills/gaia-patterns/reference.md +395 -0
- package/skills/gaia-planner/SKILL.md +37 -0
- package/skills/gaia-planner/reference.md +107 -0
- package/skills/gaia-release/SKILL.md +82 -0
- package/skills/gaia-release/reference.md +102 -0
- package/skills/gaia-self-check/SKILL.md +114 -0
- package/skills/gaia-self-check/reference.md +453 -0
- package/skills/gaia-verify/SKILL.md +77 -0
- package/skills/gaia-verify/reference.md +80 -0
- package/skills/git-conventions/SKILL.md +47 -0
- package/skills/gitops-patterns/SKILL.md +60 -0
- package/skills/gitops-patterns/reference.md +183 -0
- package/skills/gmail-policy/SKILL.md +200 -0
- package/skills/gmail-policy/reference.md +150 -0
- package/skills/gmail-triage/SKILL.md +100 -0
- package/skills/gws-setup/SKILL.md +99 -0
- package/skills/gws-setup/reference.md +73 -0
- package/skills/investigation/SKILL.md +100 -0
- package/skills/memory-curation/SKILL.md +83 -0
- package/skills/memory-search/SKILL.md +88 -0
- package/skills/orchestrator-approval/SKILL.md +160 -0
- package/skills/orchestrator-approval/reference.md +174 -0
- package/skills/pending-approvals/SKILL.md +72 -0
- package/skills/pending-approvals/reference.md +214 -0
- package/skills/readme-writing/SKILL.md +71 -0
- package/skills/readme-writing/reference.md +188 -0
- package/skills/reference.md +135 -0
- package/skills/request-approval/SKILL.md +140 -0
- package/skills/request-approval/examples.md +140 -0
- package/skills/request-approval/reference.md +57 -0
- package/skills/schedule-task/SKILL.md +64 -0
- package/skills/schedule-task/reference.md +233 -0
- package/skills/security-tiers/SKILL.md +141 -0
- package/skills/security-tiers/destructive-commands-reference.md +623 -0
- package/skills/security-tiers/reference.md +39 -0
- package/skills/skill-creation/SKILL.md +92 -0
- package/skills/skill-creation/reference.md +29 -0
- package/skills/terraform-patterns/SKILL.md +89 -0
- package/skills/terraform-patterns/reference.md +93 -0
- package/templates/README.md +69 -0
- package/templates/managed-settings.template.json +43 -0
- package/tools/__init__.py +9 -0
- package/tools/agentic-loop/decide-status.py +210 -0
- package/tools/agentic-loop/parse-metric.py +106 -0
- package/tools/agentic-loop/record-iteration.py +221 -0
- package/tools/context/README.md +132 -0
- package/tools/context/__init__.py +42 -0
- package/tools/context/_paths.py +20 -0
- package/tools/context/context_provider.py +721 -0
- package/tools/context/context_section_reader.py +342 -0
- package/tools/context/deep_merge.py +159 -0
- package/tools/context/pending_updates.py +760 -0
- package/tools/context/surface_router.py +278 -0
- package/tools/fast-queries/README.md +65 -0
- package/tools/fast-queries/__init__.py +30 -0
- package/tools/fast-queries/appservices/quicktriage_devops_developer.sh +75 -0
- package/tools/fast-queries/cloud/aws/quicktriage_aws_troubleshooter.sh +32 -0
- package/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh +88 -0
- package/tools/fast-queries/gitops/quicktriage_gitops_operator.sh +48 -0
- package/tools/fast-queries/run_triage.sh +59 -0
- package/tools/fast-queries/terraform/quicktriage_terraform_architect.sh +80 -0
- package/tools/gaia_simulator/__init__.py +33 -0
- package/tools/gaia_simulator/cli.py +354 -0
- package/tools/gaia_simulator/extractor.py +457 -0
- package/tools/gaia_simulator/reporter.py +258 -0
- package/tools/gaia_simulator/routing_simulator.py +334 -0
- package/tools/gaia_simulator/runner.py +539 -0
- package/tools/gaia_simulator/skills_mapper.py +264 -0
- package/tools/memory/README.md +0 -0
- package/tools/memory/__init__.py +20 -0
- package/tools/memory/backfill_fts5.py +107 -0
- package/tools/memory/conflict_detector.py +295 -0
- package/tools/memory/episodic.py +1210 -0
- package/tools/memory/git_invalidator.py +262 -0
- package/tools/memory/paths.py +102 -0
- package/tools/memory/scoring.py +193 -0
- package/tools/memory/search_store.py +360 -0
- package/tools/persist_transcript_analysis.py +85 -0
- package/tools/review/__init__.py +1 -0
- package/tools/review/review_engine.py +157 -0
- package/tools/scan/__init__.py +35 -0
- package/tools/scan/config.py +247 -0
- package/tools/scan/merge.py +212 -0
- package/tools/scan/orchestrator.py +549 -0
- package/tools/scan/registry.py +127 -0
- package/tools/scan/scanners/__init__.py +18 -0
- package/tools/scan/scanners/base.py +137 -0
- package/tools/scan/scanners/environment.py +349 -0
- package/tools/scan/scanners/git.py +570 -0
- package/tools/scan/scanners/infrastructure.py +875 -0
- package/tools/scan/scanners/orchestration.py +600 -0
- package/tools/scan/scanners/stack.py +1085 -0
- package/tools/scan/scanners/tools.py +260 -0
- package/tools/scan/setup.py +686 -0
- package/tools/scan/tests/__init__.py +1 -0
- package/tools/scan/tests/conftest.py +796 -0
- package/tools/scan/tests/test_environment.py +323 -0
- package/tools/scan/tests/test_git.py +419 -0
- package/tools/scan/tests/test_infrastructure.py +382 -0
- package/tools/scan/tests/test_integration.py +920 -0
- package/tools/scan/tests/test_merge.py +269 -0
- package/tools/scan/tests/test_orchestration.py +304 -0
- package/tools/scan/tests/test_stack.py +604 -0
- package/tools/scan/tests/test_tools.py +349 -0
- package/tools/scan/ui.py +624 -0
- package/tools/scan/verify.py +270 -0
- package/tools/scan/walk.py +118 -0
- package/tools/scan/workspace.py +85 -0
- package/tools/validation/README.md +244 -0
- package/tools/validation/__init__.py +17 -0
- package/tools/validation/approval_gate.py +321 -0
- package/tools/validation/validate_skills.py +189 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gaia-ops-marketplace",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "jaguilar87",
|
|
5
|
+
"email": "jorge.aguilar87@gmail.com"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "gaia-ops",
|
|
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",
|
|
12
|
+
"category": "devops",
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "jaguilar87",
|
|
15
|
+
"email": "jorge.aguilar87@gmail.com"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/metraton/gaia#readme",
|
|
18
|
+
"source": "./dist/gaia-ops"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "gaia-security",
|
|
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",
|
|
24
|
+
"category": "security",
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "jaguilar87",
|
|
27
|
+
"email": "jorge.aguilar87@gmail.com"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/metraton/gaia#gaia-security",
|
|
30
|
+
"source": "./dist/gaia-security"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gaia-ops",
|
|
3
|
+
"version": "5.0.0-rc1",
|
|
4
|
+
"description": "Security-first orchestrator with specialized agents, hooks, and governance for AI coding",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "jaguilar87",
|
|
7
|
+
"email": "jorge.aguilar87@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/metraton/gaia#readme",
|
|
10
|
+
"repository": "https://github.com/metraton/gaia",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"security",
|
|
14
|
+
"devops",
|
|
15
|
+
"orchestrator",
|
|
16
|
+
"governance"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"claude-code": ">=2.1.0"
|
|
20
|
+
},
|
|
21
|
+
"categories": [
|
|
22
|
+
"devops",
|
|
23
|
+
"security",
|
|
24
|
+
"orchestration"
|
|
25
|
+
]
|
|
26
|
+
}
|
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## What is Gaia?
|
|
4
|
+
|
|
5
|
+
Gaia is an orchestration system for Claude Code agents. It turns a single Claude Code session into a coordinated multi-agent system with security enforcement, context injection, surface-based routing, episodic memory, and deterministic response contracts.
|
|
6
|
+
|
|
7
|
+
The package is published as `@jaguilar87/gaia` on npm and installed into a project's `.claude/` directory via symlinks. Gaia ships two sub-plugins: `gaia-ops` (full orchestrator with all agents) and `gaia-security` (security hooks only).
|
|
8
|
+
|
|
9
|
+
## Core Concepts
|
|
10
|
+
|
|
11
|
+
| Concept | Definition |
|
|
12
|
+
|---------|-----------|
|
|
13
|
+
| **Agent** | A Markdown file in `agents/` defining identity, scope, skills, and delegation rules |
|
|
14
|
+
| **Skill** | Injected procedural knowledge (in `skills/`) -- the HOW for agents |
|
|
15
|
+
| **Hook** | Python scripts that intercept tool calls before and after execution |
|
|
16
|
+
| **Tool** | Python modules in `tools/` providing context assembly, memory, and validation |
|
|
17
|
+
| **Config** | JSON files in `config/` defining contracts, rules, surface routing, and security |
|
|
18
|
+
| **Orchestrator** | Agent definition in `agents/gaia-orchestrator.md`, activated via `settings.json: { "agent": "gaia-orchestrator" }`; routes requests to the correct agent via on-demand skills |
|
|
19
|
+
|
|
20
|
+
## Runtime Flow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
User request
|
|
24
|
+
|
|
|
25
|
+
v
|
|
26
|
+
Orchestrator (agents/gaia-orchestrator.md, activated via settings.json agent config)
|
|
27
|
+
| Identity defined in agent definition file
|
|
28
|
+
| Surface routing recommendation injected by UserPromptSubmit hook (deterministic)
|
|
29
|
+
| Skills loaded on-demand: agent-response
|
|
30
|
+
v
|
|
31
|
+
Orchestrator dispatches to agent
|
|
32
|
+
| Routes by surface classification
|
|
33
|
+
v
|
|
34
|
+
pre_tool_use.py (PreToolUse hook)
|
|
35
|
+
| 1. Inject project-context into agent prompt (Task/Agent)
|
|
36
|
+
| 2. Inject session events (Task/Agent)
|
|
37
|
+
| 3. Validate Bash commands (security gate)
|
|
38
|
+
| 4. Validate SendMessage (agent resumption)
|
|
39
|
+
v
|
|
40
|
+
Agent executes
|
|
41
|
+
| Uses tools, follows skills, emits json:contract
|
|
42
|
+
v
|
|
43
|
+
subagent_stop.py (SubagentStop hook)
|
|
44
|
+
| 1. Read transcript, extract task description
|
|
45
|
+
| 2. Capture workflow metrics
|
|
46
|
+
| 3. Validate response contract
|
|
47
|
+
| 4. Detect anomalies
|
|
48
|
+
| 5. Store episodic memory
|
|
49
|
+
| 6. Process CONTEXT_UPDATE blocks
|
|
50
|
+
v
|
|
51
|
+
Orchestrator processes json:contract (via agent-response skill)
|
|
52
|
+
| COMPLETE -> summarize to user
|
|
53
|
+
| REVIEW (with approval_id) -> get approval -> resume via SendMessage
|
|
54
|
+
| NEEDS_INPUT -> ask user -> resume via SendMessage
|
|
55
|
+
| BLOCKED -> report blocker
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Hook Pipeline: pre_tool_use.py
|
|
59
|
+
|
|
60
|
+
Entry point for all Bash and Task/Agent tool validation. With `Bash(*)` in the settings.json allow list, the hook is the sole security gate.
|
|
61
|
+
|
|
62
|
+
### Bash Command Validation (BashValidator)
|
|
63
|
+
|
|
64
|
+
Order is short-circuit -- first match wins:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
1. blocked_commands.py --> permanently denied patterns (exit 2)
|
|
68
|
+
2. Claude footer strip --> auto-remove Co-Authored-By (transparent updatedInput)
|
|
69
|
+
3. Commit message check --> conventional commits format validation
|
|
70
|
+
4. cloud_pipe_validator --> block pipes/redirects/chains on cloud CLIs (exit 0, corrective)
|
|
71
|
+
5. mutative_verbs.py --> scan tokens 1-5 for MUTATIVE verbs
|
|
72
|
+
| If mutative + no active grant -> generate nonce, block
|
|
73
|
+
| If mutative + active grant -> allow (T3)
|
|
74
|
+
| If not mutative -> safe by elimination (T0)
|
|
75
|
+
6. gitops_validator --> GitOps policy for kubectl/helm/flux
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Task/Agent Validation
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
1. Response contract guard --> if pending repair exists, block new tasks until resolved
|
|
82
|
+
2. Context injection --> context_provider.py assembles payload, injected via additionalContext
|
|
83
|
+
3. Session events injection --> recent git commits, pushes, file mods added via additionalContext
|
|
84
|
+
4. TaskValidator --> validate agent name, check available agents
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### SendMessage Validation (PreToolUse matcher)
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
1. Agent ID format check --> must match /^a[0-9a-f]{5,}$/
|
|
91
|
+
2. Message presence check --> non-empty message required
|
|
92
|
+
3. Nonce approval check --> detect APPROVE:{nonce}, activate pending grants
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Agent Completion Pipeline: subagent_stop.py
|
|
96
|
+
|
|
97
|
+
Fires after every agent tool completes:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
1. Consume approval file --> delete pending approval if matches agent
|
|
101
|
+
2. Capture workflow metrics --> duration, exit code, plan status -> metrics.jsonl
|
|
102
|
+
3. Validate response contract
|
|
103
|
+
| Parse AGENT_STATUS block (plan_status, agent_id, pending_steps, next_action)
|
|
104
|
+
| Parse EVIDENCE_REPORT block (7 required fields)
|
|
105
|
+
| Parse CONSOLIDATION_REPORT if multi-surface task
|
|
106
|
+
| If invalid -> save pending-repair.json for pre_tool_use guard
|
|
107
|
+
| If valid -> clear pending repair
|
|
108
|
+
4. Detect anomalies --> execution failures, consecutive failures
|
|
109
|
+
| If anomalies found -> create needs_analysis.flag for Gaia
|
|
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
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Surface Routing: surface_router.py
|
|
115
|
+
|
|
116
|
+
Classifies user tasks into surfaces using signal matching against `config/surface-routing.json`.
|
|
117
|
+
|
|
118
|
+
| Surface | Primary Agent | Typical Signals |
|
|
119
|
+
|---------|--------------|-----------------|
|
|
120
|
+
| `live_runtime` | cloud-troubleshooter | pods, services, logs, kubectl, gcloud |
|
|
121
|
+
| `gitops_desired_state` | gitops-operator | manifests, Flux, Helm, Kustomize |
|
|
122
|
+
| `terraform_iac` | terraform-architect | Terraform, Terragrunt, IAM, modules |
|
|
123
|
+
| `app_ci_tooling` | developer | CI/CD, Docker, package tooling |
|
|
124
|
+
| `planning_specs` | gaia-planner | briefs, plans, task breakdowns |
|
|
125
|
+
| `gaia_system` | gaia-system | hooks, skills, agents/, CLAUDE.md |
|
|
126
|
+
| `workspace` | gaia-operator | memory, email, schedules, file transfers |
|
|
127
|
+
|
|
128
|
+
**Classification algorithm:**
|
|
129
|
+
1. Normalize task text
|
|
130
|
+
2. Score each surface by keyword (1.0), command (1.5), and artifact (1.0) matches
|
|
131
|
+
3. Keep surfaces with score >= 1.0 and >= 55% of top score
|
|
132
|
+
4. If no match and current agent maps to a surface, use agent-fallback (score 0.2)
|
|
133
|
+
5. If still no match, dispatch reconnaissance agent
|
|
134
|
+
|
|
135
|
+
**Investigation brief** is generated per agent from routing results. It contains role assignment (primary/cross_check/adjacent), required evidence fields, stop conditions, and whether a CONSOLIDATION_REPORT is required.
|
|
136
|
+
|
|
137
|
+
## Context Injection: context_provider.py
|
|
138
|
+
|
|
139
|
+
Assembles the context payload injected into agent prompts by pre_tool_use.py.
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
context_provider.py <agent_name> <user_task>
|
|
143
|
+
|
|
|
144
|
+
+--> Load project-context.json
|
|
145
|
+
+--> Detect cloud provider (GCP/AWS)
|
|
146
|
+
+--> Load base contracts (config/context-contracts.json)
|
|
147
|
+
+--> Merge cloud overrides (config/cloud/{provider}.json)
|
|
148
|
+
+--> Extract contracted sections for this agent (read permissions)
|
|
149
|
+
+--> Load universal rules (config/universal-rules.json)
|
|
150
|
+
+--> Load relevant episodic memory (similarity match)
|
|
151
|
+
+--> Classify surfaces (surface_router.py)
|
|
152
|
+
+--> Build investigation brief (surface_router.py)
|
|
153
|
+
|
|
|
154
|
+
v
|
|
155
|
+
JSON payload:
|
|
156
|
+
project_knowledge: {sections the agent may read}
|
|
157
|
+
write_permissions: {readable/writable section lists}
|
|
158
|
+
rules: {universal + agent-specific rules}
|
|
159
|
+
surface_routing: {active surfaces, dispatch mode, confidence}
|
|
160
|
+
investigation_brief: {role, required checks, stop conditions}
|
|
161
|
+
historical_context: {relevant episodes if any}
|
|
162
|
+
metadata: {provider, version, counts}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Approval Flow
|
|
166
|
+
|
|
167
|
+
Nonce-based T3 approval lifecycle:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
1. Agent attempts dangerous command (e.g., terraform apply)
|
|
171
|
+
2. mutative_verbs.py detects MUTATIVE verb
|
|
172
|
+
3. BashValidator generates 128-bit nonce via generate_nonce()
|
|
173
|
+
4. write_pending_approval() saves pending-{nonce}.json to .claude/cache/approvals/
|
|
174
|
+
5. Hook returns corrective deny (exit 0) with NONCE:{hex} in message
|
|
175
|
+
6. Agent includes NONCE:{hex} in REVIEW status to orchestrator
|
|
176
|
+
7. Orchestrator presents plan to user, asks for approval
|
|
177
|
+
8. User approves -> orchestrator resumes agent with "APPROVE:{nonce}"
|
|
178
|
+
9. pre_tool_use.py detects APPROVE: prefix, calls activate_pending_approval()
|
|
179
|
+
10. Pending grant converted to active grant (TTL 10 min, verb-matched)
|
|
180
|
+
11. Agent retries command -> check_approval_grant() finds active grant -> allowed
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Response Contract Validation
|
|
184
|
+
|
|
185
|
+
Every agent response must end with a `json:contract` block containing `agent_status`. The contract validator (`hooks/modules/agents/contract_validator.py`) enforces:
|
|
186
|
+
|
|
187
|
+
- **AGENT_STATUS**: PLAN_STATUS (from 5 valid states: COMPLETE, NEEDS_INPUT, REVIEW, BLOCKED, IN_PROGRESS), PENDING_STEPS, NEXT_ACTION, AGENT_ID
|
|
188
|
+
- **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
|
+
- **CONSOLIDATION_REPORT**: required when multi-surface or cross-check. Fields: OWNERSHIP_ASSESSMENT (enum), CONFIRMED_FINDINGS, SUSPECTED_FINDINGS, CONFLICTS, OPEN_GAPS, NEXT_BEST_AGENT
|
|
190
|
+
|
|
191
|
+
Invalid responses trigger a repair loop: save pending-repair.json, pre_tool_use guard blocks new tasks, orchestrator must resume the same agent for repair (max 2 attempts before escalation).
|
|
192
|
+
|
|
193
|
+
## Adapter Layer
|
|
194
|
+
|
|
195
|
+
The adapter layer decouples business logic from CLI-specific protocols. Located at `hooks/adapters/`.
|
|
196
|
+
|
|
197
|
+
### Components
|
|
198
|
+
- `types.py` -- Normalized dataclasses (HookEvent, ValidationRequest, ValidationResult, etc.)
|
|
199
|
+
- `base.py` -- Abstract HookAdapter interface
|
|
200
|
+
- `claude_code.py` -- Claude Code adapter (stdin JSON <-> normalized types)
|
|
201
|
+
- `channel.py` -- Distribution channel detection (plugin vs npm)
|
|
202
|
+
|
|
203
|
+
### Flow
|
|
204
|
+
```
|
|
205
|
+
Claude Code stdin JSON -> ClaudeCodeAdapter.parse_event() -> normalized HookEvent
|
|
206
|
+
-> Business logic (unchanged) ->
|
|
207
|
+
ClaudeCodeAdapter.format_validation_response() -> Claude Code stdout JSON
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Plugin Distribution
|
|
211
|
+
Gaia ships the `gaia-ops` sub-plugin as a Claude Code plugin via `.claude-plugin/plugin.json`.
|
|
212
|
+
The plugin is auto-discovered by Claude Code -- agents, skills, commands, and hooks
|
|
213
|
+
are loaded from their respective directories.
|
|
214
|
+
|
|
215
|
+
See `.claude-plugin/marketplace.json` for the self-hosted marketplace with sub-plugins.
|
|
216
|
+
|
|
217
|
+
## Adapter Coupling Points
|
|
218
|
+
|
|
219
|
+
The adapter layer connects Claude Code's hook protocol to Gaia business logic through 5 coupling points. Each coupling point is a thin entry point that delegates to the adapter for JSON parsing/formatting and to business logic modules for decisions.
|
|
220
|
+
|
|
221
|
+
### CP-1: `hooks/pre_tool_use.py` -- Command Validation Entry Point
|
|
222
|
+
|
|
223
|
+
| Attribute | Value |
|
|
224
|
+
|-----------|-------|
|
|
225
|
+
| **File** | `hooks/pre_tool_use.py` |
|
|
226
|
+
| **Hook event** | PreToolUse |
|
|
227
|
+
| **What it does** | Security gate for all Bash, Task, and Agent tool invocations. Validates commands (blocked patterns, mutative verbs, nonce-based approval), injects project-context into agent prompts, guards pending contract repairs. |
|
|
228
|
+
| **Adapter methods called** | `ClaudeCodeAdapter.parse_event()`, `ClaudeCodeAdapter.parse_pre_tool_use()`, `ClaudeCodeAdapter.format_validation_response()` |
|
|
229
|
+
| **Business logic modules** | `security/blocked_commands.py`, `security/mutative_verbs.py`, `security/approval_grants.py`, `tools/bash_validator.py`, `tools/task_validator.py`, `agents/response_contract.py`, `context/context_provider.py` |
|
|
230
|
+
|
|
231
|
+
### CP-2: `hooks/post_tool_use.py` -- Audit Logging Entry Point
|
|
232
|
+
|
|
233
|
+
| Attribute | Value |
|
|
234
|
+
|-----------|-------|
|
|
235
|
+
| **File** | `hooks/post_tool_use.py` |
|
|
236
|
+
| **Hook event** | PostToolUse |
|
|
237
|
+
| **What it does** | Records execution audit logs, detects critical events (git commits, pushes, file modifications), updates active session context. Reads pre-hook state for timing and tier classification. |
|
|
238
|
+
| **Adapter methods called** | `ClaudeCodeAdapter.parse_event()`, `ClaudeCodeAdapter.parse_post_tool_use()` |
|
|
239
|
+
| **Business logic modules** | `audit/logger.py` (`log_execution`), `audit/event_detector.py` (`detect_critical_event`), `core/state.py` (`get_hook_state`, `clear_hook_state`) |
|
|
240
|
+
|
|
241
|
+
### CP-3: `hooks/subagent_stop.py` -- Contract Validation + Memory Entry Point
|
|
242
|
+
|
|
243
|
+
| Attribute | Value |
|
|
244
|
+
|-----------|-------|
|
|
245
|
+
| **File** | `hooks/subagent_stop.py` |
|
|
246
|
+
| **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. |
|
|
248
|
+
| **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`) |
|
|
250
|
+
|
|
251
|
+
### CP-4: `hooks/modules/tools/hook_response.py` -- Response Formatting
|
|
252
|
+
|
|
253
|
+
| Attribute | Value |
|
|
254
|
+
|-----------|-------|
|
|
255
|
+
| **File** | `hooks/modules/tools/hook_response.py` |
|
|
256
|
+
| **Hook event** | (shared utility, used by PreToolUse callers) |
|
|
257
|
+
| **What it does** | Provides `build_hook_permission_response()` -- a shared builder for hookSpecificOutput JSON. Delegates to the adapter's `format_validation_response()` so all permission responses share a single code path. |
|
|
258
|
+
| **Adapter methods called** | `ClaudeCodeAdapter.format_validation_response()` |
|
|
259
|
+
| **Business logic modules** | None (pure formatting bridge) |
|
|
260
|
+
|
|
261
|
+
### CP-5: `hooks/hooks.json` -- Hook Configuration
|
|
262
|
+
|
|
263
|
+
| Attribute | Value |
|
|
264
|
+
|-----------|-------|
|
|
265
|
+
| **File (plugin channel)** | `hooks/hooks.json` -- paths use `${CLAUDE_PLUGIN_ROOT}/hooks/` prefix |
|
|
266
|
+
| **File (npm channel)** | `hooks/hooks.json` (symlinked into `.claude/hooks/`) |
|
|
267
|
+
| **What it does** | Maps Claude Code hook events to handler scripts. Defines which events fire which entry points, the tool matchers (Bash, Task, Agent, `*`), and permissions (allow/deny lists). |
|
|
268
|
+
| **Events configured** | PreToolUse (Bash, Task, Agent, SendMessage), PostToolUse, SubagentStop, SessionStart, Stop, TaskCompleted, SubagentStart, UserPromptSubmit (routing injection) |
|
|
269
|
+
|
|
270
|
+
### HookAdapter ABC Contract
|
|
271
|
+
|
|
272
|
+
The abstract interface in `hooks/adapters/base.py` defines the adapter contract. Each CLI backend provides a concrete implementation.
|
|
273
|
+
|
|
274
|
+
| Method | Signature | Description |
|
|
275
|
+
|--------|-----------|-------------|
|
|
276
|
+
| `parse_event` | `(stdin_data: str) -> HookEvent` | Parse raw stdin JSON into a normalized, CLI-agnostic event |
|
|
277
|
+
| `format_validation_response` | `(result: ValidationResult) -> HookResponse` | Format a validation result for the CLI's permission protocol |
|
|
278
|
+
| `format_completion_response` | `(result: CompletionResult) -> HookResponse` | Format a completion result for SubagentStop |
|
|
279
|
+
| `format_context_response` | `(result: ContextResult) -> HookResponse` | Format a context injection result |
|
|
280
|
+
| `detect_channel` | `() -> DistributionChannel` | Detect whether Gaia is running as NPM or PLUGIN |
|
|
281
|
+
|
|
282
|
+
Additional abstract methods for P1/P2 events: `adapt_session_start`, `format_bootstrap_response`, `adapt_stop`, `adapt_task_completed`, `adapt_subagent_start`, `format_quality_response`, `format_verification_response`.
|
|
283
|
+
|
|
284
|
+
**Invariants:**
|
|
285
|
+
1. Business logic modules NEVER see `HookResponse`. They produce `ValidationResult`, `CompletionResult`, etc.
|
|
286
|
+
2. The adapter NEVER modifies business logic results -- it only translates format.
|
|
287
|
+
3. Adding a new hook event requires ONLY a new adapter method. Zero changes to business logic modules.
|
|
288
|
+
|
|
289
|
+
### Adding a New Hook Event
|
|
290
|
+
|
|
291
|
+
To add support for a new Claude Code hook event (e.g., a future `PreCompact` event):
|
|
292
|
+
|
|
293
|
+
1. **Add enum value** to `HookEventType` in `hooks/adapters/types.py` (already present for all 19 known events).
|
|
294
|
+
2. **Add adapter method** to `ClaudeCodeAdapter` in `hooks/adapters/claude_code.py` -- implement `adapt_<event_name>(raw: dict) -> <ResultType>` and the corresponding `format_<result>_response()` if a new result type is needed.
|
|
295
|
+
3. **Add extract/format methods** for the event type -- the extract method pulls typed data from the raw payload, the format method builds the CLI response JSON.
|
|
296
|
+
4. **Create hook script entry point** -- a new `hooks/<event_name>.py` file that reads stdin, calls `adapter.parse_event()`, delegates to business logic, and writes the response to stdout.
|
|
297
|
+
5. **Add entry to `hooks/hooks.json`** mapping the event name to the new script.
|
|
298
|
+
|
|
299
|
+
**Zero changes to business logic modules required.** The adapter is the only layer that touches CLI-specific JSON.
|
|
300
|
+
|
|
301
|
+
### Adding a New CLI Backend
|
|
302
|
+
|
|
303
|
+
To support a CLI other than Claude Code (e.g., a hypothetical Cursor or Windsurf integration):
|
|
304
|
+
|
|
305
|
+
1. **Subclass `HookAdapter`** from `hooks/adapters/base.py`.
|
|
306
|
+
2. **Implement `parse_event()`** and all `format_*()` methods to translate between the new CLI's JSON protocol and the normalized types in `hooks/adapters/types.py`.
|
|
307
|
+
3. **No changes to business logic or adapter interface.** The same `ValidationResult`, `CompletionResult`, `ContextResult`, etc. flow through unchanged.
|
|
308
|
+
|
|
309
|
+
**Business logic modules remain untouched.** They consume and produce normalized types; only the adapter layer changes.
|
|
310
|
+
|
|
311
|
+
## Key Files Reference
|
|
312
|
+
|
|
313
|
+
| File | Purpose |
|
|
314
|
+
|------|---------|
|
|
315
|
+
| `agents/gaia-orchestrator.md` | Orchestrator identity and routing (activated via settings.json agent config) |
|
|
316
|
+
| `config/surface-routing.json` | Surface routing config (agent table, signals, dispatch) |
|
|
317
|
+
| `skills/agent-response/SKILL.md` | Contract status handling protocol (on-demand) |
|
|
318
|
+
| `hooks/pre_tool_use.py` | PreToolUse hook entry point |
|
|
319
|
+
| `hooks/subagent_stop.py` | SubagentStop hook entry point |
|
|
320
|
+
| `hooks/modules/tools/bash_validator.py` | Bash command security gate |
|
|
321
|
+
| `hooks/modules/tools/task_validator.py` | Task/Agent invocation validator |
|
|
322
|
+
| `hooks/modules/security/blocked_commands.py` | Permanently denied command patterns |
|
|
323
|
+
| `hooks/modules/security/mutative_verbs.py` | CLI-agnostic mutative verb detector |
|
|
324
|
+
| `hooks/modules/security/approval_grants.py` | Nonce grant lifecycle management |
|
|
325
|
+
| `hooks/modules/agents/response_contract.py` | Agent response contract validator |
|
|
326
|
+
| `hooks/modules/context/context_writer.py` | Progressive context enrichment |
|
|
327
|
+
| `tools/context/context_provider.py` | Context payload assembly |
|
|
328
|
+
| `tools/context/surface_router.py` | Surface classification and investigation briefs |
|
|
329
|
+
| `tools/memory/episodic.py` | Episodic memory storage |
|
|
330
|
+
| `config/context-contracts.json` | Agent read/write section permissions |
|
|
331
|
+
| `config/universal-rules.json` | Universal and agent-specific rules |
|
|
332
|
+
| `config/surface-routing.json` | Surface signals and routing config |
|
|
333
|
+
| `agents/*.md` | Agent identity definitions |
|
|
334
|
+
| `skills/*/SKILL.md` | Injected procedural knowledge |
|
|
335
|
+
| `bin/*.js` | CLI tools (gaia-scan, gaia-doctor, gaia-status, etc.) |
|