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,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evolve
|
|
3
|
+
description: >
|
|
4
|
+
Scan environment for gaps, generate improvements, consolidate knowledge.
|
|
5
|
+
/evolve quick — detect only (~500 tokens, no fixes). Use after small sessions.
|
|
6
|
+
/evolve — full cycle with fixes. Run after significant work or end of week.
|
|
7
|
+
disable-model-invocation: true
|
|
8
|
+
context: fork
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# /evolve — Environment Evolution
|
|
12
|
+
|
|
13
|
+
$ARGUMENTS
|
|
14
|
+
|
|
15
|
+
## Step 0: Scope Gate
|
|
16
|
+
|
|
17
|
+
If $ARGUMENTS == "quick":
|
|
18
|
+
- Run DETECT only (read detect.md, output PLAN)
|
|
19
|
+
- Skip GENERATE, EVALUATE, Cycle 2, Cycle 3
|
|
20
|
+
- Skip EnterWorktree
|
|
21
|
+
- Output: gap list with file:line references — no fixes applied
|
|
22
|
+
- Cost: ~500 tokens. Use after small sessions or quick checks.
|
|
23
|
+
- Print: `PLAN (quick mode — gaps listed, not fixed):`
|
|
24
|
+
|
|
25
|
+
If $ARGUMENTS is blank or "full": run all cycles below.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Step 0b: Check for Loop Controller (Level 10)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
ls .claude/agents/loop-controller.md 2>/dev/null
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**If loop-controller.md exists**: delegate ALL evolution work to it via Agent tool:
|
|
36
|
+
```
|
|
37
|
+
Run a full evolution cycle: re-derivation check, then Cycle 1 (detect/generate/evaluate),
|
|
38
|
+
Cycle 2 (knowledge consolidation if 3+ sessions), Cycle 3 (topology if friction detected).
|
|
39
|
+
Show the full cycle report when done.
|
|
40
|
+
```
|
|
41
|
+
**STOP HERE** — do not run the steps below.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
**If loop-controller.md does not exist** (Levels 3–9): run manually below.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Step 1: Isolate (Worktree)
|
|
50
|
+
|
|
51
|
+
Use **EnterWorktree** — create branch `azclaude/evolve-{date}`.
|
|
52
|
+
All cycle work happens here. Environment changes do not touch main until evaluated.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Cycle 0.5: Structural Analysis (before detection)
|
|
57
|
+
|
|
58
|
+
Run both analysis scripts for structural insight:
|
|
59
|
+
```bash
|
|
60
|
+
bash .claude/scripts/import-graph.sh
|
|
61
|
+
bash .claude/scripts/validate-boundaries.sh
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**import-graph.sh** outputs: most-imported files, circular dependency warnings, co-change clusters.
|
|
65
|
+
**validate-boundaries.sh** outputs: manifest completeness, description overlap between extensions, orphaned agents, Claude Code collision check.
|
|
66
|
+
|
|
67
|
+
Feed these signals into Cycle 1 detection:
|
|
68
|
+
- Circular deps → architectural gaps
|
|
69
|
+
- Co-change clusters → agent candidates
|
|
70
|
+
- Description overlap → merge or split extensions
|
|
71
|
+
- Orphaned agents → remove or wire into commands
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Cycle 1: Detect → Generate → Evaluate
|
|
76
|
+
|
|
77
|
+
**Step 1**: Read `capabilities/evolution/detect.md` and run DETECT.
|
|
78
|
+
Include import-graph output as input. Circular deps = high-priority gaps.
|
|
79
|
+
Outputs: PLAN (list of gaps, rot types, sequence candidates)
|
|
80
|
+
|
|
81
|
+
**Step 2**: If PLAN has items → read `capabilities/evolution/generate.md` and run GENERATE.
|
|
82
|
+
Outputs: new or updated capability files
|
|
83
|
+
|
|
84
|
+
**Step 3**: Read `capabilities/evolution/evaluate.md` and run EVALUATE.
|
|
85
|
+
Outputs: quality-gated files, tagged as GENERAL or NARROW
|
|
86
|
+
|
|
87
|
+
If PLAN is empty: skip to Cycle 2.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Cycle 2: Knowledge Consolidation (if sessions ≥ 3 since last consolidation)
|
|
92
|
+
|
|
93
|
+
Read `capabilities/evolution/cycle2-knowledge.md` and run.
|
|
94
|
+
Outputs: consolidated patterns, pruned stale memory, enriched knowledge-index
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Cycle 3: Topology (if /level-up or topology friction detected)
|
|
99
|
+
|
|
100
|
+
Read `capabilities/evolution/cycle3-topology.md` and run.
|
|
101
|
+
Outputs: optimized pipeline map, pruned obsolete agents, updated manifest token estimates
|
|
102
|
+
|
|
103
|
+
After topology optimization, run semantic boundary check:
|
|
104
|
+
1. If `validate-boundaries.sh` reported warnings → load `capabilities/shared/semantic-boundary-check.md`
|
|
105
|
+
2. Classify all flagged pairs as REDUNDANT / OVERLAPPING / COMPLEMENTARY / CLEAN
|
|
106
|
+
3. Apply fixes: merge redundant, extract shared, clarify complementary
|
|
107
|
+
4. Record decisions in `.claude/memory/decisions.md`
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Re-Derivation Check (run before any cycle if friction is high)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
ls ops/observations/ | wc -l
|
|
115
|
+
```
|
|
116
|
+
If ≥ 10 friction logs AND grep shows same pattern in ≥ 5:
|
|
117
|
+
Read `capabilities/evolution/re-derivation.md` and run BEFORE any generate.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Completion: Merge or Discard
|
|
122
|
+
|
|
123
|
+
After Evaluate passes all quality gates:
|
|
124
|
+
- **ExitWorktree** and merge to main
|
|
125
|
+
- If evaluate failed: ExitWorktree (discard) — no partial improvements on main
|
|
126
|
+
|
|
127
|
+
Then offer scheduling:
|
|
128
|
+
```
|
|
129
|
+
Schedule /evolve to run automatically?
|
|
130
|
+
Use CronCreate — weekly (Sunday 9am) recommended.
|
|
131
|
+
```
|
|
132
|
+
Use **CronList** to check if a schedule already exists before creating a new one.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Step 6: Log Evolution History
|
|
137
|
+
|
|
138
|
+
Append to `ops/evolution-log.md` (create if missing):
|
|
139
|
+
```
|
|
140
|
+
| {date} | {before score}/100 | {after score}/100 | {+delta} | {1-line summary of what changed} |
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
If the file doesn't exist, create it with this header:
|
|
144
|
+
```
|
|
145
|
+
# Evolution History
|
|
146
|
+
|
|
147
|
+
| Date | Before | After | Delta | Summary |
|
|
148
|
+
|------|--------|-------|-------|---------|
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Step 7: Promote GENERAL Skills
|
|
154
|
+
|
|
155
|
+
For any fix tagged GENERAL in EVALUATE:
|
|
156
|
+
1. Copy to `~/shared-skills/{name}.md`
|
|
157
|
+
2. Add `discovered_in: {project}` to frontmatter
|
|
158
|
+
3. Update `~/shared-skills/.checksums` with sha256 hash
|
|
159
|
+
4. Print: `Promoted to ~/shared-skills/{name}.md`
|
|
160
|
+
|
|
161
|
+
Skip this step if all fixes were tagged NARROW.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Completion Rule
|
|
166
|
+
Print the PLAN that was detected.
|
|
167
|
+
Print the list of files created or updated.
|
|
168
|
+
Print the updated goals.md.
|
|
169
|
+
Print the evolution-log.md entry.
|
|
170
|
+
Show the files — do not say "evolution complete" without showing output.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explain
|
|
3
|
+
description: Explain code, errors, or concepts in plain language — no jargon, 2-3 paragraphs max.
|
|
4
|
+
argument-hint: "[code snippet, error message, file name, or concept]"
|
|
5
|
+
allowed-tools: Read, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /explain — Plain Language Explanation
|
|
9
|
+
|
|
10
|
+
Explain this to me like I'm not a developer:
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Rules:
|
|
17
|
+
- Simple, everyday language — no jargon
|
|
18
|
+
- If code was pasted: explain what it does step by step
|
|
19
|
+
- If an error was pasted: explain what went wrong and how to fix it
|
|
20
|
+
- If a file or folder was named: read it and explain what it's for
|
|
21
|
+
- If a concept was asked: explain it with a real-world analogy
|
|
22
|
+
- Keep it short — 2-3 paragraphs max unless more detail is asked for
|
|
23
|
+
|
|
24
|
+
If nothing was provided above, ask:
|
|
25
|
+
"What would you like me to explain? You can paste code, an error message, a file name, or ask about any concept."
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: find
|
|
3
|
+
description: >
|
|
4
|
+
Search for reusable skills across ~/shared-skills/ and project commands.
|
|
5
|
+
Triggers on: "find skill", "is there a skill for", "search commands",
|
|
6
|
+
"what skills exist", "find a command for", "do we have a skill that".
|
|
7
|
+
argument-hint: "[what you're looking for — e.g. 'testing', 'deploy', 'review']"
|
|
8
|
+
disable-model-invocation: true
|
|
9
|
+
allowed-tools: Read, Glob, Grep, Bash
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /find — Skill Discovery
|
|
13
|
+
|
|
14
|
+
$ARGUMENTS
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Step 1: Search Local Skills
|
|
19
|
+
|
|
20
|
+
Search project commands first — they're tailored to this project:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# List all project commands with descriptions
|
|
24
|
+
for f in .claude/commands/*.md; do
|
|
25
|
+
name=$(basename "$f" .md)
|
|
26
|
+
desc=$(grep -A1 "^description:" "$f" | tail -1 | sed 's/^ *//')
|
|
27
|
+
echo " /$name — $desc"
|
|
28
|
+
done
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If $ARGUMENTS provided, filter by keyword:
|
|
32
|
+
```bash
|
|
33
|
+
grep -li "$ARGUMENTS" .claude/commands/*.md 2>/dev/null
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Step 2: Search Shared Skills
|
|
39
|
+
|
|
40
|
+
Search `~/shared-skills/` — portable skills that work across projects:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ls ~/shared-skills/*.md 2>/dev/null | while read f; do
|
|
44
|
+
name=$(basename "$f" .md)
|
|
45
|
+
desc=$(grep -A1 "^description:" "$f" | tail -1 | sed 's/^ *//')
|
|
46
|
+
echo " $name — $desc"
|
|
47
|
+
done
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If $ARGUMENTS provided:
|
|
51
|
+
```bash
|
|
52
|
+
grep -li "$ARGUMENTS" ~/shared-skills/*.md 2>/dev/null
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 3: Search Capabilities
|
|
58
|
+
|
|
59
|
+
Some functionality lives in capabilities, not commands:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
grep -i "$ARGUMENTS" .claude/capabilities/manifest.md 2>/dev/null
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Step 4: Present Results
|
|
68
|
+
|
|
69
|
+
Format results as a table:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
## Skills matching "{query}"
|
|
73
|
+
|
|
74
|
+
### Project Commands (this project)
|
|
75
|
+
| Command | Description | File |
|
|
76
|
+
|---------|-------------|------|
|
|
77
|
+
|
|
78
|
+
### Shared Skills (all projects)
|
|
79
|
+
| Skill | Description | File |
|
|
80
|
+
|-------|-------------|------|
|
|
81
|
+
|
|
82
|
+
### Capabilities
|
|
83
|
+
| Capability | When to load | Tokens |
|
|
84
|
+
|------------|-------------|--------|
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If no results found:
|
|
88
|
+
```
|
|
89
|
+
No skills found matching "{query}".
|
|
90
|
+
|
|
91
|
+
Options:
|
|
92
|
+
1. Run /create {query} — build a new command for this
|
|
93
|
+
2. Check ~/shared-skills/ — portable skills from other projects
|
|
94
|
+
3. Ask: "I need a skill that does X" — and I'll help you build one
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Completion Rule
|
|
100
|
+
Show the results table. Do not say "search complete" without showing matches.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix
|
|
3
|
+
description: Reproduce → investigate root cause → hypothesize → fix and verify. Never guesses. Never says "should work".
|
|
4
|
+
argument-hint: "[error message, failing test, or bug description]"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
allowed-tools: Read, Grep, Bash, Edit, Write
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /fix — 4-Phase Debugging Protocol
|
|
10
|
+
|
|
11
|
+
$ARGUMENTS
|
|
12
|
+
|
|
13
|
+
Load: shared/tdd.md + shared/completion-rule.md before starting.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Phase 1: REPRODUCE
|
|
18
|
+
|
|
19
|
+
**First: check IDE diagnostics (instant, no build needed)**
|
|
20
|
+
Use `mcp__ide__getDiagnostics` — if available and returns errors, treat those as the reproduction.
|
|
21
|
+
Map each diagnostic to `file:line:message` and carry it directly into Phase 2.
|
|
22
|
+
|
|
23
|
+
**If IDE diagnostics unavailable or empty**: run the failing test or command exactly as described.
|
|
24
|
+
- Paste the actual output — never summarize it
|
|
25
|
+
- If you cannot reproduce it: stop. Use **AskUserQuestion** to ask for exact steps. Do not guess.
|
|
26
|
+
|
|
27
|
+
No investigation before reproduction. No fix before root cause.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Phase 2: INVESTIGATE
|
|
32
|
+
|
|
33
|
+
Read the code. Do not guess.
|
|
34
|
+
- Locate the failure point: `file:line`
|
|
35
|
+
- Read the actual code at that location
|
|
36
|
+
- Read what calls it and what it calls
|
|
37
|
+
- Check recent changes: `git log --oneline -10 -- {file}`
|
|
38
|
+
- Read test framework config: `package.json` / `requirements.txt` / `Cargo.toml`
|
|
39
|
+
|
|
40
|
+
Antipattern check — if `antipatterns.md` exists, read it before proceeding.
|
|
41
|
+
|
|
42
|
+
Rules:
|
|
43
|
+
- No fix hypothesis before root cause is confirmed in code
|
|
44
|
+
- No "I think the problem is" without reading the actual file
|
|
45
|
+
- No changes to files not involved in the failure
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Phase 3: HYPOTHESIZE
|
|
50
|
+
|
|
51
|
+
One root cause. Not a list.
|
|
52
|
+
|
|
53
|
+
Fill this checkpoint before writing any code:
|
|
54
|
+
```
|
|
55
|
+
Root cause: [file:line]
|
|
56
|
+
Mechanism: [why it breaks — the cause, not the symptom]
|
|
57
|
+
Fix: [what you will change — described before touching any file]
|
|
58
|
+
Confidence: [high / medium / low]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**If confidence = low → do not proceed to Phase 4.**
|
|
62
|
+
Go back to Phase 2. Read more code. You do not understand the problem yet.
|
|
63
|
+
|
|
64
|
+
**If confidence = medium**: Use **EnterWorktree** before making any changes.
|
|
65
|
+
The fix is uncertain — isolate it. Merge to main only if tests pass.
|
|
66
|
+
If tests fail: ExitWorktree (discard), go back to Phase 2.
|
|
67
|
+
|
|
68
|
+
If you have multiple hypotheses: pick the most likely one. Test it first.
|
|
69
|
+
Do not write multiple fixes speculatively.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Phase 4: FIX
|
|
74
|
+
|
|
75
|
+
1. Write the minimal change that addresses the root cause
|
|
76
|
+
2. Run the test with an exit-code gate:
|
|
77
|
+
```bash
|
|
78
|
+
{test command}; EXIT=$?
|
|
79
|
+
echo "Exit: $EXIT"
|
|
80
|
+
if [ $EXIT -ne 0 ]; then echo "FAILED — do not proceed"; fi
|
|
81
|
+
```
|
|
82
|
+
3. If EXIT ≠ 0: do NOT say "should work" — go to Self-Correction Loop
|
|
83
|
+
4. If EXIT = 0: run the full test suite — paste the output
|
|
84
|
+
5. Reference every change as `file:line — what changed and why`
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Self-Correction Loop
|
|
89
|
+
|
|
90
|
+
**Attempt 2 — gate before asking the user:**
|
|
91
|
+
|
|
92
|
+
Re-read the error. Classify it:
|
|
93
|
+
- **Different error** → new failure point → go back to Phase 2 with the new `file:line`
|
|
94
|
+
- **Same error** → wrong root cause → re-read the code at the failure point, find what you missed
|
|
95
|
+
|
|
96
|
+
If the error references a third-party library and no local docs exist:
|
|
97
|
+
**WebSearch** `"{library} {error message}"` — use the result to inform Attempt 2. One search, not a loop.
|
|
98
|
+
|
|
99
|
+
Make one targeted change. Run the exit-code gate again. Paste the output.
|
|
100
|
+
|
|
101
|
+
**After 2 failed attempts — structured escalation:**
|
|
102
|
+
|
|
103
|
+
Do not guess a third time. Report exactly:
|
|
104
|
+
```
|
|
105
|
+
Attempt 1: [file:line — what was changed]
|
|
106
|
+
Result 1: [exact error output — not a summary]
|
|
107
|
+
|
|
108
|
+
Attempt 2: [file:line — what was changed]
|
|
109
|
+
Result 2: [exact error output — not a summary]
|
|
110
|
+
|
|
111
|
+
Stuck at: [file:line]
|
|
112
|
+
Need: [specific information or decision that would unblock this]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The user is the last resort, not the first.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
**Completion Rule — NON-NEGOTIABLE:**
|
|
120
|
+
Never say "this should be fixed", "probably works now", "I think this resolves it."
|
|
121
|
+
Show the passing test output. If tests aren't passing: stay in progress.
|
|
122
|
+
"Show the output or stay in progress."
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hookify
|
|
3
|
+
description: >
|
|
4
|
+
Generate hooks from conversation friction. Analyzes recent session patterns
|
|
5
|
+
to create PreToolUse or PostToolUse hooks that prevent unwanted behaviors.
|
|
6
|
+
Triggers on: "hookify", "create a hook", "make a hook", "prevent this",
|
|
7
|
+
"stop doing that", "block this pattern", "warn when", "never do X again".
|
|
8
|
+
argument-hint: "[behavior to prevent — or blank to scan conversation]"
|
|
9
|
+
disable-model-invocation: true
|
|
10
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# /hookify — Generate Hooks From Friction
|
|
14
|
+
|
|
15
|
+
$ARGUMENTS
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 1: Identify the Pattern
|
|
20
|
+
|
|
21
|
+
**If $ARGUMENTS is provided:** Use the explicit description as the pattern.
|
|
22
|
+
|
|
23
|
+
**If $ARGUMENTS is blank:** Scan recent conversation for friction signals:
|
|
24
|
+
- User corrections: "no, not that", "don't do X", "I said Y not Z"
|
|
25
|
+
- Repeated undos: same edit reverted 2+ times
|
|
26
|
+
- Explicit frustration: "stop", "again?", "why does it keep"
|
|
27
|
+
|
|
28
|
+
Present detected patterns and ask which to hookify.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 2: Classify the Hook Type
|
|
33
|
+
|
|
34
|
+
| Pattern Type | Hook Event | Action |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| Dangerous command (rm -rf, force push) | PreToolUse, matcher: Bash | Block or warn |
|
|
37
|
+
| Unsafe code pattern (eval, exec, pickle) | PreToolUse, matcher: Edit\|Write | Warn |
|
|
38
|
+
| File protection (.env, credentials) | PreToolUse, matcher: Write\|Edit | Block |
|
|
39
|
+
| Missing step (forgot tests, forgot lint) | PostToolUse, matcher: Write\|Edit | Remind |
|
|
40
|
+
| Session behavior (too verbose, skipping) | UserPromptSubmit | Inject reminder |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Step 3: Generate the Hook
|
|
45
|
+
|
|
46
|
+
Create the hook script in `.claude/hooks/`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
#!/usr/bin/env bash
|
|
50
|
+
# .claude/hooks/{action}-{pattern-name}.sh
|
|
51
|
+
# Purpose: {what this prevents}
|
|
52
|
+
# Generated by /hookify on {date}
|
|
53
|
+
set -euo pipefail
|
|
54
|
+
|
|
55
|
+
# Read tool input from stdin
|
|
56
|
+
INPUT=$(cat)
|
|
57
|
+
|
|
58
|
+
# Check for the pattern
|
|
59
|
+
if echo "$INPUT" | grep -qE '{PATTERN_REGEX}'; then
|
|
60
|
+
echo "⚠ {WARNING_MESSAGE}"
|
|
61
|
+
# For blocking hooks, exit with non-zero:
|
|
62
|
+
# exit 1
|
|
63
|
+
fi
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Step 4: Register the Hook
|
|
69
|
+
|
|
70
|
+
Add to `.claude/settings.json` or project hooks config:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"hooks": {
|
|
75
|
+
"{EVENT_TYPE}": [{
|
|
76
|
+
"matcher": "{TOOL_MATCHER}",
|
|
77
|
+
"hooks": [{"type": "command", "command": "bash .claude/hooks/{script-name}.sh"}]
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Step 5: Verify
|
|
86
|
+
|
|
87
|
+
Show the user:
|
|
88
|
+
1. What pattern was detected
|
|
89
|
+
2. What hook was generated
|
|
90
|
+
3. How to test it: "Try the action that was causing the problem"
|
|
91
|
+
4. How to disable it: "Delete the hook file or remove from settings"
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Rules
|
|
96
|
+
- Warn by default, block only for dangerous operations (rm -rf, secrets, force push)
|
|
97
|
+
- One hook per behavior — never combine unrelated patterns
|
|
98
|
+
- Always show the hook script to the user before activating
|
|
99
|
+
- Include a comment header with purpose and generation date
|
|
100
|
+
- If the pattern requires reasoning (not just matching), suggest a skill instead
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: level-up
|
|
3
|
+
description: Scan current environment level (0–10), show what exists and what's missing, then build the next level.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /level-up — Scan and Build Next Level
|
|
8
|
+
|
|
9
|
+
Scan the current environment, then build what's missing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Step 1: Detect Current Level
|
|
14
|
+
|
|
15
|
+
Check what exists:
|
|
16
|
+
```bash
|
|
17
|
+
[ -f CLAUDE.md ] && echo "L1: CLAUDE.md ✓" || echo "L1: CLAUDE.md ✗"
|
|
18
|
+
[ -f .mcp.json ] && echo "L2: MCP ✓" || echo "L2: MCP ✗"
|
|
19
|
+
[ -d .claude/commands ] && ls .claude/commands/*.md 2>/dev/null | wc -l | xargs -I{} echo "L3: {} skill(s) ✓" || echo "L3: Skills ✗"
|
|
20
|
+
[ -f .claude/memory/goals.md ] && echo "L4: Memory ✓" || echo "L4: Memory ✗"
|
|
21
|
+
[ -d .claude/agents ] && ls .claude/agents/*.md 2>/dev/null | wc -l | xargs -I{} echo "L5: {} agent(s) ✓" || echo "L5: Agents ✗"
|
|
22
|
+
[ -f ~/.claude/settings.json ] && grep -q "_azclaude" ~/.claude/settings.json && echo "L6: Hooks ✓" || echo "L6: Hooks ✗"
|
|
23
|
+
[ -f .mcp.json ] && grep -q "external\|browser\|database" .mcp.json 2>/dev/null && echo "L7: External MCP ✓" || echo "L7: External MCP ✗"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Show result as a visual checklist. State current level clearly:
|
|
27
|
+
"You are at Level N. Next: Level N+1."
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Step 2: Build Next Level
|
|
32
|
+
|
|
33
|
+
**TaskCreate**: `Build Level {N+1} — {level name}` with status `in_progress`.
|
|
34
|
+
|
|
35
|
+
Read `.claude/capabilities/manifest.md`, find the matching `level-builders/level{N+1}.md`, load it, and build that level.
|
|
36
|
+
|
|
37
|
+
Load ONE level builder at a time — not all of them.
|
|
38
|
+
|
|
39
|
+
**TaskUpdate → completed** when the level builder finishes.
|
|
40
|
+
|
|
41
|
+
If already at Level 7: run `/evolve` instead. The environment is built — now improve what's inside it.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Completion Rule
|
|
46
|
+
Show what was created.
|
|
47
|
+
Show the updated level checklist.
|
|
48
|
+
Do not say "level complete" without showing the new files.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loop
|
|
3
|
+
description: Run a command or prompt on a recurring schedule using native Claude Code cron.
|
|
4
|
+
argument-hint: "[interval: 5m/10m/30m/1h/daily/weekly] [command or prompt]"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
allowed-tools: Bash
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /loop — Recurring Task
|
|
10
|
+
|
|
11
|
+
$ARGUMENTS
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Step 1: Parse Arguments
|
|
16
|
+
|
|
17
|
+
Extract from $ARGUMENTS:
|
|
18
|
+
- **Interval**: `5m`, `10m`, `30m`, `1h`, `daily`, `weekly` — default `10m` if not specified
|
|
19
|
+
- **Command**: everything after the interval token (e.g. `/pulse`, `/fix`, a prompt)
|
|
20
|
+
|
|
21
|
+
If blank, use **AskUserQuestion**:
|
|
22
|
+
- What should run? (e.g. `/pulse`, `/fix`, `check if the deploy succeeded`)
|
|
23
|
+
- How often? (5m / 10m / 30m / 1h / daily / weekly)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Step 2: Map Interval to Cron Expression
|
|
28
|
+
|
|
29
|
+
| Argument | Cron expression |
|
|
30
|
+
|----------|----------------|
|
|
31
|
+
| `5m` | `*/5 * * * *` |
|
|
32
|
+
| `10m` | `*/10 * * * *` |
|
|
33
|
+
| `30m` | `*/30 * * * *` |
|
|
34
|
+
| `1h` | `0 * * * *` |
|
|
35
|
+
| `daily` | `0 9 * * *` |
|
|
36
|
+
| `weekly` | `0 9 * * 1` |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 3: Create the Cron Job
|
|
41
|
+
|
|
42
|
+
Use **CronCreate** with:
|
|
43
|
+
- The mapped cron expression
|
|
44
|
+
- The command or prompt from Step 1
|
|
45
|
+
|
|
46
|
+
Run the command once immediately so the user sees it working.
|
|
47
|
+
|
|
48
|
+
Then confirm:
|
|
49
|
+
```
|
|
50
|
+
Scheduled: {command} every {interval}
|
|
51
|
+
Use CronList to view active schedules.
|
|
52
|
+
Use CronDelete to cancel.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Stopping
|
|
58
|
+
|
|
59
|
+
If $ARGUMENTS contains `stop` or `cancel`:
|
|
60
|
+
1. **CronList** — show active schedules
|
|
61
|
+
2. **CronDelete** the matching entry
|
|
62
|
+
3. Confirm: "Cancelled: {command}"
|