continuous-improvement 3.8.0 → 3.9.2
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 +2 -14
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -21
- package/QUICKSTART.md +148 -101
- package/README.md +50 -18
- package/action.yml +33 -33
- package/bin/analyze.sh +161 -161
- package/bin/backfill.mjs +19 -19
- package/bin/check-doc-runtime-claims.mjs +120 -0
- package/bin/generate-plugin-manifests.mjs +2 -0
- package/bin/hook-stats.mjs +21 -21
- package/bin/install.mjs +51 -44
- package/bin/mcp-server.mjs +43 -40
- package/bin/refresh-third-party.mjs +416 -416
- package/commands/continuous-improvement.md +115 -115
- package/commands/dashboard.md +56 -56
- package/commands/discipline.md +51 -51
- package/commands/proceed-with-the-recommendation.md +62 -62
- package/commands/seven-laws.md +16 -16
- package/commands/superpowers.md +119 -92
- package/commands/workspace-surface-audit.md +77 -77
- package/hooks/gateguard.mjs +172 -0
- package/hooks/observe.sh +172 -172
- package/hooks/session.sh +106 -106
- package/hooks/three-section-close.mjs +181 -181
- package/instinct-packs/go.json +58 -58
- package/instinct-packs/meta.json +16 -16
- package/instinct-packs/python.json +58 -58
- package/instinct-packs/react.json +58 -58
- package/lib/gateguard-state.mjs +85 -0
- package/lib/plugin-metadata.mjs +25 -18
- package/llms.txt +68 -68
- package/package.json +3 -2
- package/plugins/beginner.json +1 -1
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +1 -1
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +1 -1
- package/plugins/continuous-improvement/LICENSE +21 -21
- package/plugins/continuous-improvement/README.md +1 -0
- package/plugins/continuous-improvement/agents/README.md +120 -0
- package/plugins/continuous-improvement/agents/code-reviewer.md +97 -0
- package/plugins/continuous-improvement/agents/security-auditor.md +101 -0
- package/plugins/continuous-improvement/agents/test-engineer.md +95 -0
- package/plugins/continuous-improvement/bin/backfill.mjs +19 -19
- package/plugins/continuous-improvement/bin/mcp-server.mjs +43 -40
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -115
- package/plugins/continuous-improvement/commands/dashboard.md +56 -56
- package/plugins/continuous-improvement/commands/discipline.md +51 -51
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -62
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -16
- package/plugins/continuous-improvement/commands/superpowers.md +119 -92
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -77
- package/plugins/continuous-improvement/hooks/gateguard.mjs +172 -0
- package/plugins/continuous-improvement/hooks/hooks.json +6 -1
- package/plugins/continuous-improvement/hooks/observe.sh +172 -172
- package/plugins/continuous-improvement/hooks/session.sh +106 -106
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -181
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -58
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -16
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -58
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -58
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +25 -18
- package/plugins/continuous-improvement/skills/README.md +4 -1
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +47 -0
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +17 -9
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -108
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +1 -8
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -221
- package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +73 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -76
- package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +63 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -104
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +22 -15
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -411
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -136
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +32 -0
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -191
- package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +66 -0
- package/plugins/expert.json +1 -1
- package/skills/README.md +79 -79
- package/skills/deploy-receipt.md +47 -0
- package/skills/gateguard.md +17 -9
- package/skills/para-memory-files.md +108 -108
- package/skills/proceed-with-the-recommendation.md +1 -8
- package/skills/ralph.md +221 -221
- package/skills/recovery-classification.md +73 -0
- package/skills/safety-guard.md +76 -76
- package/skills/state-reconciliation.md +63 -0
- package/skills/strategic-compact.md +104 -104
- package/skills/superpowers.md +22 -15
- package/skills/tdd-workflow.md +411 -411
- package/skills/token-budget-advisor.md +136 -136
- package/skills/verification-loop.md +32 -0
- package/skills/wild-risa-balance.md +191 -191
- package/skills/worktree-safety.md +66 -0
- package/templates/insights-claude-md.md +91 -0
- package/templates/verify-ladder.example.json +37 -24
|
@@ -1,76 +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
|
-
|
|
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`
|
|
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
|
+
Currently implemented as skill-side discipline: when restricted-mode is active, the agent reads this skill and refuses Bash, Write, Edit, and MultiEdit calls that violate the rules before invoking the tool. There is no bundled tool-call gate today — the same enforcement gap that existed for `gateguard` before issue #106 / PR #108. A future runtime version would track via a follow-up issue.
|
|
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,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: state-reconciliation
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: "Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Pre-dispatch invariant: reconcile DB-vs-disk-vs-memory state before any unit runs, so a stale flag, missing artifact, or out-of-sync row never re-dispatches a unit that already completed or never started."
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# State Reconciliation Skill
|
|
9
|
+
|
|
10
|
+
A pre-dispatch invariant. Before the verification ladder runs (or any auto-loop unit dispatches), reconcile the three state sources — DB / disk / in-memory — and surface any divergence as a blocker, not a silent re-dispatch.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Before Phase 1 of `verification-loop` if the project tracks runtime state outside source control (sqlite, KV, redis, `completed-units.json`, milestone JSON, lockfiles).
|
|
15
|
+
- Before any auto-loop iteration in long-running sessions.
|
|
16
|
+
- After a crash, pause/resume, or context compaction — the in-memory loop state is gone but DB and disk persist.
|
|
17
|
+
- When a flag like `is_sketch`, `in_progress`, or a stale lock keeps re-firing the same unit.
|
|
18
|
+
|
|
19
|
+
## Why This Skill Exists
|
|
20
|
+
|
|
21
|
+
GSD-2's [CONTEXT.md](https://github.com/gsd-build/gsd-2/blob/main/CONTEXT.md) names "State Reconciliation" as one of four runtime invariant modules. Common failure modes it catches:
|
|
22
|
+
|
|
23
|
+
- **Stale flags re-dispatch completed units** — `is_sketch`, stale worker rows, stale sequence/dependency rows that no one cleared.
|
|
24
|
+
- **Disk artifacts present, DB status lags** — `PROJECT.md` milestone registration, completion timestamps, roadmap divergence.
|
|
25
|
+
- **Recovery helpers exist but aren't wired into dispatch** — divergence accrues silently between iterations.
|
|
26
|
+
|
|
27
|
+
A verification ladder that runs against unreconciled state reports green on the wrong inputs.
|
|
28
|
+
|
|
29
|
+
## The Reconciliation Contract
|
|
30
|
+
|
|
31
|
+
For every state class the project tracks, define and run before dispatch:
|
|
32
|
+
|
|
33
|
+
1. **Authority** — which surface is the source of truth (DB, disk artifact, in-memory loop state).
|
|
34
|
+
2. **Projection** — direction of state flow (DB → disk, disk → DB, or both with a named winner).
|
|
35
|
+
3. **Reconciliation** — the deterministic check that proves authority and projection match.
|
|
36
|
+
4. **Failure mode** — what happens on divergence (block dispatch, repair, ask operator).
|
|
37
|
+
|
|
38
|
+
Output a single fenced block before any dispatch, so the operator sees the resolved state before it costs a misread:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
state-reconciliation (resolved):
|
|
42
|
+
participants table: DB authoritative; disk projection at data/participants.json — match (1247 rows)
|
|
43
|
+
completed_units.json: project root authoritative after crash; worktree projection — match
|
|
44
|
+
is_sketch flag: DB authoritative — clear (no re-dispatch risk)
|
|
45
|
+
open lock at /tmp/foo.lck: stale (PID 1234 not running) — STALE, blocks dispatch
|
|
46
|
+
milestone registration: PROJECT.md authoritative; DB row — DIVERGED (DB shows in_progress, disk shows complete)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Each row shows class + authority + reconciliation result. `STALE`, `DIVERGED`, `MISSING` surface as blockers; only every-row-`match` unblocks dispatch.
|
|
50
|
+
|
|
51
|
+
## Anti-Patterns
|
|
52
|
+
|
|
53
|
+
- **Reconciling at unit boundary, not lifecycle boundary.** Checking only when a unit is about to run lets earlier units write to invalid state. Reconcile once at lifecycle start and on every resume.
|
|
54
|
+
- **One-way trust.** Assuming DB is always right (or disk always right) without naming authority per state class. Authority is a per-class decision; codify it.
|
|
55
|
+
- **Silent repair.** Auto-fixing divergence without surfacing it. If reconciliation fixes 12 rows, the operator must see the count and the classes.
|
|
56
|
+
- **Reconciling the wrong direction.** Projecting disk → DB when DB was the authority overwrites correct state with stale data. The direction is part of the contract, not a default.
|
|
57
|
+
- **Treating "missing" as "match".** An absent state class is not the same as a reconciled one. Missing means the projection never ran; surface it explicitly.
|
|
58
|
+
|
|
59
|
+
## Pairs With
|
|
60
|
+
|
|
61
|
+
- [verification-loop](verification-loop.md) — runs as a pre-Phase-0 invariant; the resolved-state block fires before the resolved-ladder block.
|
|
62
|
+
- [worktree-safety](worktree-safety.md) — both fire before dispatch; safety runs first because reconciliation depends on a valid worktree root.
|
|
63
|
+
- [recovery-classification](recovery-classification.md) — divergence found here routes through recovery-classification on the next loop iteration if the reconciler can't auto-repair.
|
|
@@ -1,104 +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
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: superpowers
|
|
3
3
|
tier: companion
|
|
4
|
-
description: "Law activator for the 7 Laws of AI Agent Discipline. Unified
|
|
4
|
+
description: "Law activator for the 7 Laws of AI Agent Discipline. Unified four-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) so the right discipline fires automatically instead of the agent skipping a step. Product-management coverage comes from phuryn/pm-skills via an out-of-band marketplace install (see docs/THIRD_PARTY.md). Not a peer skill — a dispatcher for the others."
|
|
5
5
|
origin: https://github.com/obra/superpowers
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -15,17 +15,32 @@ AI agents skip steps, guess, and declare "done" without verifying. Superpowers b
|
|
|
15
15
|
|
|
16
16
|
## What changed in v3.8.0
|
|
17
17
|
|
|
18
|
-
The dispatcher now routes across **
|
|
18
|
+
The dispatcher now routes across **four registered marketplaces** instead of relying on Obra installed separately. All four are installable from one marketplace entry:
|
|
19
19
|
|
|
20
20
|
```
|
|
21
21
|
/plugin install superpowers@continuous-improvement # Obra's 14 workflow skills
|
|
22
22
|
/plugin install agent-skills@continuous-improvement # Addy's 21 SDLC skills
|
|
23
23
|
/plugin install ruflo-swarm@continuous-improvement # Agent swarm + Monitor stream
|
|
24
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
25
|
```
|
|
27
26
|
|
|
28
|
-
The CI plugin (this dispatcher + `tdd-workflow`, `verification-loop`, `gateguard`, `ralph`, `deploy-receipt`, etc.) installs by default. The
|
|
27
|
+
The CI plugin (this dispatcher + `tdd-workflow`, `verification-loop`, `gateguard`, `ralph`, `deploy-receipt`, etc.) installs by default. The four companions are opt-in — install only what you need.
|
|
28
|
+
|
|
29
|
+
Product-management coverage (PRD, OKRs, personas, GTM, etc.) is provided by `phuryn/pm-skills` via an out-of-band Claude Code marketplace install:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
claude plugin marketplace add phuryn/pm-skills
|
|
33
|
+
claude plugin install pm-toolkit@pm-skills
|
|
34
|
+
claude plugin install pm-product-strategy@pm-skills
|
|
35
|
+
claude plugin install pm-product-discovery@pm-skills
|
|
36
|
+
claude plugin install pm-market-research@pm-skills
|
|
37
|
+
claude plugin install pm-data-analytics@pm-skills
|
|
38
|
+
claude plugin install pm-marketing-growth@pm-skills
|
|
39
|
+
claude plugin install pm-go-to-market@pm-skills
|
|
40
|
+
claude plugin install pm-execution@pm-skills
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See `docs/THIRD_PARTY.md` for plugin-by-plugin scope.
|
|
29
44
|
|
|
30
45
|
## The Basic Workflow
|
|
31
46
|
|
|
@@ -42,7 +57,7 @@ The CI plugin (this dispatcher + `tdd-workflow`, `verification-loop`, `gateguard
|
|
|
42
57
|
|
|
43
58
|
The agent checks for relevant skills before any task. These are mandatory workflows, not suggestions.
|
|
44
59
|
|
|
45
|
-
##
|
|
60
|
+
## Four-Source Routing Table
|
|
46
61
|
|
|
47
62
|
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
63
|
|
|
@@ -75,14 +90,7 @@ When a task trigger fires, the dispatcher resolves to the first available skill
|
|
|
75
90
|
| Reflect after session, extract patterns | 5+7 | `ci:learn-eval` → `oh-my-claudecode:retrospective` |
|
|
76
91
|
| Long autonomous run with quality gates | 6 | `oh-my-claudecode:ultrawork` → `ci:ralph` |
|
|
77
92
|
| Coordinator role for staged hand-off | 3 | `ruflo-swarm:agents/coordinator` (when ruflo installed) |
|
|
78
|
-
|
|
|
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) |
|
|
93
|
+
| Product-management work (PRD, OKRs, personas, GTM, growth, market research, analytics) | 1+2+5 | Install `phuryn/pm-skills` via Claude Code marketplace — see docs/THIRD_PARTY.md. Eight installable plugins (`pm-toolkit`, `pm-product-strategy`, `pm-product-discovery`, `pm-market-research`, `pm-data-analytics`, `pm-marketing-growth`, `pm-go-to-market`, `pm-execution`) cover the full lifecycle. Out of band — not a `/plugin install <name>@continuous-improvement` target. |
|
|
86
94
|
|
|
87
95
|
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
96
|
|
|
@@ -203,8 +211,7 @@ Superpowers skills activate when their trigger conditions are detected. The disp
|
|
|
203
211
|
- "Create a feature" → `superpowers:brainstorming` → `superpowers:writing-plans` → `superpowers:executing-plans`
|
|
204
212
|
- "Fix this bug" → `superpowers:systematic-debugging` → `superpowers:verification-before-completion`
|
|
205
213
|
- "Review this PR" → `superpowers:requesting-code-review`
|
|
206
|
-
- "Draft a PRD"
|
|
207
|
-
- "Write OKRs for next quarter" → `pm-skills:okr-writer` then `pm-skills:okr-grader`
|
|
214
|
+
- "Draft a PRD" / "Write OKRs" / "Build a persona" → install `phuryn/pm-skills` (out of band — see docs/THIRD_PARTY.md)
|
|
208
215
|
- "Run this PRD autonomously" → `ci:ralph`
|
|
209
216
|
- "Fan out parallel provider migration" → `superpowers:dispatching-parallel-agents` or `/swarm` (PR D)
|
|
210
217
|
- "Visual regression check the landing page" → `oh-my-claudecode:visual-verdict`
|