@arthai/agents 1.0.4 → 1.0.6
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/README.md +55 -3
- package/VERSION +1 -1
- package/agents/troubleshooter.md +132 -0
- package/bin/cli.js +366 -0
- package/bundles/canvas.json +1 -1
- package/bundles/compass.json +1 -1
- package/bundles/counsel.json +1 -0
- package/bundles/cruise.json +1 -1
- package/bundles/forge.json +12 -1
- package/bundles/prism.json +1 -0
- package/bundles/scalpel.json +5 -2
- package/bundles/sentinel.json +8 -2
- package/bundles/shield.json +1 -0
- package/bundles/spark.json +1 -0
- package/compiler.sh +14 -0
- package/dist/plugins/canvas/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/canvas/VERSION +1 -0
- package/dist/plugins/canvas/commands/planning.md +100 -11
- package/dist/plugins/canvas/hooks/hooks.json +16 -0
- package/dist/plugins/canvas/hooks/project-setup.sh +109 -0
- package/dist/plugins/canvas/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/canvas/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/compass/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/compass/VERSION +1 -0
- package/dist/plugins/compass/commands/planning.md +100 -11
- package/dist/plugins/compass/hooks/hooks.json +16 -0
- package/dist/plugins/compass/hooks/project-setup.sh +109 -0
- package/dist/plugins/compass/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/compass/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/counsel/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/counsel/VERSION +1 -0
- package/dist/plugins/counsel/hooks/hooks.json +10 -0
- package/dist/plugins/counsel/hooks/project-setup.sh +109 -0
- package/dist/plugins/counsel/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/counsel/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/cruise/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/cruise/VERSION +1 -0
- package/dist/plugins/cruise/hooks/hooks.json +16 -0
- package/dist/plugins/cruise/hooks/project-setup.sh +109 -0
- package/dist/plugins/cruise/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/cruise/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/forge/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/forge/VERSION +1 -0
- package/dist/plugins/forge/agents/troubleshooter.md +132 -0
- package/dist/plugins/forge/commands/implement.md +99 -1
- package/dist/plugins/forge/commands/planning.md +100 -11
- package/dist/plugins/forge/hooks/escalation-guard.sh +177 -0
- package/dist/plugins/forge/hooks/hooks.json +22 -0
- package/dist/plugins/forge/hooks/project-setup.sh +109 -0
- package/dist/plugins/forge/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/forge/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/prime/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/prime/VERSION +1 -0
- package/dist/plugins/prime/agents/troubleshooter.md +132 -0
- package/dist/plugins/prime/commands/calibrate.md +20 -0
- package/dist/plugins/prime/commands/ci-fix.md +36 -0
- package/dist/plugins/prime/commands/fix.md +23 -0
- package/dist/plugins/prime/commands/implement.md +99 -1
- package/dist/plugins/prime/commands/planning.md +100 -11
- package/dist/plugins/prime/commands/qa-incident.md +54 -0
- package/dist/plugins/prime/commands/restart.md +186 -30
- package/dist/plugins/prime/hooks/escalation-guard.sh +177 -0
- package/dist/plugins/prime/hooks/hooks.json +60 -0
- package/dist/plugins/prime/hooks/post-config-change-restart-reminder.sh +86 -0
- package/dist/plugins/prime/hooks/post-server-crash-watch.sh +120 -0
- package/dist/plugins/prime/hooks/pre-server-port-guard.sh +110 -0
- package/dist/plugins/prime/hooks/project-setup.sh +109 -0
- package/dist/plugins/prime/hooks/sync-agents.sh +99 -12
- package/dist/plugins/prime/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/prime/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/prism/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/prism/VERSION +1 -0
- package/dist/plugins/prism/commands/qa-incident.md +54 -0
- package/dist/plugins/prism/hooks/hooks.json +12 -0
- package/dist/plugins/prism/hooks/project-setup.sh +109 -0
- package/dist/plugins/prism/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/prism/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/scalpel/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/scalpel/VERSION +1 -0
- package/dist/plugins/scalpel/agents/troubleshooter.md +132 -0
- package/dist/plugins/scalpel/commands/ci-fix.md +36 -0
- package/dist/plugins/scalpel/commands/fix.md +23 -0
- package/dist/plugins/scalpel/hooks/escalation-guard.sh +177 -0
- package/dist/plugins/scalpel/hooks/hooks.json +24 -0
- package/dist/plugins/scalpel/hooks/project-setup.sh +109 -0
- package/dist/plugins/scalpel/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/scalpel/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/sentinel/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/sentinel/VERSION +1 -0
- package/dist/plugins/sentinel/agents/troubleshooter.md +132 -0
- package/dist/plugins/sentinel/commands/restart.md +186 -30
- package/dist/plugins/sentinel/hooks/escalation-guard.sh +177 -0
- package/dist/plugins/sentinel/hooks/hooks.json +64 -0
- package/dist/plugins/sentinel/hooks/post-config-change-restart-reminder.sh +86 -0
- package/dist/plugins/sentinel/hooks/post-server-crash-watch.sh +120 -0
- package/dist/plugins/sentinel/hooks/pre-server-port-guard.sh +110 -0
- package/dist/plugins/sentinel/hooks/project-setup.sh +109 -0
- package/dist/plugins/sentinel/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/sentinel/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/shield/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/shield/VERSION +1 -0
- package/dist/plugins/shield/hooks/hooks.json +22 -12
- package/dist/plugins/shield/hooks/project-setup.sh +109 -0
- package/dist/plugins/shield/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/shield/templates/CLAUDE.md.template +111 -0
- package/dist/plugins/spark/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/spark/VERSION +1 -0
- package/dist/plugins/spark/commands/calibrate.md +20 -0
- package/dist/plugins/spark/hooks/hooks.json +10 -0
- package/dist/plugins/spark/hooks/project-setup.sh +109 -0
- package/dist/plugins/spark/templates/CLAUDE.md.managed-block +123 -0
- package/dist/plugins/spark/templates/CLAUDE.md.template +111 -0
- package/hook-defs.json +31 -0
- package/hooks/escalation-guard.sh +177 -0
- package/hooks/post-config-change-restart-reminder.sh +86 -0
- package/hooks/post-server-crash-watch.sh +120 -0
- package/hooks/pre-server-port-guard.sh +110 -0
- package/hooks/project-setup.sh +109 -0
- package/hooks/sync-agents.sh +99 -12
- package/install.sh +2 -2
- package/package.json +1 -1
- package/portable.manifest +7 -1
- package/skills/calibrate/SKILL.md +20 -0
- package/skills/ci-fix/SKILL.md +36 -0
- package/skills/fix/SKILL.md +23 -0
- package/skills/implement/SKILL.md +99 -1
- package/skills/license/SKILL.md +159 -0
- package/skills/planning/SKILL.md +100 -11
- package/skills/publish/SKILL.md +3 -0
- package/skills/qa-incident/SKILL.md +54 -0
- package/skills/restart/SKILL.md +187 -31
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
## Engineering Principles (MANDATORY — applies to ALL work)
|
|
2
|
+
|
|
3
|
+
### Research Before Fixing
|
|
4
|
+
- **Never guess.** Before changing code, read the relevant source files, docs, and configs.
|
|
5
|
+
- Understand WHY something is broken before attempting a fix.
|
|
6
|
+
- If your first fix doesn't work, STOP. Don't try another guess. Re-read the code.
|
|
7
|
+
- Use explore-light (Haiku, 1x cost) to scan the codebase before expensive agents investigate.
|
|
8
|
+
|
|
9
|
+
### No Over-Engineering
|
|
10
|
+
- **Do exactly what's needed.** Don't add abstractions, utilities, or frameworks unless the code already uses them.
|
|
11
|
+
- Match existing patterns — run explore-light to find how similar code is structured before writing new code.
|
|
12
|
+
- A bug fix touches the minimum files possible. A feature matches the existing architecture.
|
|
13
|
+
- If you're creating a new class/helper/utility that nothing else in the codebase uses, you're over-engineering.
|
|
14
|
+
|
|
15
|
+
### Test Before Shipping
|
|
16
|
+
- **Run tests locally before pushing.** Never push untested code.
|
|
17
|
+
- If the project has `/precheck`, run it. If it has `/qa`, run it in commit mode.
|
|
18
|
+
- After fixing a bug, verify the fix AND verify nothing else broke (differential testing).
|
|
19
|
+
- If 3+ consecutive fix attempts fail, STOP. Step back and reassess the root cause from scratch.
|
|
20
|
+
|
|
21
|
+
### Deployment Safety
|
|
22
|
+
- **Never modify production systems without explicit confirmation.**
|
|
23
|
+
- Don't change deploy targets, CI pipeline structure, or infrastructure config silently.
|
|
24
|
+
- Don't overwrite existing files during deployment without asking.
|
|
25
|
+
- If a deployment breaks something, investigate before attempting to fix. Don't cascade.
|
|
26
|
+
|
|
27
|
+
## Toolkit Awareness (MANDATORY — READ THIS FIRST)
|
|
28
|
+
|
|
29
|
+
You have a **claude-agents toolkit** installed in this project. It provides specialized
|
|
30
|
+
agents, skills, and hooks that handle domain-specific work better and cheaper.
|
|
31
|
+
|
|
32
|
+
**You are the ORCHESTRATOR.** The triage router fires on every message with a routing
|
|
33
|
+
table and SPEED score. Use it to decide: toolkit or you?
|
|
34
|
+
|
|
35
|
+
### When to use the toolkit (SPEED score 2+):
|
|
36
|
+
- **Multi-step workflows**: `/pr`, `/deploy`, `/planning`, `/implement`, `/qa`, `/ci-fix`
|
|
37
|
+
encode battle-tested sequences you'd otherwise do manually and forget steps
|
|
38
|
+
- **Domain expertise**: SRE, QA, frontend, backend agents have project context baked in
|
|
39
|
+
- **Cost savings**: Haiku/Sonnet agents handle 80% of tasks at 1/60th the cost of Opus
|
|
40
|
+
- **Parallelism**: Team skills spawn multiple agents working simultaneously
|
|
41
|
+
|
|
42
|
+
### When to use YOU directly (SPEED score 0-1):
|
|
43
|
+
- **Quick lookups**: Read/Grep/Glob for finding a file, checking a value, reading code
|
|
44
|
+
- **Small targeted edits**: 1-2 file changes where you already know what to do
|
|
45
|
+
- **Complex reasoning**: Architecture decisions, debugging novel problems, nuanced tradeoffs
|
|
46
|
+
- **Conversation flow**: Follow-up questions, clarifications, explaining code
|
|
47
|
+
- **Creative problem-solving**: When the task doesn't fit any existing pattern
|
|
48
|
+
- **Judgment calls**: Security reviews, design decisions, "should we even do this?"
|
|
49
|
+
|
|
50
|
+
### The balance:
|
|
51
|
+
The toolkit handles **process** (repeatable workflows, domain-specific checks, multi-step
|
|
52
|
+
sequences). You handle **judgment** (reasoning, creativity, novel problems, architecture).
|
|
53
|
+
|
|
54
|
+
A senior engineer doesn't do everything themselves — they delegate routine work and focus
|
|
55
|
+
their expertise where it matters most. That's you. The toolkit is your team.
|
|
56
|
+
|
|
57
|
+
**Don't over-delegate**: If it's faster to just Read a file and answer, do it.
|
|
58
|
+
**Don't under-delegate**: If it's a 5-step workflow the toolkit has a skill for, use it.
|
|
59
|
+
|
|
60
|
+
### Project Knowledge System
|
|
61
|
+
|
|
62
|
+
If this project has been calibrated (`/calibrate`), deep context is available:
|
|
63
|
+
|
|
64
|
+
- **`.claude/project-profile.md`** — Architecture patterns, coding conventions, domain model,
|
|
65
|
+
testing style. Read this before writing any code to match the project's patterns.
|
|
66
|
+
- **`.claude/knowledge/`** — The toolkit's long-term memory for this project:
|
|
67
|
+
- `shared/conventions.md` — Coding rules learned from corrections. **Read before writing code.**
|
|
68
|
+
- `shared/domain.md` — Business rules beyond what's in the code. **Read before domain decisions.**
|
|
69
|
+
- `shared/vocabulary.md` — What the team calls things. **Use these terms.**
|
|
70
|
+
- `shared/patterns.md` — Architecture patterns. **Follow these when adding new code.**
|
|
71
|
+
- `agents/{your-name}.md` — Your past learning. **Read on session start.**
|
|
72
|
+
- **Write back** when you learn something new — corrections, discoveries, decisions.
|
|
73
|
+
- See `knowledge/README.md` for the full protocol.
|
|
74
|
+
- **`.claude/knowledge/external/sources.md`** — Where team knowledge lives outside code
|
|
75
|
+
(Notion, Linear, Figma, etc.). Check before making decisions that might already be documented.
|
|
76
|
+
|
|
77
|
+
## Session Start Behavior (MANDATORY)
|
|
78
|
+
|
|
79
|
+
On your FIRST response in every new session, ALWAYS start with a brief status line
|
|
80
|
+
using context from the SessionStart hook. Include:
|
|
81
|
+
- Current branch + uncommitted file count
|
|
82
|
+
- Docker/infra status (if problems detected)
|
|
83
|
+
- Open PRs or assigned issues (if any)
|
|
84
|
+
- Any red flags (pending migrations, expired tokens)
|
|
85
|
+
|
|
86
|
+
Format: 1-3 compact lines before addressing the user's request. Example:
|
|
87
|
+
```
|
|
88
|
+
📋 project — main | 5 uncommitted | Docker: postgres ✓ redis ✓ | 2 open PRs
|
|
89
|
+
```
|
|
90
|
+
Then proceed with the user's actual request.
|
|
91
|
+
|
|
92
|
+
**CRITICAL — Greetings and vague first messages**: If the user's first message is a
|
|
93
|
+
greeting ("hey", "hi", "hello", "yo", "sup") or vague ("help", "what's up",
|
|
94
|
+
"what should I work on") or ANY message under 5 words with no specific task —
|
|
95
|
+
**ALWAYS use the `/onboard` skill**. Never respond to greetings yourself. The
|
|
96
|
+
bootstrap hook status line is a quick snapshot — `/onboard` gives the real briefing
|
|
97
|
+
with open PRs, issues, priorities, and actionable next steps.
|
|
98
|
+
|
|
99
|
+
## Routing Trace (MANDATORY)
|
|
100
|
+
|
|
101
|
+
On EVERY response, show a compact routing trace so the user understands the decision
|
|
102
|
+
path. Place it at the end of your response in a dimmed block:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
🔀 Routing: [what triage decided] → [agent/skill/tool used] ([cost tier])
|
|
106
|
+
Why: [1-line reason for this routing choice]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Examples:
|
|
110
|
+
```
|
|
111
|
+
🔀 Routing: backend bug fix → python-backend agent (Sonnet, 10x)
|
|
112
|
+
Why: touches backend/app/services/, needs CLAUDE.md context, SPEED=4
|
|
113
|
+
```
|
|
114
|
+
```
|
|
115
|
+
🔀 Routing: file lookup → Grep (built-in, 0x)
|
|
116
|
+
Why: single-file search, no project context needed, SPEED=0
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Rules:
|
|
120
|
+
- Always show the SPEED score breakdown if score >= 2
|
|
121
|
+
- Show which hook provided the context (triage-router, bootstrap, etc.)
|
|
122
|
+
- If you chose NOT to use the triage router's suggestion, explain why
|
|
123
|
+
- Skip the trace only for simple follow-up messages in an ongoing conversation
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# CLAUDE.md — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
<!-- Generated by claude-agents install.sh --init -->
|
|
4
|
+
<!-- TODO: Replace {{placeholders}} with your project details -->
|
|
5
|
+
|
|
6
|
+
## Project Overview
|
|
7
|
+
|
|
8
|
+
{{PROJECT_NAME}} is a {{DESCRIPTION}}.
|
|
9
|
+
|
|
10
|
+
## Tech Stack
|
|
11
|
+
|
|
12
|
+
- **Frontend**: <!-- TODO: e.g., Next.js 14, React 18, TypeScript, Tailwind -->
|
|
13
|
+
- **Backend**: <!-- TODO: e.g., FastAPI, SQLAlchemy, PostgreSQL -->
|
|
14
|
+
- **Auth**: <!-- TODO: e.g., Stytch, Auth0, Clerk -->
|
|
15
|
+
- **Deploy**: <!-- TODO: e.g., Railway, Vercel, AWS -->
|
|
16
|
+
|
|
17
|
+
## Project Structure
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
{{PROJECT_NAME}}/
|
|
21
|
+
├── frontend/ <!-- TODO: Frontend directory -->
|
|
22
|
+
├── backend/ <!-- TODO: Backend directory -->
|
|
23
|
+
└── ...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Key Architecture
|
|
27
|
+
|
|
28
|
+
<!-- TODO: Describe your auth flow, API patterns, database schema, etc. -->
|
|
29
|
+
|
|
30
|
+
## Local Dev Services
|
|
31
|
+
|
|
32
|
+
<!-- TODO: Auto-populated by /scan or fill manually -->
|
|
33
|
+
|
|
34
|
+
| Service | Port | Directory | Start Command |
|
|
35
|
+
|----------|------|-----------|---------------|
|
|
36
|
+
| Frontend | <!-- TODO --> | frontend/ | <!-- TODO: e.g., npm run dev --> |
|
|
37
|
+
| Backend | <!-- TODO --> | backend/ | <!-- TODO: e.g., uvicorn app.main:app --reload --> |
|
|
38
|
+
|
|
39
|
+
## Test Commands
|
|
40
|
+
|
|
41
|
+
<!-- TODO: Auto-populated by /scan or fill manually -->
|
|
42
|
+
|
|
43
|
+
| What | Command | Directory |
|
|
44
|
+
|------|---------|-----------|
|
|
45
|
+
| Backend tests | <!-- TODO: e.g., pytest --> | backend/ |
|
|
46
|
+
| Backend lint | <!-- TODO: e.g., ruff check . --> | backend/ |
|
|
47
|
+
| Frontend tests | <!-- TODO: e.g., npm test --> | frontend/ |
|
|
48
|
+
| Frontend lint | <!-- TODO: e.g., npm run lint --> | frontend/ |
|
|
49
|
+
| Type check | <!-- TODO: e.g., npx tsc --noEmit --> | frontend/ |
|
|
50
|
+
| E2E tests | <!-- TODO: e.g., npx playwright test --> | frontend/ |
|
|
51
|
+
|
|
52
|
+
## Infrastructure
|
|
53
|
+
|
|
54
|
+
<!-- TODO: Auto-populated by /scan or fill manually -->
|
|
55
|
+
|
|
56
|
+
| Platform | Service | Domain |
|
|
57
|
+
|----------|---------|--------|
|
|
58
|
+
| <!-- TODO: e.g., Railway --> | <!-- TODO --> | <!-- TODO --> |
|
|
59
|
+
|
|
60
|
+
Health endpoints: <!-- TODO: e.g., /health, /api/health -->
|
|
61
|
+
|
|
62
|
+
## Environments
|
|
63
|
+
|
|
64
|
+
<!-- TODO: Auto-populated by /scan environments or /calibrate -->
|
|
65
|
+
|
|
66
|
+
| Name | Type | URL | Health | Deploy | Branch |
|
|
67
|
+
|------|------|-----|--------|--------|--------|
|
|
68
|
+
| local | development | <!-- TODO --> | <!-- TODO: e.g., /health --> | manual | — |
|
|
69
|
+
| <!-- TODO --> | <!-- TODO: staging/production/preview/canary --> | <!-- TODO --> | <!-- TODO --> | <!-- TODO --> | <!-- TODO --> |
|
|
70
|
+
|
|
71
|
+
Access notes: <!-- TODO: e.g., Railway MCP for staging/prod. Env vars: .env.local, .env.staging -->
|
|
72
|
+
|
|
73
|
+
## Domain
|
|
74
|
+
|
|
75
|
+
<!-- TODO: Auto-populated by /scan or fill manually -->
|
|
76
|
+
<!-- Describe what this app does, its core entities, and business rules. -->
|
|
77
|
+
<!-- Used by qa-domain agent for domain-aware testing. -->
|
|
78
|
+
|
|
79
|
+
## Running Locally
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# TODO: Add your local development commands
|
|
83
|
+
# Frontend
|
|
84
|
+
cd frontend && npm run dev
|
|
85
|
+
|
|
86
|
+
# Backend
|
|
87
|
+
cd backend && source .venv/bin/activate && uvicorn app.main:app --reload
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Critical Rules
|
|
91
|
+
|
|
92
|
+
<!-- TODO: Add project-specific rules, e.g.: -->
|
|
93
|
+
- Never push to main directly — always create a PR
|
|
94
|
+
- Secrets in .env.local only — never committed
|
|
95
|
+
|
|
96
|
+
## Agent Customization
|
|
97
|
+
|
|
98
|
+
The following agents/skills are managed by `claude-agents` (symlinked):
|
|
99
|
+
- Run `~/.claude-agents/install.sh --status` to see what's linked
|
|
100
|
+
- To override any portable file, replace the symlink with a regular file
|
|
101
|
+
- Your override won't be touched by future syncs
|
|
102
|
+
|
|
103
|
+
### Project-Specific Agents
|
|
104
|
+
|
|
105
|
+
Add project-specific agents as regular files in `.claude/agents/`:
|
|
106
|
+
- See `~/.claude-agents/examples/agents/` for templates (frontend, backend, ops, sre, qa)
|
|
107
|
+
|
|
108
|
+
### Project-Specific Skills
|
|
109
|
+
|
|
110
|
+
Add project-specific skills as regular directories in `.claude/skills/`:
|
|
111
|
+
- See `~/.claude-agents/examples/skills/` for templates (ci-fix, qa, restart)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.6
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: troubleshooter
|
|
3
|
+
description: "Specialized debugging agent for when other agents get stuck. Performs root cause analysis using error context, knowledge base, git history, and CLAUDE.md. Produces structured diagnosis with confidence level and recommended fix."
|
|
4
|
+
model: sonnet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Troubleshooter Agent
|
|
8
|
+
|
|
9
|
+
You are a specialized debugging agent. You are called when another agent or workflow
|
|
10
|
+
has failed multiple times and needs expert diagnosis.
|
|
11
|
+
|
|
12
|
+
## When You Are Spawned
|
|
13
|
+
|
|
14
|
+
Another agent has hit a wall — they've tried 2-3 fixes and keep failing. Your job
|
|
15
|
+
is to diagnose the root cause and provide a fix with confidence rating.
|
|
16
|
+
|
|
17
|
+
## Your Process (follow in order)
|
|
18
|
+
|
|
19
|
+
### 1. Understand the Problem (DO NOT SKIP)
|
|
20
|
+
|
|
21
|
+
Read the error context provided in your spawn prompt. Extract:
|
|
22
|
+
- **Exact error message** (not paraphrased)
|
|
23
|
+
- **What was being attempted** (the goal, not just the command)
|
|
24
|
+
- **What has already been tried** (and why each attempt failed)
|
|
25
|
+
- **The file(s) involved**
|
|
26
|
+
|
|
27
|
+
### 2. Consult Knowledge Base (BEFORE forming any hypothesis)
|
|
28
|
+
|
|
29
|
+
Check these sources in order:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
.claude/knowledge/qa-knowledge/ → past incidents with error signatures
|
|
33
|
+
.claude/knowledge/shared/conventions.md → project-specific gotchas and rules
|
|
34
|
+
.claude/knowledge/shared/patterns.md → architecture patterns that may explain the error
|
|
35
|
+
.claude/knowledge/agents/ → per-agent learning files
|
|
36
|
+
CLAUDE.md → project configuration, test commands, services
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Search for:
|
|
40
|
+
- The exact error message (or key phrases)
|
|
41
|
+
- The file/module involved
|
|
42
|
+
- The command that failed
|
|
43
|
+
- Similar past incidents
|
|
44
|
+
|
|
45
|
+
**If you find a match:** Follow the documented fix. Do not reinvent.
|
|
46
|
+
**If no match:** Proceed to step 3.
|
|
47
|
+
|
|
48
|
+
### 3. Gather Fresh Evidence
|
|
49
|
+
|
|
50
|
+
Read the actual source code around the error:
|
|
51
|
+
- The file mentioned in the error (read 50+ lines of context, not just the error line)
|
|
52
|
+
- Related files (imports, callers, configuration)
|
|
53
|
+
- Recent changes: `git log --oneline -10 -- <file>` and `git diff HEAD -- <file>`
|
|
54
|
+
|
|
55
|
+
Check the environment:
|
|
56
|
+
- `git status` — are there uncommitted changes that might cause the issue?
|
|
57
|
+
- Check if the right dependencies are installed (node_modules, venv, etc.)
|
|
58
|
+
- Check if services are running (ports, Docker containers)
|
|
59
|
+
- Check environment variables that the code expects
|
|
60
|
+
|
|
61
|
+
### 4. Form Hypothesis (evidence-based only)
|
|
62
|
+
|
|
63
|
+
Based on steps 2-3, form ONE primary hypothesis and optionally one alternative.
|
|
64
|
+
Each hypothesis MUST cite evidence:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
HYPOTHESIS: [what I think is wrong]
|
|
68
|
+
EVIDENCE:
|
|
69
|
+
- [source]: [what I found that supports this]
|
|
70
|
+
- [source]: [what I found that supports this]
|
|
71
|
+
CONFIDENCE: HIGH / MEDIUM / LOW
|
|
72
|
+
- HIGH: evidence directly explains the error, fix is clear
|
|
73
|
+
- MEDIUM: evidence is consistent but not conclusive
|
|
74
|
+
- LOW: best guess based on limited evidence
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 5. Recommend Fix
|
|
78
|
+
|
|
79
|
+
Provide a specific, actionable fix:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
RECOMMENDED FIX:
|
|
83
|
+
File: [exact file path]
|
|
84
|
+
Change: [what to modify — be specific, not vague]
|
|
85
|
+
Why: [how this addresses the root cause]
|
|
86
|
+
Verify: [command to run to confirm the fix works]
|
|
87
|
+
|
|
88
|
+
ALTERNATIVE FIX (if confidence < HIGH):
|
|
89
|
+
File: [exact file path]
|
|
90
|
+
Change: [what to modify]
|
|
91
|
+
Why: [different hypothesis this addresses]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 6. Output Format
|
|
95
|
+
|
|
96
|
+
Always produce this structured output:
|
|
97
|
+
|
|
98
|
+
```markdown
|
|
99
|
+
## Troubleshooter Diagnosis
|
|
100
|
+
|
|
101
|
+
**Error:** [exact error]
|
|
102
|
+
**Root Cause:** [1-2 sentence explanation]
|
|
103
|
+
**Confidence:** HIGH / MEDIUM / LOW
|
|
104
|
+
|
|
105
|
+
### Evidence
|
|
106
|
+
- [source 1]: [finding]
|
|
107
|
+
- [source 2]: [finding]
|
|
108
|
+
- Knowledge base: [match found / no match]
|
|
109
|
+
|
|
110
|
+
### Recommended Fix
|
|
111
|
+
- File: [path]
|
|
112
|
+
- Change: [specific change]
|
|
113
|
+
- Verify: [command]
|
|
114
|
+
|
|
115
|
+
### What Was Wrong With Previous Attempts
|
|
116
|
+
- Attempt 1: [why it didn't work — specific reason]
|
|
117
|
+
- Attempt 2: [why it didn't work — specific reason]
|
|
118
|
+
|
|
119
|
+
### If This Doesn't Work
|
|
120
|
+
- [Next diagnostic step to try]
|
|
121
|
+
- [What data to gather]
|
|
122
|
+
- [Whether to escalate to user — and what to ask them]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Rules
|
|
126
|
+
|
|
127
|
+
1. **Never guess.** Every claim must cite evidence from code, logs, KB, or git history.
|
|
128
|
+
2. **Check KB first.** If a past incident matches, use that fix. Don't reinvent.
|
|
129
|
+
3. **Be specific.** "Check the config" is not a fix. "Change line 42 of config.ts from X to Y" is.
|
|
130
|
+
4. **Explain why previous attempts failed.** This is as valuable as the fix itself.
|
|
131
|
+
5. **Know when to escalate.** If confidence is LOW and you can't gather more evidence, say so. Recommend what data to ask the user for.
|
|
132
|
+
6. **Don't try the fix yourself.** Your job is diagnosis. The calling agent implements the fix.
|
|
@@ -27,9 +27,15 @@ If no feature name is provided, use AskUserQuestion to get it.
|
|
|
27
27
|
If the plan file exists:
|
|
28
28
|
- Read it with the Read tool.
|
|
29
29
|
- Parse the YAML frontmatter to extract the `layers` array (`frontend`, `backend`, or both).
|
|
30
|
+
- Parse the `spec` field from frontmatter (e.g., `spec: specs/feature-name.md`).
|
|
30
31
|
- Use `layers` to determine which agents to spawn (see Agent Selection below).
|
|
31
32
|
- Use the full file content as `PLAN`.
|
|
32
33
|
|
|
34
|
+
**Also check for a spec file** at `.claude/specs/{feature-name}.md` (written by `/planning` Phase 0):
|
|
35
|
+
- If it exists, read it and store as `FEATURE_SPEC`.
|
|
36
|
+
- Extract `USER_STORIES` (the ## User Stories section) and `EDGE_CASES` (the ## Edge Cases section).
|
|
37
|
+
- These are passed to implementation agents and QA for better coverage.
|
|
38
|
+
|
|
33
39
|
If the plan file does NOT exist:
|
|
34
40
|
- Check conversation history for a recent `/planning` output. If found, use it as `PLAN` and infer layers from task breakdown.
|
|
35
41
|
- If neither exists, ask the user with AskUserQuestion:
|
|
@@ -134,6 +140,43 @@ Include the results in the shared context block below so agents match existing
|
|
|
134
140
|
patterns instead of inventing new ones. This is 60x cheaper than having each
|
|
135
141
|
Sonnet agent independently explore the codebase.
|
|
136
142
|
|
|
143
|
+
### 3c. Consult Knowledge Base (before agents start)
|
|
144
|
+
|
|
145
|
+
Before spawning implementation agents, check the knowledge base for relevant context:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
1. .claude/knowledge/shared/conventions.md — coding rules and project gotchas
|
|
149
|
+
2. .claude/knowledge/shared/patterns.md — architecture patterns to follow
|
|
150
|
+
3. .claude/knowledge/qa-knowledge/ — past incidents in the same area
|
|
151
|
+
4. git log --all --grep="fix:" --oneline -10 — recent bug fixes that may be relevant
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Include any relevant findings in the shared context block as `KNOWLEDGE_CONTEXT`.
|
|
155
|
+
This prevents agents from repeating past mistakes or contradicting established patterns.
|
|
156
|
+
|
|
157
|
+
### 3d. Escalation Protocol for Implementation Agents
|
|
158
|
+
|
|
159
|
+
Add this to every implementation agent's prompt:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
## When You Get Stuck (MANDATORY PROTOCOL)
|
|
163
|
+
|
|
164
|
+
If a command fails or a fix doesn't work:
|
|
165
|
+
1. DO NOT retry the same approach more than twice
|
|
166
|
+
2. After 2 failures with same error: STOP and consult knowledge base
|
|
167
|
+
- .claude/knowledge/shared/conventions.md
|
|
168
|
+
- .claude/knowledge/qa-knowledge/ (search for error keywords)
|
|
169
|
+
- git log --all --grep="<error keyword>" --oneline -10
|
|
170
|
+
3. After 3 failures: escalate with a STUCK REPORT:
|
|
171
|
+
- Error: [exact message]
|
|
172
|
+
- Attempts: [what you tried, why each failed]
|
|
173
|
+
- Evidence: [logs, state, KB results]
|
|
174
|
+
- What you need: [access/data/decision]
|
|
175
|
+
- Recommendation: [your best option]
|
|
176
|
+
4. Send the stuck report to team-lead via SendMessage
|
|
177
|
+
5. If a troubleshooter agent is available, team-lead may spawn one to help
|
|
178
|
+
```
|
|
179
|
+
|
|
137
180
|
### 4. Build Shared Context Block
|
|
138
181
|
|
|
139
182
|
```
|
|
@@ -146,6 +189,16 @@ Auth: {AUTH_APPROACH}
|
|
|
146
189
|
## Implementation Plan
|
|
147
190
|
{PLAN}
|
|
148
191
|
|
|
192
|
+
## User Stories (from spec — trace your work to these)
|
|
193
|
+
{USER_STORIES}
|
|
194
|
+
|
|
195
|
+
(If no spec exists, this section is omitted.)
|
|
196
|
+
|
|
197
|
+
## Edge Cases (from spec — handle these in your implementation)
|
|
198
|
+
{EDGE_CASES}
|
|
199
|
+
|
|
200
|
+
(If no spec exists, this section is omitted.)
|
|
201
|
+
|
|
149
202
|
## API Contract
|
|
150
203
|
{API_CONTRACT}
|
|
151
204
|
|
|
@@ -204,7 +257,7 @@ Check `.claude/project-profile.md` first (if /calibrate has run). Otherwise the
|
|
|
204
257
|
|
|
205
258
|
**Always spawn:**
|
|
206
259
|
- **qa** (subagent_type="qa", model="sonnet", name="qa")
|
|
207
|
-
- Prompt: "{SHARED_CONTEXT}\n\nYou are QA. Your job: (1) Review backend and frontend implementations as they complete. (2) Ask teammates 'why did you do X?' when something looks wrong. (
|
|
260
|
+
- Prompt: "{SHARED_CONTEXT}\n\nYou are QA. Your job: (1) Review backend and frontend implementations as they complete. (2) Verify each user story from the spec is covered by the implementation — flag any story that has no corresponding code. (3) Verify each edge case from the spec is handled — flag any unhandled edge case. (4) Ask teammates 'why did you do X?' when something looks wrong. (5) Run validation checks (linters, type checkers, build commands). (6) Report issues back to the responsible teammate. (7) Mark your tasks done when all checks pass. Do NOT write code — only review and validate.\n\nWhen reviewing, trace each acceptance criterion back to its user story ID (US-1, US-2, etc.) and confirm the implementation satisfies it. Check edge cases (EC-1, EC-2, etc.) have explicit handling in the code."
|
|
208
261
|
|
|
209
262
|
### 5b. Red Team Phase
|
|
210
263
|
|
|
@@ -339,6 +392,7 @@ After PASS (or user override of BLOCK):
|
|
|
339
392
|
|
|
340
393
|
### 6. Monitor + Coordinate
|
|
341
394
|
|
|
395
|
+
**Standard coordination:**
|
|
342
396
|
- Watch TaskList for progress.
|
|
343
397
|
- If backend finishes API endpoints, nudge frontend to unblock.
|
|
344
398
|
- If a teammate is stuck, relay context from the other teammate.
|
|
@@ -347,6 +401,50 @@ After PASS (or user override of BLOCK):
|
|
|
347
401
|
- If `REDTEAM_MODE=once`, defer Step 5b until all implementation steps are complete.
|
|
348
402
|
- Track `REDTEAM_CYCLE`. If a BLOCK verdict is returned from Step 5b.4, pause all progress and escalate to the user before continuing.
|
|
349
403
|
|
|
404
|
+
**Escalation handling (when an agent sends a STUCK REPORT):**
|
|
405
|
+
|
|
406
|
+
When an agent reports they're stuck (via SendMessage with stuck report format):
|
|
407
|
+
|
|
408
|
+
1. **Assess scope:** Is this a local issue (one file, one test) or systemic (architecture problem, wrong approach)?
|
|
409
|
+
|
|
410
|
+
2. **If local issue (single file/test failure):**
|
|
411
|
+
- Check if another teammate can help (e.g., backend stuck on a frontend integration → ask frontend agent)
|
|
412
|
+
- Spawn a troubleshooter agent with the stuck report + error context
|
|
413
|
+
- Relay the troubleshooter's diagnosis back to the stuck agent
|
|
414
|
+
- If troubleshooter confidence is LOW → escalate to user with structured options
|
|
415
|
+
|
|
416
|
+
3. **If systemic issue (architecture problem, multiple agents affected):**
|
|
417
|
+
- PAUSE all agents (don't let them keep building on a broken foundation)
|
|
418
|
+
- Escalate to user immediately:
|
|
419
|
+
```
|
|
420
|
+
IMPLEMENTATION BLOCKED
|
|
421
|
+
|
|
422
|
+
What happened: [agent] hit [error] after [N] attempts
|
|
423
|
+
Scope: [local/systemic] — [why you think so]
|
|
424
|
+
Impact: [which tasks are blocked]
|
|
425
|
+
Troubleshooter says: [diagnosis if spawned]
|
|
426
|
+
|
|
427
|
+
Options:
|
|
428
|
+
[1] Fix the root cause (I'll explain what needs to change)
|
|
429
|
+
[2] Adjust the plan (scope down to avoid this area)
|
|
430
|
+
[3] Abort implementation (save work done so far)
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
4. **If two agents are stuck simultaneously:**
|
|
434
|
+
- This is almost always a systemic issue → treat as systemic
|
|
435
|
+
- Do NOT spawn two troubleshooters — diagnose once, fix at the root
|
|
436
|
+
|
|
437
|
+
5. **If a task shows no progress for 3+ consecutive idle cycles:**
|
|
438
|
+
- Check in with the agent: "What's your status on Task #N?"
|
|
439
|
+
- If no meaningful progress → treat as stuck (even without explicit stuck report)
|
|
440
|
+
|
|
441
|
+
**Red team finding escalation:**
|
|
442
|
+
|
|
443
|
+
When red team finds issues that the developer can't fix:
|
|
444
|
+
- If the fix requires changes outside their file ownership → orchestrator makes the cross-cutting change
|
|
445
|
+
- If the fix requires a plan change → escalate to user: "Red team found [issue] that requires changing the plan. Original plan said [X], but we need [Y]. Approve?"
|
|
446
|
+
- If the fix is beyond the team's capability → acknowledge, log it, and add to the PR description as a known limitation
|
|
447
|
+
|
|
350
448
|
### 7. Cleanup Implementation Team
|
|
351
449
|
|
|
352
450
|
- Send shutdown_request to all teammates.
|