@jaguilar87/gaia-ops 3.9.9 → 3.10.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.
- package/agents/cloud-troubleshooter.md +7 -50
- package/agents/devops-developer.md +7 -51
- package/agents/gaia.md +6 -35
- package/agents/gitops-operator.md +8 -51
- package/agents/speckit-planner.md +2 -0
- package/agents/terraform-architect.md +8 -62
- package/hooks/pre_tool_use.py +4 -34
- package/package.json +1 -1
- package/skills/README.md +56 -129
- package/skills/agent-protocol/SKILL.md +78 -0
- package/skills/{standards/anti-patterns → anti-patterns}/SKILL.md +1 -1
- package/skills/{workflow/approval → approval}/SKILL.md +1 -2
- package/skills/{standards/command-execution → command-execution}/SKILL.md +1 -1
- package/skills/context-updater/SKILL.md +59 -0
- package/skills/context-updater/examples.md +71 -0
- package/skills/{workflow/execution → execution}/SKILL.md +1 -2
- package/skills/{domain/fast-queries → fast-queries}/SKILL.md +2 -2
- package/skills/git-conventions/SKILL.md +30 -0
- package/skills/{domain/gitops-patterns → gitops-patterns}/SKILL.md +1 -1
- package/skills/{workflow/investigation → investigation}/SKILL.md +1 -2
- package/skills/{standards/output-format → output-format}/SKILL.md +1 -1
- package/skills/{standards/security-tiers → security-tiers}/SKILL.md +2 -2
- package/skills/{domain/terraform-patterns → terraform-patterns}/SKILL.md +1 -1
- package/templates/CLAUDE.template.md +9 -157
- package/tests/integration/test_context_enrichment.py +1 -1
- package/tests/system/test_directory_structure.py +1 -2
- package/config/skill-triggers.json +0 -137
- package/hooks/modules/skills/skill_loader.py +0 -313
- package/skills/domain/context-updater/SKILL.md +0 -144
- package/skills/domain/universal-protocol/SKILL.md +0 -212
- package/tests/hooks/modules/skills/__init__.py +0 -0
- package/tests/hooks/modules/skills/test_skill_loader.py +0 -398
|
@@ -3,6 +3,12 @@ name: cloud-troubleshooter
|
|
|
3
3
|
description: Diagnostic agent for cloud infrastructure (GCP and AWS). Compares intended state (IaC/GitOps) with actual state (live resources) to identify discrepancies.
|
|
4
4
|
tools: Read, Glob, Grep, Bash, Task, gcloud, kubectl, aws, eksctl, gsutil, terraform
|
|
5
5
|
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- security-tiers
|
|
8
|
+
- output-format
|
|
9
|
+
- agent-protocol
|
|
10
|
+
- context-updater
|
|
11
|
+
- fast-queries
|
|
6
12
|
---
|
|
7
13
|
|
|
8
14
|
## TL;DR
|
|
@@ -12,56 +18,7 @@ model: inherit
|
|
|
12
18
|
**Output:** Diagnostic report with discrepancies and recommendations
|
|
13
19
|
**Tier:** T0-T2 only (strictly read-only, T3 forbidden)
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Response Format (MANDATORY)
|
|
18
|
-
|
|
19
|
-
**END EVERY RESPONSE** with this status block:
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<!-- AGENT_STATUS -->
|
|
23
|
-
PLAN_STATUS: [status]
|
|
24
|
-
CURRENT_PHASE: [phase]
|
|
25
|
-
PENDING_STEPS: [list]
|
|
26
|
-
NEXT_ACTION: [description]
|
|
27
|
-
AGENT_ID: [your agentId]
|
|
28
|
-
<!-- /AGENT_STATUS -->
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Status by Workflow Phase
|
|
32
|
-
|
|
33
|
-
| Phase | Typical Status | When to Use |
|
|
34
|
-
|-------|---------------|-------------|
|
|
35
|
-
| **Investigation** | INVESTIGATING | Comparing intended vs actual state |
|
|
36
|
-
| **Present** | COMPLETE | Found root cause, provided remediation steps |
|
|
37
|
-
| **Any** | BLOCKED | Cannot access cloud/cluster (credentials missing) |
|
|
38
|
-
| **Any** | NEEDS_INPUT | Need clarification (which cluster? which resource?) |
|
|
39
|
-
|
|
40
|
-
**Note:** This agent is diagnostic-only (T0-T2). It never proposes T3 operations, so typically ends with COMPLETE.
|
|
41
|
-
|
|
42
|
-
### Examples
|
|
43
|
-
|
|
44
|
-
**Investigation in progress:**
|
|
45
|
-
```html
|
|
46
|
-
<!-- AGENT_STATUS -->
|
|
47
|
-
PLAN_STATUS: INVESTIGATING
|
|
48
|
-
CURRENT_PHASE: Investigation
|
|
49
|
-
PENDING_STEPS: ["Check live state", "Compare with IaC", "Present diagnosis"]
|
|
50
|
-
NEXT_ACTION: Comparing EKS cluster config with Terraform state
|
|
51
|
-
AGENT_ID: a11111
|
|
52
|
-
<!-- /AGENT_STATUS -->
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Diagnosis complete:**
|
|
56
|
-
```html
|
|
57
|
-
<!-- AGENT_STATUS -->
|
|
58
|
-
PLAN_STATUS: COMPLETE
|
|
59
|
-
CURRENT_PHASE: Investigation
|
|
60
|
-
PENDING_STEPS: []
|
|
61
|
-
NEXT_ACTION: Task complete - root cause identified, remediation steps provided
|
|
62
|
-
AGENT_ID: a11111
|
|
63
|
-
<!-- /AGENT_STATUS -->
|
|
64
|
-
```
|
|
21
|
+
For T3 approval/execution workflows, read `.claude/skills/approval/SKILL.md` and `.claude/skills/execution/SKILL.md`.
|
|
65
22
|
|
|
66
23
|
---
|
|
67
24
|
|
|
@@ -3,6 +3,12 @@ name: devops-developer
|
|
|
3
3
|
description: Full-stack DevOps specialist unifying application code, infrastructure, and developer tooling across Node.js/TypeScript and Python ecosystems.
|
|
4
4
|
tools: Read, Edit, Glob, Grep, Bash, Task, node, npm, pip, pytest, jest, eslint, prettier
|
|
5
5
|
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- security-tiers
|
|
8
|
+
- output-format
|
|
9
|
+
- agent-protocol
|
|
10
|
+
- context-updater
|
|
11
|
+
- command-execution
|
|
6
12
|
---
|
|
7
13
|
|
|
8
14
|
## TL;DR
|
|
@@ -12,57 +18,7 @@ model: inherit
|
|
|
12
18
|
**Output:** Code changes, test results, build artifacts
|
|
13
19
|
**Tier:** T0-T2 (no infrastructure deployments)
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Response Format (MANDATORY)
|
|
18
|
-
|
|
19
|
-
**END EVERY RESPONSE** with this status block:
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<!-- AGENT_STATUS -->
|
|
23
|
-
PLAN_STATUS: [status]
|
|
24
|
-
CURRENT_PHASE: [phase]
|
|
25
|
-
PENDING_STEPS: [list]
|
|
26
|
-
NEXT_ACTION: [description]
|
|
27
|
-
AGENT_ID: [your agentId]
|
|
28
|
-
<!-- /AGENT_STATUS -->
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Status by Workflow Phase
|
|
32
|
-
|
|
33
|
-
| Phase | Typical Status | When to Use |
|
|
34
|
-
|-------|---------------|-------------|
|
|
35
|
-
| **Investigation** | INVESTIGATING | Reading code, running tests, analyzing |
|
|
36
|
-
| **Present** | PENDING_APPROVAL | Proposing code changes (T3) |
|
|
37
|
-
| **Present** | COMPLETE | Analysis done, no code changes needed |
|
|
38
|
-
| **Confirm** | APPROVED_EXECUTING | User approved, committing code changes |
|
|
39
|
-
| **Execute** | COMPLETE | Code committed, tests passed |
|
|
40
|
-
| **Any** | BLOCKED | Build/test failures, dependencies missing |
|
|
41
|
-
| **Any** | NEEDS_INPUT | Need clarification about implementation |
|
|
42
|
-
|
|
43
|
-
### Examples
|
|
44
|
-
|
|
45
|
-
**Investigation in progress:**
|
|
46
|
-
```html
|
|
47
|
-
<!-- AGENT_STATUS -->
|
|
48
|
-
PLAN_STATUS: INVESTIGATING
|
|
49
|
-
CURRENT_PHASE: Investigation
|
|
50
|
-
PENDING_STEPS: ["Run tests", "Analyze results", "Present findings"]
|
|
51
|
-
NEXT_ACTION: Running npm test to check current state
|
|
52
|
-
AGENT_ID: a22222
|
|
53
|
-
<!-- /AGENT_STATUS -->
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Proposing code changes (T3):**
|
|
57
|
-
```html
|
|
58
|
-
<!-- AGENT_STATUS -->
|
|
59
|
-
PLAN_STATUS: PENDING_APPROVAL
|
|
60
|
-
CURRENT_PHASE: Present
|
|
61
|
-
PENDING_STEPS: ["Get approval", "Commit changes", "Push to remote"]
|
|
62
|
-
NEXT_ACTION: Wait for user approval to commit code changes
|
|
63
|
-
AGENT_ID: a22222
|
|
64
|
-
<!-- /AGENT_STATUS -->
|
|
65
|
-
```
|
|
21
|
+
For T3 approval/execution workflows, read `.claude/skills/approval/SKILL.md` and `.claude/skills/execution/SKILL.md`.
|
|
66
22
|
|
|
67
23
|
---
|
|
68
24
|
|
package/agents/gaia.md
CHANGED
|
@@ -3,6 +3,11 @@ name: gaia
|
|
|
3
3
|
description: Meta-agent specialized in the gaia-ops orchestration system. Analyzes architecture, writes agent definitions, designs workflows, and maintains system documentation.
|
|
4
4
|
tools: Read, Glob, Grep, Bash, Task, WebSearch, Write, Edit
|
|
5
5
|
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- security-tiers
|
|
8
|
+
- output-format
|
|
9
|
+
- agent-protocol
|
|
10
|
+
- git-conventions
|
|
6
11
|
---
|
|
7
12
|
|
|
8
13
|
## TL;DR
|
|
@@ -10,42 +15,8 @@ model: inherit
|
|
|
10
15
|
**Purpose:** Maintain and improve the gaia-ops system itself
|
|
11
16
|
**Scope:** ONLY gaia-ops internals (agents, hooks, orchestrator, workflows, tools)
|
|
12
17
|
**Invoke When:** Questions ABOUT gaia-ops OR creating/modifying gaia-ops components
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Response Format (MANDATORY)
|
|
16
|
-
|
|
17
|
-
**END EVERY RESPONSE** with this status block:
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
<!-- AGENT_STATUS -->
|
|
21
|
-
PLAN_STATUS: [status]
|
|
22
|
-
CURRENT_PHASE: [phase]
|
|
23
|
-
PENDING_STEPS: [list]
|
|
24
|
-
NEXT_ACTION: [description]
|
|
25
|
-
AGENT_ID: [your agentId]
|
|
26
|
-
<!-- /AGENT_STATUS -->
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Status Types
|
|
30
|
-
|
|
31
|
-
| Status | When to Use |
|
|
32
|
-
|--------|-------------|
|
|
33
|
-
| **INVESTIGATING** | Reading system files, analyzing architecture, researching patterns |
|
|
34
|
-
| **COMPLETE** | Delivered analysis, recommendations, or completed implementation |
|
|
35
|
-
| **BLOCKED** | Missing context, need external input, dependency issue |
|
|
36
|
-
| **NEEDS_INPUT** | Ambiguous request, need user clarification |
|
|
37
|
-
|
|
38
|
-
### Example
|
|
39
|
-
|
|
40
|
-
```html
|
|
41
|
-
<!-- AGENT_STATUS -->
|
|
42
|
-
PLAN_STATUS: COMPLETE
|
|
43
|
-
CURRENT_PHASE: Analysis Complete
|
|
44
|
-
PENDING_STEPS: []
|
|
45
|
-
NEXT_ACTION: Architecture analysis delivered with recommendations
|
|
46
|
-
AGENT_ID: a12345
|
|
47
|
-
<!-- /AGENT_STATUS -->
|
|
48
|
-
```
|
|
19
|
+
For T3 approval/execution workflows, read `.claude/skills/approval/SKILL.md` and `.claude/skills/execution/SKILL.md`.
|
|
49
20
|
|
|
50
21
|
---
|
|
51
22
|
|
|
@@ -3,6 +3,13 @@ name: gitops-operator
|
|
|
3
3
|
description: A specialized agent that manages the Kubernetes application lifecycle via GitOps. It analyzes, proposes, and realizes changes to declarative configurations in the Git repository.
|
|
4
4
|
tools: Read, Edit, Glob, Grep, Bash, Task, kubectl, helm, flux, kustomize
|
|
5
5
|
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- security-tiers
|
|
8
|
+
- output-format
|
|
9
|
+
- agent-protocol
|
|
10
|
+
- context-updater
|
|
11
|
+
- gitops-patterns
|
|
12
|
+
- command-execution
|
|
6
13
|
---
|
|
7
14
|
|
|
8
15
|
## TL;DR
|
|
@@ -12,57 +19,7 @@ model: inherit
|
|
|
12
19
|
**Output:** K8s manifests + flux reconciliation
|
|
13
20
|
**Tier:** T0-T3 (T3 requires approval for `git push` + `flux reconcile`)
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Response Format (MANDATORY)
|
|
18
|
-
|
|
19
|
-
**END EVERY RESPONSE** with this status block:
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<!-- AGENT_STATUS -->
|
|
23
|
-
PLAN_STATUS: [status]
|
|
24
|
-
CURRENT_PHASE: [phase]
|
|
25
|
-
PENDING_STEPS: [list]
|
|
26
|
-
NEXT_ACTION: [description]
|
|
27
|
-
AGENT_ID: [your agentId]
|
|
28
|
-
<!-- /AGENT_STATUS -->
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Status by Workflow Phase
|
|
32
|
-
|
|
33
|
-
| Phase | Typical Status | When to Use |
|
|
34
|
-
|-------|---------------|-------------|
|
|
35
|
-
| **Investigation** | INVESTIGATING | Checking cluster, reading GitOps repo, analyzing patterns |
|
|
36
|
-
| **Present** | PENDING_APPROVAL | Proposing manifest changes (T3) |
|
|
37
|
-
| **Present** | COMPLETE | Investigation done, no changes needed |
|
|
38
|
-
| **Confirm** | APPROVED_EXECUTING | User approved, applying manifest changes |
|
|
39
|
-
| **Execute** | COMPLETE | Changes applied, flux reconciled |
|
|
40
|
-
| **Any** | BLOCKED | Cannot proceed (kubeconfig missing, cluster unreachable) |
|
|
41
|
-
| **Any** | NEEDS_INPUT | Need clarification (which namespace? which cluster?) |
|
|
42
|
-
|
|
43
|
-
### Examples
|
|
44
|
-
|
|
45
|
-
**Investigation in progress:**
|
|
46
|
-
```html
|
|
47
|
-
<!-- AGENT_STATUS -->
|
|
48
|
-
PLAN_STATUS: INVESTIGATING
|
|
49
|
-
CURRENT_PHASE: Investigation
|
|
50
|
-
PENDING_STEPS: ["Check cluster state", "Compare with GitOps repo", "Present findings"]
|
|
51
|
-
NEXT_ACTION: Analyzing HelmRelease configurations
|
|
52
|
-
AGENT_ID: a67890
|
|
53
|
-
<!-- /AGENT_STATUS -->
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Proposing deployment (T3):**
|
|
57
|
-
```html
|
|
58
|
-
<!-- AGENT_STATUS -->
|
|
59
|
-
PLAN_STATUS: PENDING_APPROVAL
|
|
60
|
-
CURRENT_PHASE: Present
|
|
61
|
-
PENDING_STEPS: ["Get approval", "Commit manifest", "Flux reconcile", "Verify"]
|
|
62
|
-
NEXT_ACTION: Wait for user approval to commit GitOps changes
|
|
63
|
-
AGENT_ID: a67890
|
|
64
|
-
<!-- /AGENT_STATUS -->
|
|
65
|
-
```
|
|
22
|
+
For T3 approval/execution workflows, read `.claude/skills/approval/SKILL.md` and `.claude/skills/execution/SKILL.md`.
|
|
66
23
|
|
|
67
24
|
---
|
|
68
25
|
|
|
@@ -3,6 +3,8 @@ name: speckit-planner
|
|
|
3
3
|
description: Specialized agent for feature specification, planning, and task generation using the Spec-Kit framework. Internalizes all Spec-Kit knowledge for consistent, precise workflow execution.
|
|
4
4
|
tools: Read, Edit, Glob, Grep, Bash, Task, AskUserQuestion
|
|
5
5
|
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- output-format
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
You are a feature planning specialist who guides users through the complete Spec-Kit workflow. You have internalized all Spec-Kit knowledge and execute workflows consistently every time.
|
|
@@ -3,6 +3,13 @@ name: terraform-architect
|
|
|
3
3
|
description: A specialized agent that manages the cloud infrastructure lifecycle via IaC. It analyzes, proposes, and realizes changes to declarative configurations using Terraform and Terragrunt.
|
|
4
4
|
tools: Read, Edit, Glob, Grep, Bash, Task, terraform, terragrunt, tflint
|
|
5
5
|
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- security-tiers
|
|
8
|
+
- output-format
|
|
9
|
+
- agent-protocol
|
|
10
|
+
- context-updater
|
|
11
|
+
- terraform-patterns
|
|
12
|
+
- command-execution
|
|
6
13
|
---
|
|
7
14
|
|
|
8
15
|
## TL;DR
|
|
@@ -12,68 +19,7 @@ model: inherit
|
|
|
12
19
|
**Output:** HCL code + plan + pattern explanation
|
|
13
20
|
**Tier:** T0-T3 (T3 requires approval for `apply`)
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Response Format (MANDATORY)
|
|
18
|
-
|
|
19
|
-
**END EVERY RESPONSE** with this status block:
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<!-- AGENT_STATUS -->
|
|
23
|
-
PLAN_STATUS: [status]
|
|
24
|
-
CURRENT_PHASE: [phase]
|
|
25
|
-
PENDING_STEPS: [list]
|
|
26
|
-
NEXT_ACTION: [description]
|
|
27
|
-
AGENT_ID: [your agentId]
|
|
28
|
-
<!-- /AGENT_STATUS -->
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Status by Workflow Phase
|
|
32
|
-
|
|
33
|
-
| Phase | Typical Status | When to Use |
|
|
34
|
-
|-------|---------------|-------------|
|
|
35
|
-
| **Investigation** | INVESTIGATING | Analyzing code, reading patterns, validating |
|
|
36
|
-
| **Present** | PENDING_APPROVAL | Found issues, proposing terraform changes (T3) |
|
|
37
|
-
| **Present** | COMPLETE | Found issues, no T3 changes needed (read-only) |
|
|
38
|
-
| **Confirm** | APPROVED_EXECUTING | User approved, running terraform apply |
|
|
39
|
-
| **Execute** | COMPLETE | Applied successfully |
|
|
40
|
-
| **Any** | BLOCKED | Cannot proceed (missing files, validation errors) |
|
|
41
|
-
| **Any** | NEEDS_INPUT | Need clarification from user |
|
|
42
|
-
|
|
43
|
-
### Examples
|
|
44
|
-
|
|
45
|
-
**Investigation in progress:**
|
|
46
|
-
```html
|
|
47
|
-
<!-- AGENT_STATUS -->
|
|
48
|
-
PLAN_STATUS: INVESTIGATING
|
|
49
|
-
CURRENT_PHASE: Investigation
|
|
50
|
-
PENDING_STEPS: ["Validate code", "Run terraform plan", "Present findings"]
|
|
51
|
-
NEXT_ACTION: Analyzing existing Terragrunt configurations
|
|
52
|
-
AGENT_ID: a12345
|
|
53
|
-
<!-- /AGENT_STATUS -->
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Proposing terraform apply (T3):**
|
|
57
|
-
```html
|
|
58
|
-
<!-- AGENT_STATUS -->
|
|
59
|
-
PLAN_STATUS: PENDING_APPROVAL
|
|
60
|
-
CURRENT_PHASE: Present
|
|
61
|
-
PENDING_STEPS: ["Get approval", "Execute terraform apply", "Verify"]
|
|
62
|
-
NEXT_ACTION: Wait for user approval to apply terraform changes
|
|
63
|
-
AGENT_ID: a12345
|
|
64
|
-
<!-- /AGENT_STATUS -->
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Read-only task complete:**
|
|
68
|
-
```html
|
|
69
|
-
<!-- AGENT_STATUS -->
|
|
70
|
-
PLAN_STATUS: COMPLETE
|
|
71
|
-
CURRENT_PHASE: Investigation
|
|
72
|
-
PENDING_STEPS: []
|
|
73
|
-
NEXT_ACTION: Task complete - reported findings
|
|
74
|
-
AGENT_ID: a12345
|
|
75
|
-
<!-- /AGENT_STATUS -->
|
|
76
|
-
```
|
|
22
|
+
For T3 approval/execution workflows, read `.claude/skills/approval/SKILL.md` and `.claude/skills/execution/SKILL.md`.
|
|
77
23
|
|
|
78
24
|
---
|
|
79
25
|
|
package/hooks/pre_tool_use.py
CHANGED
|
@@ -26,18 +26,8 @@ from datetime import datetime
|
|
|
26
26
|
|
|
27
27
|
# Add modules to path
|
|
28
28
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
29
|
-
sys.path.insert(0, str(Path(__file__).parent / "modules" / "skills"))
|
|
30
|
-
|
|
31
29
|
from modules.core.paths import get_logs_dir
|
|
32
30
|
|
|
33
|
-
# Import skill loader
|
|
34
|
-
try:
|
|
35
|
-
from skill_loader import load_skills_for_task
|
|
36
|
-
except ImportError:
|
|
37
|
-
# Fallback if skill_loader not available
|
|
38
|
-
def load_skills_for_task(prompt: str, subagent_type: str) -> str:
|
|
39
|
-
return ""
|
|
40
|
-
|
|
41
31
|
# Import context exhaustion detector
|
|
42
32
|
try:
|
|
43
33
|
from modules.context.exhaustion_detector import check_context_health
|
|
@@ -76,23 +66,6 @@ PROJECT_AGENTS = [
|
|
|
76
66
|
]
|
|
77
67
|
|
|
78
68
|
|
|
79
|
-
def _load_skills_for_task(prompt: str, subagent_type: str) -> str:
|
|
80
|
-
"""
|
|
81
|
-
Load skills on-demand for task
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
prompt: Task prompt
|
|
85
|
-
subagent_type: Agent type
|
|
86
|
-
|
|
87
|
-
Returns:
|
|
88
|
-
Formatted skills content (empty string if loader unavailable)
|
|
89
|
-
"""
|
|
90
|
-
try:
|
|
91
|
-
return load_skills_for_task(prompt, subagent_type)
|
|
92
|
-
except Exception as e:
|
|
93
|
-
logger.warning(f"Failed to load skills: {e}")
|
|
94
|
-
return ""
|
|
95
|
-
|
|
96
69
|
|
|
97
70
|
|
|
98
71
|
def _should_inject_on_resume(parameters: dict) -> bool:
|
|
@@ -273,18 +246,15 @@ def _inject_project_context(parameters: dict) -> dict:
|
|
|
273
246
|
logger.error(f"Failed to parse context JSON: {e}")
|
|
274
247
|
return parameters
|
|
275
248
|
|
|
276
|
-
# Load skills on-demand based on prompt
|
|
277
|
-
skills_content = _load_skills_for_task(prompt, subagent_type)
|
|
278
|
-
|
|
279
249
|
# Check pending update count (non-blocking, fast path)
|
|
280
250
|
pending_warning = _check_pending_updates_threshold()
|
|
281
251
|
|
|
282
|
-
# Inject context
|
|
252
|
+
# Inject context into prompt (skills now loaded natively via agent frontmatter)
|
|
283
253
|
enriched_prompt = f"""# Project Context (Auto-Injected)
|
|
284
254
|
|
|
285
255
|
{json.dumps(context_payload, indent=2)}
|
|
286
256
|
|
|
287
|
-
{
|
|
257
|
+
{pending_warning}---
|
|
288
258
|
|
|
289
259
|
# User Task
|
|
290
260
|
|
|
@@ -657,12 +627,12 @@ def _handle_task(tool_name: str, parameters: dict) -> str | dict | None:
|
|
|
657
627
|
# Return updatedInput if prompt was modified by context/skills injection
|
|
658
628
|
if parameters.get("prompt", "") != original_prompt:
|
|
659
629
|
updated_input = {k: v for k, v in parameters.items() if not k.startswith("_")}
|
|
660
|
-
logger.info(f"Returning updatedInput for {result.agent_name} (
|
|
630
|
+
logger.info(f"Returning updatedInput for {result.agent_name} (context injected)")
|
|
661
631
|
return {
|
|
662
632
|
"hookSpecificOutput": {
|
|
663
633
|
"hookEventName": "PreToolUse",
|
|
664
634
|
"permissionDecision": "allow",
|
|
665
|
-
"permissionDecisionReason": f"Context
|
|
635
|
+
"permissionDecisionReason": f"Context injected for {result.agent_name}",
|
|
666
636
|
"updatedInput": updated_input
|
|
667
637
|
}
|
|
668
638
|
}
|
package/package.json
CHANGED
package/skills/README.md
CHANGED
|
@@ -1,154 +1,81 @@
|
|
|
1
1
|
# Skills System
|
|
2
2
|
|
|
3
|
-
Skills are
|
|
3
|
+
Skills are knowledge modules that extend agent capabilities. They use Claude Code's native skill system for automatic discovery and injection.
|
|
4
4
|
|
|
5
5
|
## Architecture
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
.claude/skills/
|
|
9
|
-
├──
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
├── agent-protocol/ # AGENT_STATUS, local-first, error handling
|
|
10
|
+
├── security-tiers/ # T0-T3 classification
|
|
11
|
+
├── output-format/ # Report structure and icons
|
|
12
|
+
├── context-updater/ # CONTEXT_UPDATE format
|
|
13
|
+
├── git-conventions/ # Conventional commits
|
|
14
|
+
├── fast-queries/ # Quick diagnostic scripts
|
|
15
|
+
├── terraform-patterns/ # Terraform/Terragrunt patterns
|
|
16
|
+
├── gitops-patterns/ # GitOps/Flux patterns
|
|
17
|
+
├── command-execution/ # Shell security rules
|
|
18
|
+
├── anti-patterns/ # Common mistakes by tool
|
|
19
|
+
├── investigation/ # Local-first analysis methodology
|
|
20
|
+
├── approval/ # T3 plan presentation workflow
|
|
21
|
+
└── execution/ # Post-approval execution workflow
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
##
|
|
24
|
+
## How Skills Work
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|----------|---------|-------------|---------|
|
|
23
|
-
| **Workflow** | Process/methodology | By workflow phase | investigation-skill: how to investigate before acting |
|
|
24
|
-
| **Domain** | Technical patterns | By keywords in task | terraform-patterns: HCL patterns for this project |
|
|
26
|
+
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.
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
```yaml
|
|
29
|
+
# Example: agents/cloud-troubleshooter.md
|
|
30
|
+
---
|
|
31
|
+
name: cloud-troubleshooter
|
|
32
|
+
skills:
|
|
33
|
+
- security-tiers
|
|
34
|
+
- output-format
|
|
35
|
+
- agent-protocol
|
|
36
|
+
- context-updater
|
|
37
|
+
- fast-queries
|
|
38
|
+
---
|
|
39
|
+
```
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
1. **Workflow phase changes** (automatic) - investigation → approval → execution
|
|
30
|
-
2. **Task contains trigger keywords** (see `skill-triggers.json`)
|
|
41
|
+
## Skill Assignment Matrix
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
| Agent | Core Skills | Domain Skills |
|
|
44
|
+
|-------|-------------|---------------|
|
|
45
|
+
| cloud-troubleshooter | security-tiers, output-format, agent-protocol, context-updater | fast-queries |
|
|
46
|
+
| terraform-architect | security-tiers, output-format, agent-protocol, context-updater | terraform-patterns, command-execution |
|
|
47
|
+
| gitops-operator | security-tiers, output-format, agent-protocol, context-updater | gitops-patterns, command-execution |
|
|
48
|
+
| devops-developer | security-tiers, output-format, agent-protocol, context-updater | command-execution |
|
|
49
|
+
| gaia | security-tiers, output-format, agent-protocol | git-conventions |
|
|
50
|
+
| speckit-planner | output-format | |
|
|
33
51
|
|
|
34
|
-
|
|
52
|
+
## Skill Types
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
| Type | Injection | Examples |
|
|
55
|
+
|------|-----------|----------|
|
|
56
|
+
| **Core** | Always via `skills:` | agent-protocol, security-tiers, output-format |
|
|
57
|
+
| **Domain** | Per-agent via `skills:` | terraform-patterns, gitops-patterns |
|
|
58
|
+
| **Workflow** | On-demand (agent reads file) | investigation, approval, execution |
|
|
40
59
|
|
|
41
|
-
|
|
60
|
+
Workflow skills are large (200-500 lines) and loaded on-demand. Agents read them from disk when needed rather than receiving them at startup.
|
|
42
61
|
|
|
43
|
-
|
|
62
|
+
## SKILL.md Format
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
44
65
|
---
|
|
45
66
|
name: skill-name
|
|
46
|
-
description:
|
|
47
|
-
|
|
48
|
-
phase: start|investigation|approval|execution # For workflow skills
|
|
67
|
+
description: When Claude should use this skill
|
|
68
|
+
user-invocable: false # Background knowledge, not a slash command
|
|
49
69
|
---
|
|
50
70
|
|
|
51
|
-
# Skill
|
|
52
|
-
|
|
53
|
-
[Content that agents will read when skill is loaded]
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## How Skills Work
|
|
71
|
+
# Skill Content
|
|
57
72
|
|
|
58
|
-
|
|
59
|
-
```python
|
|
60
|
-
# pre_tool_use.py
|
|
61
|
-
if is_project_agent:
|
|
62
|
-
skills = skill_loader.load_skills(task_prompt, workflow_phase)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
2. **skill_loader.py determines which skills to load**
|
|
66
|
-
```python
|
|
67
|
-
# Load workflow skill based on phase
|
|
68
|
-
if phase == "start":
|
|
69
|
-
load("workflow/investigation")
|
|
70
|
-
|
|
71
|
-
# Load domain skills based on keywords
|
|
72
|
-
if "terraform" in prompt:
|
|
73
|
-
load("domain/terraform-patterns")
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
3. **Skills are injected into prompt**
|
|
77
|
-
```
|
|
78
|
-
# Project Context (Auto-Injected)
|
|
79
|
-
{...context...}
|
|
80
|
-
|
|
81
|
-
# Active Skills
|
|
82
|
-
## investigation-skill
|
|
83
|
-
[content of investigation SKILL.md]
|
|
84
|
-
|
|
85
|
-
## terraform-patterns
|
|
86
|
-
[content of terraform-patterns SKILL.md]
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
# User Task
|
|
90
|
-
{original prompt}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Benefits
|
|
94
|
-
|
|
95
|
-
| Metric | Before Skills | After Skills |
|
|
96
|
-
|--------|---------------|--------------|
|
|
97
|
-
| Token duplication | ~6000 tokens repeated in 4 agents | ~1500 tokens in skills, loaded once |
|
|
98
|
-
| Agent size | ~280 lines each | ~180 lines each |
|
|
99
|
-
| Maintenance | Update 4 files | Update 1 skill |
|
|
100
|
-
| Consistency | Can drift | Guaranteed consistent |
|
|
101
|
-
|
|
102
|
-
## Usage Example
|
|
103
|
-
|
|
104
|
-
**User request:** "Create a new VPC in terraform"
|
|
105
|
-
|
|
106
|
-
**Skills loaded:**
|
|
107
|
-
1. `workflow/investigation` (phase: start)
|
|
108
|
-
2. `domain/terraform-patterns` (trigger: "terraform")
|
|
109
|
-
3. `domain/universal-protocol` (auto_load for project agents)
|
|
110
|
-
|
|
111
|
-
**Agent receives:**
|
|
112
|
-
- Full project context (~3000 tokens)
|
|
113
|
-
- Investigation skill (~500 tokens) - how to discover patterns first
|
|
114
|
-
- Terraform patterns skill (~600 tokens) - HCL patterns for this project
|
|
115
|
-
- Universal protocol skill (~400 tokens) - AGENT_STATUS format, Security Tiers
|
|
116
|
-
|
|
117
|
-
**Total:** ~4500 tokens vs ~6000 without skills
|
|
118
|
-
|
|
119
|
-
## Skill Development Guidelines
|
|
120
|
-
|
|
121
|
-
### Do's
|
|
122
|
-
- ✅ Keep skills focused and specific
|
|
123
|
-
- ✅ Use concrete examples
|
|
124
|
-
- ✅ Include decision trees when applicable
|
|
125
|
-
- ✅ Update skills when patterns change
|
|
126
|
-
|
|
127
|
-
### Don'ts
|
|
128
|
-
- ❌ Duplicate information across skills
|
|
129
|
-
- ❌ Make skills too generic (defeats the purpose)
|
|
130
|
-
- ❌ Include project-specific credentials/secrets
|
|
131
|
-
- ❌ Create skills for one-time operations
|
|
132
|
-
|
|
133
|
-
## Testing Skills
|
|
134
|
-
|
|
135
|
-
Test that skills load correctly:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Test skill loader with agent and prompt
|
|
139
|
-
python3 .claude/hooks/modules/skills/skill_loader.py \
|
|
140
|
-
--test \
|
|
141
|
-
--prompt "terraform apply vpc" \
|
|
142
|
-
--agent "terraform-architect"
|
|
143
|
-
|
|
144
|
-
# Expected output:
|
|
145
|
-
# Loaded skills:
|
|
146
|
-
# - workflow/investigation (phase: start)
|
|
147
|
-
# - domain/terraform-patterns (trigger: terraform)
|
|
148
|
-
# - domain/universal-protocol (auto_load)
|
|
73
|
+
Instructions and patterns the agent follows.
|
|
149
74
|
```
|
|
150
75
|
|
|
151
|
-
##
|
|
76
|
+
## Development Guidelines
|
|
152
77
|
|
|
153
|
-
-
|
|
154
|
-
-
|
|
78
|
+
- Keep skills focused and specific
|
|
79
|
+
- Use `user-invocable: false` for background knowledge
|
|
80
|
+
- Keep injected skills under 100 lines (move details to supporting files)
|
|
81
|
+
- Reference workflow skills as readable files, not injected content
|