@jaguilar87/gaia-ops 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +315 -0
  2. package/CLAUDE.md +154 -0
  3. package/LICENSE +21 -0
  4. package/README.md +221 -0
  5. package/agents/aws-troubleshooter.md +50 -0
  6. package/agents/claude-architect.md +821 -0
  7. package/agents/devops-developer.md +92 -0
  8. package/agents/gcp-troubleshooter.md +50 -0
  9. package/agents/gitops-operator.md +360 -0
  10. package/agents/terraform-architect.md +289 -0
  11. package/bin/gaia-init.js +620 -0
  12. package/commands/architect.md +97 -0
  13. package/commands/restore-session.md +87 -0
  14. package/commands/save-session.md +88 -0
  15. package/commands/session-status.md +61 -0
  16. package/commands/speckit.add-task.md +144 -0
  17. package/commands/speckit.analyze-task.md +65 -0
  18. package/commands/speckit.implement.md +96 -0
  19. package/commands/speckit.init.md +237 -0
  20. package/commands/speckit.plan.md +88 -0
  21. package/commands/speckit.specify.md +161 -0
  22. package/commands/speckit.tasks.md +188 -0
  23. package/config/AGENTS.md +162 -0
  24. package/config/agent-catalog.md +604 -0
  25. package/config/context-contracts.md +682 -0
  26. package/config/git-standards.md +674 -0
  27. package/config/git_standards.json +69 -0
  28. package/config/orchestration-workflow.md +735 -0
  29. package/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
  30. package/hooks/__pycache__/pre_kubectl_security.cpython-312.pyc +0 -0
  31. package/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
  32. package/hooks/__pycache__/session_start.cpython-312.pyc +0 -0
  33. package/hooks/__pycache__/subagent_stop.cpython-312.pyc +0 -0
  34. package/hooks/post_tool_use.py +463 -0
  35. package/hooks/pre_kubectl_security.py +205 -0
  36. package/hooks/pre_tool_use.py +530 -0
  37. package/hooks/session_start.py +315 -0
  38. package/hooks/subagent_stop.py +549 -0
  39. package/index.js +92 -0
  40. package/package.json +59 -0
  41. package/speckit/README.en.md +648 -0
  42. package/speckit/README.md +353 -0
  43. package/speckit/governance.md +169 -0
  44. package/speckit/scripts/check-prerequisites.sh +194 -0
  45. package/speckit/scripts/common.sh +126 -0
  46. package/speckit/scripts/create-new-feature.sh +131 -0
  47. package/speckit/scripts/init.sh +42 -0
  48. package/speckit/scripts/setup-plan.sh +95 -0
  49. package/speckit/scripts/update-agent-context.sh +718 -0
  50. package/speckit/templates/adr-template.md +118 -0
  51. package/speckit/templates/agent-file-template.md +23 -0
  52. package/speckit/templates/plan-template.md +233 -0
  53. package/speckit/templates/spec-template.md +116 -0
  54. package/speckit/templates/tasks-template-bkp.md +136 -0
  55. package/speckit/templates/tasks-template.md +345 -0
  56. package/templates/CLAUDE.template.md +170 -0
  57. package/templates/code-examples/approval_gate_workflow.py +141 -0
  58. package/templates/code-examples/clarification_workflow.py +94 -0
  59. package/templates/code-examples/commit_validation.py +86 -0
  60. package/templates/project-context.template.json +126 -0
  61. package/templates/settings.template.json +307 -0
  62. package/tools/__pycache__/agent_router.cpython-312.pyc +0 -0
  63. package/tools/__pycache__/approval_gate.cpython-312.pyc +0 -0
  64. package/tools/__pycache__/clarify_engine.cpython-312.pyc +0 -0
  65. package/tools/__pycache__/clarify_patterns.cpython-312.pyc +0 -0
  66. package/tools/__pycache__/commit_validator.cpython-312.pyc +0 -0
  67. package/tools/__pycache__/context_section_reader.cpython-312.pyc +0 -0
  68. package/tools/__pycache__/routing_dashboard.cpython-312.pyc +0 -0
  69. package/tools/__pycache__/routing_feedback.cpython-312.pyc +0 -0
  70. package/tools/__pycache__/semantic_matcher.cpython-312.pyc +0 -0
  71. package/tools/__pycache__/task_manager.cpython-312.pyc +0 -0
  72. package/tools/agent_capabilities.json +231 -0
  73. package/tools/agent_invoker_helper.py +239 -0
  74. package/tools/agent_router.py +730 -0
  75. package/tools/approval_gate.py +318 -0
  76. package/tools/clarify_engine.py +511 -0
  77. package/tools/clarify_patterns.py +356 -0
  78. package/tools/commit_validator.py +338 -0
  79. package/tools/context_provider.py +181 -0
  80. package/tools/context_section_reader.py +301 -0
  81. package/tools/demo_clarify.py +104 -0
  82. package/tools/generate_embeddings.py +168 -0
  83. package/tools/quicktriage_aws_troubleshooter.sh +45 -0
  84. package/tools/quicktriage_devops_developer.sh +38 -0
  85. package/tools/quicktriage_gcp_troubleshooter.sh +51 -0
  86. package/tools/quicktriage_gitops_operator.sh +47 -0
  87. package/tools/quicktriage_terraform_architect.sh +40 -0
  88. package/tools/semantic_matcher.py +222 -0
  89. package/tools/task_manager.py +547 -0
  90. package/tools/task_manager_README.md +395 -0
  91. package/tools/task_manager_example.py +215 -0
@@ -0,0 +1,345 @@
1
+ # Tasks: [FEATURE NAME]
2
+
3
+ **Input**: Design documents from `/specs/[###-feature-name]/`
4
+ **Prerequisites**: plan.md (required), research.md, data-model.md, contracts/
5
+
6
+ ## Execution Flow (main)
7
+ ```
8
+ 1. Load plan.md from feature directory
9
+ → If not found: ERROR "No implementation plan found"
10
+ → Extract: tech stack, libraries, structure
11
+ 2. Load optional design documents:
12
+ → data-model.md: Extract entities → model tasks
13
+ → contracts/: Each file → contract test task
14
+ → research.md: Extract decisions → setup tasks
15
+ 3. Generate tasks by category:
16
+ → Setup: GitOps setup, HelmRelease validation, image tag verification
17
+ → Tests: contract tests, integration tests, health checks
18
+ → Core: models, services, CLI commands
19
+ → Infrastructure: Ingress-GCE, certificate management, DNS setup
20
+ → Integration: DB, middleware, logging, observability
21
+ → Polish: unit tests, performance, documentation, rollback procedures
22
+ 4. Apply task rules:
23
+ → Different files = mark [P] for parallel
24
+ → Same file = sequential (no [P])
25
+ → Tests before implementation (TDD)
26
+ 5. Number tasks sequentially (T001, T002...)
27
+ 6. Generate dependency graph
28
+ 7. Create parallel execution examples
29
+ 8. Validate task completeness:
30
+ → All contracts have tests?
31
+ → All entities have models?
32
+ → All endpoints implemented?
33
+ 9. Return: SUCCESS (tasks ready for execution)
34
+ ```
35
+
36
+ ## Format: `[ID] [P?] Description`
37
+ - **[P]**: Can run in parallel (different files, no dependencies)
38
+ - Include exact file paths in descriptions
39
+
40
+ ## Path Conventions
41
+ - **Single project**: `src/`, `tests/` at repository root
42
+ - **Web app**: `backend/src/`, `frontend/src/`
43
+ - **Mobile**: `api/src/`, `ios/src/` or `android/src/`
44
+ - Paths shown below assume single project - adjust based on plan.md structure
45
+
46
+ ## Phase 3.1: Setup
47
+ - [ ] T001 Create project structure per implementation plan
48
+ <!-- 🤖 Agent: terraform-architect | ✅ T1 | ❓ 0.70 -->
49
+ <!-- 🏷️ Tags: #code #setup -->
50
+ <!-- 🧠 Reasoning: Skill 'terraform_operations' matched (score: 2.0), Routed to terraform-architect, Security tier: T1 -->
51
+ <!-- 🎯 skill: terraform_operations (2.0) -->
52
+ <!-- 🔄 Fallback: devops-developer -->
53
+
54
+ - [ ] T002 Initialize [language] project with [framework] dependencies
55
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
56
+ <!-- 🏷️ Tags: #setup -->
57
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
58
+ <!-- 🎯 default: devops-developer -->
59
+ <!-- 🔄 Fallback: devops-developer -->
60
+
61
+ - [ ] T003 [P] Configure linting and formatting tools
62
+ <!-- 🤖 Agent: gitops-operator | 👁️ T0 | ❓ 0.50 -->
63
+ <!-- 🏷️ Tags: #config #setup -->
64
+ <!-- 🧠 Reasoning: Skill 'configuration_management' matched (score: 2.0), Routed to gitops-operator, Security tier: T0 -->
65
+ <!-- 🎯 skill: configuration_management (2.0) -->
66
+ <!-- 🔄 Fallback: devops-developer -->
67
+
68
+
69
+ ## Phase 3.2: Tests First (TDD) ⚠️ MUST COMPLETE BEFORE 3.3
70
+ **CRITICAL: These tests MUST be written and MUST FAIL before ANY implementation**
71
+ - [ ] T004 [P] Contract test POST /api/users in tests/contract/test_users_post.py
72
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | 🔥 1.00 -->
73
+ <!-- 🏷️ Tags: #api #hr #integration #test -->
74
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 10.0), Routed to devops-developer, Security tier: T1 -->
75
+ <!-- 🎯 skill: testing_validation (10.0) -->
76
+ <!-- 🔄 Fallback: gitops-operator -->
77
+
78
+ - [ ] T005 [P] Contract test GET /api/users/{id} in tests/contract/test_users_get.py
79
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | 🔥 1.00 -->
80
+ <!-- 🏷️ Tags: #api #hr #integration #test -->
81
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 10.0), Routed to devops-developer, Security tier: T1 -->
82
+ <!-- 🎯 skill: testing_validation (10.0) -->
83
+ <!-- 🔄 Fallback: gitops-operator -->
84
+
85
+ - [ ] T006 [P] Integration test user registration in tests/integration/test_registration.py
86
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
87
+ <!-- 🏷️ Tags: #hr #test -->
88
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 10.0), Routed to devops-developer, Security tier: T1 -->
89
+ <!-- 🎯 skill: testing_validation (10.0) -->
90
+ <!-- 🔄 Fallback: gitops-operator -->
91
+
92
+ - [ ] T007 [P] Integration test auth flow in tests/integration/test_auth.py
93
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | 🔥 1.00 -->
94
+ <!-- 🏷️ Tags: #security #test -->
95
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 10.0), Routed to devops-developer, Security tier: T1 -->
96
+ <!-- 🎯 skill: testing_validation (10.0) -->
97
+ <!-- 🔄 Fallback: gitops-operator -->
98
+
99
+
100
+ ## Phase 3.3: Core Implementation (ONLY after tests are failing)
101
+ - [ ] T008 [P] User model in src/models/user.py
102
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ❓ 0.90 -->
103
+ <!-- 🏷️ Tags: #hr -->
104
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 6.0), Routed to devops-developer, Security tier: T1 -->
105
+ <!-- 🎯 skill: application_development (6.0) -->
106
+ <!-- 🔄 Fallback: gitops-operator -->
107
+
108
+ - [ ] T009 [P] UserService CRUD in src/services/user_service.py
109
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | 🔥 1.00 -->
110
+ <!-- 🏷️ Tags: #api #hr #kubernetes -->
111
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 8.0), Routed to devops-developer, Security tier: T1 -->
112
+ <!-- 🎯 skill: application_development (8.0) -->
113
+ <!-- 🔄 Fallback: gitops-operator -->
114
+
115
+ - [ ] T010 [P] CLI --create-user in src/cli/user_commands.py
116
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ❓ 0.90 -->
117
+ <!-- 🏷️ Tags: #hr #setup -->
118
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 6.0), Routed to devops-developer, Security tier: T1 -->
119
+ <!-- 🎯 skill: application_development (6.0) -->
120
+ <!-- 🔄 Fallback: gitops-operator -->
121
+
122
+ - [ ] T011 POST /api/users endpoint
123
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.50 -->
124
+ <!-- 🏷️ Tags: #api #hr #integration -->
125
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 2.0), Routed to devops-developer, Security tier: T1 -->
126
+ <!-- 🎯 skill: application_development (2.0) -->
127
+ <!-- 🔄 Fallback: gitops-operator -->
128
+
129
+ - [ ] T012 GET /api/users/{id} endpoint
130
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.50 -->
131
+ <!-- 🏷️ Tags: #api #hr #integration -->
132
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 2.0), Routed to devops-developer, Security tier: T1 -->
133
+ <!-- 🎯 skill: application_development (2.0) -->
134
+ <!-- 🔄 Fallback: gitops-operator -->
135
+
136
+ - [ ] T013 Input validation
137
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.70 -->
138
+ <!-- 🏷️ Tags: #test -->
139
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 2.0), Routed to devops-developer, Security tier: T1 -->
140
+ <!-- 🎯 skill: testing_validation (2.0) -->
141
+ <!-- 🔄 Fallback: gitops-operator -->
142
+
143
+ - [ ] T014 Error handling and logging
144
+ <!-- 🤖 Agent: gcp-troubleshooter | 👁️ T0 | ❓ 0.50 -->
145
+ <!-- 🏷️ Tags: #debug -->
146
+ <!-- 🧠 Reasoning: Skill 'monitoring_observability' matched (score: 2.0), Routed to gcp-troubleshooter, Security tier: T0 -->
147
+ <!-- 🎯 skill: monitoring_observability (2.0) -->
148
+ <!-- 🔄 Fallback: aws-troubleshooter -->
149
+
150
+
151
+ ## Phase 3.4: Integration
152
+ - [ ] T015 Connect UserService to DB
153
+ <!-- 🤖 Agent: gitops-operator | 👁️ T0 | ⚡ 0.60 -->
154
+ <!-- 🏷️ Tags: #api #database #hr #kubernetes -->
155
+ <!-- 🧠 Reasoning: Skill 'kubernetes_deployment' matched (score: 2.0), Routed to gitops-operator, Security tier: T0 -->
156
+ <!-- 🎯 skill: kubernetes_deployment (2.0) -->
157
+ <!-- 🔄 Fallback: devops-developer -->
158
+
159
+ - [ ] T016 Auth middleware
160
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
161
+ <!-- 🏷️ Tags: #security -->
162
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
163
+ <!-- 🎯 default: devops-developer -->
164
+ <!-- 🔄 Fallback: devops-developer -->
165
+
166
+ - [ ] T017 Request/response logging
167
+ <!-- 🤖 Agent: gcp-troubleshooter | 👁️ T0 | ❓ 0.50 -->
168
+ <!-- 🏷️ Tags: -->
169
+ <!-- 🧠 Reasoning: Skill 'monitoring_observability' matched (score: 2.0), Routed to gcp-troubleshooter, Security tier: T0 -->
170
+ <!-- 🎯 skill: monitoring_observability (2.0) -->
171
+ <!-- 🔄 Fallback: aws-troubleshooter -->
172
+
173
+ - [ ] T018 CORS and security headers
174
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.70 -->
175
+ <!-- 🏷️ Tags: #infrastructure #security #test -->
176
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 2.0), Routed to devops-developer, Security tier: T1 -->
177
+ <!-- 🎯 skill: testing_validation (2.0) -->
178
+ <!-- 🔄 Fallback: gitops-operator -->
179
+
180
+
181
+ ## Phase 3.5: Polish
182
+ - [ ] T019 [P] Unit tests for validation in tests/unit/test_validation.py
183
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
184
+ <!-- 🏷️ Tags: #test -->
185
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 12.0), Routed to devops-developer, Security tier: T1 -->
186
+ <!-- 🎯 skill: testing_validation (12.0) -->
187
+ <!-- 🔄 Fallback: gitops-operator -->
188
+
189
+ - [ ] T020 Performance tests (<200ms)
190
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
191
+ <!-- 🏷️ Tags: #performance #test -->
192
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 5.0), Routed to devops-developer, Security tier: T1 -->
193
+ <!-- 🎯 skill: testing_validation (5.0) -->
194
+ <!-- 🔄 Fallback: gitops-operator -->
195
+
196
+ - [ ] T021 [P] Update docs/api.md
197
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | 🔥 1.00 -->
198
+ <!-- 🏷️ Tags: #api #docs #integration -->
199
+ <!-- 🧠 Reasoning: Skill 'documentation_creation' matched (score: 8.0), Routed to devops-developer, Security tier: T1 -->
200
+ <!-- 🎯 skill: documentation_creation (8.0) -->
201
+ <!-- 🔄 Fallback: gitops-operator -->
202
+
203
+ - [ ] T022 Remove duplication
204
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
205
+ <!-- 🏷️ Tags: -->
206
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
207
+ <!-- 🎯 default: devops-developer -->
208
+ <!-- 🔄 Fallback: devops-developer -->
209
+
210
+ - [ ] T023 Run manual-testing.md
211
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
212
+ <!-- 🏷️ Tags: #docs #test -->
213
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 7.0), Routed to devops-developer, Security tier: T1 -->
214
+ <!-- 🎯 skill: testing_validation (7.0) -->
215
+ <!-- 🔄 Fallback: gitops-operator -->
216
+
217
+
218
+ ## Dependencies
219
+ - Tests (T004-T007) before implementation (T008-T014)
220
+ - T008 blocks T009, T015
221
+ - T016 blocks T018
222
+ - Implementation before polish (T019-T023)
223
+
224
+ ## Parallel Example
225
+ ```
226
+ # Launch T004-T007 together:
227
+ Task: "Contract test POST /api/users in tests/contract/test_users_post.py"
228
+ Task: "Contract test GET /api/users/{id} in tests/contract/test_users_get.py"
229
+ Task: "Integration test registration in tests/integration/test_registration.py"
230
+ Task: "Integration test auth in tests/integration/test_auth.py"
231
+ ```
232
+
233
+ ## Notes
234
+ - [P] tasks = different files, no dependencies
235
+ - Verify tests fail before implementing
236
+ - Commit after each task
237
+ - Avoid: vague tasks, same file conflicts
238
+
239
+ ## Task Generation Rules
240
+ *Applied during main() execution*
241
+
242
+ 1. **From Contracts**:
243
+ - Each contract file → contract test task [P]
244
+ - Each endpoint → implementation task
245
+
246
+ 2. **From Data Model**:
247
+ - Each entity → model creation task [P]
248
+ - Relationships → service layer tasks
249
+
250
+ 3. **From User Stories**:
251
+ - Each story → integration test [P]
252
+ - Quickstart scenarios → validation tasks
253
+
254
+ 4. **Ordering**:
255
+ - Setup → Tests → Models → Services → Endpoints → Polish
256
+ - Dependencies block parallel execution
257
+
258
+ ## Validation Checklist
259
+ *GATE: Checked by main() before returning*
260
+
261
+ - [ ] T024 All contracts have corresponding tests
262
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
263
+ <!-- 🏷️ Tags: #test -->
264
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 7.0), Routed to devops-developer, Security tier: T1 -->
265
+ <!-- 🎯 skill: testing_validation (7.0) -->
266
+ <!-- 🔄 Fallback: gitops-operator -->
267
+
268
+ - [ ] T025 All entities have model tasks
269
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
270
+ <!-- 🏷️ Tags: -->
271
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
272
+ <!-- 🎯 default: devops-developer -->
273
+ <!-- 🔄 Fallback: devops-developer -->
274
+
275
+ - [ ] T026 All tests come before implementation
276
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
277
+ <!-- 🏷️ Tags: #code #test -->
278
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 5.0), Routed to devops-developer, Security tier: T1 -->
279
+ <!-- 🎯 skill: testing_validation (5.0) -->
280
+ <!-- 🔄 Fallback: gitops-operator -->
281
+
282
+ - [ ] T027 Parallel tasks truly independent
283
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
284
+ <!-- 🏷️ Tags: -->
285
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
286
+ <!-- 🎯 default: devops-developer -->
287
+ <!-- 🔄 Fallback: devops-developer -->
288
+
289
+ - [ ] T028 Each task specifies exact file path
290
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.80 -->
291
+ <!-- 🏷️ Tags: #test -->
292
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 3.0), Routed to devops-developer, Security tier: T1 -->
293
+ <!-- 🎯 skill: testing_validation (3.0) -->
294
+ <!-- 🔄 Fallback: gitops-operator -->
295
+
296
+ - [ ] T029 No task modifies same file as another [P] task
297
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
298
+ <!-- 🏷️ Tags: -->
299
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
300
+ <!-- 🎯 default: devops-developer -->
301
+ <!-- 🔄 Fallback: devops-developer -->
302
+
303
+
304
+ **TCM Constitution Compliance**:
305
+ - [ ] T030 GitOps patterns enforced (no manual kubectl apply tasks)
306
+ <!-- 🤖 Agent: terraform-architect | 🚫 T3 | ❓ 0.70 -->
307
+ <!-- 🏷️ Tags: #docs #kubernetes -->
308
+ <!-- 🧠 Reasoning: Skill 'terraform_operations' matched (score: 2.0), Routed to terraform-architect, Security tier: T3 -->
309
+ <!-- 🎯 skill: terraform_operations (2.0) -->
310
+ <!-- 🔄 Fallback: devops-developer -->
311
+
312
+ - [ ] T031 Concrete image tags specified (no :latest references)
313
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 1.00 -->
314
+ <!-- 🏷️ Tags: #docker #test -->
315
+ <!-- 🧠 Reasoning: Skill 'testing_validation' matched (score: 8.0), Routed to devops-developer, Security tier: T1 -->
316
+ <!-- 🎯 skill: testing_validation (8.0) -->
317
+ <!-- 🔄 Fallback: gitops-operator -->
318
+
319
+ - [ ] T032 HTTPS endpoints required for external exposure
320
+ <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.60 -->
321
+ <!-- 🏷️ Tags: #api #web -->
322
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 3.0), Routed to devops-developer, Security tier: T1 -->
323
+ <!-- 🎯 skill: application_development (3.0) -->
324
+ <!-- 🔄 Fallback: gitops-operator -->
325
+
326
+ - [ ] T033 Health checks included before DNS exposure
327
+ <!-- 🤖 Agent: gcp-troubleshooter | 👁️ T0 | ❓ 0.50 -->
328
+ <!-- 🏷️ Tags: #monitoring #networking #test -->
329
+ <!-- 🧠 Reasoning: Skill 'monitoring_observability' matched (score: 2.0), Routed to gcp-troubleshooter, Security tier: T0 -->
330
+ <!-- 🎯 skill: monitoring_observability (2.0) -->
331
+ <!-- 🔄 Fallback: aws-troubleshooter -->
332
+
333
+ - [ ] T034 Certificate management strategy documented
334
+ <!-- 🤖 Agent: devops-developer | 👁️ T0 | ❓ 0.00 -->
335
+ <!-- 🏷️ Tags: #security #tcm -->
336
+ <!-- 🧠 Reasoning: Defaulted to devops-developer (no specific skill match) -->
337
+ <!-- 🎯 default: devops-developer -->
338
+ <!-- 🔄 Fallback: devops-developer -->
339
+
340
+ - [ ] T035 Rollback procedures defined for deployments
341
+ <!-- 🤖 Agent: devops-developer | 🚫 T3 | ❓ 0.60 -->
342
+ <!-- 🏷️ Tags: #deploy #kubernetes -->
343
+ <!-- 🧠 Reasoning: Skill 'application_development' matched (score: 3.0), Routed to devops-developer, Security tier: T3 -->
344
+ <!-- 🎯 skill: application_development (3.0) -->
345
+ <!-- 🔄 Fallback: gitops-operator -->
@@ -0,0 +1,170 @@
1
+ ---
2
+ version: 2.1.0
3
+ last_updated: {{TIMESTAMP}}
4
+ description: Orchestrator instructions for Claude Code agent system
5
+ maintainer: jaguilar@aaxis.com
6
+ changelog: .claude/CHANGELOG.md
7
+ project_id: {{PROJECT_ID}}
8
+ region: {{REGION}}
9
+ cluster: {{CLUSTER_NAME}}
10
+ ---
11
+
12
+ # CLAUDE.md
13
+
14
+ Guidance for Claude Code orchestrator working in this repository.
15
+
16
+ ## Language Policy
17
+
18
+ - **Technical Documentation:** All code, commits, technical documentation, and system artifacts MUST be in English.
19
+ - **Chat Interactions:** Always respond to users in Spanish during chat conversations.
20
+
21
+ ## Core Operating Principles
22
+
23
+ ### Rule 1.0 [P0]: Selective Delegation
24
+ - **COMPLEX workflows** (multi-step, infrastructure, deployments) → Delegate to specialist agents
25
+ - **SIMPLE operations** (atomic commits, file edits, queries) → Execute directly
26
+ - **Default:** When in doubt, delegate (safer)
27
+
28
+ ### Rule 2.0 [P0]: Context Provisioning
29
+ - Use `context_provider.py` to build agent payload (ONLY for project agents)
30
+ - Meta-agents receive manual context in prompt
31
+
32
+ ### Rule 3.0 [P0]: Two-Phase Workflow for Infrastructure
33
+ - **Phase 1 (Planning):** Agent generates code and plan
34
+ - **Phase 2 (Realization):** After user approval, agent persists and applies
35
+ - **Applies to:** Infrastructure changes, deployments, T3 operations
36
+
37
+ ### Rule 4.0 [P1]: Execution Standards
38
+ - Use native tools (`Write`, `Read`, `Edit`, `Grep`) over bash redirections
39
+ - Execute simple commands separately (`cd /path` then `git status`, NOT chained with `&&`)
40
+ - Permission priority: `deny` > `ask (specific)` > `allow (generic)`
41
+
42
+ ## Orchestrator Workflow
43
+
44
+ **See:** `.claude/docs/orchestration-workflow.md` for complete details.
45
+
46
+ ### Rule 5.0 [P0]: Six-Phase Workflow
47
+
48
+ | Phase | Action | Tool | Mandatory |
49
+ |-------|--------|------|-----------|
50
+ | 0 | Clarification (if ambiguous) | `clarify_engine.py` | Conditional |
51
+ | 1 | Route to agent | `agent_router.py` | Yes |
52
+ | 2 | Provision context | `context_provider.py` | Yes |
53
+ | 3 | Invoke (Planning) | `Task` tool | Yes |
54
+ | 4 | Approval Gate | `approval_gate.py` | **Yes (T3)** |
55
+ | 5 | Realization | `Task` tool (re-invoke) | Yes |
56
+ | 6 | Update SSOT | Edit `project-context.json`, `tasks.md` | Yes |
57
+
58
+ ### Rule 5.1 [P0]: Approval Gate Enforcement
59
+ - Phase 4 CANNOT be skipped for T3 operations
60
+ - Phase 5 requires `validation["approved"] == True`
61
+ - Phase 6 updates MUST complete after successful realization
62
+
63
+ ## Git Operations
64
+
65
+ ### Rule 6.0 [P0]: Commit Responsibility
66
+
67
+ | Scenario | Handler | Reason |
68
+ |----------|---------|--------|
69
+ | Ad-hoc commits ("commitea los cambios") | Orchestrator | Simple, atomic |
70
+ | Infrastructure workflow commits | Agent (terraform/gitops) | Part of realization |
71
+ | PR creation | Orchestrator | Simple ops (commit + push + gh) |
72
+
73
+ ### Rule 6.1 [P0]: Universal Validation
74
+ - **ALL commits** (orchestrator + agents) MUST validate via `commit_validator.safe_validate_before_commit(msg)`
75
+ - **Format:** Conventional Commits `<type>(<scope>): <description>`
76
+ - **Max:** 72 chars, imperative mood, no period
77
+ - **Forbidden:** Claude Code attribution footers
78
+
79
+ **Complete spec:** `.claude/docs/git-standards.md`
80
+ **Config:** `.claude/config/git_standards.json`
81
+
82
+ ## Context Contracts
83
+
84
+ **See:** `.claude/docs/context-contracts.md` for complete contracts.
85
+
86
+ | Agent | Required Context |
87
+ |-------|-----------------|
88
+ | terraform-architect | project_details, terraform_infrastructure, operational_guidelines |
89
+ | gitops-operator | project_details, gitops_configuration, cluster_details, operational_guidelines |
90
+ | gcp/aws-troubleshooter | project_details, terraform_infrastructure, gitops_configuration, application_services |
91
+ | devops-developer | project_details, operational_guidelines |
92
+ | claude-architect | Manual context (system paths, logs, tests) |
93
+
94
+ ## Agent System
95
+
96
+ **See:** `.claude/docs/agent-catalog.md` for full capabilities.
97
+
98
+ ### Project Agents (use context_provider.py)
99
+
100
+ | Agent | Primary Role | Security Tier |
101
+ |-------|--------------|---------------|
102
+ | **terraform-architect** | Terraform/Terragrunt operations | T0-T3 (apply with approval) |
103
+ | **gitops-operator** | Kubernetes/Flux deployments | T0-T3 (push with approval) |
104
+ | **gcp-troubleshooter** | GCP diagnostics | T0-T2 (read-only) |
105
+ | **aws-troubleshooter** | AWS diagnostics | T0-T2 (read-only) |
106
+ | **devops-developer** | Application build/test/debug | T0-T2 |
107
+
108
+ ### Meta-Agents (manual context in prompt)
109
+
110
+ | Agent | Primary Role |
111
+ |-------|--------------|
112
+ | **claude-architect** | System analysis & optimization |
113
+ | **Explore** | Codebase exploration |
114
+ | **Plan** | Implementation planning |
115
+
116
+ **Context pattern:**
117
+ - **Project agents:** `context_provider.py` generates payload automatically
118
+ - **Meta-agents:** Manual context in prompt (system paths, logs, tests)
119
+
120
+ ### Security Tiers
121
+
122
+ | Tier | Operations | Approval | Examples |
123
+ |------|-----------|----------|----------|
124
+ | **T0** | Read-only queries | No | `kubectl get`, `git status`, `terraform show` |
125
+ | **T1** | Local changes only | No | File edits, local commits |
126
+ | **T2** | Reversible remote ops | No | `git push` to feature branch |
127
+ | **T3** | Irreversible ops | **YES** | `git push` to main, `terraform apply`, `kubectl apply` |
128
+
129
+ ## Common Anti-Patterns
130
+
131
+ ### Rule 7.0 [P0]: Violations to Avoid
132
+
133
+ | ❌ DON'T | ✅ DO |
134
+ |----------|-------|
135
+ | Skip approval gate for T3 ops | Use `approval_gate.py` for ALL T3 operations |
136
+ | Use `context_provider.py` for meta-agents | Provide manual context in prompt for meta-agents |
137
+ | Chain bash with `&&` | Use native tools or separate commands |
138
+ | Proceed without approval (`validation["approved"]`) | Halt and require explicit user approval |
139
+ | Over-prompt agents with step-by-step instructions | Minimalist prompt: context + task only |
140
+ | Skip SSOT updates after realization | Update `project-context.json` and `tasks.md` |
141
+
142
+ ## Project Configuration
143
+
144
+ **This project:**
145
+ - **GCP Project ID:** {{PROJECT_ID}}
146
+ - **Region:** {{REGION}}
147
+ - **Cluster:** {{CLUSTER_NAME}}
148
+ - **GitOps Path:** {{GITOPS_PATH}}
149
+ - **Terraform Path:** {{TERRAFORM_PATH}}
150
+ - **App Services Path:** {{APP_SERVICES_PATH}}
151
+
152
+ ## System Paths
153
+
154
+ **NOTE:** All paths are relative to this repository root, resolved at runtime via npm package.
155
+
156
+ - **Agent system:** `.claude/` (symlinked to `node_modules/@aaxis/claude-agents/`)
157
+ - **Orchestrator:** `./CLAUDE.md` (this file)
158
+ - **Tools:** `.claude/tools/` → `node_modules/@aaxis/claude-agents/tools/`
159
+ - **Logs:** `.claude/logs/` (project-specific, NOT symlinked)
160
+ - **Tests:** `.claude/tests/` (project-specific, NOT symlinked)
161
+ - **Project SSOT:** `.claude/project-context.json` (project-specific, NOT symlinked)
162
+
163
+ ## References
164
+
165
+ - **Orchestration workflow:** `.claude/docs/orchestration-workflow.md`
166
+ - **Git standards:** `.claude/docs/git-standards.md`
167
+ - **Context contracts:** `.claude/docs/context-contracts.md`
168
+ - **Agent catalog:** `.claude/docs/agent-catalog.md`
169
+ - **Code examples:** `.claude/templates/code-examples/`
170
+ - **Package source:** `@aaxis/claude-agents` (npm package)
@@ -0,0 +1,141 @@
1
+ # Phase 4: Approval Gate Workflow Example
2
+ # MANDATORY for T3 operations (terraform apply, kubectl apply, git push to main)
3
+
4
+ import sys
5
+ sys.path.insert(0, '/home/jaguilar/aaxis/rnd/repositories/.claude/tools')
6
+ from approval_gate import request_approval, process_approval_response
7
+
8
+ # Example 1: Generate approval summary
9
+ def generate_approval_summary(realization_package: dict, agent_name: str, phase: str):
10
+ """
11
+ Generate structured approval summary from realization package.
12
+ """
13
+ approval_data = request_approval(
14
+ realization_package=realization_package,
15
+ agent_name=agent_name, # "gitops-operator", "terraform-architect", etc.
16
+ phase=phase # "Phase 3.3", "Deploy production", etc.
17
+ )
18
+
19
+ # approval_data contains:
20
+ # - summary: Human-readable breakdown
21
+ # - question_config: Pre-formatted for AskUserQuestion
22
+ # - gate_instance: Reference for validation step
23
+
24
+ return approval_data
25
+
26
+
27
+ # Example 2: Present summary and ask user
28
+ def ask_user_approval(approval_data: dict):
29
+ """
30
+ Present approval summary and ask for user decision.
31
+ """
32
+ # Show summary
33
+ print(approval_data["summary"])
34
+
35
+ # Ask question (3 options: Approve, Reject, Other)
36
+ question_config = approval_data["question_config"]
37
+ # response = AskUserQuestion(**question_config) # Simulated
38
+
39
+ # Example response
40
+ response = {"answers": {"question_1": "✅ Aprobar y ejecutar"}}
41
+
42
+ return response
43
+
44
+
45
+ # Example 3: Validate user response
46
+ def validate_approval(approval_data: dict, user_response: dict, realization_package: dict, agent_name: str, phase: str):
47
+ """
48
+ Process user response and determine if approved.
49
+ """
50
+ validation = process_approval_response(
51
+ gate_instance=approval_data["gate_instance"],
52
+ user_response=user_response["answers"]["question_1"],
53
+ realization_package=realization_package,
54
+ agent_name=agent_name,
55
+ phase=phase
56
+ )
57
+
58
+ # validation contains:
59
+ # - approved: Boolean (True if user approved)
60
+ # - action: String ("proceed", "halt_workflow", "clarify_with_user")
61
+ # - reason: String (explanation)
62
+
63
+ return validation
64
+
65
+
66
+ # Example 4: Enforcement rules
67
+ def enforce_approval_gate(validation: dict):
68
+ """
69
+ Enforce approval gate rules before proceeding to Phase 5.
70
+ """
71
+ if validation["approved"]:
72
+ # Approved, proceed to Phase 5 (Realization)
73
+ return {"allow_phase_5": True}
74
+
75
+ if validation["action"] == "halt_workflow":
76
+ # Rejected, STOP workflow
77
+ return {
78
+ "allow_phase_5": False,
79
+ "message": "User rejected realization. Workflow halted."
80
+ }
81
+
82
+ if validation["action"] == "clarify_with_user":
83
+ # Need more info, re-run approval gate
84
+ return {
85
+ "allow_phase_5": False,
86
+ "message": "Clarification needed. Re-run approval gate."
87
+ }
88
+
89
+ # Default: deny
90
+ return {"allow_phase_5": False, "message": "Unknown validation state"}
91
+
92
+
93
+ # Example 5: Full approval gate workflow
94
+ def approval_gate_workflow(realization_package: dict, agent_name: str, phase: str):
95
+ """
96
+ Complete Phase 4 workflow (MANDATORY for T3 operations).
97
+ """
98
+ # Step 1: Generate approval summary
99
+ approval_data = generate_approval_summary(realization_package, agent_name, phase)
100
+
101
+ # Step 2: Ask user for approval
102
+ user_response = ask_user_approval(approval_data)
103
+
104
+ # Step 3: Validate response
105
+ validation = validate_approval(
106
+ approval_data,
107
+ user_response,
108
+ realization_package,
109
+ agent_name,
110
+ phase
111
+ )
112
+
113
+ # Step 4: Enforce rules
114
+ enforcement = enforce_approval_gate(validation)
115
+
116
+ if not enforcement["allow_phase_5"]:
117
+ # Cannot proceed to Phase 5
118
+ return {
119
+ "status": "blocked",
120
+ "message": enforcement["message"]
121
+ }
122
+
123
+ # Approved, can proceed to Phase 5
124
+ return {
125
+ "status": "approved",
126
+ "message": "User approved. Proceeding to Phase 5 (Realization)."
127
+ }
128
+
129
+
130
+ # Example 6: CRITICAL - Cannot skip approval gate
131
+ def attempt_to_skip_approval_gate():
132
+ """
133
+ This is an ANTI-PATTERN. NEVER do this.
134
+ """
135
+ # ❌ WRONG: Skip approval gate for T3 operation
136
+ # Task(subagent_type="gitops-operator", prompt="Deploy to prod") # Direct realization
137
+ # This violates Rule 5.1 [P0]: Approval Gate Enforcement
138
+
139
+ # ✅ CORRECT: Always go through approval gate
140
+ # Phase 3: Planning -> Phase 4: Approval Gate -> Phase 5: Realization
141
+ pass