@jaguilar87/gaia-ops 4.4.0 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +12 -3
- package/ARCHITECTURE.md +9 -8
- package/CHANGELOG.md +34 -0
- package/README.md +43 -11
- package/agents/terraform-architect.md +1 -1
- package/bin/README.md +2 -2
- package/bin/gaia-doctor.js +18 -5
- package/bin/gaia-history.js +0 -1
- package/bin/gaia-metrics.js +2 -2
- package/bin/gaia-scan.py +23 -1
- package/bin/gaia-update.js +346 -54
- package/bin/pre-publish-validate.js +33 -10
- package/commands/gaia.md +37 -0
- package/config/README.md +3 -9
- package/config/context-contracts.json +47 -15
- package/config/surface-routing.json +9 -1
- package/dist/gaia-ops/.claude-plugin/plugin.json +22 -0
- package/dist/gaia-ops/agents/cloud-troubleshooter.md +73 -0
- package/dist/gaia-ops/agents/devops-developer.md +57 -0
- package/dist/gaia-ops/agents/gaia-system.md +58 -0
- package/dist/gaia-ops/agents/gitops-operator.md +60 -0
- package/dist/gaia-ops/agents/speckit-planner.md +71 -0
- package/dist/gaia-ops/agents/terraform-architect.md +60 -0
- package/dist/gaia-ops/commands/gaia.md +37 -0
- package/dist/gaia-ops/config/README.md +58 -0
- package/dist/gaia-ops/config/cloud/aws.json +140 -0
- package/dist/gaia-ops/config/cloud/gcp.json +145 -0
- package/dist/gaia-ops/config/context-contracts.json +131 -0
- package/dist/gaia-ops/config/git_standards.json +72 -0
- package/dist/gaia-ops/config/surface-routing.json +197 -0
- package/dist/gaia-ops/config/universal-rules.json +10 -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 +1477 -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 +126 -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 +124 -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 +576 -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/anchor_tracker.py +317 -0
- package/dist/gaia-ops/hooks/modules/context/compact_context_builder.py +215 -0
- package/dist/gaia-ops/hooks/modules/context/context_cache.py +129 -0
- package/dist/gaia-ops/hooks/modules/context/context_freshness.py +145 -0
- package/dist/gaia-ops/hooks/modules/context/context_injector.py +427 -0
- package/dist/gaia-ops/hooks/modules/context/context_writer.py +518 -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 +558 -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/identity/__init__.py +0 -0
- package/dist/gaia-ops/hooks/modules/identity/identity_provider.py +21 -0
- package/dist/gaia-ops/hooks/modules/identity/ops_identity.py +34 -0
- package/dist/gaia-ops/hooks/modules/identity/security_identity.py +10 -0
- package/dist/gaia-ops/hooks/modules/memory/__init__.py +8 -0
- package/dist/gaia-ops/hooks/modules/memory/episode_writer.py +227 -0
- package/dist/gaia-ops/hooks/modules/orchestrator/__init__.py +1 -0
- package/dist/gaia-ops/hooks/modules/orchestrator/delegate_mode.py +128 -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 +89 -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 +912 -0
- package/dist/gaia-ops/hooks/modules/security/approval_messages.py +71 -0
- package/dist/gaia-ops/hooks/modules/security/approval_scopes.py +153 -0
- package/dist/gaia-ops/hooks/modules/security/blocked_commands.py +584 -0
- package/dist/gaia-ops/hooks/modules/security/blocked_message_formatter.py +86 -0
- package/dist/gaia-ops/hooks/modules/security/command_semantics.py +130 -0
- package/dist/gaia-ops/hooks/modules/security/gitops_validator.py +179 -0
- package/dist/gaia-ops/hooks/modules/security/mutative_verbs.py +850 -0
- package/dist/gaia-ops/hooks/modules/security/prompt_validator.py +40 -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/session_context_writer.py +100 -0
- package/dist/gaia-ops/hooks/modules/session/session_event_injector.py +158 -0
- package/dist/gaia-ops/hooks/modules/session/session_manager.py +31 -0
- package/dist/gaia-ops/hooks/modules/tools/__init__.py +25 -0
- package/dist/gaia-ops/hooks/modules/tools/bash_validator.py +708 -0
- package/dist/gaia-ops/hooks/modules/tools/cloud_pipe_validator.py +181 -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/task_validator.py +283 -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_tool_use.py +383 -0
- package/dist/gaia-ops/hooks/session_start.py +69 -0
- package/dist/gaia-ops/hooks/stop_hook.py +69 -0
- package/dist/gaia-ops/hooks/subagent_start.py +71 -0
- package/dist/gaia-ops/hooks/subagent_stop.py +288 -0
- package/dist/gaia-ops/hooks/task_completed.py +70 -0
- package/dist/gaia-ops/hooks/user_prompt_submit.py +177 -0
- package/dist/gaia-ops/settings.json +72 -0
- package/dist/gaia-ops/skills/README.md +109 -0
- package/dist/gaia-ops/skills/agent-protocol/SKILL.md +105 -0
- package/dist/gaia-ops/skills/agent-protocol/examples.md +170 -0
- package/dist/gaia-ops/skills/agent-response/SKILL.md +53 -0
- package/dist/gaia-ops/skills/approval/SKILL.md +85 -0
- package/dist/gaia-ops/skills/approval/examples.md +140 -0
- package/dist/gaia-ops/skills/approval/reference.md +57 -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 +76 -0
- package/dist/gaia-ops/skills/context-updater/examples.md +71 -0
- package/dist/gaia-ops/skills/developer-patterns/SKILL.md +93 -0
- package/dist/gaia-ops/skills/developer-patterns/reference.md +112 -0
- package/dist/gaia-ops/skills/execution/SKILL.md +66 -0
- package/dist/gaia-ops/skills/fast-queries/SKILL.md +47 -0
- package/dist/gaia-ops/skills/gaia-patterns/SKILL.md +92 -0
- package/dist/gaia-ops/skills/gaia-patterns/reference.md +22 -0
- package/dist/gaia-ops/skills/git-conventions/SKILL.md +48 -0
- package/dist/gaia-ops/skills/gitops-patterns/SKILL.md +73 -0
- package/dist/gaia-ops/skills/gitops-patterns/reference.md +183 -0
- package/dist/gaia-ops/skills/investigation/SKILL.md +77 -0
- package/dist/gaia-ops/skills/orchestrator-approval/SKILL.md +64 -0
- package/dist/gaia-ops/skills/reference.md +134 -0
- package/dist/gaia-ops/skills/security-tiers/SKILL.md +61 -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 +119 -0
- package/dist/gaia-ops/skills/specification/SKILL.md +186 -0
- package/dist/gaia-ops/skills/speckit-workflow/SKILL.md +165 -0
- package/dist/gaia-ops/skills/speckit-workflow/reference.md +117 -0
- package/dist/gaia-ops/skills/terraform-patterns/SKILL.md +63 -0
- package/dist/gaia-ops/skills/terraform-patterns/reference.md +93 -0
- package/dist/gaia-ops/speckit/README.md +516 -0
- package/dist/gaia-ops/speckit/scripts/.gitkeep +0 -0
- package/dist/gaia-ops/speckit/templates/adr-template.md +118 -0
- package/dist/gaia-ops/speckit/templates/agent-file-template.md +23 -0
- package/dist/gaia-ops/speckit/templates/plan-template.md +227 -0
- package/dist/gaia-ops/speckit/templates/spec-template.md +140 -0
- package/dist/gaia-ops/speckit/templates/tasks-template.md +257 -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 +476 -0
- package/dist/gaia-ops/tools/context/context_section_reader.py +330 -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 +262 -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/episodic.py +1196 -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 +324 -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 +753 -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 +266 -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 +22 -0
- package/dist/gaia-security/config/universal-rules.json +10 -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 +1477 -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 +57 -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 +124 -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 +576 -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/anchor_tracker.py +317 -0
- package/dist/gaia-security/hooks/modules/context/compact_context_builder.py +215 -0
- package/dist/gaia-security/hooks/modules/context/context_cache.py +129 -0
- package/dist/gaia-security/hooks/modules/context/context_freshness.py +145 -0
- package/dist/gaia-security/hooks/modules/context/context_injector.py +427 -0
- package/dist/gaia-security/hooks/modules/context/context_writer.py +518 -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 +558 -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/identity/__init__.py +0 -0
- package/dist/gaia-security/hooks/modules/identity/identity_provider.py +21 -0
- package/dist/gaia-security/hooks/modules/identity/ops_identity.py +34 -0
- package/dist/gaia-security/hooks/modules/identity/security_identity.py +10 -0
- package/dist/gaia-security/hooks/modules/memory/__init__.py +8 -0
- package/dist/gaia-security/hooks/modules/memory/episode_writer.py +227 -0
- package/dist/gaia-security/hooks/modules/orchestrator/__init__.py +1 -0
- package/dist/gaia-security/hooks/modules/orchestrator/delegate_mode.py +128 -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 +89 -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 +912 -0
- package/dist/gaia-security/hooks/modules/security/approval_messages.py +71 -0
- package/dist/gaia-security/hooks/modules/security/approval_scopes.py +153 -0
- package/dist/gaia-security/hooks/modules/security/blocked_commands.py +584 -0
- package/dist/gaia-security/hooks/modules/security/blocked_message_formatter.py +86 -0
- package/dist/gaia-security/hooks/modules/security/command_semantics.py +130 -0
- package/dist/gaia-security/hooks/modules/security/gitops_validator.py +179 -0
- package/dist/gaia-security/hooks/modules/security/mutative_verbs.py +850 -0
- package/dist/gaia-security/hooks/modules/security/prompt_validator.py +40 -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/session_context_writer.py +100 -0
- package/dist/gaia-security/hooks/modules/session/session_event_injector.py +158 -0
- package/dist/gaia-security/hooks/modules/session/session_manager.py +31 -0
- package/dist/gaia-security/hooks/modules/tools/__init__.py +25 -0
- package/dist/gaia-security/hooks/modules/tools/bash_validator.py +708 -0
- package/dist/gaia-security/hooks/modules/tools/cloud_pipe_validator.py +181 -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/task_validator.py +283 -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 +383 -0
- package/dist/gaia-security/hooks/session_start.py +69 -0
- package/dist/gaia-security/hooks/stop_hook.py +69 -0
- package/dist/gaia-security/hooks/user_prompt_submit.py +177 -0
- package/dist/gaia-security/settings.json +58 -0
- package/git-hooks/commit-msg +41 -0
- package/hooks/README.md +8 -6
- package/hooks/adapters/channel.py +0 -25
- package/hooks/adapters/claude_code.py +364 -125
- package/hooks/elicitation_result.py +132 -0
- package/hooks/hooks.json +10 -1
- package/hooks/modules/README.md +3 -2
- package/hooks/modules/agents/contract_validator.py +3 -51
- package/hooks/modules/agents/response_contract.py +4 -8
- package/hooks/modules/agents/transcript_reader.py +4 -5
- package/hooks/modules/audit/__init__.py +4 -6
- package/hooks/modules/audit/event_detector.py +0 -2
- package/hooks/modules/audit/metrics.py +108 -187
- package/hooks/modules/audit/workflow_auditor.py +0 -4
- package/hooks/modules/audit/workflow_recorder.py +0 -5
- package/hooks/modules/context/compact_context_builder.py +1 -0
- package/hooks/modules/context/context_cache.py +129 -0
- package/hooks/modules/context/context_injector.py +18 -40
- package/hooks/modules/context/context_writer.py +1 -25
- package/hooks/modules/context/contracts_loader.py +7 -10
- package/hooks/modules/core/hook_entry.py +1 -0
- package/hooks/modules/core/paths.py +12 -13
- package/hooks/modules/core/plugin_mode.py +74 -4
- package/hooks/modules/core/plugin_setup.py +395 -23
- package/hooks/modules/events/__init__.py +1 -0
- package/hooks/modules/events/event_writer.py +210 -0
- package/hooks/modules/identity/ops_identity.py +18 -27
- package/hooks/modules/memory/episode_writer.py +1 -6
- package/hooks/modules/orchestrator/__init__.py +1 -0
- package/hooks/modules/orchestrator/delegate_mode.py +128 -0
- package/hooks/modules/security/__init__.py +2 -4
- package/hooks/modules/security/approval_constants.py +5 -1
- package/hooks/modules/security/approval_grants.py +189 -6
- package/hooks/modules/security/approval_messages.py +9 -21
- package/hooks/modules/security/blocked_commands.py +98 -34
- package/hooks/modules/security/command_semantics.py +0 -4
- package/hooks/modules/security/gitops_validator.py +1 -11
- package/hooks/modules/security/mutative_verbs.py +179 -38
- package/hooks/modules/security/tiers.py +1 -19
- package/hooks/modules/session/session_event_injector.py +1 -25
- package/hooks/modules/tools/bash_validator.py +310 -94
- package/hooks/modules/tools/shell_parser.py +0 -1
- package/hooks/modules/tools/task_validator.py +9 -29
- package/hooks/post_tool_use.py +0 -72
- package/hooks/pre_tool_use.py +42 -102
- package/hooks/session_start.py +4 -2
- package/hooks/subagent_start.py +6 -2
- package/hooks/subagent_stop.py +1 -13
- package/hooks/user_prompt_submit.py +119 -37
- package/index.js +1 -1
- package/package.json +5 -3
- package/skills/README.md +3 -5
- package/skills/agent-protocol/SKILL.md +17 -16
- package/skills/agent-protocol/examples.md +6 -6
- package/skills/agent-response/SKILL.md +11 -14
- package/skills/approval/SKILL.md +28 -13
- package/skills/approval/reference.md +2 -2
- package/skills/execution/SKILL.md +1 -1
- package/skills/gaia-patterns/SKILL.md +2 -3
- package/skills/orchestrator-approval/SKILL.md +22 -50
- package/skills/security-tiers/SKILL.md +1 -1
- package/templates/README.md +9 -9
- package/templates/managed-settings.template.json +43 -0
- package/tools/gaia_simulator/runner.py +34 -1
- package/tools/scan/orchestrator.py +13 -0
- package/tools/scan/scanners/base.py +8 -0
- package/tools/scan/scanners/git.py +78 -0
- package/tools/scan/scanners/infrastructure.py +65 -0
- package/tools/scan/scanners/stack.py +110 -0
- package/tools/scan/setup.py +120 -13
- package/tools/scan/workspace.py +85 -0
- package/config/context-contracts.aws.json +0 -42
- package/config/context-contracts.gcp.json +0 -39
- package/skills/project-dispatch/SKILL.md +0 -34
- package/templates/settings.template.json +0 -226
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Skills System
|
|
2
|
+
|
|
3
|
+
Skills are knowledge modules that extend agent capabilities. They use Claude Code's native skill system for automatic discovery and injection.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.claude/skills/
|
|
9
|
+
├── agent-protocol/ # json:contract format, state machine, repair flow
|
|
10
|
+
├── agent-response/ # Orchestrator: interpret agent json:contract responses
|
|
11
|
+
├── security-tiers/ # T0-T3 classification
|
|
12
|
+
│ └── reference.md
|
|
13
|
+
├── investigation/ # Diagnosis methodology and pattern analysis
|
|
14
|
+
├── command-execution/ # Defensive execution, safe shell patterns
|
|
15
|
+
│ └── reference.md
|
|
16
|
+
├── context-updater/ # CONTEXT_UPDATE format and contract-driven writable sections
|
|
17
|
+
│ └── examples.md
|
|
18
|
+
├── git-conventions/ # Conventional commits (on-demand)
|
|
19
|
+
├── skill-creation/ # How to create new skills
|
|
20
|
+
├── gaia-patterns/ # Gaia meta-system patterns
|
|
21
|
+
│ └── reference.md
|
|
22
|
+
├── terraform-patterns/ # Terraform/Terragrunt patterns
|
|
23
|
+
│ └── reference.md
|
|
24
|
+
├── gitops-patterns/ # GitOps/Flux patterns
|
|
25
|
+
│ └── reference.md
|
|
26
|
+
├── developer-patterns/ # Developer workflow patterns
|
|
27
|
+
├── fast-queries/ # Quick diagnostic scripts
|
|
28
|
+
├── speckit-workflow/ # Speckit phase management
|
|
29
|
+
├── specification/ # Feature specification workflow
|
|
30
|
+
├── orchestrator-approval/ # T3 approval presentation for orchestrator
|
|
31
|
+
├── approval/ # T3 plan presentation and approval workflow
|
|
32
|
+
│ └── examples.md
|
|
33
|
+
├── execution/ # Post-approval execution protocol
|
|
34
|
+
└── reference.md # Cross-skill reference
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## How Skills Work
|
|
38
|
+
|
|
39
|
+
Skills are assigned to agents via the `skills:` field in agent frontmatter (`.claude/agents/<name>.md`). Claude Code injects the full skill content at subagent startup.
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
# Example: agents/cloud-troubleshooter.md
|
|
43
|
+
---
|
|
44
|
+
name: cloud-troubleshooter
|
|
45
|
+
skills:
|
|
46
|
+
- security-tiers
|
|
47
|
+
- agent-protocol
|
|
48
|
+
- context-updater
|
|
49
|
+
- fast-queries
|
|
50
|
+
- command-execution
|
|
51
|
+
- investigation
|
|
52
|
+
---
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Skill Assignment Matrix
|
|
56
|
+
|
|
57
|
+
| Agent | Core Skills | Domain Skills |
|
|
58
|
+
|-------|-------------|---------------|
|
|
59
|
+
| cloud-troubleshooter | agent-protocol, security-tiers | fast-queries |
|
|
60
|
+
| terraform-architect | agent-protocol, security-tiers, terraform-patterns | fast-queries |
|
|
61
|
+
| gitops-operator | agent-protocol, security-tiers, gitops-patterns | fast-queries |
|
|
62
|
+
| devops-developer | agent-protocol, security-tiers, developer-patterns | fast-queries |
|
|
63
|
+
| gaia | agent-protocol, security-tiers, gaia-patterns, skill-creation | - |
|
|
64
|
+
| speckit-planner | agent-protocol, security-tiers, speckit-workflow | - |
|
|
65
|
+
|
|
66
|
+
Orchestrator skills (loaded on-demand via Skill tool, not assigned to agents):
|
|
67
|
+
- **agent-response** -- contract status interpretation and presentation
|
|
68
|
+
- **orchestrator-approval** -- T3 approval presentation and grant activation
|
|
69
|
+
|
|
70
|
+
## Skill Types
|
|
71
|
+
|
|
72
|
+
| Type | Injection | Examples |
|
|
73
|
+
|------|-----------|----------|
|
|
74
|
+
| **Core** | Always via `skills:` | agent-protocol, security-tiers |
|
|
75
|
+
| **Common** | Most agents via `skills:` | command-execution, context-updater |
|
|
76
|
+
| **Domain** | Per-agent via `skills:` | terraform-patterns, gitops-patterns, developer-patterns, gaia-patterns |
|
|
77
|
+
| **Workflow** | On-demand (agent reads file) | approval, execution, git-conventions |
|
|
78
|
+
| **Orchestrator** | On-demand via Skill tool | agent-response, orchestrator-approval |
|
|
79
|
+
|
|
80
|
+
Workflow skills are loaded on-demand -- agents read them from disk when needed rather than receiving them at startup. Supporting files (`examples.md`, `reference.md`) are also read on-demand.
|
|
81
|
+
|
|
82
|
+
## SKILL.md Format
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
---
|
|
86
|
+
name: skill-name
|
|
87
|
+
description: When Claude should use this skill
|
|
88
|
+
metadata:
|
|
89
|
+
user-invocable: false # Background knowledge, not a slash command
|
|
90
|
+
type: core # Optional: core, common, domain, workflow
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
# Skill Content
|
|
94
|
+
|
|
95
|
+
Instructions and patterns the agent follows.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Development Guidelines
|
|
99
|
+
|
|
100
|
+
- Keep skills focused and specific
|
|
101
|
+
- Use `metadata.user-invocable: false` for background knowledge
|
|
102
|
+
- Keep injected skills under 100 lines (move details to supporting files)
|
|
103
|
+
- Reference workflow skills as readable files, not injected content
|
|
104
|
+
- Avoid duplicating content across skills -- use references instead
|
|
105
|
+
- See `skill-creation/SKILL.md` for detailed creation guidelines
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
**Updated:** 2026-03-19 | **Total skills:** 20
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-protocol
|
|
3
|
+
description: Defines json:contract response format, state machine, and evidence reporting
|
|
4
|
+
metadata:
|
|
5
|
+
user-invocable: false
|
|
6
|
+
type: protocol
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Agent Protocol
|
|
10
|
+
|
|
11
|
+
## Response Contract
|
|
12
|
+
|
|
13
|
+
Every response MUST end with a single fenced `json:contract` block.
|
|
14
|
+
|
|
15
|
+
```json:contract
|
|
16
|
+
{
|
|
17
|
+
"agent_status": {
|
|
18
|
+
"plan_status": "<STATUS>",
|
|
19
|
+
"agent_id": "<a + 5+ hex chars>",
|
|
20
|
+
"pending_steps": [],
|
|
21
|
+
"next_action": "done"
|
|
22
|
+
},
|
|
23
|
+
"evidence_report": {
|
|
24
|
+
"patterns_checked": [],
|
|
25
|
+
"files_checked": [],
|
|
26
|
+
"commands_run": [],
|
|
27
|
+
"key_outputs": [],
|
|
28
|
+
"verbatim_outputs": [],
|
|
29
|
+
"cross_layer_impacts": [],
|
|
30
|
+
"open_gaps": []
|
|
31
|
+
},
|
|
32
|
+
"consolidation_report": null,
|
|
33
|
+
"approval_request": null
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### agent_status (always required)
|
|
38
|
+
|
|
39
|
+
- `plan_status` -- one of the 5 valid states below
|
|
40
|
+
- `agent_id` -- generate once, reuse across responses
|
|
41
|
+
- `pending_steps` -- remaining work (`[]` when done)
|
|
42
|
+
- `next_action` -- `"done"` or what happens next
|
|
43
|
+
|
|
44
|
+
### evidence_report (always required)
|
|
45
|
+
|
|
46
|
+
All 7 fields validated by runtime. Use `[]` when not applicable.
|
|
47
|
+
Keep each to 1-3 items unless the task genuinely needs more.
|
|
48
|
+
|
|
49
|
+
- `key_outputs` -- actionable findings, not descriptions of what you ran. Highlight what matters: what is wrong, what changed, what needs attention.
|
|
50
|
+
- `verbatim_outputs` -- literal command output; truncate at ~100 lines
|
|
51
|
+
- `cross_layer_impacts` -- adjacent surfaces affected
|
|
52
|
+
- `open_gaps` -- what remains unverified; never imply certainty
|
|
53
|
+
|
|
54
|
+
### consolidation_report (when multi-surface)
|
|
55
|
+
|
|
56
|
+
Required when `investigation_brief.consolidation_required` or
|
|
57
|
+
`surface_routing.multi_surface` is true. Otherwise `null`.
|
|
58
|
+
|
|
59
|
+
Fields: `ownership_assessment`, `confirmed_findings`,
|
|
60
|
+
`suspected_findings`, `conflicts`, `open_gaps`, `next_best_agent`.
|
|
61
|
+
|
|
62
|
+
For examples, read `examples.md` in this skill directory.
|
|
63
|
+
|
|
64
|
+
### approval_request (when REVIEW)
|
|
65
|
+
|
|
66
|
+
Required when `plan_status` is `REVIEW`. Otherwise `null`.
|
|
67
|
+
|
|
68
|
+
Fields: `operation`, `exact_content`, `scope`, `risk_level`, `rollback`, `verification`.
|
|
69
|
+
When a hook blocked a T3 command with `[T3_BLOCKED]` and an `approval_id`:
|
|
70
|
+
- Do NOT retry the command -- retrying generates new nonces in a loop
|
|
71
|
+
- Set `plan_status` to `REVIEW` and include `approval_id` in `approval_request`
|
|
72
|
+
- The orchestrator will resume you after user approval; only then retry
|
|
73
|
+
|
|
74
|
+
## State Machine
|
|
75
|
+
|
|
76
|
+
| Status | Meaning |
|
|
77
|
+
|--------|---------|
|
|
78
|
+
| `IN_PROGRESS` | Active work: investigating, planning, executing, retrying (max 2 cycles) |
|
|
79
|
+
| `REVIEW` | Presenting plan or analysis for user feedback. May include `approval_id` when hook-blocked. |
|
|
80
|
+
| `COMPLETE` | Task finished |
|
|
81
|
+
| `BLOCKED` | Cannot proceed -- escalated |
|
|
82
|
+
| `NEEDS_INPUT` | Missing information from user |
|
|
83
|
+
|
|
84
|
+
### Transitions
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
IN_PROGRESS -> COMPLETE (T0/T1/T2)
|
|
88
|
+
IN_PROGRESS -> REVIEW -> IN_PROGRESS -> COMPLETE (plan-first or hook-blocked T3)
|
|
89
|
+
IN_PROGRESS -> BLOCKED | NEEDS_INPUT (any point)
|
|
90
|
+
IN_PROGRESS -> IN_PROGRESS (retry, max 2)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Error Handling
|
|
94
|
+
|
|
95
|
+
| Type | Action | Status |
|
|
96
|
+
|------|--------|--------|
|
|
97
|
+
| Recoverable | Fix and retry (max 2 cycles) | `IN_PROGRESS` |
|
|
98
|
+
| Blocker | Log details, list solutions | `BLOCKED` |
|
|
99
|
+
| Ambiguous | List options | `NEEDS_INPUT` |
|
|
100
|
+
|
|
101
|
+
## Contract Repair
|
|
102
|
+
|
|
103
|
+
If resumed with repair instructions, reissue a complete response
|
|
104
|
+
with `json:contract`. Do not rerun the full investigation.
|
|
105
|
+
Retries capped at 2.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Agent Protocol -- Status-Specific Examples
|
|
2
|
+
|
|
3
|
+
Read on-demand when constructing a `json:contract` block.
|
|
4
|
+
See `SKILL.md` for the schema definition and field rules.
|
|
5
|
+
|
|
6
|
+
## COMPLETE (task finished, evidence-backed)
|
|
7
|
+
|
|
8
|
+
```json:contract
|
|
9
|
+
{
|
|
10
|
+
"agent_status": {
|
|
11
|
+
"plan_status": "COMPLETE",
|
|
12
|
+
"agent_id": "ab7e4d2",
|
|
13
|
+
"pending_steps": [],
|
|
14
|
+
"next_action": "done"
|
|
15
|
+
},
|
|
16
|
+
"evidence_report": {
|
|
17
|
+
"patterns_checked": ["existing HelmRelease naming convention in flux/apps/"],
|
|
18
|
+
"files_checked": ["flux/apps/qxo-api/helmrelease.yaml"],
|
|
19
|
+
"commands_run": ["kubectl get hr -n qxo -> all reconciled"],
|
|
20
|
+
"key_outputs": ["All 12 HelmReleases healthy, no drift detected"],
|
|
21
|
+
"verbatim_outputs": [],
|
|
22
|
+
"cross_layer_impacts": [],
|
|
23
|
+
"open_gaps": []
|
|
24
|
+
},
|
|
25
|
+
"consolidation_report": null,
|
|
26
|
+
"approval_request": null
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## BLOCKED (cannot proceed)
|
|
31
|
+
|
|
32
|
+
```json:contract
|
|
33
|
+
{
|
|
34
|
+
"agent_status": {
|
|
35
|
+
"plan_status": "BLOCKED",
|
|
36
|
+
"agent_id": "ac3a1f9",
|
|
37
|
+
"pending_steps": ["validate IAM binding", "apply terraform change"],
|
|
38
|
+
"next_action": "User must grant roles/container.admin to SA"
|
|
39
|
+
},
|
|
40
|
+
"evidence_report": {
|
|
41
|
+
"patterns_checked": ["SA binding pattern in terraform/iam/"],
|
|
42
|
+
"files_checked": ["terraform/iam/main.tf", "terraform/iam/variables.tf"],
|
|
43
|
+
"commands_run": ["gcloud iam service-accounts get-iam-policy sa@proj.iam -> missing binding"],
|
|
44
|
+
"key_outputs": ["SA lacks roles/container.admin required for node pool ops"],
|
|
45
|
+
"verbatim_outputs": ["gcloud iam service-accounts get-iam-policy sa@proj.iam:\n```\nbindings: []\n```"],
|
|
46
|
+
"cross_layer_impacts": ["GKE node pool scaling depends on this SA"],
|
|
47
|
+
"open_gaps": ["Whether SA should get role directly or via workload identity"]
|
|
48
|
+
},
|
|
49
|
+
"consolidation_report": null,
|
|
50
|
+
"approval_request": null
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## NEEDS_INPUT (missing information)
|
|
55
|
+
|
|
56
|
+
```json:contract
|
|
57
|
+
{
|
|
58
|
+
"agent_status": {
|
|
59
|
+
"plan_status": "NEEDS_INPUT",
|
|
60
|
+
"agent_id": "ad9f2b1",
|
|
61
|
+
"pending_steps": ["create namespace manifest", "configure HelmRelease"],
|
|
62
|
+
"next_action": "User must choose: Option A (shared namespace) or Option B (dedicated namespace)"
|
|
63
|
+
},
|
|
64
|
+
"evidence_report": {
|
|
65
|
+
"patterns_checked": ["namespace conventions in flux/clusters/"],
|
|
66
|
+
"files_checked": ["flux/clusters/dev/namespaces/"],
|
|
67
|
+
"commands_run": [],
|
|
68
|
+
"key_outputs": ["Both patterns exist in codebase -- no single convention"],
|
|
69
|
+
"verbatim_outputs": [],
|
|
70
|
+
"cross_layer_impacts": ["Network policies differ per pattern"],
|
|
71
|
+
"open_gaps": ["User preference for namespace isolation"]
|
|
72
|
+
},
|
|
73
|
+
"consolidation_report": null,
|
|
74
|
+
"approval_request": null
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## REVIEW (plan ready for user feedback, no nonce)
|
|
79
|
+
|
|
80
|
+
```json:contract
|
|
81
|
+
{
|
|
82
|
+
"agent_status": {
|
|
83
|
+
"plan_status": "REVIEW",
|
|
84
|
+
"agent_id": "ae5c8a3",
|
|
85
|
+
"pending_steps": ["execute terraform apply", "verify state"],
|
|
86
|
+
"next_action": "Awaiting user feedback on terraform apply plan"
|
|
87
|
+
},
|
|
88
|
+
"evidence_report": {
|
|
89
|
+
"patterns_checked": ["existing bucket naming in terraform/gcs/"],
|
|
90
|
+
"files_checked": ["terraform/gcs/main.tf", "terraform/gcs/variables.tf"],
|
|
91
|
+
"commands_run": ["terraform plan -out=tfplan -> 1 to add, 0 to change, 0 to destroy"],
|
|
92
|
+
"key_outputs": ["Plan adds 1 GCS bucket with standard config"],
|
|
93
|
+
"verbatim_outputs": ["terraform plan:\n```\n+ google_storage_bucket.events\n name: qxo-events-dev\n location: us-east4\n```"],
|
|
94
|
+
"cross_layer_impacts": ["Flux ExternalSecret must reference new bucket"],
|
|
95
|
+
"open_gaps": []
|
|
96
|
+
},
|
|
97
|
+
"consolidation_report": null,
|
|
98
|
+
"approval_request": {
|
|
99
|
+
"operation": "Create GCS bucket qxo-events-dev",
|
|
100
|
+
"exact_content": "terraform apply -auto-approve",
|
|
101
|
+
"scope": "terraform/gcs/main.tf, GCS bucket in us-east4",
|
|
102
|
+
"risk_level": "MEDIUM",
|
|
103
|
+
"rollback": "terraform destroy -target=google_storage_bucket.events",
|
|
104
|
+
"verification": "gcloud storage buckets describe gs://qxo-events-dev"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## REVIEW with approval_id (hook blocked T3 command)
|
|
110
|
+
|
|
111
|
+
```json:contract
|
|
112
|
+
{
|
|
113
|
+
"agent_status": {
|
|
114
|
+
"plan_status": "REVIEW",
|
|
115
|
+
"agent_id": "af1d9b7",
|
|
116
|
+
"pending_steps": ["execute git push", "verify Flux reconciliation"],
|
|
117
|
+
"next_action": "Hook blocked git push -- awaiting user approval"
|
|
118
|
+
},
|
|
119
|
+
"evidence_report": {
|
|
120
|
+
"patterns_checked": ["git branch naming in flux/clusters/"],
|
|
121
|
+
"files_checked": ["flux/apps/qxo-api/helmrelease.yaml"],
|
|
122
|
+
"commands_run": ["git diff HEAD -> 1 file changed", "git push origin main -> BLOCKED by hook"],
|
|
123
|
+
"key_outputs": ["Push blocked by security hook, approval_id issued"],
|
|
124
|
+
"verbatim_outputs": ["[T3_BLOCKED] MUTATIVE operation requires user approval. approval_id: a1b2c3..."],
|
|
125
|
+
"cross_layer_impacts": ["Flux will reconcile HelmRelease on push"],
|
|
126
|
+
"open_gaps": []
|
|
127
|
+
},
|
|
128
|
+
"consolidation_report": null,
|
|
129
|
+
"approval_request": {
|
|
130
|
+
"operation": "Push HelmRelease changes to main",
|
|
131
|
+
"exact_content": "git push origin main",
|
|
132
|
+
"scope": "flux/apps/qxo-api/helmrelease.yaml",
|
|
133
|
+
"risk_level": "MEDIUM",
|
|
134
|
+
"rollback": "git revert HEAD && git push",
|
|
135
|
+
"verification": "flux get hr -n qxo -> reconciled",
|
|
136
|
+
"approval_id": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## With Consolidation (multi-surface task)
|
|
142
|
+
|
|
143
|
+
```json:contract
|
|
144
|
+
{
|
|
145
|
+
"agent_status": {
|
|
146
|
+
"plan_status": "COMPLETE",
|
|
147
|
+
"agent_id": "af4b2e8",
|
|
148
|
+
"pending_steps": [],
|
|
149
|
+
"next_action": "done"
|
|
150
|
+
},
|
|
151
|
+
"evidence_report": {
|
|
152
|
+
"patterns_checked": ["terraform module structure in terraform/modules/"],
|
|
153
|
+
"files_checked": ["terraform/modules/gke/main.tf", "flux/clusters/dev/kustomization.yaml"],
|
|
154
|
+
"commands_run": ["terragrunt plan -chdir=/abs/path -> no changes"],
|
|
155
|
+
"key_outputs": ["Terraform state matches code; Flux kustomization references correct cluster"],
|
|
156
|
+
"verbatim_outputs": [],
|
|
157
|
+
"cross_layer_impacts": ["Flux depends on GKE node pool count from terraform output"],
|
|
158
|
+
"open_gaps": ["HPA config in flux not verified"]
|
|
159
|
+
},
|
|
160
|
+
"consolidation_report": {
|
|
161
|
+
"ownership_assessment": "cross_surface_dependency",
|
|
162
|
+
"confirmed_findings": ["GKE cluster config matches terraform code", "Node pool count is 3 in both plan and live"],
|
|
163
|
+
"suspected_findings": ["HPA max replicas may exceed node capacity"],
|
|
164
|
+
"conflicts": [],
|
|
165
|
+
"open_gaps": ["HPA config in flux not verified -- gitops-operator should check"],
|
|
166
|
+
"next_best_agent": "gitops-operator"
|
|
167
|
+
},
|
|
168
|
+
"approval_request": null
|
|
169
|
+
}
|
|
170
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-response
|
|
3
|
+
description: Use when an agent returns a json:contract response that needs to be interpreted and presented to the user
|
|
4
|
+
metadata:
|
|
5
|
+
user-invocable: false
|
|
6
|
+
type: protocol
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Agent Response Protocol
|
|
10
|
+
|
|
11
|
+
## State Machine
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Agent returns json:contract
|
|
15
|
+
|- COMPLETE -> Summarize key_outputs (3-5 bullets)
|
|
16
|
+
|- NEEDS_INPUT -> AskUserQuestion, then SendMessage answer back
|
|
17
|
+
|- REVIEW -> Load Skill("orchestrator-approval") if approval_id present,
|
|
18
|
+
| otherwise AskUserQuestion (execute/modify/cancel)
|
|
19
|
+
|- BLOCKED -> Present open_gaps via AskUserQuestion
|
|
20
|
+
+- IN_PROGRESS -> SendMessage to resume agent
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Mandatory Actions per Status
|
|
24
|
+
|
|
25
|
+
| Status | Action | Tool |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `COMPLETE` | Summarize `key_outputs` in 3-5 bullets. Mention `cross_layer_impacts` and `open_gaps` if non-empty. Say "ask for details" if `verbatim_outputs` exists. | Direct response |
|
|
28
|
+
| `NEEDS_INPUT` | Present the agent's question with options | `AskUserQuestion` -> `SendMessage` |
|
|
29
|
+
| `REVIEW` | If `approval_request.approval_id` is present: load `Skill("orchestrator-approval")`. Otherwise: present plan with options execute / modify / cancel. | `AskUserQuestion` -> `SendMessage` |
|
|
30
|
+
| `BLOCKED` | Present alternatives from `open_gaps` | `AskUserQuestion` |
|
|
31
|
+
| `IN_PROGRESS` | Agent was interrupted, let it continue | `SendMessage` |
|
|
32
|
+
|
|
33
|
+
## Output Fields
|
|
34
|
+
|
|
35
|
+
| Field | When to surface |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `key_outputs` | Always -- base your summary on these |
|
|
38
|
+
| `verbatim_outputs` | Only when user asks for details -- relay in code blocks |
|
|
39
|
+
| `cross_layer_impacts` | Always mention if non-empty |
|
|
40
|
+
| `open_gaps` | Always mention -- never imply certainty |
|
|
41
|
+
| `consolidation_report` | Check for `conflicts` and `next_best_agent` |
|
|
42
|
+
| `next_best_agent` | Ask user if they want to dispatch |
|
|
43
|
+
|
|
44
|
+
## Multiple Agents
|
|
45
|
+
|
|
46
|
+
Wait for ALL dispatched agents before responding. Consolidate findings.
|
|
47
|
+
If agents conflict, present both sides and ask user to decide.
|
|
48
|
+
|
|
49
|
+
## Error Handling
|
|
50
|
+
|
|
51
|
+
| Situation | Action |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Malformed contract | Resume agent with repair instructions (max 2 retries). |
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: approval
|
|
3
|
+
description: Use when a T3 operation is ready and needs to be presented to the user for approval before execution
|
|
4
|
+
metadata:
|
|
5
|
+
user-invocable: false
|
|
6
|
+
type: technique
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Approval
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The plan is a contract. The user approves the exact contract --
|
|
14
|
+
not a vague intent. Structure your plan in the `approval_request`
|
|
15
|
+
field of your `json:contract` so the orchestrator can present it
|
|
16
|
+
directly to the user.
|
|
17
|
+
|
|
18
|
+
## Approval Request
|
|
19
|
+
|
|
20
|
+
Include an `approval_request` object in your `json:contract` block
|
|
21
|
+
with these 6 fields:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
"approval_request": {
|
|
25
|
+
"operation": "verb + target",
|
|
26
|
+
"exact_content": "literal command, config, or file change",
|
|
27
|
+
"scope": "files, resources, environments affected",
|
|
28
|
+
"risk_level": "LOW | MEDIUM | HIGH | CRITICAL",
|
|
29
|
+
"rollback": "how to undo if wrong",
|
|
30
|
+
"verification": "how to confirm success after execution"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
When a hook blocked your command with an `approval_id`, also include:
|
|
35
|
+
```json
|
|
36
|
+
"approval_id": "hex from hook deny response"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Risk Levels
|
|
40
|
+
|
|
41
|
+
| Level | Criteria |
|
|
42
|
+
|-------|----------|
|
|
43
|
+
| LOW | Single resource, non-prod, no dependencies |
|
|
44
|
+
| MEDIUM | Multiple resources, non-prod, some dependencies |
|
|
45
|
+
| HIGH | Production, dependencies, potential downtime |
|
|
46
|
+
| CRITICAL | Irreversible, data loss possible |
|
|
47
|
+
|
|
48
|
+
## Which Status to Emit
|
|
49
|
+
|
|
50
|
+
- `REVIEW` -- presenting a plan before executing (no hook block)
|
|
51
|
+
- `REVIEW` with `approval_id` -- hook blocked your command with an approval_id
|
|
52
|
+
|
|
53
|
+
Both use `REVIEW` as the plan_status. The presence or absence of
|
|
54
|
+
`approval_id` in `approval_request` tells the orchestrator which
|
|
55
|
+
handling path to take.
|
|
56
|
+
|
|
57
|
+
## Hook Block Flow
|
|
58
|
+
|
|
59
|
+
When a hook blocks your command with `[T3_BLOCKED]` and an `approval_id`:
|
|
60
|
+
|
|
61
|
+
1. **STOP** -- do NOT retry the command. Retrying generates a new nonce
|
|
62
|
+
each time, creating an infinite loop.
|
|
63
|
+
2. **Report REVIEW** -- set `plan_status` to `REVIEW` in your `json:contract`.
|
|
64
|
+
3. **Include the approval_id** -- copy the hex identifier from the hook deny
|
|
65
|
+
response into `approval_request.approval_id`.
|
|
66
|
+
4. **Wait** -- the orchestrator presents your plan to the user. When the user
|
|
67
|
+
approves, the orchestrator resumes you with the grant activated.
|
|
68
|
+
5. **Then retry** -- only after the orchestrator resumes you, retry the command.
|
|
69
|
+
|
|
70
|
+
The hook deny message looks like:
|
|
71
|
+
```
|
|
72
|
+
[T3_BLOCKED] This command requires user approval.
|
|
73
|
+
Do NOT retry this command. Report REVIEW with this approval_id in your json:contract.
|
|
74
|
+
approval_id: <hex>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If you lose the approval_id, re-attempt the command once for a fresh one.
|
|
78
|
+
|
|
79
|
+
## Anti-Patterns
|
|
80
|
+
|
|
81
|
+
- **Retrying after T3_BLOCKED** -- generates a new nonce, causes infinite loop
|
|
82
|
+
- Presenting approval without all 6 fields in `approval_request`
|
|
83
|
+
- Putting approval fields in text only without the JSON object
|
|
84
|
+
- Treating prior approvals as valid for new operations
|
|
85
|
+
- Fabricating or paraphrasing the approval_id token
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Approval Plan Examples
|
|
2
|
+
|
|
3
|
+
Reference examples for agents. Read on-demand when building your first plan or when unsure about format.
|
|
4
|
+
|
|
5
|
+
## Example 1: Terraform Apply (GCP)
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
## Terraform Apply Plan
|
|
9
|
+
|
|
10
|
+
### Summary
|
|
11
|
+
- Creating GCP VPC network for production cluster
|
|
12
|
+
- Adds 3 subnetworks across us-east4-a, us-east4-b, us-east4-c
|
|
13
|
+
- No existing resources affected
|
|
14
|
+
|
|
15
|
+
### Changes Proposed
|
|
16
|
+
|
|
17
|
+
**Resources to CREATE:**
|
|
18
|
+
- `google_compute_network.prod-network`: VPC in auto-subnet mode disabled
|
|
19
|
+
- `google_compute_subnetwork.prod-subnet-a`: 10.0.1.0/24 in us-east4-a
|
|
20
|
+
- `google_compute_subnetwork.prod-subnet-b`: 10.0.2.0/24 in us-east4-b
|
|
21
|
+
- `google_compute_subnetwork.prod-subnet-c`: 10.0.3.0/24 in us-east4-c
|
|
22
|
+
|
|
23
|
+
**Resources to MODIFY:** None
|
|
24
|
+
**Resources to DELETE:** None
|
|
25
|
+
|
|
26
|
+
### Validation Results
|
|
27
|
+
|
|
28
|
+
**Dry-run status:**
|
|
29
|
+
- ✅ `terragrunt plan` - No errors, 4 to add, 0 to change, 0 to destroy
|
|
30
|
+
- ✅ `terragrunt hclfmt --check` - No formatting issues
|
|
31
|
+
- ✅ `terraform validate` - Success
|
|
32
|
+
|
|
33
|
+
**Dependencies verified:**
|
|
34
|
+
- GCP project [project-id]: accessible ✓
|
|
35
|
+
- No CIDR conflicts with existing networks ✓
|
|
36
|
+
|
|
37
|
+
### Risk Assessment
|
|
38
|
+
|
|
39
|
+
**Risk Level:** MEDIUM
|
|
40
|
+
|
|
41
|
+
**Potential Risks:**
|
|
42
|
+
1. CIDR overlap with existing VPC networks
|
|
43
|
+
- Mitigation: Verified no overlaps via `gcloud compute networks list`
|
|
44
|
+
2. Subnet creation timeout
|
|
45
|
+
- Mitigation: Timeout set to 300s, idempotent — safe to retry
|
|
46
|
+
|
|
47
|
+
**Rollback Plan:**
|
|
48
|
+
- If creation fails: `terragrunt destroy --terragrunt-working-dir "/abs/path/to/terraform/vpc"`
|
|
49
|
+
- Recovery time: ~5 minutes
|
|
50
|
+
|
|
51
|
+
### Execution Steps
|
|
52
|
+
|
|
53
|
+
When approved, will execute:
|
|
54
|
+
1. `git add [terraform_vpc_path]/`
|
|
55
|
+
2. `git commit -m "feat(infra): add production VPC network"`
|
|
56
|
+
3. `git push origin main`
|
|
57
|
+
4. `terragrunt apply -auto-approve --terragrunt-working-dir "/abs/path/to/terraform/vpc"`
|
|
58
|
+
|
|
59
|
+
### Verification Criteria
|
|
60
|
+
|
|
61
|
+
- `gcloud compute networks describe prod-network --project=[project-id]` → `status: ACTIVE`
|
|
62
|
+
- `gcloud compute networks subnets list --filter="network:prod-network" --project=[project-id]` → 3 subnets listed
|
|
63
|
+
|
|
64
|
+
### Files Affected
|
|
65
|
+
|
|
66
|
+
**Git changes:**
|
|
67
|
+
- Added: `[terraform_vpc_path]/terragrunt.hcl`
|
|
68
|
+
- Added: `[terraform_vpc_path]/main.tf`
|
|
69
|
+
|
|
70
|
+
## Approval Required
|
|
71
|
+
|
|
72
|
+
**Approval Code:** `NONCE:<hex from hook block response>`
|
|
73
|
+
**Operation:** terragrunt apply
|
|
74
|
+
**Environment:** prod
|
|
75
|
+
**Risk Level:** MEDIUM
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Example 2: GitOps Deployment
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## GitOps Deployment Plan
|
|
82
|
+
|
|
83
|
+
### Summary
|
|
84
|
+
- Updating graphql-server image to v1.0.180
|
|
85
|
+
- No configuration changes
|
|
86
|
+
- Flux will auto-reconcile in ~1 minute
|
|
87
|
+
|
|
88
|
+
### Changes Proposed
|
|
89
|
+
|
|
90
|
+
**HelmRelease to MODIFY:**
|
|
91
|
+
- `graphql-server` in namespace `common`
|
|
92
|
+
- Image: ghcr.io/vtr/graphql-server:v1.0.176 → v1.0.180
|
|
93
|
+
- No other changes
|
|
94
|
+
|
|
95
|
+
### Validation Results
|
|
96
|
+
|
|
97
|
+
**Dry-run status:**
|
|
98
|
+
- ✅ `kubectl apply --dry-run=client` - Valid manifest
|
|
99
|
+
- ✅ YAML syntax check - Passed
|
|
100
|
+
- ✅ Image exists in registry - Verified
|
|
101
|
+
|
|
102
|
+
### Risk Assessment
|
|
103
|
+
|
|
104
|
+
**Risk Level:** LOW
|
|
105
|
+
|
|
106
|
+
**Potential Risks:**
|
|
107
|
+
1. New image might have bugs
|
|
108
|
+
- Mitigation: Tested in dev cluster, all tests passed
|
|
109
|
+
2. Pod restart might cause brief downtime
|
|
110
|
+
- Mitigation: RollingUpdate strategy, 2 replicas ensure availability
|
|
111
|
+
|
|
112
|
+
**Rollback Plan:**
|
|
113
|
+
- If deployment fails: `git revert` + `flux reconcile`
|
|
114
|
+
- Recovery time: ~2 minutes
|
|
115
|
+
|
|
116
|
+
### Execution Steps
|
|
117
|
+
|
|
118
|
+
When approved, will execute:
|
|
119
|
+
1. `git add gitops/clusters/prod-digital-eks/common/graphql-server.yaml`
|
|
120
|
+
2. `git commit -m "chore(graphql): update to v1.0.180"`
|
|
121
|
+
3. `git push origin main`
|
|
122
|
+
4. Flux auto-reconciles in ~1 minute (or force: `flux reconcile helmrelease graphql-server -n common --timeout=90s`)
|
|
123
|
+
|
|
124
|
+
### Verification Criteria
|
|
125
|
+
|
|
126
|
+
- `kubectl get helmrelease graphql-server -n common --request-timeout=30s` → `READY=True`, revision contains `v1.0.180`
|
|
127
|
+
- `kubectl get pods -n common -l app=graphql-server --request-timeout=30s` → all pods `Running`
|
|
128
|
+
|
|
129
|
+
### Files Affected
|
|
130
|
+
|
|
131
|
+
**Git changes:**
|
|
132
|
+
- Modified: `gitops/clusters/prod-digital-eks/common/graphql-server.yaml`
|
|
133
|
+
|
|
134
|
+
## Approval Required
|
|
135
|
+
|
|
136
|
+
**Approval Code:** `NONCE:<hex from hook block response>`
|
|
137
|
+
**Operation:** git push + flux reconcile
|
|
138
|
+
**Environment:** prod
|
|
139
|
+
**Risk Level:** LOW
|
|
140
|
+
```
|