continuous-improvement 3.0.0 → 3.8.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 +78 -0
- package/CHANGELOG.md +210 -0
- package/LICENSE +21 -21
- package/QUICKSTART.md +101 -81
- package/README.md +224 -198
- package/SKILL.md +87 -9
- package/action.yml +33 -0
- package/bin/analyze.sh +161 -153
- package/bin/backfill.mjs +172 -0
- package/bin/check-docs-substrings.mjs +333 -0
- package/bin/check-everything-mirror.mjs +145 -0
- package/bin/check-routing-targets.mjs +151 -0
- package/bin/check-skill-law-tag.mjs +128 -0
- package/bin/check-skill-mirror.mjs +119 -0
- package/bin/check-skill-tiers.mjs +116 -0
- package/bin/check-third-party-shape.mjs +202 -0
- package/bin/generate-plugin-manifests.mjs +169 -0
- package/bin/harvest-friction.mjs +279 -0
- package/bin/hook-stats.mjs +258 -0
- package/bin/install.mjs +418 -456
- package/bin/lint-transcript.mjs +239 -0
- package/bin/mcp-server.mjs +842 -499
- package/bin/observe.mjs +148 -0
- package/bin/pre-commit-block-strays.sh +49 -0
- package/bin/refresh-third-party.mjs +416 -0
- package/bin/unified-cli.mjs +533 -0
- package/commands/continuous-improvement.md +115 -74
- package/commands/dashboard.md +56 -0
- package/commands/discipline.md +51 -0
- package/commands/harvest.md +76 -0
- package/commands/learn-eval.md +117 -0
- package/commands/planning-with-files.md +66 -0
- package/commands/proceed-with-the-recommendation.md +62 -0
- package/commands/ralph.md +103 -0
- package/commands/release-train.md +81 -0
- package/commands/seven-laws.md +16 -0
- package/commands/superpowers.md +153 -0
- package/commands/swarm.md +101 -0
- package/commands/workspace-surface-audit.md +77 -0
- package/hooks/observe.sh +172 -134
- package/hooks/session.sh +106 -106
- package/hooks/three-section-close.mjs +181 -0
- package/instinct-packs/go.json +58 -0
- package/instinct-packs/meta.json +16 -0
- package/instinct-packs/python.json +58 -0
- package/instinct-packs/react.json +58 -0
- package/lib/cli-anything.mjs +401 -0
- package/lib/compound-engineering.mjs +831 -0
- package/lib/observe-event.mjs +128 -0
- package/lib/plugin-metadata.mjs +432 -0
- package/lib/pm-marketplace.mjs +61 -0
- package/lib/pm-skills.mjs +1274 -0
- package/lib/resolve-home-dir.mjs +43 -0
- package/lib/skill-tiers.mjs +137 -0
- package/lib/unified-plugin.mjs +924 -0
- package/llms.txt +68 -0
- package/package.json +38 -15
- package/plugins/beginner.json +17 -6
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
- package/plugins/continuous-improvement/LICENSE +21 -0
- package/plugins/continuous-improvement/README.md +56 -0
- package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +886 -0
- package/plugins/continuous-improvement/bin/observe.mjs +148 -0
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
- package/plugins/continuous-improvement/commands/dashboard.md +56 -0
- package/plugins/continuous-improvement/commands/discipline.md +51 -0
- package/plugins/continuous-improvement/commands/harvest.md +76 -0
- package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
- package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
- package/plugins/continuous-improvement/commands/ralph.md +103 -0
- package/plugins/continuous-improvement/commands/release-train.md +81 -0
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
- package/plugins/continuous-improvement/commands/superpowers.md +153 -0
- package/plugins/continuous-improvement/commands/swarm.md +101 -0
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
- package/plugins/continuous-improvement/hooks/hooks.json +60 -0
- package/plugins/continuous-improvement/hooks/observe.sh +172 -0
- package/plugins/continuous-improvement/hooks/session.sh +106 -0
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
- package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +432 -0
- package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
- package/plugins/continuous-improvement/skills/README.md +34 -0
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +131 -0
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +155 -0
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +454 -0
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +212 -0
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +192 -0
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
- package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
- package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
- package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
- package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
- package/plugins/expert.json +34 -5
- package/skills/README.md +79 -0
- package/skills/deploy-receipt.md +131 -0
- package/skills/gateguard.md +155 -0
- package/skills/para-memory-files.md +108 -0
- package/skills/proceed-with-the-recommendation.md +454 -0
- package/skills/ralph.md +221 -0
- package/skills/safety-guard.md +76 -0
- package/skills/strategic-compact.md +104 -0
- package/skills/superpowers.md +212 -0
- package/skills/tdd-workflow.md +411 -0
- package/skills/token-budget-advisor.md +136 -0
- package/skills/verification-loop.md +192 -0
- package/skills/wild-risa-balance.md +191 -0
- package/skills/workspace-surface-audit.md +147 -0
- package/templates/planning-with-files/findings.md +8 -0
- package/templates/planning-with-files/progress.md +7 -0
- package/templates/planning-with-files/task_plan.md +23 -0
- package/templates/verify-ladder.example.json +47 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph
|
|
3
|
+
tier: companion
|
|
4
|
+
description: "Enforces Law 6 (Iterate Means One Thing) of the 7 Laws of AI Agent Discipline at PRD scale. Ralph is an autonomous AI agent loop that runs repeatedly until all PRD items are complete. Converts PRDs to executable JSON, implements stories iteratively with quality checks, and tracks progress."
|
|
5
|
+
origin: https://github.com/snarktank/ralph
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ralph — Autonomous Agent Loop
|
|
9
|
+
|
|
10
|
+
Ralph runs iteratively until all PRD stories are complete. Each iteration: picks highest priority story, implements, runs quality checks, commits if passing, updates progress, repeats.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Large features that exceed a single context window
|
|
15
|
+
- Multi-story PRDs that need consistent implementation
|
|
16
|
+
- Tasks requiring repeated verification and commit cycles
|
|
17
|
+
- Long-running development that benefits from persistence across interruptions
|
|
18
|
+
|
|
19
|
+
## Do NOT Use When
|
|
20
|
+
|
|
21
|
+
- Task is a one-shot fix completable in a single edit — just edit the file
|
|
22
|
+
- You haven't written a PRD yet — write the PRD first, then run Ralph against it
|
|
23
|
+
- The work spans fewer than 3 stories — single-iteration verification is enough
|
|
24
|
+
- You need to explore or plan before committing to scope — use a planning skill first; Ralph is for execution, not discovery
|
|
25
|
+
- You want manual control over each iteration — run quality checks yourself, no need for Ralph's loop
|
|
26
|
+
|
|
27
|
+
## Prerequisites
|
|
28
|
+
|
|
29
|
+
- Git repository
|
|
30
|
+
- PRD document (markdown format)
|
|
31
|
+
- `jq` installed (`brew install jq` on macOS)
|
|
32
|
+
|
|
33
|
+
## Workflow
|
|
34
|
+
|
|
35
|
+
### 1. Create a PRD
|
|
36
|
+
|
|
37
|
+
Generate a detailed requirements document using the PRD skill:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Load the prd skill and create a PRD for [your feature description]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Output saved to `tasks/prd-[feature-name].md`
|
|
44
|
+
|
|
45
|
+
**CRITICAL — refine generic criteria before iteration begins.** Auto-generated PRD scaffolds often produce generic acceptance criteria like `["Implementation is complete", "Code compiles without errors"]`. These are theater — Ralph cannot prove a story passes against criteria that don't actually constrain it. Replace every generic criterion with a concrete, testable statement before moving to step 2.
|
|
46
|
+
|
|
47
|
+
- Bad: `"Function is implemented correctly"`
|
|
48
|
+
- Good: `"Function parseUserInput(s) returns {ok: true, value} for valid s and {ok: false, error} for invalid s, asserted by tests/parse-user-input.test.ts"`
|
|
49
|
+
- Bad: `"Code compiles"`
|
|
50
|
+
- Good: `"TypeScript compiles with no errors (npm run build) AND lsp diagnostics show 0 errors on src/parse-user-input.ts"`
|
|
51
|
+
|
|
52
|
+
If you cannot write a testable criterion, the story is too big. Break it down before continuing.
|
|
53
|
+
|
|
54
|
+
**Example — refining a scaffold criterion**
|
|
55
|
+
|
|
56
|
+
Auto-generated:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
"acceptanceCriteria": [
|
|
60
|
+
"Implementation is complete",
|
|
61
|
+
"Code compiles without errors"
|
|
62
|
+
]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
After refinement:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
"acceptanceCriteria": [
|
|
69
|
+
"POST /api/users returns 201 with {id, email} for valid input, asserted by tests/api-users.test.ts",
|
|
70
|
+
"POST /api/users returns 400 with {error} for missing email, asserted by tests/api-users.test.ts",
|
|
71
|
+
"TypeScript compiles with 0 errors (npm run build)",
|
|
72
|
+
"lsp diagnostics show 0 errors on src/api/users.ts"
|
|
73
|
+
]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. Convert PRD to Ralph Format
|
|
77
|
+
|
|
78
|
+
Convert the markdown PRD to executable JSON:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Load the ralph skill and convert tasks/prd-[feature-name].md to prd.json
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This creates `prd.json` with user stories structured for autonomous execution.
|
|
85
|
+
|
|
86
|
+
### 3. Run Ralph
|
|
87
|
+
|
|
88
|
+
Execute the autonomous loop:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Using Amp (default)
|
|
92
|
+
./scripts/ralph/ralph.sh [max_iterations]
|
|
93
|
+
|
|
94
|
+
# Using Claude Code
|
|
95
|
+
./scripts/ralph/ralph.sh --tool claude [max_iterations]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Default: 10 iterations. Use `--tool amp` or `--tool claude` to select your AI tool.
|
|
99
|
+
|
|
100
|
+
## Ralph Loop Steps
|
|
101
|
+
|
|
102
|
+
1. **Create feature branch** — from PRD `branchName`
|
|
103
|
+
2. **Pick highest priority story** — where `passes: false`
|
|
104
|
+
3. **Implement that single story** — fresh context per iteration
|
|
105
|
+
4. **Run quality checks** — verify the current story's specific acceptance criteria with fresh evidence:
|
|
106
|
+
- For EACH acceptance criterion, run the test/build/lint that proves it
|
|
107
|
+
- Read the output, do not assume
|
|
108
|
+
- If ANY criterion is not met, continue working — do NOT mark the story as `passes: true`
|
|
109
|
+
- **Suite-level "all tests pass" is NOT a substitute for criterion-level proof.**
|
|
110
|
+
|
|
111
|
+
**Example — story-by-story verification**
|
|
112
|
+
|
|
113
|
+
Bad:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Story US-002: "Add /api/users endpoint"
|
|
117
|
+
- Ran npm test → all green → marked passes: true
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Why bad: suite-level pass doesn't prove THIS story's criteria. Other tests could be passing while the new endpoint is broken.
|
|
121
|
+
|
|
122
|
+
Good:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Story US-002: "Add /api/users endpoint"
|
|
126
|
+
- Criterion 1: POST /api/users → 201 → ran `npx vitest tests/api-users.test.ts -t "valid input"` → PASS
|
|
127
|
+
- Criterion 2: POST /api/users → 400 → ran `npx vitest tests/api-users.test.ts -t "missing email"` → PASS
|
|
128
|
+
- Criterion 3: typecheck → ran `npm run build` → 0 errors
|
|
129
|
+
- All criteria met with fresh evidence → marked passes: true
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Why good: each criterion proven with a targeted run; the output was read before the mark.
|
|
133
|
+
|
|
134
|
+
5. **Commit if checks pass** — atomic commits per story
|
|
135
|
+
6. **Update prd.json** — mark story as `passes: true`
|
|
136
|
+
7. **Append learnings** — to `progress.txt`
|
|
137
|
+
8. **Repeat** — until all stories pass or max iterations reached
|
|
138
|
+
|
|
139
|
+
## Key Concepts
|
|
140
|
+
|
|
141
|
+
### Each Iteration = Fresh Context
|
|
142
|
+
|
|
143
|
+
Every story gets a clean slate. Previous work is visible only via git history and `prd.json`, preventing context pollution.
|
|
144
|
+
|
|
145
|
+
### Small Tasks
|
|
146
|
+
|
|
147
|
+
Stories should be completable in 10-30 minutes. If a story stalls, break it down.
|
|
148
|
+
|
|
149
|
+
### AGENTS.md Updates Are Critical
|
|
150
|
+
|
|
151
|
+
Ralph updates `AGENTS.md` after each story so subsequent iterations know what's already done.
|
|
152
|
+
|
|
153
|
+
### Feedback Loops
|
|
154
|
+
|
|
155
|
+
- Build/test failures: immediate fix or rollback
|
|
156
|
+
- Test failures: investigate before declaring pass
|
|
157
|
+
- Confusion: log to `progress.txt` for human review
|
|
158
|
+
|
|
159
|
+
### Browser Verification for UI Stories
|
|
160
|
+
|
|
161
|
+
Ralph starts a dev server and uses Playwright to verify UI stories actually render.
|
|
162
|
+
|
|
163
|
+
### Stop Condition
|
|
164
|
+
|
|
165
|
+
Ralph stops when:
|
|
166
|
+
- All stories have `passes: true`
|
|
167
|
+
- Max iterations reached
|
|
168
|
+
- Critical failure encountered (user intervention required)
|
|
169
|
+
|
|
170
|
+
## Anti-patterns
|
|
171
|
+
|
|
172
|
+
These thoughts mean STOP — Ralph is about to slip:
|
|
173
|
+
|
|
174
|
+
| Thought | Why it's wrong |
|
|
175
|
+
|---|---|
|
|
176
|
+
| "All stories pass, time to summarise and wait for the user" mid-loop | Polite-stop. Ralph continues through commit + progress update + next pick in the same turn. |
|
|
177
|
+
| "Tests pass at the suite level, the story must be done" | Suite-level pass is not criterion-level proof. Verify each criterion with fresh evidence. |
|
|
178
|
+
| "Story is bigger than expected, I'll mark it passes: true and add a TODO" | Scope reduction. Either complete the story or break it down — never declare partial completion. |
|
|
179
|
+
| "The criterion is generic but obviously the test covers it" | PRD theater. Refine the criterion to something specific before proceeding. |
|
|
180
|
+
| "I'll skip the failing test by deleting/skipping it" | Tests are evidence. Fix the implementation, not the test. |
|
|
181
|
+
| "Reviewer said it looks good" — without running fresh checks | "Looks good" is not verification. Run the build, run the tests, read the output. |
|
|
182
|
+
|
|
183
|
+
## Final Checklist (Hard Gate)
|
|
184
|
+
|
|
185
|
+
Ralph cannot exit cleanly until ALL of these are true:
|
|
186
|
+
|
|
187
|
+
- [ ] Every story in `prd.json` has `passes: true` (no incomplete stories)
|
|
188
|
+
- [ ] Acceptance criteria are task-specific (no `"Implementation is complete"` generics)
|
|
189
|
+
- [ ] All requirements from the original task are met (no scope reduction)
|
|
190
|
+
- [ ] Fresh test run output shows all tests pass (read it, don't assume)
|
|
191
|
+
- [ ] Fresh build output shows success (read it, don't assume)
|
|
192
|
+
- [ ] No tests were deleted, skipped, or weakened to make checks green
|
|
193
|
+
- [ ] `progress.txt` records implementation details and learnings per iteration
|
|
194
|
+
- [ ] Working tree is clean (every story committed atomically)
|
|
195
|
+
|
|
196
|
+
A failing checkbox is a hard halt — do not declare done.
|
|
197
|
+
|
|
198
|
+
## Files
|
|
199
|
+
|
|
200
|
+
- `prd.json` — executable PRD with user stories
|
|
201
|
+
- `progress.txt` — accumulated learnings and status
|
|
202
|
+
- `ralph.sh` — the loop script
|
|
203
|
+
- `AGENTS.md` — iteration memory
|
|
204
|
+
|
|
205
|
+
## Debugging
|
|
206
|
+
|
|
207
|
+
If Ralph gets stuck:
|
|
208
|
+
|
|
209
|
+
1. Check `prd.json` for malformed stories
|
|
210
|
+
2. Review `progress.txt` for accumulated errors
|
|
211
|
+
3. Verify tests pass independently: `npm test` or equivalent
|
|
212
|
+
4. Check git status for uncommitted changes
|
|
213
|
+
5. Run single iteration manually to isolate issues
|
|
214
|
+
|
|
215
|
+
## Customizing the Prompt
|
|
216
|
+
|
|
217
|
+
Edit the prompt template in `scripts/ralph/prompt.md` (Amp) or `scripts/ralph/CLAUDE.md` (Claude Code) to adjust behavior.
|
|
218
|
+
|
|
219
|
+
## Archiving
|
|
220
|
+
|
|
221
|
+
After completion, archive `prd.json` and `progress.txt` to `tasks/archive/[date]/` for future reference.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: safety-guard
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 3 (One Thing at a Time) of the 7 Laws of AI Agent Discipline by scoping edits to a directory and blocking destructive shell commands. Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Safety Guard — Prevent Destructive Operations
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- When working on production systems
|
|
13
|
+
- When agents are running autonomously (full-auto mode)
|
|
14
|
+
- When you want to restrict edits to a specific directory
|
|
15
|
+
- During sensitive operations (migrations, deploys, data changes)
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
Three modes of protection:
|
|
20
|
+
|
|
21
|
+
### Mode 1: Careful Mode
|
|
22
|
+
|
|
23
|
+
Intercepts destructive commands before execution and warns:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Watched patterns:
|
|
27
|
+
- rm -rf (especially /, ~, or project root)
|
|
28
|
+
- git push --force
|
|
29
|
+
- git reset --hard
|
|
30
|
+
- git checkout . (discard all changes)
|
|
31
|
+
- DROP TABLE / DROP DATABASE
|
|
32
|
+
- docker system prune
|
|
33
|
+
- kubectl delete
|
|
34
|
+
- chmod 777
|
|
35
|
+
- sudo rm
|
|
36
|
+
- npm publish (accidental publishes)
|
|
37
|
+
- Any command with --no-verify
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When detected: shows what the command does, asks for confirmation, suggests safer alternative.
|
|
41
|
+
|
|
42
|
+
### Mode 2: Freeze Mode
|
|
43
|
+
|
|
44
|
+
Locks file edits to a specific directory tree:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
/safety-guard freeze src/components/
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Any Write/Edit outside `src/components/` is blocked with an explanation. Useful when you want an agent to focus on one area without touching unrelated code.
|
|
51
|
+
|
|
52
|
+
### Mode 3: Guard Mode (Careful + Freeze combined)
|
|
53
|
+
|
|
54
|
+
Both protections active. Maximum safety for autonomous agents.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/safety-guard guard --dir src/api/ --allow-read-all
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Agents can read anything but only write to `src/api/`. Destructive commands are blocked everywhere.
|
|
61
|
+
|
|
62
|
+
### Unlock
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
/safety-guard off
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Implementation
|
|
69
|
+
|
|
70
|
+
Uses PreToolUse hooks to intercept Bash, Write, Edit, and MultiEdit tool calls. Checks the command/path against the active rules before allowing execution.
|
|
71
|
+
|
|
72
|
+
## Integration
|
|
73
|
+
|
|
74
|
+
- Enable by default for `codex -a never` sessions
|
|
75
|
+
- Pair with observability risk scoring in continuous-improvement v2
|
|
76
|
+
- Logs all blocked actions to `~/.claude/safety-guard.log`
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: strategic-compact
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 5 (Reflect After Every Session) of the 7 Laws of AI Agent Discipline at phase boundaries. Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Strategic Compact Skill
|
|
9
|
+
|
|
10
|
+
Suggests manual `/compact` at strategic points in your workflow rather than relying on arbitrary auto-compaction.
|
|
11
|
+
|
|
12
|
+
## When to Activate
|
|
13
|
+
|
|
14
|
+
- Running long sessions that approach context limits (200K+ tokens)
|
|
15
|
+
- Working on multi-phase tasks (research → plan → implement → test)
|
|
16
|
+
- Switching between unrelated tasks within the same session
|
|
17
|
+
- After completing a major milestone and starting new work
|
|
18
|
+
- When responses slow down or become less coherent (context pressure)
|
|
19
|
+
|
|
20
|
+
## Why Strategic Compaction?
|
|
21
|
+
|
|
22
|
+
Auto-compaction triggers at arbitrary points:
|
|
23
|
+
- Often mid-task, losing important context
|
|
24
|
+
- No awareness of logical task boundaries
|
|
25
|
+
- Can interrupt complex multi-step operations
|
|
26
|
+
|
|
27
|
+
Strategic compaction at logical boundaries:
|
|
28
|
+
- **After exploration, before execution** — Compact research context, keep implementation plan
|
|
29
|
+
- **After completing a milestone** — Fresh start for next phase
|
|
30
|
+
- **Before major context shifts** — Clear exploration context before different task
|
|
31
|
+
|
|
32
|
+
## How It Works
|
|
33
|
+
|
|
34
|
+
The `suggest-compact.js` script runs on PreToolUse (Edit/Write) and:
|
|
35
|
+
|
|
36
|
+
1. **Tracks tool calls** — Counts tool invocations in session
|
|
37
|
+
2. **Threshold detection** — Suggests at configurable threshold (default: 50 calls)
|
|
38
|
+
3. **Periodic reminders** — Reminds every 25 calls after threshold
|
|
39
|
+
|
|
40
|
+
## Hook Setup
|
|
41
|
+
|
|
42
|
+
Add to your `~/.claude/settings.json`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"hooks": {
|
|
47
|
+
"PreToolUse": [
|
|
48
|
+
{
|
|
49
|
+
"matcher": "Edit",
|
|
50
|
+
"hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"matcher": "Write",
|
|
54
|
+
"hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
Environment variables:
|
|
64
|
+
- `COMPACT_THRESHOLD` — Tool calls before first suggestion (default: 50)
|
|
65
|
+
|
|
66
|
+
## Compaction Decision Guide
|
|
67
|
+
|
|
68
|
+
Use this table to decide when to compact:
|
|
69
|
+
|
|
70
|
+
| Phase Transition | Compact? | Why |
|
|
71
|
+
|-----------------|----------|-----|
|
|
72
|
+
| Research → Planning | Yes | Research context is bulky; plan is the distilled output |
|
|
73
|
+
| Planning → Implementation | Yes | Plan is in TodoWrite or a file; free up context for code |
|
|
74
|
+
| Implementation → Testing | Maybe | Keep if tests reference recent code; compact if switching focus |
|
|
75
|
+
| Debugging → Next feature | Yes | Debug traces pollute context for unrelated work |
|
|
76
|
+
| Mid-implementation | No | Losing variable names, file paths, and partial state is costly |
|
|
77
|
+
| After a failed approach | Yes | Clear the dead-end reasoning before trying a new approach |
|
|
78
|
+
|
|
79
|
+
## What Survives Compaction
|
|
80
|
+
|
|
81
|
+
Understanding what persists helps you compact with confidence:
|
|
82
|
+
|
|
83
|
+
| Persists | Lost |
|
|
84
|
+
|----------|------|
|
|
85
|
+
| Agent instructions (from CLAUDE.md / AGENTS.md) | Intermediate reasoning and analysis |
|
|
86
|
+
| TodoWrite task list | File contents you previously read |
|
|
87
|
+
| Memory files (`~/.claude/memory/`) | Multi-step conversation context |
|
|
88
|
+
| Git state (commits, branches) | Tool call history and counts |
|
|
89
|
+
| Files on disk | Nuanced user preferences stated verbally |
|
|
90
|
+
|
|
91
|
+
## Best Practices
|
|
92
|
+
|
|
93
|
+
1. **Compact after planning** — Once plan is finalized in TodoWrite, compact to start fresh
|
|
94
|
+
2. **Compact after debugging** — Clear error-resolution context before continuing
|
|
95
|
+
3. **Don't compact mid-implementation** — Preserve context for related changes
|
|
96
|
+
4. **Read the suggestion** — The hook tells you *when*, you decide *if*
|
|
97
|
+
5. **Write before compacting** — Save important context to files or memory before compacting
|
|
98
|
+
6. **Use `/compact` with a summary** — Add a custom message: `/compact Focus on implementing auth middleware next`
|
|
99
|
+
|
|
100
|
+
## Related
|
|
101
|
+
|
|
102
|
+
- [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) — Token optimization section
|
|
103
|
+
- Memory persistence hooks — For state that survives compaction
|
|
104
|
+
- `continuous-learning` skill — Extracts patterns before session ends
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: superpowers
|
|
3
|
+
tier: companion
|
|
4
|
+
description: "Law activator for the 7 Laws of AI Agent Discipline. Unified five-source dispatcher — routes tasks to the correct Law-aligned specialist across the CI plugin (tdd-workflow, verification-loop, gateguard, ralph, deploy-receipt) and four registered upstream companions (Obra superpowers, addy agent-skills, ruflo-swarm, oh-my-claudecode, pm-skills) so the right discipline fires automatically instead of the agent skipping a step. Not a peer skill — a dispatcher for the others."
|
|
5
|
+
origin: https://github.com/obra/superpowers
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Superpowers — Mandatory Agent Workflows (Five-Source Dispatcher)
|
|
9
|
+
|
|
10
|
+
Superpowers enforces a structured development workflow. Skills activate automatically when their trigger conditions are met. This is not optional guidance — it is mandatory workflow.
|
|
11
|
+
|
|
12
|
+
## Philosophy
|
|
13
|
+
|
|
14
|
+
AI agents skip steps, guess, and declare "done" without verifying. Superpowers blocks this by making workflow stages explicit and enforced.
|
|
15
|
+
|
|
16
|
+
## What changed in v3.8.0
|
|
17
|
+
|
|
18
|
+
The dispatcher now routes across **five registered marketplaces** instead of relying on Obra installed separately. All five are installable from one marketplace entry:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/plugin install superpowers@continuous-improvement # Obra's 14 workflow skills
|
|
22
|
+
/plugin install agent-skills@continuous-improvement # Addy's 21 SDLC skills
|
|
23
|
+
/plugin install ruflo-swarm@continuous-improvement # Agent swarm + Monitor stream
|
|
24
|
+
/plugin install oh-my-claudecode@continuous-improvement # 39 skills + 19 agents
|
|
25
|
+
/plugin install pm-skills@continuous-improvement # 41 PM skills + 47 commands
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The CI plugin (this dispatcher + `tdd-workflow`, `verification-loop`, `gateguard`, `ralph`, `deploy-receipt`, etc.) installs by default. The five companions are opt-in — install only what you need.
|
|
29
|
+
|
|
30
|
+
## The Basic Workflow
|
|
31
|
+
|
|
32
|
+
| Order | Skill | When It Activates |
|
|
33
|
+
|-------|-------|-------------------|
|
|
34
|
+
| 1 | **brainstorming** | Before writing code. Refines rough ideas through questions, explores alternatives, presents design in sections for validation. |
|
|
35
|
+
| 2 | **using-git-worktrees** | After design approval. Creates isolated workspace on new branch, runs project setup, verifies clean test baseline. |
|
|
36
|
+
| 3 | **writing-plans** | With approved design. Breaks work into bite-sized tasks (2-5 minutes each). Every task has exact file paths, complete code, verification steps. |
|
|
37
|
+
| 4 | **subagent-driven-development** or **executing-plans** | With plan. Dispatches fresh subagent per task with two-stage review (spec compliance, then code quality), or executes in batches with human checkpoints. |
|
|
38
|
+
| 5 | **test-driven-development** | During implementation. Enforces RED-GREEN-REFACTOR: write failing test, watch it fail, write minimal code, watch it pass, commit. Deletes code written before tests. |
|
|
39
|
+
| 6 | **requesting-code-review** | Between tasks. Reviews against plan, reports issues by severity. Critical issues block progress. |
|
|
40
|
+
| 7 | **finishing-a-development-branch** | When tasks complete. Verifies tests, presents options (merge/PR/keep/discard), cleans up worktree. |
|
|
41
|
+
| 8 | **deploy-receipt** | When the deploy branch auto-deploys (Railway / Cloudflare Workers / Vercel / Netlify / Fly.io / etc.). Verifies deployed SHA matches merge SHA and healthcheck returns 200. Until the receipt is COMPLETE the merge is not reported as done. |
|
|
42
|
+
|
|
43
|
+
The agent checks for relevant skills before any task. These are mandatory workflows, not suggestions.
|
|
44
|
+
|
|
45
|
+
## Five-Source Routing Table
|
|
46
|
+
|
|
47
|
+
When a task trigger fires, the dispatcher resolves to the first available skill in the preference chain. Order = preference order. Items prefixed with `ci:` are bundled in this plugin; others are namespaced by their installed plugin name.
|
|
48
|
+
|
|
49
|
+
| Trigger | Law | Preferred → Fallback chain |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Write a failing test before code | 3+4 | `ci:tdd-workflow` → `superpowers:test-driven-development` → `agent-skills:test-driven-development` |
|
|
52
|
+
| Verify before declaring done | 4 | `ci:verification-loop` → `superpowers:verification-before-completion` |
|
|
53
|
+
| Block edit until investigation present | 1 | `ci:gateguard` (no equivalents) |
|
|
54
|
+
| Diagnose root cause across layers | 6 | `superpowers:systematic-debugging` → `agent-skills:debugging-and-error-recovery` |
|
|
55
|
+
| Refine vague request into design | 2 | `superpowers:brainstorming` → `agent-skills:idea-refine` |
|
|
56
|
+
| Decompose plan into atomic tasks | 2 | `superpowers:writing-plans` → `agent-skills:planning-and-task-breakdown` → `ci:planning-with-files` |
|
|
57
|
+
| Execute plan with checkpoints | 3+6 | `superpowers:executing-plans` → `agent-skills:incremental-implementation` |
|
|
58
|
+
| Spawn fresh subagent per task | 3 | `superpowers:subagent-driven-development` → `superpowers:dispatching-parallel-agents` |
|
|
59
|
+
| Fan out N parallel agents on isolated worktrees | 3 | `superpowers:dispatching-parallel-agents` → `ruflo-swarm:swarm-init` |
|
|
60
|
+
| Stream live observation of long agent runs | 4 | `ruflo-swarm:monitor-stream` (only source) |
|
|
61
|
+
| Isolate work on a new branch | 3 | `superpowers:using-git-worktrees` (only source) |
|
|
62
|
+
| Decide merge / PR / discard at branch end | 3+4 | `superpowers:finishing-a-development-branch` → `agent-skills:shipping-and-launch` |
|
|
63
|
+
| Pre-review checklist before requesting review | 4 | `superpowers:requesting-code-review` → `agent-skills:code-review-and-quality` |
|
|
64
|
+
| Respond to reviewer feedback | 4 | `superpowers:receiving-code-review` |
|
|
65
|
+
| Verify deployed SHA matches merge SHA | 4 | `ci:deploy-receipt` (only source) |
|
|
66
|
+
| Audit repo / MCP / env at session start | 1 | `ci:workspace-surface-audit` (only source) |
|
|
67
|
+
| Run autonomous PRD loop | 6 | `ci:ralph` → `oh-my-claudecode:ralph` (heavy overlap; prefer CI) |
|
|
68
|
+
| Audit-then-execute production fix sweep | all | `ci:proceed-with-the-recommendation` (only source) |
|
|
69
|
+
| Spec-first contract before implementation | 2 | `agent-skills:spec-driven-development` (only source) |
|
|
70
|
+
| Source-first reading before writing | 1 | `agent-skills:source-driven-development` (only source) |
|
|
71
|
+
| Curate the right context window | 1 | `agent-skills:context-engineering` → `ci:context-budget` |
|
|
72
|
+
| Simplify code, remove duplication | 6 | `agent-skills:code-simplification` → `simplify` |
|
|
73
|
+
| Security review for auth/input/secrets | 4 | `agent-skills:security-and-hardening` → `security-review` |
|
|
74
|
+
| Browser-level visual regression | 4 | `oh-my-claudecode:visual-verdict` (only source) |
|
|
75
|
+
| Reflect after session, extract patterns | 5+7 | `ci:learn-eval` → `oh-my-claudecode:retrospective` |
|
|
76
|
+
| Long autonomous run with quality gates | 6 | `oh-my-claudecode:ultrawork` → `ci:ralph` |
|
|
77
|
+
| Coordinator role for staged hand-off | 3 | `ruflo-swarm:agents/coordinator` (when ruflo installed) |
|
|
78
|
+
| Draft a PRD before implementation | 2 | `pm-skills:prd` (only source) |
|
|
79
|
+
| Decompose into user stories + acceptance criteria | 2 | `pm-skills:user-stories` + `pm-skills:acceptance-criteria` |
|
|
80
|
+
| Write or grade quarterly OKRs | 2 | `pm-skills:okr-writer` + `pm-skills:okr-grader` |
|
|
81
|
+
| Design hypothesis-driven experiment | 2 | `pm-skills:experiment-design` + `pm-skills:hypothesis` |
|
|
82
|
+
| Discovery framework: persona, JTBD, lean canvas | 1 | `pm-skills:persona` + `pm-skills:jtbd-canvas` + `pm-skills:lean-canvas` |
|
|
83
|
+
| Market sizing / competitive analysis | 1 | `pm-skills:market-sizing` + `pm-skills:competitive-analysis` |
|
|
84
|
+
| Meeting agenda / brief / recap / synthesize | 5 | `pm-skills:meeting-*` family |
|
|
85
|
+
| Launch checklist before product release | 4 | `pm-skills:launch-checklist` (no engineering equivalent) |
|
|
86
|
+
|
|
87
|
+
When no installed plugin in the chain resolves, the dispatcher falls back to the inline protocols below (Test-Driven Development, Brainstorming, Plan Format, etc.) so the workflow still works on a clean install.
|
|
88
|
+
|
|
89
|
+
## Stacked-PR Plan Precondition (≥3 files)
|
|
90
|
+
|
|
91
|
+
Any change touching three or more files — across `skills/`, `src/`, `bin/`, `commands/`, or any combination — must produce a stacked-PR plan as a precondition to the first edit landing. The 28-day usage report shows a clean correlation: sessions that opened with a stacked-PR plan landed at `fully_achieved`; sessions that began as a single big-bang multi-file edit landed at `partially_achieved` (landing-page dark theme, market-data-hub wiring, RAG misrouting). Single-concern PRs are the lever that closes that gap.
|
|
92
|
+
|
|
93
|
+
The required plan output has four components, in this order:
|
|
94
|
+
|
|
95
|
+
1. **Per-PR table** — title, scope (files), test strategy, merge order. One row per PR.
|
|
96
|
+
2. **Dependency graph** — which PRs depend on which (or "independent" if none).
|
|
97
|
+
3. **Worktree per PR** — branch name + base commit. Sequential by default; parallel only when items share no state.
|
|
98
|
+
4. **Out-of-scope list** — anything explicitly NOT in the train. Drive-by temptations get logged here, not implemented.
|
|
99
|
+
|
|
100
|
+
The plan ships as the FIRST commit of the train's first PR (under `docs/plans/YYYY-MM-DD-<slug>.md`) and is cited by every subsequent commit it produces.
|
|
101
|
+
|
|
102
|
+
### When this rule does NOT fire
|
|
103
|
+
|
|
104
|
+
The threshold targets multi-concern feature work, not high-volume mechanical changes. The rule does NOT fire on:
|
|
105
|
+
|
|
106
|
+
- **Markdown-only commits** — README, CHANGELOG, docs/ updates that touch many files but ship one concern.
|
|
107
|
+
- **Lockfile-only commits** — `package-lock.json`, `pnpm-lock.yaml`, `Cargo.lock`, etc. updated in isolation by a dependency bump.
|
|
108
|
+
- **Generated-only commits** — output of `npm run build`, `tsc`, codemod sweeps, or any tool whose input is one source file and whose output is many derived files. The source change is what counts toward the threshold; the regenerated artifacts ride free.
|
|
109
|
+
- **Vendor-snapshot refreshes** — `third-party/<name>/` updated by a documented `bin/refresh-third-party.mjs` driver. The single source of change is the upstream SHA bump.
|
|
110
|
+
- **Skill-mirror sync commits** — `skills/<name>.md` + `plugins/continuous-improvement/skills/<name>/SKILL.md` count as one file pair, not two, since the CONTRIBUTING.md skill mirror rule treats them as the same concern.
|
|
111
|
+
|
|
112
|
+
If you are unsure whether the rule applies, the fall-through default is to write the plan. A 30-line plan doc is cheap; a stranded big-bang edit is expensive.
|
|
113
|
+
|
|
114
|
+
## Skill Library
|
|
115
|
+
|
|
116
|
+
### Testing
|
|
117
|
+
- **test-driven-development** — RED-GREEN-REFACTOR cycle (includes testing anti-patterns reference)
|
|
118
|
+
|
|
119
|
+
### Debugging
|
|
120
|
+
- **systematic-debugging** — 4-phase root cause process (includes root-cause-tracing, defense-in-depth, condition-based-waiting techniques)
|
|
121
|
+
- **verification-before-completion** — Ensure it's actually fixed
|
|
122
|
+
|
|
123
|
+
### Collaboration
|
|
124
|
+
- **brainstorming** — Socratic design refinement
|
|
125
|
+
- **writing-plans** — Detailed implementation plans
|
|
126
|
+
- **executing-plans** — Batch execution with checkpoints
|
|
127
|
+
- **dispatching-parallel-agents** — Concurrent subagent workflows
|
|
128
|
+
- **requesting-code-review** — Pre-review checklist
|
|
129
|
+
- **receiving-code-review** — Responding to feedback
|
|
130
|
+
- **using-git-worktrees** — Parallel development branches
|
|
131
|
+
- **finishing-a-development-branch** — Merge/PR decision workflow
|
|
132
|
+
- **subagent-driven-development** — Fast iteration with two-stage review (spec compliance, then code quality)
|
|
133
|
+
|
|
134
|
+
### Deployment Verification
|
|
135
|
+
- **deploy-receipt** — Closes the merge-to-production gap on auto-deploy targets (CI-side companion to `finishing-a-development-branch`)
|
|
136
|
+
|
|
137
|
+
### Meta
|
|
138
|
+
- **writing-skills** — Create new skills following best practices (includes testing methodology)
|
|
139
|
+
- **using-superpowers** — Introduction to the skills system
|
|
140
|
+
|
|
141
|
+
## Test-Driven Development (Mandatory)
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
RED: Write failing test → Watch it fail
|
|
145
|
+
GREEN: Write minimal code → Watch it pass
|
|
146
|
+
REFACTOR: Improve while staying green → Commit
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Code written before tests is deleted. No exceptions.
|
|
150
|
+
|
|
151
|
+
## Brainstorming Protocol
|
|
152
|
+
|
|
153
|
+
When given a vague request:
|
|
154
|
+
|
|
155
|
+
1. Ask clarifying questions
|
|
156
|
+
2. Explore 2-3 alternative approaches
|
|
157
|
+
3. Present design in sections
|
|
158
|
+
4. Wait for explicit approval before proceeding
|
|
159
|
+
|
|
160
|
+
## Plan Format
|
|
161
|
+
|
|
162
|
+
Every task in a plan must include:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
- task: "Specific action"
|
|
166
|
+
file: "exact/path/to/file.ext"
|
|
167
|
+
code: "Complete implementation"
|
|
168
|
+
verify: "How to confirm it works"
|
|
169
|
+
estimate: "2-5 minutes"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Code Review Severity
|
|
173
|
+
|
|
174
|
+
| Level | Action |
|
|
175
|
+
|-------|--------|
|
|
176
|
+
| Critical | Blocks progress. Must fix before continuing. |
|
|
177
|
+
| Warning | Should fix. Note and continue. |
|
|
178
|
+
| Info | Noted for later. No action required. |
|
|
179
|
+
|
|
180
|
+
## Subagent Development
|
|
181
|
+
|
|
182
|
+
Two-stage review for every task:
|
|
183
|
+
|
|
184
|
+
1. **Spec compliance** — Does it match the plan?
|
|
185
|
+
2. **Code quality** — Is it clean, tested, and maintainable?
|
|
186
|
+
|
|
187
|
+
Both must pass. Fresh subagent per task prevents context pollution.
|
|
188
|
+
|
|
189
|
+
## Git Worktrees
|
|
190
|
+
|
|
191
|
+
Each feature gets an isolated workspace:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
git worktree add -b feature-name ../feature-name
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Clean separation, parallel development, easy cleanup.
|
|
198
|
+
|
|
199
|
+
## Using Superpowers
|
|
200
|
+
|
|
201
|
+
Superpowers skills activate when their trigger conditions are detected. The dispatcher resolves each trigger through the five-source routing table above:
|
|
202
|
+
|
|
203
|
+
- "Create a feature" → `superpowers:brainstorming` → `superpowers:writing-plans` → `superpowers:executing-plans`
|
|
204
|
+
- "Fix this bug" → `superpowers:systematic-debugging` → `superpowers:verification-before-completion`
|
|
205
|
+
- "Review this PR" → `superpowers:requesting-code-review`
|
|
206
|
+
- "Draft a PRD" → `pm-skills:prd` → `pm-skills:user-stories` → `pm-skills:acceptance-criteria`
|
|
207
|
+
- "Write OKRs for next quarter" → `pm-skills:okr-writer` then `pm-skills:okr-grader`
|
|
208
|
+
- "Run this PRD autonomously" → `ci:ralph`
|
|
209
|
+
- "Fan out parallel provider migration" → `superpowers:dispatching-parallel-agents` or `/swarm` (PR D)
|
|
210
|
+
- "Visual regression check the landing page" → `oh-my-claudecode:visual-verdict`
|
|
211
|
+
|
|
212
|
+
No manual skill selection. The framework detects the trigger, resolves the chain, and enforces.
|