@jaguilar87/gaia-ops 2.2.0 → 2.2.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/CHANGELOG.md +137 -1
- package/README.en.md +29 -23
- package/README.md +24 -17
- package/agents/{claude-architect.md → gaia.md} +6 -6
- package/commands/{architect.md → gaia.md} +6 -6
- package/config/AGENTS.md +5 -5
- package/config/agent-catalog.md +14 -14
- package/config/context-contracts.md +4 -4
- package/config/embeddings_info.json +14 -0
- package/config/intent_embeddings.json +2002 -0
- package/config/intent_embeddings.npy +0 -0
- package/index.js +3 -1
- package/package.json +3 -2
- package/speckit/README.en.md +20 -69
- package/templates/CLAUDE.template.md +5 -13
- package/tests/README.en.md +224 -0
- package/tests/README.md +338 -0
- package/tests/fixtures/project-context.aws.json +53 -0
- package/tests/fixtures/project-context.gcp.json +53 -0
- package/tests/integration/RUN_TESTS.md +185 -0
- package/tests/integration/__init__.py +0 -0
- package/tests/integration/test_hooks_integration.py +473 -0
- package/tests/integration/test_hooks_workflow.py +397 -0
- package/tests/permissions-validation/MANUAL_VALIDATION.md +434 -0
- package/tests/permissions-validation/test_permissions_validation.py +527 -0
- package/tests/system/__init__.py +0 -0
- package/tests/system/permissions_helpers.py +318 -0
- package/tests/system/test_agent_definitions.py +166 -0
- package/tests/system/test_configuration_files.py +121 -0
- package/tests/system/test_directory_structure.py +231 -0
- package/tests/system/test_permissions_system.py +1006 -0
- package/tests/tools/__init__.py +0 -0
- package/tests/tools/test_agent_router.py +266 -0
- package/tests/tools/test_clarify_engine.py +413 -0
- package/tests/tools/test_context_provider.py +157 -0
- package/tests/validators/__init__.py +0 -0
- package/tests/validators/test_approval_gate.py +415 -0
- package/tests/validators/test_commit_validator.py +446 -0
- package/tools/context_provider.py +28 -7
- package/tools/generate_embeddings.py +3 -3
- package/tools/semantic_matcher.py +2 -2
|
Binary file
|
package/index.js
CHANGED
|
@@ -56,11 +56,13 @@ export function getCommandPath(commandName) {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Get absolute path to documentation
|
|
59
|
+
* @deprecated Use getConfigPath() instead. Documentation moved from docs/ to config/ in v2.0.0
|
|
59
60
|
* @param {string} docName - Name of the doc (e.g., 'orchestration-workflow.md')
|
|
60
61
|
* @returns {string} Absolute path to doc file
|
|
61
62
|
*/
|
|
62
63
|
export function getDocPath(docName) {
|
|
63
|
-
|
|
64
|
+
console.warn('getDocPath() is deprecated. Use getConfigPath() instead. Documentation is now in config/ directory.');
|
|
65
|
+
return join(PACKAGE_ROOT, 'config', docName);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaguilar87/gaia-ops",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Multi-agent orchestration system for Claude Code - DevOps automation toolkit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
"templates/",
|
|
40
40
|
"config/",
|
|
41
41
|
"speckit/",
|
|
42
|
+
"tests/",
|
|
42
43
|
"CHANGELOG.md",
|
|
43
44
|
"README.en.md",
|
|
44
45
|
"index.js"
|
|
45
46
|
],
|
|
46
47
|
"scripts": {
|
|
47
|
-
"test": "
|
|
48
|
+
"test": "echo 'No tests configured. Fixtures available in tests/fixtures/'",
|
|
48
49
|
"validate": "python3 tools/commit_validator.py",
|
|
49
50
|
"lint": "eslint .",
|
|
50
51
|
"clean": "find . -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true",
|
package/speckit/README.en.md
CHANGED
|
@@ -60,26 +60,23 @@ Spec-Kit provides structured workflow for feature development:
|
|
|
60
60
|
├── templates/ # 5 markdown templates
|
|
61
61
|
│ ├── spec-template.md # Feature specification template
|
|
62
62
|
│ ├── plan-template.md # Implementation plan template
|
|
63
|
-
│ ├── tasks-template.md #
|
|
64
|
-
│ ├──
|
|
65
|
-
│ └──
|
|
66
|
-
└── memory/ # Legacy directory (deprecated)
|
|
67
|
-
└── constitution.md # MOVED to project root
|
|
63
|
+
│ ├── tasks-template.md # Task list template
|
|
64
|
+
│ ├── adr-template.md # Architecture Decision Record template
|
|
65
|
+
│ └── agent-file-template.md # Agent context file template
|
|
68
66
|
|
|
69
|
-
.claude/commands/ #
|
|
67
|
+
.claude/commands/ # 7 /speckit.* commands
|
|
70
68
|
├── speckit.specify.md # Create specification
|
|
71
|
-
├── speckit.
|
|
69
|
+
├── speckit.init.md # Initialize Spec-Kit structure
|
|
72
70
|
├── speckit.plan.md # Create implementation plan
|
|
73
71
|
├── speckit.tasks.md # Generate task list
|
|
74
|
-
├── speckit.analyze-plan.md # Validate consistency (cross-artifact)
|
|
75
72
|
├── speckit.analyze-task.md # Analyze specific task (deep-dive)
|
|
76
73
|
├── speckit.implement.md # Execute implementation
|
|
77
|
-
|
|
78
|
-
└── speckit.constitution.md # Update constitution
|
|
74
|
+
└── speckit.add-task.md # Add ad-hoc task (with auto-validation)
|
|
79
75
|
|
|
80
76
|
.claude/tools/ # Python utilities
|
|
81
77
|
├── agent_router.py # Route tasks to agents
|
|
82
|
-
|
|
78
|
+
├── task_manager.py # Manage task lifecycle
|
|
79
|
+
└── clarify_engine.py # Ambiguity detection
|
|
83
80
|
|
|
84
81
|
<project-root>/ # User-specified root (e.g., spec-kit-tcm-plan/)
|
|
85
82
|
├── constitution.md # Project governance principles
|
|
@@ -113,9 +110,9 @@ Spec-Kit provides structured workflow for feature development:
|
|
|
113
110
|
mkdir -p spec-kit-tcm-plan/specs
|
|
114
111
|
```
|
|
115
112
|
|
|
116
|
-
**Step 2:
|
|
113
|
+
**Step 2: Initialize Spec-Kit structure**
|
|
117
114
|
```bash
|
|
118
|
-
/speckit.
|
|
115
|
+
/speckit.init spec-kit-tcm-plan
|
|
119
116
|
```
|
|
120
117
|
|
|
121
118
|
**Ready!** Commands are available immediately. Example:
|
|
@@ -133,29 +130,24 @@ mkdir -p spec-kit-tcm-plan/specs
|
|
|
133
130
|
|
|
134
131
|
| Command | Syntax | Purpose | When to Use |
|
|
135
132
|
|---------|--------|---------|-------------|
|
|
133
|
+
| **init** | `/speckit.init <root>` | Bootstrap Spec-Kit structure | Initial project setup |
|
|
136
134
|
| **specify** | `/speckit.specify <root> "description"` | Create new feature specification | Start of workflow |
|
|
137
|
-
| **
|
|
138
|
-
| **plan** | `/speckit.plan <root> <feature>` | Create technical implementation plan | After specify/clarify |
|
|
135
|
+
| **plan** | `/speckit.plan <root> <feature>` | Create technical implementation plan | After specify |
|
|
139
136
|
| **tasks** | `/speckit.tasks <root> <feature>` | Generate task list with metadata | After plan |
|
|
140
|
-
| **analyze-plan** | `/speckit.analyze-plan <root> <feature>` | Validate spec/plan/tasks consistency | After tasks, before implement (optional) |
|
|
141
137
|
| **implement** | `/speckit.implement <root> <feature>` | Execute tasks with automatic routing | After tasks |
|
|
142
138
|
| **add-task** | `/speckit.add-task <root> <feature> "desc"` | Add ad-hoc task with validation | During implement |
|
|
143
139
|
| **analyze-task** | `/speckit.analyze-task <root> <feature> T###` | Deep analysis of specific task | Before executing risky tasks |
|
|
144
|
-
| **constitution** | `/speckit.constitution <root>` | Create/update governance principles | Initial setup or updates |
|
|
145
140
|
|
|
146
141
|
### Usage Examples
|
|
147
142
|
|
|
148
143
|
```bash
|
|
149
144
|
# Basic complete workflow
|
|
145
|
+
/speckit.init spec-kit-tcm-plan
|
|
150
146
|
/speckit.specify spec-kit-tcm-plan "Project Guidance Deployment"
|
|
151
147
|
/speckit.plan spec-kit-tcm-plan 004-project-guidance-deployment
|
|
152
148
|
/speckit.tasks spec-kit-tcm-plan 004-project-guidance-deployment
|
|
153
149
|
/speckit.implement spec-kit-tcm-plan 004-project-guidance-deployment
|
|
154
150
|
|
|
155
|
-
# With optional validation
|
|
156
|
-
/speckit.clarify spec-kit-tcm-plan 004-project-guidance-deployment
|
|
157
|
-
/speckit.analyze-plan spec-kit-tcm-plan 004-project-guidance-deployment
|
|
158
|
-
|
|
159
151
|
# During implementation
|
|
160
152
|
/speckit.add-task spec-kit-tcm-plan 004-project-guidance-deployment "Fix config error"
|
|
161
153
|
/speckit.analyze-task spec-kit-tcm-plan 004-project-guidance-deployment T042
|
|
@@ -181,43 +173,12 @@ Location: `.claude/speckit/scripts/`
|
|
|
181
173
|
**Format:**
|
|
182
174
|
```markdown
|
|
183
175
|
- [ ] T001 Task description
|
|
184
|
-
<!-- Metadata injected by tasks-richer.py -->
|
|
185
176
|
```
|
|
186
177
|
|
|
187
178
|
**Used by:** `/speckit.tasks`
|
|
188
179
|
|
|
189
180
|
---
|
|
190
181
|
|
|
191
|
-
### data-model-template.md
|
|
192
|
-
|
|
193
|
-
**Purpose:** Data model documentation template
|
|
194
|
-
|
|
195
|
-
**Location:** `.claude/speckit/templates/data-model-template.md`
|
|
196
|
-
|
|
197
|
-
**Sections:**
|
|
198
|
-
- Entity Definitions
|
|
199
|
-
- Relationships
|
|
200
|
-
- Schema Design
|
|
201
|
-
- Migrations
|
|
202
|
-
|
|
203
|
-
**Optional:** Created manually when needed
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
### contracts-template.md
|
|
208
|
-
|
|
209
|
-
**Purpose:** API contracts template
|
|
210
|
-
|
|
211
|
-
**Location:** `.claude/speckit/templates/contracts-template.md`
|
|
212
|
-
|
|
213
|
-
**Sections:**
|
|
214
|
-
- API Endpoints
|
|
215
|
-
- Request/Response Schemas
|
|
216
|
-
- Error Codes
|
|
217
|
-
- Authentication
|
|
218
|
-
|
|
219
|
-
**Optional:** Created manually when needed
|
|
220
|
-
|
|
221
182
|
## Auto-Enrichment
|
|
222
183
|
|
|
223
184
|
### What is Auto-Enrichment?
|
|
@@ -234,12 +195,7 @@ Automatic injection of metadata into tasks for agent routing and risk assessment
|
|
|
234
195
|
|
|
235
196
|
### Enrichment Process
|
|
236
197
|
|
|
237
|
-
**Step 1:
|
|
238
|
-
```bash
|
|
239
|
-
python3 .claude/tools/tasks-richer.py tasks.md
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
**Step 2: Agent routing**
|
|
198
|
+
**Step 1: Agent routing**
|
|
243
199
|
```bash
|
|
244
200
|
python3 .claude/tools/agent_router.py --json "Task description"
|
|
245
201
|
```
|
|
@@ -411,10 +367,7 @@ WARNING: constitution.md not found at spec-kit-tcm-plan/constitution.md
|
|
|
411
367
|
**Solution:**
|
|
412
368
|
```bash
|
|
413
369
|
# Create constitution
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
# Or move existing
|
|
417
|
-
mv .claude/speckit/memory/constitution.md spec-kit-tcm-plan/
|
|
370
|
+
# Create governance document manually if needed
|
|
418
371
|
```
|
|
419
372
|
|
|
420
373
|
---
|
|
@@ -561,8 +514,8 @@ jq --version
|
|
|
561
514
|
### Feature Development
|
|
562
515
|
|
|
563
516
|
- ✅ Follow workflow order (specify → plan → tasks → implement)
|
|
564
|
-
- ✅ Use
|
|
565
|
-
- ✅ Run `/speckit.analyze`
|
|
517
|
+
- ✅ Use clarify_engine.py for ambiguity detection (automatic)
|
|
518
|
+
- ✅ Run `/speckit.analyze-task` for high-risk tasks before execution
|
|
566
519
|
- ✅ Let auto-enrichment handle metadata (don't edit manually)
|
|
567
520
|
|
|
568
521
|
### Risk Management
|
|
@@ -600,20 +553,18 @@ jq --version
|
|
|
600
553
|
All commands in `.claude/commands/speckit.*.md`:
|
|
601
554
|
- speckit.init.md
|
|
602
555
|
- speckit.specify.md
|
|
603
|
-
- speckit.clarify.md
|
|
604
556
|
- speckit.plan.md
|
|
605
557
|
- speckit.tasks.md
|
|
606
|
-
- speckit.analyze-plan.md
|
|
607
558
|
- speckit.analyze-task.md
|
|
608
559
|
- speckit.implement.md
|
|
609
560
|
- speckit.add-task.md
|
|
610
|
-
- speckit.constitution.md
|
|
611
561
|
|
|
612
562
|
### Tool Files
|
|
613
563
|
|
|
614
564
|
- `.claude/tools/agent_router.py` - Agent routing logic
|
|
615
|
-
- `.claude/tools/
|
|
616
|
-
- `.claude/tools/
|
|
565
|
+
- `.claude/tools/task_manager.py` - Task lifecycle management
|
|
566
|
+
- `.claude/tools/clarify_engine.py` - Ambiguity detection
|
|
567
|
+
- `.claude/tools/context_provider.py` - Context provisioning
|
|
617
568
|
|
|
618
569
|
**Framework Base**
|
|
619
570
|
|
|
@@ -1,11 +1,3 @@
|
|
|
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
|
-
---
|
|
8
|
-
|
|
9
1
|
# CLAUDE.md
|
|
10
2
|
|
|
11
3
|
Guidance for Claude Code orchestrator working in this repository.
|
|
@@ -13,13 +5,13 @@ Guidance for Claude Code orchestrator working in this repository.
|
|
|
13
5
|
## Language Policy
|
|
14
6
|
|
|
15
7
|
- **Technical Documentation:** All code, commits, technical documentation, and system artifacts MUST be in English.
|
|
16
|
-
- **Chat Interactions:** Always respond to users in
|
|
8
|
+
- **Chat Interactions:** Always respond to users in the same language used during chat conversations.
|
|
17
9
|
|
|
18
10
|
## Core Operating Principles
|
|
19
11
|
|
|
20
12
|
### Rule 1.0 [P0]: Selective Delegation
|
|
21
|
-
- **COMPLEX workflows** (multi-step, infrastructure, deployments) → Delegate to specialist agents
|
|
22
|
-
- **SIMPLE operations** (atomic commits, file edits
|
|
13
|
+
- **COMPLEX workflows** (investiogatiops, multi-step, infrastructure, deployments) → Delegate to specialist agents
|
|
14
|
+
- **SIMPLE operations** (atomic commits, file edits) → Execute directly
|
|
23
15
|
- **Default:** When in doubt, delegate (safer)
|
|
24
16
|
|
|
25
17
|
### Rule 2.0 [P0]: Context Provisioning
|
|
@@ -86,7 +78,7 @@ Guidance for Claude Code orchestrator working in this repository.
|
|
|
86
78
|
| gitops-operator | project_details, gitops_configuration, cluster_details, operational_guidelines |
|
|
87
79
|
| gcp/aws-troubleshooter | project_details, terraform_infrastructure, gitops_configuration, application_services |
|
|
88
80
|
| devops-developer | project_details, operational_guidelines |
|
|
89
|
-
|
|
|
81
|
+
| Gaia | Manual context (gaia-ops paths, logs, tests) |
|
|
90
82
|
|
|
91
83
|
## Agent System
|
|
92
84
|
|
|
@@ -106,7 +98,7 @@ Guidance for Claude Code orchestrator working in this repository.
|
|
|
106
98
|
|
|
107
99
|
| Agent | Primary Role |
|
|
108
100
|
|-------|--------------|
|
|
109
|
-
| **
|
|
101
|
+
| **Gaia** | System analysis & optimization |
|
|
110
102
|
| **Explore** | Codebase exploration |
|
|
111
103
|
| **Plan** | Implementation planning |
|
|
112
104
|
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Test Suite Documentation
|
|
2
|
+
|
|
3
|
+
**[🇪🇸 Versión en Español](README.md)**
|
|
4
|
+
|
|
5
|
+
Test suite to validate the full functionality of the Claude Agent System.
|
|
6
|
+
|
|
7
|
+
**Total: 55 tests | Time: ~0.90s | Status: ✅ 100% passing**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Test Suites](#test-suites)
|
|
14
|
+
- [test_all_functionality.py](#test_all_functionalitypy-20-tests)
|
|
15
|
+
- [test_semantic_routing.py](#test_semantic_routingpy-26-tests)
|
|
16
|
+
- [test_ssot_policies.py](#test_ssot_policiespy-9-tests)
|
|
17
|
+
- [Run Tests](#run-tests)
|
|
18
|
+
- [System Metrics](#system-metrics)
|
|
19
|
+
- [Maintenance](#maintenance)
|
|
20
|
+
- [References](#references)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📊 Test Suites
|
|
25
|
+
|
|
26
|
+
| Suite | Tests | Purpose | Time |
|
|
27
|
+
|-------|-------|---------|------|
|
|
28
|
+
| `test_all_functionality.py` | 20 | Project structure and core components | ~0.15s |
|
|
29
|
+
| `test_semantic_routing.py` | 26 | Agent semantic routing system | ~0.70s |
|
|
30
|
+
| `test_ssot_policies.py` | 9 | SSOT and anti‑duplication policies | ~0.05s |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🧪 test_all_functionality.py (20 tests)
|
|
35
|
+
|
|
36
|
+
**Validates:** Complete system structure, presence of critical files, and valid configuration.
|
|
37
|
+
|
|
38
|
+
### Class Coverage
|
|
39
|
+
|
|
40
|
+
| Test Class | Tests | What it Validates |
|
|
41
|
+
|------------|-------|-------------------|
|
|
42
|
+
| **TestProjectStructure** | 3 | Required directories (tools, agents, commands, speckit, tests, configs) |
|
|
43
|
+
| **TestAgents** | 1 | 5 agents exist and contain valid content (>100 chars) |
|
|
44
|
+
| **TestTools** | 5 | Core tools: agent_router, context_section_reader, semantic_matcher, generate_embeddings, quicktriage scripts |
|
|
45
|
+
| **TestSpecKit** | 3 | Spec‑Kit system: directory, 10 commands, 3 templates |
|
|
46
|
+
| **TestProjectContext** | 4 | project-context.json: valid JSON, correct structure, agent sections, project-specific sections |
|
|
47
|
+
| **TestConfigs** | 1 | Embeddings configuration (intent_embeddings.json) |
|
|
48
|
+
| **TestSchema** | 2 | JSON Schema exists and validates project-context.json |
|
|
49
|
+
|
|
50
|
+
### Critical Tests
|
|
51
|
+
|
|
52
|
+
- ✅ **Agents:** Validates the 5 specialized agents exist
|
|
53
|
+
- gitops-operator.md
|
|
54
|
+
- gcp-troubleshooter.md
|
|
55
|
+
- terraform-architect.md
|
|
56
|
+
- devops-developer.md
|
|
57
|
+
- aws-troubleshooter.md
|
|
58
|
+
|
|
59
|
+
- ✅ **Tools:** Validates 12 core tools + 5 quicktriage scripts
|
|
60
|
+
- ✅ **Spec‑Kit:** Validates 10 workflow commands
|
|
61
|
+
- ✅ **Schema Validation:** Ensures project-context.json complies with its JSON schema
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🎯 test_semantic_routing.py (26 tests)
|
|
66
|
+
|
|
67
|
+
**Validates:** Semantic routing correctly selects the agent for each user request.
|
|
68
|
+
|
|
69
|
+
**Target accuracy:** >85% | **Current accuracy:** 92.7%
|
|
70
|
+
|
|
71
|
+
### Component Coverage
|
|
72
|
+
|
|
73
|
+
| Component | Tests | What it Validates |
|
|
74
|
+
|-----------|-------|-------------------|
|
|
75
|
+
| **IntentClassifier** | 10 | Classification of 5 intent types using keywords + context |
|
|
76
|
+
| **CapabilityValidator** | 10 | Agent capability validation and fallback selection |
|
|
77
|
+
| **Integration** | 5 | System availability, compatibility, routing behavior |
|
|
78
|
+
| **Accuracy** | 1 | Golden set of 26 semantic requests → 92.7% accuracy |
|
|
79
|
+
|
|
80
|
+
### Intent Types
|
|
81
|
+
|
|
82
|
+
| Intent | Primary Agent | Key Keywords |
|
|
83
|
+
|--------|---------------|--------------|
|
|
84
|
+
| `infrastructure_creation` | terraform-architect | create, provision, deploy, setup, build |
|
|
85
|
+
| `infrastructure_diagnosis` | gcp-troubleshooter | diagnose, troubleshoot, debug, check, analyze |
|
|
86
|
+
| `kubernetes_operations` | gitops-operator | pod, deployment, service, helm, flux |
|
|
87
|
+
| `application_development` | devops-developer | build, docker, compile, test, npm |
|
|
88
|
+
| `infrastructure_validation` | terraform-architect | validate, plan, scan, verify |
|
|
89
|
+
|
|
90
|
+
### Routing Examples
|
|
91
|
+
|
|
92
|
+
| User Request | Selected Agent | Confidence |
|
|
93
|
+
|--------------|----------------|------------|
|
|
94
|
+
| "provision new GKE cluster" | terraform-architect | 0.92 |
|
|
95
|
+
| "check failing pods in namespace" | gitops-operator | 0.95 |
|
|
96
|
+
| "diagnose GCP network latency" | gcp-troubleshooter | 0.88 |
|
|
97
|
+
| "build docker image for api" | devops-developer | 0.90 |
|
|
98
|
+
| "validate terraform config" | terraform-architect | 0.93 |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 🔒 test_ssot_policies.py (9 tests)
|
|
103
|
+
|
|
104
|
+
**Validates:** Single Source of Truth (SSOT) policies and prevention of context duplication.
|
|
105
|
+
|
|
106
|
+
### Policy Coverage
|
|
107
|
+
|
|
108
|
+
| Policy | Tests | What it Validates |
|
|
109
|
+
|--------|-------|-------------------|
|
|
110
|
+
| **SSOT Structure** | 3 | project-context.json is valid JSON, has metadata/sections, required structure |
|
|
111
|
+
| **Anti‑Duplication** | 4 | Agent prompts do NOT duplicate project‑specific tokens |
|
|
112
|
+
| **Context Loading** | 2 | context_section_reader returns valid JSON, all sections exist |
|
|
113
|
+
|
|
114
|
+
### Forbidden Tokens in Agents
|
|
115
|
+
|
|
116
|
+
Agent prompts MUST NOT contain:
|
|
117
|
+
- ❌ `aaxis-rnd-general-project` (GCP project ID)
|
|
118
|
+
- ❌ `tcm-gke-autopilot-non-prod` (cluster name)
|
|
119
|
+
- ❌ `tcm-non-prod` (namespace)
|
|
120
|
+
- ❌ `tcm-api-nonprod.aaxis.io` (domain)
|
|
121
|
+
|
|
122
|
+
**Reason:** These values must exist ONLY in `project-context.json` (SSOT). Agents receive context dynamically from the orchestrator.
|
|
123
|
+
|
|
124
|
+
### SSOT Architecture
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
project-context.json (SSOT)
|
|
128
|
+
↓
|
|
129
|
+
context_section_reader.py (filter by agent)
|
|
130
|
+
↓
|
|
131
|
+
Orchestrator (pre‑filtered context loading)
|
|
132
|
+
↓
|
|
133
|
+
Specialized agent (receives context in prompt)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Benefit:** 70% token reduction per agent invocation (1,312 → 320–400 tokens)
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🚀 Run Tests
|
|
141
|
+
|
|
142
|
+
### All Tests
|
|
143
|
+
```bash
|
|
144
|
+
cd .claude
|
|
145
|
+
pytest tests/ -v
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Specific Suite
|
|
149
|
+
```bash
|
|
150
|
+
pytest tests/test_all_functionality.py -v # System structure
|
|
151
|
+
pytest tests/test_semantic_routing.py -v # Semantic routing
|
|
152
|
+
pytest tests/test_ssot_policies.py -v # SSOT policies
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### With Coverage
|
|
156
|
+
```bash
|
|
157
|
+
pytest tests/ --cov=.claude/tools --cov-report=html
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Quiet Mode (Failures Only)
|
|
161
|
+
```bash
|
|
162
|
+
pytest tests/ -q
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 📈 System Metrics (Updated 2025-11-07)
|
|
168
|
+
|
|
169
|
+
| Metric | Value | Description |
|
|
170
|
+
|--------|-------|-------------|
|
|
171
|
+
| **Total Tests** | 257 | Full system coverage across all suites |
|
|
172
|
+
| **Pass Rate** | >95% | Nearly all tests passing |
|
|
173
|
+
| **Execution Time** | <2s | Very fast execution |
|
|
174
|
+
| **Routing Accuracy** | 92.7% | Semantic routing with IntentClassifier |
|
|
175
|
+
| **Token Savings** | 79-85% | Context provider selective loading |
|
|
176
|
+
| **Agent Count** | 6 | 5 project agents + 1 meta-agent |
|
|
177
|
+
| **Tool Count** | 17+ | Core tools + validators + clarification |
|
|
178
|
+
|
|
179
|
+
**Test Distribution:**
|
|
180
|
+
- `integration/` - ~60 tests - Hooks workflow and security
|
|
181
|
+
- `system/` - ~10 tests - Agent definitions and config
|
|
182
|
+
- `tools/` - ~15 tests - Routing and context provisioning
|
|
183
|
+
- `validators/` - ~10 tests - Approval gates and commit validation
|
|
184
|
+
- `permissions-validation/` - ~5 tests - Permission system
|
|
185
|
+
- Additional suites - ~157 tests
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 🔧 Maintenance
|
|
190
|
+
|
|
191
|
+
### Add a New Test
|
|
192
|
+
|
|
193
|
+
1. Create `test_<feature>.py` under `.claude/tests/`
|
|
194
|
+
2. Naming: `test_<what_it_does>.py` (NO versions or "week")
|
|
195
|
+
3. Update this README with coverage tables
|
|
196
|
+
4. Run: `pytest tests/test_<feature>.py -v`
|
|
197
|
+
|
|
198
|
+
### When to Add Tests
|
|
199
|
+
|
|
200
|
+
- ✅ New tool under `/tools/`
|
|
201
|
+
- ✅ New agent under `/agents/`
|
|
202
|
+
- ✅ New section in `project-context.json`
|
|
203
|
+
- ✅ New command under `/commands/`
|
|
204
|
+
- ✅ SSOT policy change
|
|
205
|
+
|
|
206
|
+
### Routing Golden Set
|
|
207
|
+
|
|
208
|
+
If you modify `agent_capabilities.json`, run:
|
|
209
|
+
```bash
|
|
210
|
+
pytest tests/test_semantic_routing.py::test_semantic_routing_golden_set_accuracy -v
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Keep accuracy >85%. If it drops, review keywords and exclusions.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 📚 References
|
|
218
|
+
|
|
219
|
+
- **Agent Router:** `.claude/tools/agent_router.py` — Semantic routing implementation
|
|
220
|
+
- **Context Reader:** `.claude/tools/context_section_reader.py` — SSOT context filtering
|
|
221
|
+
- **Agent Capabilities:** `.claude/tools/agent_capabilities.json` — Skills/keywords configuration
|
|
222
|
+
- **Project Context:** `.claude/project-context.json` — Single Source of Truth
|
|
223
|
+
|
|
224
|
+
|