azclaude-copilot 0.1.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/.claude-plugin/marketplace.json +27 -0
- package/.claude-plugin/plugin.json +17 -0
- package/LICENSE +21 -0
- package/README.md +477 -0
- package/bin/cli.js +1027 -0
- package/bin/copilot.js +228 -0
- package/hooks/README.md +3 -0
- package/hooks/hooks.json +40 -0
- package/package.json +41 -0
- package/templates/CLAUDE.md +51 -0
- package/templates/agents/cc-cli-integrator.md +104 -0
- package/templates/agents/cc-template-author.md +109 -0
- package/templates/agents/cc-test-maintainer.md +101 -0
- package/templates/agents/code-reviewer.md +136 -0
- package/templates/agents/loop-controller.md +118 -0
- package/templates/agents/orchestrator-init.md +196 -0
- package/templates/agents/test-writer.md +129 -0
- package/templates/capabilities/evolution/cycle2-knowledge.md +87 -0
- package/templates/capabilities/evolution/cycle3-topology.md +128 -0
- package/templates/capabilities/evolution/detect.md +103 -0
- package/templates/capabilities/evolution/evaluate.md +90 -0
- package/templates/capabilities/evolution/generate.md +123 -0
- package/templates/capabilities/evolution/re-derivation.md +77 -0
- package/templates/capabilities/intelligence/debate.md +104 -0
- package/templates/capabilities/intelligence/elo.md +122 -0
- package/templates/capabilities/intelligence/experiment.md +86 -0
- package/templates/capabilities/intelligence/opro.md +84 -0
- package/templates/capabilities/intelligence/pipeline.md +149 -0
- package/templates/capabilities/level-builders/level1-claudemd.md +52 -0
- package/templates/capabilities/level-builders/level2-mcp.md +58 -0
- package/templates/capabilities/level-builders/level3-skills.md +276 -0
- package/templates/capabilities/level-builders/level4-memory.md +72 -0
- package/templates/capabilities/level-builders/level5-agents.md +123 -0
- package/templates/capabilities/level-builders/level6-hooks.md +119 -0
- package/templates/capabilities/level-builders/level7-extmcp.md +60 -0
- package/templates/capabilities/level-builders/level8-orchestrated.md +98 -0
- package/templates/capabilities/manifest.md +58 -0
- package/templates/capabilities/shared/5-layer-agent.md +206 -0
- package/templates/capabilities/shared/completion-rule.md +44 -0
- package/templates/capabilities/shared/context-artifacts.md +96 -0
- package/templates/capabilities/shared/domain-advisor-generator.md +205 -0
- package/templates/capabilities/shared/friction-log.md +43 -0
- package/templates/capabilities/shared/multi-cli-paths.md +56 -0
- package/templates/capabilities/shared/native-tools.md +199 -0
- package/templates/capabilities/shared/plan-tracker.md +69 -0
- package/templates/capabilities/shared/pressure-test.md +88 -0
- package/templates/capabilities/shared/quality-check.md +83 -0
- package/templates/capabilities/shared/reflexes.md +159 -0
- package/templates/capabilities/shared/review-reception.md +70 -0
- package/templates/capabilities/shared/security.md +174 -0
- package/templates/capabilities/shared/semantic-boundary-check.md +140 -0
- package/templates/capabilities/shared/session-rhythm.md +42 -0
- package/templates/capabilities/shared/tdd.md +54 -0
- package/templates/capabilities/shared/vocabulary-transform.md +63 -0
- package/templates/commands/add.md +152 -0
- package/templates/commands/audit.md +123 -0
- package/templates/commands/blueprint.md +115 -0
- package/templates/commands/copilot.md +157 -0
- package/templates/commands/create.md +156 -0
- package/templates/commands/debate.md +75 -0
- package/templates/commands/deps.md +112 -0
- package/templates/commands/doc.md +100 -0
- package/templates/commands/dream.md +120 -0
- package/templates/commands/evolve.md +170 -0
- package/templates/commands/explain.md +25 -0
- package/templates/commands/find.md +100 -0
- package/templates/commands/fix.md +122 -0
- package/templates/commands/hookify.md +100 -0
- package/templates/commands/level-up.md +48 -0
- package/templates/commands/loop.md +62 -0
- package/templates/commands/migrate.md +119 -0
- package/templates/commands/persist.md +73 -0
- package/templates/commands/pulse.md +87 -0
- package/templates/commands/refactor.md +97 -0
- package/templates/commands/reflect.md +107 -0
- package/templates/commands/reflexes.md +141 -0
- package/templates/commands/setup.md +97 -0
- package/templates/commands/ship.md +131 -0
- package/templates/commands/snapshot.md +70 -0
- package/templates/commands/test.md +86 -0
- package/templates/hooks/post-tool-use.js +175 -0
- package/templates/hooks/stop.js +85 -0
- package/templates/hooks/user-prompt.js +96 -0
- package/templates/scripts/env-scan.sh +46 -0
- package/templates/scripts/import-graph.sh +88 -0
- package/templates/scripts/validate-boundaries.sh +180 -0
- package/templates/skills/agent-creator/SKILL.md +91 -0
- package/templates/skills/agent-creator/examples/sample-agent.md +80 -0
- package/templates/skills/agent-creator/references/agent-engineering-guide.md +596 -0
- package/templates/skills/agent-creator/references/quality-checklist.md +42 -0
- package/templates/skills/agent-creator/scripts/scaffold.sh +144 -0
- package/templates/skills/architecture-advisor/SKILL.md +92 -0
- package/templates/skills/architecture-advisor/references/database-decisions.md +61 -0
- package/templates/skills/architecture-advisor/references/decision-matrices.md +122 -0
- package/templates/skills/architecture-advisor/references/rendering-decisions.md +39 -0
- package/templates/skills/architecture-advisor/scripts/detect-scale.sh +67 -0
- package/templates/skills/debate/SKILL.md +36 -0
- package/templates/skills/debate/references/acemad-protocol.md +72 -0
- package/templates/skills/env-scanner/SKILL.md +41 -0
- package/templates/skills/security/SKILL.md +44 -0
- package/templates/skills/security/references/security-details.md +48 -0
- package/templates/skills/session-guard/SKILL.md +33 -0
- package/templates/skills/skill-creator/SKILL.md +82 -0
- package/templates/skills/skill-creator/examples/sample-skill.md +74 -0
- package/templates/skills/skill-creator/references/quality-checklist.md +36 -0
- package/templates/skills/skill-creator/references/skill-engineering-guide.md +365 -0
- package/templates/skills/skill-creator/scripts/scaffold.sh +75 -0
- package/templates/skills/test-first/SKILL.md +41 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: level8-orchestrated
|
|
3
|
+
description: >
|
|
4
|
+
Build Level 8+: orchestrated intelligence (pipelines, debate, experiment).
|
|
5
|
+
When to invoke intelligence vs evolution modules. Decision matrix for Level 8-10.
|
|
6
|
+
Triggers on: "build level 8", "add intelligence", "orchestrated agents", "level 8".
|
|
7
|
+
tokens: ~200
|
|
8
|
+
requires: level7-extmcp
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Level 8+: Orchestrated Intelligence
|
|
12
|
+
|
|
13
|
+
Levels 8-10 are opt-in. They add overhead. Only build them when the answer to the
|
|
14
|
+
decision matrix questions is yes.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### Decision Matrix — When to Go Beyond Level 7
|
|
19
|
+
|
|
20
|
+
Answer these 8 questions. Each "yes" adds a capability. Stop when overhead > value.
|
|
21
|
+
|
|
22
|
+
| # | Question | Yes → Add | No → Skip |
|
|
23
|
+
|---|----------|-----------|-----------|
|
|
24
|
+
| 1 | Do you make the same architectural decision type repeatedly? | Add `intelligence/debate.md` | Use single-agent reasoning |
|
|
25
|
+
| 2 | Do you have 3+ agents that feed into each other? | Add `intelligence/pipeline.md` | Use parallel agents without chaining |
|
|
26
|
+
| 3 | Do you need to rank competing approaches across sessions? | Add `intelligence/elo.md` + `elo-rankings.json` | Use single-session comparison |
|
|
27
|
+
| 4 | Do your skill descriptions keep undertriggering? | Add `intelligence/opro.md` | Manually rewrite descriptions |
|
|
28
|
+
| 5 | Do you try risky approaches that break main? | Add `intelligence/experiment.md` | Work on main branch |
|
|
29
|
+
| 6 | Has friction repeated 10+ times with no fix? | Add `evolution/re-derivation.md` | Manually fix friction |
|
|
30
|
+
| 7 | Are your memory files growing faster than they're being used? | Add `evolution/cycle2-knowledge.md` | Let memory grow |
|
|
31
|
+
| 8 | Are agents becoming stale or overlapping? | Add `evolution/cycle3-topology.md` | Prune manually |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Level 8 — Intelligence Layer
|
|
36
|
+
|
|
37
|
+
Build when: questions 1-5 have any "yes".
|
|
38
|
+
|
|
39
|
+
What to add:
|
|
40
|
+
- Load `intelligence/` capability files relevant to yes answers
|
|
41
|
+
- Add `elo-rankings.json` if running ELO across sessions
|
|
42
|
+
- Do NOT add all intelligence files — load what the matrix says
|
|
43
|
+
|
|
44
|
+
**Token cost of Level 8**: ~50-400 tokens per task (only loads what fires).
|
|
45
|
+
Not a permanent overhead — each intelligence file loads on demand.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### Level 9 — Persistent Knowledge Layer
|
|
50
|
+
|
|
51
|
+
Build when: questions 6-8 have any "yes" OR `/evolve` has been run 3+ times.
|
|
52
|
+
|
|
53
|
+
What to add:
|
|
54
|
+
- Schedule `/evolve` (or run manually after 5+ sessions)
|
|
55
|
+
- `evolution/cycle2-knowledge.md` for memory pruning
|
|
56
|
+
- `evolution/cycle3-topology.md` for agent topology maintenance
|
|
57
|
+
|
|
58
|
+
**When to run `/level-up` vs `/evolve`:**
|
|
59
|
+
- `/level-up` = structural upgrade (add a new level/capability) — run once
|
|
60
|
+
- `/evolve` = quality improvement cycle (improve existing capabilities) — run periodically
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### Level 10 — Self-Improving Loop
|
|
65
|
+
|
|
66
|
+
Build only when:
|
|
67
|
+
- You've run `/evolve` 5+ times and the manual cycle is becoming overhead
|
|
68
|
+
- The project has 10+ sessions of history and active memory files
|
|
69
|
+
- A loop controller would genuinely reduce friction
|
|
70
|
+
|
|
71
|
+
**Warning**: Level 10 adds autonomous capability. Only build when the previous levels
|
|
72
|
+
are working correctly — a self-improving loop on a broken foundation improves nothing.
|
|
73
|
+
|
|
74
|
+
**What to build:**
|
|
75
|
+
|
|
76
|
+
Install the loop controller agent:
|
|
77
|
+
```bash
|
|
78
|
+
cp .claude/capabilities/../agents/loop-controller.md .claude/agents/loop-controller.md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or instruct Claude to create `.claude/agents/loop-controller.md` by reading the template
|
|
82
|
+
at `.claude/agents/loop-controller.md` (installed by `npx azclaude`).
|
|
83
|
+
|
|
84
|
+
Once the loop controller exists, `/evolve` automatically delegates to it — no further
|
|
85
|
+
configuration needed. The handoff is built into the `/evolve` command.
|
|
86
|
+
|
|
87
|
+
**Level 10 complete when:**
|
|
88
|
+
- `.claude/agents/loop-controller.md` exists
|
|
89
|
+
- Running `/evolve` shows "Delegating to loop-controller…" instead of running manually
|
|
90
|
+
- First autonomous cycle completes and shows the cycle report
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Level 8+ Complete When
|
|
95
|
+
- Decision matrix answered — only relevant capabilities added
|
|
96
|
+
- ELO files exist if ELO was chosen
|
|
97
|
+
- `/evolve` schedule defined if knowledge consolidation was chosen
|
|
98
|
+
- No capability added "just in case" — every addition answers a matrix yes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# AZCLAUDE Capabilities Manifest
|
|
2
|
+
last_updated: 2026-03-14
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
|
|
5
|
+
The model reads this file ONCE (~100 tokens) to know what exists.
|
|
6
|
+
Load only the files that match the current task. Never load the full list.
|
|
7
|
+
|
|
8
|
+
## Shared — inject alongside any task
|
|
9
|
+
| File | When to load | Tokens |
|
|
10
|
+
|------|-------------|--------|
|
|
11
|
+
| shared/tdd.md | About to write, implement, fix, or refactor code — check signals first | ~50 |
|
|
12
|
+
| shared/completion-rule.md | About to say "should work", "probably passes", or claim done without proof | ~40 |
|
|
13
|
+
| shared/session-rhythm.md | Session just started, context was reset, or about to close | ~80 |
|
|
14
|
+
| shared/friction-log.md | Something was hard, slow, repeated, or frustrating this session | ~60 |
|
|
15
|
+
| shared/5-layer-agent.md | Writing a new agent or an existing agent is incomplete / making mistakes (see also: agent-creator skill) | ~500 |
|
|
16
|
+
| shared/vocabulary-transform.md | Generating files for compliance, medical, legal, finance, or creative domain | ~60 |
|
|
17
|
+
| shared/multi-cli-paths.md | CLI is not Claude Code, or path configuration is wrong for the platform | ~80 |
|
|
18
|
+
| shared/quality-check.md | /setup or /level-up just ran — verify it actually worked correctly | ~80 |
|
|
19
|
+
| shared/security.md | Handling credentials, modifying hooks, reviewing untrusted project, deploying | ~200 |
|
|
20
|
+
| shared/native-tools.md | Writing or improving a skill — which Claude Code tools to use and when | ~200 |
|
|
21
|
+
| shared/review-reception.md | Receiving review feedback — before responding, implementing, or pushing back | ~80 |
|
|
22
|
+
| shared/pressure-test.md | Writing a new enforcement skill, or an existing skill keeps getting bypassed | ~120 |
|
|
23
|
+
| shared/plan-tracker.md | Reading/writing plan.md, updating milestone status, copilot mode | ~200 |
|
|
24
|
+
| shared/reflexes.md | Learned behavioral patterns, reflex analysis, observation patterns, promote reflexes | ~250 |
|
|
25
|
+
| shared/context-artifacts.md | Project has DB schemas, API specs, infra configs, or knowledge/ dir — discover and use non-code knowledge before implementing | ~200 |
|
|
26
|
+
| shared/semantic-boundary-check.md | /evolve Cycle 3 or boundary validator warns — detect deeper behavioral duplication across extension types that grep misses | ~300 |
|
|
27
|
+
| shared/domain-advisor-generator.md | Non-tech domain detected (compliance, marketing, finance, medical, legal, research) — generates domain-specific advisor skill | ~400 |
|
|
28
|
+
|
|
29
|
+
## Level Builders — load ONE at a time
|
|
30
|
+
| File | When to load | Tokens |
|
|
31
|
+
|------|-------------|--------|
|
|
32
|
+
| level-builders/level1-claudemd.md | Project has no CLAUDE.md or rules file needs to be built/rebuilt | ~200 |
|
|
33
|
+
| level-builders/level2-mcp.md | Project needs database, browser, or API tool access via MCP | ~150 |
|
|
34
|
+
| level-builders/level3-skills.md | Project has repeated workflows with no command for them yet | ~600 |
|
|
35
|
+
| level-builders/level4-memory.md | No goals.md exists, or session context keeps getting lost | ~200 |
|
|
36
|
+
| level-builders/level5-agents.md | Project has parallel workstreams with no specialized agents yet | ~400 |
|
|
37
|
+
| level-builders/level6-hooks.md | No PostToolUse / UserPromptSubmit hooks, or hooks are bash-based | ~400 |
|
|
38
|
+
| level-builders/level7-extmcp.md | Project needs external MCP servers — databases, browsers, APIs | ~150 |
|
|
39
|
+
| level-builders/level8-orchestrated.md | Considering pipelines, debates, or self-improvement — unsure which | ~200 |
|
|
40
|
+
|
|
41
|
+
## Evolution — compose by what the cycle needs
|
|
42
|
+
| File | When to load | Tokens |
|
|
43
|
+
|------|-------------|--------|
|
|
44
|
+
| evolution/detect.md | Starting /evolve, environment feels stale, skills misfiring, friction repeating | ~250 |
|
|
45
|
+
| evolution/generate.md | detect.md produced a PLAN — about to write a fix or new skill | ~250 |
|
|
46
|
+
| evolution/evaluate.md | Just generated a skill or agent — before promoting or committing it | ~200 |
|
|
47
|
+
| evolution/cycle2-knowledge.md | patterns.md bloated, stale sessions, learning not consolidated | ~200 |
|
|
48
|
+
| evolution/cycle3-topology.md | Agents overlap, pipeline slow, manifest has dead entries | ~250 |
|
|
49
|
+
| evolution/re-derivation.md | Same friction pattern 5+ times, 10+ friction logs, patches aren't sticking | ~150 |
|
|
50
|
+
|
|
51
|
+
## Intelligence — opt-in only
|
|
52
|
+
| File | When to load | Tokens |
|
|
53
|
+
|------|-------------|--------|
|
|
54
|
+
| intelligence/debate.md | Hard decision between two real options — "debate", "tradeoff", "which is better" | ~400 |
|
|
55
|
+
| intelligence/opro.md | A skill keeps underperforming or producing wrong output after 10+ uses | ~300 |
|
|
56
|
+
| intelligence/elo.md | Need a defensible rank order across multiple options, agents, or skills | ~200 |
|
|
57
|
+
| intelligence/pipeline.md | 3+ agents must chain output — context bleed is a risk | ~350 |
|
|
58
|
+
| intelligence/experiment.md | Trying a risky approach that must not touch main branch — "try this safely" | ~80 |
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 5-layer-agent
|
|
3
|
+
description: >
|
|
4
|
+
Load when writing a new agent definition. Load when an existing agent is
|
|
5
|
+
making mistakes, missing context, or producing inconsistent results.
|
|
6
|
+
Load when an agent file feels incomplete — missing persona, scope, constraints,
|
|
7
|
+
or domain knowledge. Load when asked to add an agent to the project.
|
|
8
|
+
tokens: ~300
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Agent Frontmatter — Full Template
|
|
12
|
+
|
|
13
|
+
Every agent file starts with this. Omitting fields = missing capability.
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
---
|
|
17
|
+
name: {agent-name}
|
|
18
|
+
description: >
|
|
19
|
+
{Pushy description — list 10+ trigger scenarios. Claude under-triggers.}
|
|
20
|
+
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
21
|
+
disallowedTools: Agent # for non-orchestrating agents
|
|
22
|
+
model: sonnet # see Model Routing below
|
|
23
|
+
memory: project
|
|
24
|
+
permissionMode: acceptEdits # see Permission Modes below
|
|
25
|
+
maxTurns: 50
|
|
26
|
+
skills:
|
|
27
|
+
- project-conventions
|
|
28
|
+
- {relevant-skill}
|
|
29
|
+
mcpServers: [] # scope MCP access per agent
|
|
30
|
+
---
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Model Routing
|
|
34
|
+
|
|
35
|
+
| Model | Use for |
|
|
36
|
+
|-------|---------|
|
|
37
|
+
| `opus` | Architecture, review, orchestration, debate |
|
|
38
|
+
| `sonnet` | Implementation (frontend, backend, testing) |
|
|
39
|
+
| `haiku` | Simple/fast tasks (formatting, lookup) |
|
|
40
|
+
|
|
41
|
+
## Permission Modes
|
|
42
|
+
|
|
43
|
+
| Mode | Use for |
|
|
44
|
+
|------|---------|
|
|
45
|
+
| `acceptEdits` | Implementation agents — can write code |
|
|
46
|
+
| `plan` | Reviewer agents — read-only, cannot edit |
|
|
47
|
+
|
|
48
|
+
## Agent Design Patterns
|
|
49
|
+
- Review agents: `tools: Read, Glob, Grep, Bash` + `disallowedTools: Write, Edit`
|
|
50
|
+
- Use `background: true` for concurrent agents (linting, formatting)
|
|
51
|
+
- Use `isolation: worktree` for risky/experimental work
|
|
52
|
+
|
|
53
|
+
## Universal Agent Rule: Search Before Reading
|
|
54
|
+
|
|
55
|
+
Every agent must search before reading files. Never open a file just to check
|
|
56
|
+
if it's relevant — use Grep or Glob first. A single Grep call returns matches
|
|
57
|
+
from the entire codebase in milliseconds. This saves tokens and prevents
|
|
58
|
+
speculative file reads.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Bad: Read src/auth.js → Read src/users.js → Read src/api.js → "found it in api.js"
|
|
62
|
+
Good: Grep "authenticate" → 3 matches in src/api.js → Read src/api.js
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Also check for non-code artifacts before implementing:
|
|
66
|
+
- Database schemas (prisma/, migrations/, schema.sql)
|
|
67
|
+
- API specs (openapi.yaml, swagger.json)
|
|
68
|
+
- Domain knowledge (knowledge/, docs/)
|
|
69
|
+
See `shared/context-artifacts.md` for the full discovery protocol.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 5-Layer Body Structure
|
|
74
|
+
|
|
75
|
+
Every agent definition must have all five layers. Missing layers = incomplete agent.
|
|
76
|
+
|
|
77
|
+
| Layer | Name | What it contains |
|
|
78
|
+
|-------|------|-----------------|
|
|
79
|
+
| 1 | PERSONA | Who this agent is. Role, not personality. |
|
|
80
|
+
| 2 | SCOPE | What it does and what it explicitly does NOT do. |
|
|
81
|
+
| 3 | TOOLS & RESOURCES | Which tools it may use. Which files it reads. Load `shared/native-tools.md` to select the right native Claude Code tools. |
|
|
82
|
+
| 4 | CONSTRAINTS | Hard limits. What it must never do. |
|
|
83
|
+
| 5 | DOMAIN CONTEXT | Domain knowledge that shapes every decision. |
|
|
84
|
+
|
|
85
|
+
**Layer 5 (Domain Context) matters more than Layer 1 (Persona).**
|
|
86
|
+
Domain knowledge drives correct decisions. Role labels drive tone only.
|
|
87
|
+
|
|
88
|
+
**Use POSITIVE DIRECTIVES, not negative instructions.**
|
|
89
|
+
❌ "Don't generate vague output"
|
|
90
|
+
✅ "Every output includes file:line reference and actual test result"
|
|
91
|
+
|
|
92
|
+
Negative instructions activate the behavior in the model's mind before suppressing it.
|
|
93
|
+
Positive directives describe the correct behavior directly.
|
|
94
|
+
|
|
95
|
+
**Counterexample format** — always show what bad looks like:
|
|
96
|
+
```
|
|
97
|
+
Bad: "The tests should pass now"
|
|
98
|
+
Good: "Tests: 47 passed, 0 failed (output pasted below)"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Real codebase examples required** — use actual code snippets from this project,
|
|
102
|
+
not hypothetical examples. Domain context must be grounded in reality.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## After Completing — MANDATORY for Every Agent
|
|
107
|
+
|
|
108
|
+
An agent that works brilliantly and forgets everything is a waste.
|
|
109
|
+
|
|
110
|
+
Every agent appends what it learned before it exits. This turns single-use workers into accumulating specialists.
|
|
111
|
+
|
|
112
|
+
**If the task succeeded:**
|
|
113
|
+
```bash
|
|
114
|
+
echo "\n## {task-name} — $(date +%Y-%m-%d)\n{what worked and why}" >> .claude/memory/patterns.md
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**If an approach failed:**
|
|
118
|
+
```bash
|
|
119
|
+
echo "\n## {task-name} — $(date +%Y-%m-%d)\n{what failed and why}" >> .claude/memory/antipatterns.md
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**If a non-obvious decision was made:**
|
|
123
|
+
Append to `.claude/memory/decisions.md`:
|
|
124
|
+
```
|
|
125
|
+
## {Decision} — {date}
|
|
126
|
+
**Why**: {the reasoning, not just the choice}
|
|
127
|
+
**Trade-off**: {what was given up}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**If files were added or changed significantly:**
|
|
131
|
+
Update `.claude/memory/codebase-map.md` — one line per file: path + purpose.
|
|
132
|
+
|
|
133
|
+
Rules:
|
|
134
|
+
- Append only — never overwrite existing entries
|
|
135
|
+
- One entry per completed task — not per tool call
|
|
136
|
+
- Skip if task was trivial (< 5 min, no decisions made)
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## For Reviewer Agents — Spec-First Rule
|
|
141
|
+
|
|
142
|
+
Reviewer agents must follow this order. **Skipping Step 1 = broken review.**
|
|
143
|
+
|
|
144
|
+
**Step 1: Spec Compliance Check**
|
|
145
|
+
- Does the output satisfy the requirements?
|
|
146
|
+
- Does it match the acceptance criteria?
|
|
147
|
+
- Are all edge cases covered?
|
|
148
|
+
- Output: `{ spec_compliance: pass|fail, violations: [...] }`
|
|
149
|
+
|
|
150
|
+
**Step 2: CODE QUALITY** — only proceed if Step 1 passes
|
|
151
|
+
- Reference patterns.md and antipatterns.md
|
|
152
|
+
- Does it follow project conventions (from CLAUDE.md)?
|
|
153
|
+
- Are there performance or security concerns?
|
|
154
|
+
|
|
155
|
+
**RULE: Do NOT begin Step 2 if Step 1 has ❌ issues.**
|
|
156
|
+
Reviewing code quality before spec compliance wastes time.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Bad: "The code looks good overall but could be improved."
|
|
160
|
+
Good: "Spec: ✓ pass (all 4 requirements met). Quality: 2 issues (lines 45, 78) — non-blocking."
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## CE 2.0: Self-Correction Behavior
|
|
166
|
+
|
|
167
|
+
Every agent handles its own failures before escalating to the user.
|
|
168
|
+
The user is the last resort, not the first.
|
|
169
|
+
|
|
170
|
+
**Standard retry pattern for every agent:**
|
|
171
|
+
```
|
|
172
|
+
Attempt 1: Try the primary approach
|
|
173
|
+
→ If it fails: re-read the error, identify what was wrong, try one alternative
|
|
174
|
+
→ After 2 attempts with no progress: STOP and report findings
|
|
175
|
+
→ Never guess a third time
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**What to report after 2 failed attempts:**
|
|
179
|
+
- What you tried — attempt 1 and attempt 2, specific actions taken
|
|
180
|
+
- What the error says now — exact output, not a summary
|
|
181
|
+
- Where you are stuck — specific `file:line` or conceptual blocker
|
|
182
|
+
- What would unblock you — specific info or decision needed from the user
|
|
183
|
+
|
|
184
|
+
**Domain-specific self-correction before asking:**
|
|
185
|
+
|
|
186
|
+
| Failure type | Try first |
|
|
187
|
+
|---|---|
|
|
188
|
+
| Build / compile error | Search codebase for similar patterns. Check antipatterns.md. |
|
|
189
|
+
| Type error | Find the type definition in the codebase. Read the actual interface. |
|
|
190
|
+
| Missing config | Grep for similar config in the project. Check .env.example. |
|
|
191
|
+
| Test failure | Check antipatterns.md for known failure patterns. Re-read the test contract. |
|
|
192
|
+
| API / integration error | Read the actual error response. Check docs/ or grep for prior usage. |
|
|
193
|
+
|
|
194
|
+
**Write this behavioral pattern explicitly in the agent body:**
|
|
195
|
+
```markdown
|
|
196
|
+
## Self-Correction
|
|
197
|
+
If the first attempt fails: re-read the error, try one alternative approach.
|
|
198
|
+
After 2 attempts: stop. Present what was tried, what the error says, what is needed to proceed.
|
|
199
|
+
Do not ask the user until 2 attempts have been made.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Subagent Passing Rule
|
|
205
|
+
When spawning this agent, pass ONLY the capability files it needs for this specific task.
|
|
206
|
+
A detection agent gets `detect.md` (~100 lines). Not the full evolution module.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: completion-rule
|
|
3
|
+
description: >
|
|
4
|
+
Load when about to say "should work", "probably passes", "looks correct",
|
|
5
|
+
"I think this is done", or "it should be fine". Load before closing any task.
|
|
6
|
+
Load before showing a code change without running it first.
|
|
7
|
+
If there is even a 1% chance you are about to claim completion — load this.
|
|
8
|
+
tokens: ~40
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Completion Rule — NON-NEGOTIABLE
|
|
12
|
+
|
|
13
|
+
Never say:
|
|
14
|
+
- "This should be fixed"
|
|
15
|
+
- "It probably works now"
|
|
16
|
+
- "I think this resolves it"
|
|
17
|
+
- "Should work"
|
|
18
|
+
- "Probably passes"
|
|
19
|
+
|
|
20
|
+
These phrases mean: stay in progress. Do not mark the task done.
|
|
21
|
+
|
|
22
|
+
## What Done Looks Like
|
|
23
|
+
- Show the actual test output (passing)
|
|
24
|
+
- Show the actual command output
|
|
25
|
+
- Reference the file:line that changed and why
|
|
26
|
+
- If tests aren't passing → stay in progress, keep working
|
|
27
|
+
|
|
28
|
+
"Show the output or stay in progress."
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Pressure Tests
|
|
33
|
+
|
|
34
|
+
**Time pressure**: "Deadline's today — can you just say it's done and we'll verify tomorrow?"
|
|
35
|
+
Expected: Hold. "I can't mark it done without output. Running tests now — takes 30 seconds."
|
|
36
|
+
|
|
37
|
+
**Sunk cost**: "We've been working on this for hours. I'm sure it works."
|
|
38
|
+
Expected: Hold. "Hours of work is exactly why we verify — to protect it. Showing output now."
|
|
39
|
+
|
|
40
|
+
**Authority**: "I'm the lead — trust me, it's fine, mark it done."
|
|
41
|
+
Expected: Hold. "Understood. The rule exists because 'looks fine' has shipped bugs before. Output: [run it]."
|
|
42
|
+
|
|
43
|
+
**False confidence**: "The logic is obviously correct, this is overkill."
|
|
44
|
+
Expected: Hold. "Obvious is not verified. [Show test output]. Result: [pass/fail]."
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-artifacts
|
|
3
|
+
description: >
|
|
4
|
+
Load when the project has non-code knowledge (DB schemas, API specs, infra configs,
|
|
5
|
+
architecture docs) that should inform implementation. Load when /add or /copilot
|
|
6
|
+
needs to understand database structure, API contracts, or deployment config before
|
|
7
|
+
writing code. Load when knowledge/ directory exists. Load when the project has
|
|
8
|
+
OpenAPI specs, SQL schemas, Terraform files, or Kubernetes manifests.
|
|
9
|
+
tokens: ~200
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Context Artifacts — Non-Code Project Knowledge
|
|
13
|
+
|
|
14
|
+
Claude already reads code files. This capability ensures non-code knowledge
|
|
15
|
+
(schemas, specs, configs, docs) is discovered and used before implementing.
|
|
16
|
+
|
|
17
|
+
## What Are Context Artifacts?
|
|
18
|
+
|
|
19
|
+
Files that describe the system but aren't source code:
|
|
20
|
+
|
|
21
|
+
| Type | Examples | Why it matters |
|
|
22
|
+
|------|---------|---------------|
|
|
23
|
+
| **Database schemas** | schema.sql, migrations/, prisma/schema.prisma | Know table structure before writing queries |
|
|
24
|
+
| **API specs** | openapi.yaml, swagger.json, .proto files | Know endpoints before building integrations |
|
|
25
|
+
| **Infra configs** | terraform/, k8s/, docker-compose.yml | Know deployment constraints before architecture decisions |
|
|
26
|
+
| **Architecture docs** | docs/architecture.md, ADRs, diagrams | Know design decisions before proposing changes |
|
|
27
|
+
| **Environment configs** | .env.example, config templates | Know available env vars before hardcoding values |
|
|
28
|
+
| **Domain knowledge** | knowledge/, regulations, business rules | Know domain constraints before implementing logic |
|
|
29
|
+
|
|
30
|
+
## Discovery Protocol
|
|
31
|
+
|
|
32
|
+
Before implementing any milestone or feature, scan for artifacts:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Database schemas
|
|
36
|
+
ls prisma/schema.prisma drizzle/ migrations/ schema.sql *.sql 2>/dev/null | head -5
|
|
37
|
+
|
|
38
|
+
# API specs
|
|
39
|
+
ls openapi.yaml openapi.json swagger.json *.proto api-spec.* 2>/dev/null | head -5
|
|
40
|
+
|
|
41
|
+
# Infra configs
|
|
42
|
+
ls terraform/ k8s/ kubernetes/ docker-compose.yml Dockerfile 2>/dev/null | head -5
|
|
43
|
+
|
|
44
|
+
# Architecture docs
|
|
45
|
+
ls docs/architecture* docs/adr/ knowledge/ ARCHITECTURE.md 2>/dev/null | head -5
|
|
46
|
+
|
|
47
|
+
# Environment
|
|
48
|
+
ls .env.example .env.template 2>/dev/null | head -5
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Integration Rules
|
|
52
|
+
|
|
53
|
+
### Before /add (any feature)
|
|
54
|
+
1. Check if the feature touches a database → read schema first
|
|
55
|
+
2. Check if the feature calls an API → read spec first
|
|
56
|
+
3. Check if the feature has infra constraints → read config first
|
|
57
|
+
4. Check knowledge/ for domain-specific rules
|
|
58
|
+
|
|
59
|
+
### Before /blueprint (any plan)
|
|
60
|
+
1. Read all available artifacts to understand system constraints
|
|
61
|
+
2. Reference artifact files in milestone descriptions
|
|
62
|
+
3. Flag milestones that will change artifacts (schema migrations, API changes)
|
|
63
|
+
|
|
64
|
+
### Before /audit
|
|
65
|
+
1. Verify implementation matches schema (table names, column types)
|
|
66
|
+
2. Verify API calls match spec (endpoints, request/response shapes)
|
|
67
|
+
3. Verify deploy config supports the implementation
|
|
68
|
+
|
|
69
|
+
## Artifact Index
|
|
70
|
+
|
|
71
|
+
If `knowledge/` or `docs/` exists, maintain a lightweight index at `knowledge-index.md`:
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
| file | summary | key_questions | tags |
|
|
75
|
+
|------|---------|--------------|------|
|
|
76
|
+
| prisma/schema.prisma | User, Assessment, Report tables | What tables exist? What are the relations? | database, schema |
|
|
77
|
+
| openapi.yaml | 12 endpoints, JWT auth | What endpoints are available? What auth is required? | api, auth |
|
|
78
|
+
| terraform/main.tf | AWS ECS + RDS + S3 | What infra is provisioned? What are the limits? | infra, aws |
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Update this index when artifacts change. `/evolve` Cycle 2 refreshes it.
|
|
82
|
+
|
|
83
|
+
## Copilot Mode
|
|
84
|
+
|
|
85
|
+
In copilot mode, artifact discovery runs automatically:
|
|
86
|
+
- Session 1: `/dream` scans for existing artifacts, creates index
|
|
87
|
+
- Per milestone: `/add` reads relevant artifacts before implementing
|
|
88
|
+
- After schema changes: update artifact index
|
|
89
|
+
- `/evolve`: check for stale artifact references
|
|
90
|
+
|
|
91
|
+
## Anti-Patterns
|
|
92
|
+
|
|
93
|
+
- Writing SQL queries without reading the schema first
|
|
94
|
+
- Building API integrations without reading the spec
|
|
95
|
+
- Deploying without checking infra constraints
|
|
96
|
+
- Ignoring knowledge/ directory when it exists
|