continuous-improvement 3.9.2 → 3.11.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 +2 -2
- package/CHANGELOG.md +61 -0
- package/QUICKSTART.md +13 -8
- package/README.md +84 -153
- package/bin/backfill.mjs +0 -0
- package/bin/check-doc-runtime-claims.mjs +0 -0
- package/bin/check-docs-substrings.mjs +73 -0
- package/bin/check-everything-mirror.mjs +0 -0
- package/bin/check-routing-targets.mjs +0 -0
- package/bin/check-scripts-citation-drift.mjs +210 -0
- package/bin/check-skill-count.mjs +110 -0
- package/bin/check-skill-law-tag.mjs +0 -0
- package/bin/check-skill-mirror.mjs +0 -0
- package/bin/check-skill-tiers.mjs +0 -0
- package/bin/check-test-imports-only.mjs +126 -0
- package/bin/check-third-party-shape.mjs +0 -0
- package/bin/companion-preference-status.mjs +231 -0
- package/bin/gateguard-clear.mjs +53 -0
- package/bin/generate-plugin-manifests.mjs +7 -1
- package/bin/harvest-friction.mjs +0 -0
- package/bin/hook-stats.mjs +0 -0
- package/bin/install.mjs +182 -26
- package/bin/lint-transcript.mjs +0 -0
- package/bin/mcp-server.mjs +215 -2
- package/bin/observe.mjs +0 -0
- package/bin/pre-commit-block-strays.sh +0 -0
- package/bin/refresh-third-party.mjs +315 -313
- package/bin/unified-cli.mjs +0 -0
- package/commands/audit.md +34 -0
- package/commands/companion-preference.md +58 -0
- package/commands/discipline.md +14 -0
- package/commands/distill.md +39 -0
- package/commands/goal-check.md +53 -0
- package/commands/grill-me.md +40 -0
- package/commands/grill-with-docs.md +38 -0
- package/commands/handoff.md +42 -0
- package/commands/proceed-with-the-recommendation.md +20 -0
- package/commands/recall.md +49 -0
- package/commands/reconcile.md +47 -0
- package/commands/superpowers.md +2 -2
- package/commands/verify-install.md +55 -0
- package/hooks/companion-preference.mjs +190 -0
- package/hooks/gateguard.mjs +60 -25
- package/hooks/goal-drift-stop.mjs +183 -0
- package/hooks/observe.sh +15 -1
- package/hooks/route-prompt.mjs +180 -0
- package/hooks/route-table.json +35 -0
- package/hooks/three-section-close.mjs +134 -132
- package/lib/cli-anything.mjs +0 -0
- package/lib/compound-engineering.mjs +0 -0
- package/lib/gateguard-state.mjs +54 -2
- package/lib/goal-drift-gate.mjs +50 -0
- package/lib/goal-state.mjs +285 -0
- package/lib/observe-event.mjs +0 -0
- package/lib/plugin-metadata.mjs +126 -12
- package/lib/pm-marketplace.mjs +0 -0
- package/lib/pm-skills.mjs +0 -0
- package/lib/recall-index.mjs +175 -0
- package/lib/resolve-home-dir.mjs +0 -0
- package/lib/skill-distill.mjs +222 -0
- package/lib/skill-tiers.mjs +0 -0
- package/lib/unified-plugin.mjs +0 -0
- package/llms.txt +1 -1
- package/package.json +11 -7
- package/plugins/beginner.json +8 -3
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
- package/plugins/continuous-improvement/agents/README.md +2 -2
- package/plugins/continuous-improvement/bin/backfill.mjs +0 -0
- package/plugins/continuous-improvement/bin/gateguard-clear.mjs +53 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +215 -2
- package/plugins/continuous-improvement/bin/observe.mjs +0 -0
- package/plugins/continuous-improvement/commands/audit.md +34 -0
- package/plugins/continuous-improvement/commands/companion-preference.md +58 -0
- package/plugins/continuous-improvement/commands/discipline.md +14 -0
- package/plugins/continuous-improvement/commands/distill.md +39 -0
- package/plugins/continuous-improvement/commands/goal-check.md +53 -0
- package/plugins/continuous-improvement/commands/grill-me.md +40 -0
- package/plugins/continuous-improvement/commands/grill-with-docs.md +38 -0
- package/plugins/continuous-improvement/commands/handoff.md +42 -0
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +20 -0
- package/plugins/continuous-improvement/commands/recall.md +49 -0
- package/plugins/continuous-improvement/commands/reconcile.md +47 -0
- package/plugins/continuous-improvement/commands/superpowers.md +2 -2
- package/plugins/continuous-improvement/commands/verify-install.md +55 -0
- package/plugins/continuous-improvement/hooks/companion-preference.mjs +190 -0
- package/plugins/continuous-improvement/hooks/gateguard.mjs +60 -25
- package/plugins/continuous-improvement/hooks/goal-drift-stop.mjs +183 -0
- package/plugins/continuous-improvement/hooks/hooks.json +18 -2
- package/plugins/continuous-improvement/hooks/observe.sh +15 -1
- package/plugins/continuous-improvement/hooks/route-prompt.mjs +180 -0
- package/plugins/continuous-improvement/hooks/route-table.json +35 -0
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +134 -132
- package/plugins/continuous-improvement/lib/gateguard-state.mjs +137 -0
- package/plugins/continuous-improvement/lib/goal-drift-gate.mjs +50 -0
- package/plugins/continuous-improvement/lib/goal-state.mjs +285 -0
- package/plugins/continuous-improvement/lib/observe-event.mjs +0 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +126 -12
- package/plugins/continuous-improvement/lib/recall-index.mjs +175 -0
- package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +0 -0
- package/plugins/continuous-improvement/lib/skill-distill.mjs +222 -0
- package/plugins/continuous-improvement/skills/README.md +8 -0
- package/plugins/continuous-improvement/skills/audit/SKILL.md +73 -0
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +13 -17
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +36 -17
- package/plugins/continuous-improvement/skills/goal-monitor/SKILL.md +81 -0
- package/plugins/continuous-improvement/skills/grill-me/SKILL.md +66 -0
- package/plugins/continuous-improvement/skills/grill-with-docs/SKILL.md +252 -0
- package/plugins/continuous-improvement/skills/handoff/SKILL.md +59 -0
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +82 -6
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/recall/SKILL.md +50 -0
- package/plugins/continuous-improvement/skills/reconcile/SKILL.md +80 -0
- package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/skill-distillation/SKILL.md +57 -0
- package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +76 -2
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +28 -20
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +1 -0
- package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +3 -2
- package/plugins/expert.json +27 -2
- package/skills/README.md +3 -0
- package/skills/audit.md +73 -0
- package/skills/deploy-receipt.md +13 -17
- package/skills/gateguard.md +36 -17
- package/skills/goal-monitor.md +81 -0
- package/skills/grill-me.md +66 -0
- package/skills/grill-with-docs.md +252 -0
- package/skills/handoff.md +59 -0
- package/skills/para-memory-files.md +1 -1
- package/skills/proceed-with-the-recommendation.md +82 -6
- package/skills/ralph.md +1 -0
- package/skills/recall.md +50 -0
- package/skills/reconcile.md +80 -0
- package/skills/recovery-classification.md +1 -0
- package/skills/safety-guard.md +1 -0
- package/skills/skill-distillation.md +57 -0
- package/skills/state-reconciliation.md +1 -0
- package/skills/strategic-compact.md +1 -0
- package/skills/superpowers.md +76 -2
- package/skills/token-budget-advisor.md +1 -1
- package/skills/verification-loop.md +28 -20
- package/skills/wild-risa-balance.md +1 -0
- package/skills/workspace-surface-audit.md +1 -1
- package/skills/worktree-safety.md +3 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reconcile
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations, and verifies a push actually landed instead of assuming it did.
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Reconcile — Ground-Truth Git State Before You Touch It
|
|
10
|
+
|
|
11
|
+
Law 1 says research before executing. The most expensive skipped research is the state of your own repo: a branch that shifted under you, a push that silently did not land, a stash from a session you forgot. This skill establishes git ground truth first, acts only on a known state, and stops at every operation that is hard to reverse.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
|
|
15
|
+
- Before any branch/merge/rebase/push when more than one session, loop, or agent may be writing to the tree.
|
|
16
|
+
- When the working tree looks different from what you expect (unexpected branch, surprise modifications, a half-finished merge).
|
|
17
|
+
- Before cleaning up: consolidating branches, dropping stashes, removing worktrees.
|
|
18
|
+
- After a push, to confirm it actually landed on the remote.
|
|
19
|
+
|
|
20
|
+
## Establish Ground Truth First
|
|
21
|
+
|
|
22
|
+
Read before you write. Capture the full state in one pass:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
git branch --show-current
|
|
26
|
+
git status --porcelain=v1
|
|
27
|
+
git rev-list --left-right --count @{u}...HEAD # behind / ahead of upstream
|
|
28
|
+
git stash list
|
|
29
|
+
git worktree list
|
|
30
|
+
ls .git/MERGE_HEAD .git/rebase-merge .git/rebase-apply 2>/dev/null # in-progress operation?
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
On Windows with `autocrlf=true`, `git status` reports phantom line-ending-only modifications. Trust `git diff --stat` (and `git diff --ignore-all-space`) for real content drift, not `git status`. Never stage with `git add -A` / `git add .` on such a tree — stage by explicit filename.
|
|
34
|
+
|
|
35
|
+
## Detect a Concurrent Writer
|
|
36
|
+
|
|
37
|
+
When another session/loop may be active, do not assume the tree is yours:
|
|
38
|
+
|
|
39
|
+
- An in-progress `MERGE_HEAD` / `rebase-merge` you did not start means another actor is mid-operation. Do not "help" by editing conflicted files — wait, or hand off.
|
|
40
|
+
- Re-read the current branch immediately before any mutation; if it shifted since your snapshot, re-survey from the top.
|
|
41
|
+
- If `.git/index` keeps changing while you are idle, a writer is active. Pause and surface it rather than racing.
|
|
42
|
+
- If `gateguard` is installed, its Parallel-Actor Gate already captured this baseline on the session's first mutation (via `scripts/git-state-snapshot.sh`) and divergence-checks every later mutation — `reconcile` complements that gate, it does not replace it. Without gateguard, run the snapshot above yourself.
|
|
43
|
+
|
|
44
|
+
## Classify, Then Act
|
|
45
|
+
|
|
46
|
+
Map the upstream relationship before choosing an action:
|
|
47
|
+
|
|
48
|
+
- **even** (0 ahead / 0 behind) → safe to branch.
|
|
49
|
+
- **ahead only** → push (after the protected-op gate below) or open a PR.
|
|
50
|
+
- **behind only** → `git pull --ff-only`.
|
|
51
|
+
- **diverged** (both) → rebase or merge deliberately; never blind `--force`.
|
|
52
|
+
|
|
53
|
+
Branch from a base only after confirming `local <base>` equals `origin/<base>` — a squash-merge will otherwise silently bundle ahead-of-origin commits.
|
|
54
|
+
|
|
55
|
+
## Halt on Protected or Destructive Operations
|
|
56
|
+
|
|
57
|
+
STOP and get explicit authorization before:
|
|
58
|
+
|
|
59
|
+
- Pushing to a protected branch (e.g. `main`) — this repo's flow is feature branch + PR, never direct push.
|
|
60
|
+
- `git push --force` / `--force-with-lease`, `git reset --hard`, `git clean -fd`, `worktree remove` on a dirty worktree, or dropping a stash with uncommitted value.
|
|
61
|
+
|
|
62
|
+
If a rebase has diverged and force-push is gated, do not force-recover — supersede via a new branch + new PR.
|
|
63
|
+
|
|
64
|
+
## Verify the Push Actually Landed
|
|
65
|
+
|
|
66
|
+
A push that printed no error is still a claim. Confirm:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
git rev-parse HEAD
|
|
70
|
+
git ls-remote origin refs/heads/<branch> # remote tip must equal local HEAD
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If the remote ref is absent or behind, the push did not land — investigate before reporting success.
|
|
74
|
+
|
|
75
|
+
## Pairs With
|
|
76
|
+
|
|
77
|
+
- **`recall`** (Law 1) — before a risky git op, recall whether the same operation failed on this repo before.
|
|
78
|
+
- **`gateguard`** (Law 1) — the runtime gate (`hooks/gateguard.mjs`); `reconcile` is the procedure you run once a destructive git action is in play.
|
|
79
|
+
- **`safety-guard`** — destructive-operation guardrails for production and autonomous runs.
|
|
80
|
+
- **`audit`** (Law 4) — when an audit ends in a fix, `reconcile` is the safe path from branch to landed PR.
|
|
@@ -3,6 +3,7 @@ name: recovery-classification
|
|
|
3
3
|
tier: "2"
|
|
4
4
|
description: "Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. After any failure in the verification ladder or auto-loop, classify the failure class before retrying — provider, tool-schema, deterministic-policy, git, worktree, runtime — so retry-vs-pause-vs-self-heal-vs-stop is an intentional decision, not a generic 'try again'."
|
|
5
5
|
origin: continuous-improvement
|
|
6
|
+
user-invocable: false
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Recovery Classification Skill
|
package/skills/safety-guard.md
CHANGED
|
@@ -3,6 +3,7 @@ name: safety-guard
|
|
|
3
3
|
tier: "2"
|
|
4
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
5
|
origin: continuous-improvement
|
|
6
|
+
disable-model-invocation: true
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Safety Guard — Prevent Destructive Operations
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-distillation
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: Enforces Law 7 (Learn From Every Session) of the 7 Laws of AI Agent Discipline. Distills repeated successful tool sequences into reusable draft instincts, so a pattern that worked three times becomes a captured recipe instead of being re-derived from scratch every session.
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill Distillation — Turn Repeated Wins Into Reusable Instincts
|
|
10
|
+
|
|
11
|
+
Law 7 says learn from every session. The friction harvester already learns from failures. This skill learns from the other side: when the same tool sequence keeps ending in a passing verification, that is a recipe worth keeping — not a coincidence to forget.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
|
|
15
|
+
- At end of session, after a successful multi-step task — check whether the pattern is worth keeping.
|
|
16
|
+
- When you notice you have solved a similar problem the same way more than once.
|
|
17
|
+
- During a retrospective, to mine the observation log for patterns that have proven themselves.
|
|
18
|
+
|
|
19
|
+
## Core Concept
|
|
20
|
+
|
|
21
|
+
Distillation walks the observation log, groups it into contiguous trajectories (split on session change or a long time gap), and keeps only the trajectories that ended in success:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
verify-exit-0 — a Bash test/build/verify command with a non-failing output
|
|
25
|
+
reflection-pass — an observation containing "verified" / "phase 4" / "verify:all green"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
It then mines the tool-name sequences of successful trajectories for n-grams (length 3–5) that recurred **across multiple distinct sessions**. A pattern repeated only within a single session is rejected — that is repetition, not a reusable skill.
|
|
29
|
+
|
|
30
|
+
## The Promotion Ladder
|
|
31
|
+
|
|
32
|
+
Drafts never affect behavior until you promote them. Three explicit steps, no auto-promotion:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
1. ci_distill_candidates — list patterns that qualify (read-only)
|
|
36
|
+
2. ci_distill_propose id=<id> — write a DRAFT to ~/.claude/instincts/<hash>/drafts/
|
|
37
|
+
(placeholder body — you fill in the real recipe)
|
|
38
|
+
3. <edit the draft body by hand> — the tool sequence is evidence, not a recipe
|
|
39
|
+
4. ci_distill_promote id=<id> — promote to a live instinct at 0.5 confidence (SUGGEST)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The draft starts at 0.4 confidence and lives in a `drafts/` subdirectory that the instinct loader ignores. Only `ci_distill_promote` writes a live instinct, at 0.5 (SUGGEST tier) — it suggests, it does not auto-apply, until the normal reinforcement loop earns it more confidence.
|
|
43
|
+
|
|
44
|
+
## Why Drafts, Not Auto-Instincts
|
|
45
|
+
|
|
46
|
+
A tool sequence alone is cargo-cult evidence: `Read → Edit → Bash → Edit → Bash` is a TDD loop, but the *value* is in the preconditions and the specific steps, which the sequence does not capture. Requiring a human to edit the body before promotion is the guard against the system fabricating confident-sounding skills from coincidental call ordering.
|
|
47
|
+
|
|
48
|
+
## Limitations
|
|
49
|
+
|
|
50
|
+
- **Pattern detection only (no LLM in v1).** The draft body is a placeholder; you write the recipe. An optional model-assisted body draft is a planned follow-up.
|
|
51
|
+
- **Tool-name granularity.** Distillation sees tool names and summaries, not full intent. Two unrelated tasks with the same call shape will look like one pattern — the human edit step resolves this.
|
|
52
|
+
|
|
53
|
+
## Pairs With
|
|
54
|
+
|
|
55
|
+
- **`continuous-improvement`** (core SKILL.md, Law 7) — distillation is the success-side complement to the friction-harvest failure side of the same observation log.
|
|
56
|
+
- **`recall`** — before promoting, recall whether an existing instinct already covers the pattern.
|
|
57
|
+
- **`tdd-workflow`** — the most common distilled pattern is the RED-GREEN-REFACTOR loop; promote it with project-specific test commands filled in.
|
|
@@ -3,6 +3,7 @@ name: state-reconciliation
|
|
|
3
3
|
tier: "2"
|
|
4
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
5
|
origin: continuous-improvement
|
|
6
|
+
user-invocable: false
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# State Reconciliation Skill
|
|
@@ -3,6 +3,7 @@ name: strategic-compact
|
|
|
3
3
|
tier: "2"
|
|
4
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
5
|
origin: continuous-improvement
|
|
6
|
+
user-invocable: false
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Strategic Compact Skill
|
package/skills/superpowers.md
CHANGED
|
@@ -5,7 +5,7 @@ description: "Law activator for the 7 Laws of AI Agent Discipline. Unified four-
|
|
|
5
5
|
origin: https://github.com/obra/superpowers
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Superpowers — Mandatory Agent Workflows (
|
|
8
|
+
# Superpowers — Mandatory Agent Workflows (Four-Source Dispatcher)
|
|
9
9
|
|
|
10
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
11
|
|
|
@@ -94,6 +94,80 @@ When a task trigger fires, the dispatcher resolves to the first available skill
|
|
|
94
94
|
|
|
95
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.
|
|
96
96
|
|
|
97
|
+
## Companion-Preference Override
|
|
98
|
+
|
|
99
|
+
The four-source routing table above is **CI-first by default**: where a CI-bundled skill (`ci:tdd-workflow`, `ci:verification-loop`, `ci:planning-with-files`, `ci:context-budget`, `ci:ralph`, `ci:learn-eval`) and a companion skill resolve the same trigger, the table lists the CI skill first and the dispatcher picks it. That is the conservative default — the CI plugin ships with the marketplace, the companions are opt-in installs, so a clean install routes to skills that are guaranteed present.
|
|
100
|
+
|
|
101
|
+
Once the operator has explicitly installed a companion plugin (`superpowers@continuous-improvement`, `agent-skills@continuous-improvement`, `ruflo-swarm@continuous-improvement`, `oh-my-claudecode@continuous-improvement`), the default starts working against them: the installed companion is shadowed by the CI fallback for the same trigger. This override flag respects the operator's explicit install choice without forcing every user to relitigate routing per task.
|
|
102
|
+
|
|
103
|
+
### Setting the flag
|
|
104
|
+
|
|
105
|
+
Add a `continuous_improvement.companion_preference` key to `~/.claude/settings.json`:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"continuous_improvement": {
|
|
110
|
+
"companion_preference": "companions-first"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Valid values:
|
|
116
|
+
|
|
117
|
+
| Value | Behavior |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `"ci-first"` (default) | Unchanged from the routing tables above. CI-bundled skills win every chain where they appear. |
|
|
120
|
+
| `"companions-first"` | For any routing row that lists both a CI skill and a companion alternative, the dispatcher reads the chain right-to-left: companion first, CI as the silent fallback if the companion plugin is not installed. CI-only rows (`ci:gateguard`, `ci:deploy-receipt`, `ci:workspace-surface-audit`, `ci:proceed-with-the-recommendation`) are unaffected because no companion exists. |
|
|
121
|
+
| `"strict-companions"` | Same as `companions-first`, but the CI fallback is suppressed. If the companion plugin is not installed, the dispatcher hard-halts with the same shape as the missing-companion detection in `/superpowers` and asks the operator to install the companion or change the flag. Use when you want a guarantee that the installed companion ran, not the CI shim. |
|
|
122
|
+
|
|
123
|
+
### Which rows the override affects
|
|
124
|
+
|
|
125
|
+
These are the routing rows where the override changes the resolved target. Rows not listed here are CI-only or companion-only and route the same under any setting.
|
|
126
|
+
|
|
127
|
+
| Trigger | `ci-first` (default) | `companions-first` |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| Write a failing test before code | `ci:tdd-workflow` | `superpowers:test-driven-development`, then `agent-skills:test-driven-development` |
|
|
130
|
+
| Verify before declaring done | `ci:verification-loop` | `superpowers:verification-before-completion` |
|
|
131
|
+
| Curate the right context window | `ci:context-budget` | `agent-skills:context-engineering` |
|
|
132
|
+
| Long autonomous run with quality gates | `ci:ralph` | `oh-my-claudecode:ultrawork`, then `ci:ralph` |
|
|
133
|
+
| Reflect after session, extract patterns | `ci:learn-eval` | `oh-my-claudecode:retrospective` |
|
|
134
|
+
|
|
135
|
+
`superpowers:writing-plans` already wins the planning chain under both settings — it is the first entry, with `ci:planning-with-files` as the third fallback — so that row is unchanged.
|
|
136
|
+
|
|
137
|
+
### Hard halts that remain regardless of the flag
|
|
138
|
+
|
|
139
|
+
The override does not disable:
|
|
140
|
+
|
|
141
|
+
- `gateguard` PreToolUse fact-list enforcement (Law 1, runtime layer in `hooks/gateguard.mjs`)
|
|
142
|
+
- Stop-hook three-section-close discipline (Law 4 + Law 7, runtime layer in `hooks/three-section-close.mjs`)
|
|
143
|
+
- Dispatcher commitments 1–6 above (subagent-driven-development default, parallel fan-out routing, TDD RED-GREEN-REFACTOR, worktree isolation, finishing-a-development-branch before push, distinct Obra/CI variants)
|
|
144
|
+
- Phase 0 P-MAG in `proceed-with-the-recommendation` (Law 5 + Law 7)
|
|
145
|
+
|
|
146
|
+
These are framework invariants, not routing preferences. The flag re-orders which specialist runs; it does not weaken what the framework guarantees.
|
|
147
|
+
|
|
148
|
+
### Runtime enforcement
|
|
149
|
+
|
|
150
|
+
The override is enforced at the PreToolUse layer by `hooks/companion-preference.mjs`. On every `Skill` tool call, the hook reads `~/.claude/settings.json` for the `companion_preference` value and:
|
|
151
|
+
|
|
152
|
+
- `ci-first` (default): no-op, allow.
|
|
153
|
+
- `companions-first`: emit a one-line stderr advisory naming the preferred companion; allow.
|
|
154
|
+
- `strict-companions`: block the call. Reason names the companion when its plugin is installed, or the `/plugin install <plugin>@continuous-improvement` hint when it is not.
|
|
155
|
+
|
|
156
|
+
The override map inside `hooks/companion-preference.mjs` stays row-aligned with the "Which rows the override affects" table above. Drift surfaces in the hook test suite, which walks the same pairs and fails on any new CI→companion row that the hook does not recognize.
|
|
157
|
+
|
|
158
|
+
The hook fails open. If `~/.claude/settings.json` is missing, malformed, or unreadable, the hook emits `{ "decision": "allow" }` and exits 0. Bugs in the hook never block tool calls — they only fail to enforce.
|
|
159
|
+
|
|
160
|
+
### Telemetry
|
|
161
|
+
|
|
162
|
+
Every hook invocation that touches a mapped CI skill appends one JSONL line to `~/.claude/instincts/<project-hash>/companion-preference.jsonl`. The line carries `ts`, `mode`, `action`, `ci_skill`, `companion`, `plugin`, and `companion_installed`. The action enum is:
|
|
163
|
+
|
|
164
|
+
- `observation` — mode is `ci-first`; this is the shadow row showing what `companions-first` would have done.
|
|
165
|
+
- `advisory` — mode is `companions-first`; stderr advisory was emitted.
|
|
166
|
+
- `block` — mode is `strict-companions`; companion installed; tool call blocked.
|
|
167
|
+
- `block-not-installed` — mode is `strict-companions`; companion missing; blocked with install hint.
|
|
168
|
+
|
|
169
|
+
Non-mapped skills and non-`Skill` tool calls write nothing. The writer wraps `appendFileSync` in try/catch — telemetry failure never changes the hook decision, preserving the fail-open invariant. The JSONL file is the evidence base for a future default-flip decision: after a 7-day window, the operator can grep / aggregate the file to see which routing rows the override fires on, how often, and whether the companion was installed at the time.
|
|
170
|
+
|
|
97
171
|
## Stacked-PR Plan Precondition (≥3 files)
|
|
98
172
|
|
|
99
173
|
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.
|
|
@@ -206,7 +280,7 @@ Clean separation, parallel development, easy cleanup.
|
|
|
206
280
|
|
|
207
281
|
## Using Superpowers
|
|
208
282
|
|
|
209
|
-
Superpowers skills activate when their trigger conditions are detected. The dispatcher resolves each trigger through the
|
|
283
|
+
Superpowers skills activate when their trigger conditions are detected. The dispatcher resolves each trigger through the four-source routing table above:
|
|
210
284
|
|
|
211
285
|
- "Create a feature" → `superpowers:brainstorming` → `superpowers:writing-plans` → `superpowers:executing-plans`
|
|
212
286
|
- "Fix this bug" → `superpowers:systematic-debugging` → `superpowers:verification-before-completion`
|
|
@@ -38,7 +38,7 @@ Intercept the response flow to offer the user a choice about response depth **be
|
|
|
38
38
|
|
|
39
39
|
Use the repository's canonical context-budget heuristics to estimate the prompt's token count mentally.
|
|
40
40
|
|
|
41
|
-
Use the same calibration guidance as
|
|
41
|
+
Use the same calibration guidance as `context-budget`:
|
|
42
42
|
|
|
43
43
|
- prose: `words × 1.3`
|
|
44
44
|
- code-heavy or mixed/code blocks: `chars / 4`
|
|
@@ -23,7 +23,21 @@ Invoke this skill:
|
|
|
23
23
|
|
|
24
24
|
Every project has its own actual invocation for build / typecheck / lint / test / security / deploy-receipt. Hardcoding `npm run build` and `npm run test` works when the project happens to use those exact scripts; for everything else (pnpm, yarn, cargo, go, mise, just, custom scripts, monorepos with workspace-scoped commands) it returns "deps not installed" or "config not found" misreads from the wrong invocation. Phase 0 runs first so Phases 1–6 never have to guess.
|
|
25
25
|
|
|
26
|
-
**
|
|
26
|
+
**Run [`scripts/resolve-verify-ladder.mjs`](../scripts/resolve-verify-ladder.mjs)** at the repo root. It encodes the full four-step resolution priority and emits the fenced block below. Use `--json` for machine consumption.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
$ node scripts/resolve-verify-ladder.mjs
|
|
30
|
+
verify-ladder (resolved):
|
|
31
|
+
build: npm run build (sniff:package.json:scripts.build)
|
|
32
|
+
typecheck: npm run typecheck (sniff:package.json:scripts.typecheck)
|
|
33
|
+
lint: npm run lint (sniff:package.json:scripts.lint)
|
|
34
|
+
test: npm test (sniff:package.json:scripts.test)
|
|
35
|
+
security: (ask operator — no marker found)
|
|
36
|
+
deploy_receipt: (ask operator — no marker found)
|
|
37
|
+
synthetic_checks: (ask operator — no marker found)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Resolution priority** (first match wins; the script implements this — the prose is documentation):
|
|
27
41
|
|
|
28
42
|
1. **`.claude/verify-ladder.json` manifest** at the repo root. Schema:
|
|
29
43
|
```json
|
|
@@ -36,24 +50,12 @@ Every project has its own actual invocation for build / typecheck / lint / test
|
|
|
36
50
|
"deploy_receipt": "npx wrangler deployments list --json"
|
|
37
51
|
}
|
|
38
52
|
```
|
|
39
|
-
Any field omitted falls through to step 2 for that field only. A field set to the literal
|
|
40
|
-
2. **Sniff `package.json` `scripts`** for `build`, `typecheck` or `tsc`, `lint`, `test`, `audit` or `security`. Tie-breaker when multiple scripts could match a phase: prefer `verify:<phase>` over `<phase>` over `<phase
|
|
41
|
-
3. **Sniff per-language toolchain files** if `package.json` is absent: `Cargo.toml` → `cargo build` / `cargo test`, `go.mod` → `go build ./...` / `go test ./...`, `pyproject.toml` → `
|
|
42
|
-
4. **Ask the operator** if none of the above resolves the field. Do not invent.
|
|
53
|
+
Any field omitted falls through to step 2 for that field only. A field set to the literal JSON `null` means "skip this phase for this project" — the resolver records source `manifest:null`. Underscore-prefixed keys (`_doc`, `_node_example`, etc.) are ignored as documentation/examples.
|
|
54
|
+
2. **Sniff `package.json` `scripts`** for `build`, `typecheck` or `tsc`, `lint`, `test`, `audit` or `security`. Tie-breaker when multiple scripts could match a phase: prefer `verify:<phase>` over `<phase>` over `<phase>:*` (wildcard tail). Do NOT pick `test` when `verify:test` exists; the operator's explicit verification surface always wins over the convenience alias.
|
|
55
|
+
3. **Sniff per-language toolchain files** if `package.json` is absent: `Cargo.toml` → `cargo build` / `cargo check` / `cargo clippy` / `cargo test` / `cargo audit`, `go.mod` → `go build ./...` / `go vet ./...` / `go test ./...`, `pyproject.toml` → `pyright` / `ruff check .` / `pytest`, `Gemfile` → `bundle exec rspec` / `bundle exec rubocop`.
|
|
56
|
+
4. **Ask the operator** (source `ask-operator`) if none of the above resolves the field. Do not invent.
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
verify-ladder (resolved):
|
|
48
|
-
build: npm run build
|
|
49
|
-
typecheck: npx tsc --noEmit (sniff: package.json scripts.typecheck)
|
|
50
|
-
lint: npm run lint
|
|
51
|
-
test: npm test
|
|
52
|
-
security: (skipped — no script defined)
|
|
53
|
-
deploy_receipt: npx wrangler deployments list --json (manifest)
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Each row shows the resolved command + its source (manifest, sniff, or skipped). The fenced block is the contract surface — every later phase reads from this resolved ladder, never from a hardcoded fallback.
|
|
58
|
+
Each row shows the resolved command + its source (`manifest`, `sniff:<file>:<key>`, `manifest:null`, or `ask-operator`). The fenced block is the contract surface — every later phase reads from this resolved ladder, never from a hardcoded fallback.
|
|
57
59
|
|
|
58
60
|
A starter manifest is provided at `templates/verify-ladder.example.json`; copy it to `.claude/verify-ladder.json` and trim per project.
|
|
59
61
|
|
|
@@ -143,7 +145,11 @@ If either is `No`, the verification report goes back to the operator with the ex
|
|
|
143
145
|
|
|
144
146
|
### Phase 8: Deploy Receipt (auto-deploy projects only)
|
|
145
147
|
|
|
146
|
-
For repos whose `verify-ladder.json` declares a `deploy_receipt` field — or whose sniff path detects an auto-deploy target
|
|
148
|
+
For repos whose `verify-ladder.json` declares a `deploy_receipt` field — or whose sniff path detects an auto-deploy target — the verify is not complete until the deployed SHA matches the merge SHA and a healthcheck returns 200. Hand off to the `deploy-receipt` skill (Law 4 deploy-seam companion landed in PR #83) and treat its `Receipt status: COMPLETE` as the gate.
|
|
149
|
+
|
|
150
|
+
**Detection.** Run [`scripts/detect-deploy-target.sh`](../scripts/detect-deploy-target.sh) at the repo root. Output is one of `railway` / `cloudflare` / `vercel` / `netlify` / `fly` / `appengine` / `apprunner` / `gha-deploy` / `none`. Anything except `none` triggers handoff to `deploy-receipt`; `none` means Phase 8 is skipped (no deploy seam exists).
|
|
151
|
+
|
|
152
|
+
**SHA extraction.** For the detected provider, [`scripts/get-deployed-sha.sh <provider>`](../scripts/get-deployed-sha.sh) returns the currently-deployed SHA via the provider CLI; `--show-command <provider>` prints the pipeline shape without executing (useful for dry-runs and citation). `deploy-receipt` owns the receipt's other components (health endpoint, build artifact, on-incomplete modes) and Route B/C fallbacks.
|
|
147
153
|
|
|
148
154
|
INCOMPLETE receipts move to "Immediate operator action" in the close, never to "ready". Library-only / package-published repos skip this phase entirely (no deploy seam exists).
|
|
149
155
|
|
|
@@ -158,11 +164,13 @@ Phase 8 confirms the deploy seam. Phase 9 confirms the deployed surface matches
|
|
|
158
164
|
|
|
159
165
|
**What the runner does:**
|
|
160
166
|
|
|
167
|
+
Implementation: `scripts/run-synthetic.mjs` encodes the lexical walk, interpreter map, env injection, and exit-code aggregation below. The prose is documentation, not the contract — when the two disagree, the script wins.
|
|
168
|
+
|
|
161
169
|
1. List every `*.synthetic.{sh,mjs,ts,py}` file in the resolved directory in lexical order.
|
|
162
170
|
2. For each file, set the input env vars: `BASE_URL` (production base from project config), `BASELINE_URL` (staging baseline from project config), `EXPECTED_SHA` (the merge SHA Phase 8 reported COMPLETE), `DEPLOY_BRANCH` (the deploy branch name), `RECEIPT_TIMESTAMP` (ISO-8601 of the receipt).
|
|
163
171
|
3. Invoke the file via the right interpreter (`bash` for `.sh`, `node` for `.mjs`, `tsx` for `.ts`, `python` for `.py`). Files with unrecognized extensions are skipped with a warning.
|
|
164
172
|
4. Capture stdout + stderr + exit code per file. On exit 0, the check passed. On any non-zero exit, the check failed and stdout is the operator-facing diff.
|
|
165
|
-
5. Aggregate: if every file exited 0, Phase 9 is `PASS`. If any file exited non-zero, Phase 9 is `FAIL — synthetic drift on <filenames>` and the captured diffs go into the verification report verbatim (no agent re-summarization).
|
|
173
|
+
5. Aggregate: if every file exited 0, Phase 9 is `PASS`. If any file exited non-zero, Phase 9 is `FAIL — synthetic drift on <filenames>` and the captured diffs go into the verification report verbatim (no agent re-summarization). Exit code 2 with zero drift (every non-pass was a config error from the check itself) surfaces as `INCOMPLETE — config error` to distinguish "gate did not run" from "gate ran and found drift".
|
|
166
174
|
|
|
167
175
|
**Surfacing rule:**
|
|
168
176
|
|
|
@@ -3,6 +3,7 @@ name: wild-risa-balance
|
|
|
3
3
|
tier: "2"
|
|
4
4
|
description: Enforces Law 2 (Plan Is Sacred) of the 7 Laws of AI Agent Discipline. Decision-framing lens that pairs WILD generation with RISA execution when emitting recommendation lists. Not a runtime hook.
|
|
5
5
|
origin: continuous-improvement
|
|
6
|
+
user-invocable: false
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# WILD / RISA Balance
|
|
@@ -74,7 +74,7 @@ Probe and record (no destructive commands; quote results inline):
|
|
|
74
74
|
- **jq availability.** `command -v jq` (or `Get-Command jq`). When jq is missing, observation-pipeline hooks fall back to a thin schema and curl/JSON one-liners need a node/python rewrite.
|
|
75
75
|
- **Case-sensitive filesystem.** Test by creating two paths differing only in case in a tempdir. NTFS (Windows) and APFS (macOS default) are case-insensitive; Linux ext4 and case-sensitive APFS are case-sensitive. Affects `CLAUDE.md` vs `claude.md` resolution and import paths.
|
|
76
76
|
- **CWD baseline.** `pwd` (or `Get-Location`) recorded at session start. `tsc`, build scripts, and some test runners change CWD as a side effect; subsequent commands run from the wrong directory return "deps not installed" or "config not found" misreads.
|
|
77
|
-
- **Parallel-actor expectation.** Document whether a second Claude / Codex / Maulana session may operate on the same working tree. If yes, the `gateguard` Parallel-Actor Gate
|
|
77
|
+
- **Parallel-actor expectation.** Document whether a second Claude / Codex / Maulana session may operate on the same working tree. If yes, the `gateguard` Parallel-Actor Gate uses [`scripts/git-state-snapshot.sh`](../scripts/git-state-snapshot.sh) to produce a single JSON envelope (`{head, upstream, dirty, root, branch}`) for the baseline and the divergence check. This skill records whether parallel-actor is expected; gateguard owns the runtime mechanics, so the audit doesn't restate the git-command triple.
|
|
78
78
|
|
|
79
79
|
Output the recorded grain as a single fenced block so it survives context compaction and any later phase can reference it without re-probing:
|
|
80
80
|
|
|
@@ -3,6 +3,7 @@ name: worktree-safety
|
|
|
3
3
|
tier: "2"
|
|
4
4
|
description: "Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Pre-dispatch invariant: validate worktree root before any source-writing tool call. Catches missing .git, fallback path-only creation, stale leases, foreign-session ownership, and non-worktree git operations before they corrupt history."
|
|
5
5
|
origin: continuous-improvement
|
|
6
|
+
user-invocable: false
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Worktree Safety Skill
|
|
@@ -31,10 +32,10 @@ The continuous-improvement repo runs on Windows + Git Bash with `autocrlf=true`
|
|
|
31
32
|
|
|
32
33
|
Before any source-writing call, verify all five. Fail closed on any miss.
|
|
33
34
|
|
|
34
|
-
1. **Root validity** — `git rev-parse --show-toplevel` resolves; the resolved path matches CWD after symlink-safe canonicalization.
|
|
35
|
+
1. **Root validity** — `git rev-parse --show-toplevel` resolves; the resolved path matches CWD after symlink-safe canonicalization. The `root` field of [`scripts/git-state-snapshot.sh`](../scripts/git-state-snapshot.sh) carries the canonicalized root, and its non-zero exit on `{"error":"not-a-git-repo"}` is itself the fail-closed signal — no second probe needed.
|
|
35
36
|
2. **`.git` presence** — `.git` exists (file pointer for worktrees, directory for primary checkout). A missing or unreadable `.git` is an immediate stop.
|
|
36
37
|
3. **Worktree registration** — `git worktree list` includes the resolved root with no `prunable` flag. Prunable worktrees can be deleted by another process at any moment.
|
|
37
|
-
4. **Branch alignment** — current branch matches the lease ledger; `HEAD` is not detached unless the unit explicitly asked for detached state.
|
|
38
|
+
4. **Branch alignment** — current branch matches the lease ledger; `HEAD` is not detached unless the unit explicitly asked for detached state. The snapshot script's `branch` field carries either the branch name or the literal `"detached"`, so detached-state is observable without a second probe.
|
|
38
39
|
5. **Lease ownership** — the session ID in `.git/worktrees/<name>/lease` (or your equivalent ledger) matches this session. Stale or foreign leases block the call.
|
|
39
40
|
|
|
40
41
|
Output a single fenced block before any source-writing dispatch:
|