continuous-improvement 3.20.4 → 3.22.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.
Files changed (37) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +23 -0
  3. package/QUICKSTART.md +1 -1
  4. package/README.md +7 -6
  5. package/bin/check-reconcile-parity.mjs +168 -0
  6. package/bin/generate-plugin-manifests.mjs +2 -0
  7. package/bin/install.mjs +30 -69
  8. package/bin/reconcile.mjs +259 -0
  9. package/commands/production-readiness-review.md +5 -4
  10. package/commands/reconcile.md +30 -6
  11. package/commands/simplicity-review.md +35 -0
  12. package/commands/verify-install.md +2 -2
  13. package/hooks/session.mjs +85 -0
  14. package/lib/git-state.mjs +411 -0
  15. package/lib/plugin-metadata.mjs +18 -20
  16. package/llms.txt +1 -1
  17. package/package.json +6 -4
  18. package/plugins/beginner.json +1 -1
  19. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
  20. package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
  21. package/plugins/continuous-improvement/bin/reconcile.mjs +259 -0
  22. package/plugins/continuous-improvement/commands/production-readiness-review.md +5 -4
  23. package/plugins/continuous-improvement/commands/reconcile.md +30 -6
  24. package/plugins/continuous-improvement/commands/simplicity-review.md +35 -0
  25. package/plugins/continuous-improvement/commands/verify-install.md +2 -2
  26. package/plugins/continuous-improvement/hooks/hooks.json +15 -16
  27. package/plugins/continuous-improvement/hooks/session.mjs +85 -0
  28. package/plugins/continuous-improvement/lib/git-state.mjs +411 -0
  29. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +18 -20
  30. package/plugins/continuous-improvement/skills/README.md +1 -0
  31. package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +1 -0
  32. package/plugins/continuous-improvement/skills/reconcile/SKILL.md +62 -12
  33. package/plugins/continuous-improvement/skills/simplicity-review/SKILL.md +80 -0
  34. package/plugins/expert.json +1 -1
  35. package/skills/proceed-with-the-recommendation.md +1 -0
  36. package/skills/reconcile.md +62 -12
  37. package/skills/simplicity-review.md +80 -0
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: simplicity-review
3
+ tier: "2"
4
+ description: Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Reviews the current diff for over-engineering (code that could reuse an existing file, a stdlib or native feature, or fewer lines) and reports trim findings without touching code, so 'it works' is never mistaken for 'it is the minimum that works'.
5
+ origin: continuous-improvement
6
+ user-invocable: true
7
+ ---
8
+
9
+ # Simplicity Review — Flag the Over-Build Before It Ships
10
+
11
+ Law 4 says verify before reporting. "It compiles and the test passes" is a claim about correctness, not about whether the change is the minimum that works. This skill runs a diff-scoped review with one question: could this have been smaller? It reads the change like the laziest senior dev in the room, walks a fixed reuse ladder, and reports what to trim. It never edits code. The best code is the code you never wrote.
12
+
13
+ ## When to Activate
14
+
15
+ - After writing a feature or fix, before opening a PR, when the diff feels larger than the task warranted.
16
+ - When you reached for a new file, a new dependency, or a wrapper component and a native or existing option might already cover it.
17
+ - As a routed step from `proceed-with-the-recommendation` at the "Refactor / dead code cleanup" line, as the repo-owned alternative to the built-in `simplify`.
18
+ - Before a release cut, over the diff since the last tag, as a last pass on accreted complexity.
19
+
20
+ ## The Ladder
21
+
22
+ Read each added or changed block and stop at the first rung that holds:
23
+
24
+ ```
25
+ 1. Does this need to exist? -> skip it (YAGNI)
26
+ 2. Already in this codebase? -> reuse it
27
+ 3. Stdlib does it? -> use it
28
+ 4. Native platform feature? -> use it
29
+ 5. Installed dependency? -> use it
30
+ 6. One line? -> one line
31
+ 7. Only then: the minimum that works
32
+ ```
33
+
34
+ Most real cuts come from rungs 2 to 4: a hand-rolled helper that duplicates an existing one, a component built where a native input, a stdlib call, or a platform primitive already does the job.
35
+
36
+ ## Read Before You Cut
37
+
38
+ Lazy about the solution, never about the reading. The ladder shortens the solution, not the investigation. Trace the whole change and what it touches first. A "simpler" path proposed without reading the surrounding code is a guess, and a wrong trim is worse than the over-build.
39
+
40
+ ## Safety Carve-Out (Never Flag)
41
+
42
+ Lazy, not negligent. These are never on the chopping block, no matter how many lines they cost:
43
+
44
+ - Input validation at trust boundaries.
45
+ - Error handling that prevents data loss.
46
+ - Security controls (authz checks, escaping, secret handling).
47
+ - Accessibility.
48
+
49
+ This aligns with `rules/common/security.md` and `rules/common/coding-style.md`. If a trim would weaken any of the above, it is not a finding.
50
+
51
+ ## Output
52
+
53
+ A findings list. For each item:
54
+
55
+ - `file:line`
56
+ - `over-built:` what the code does the long way
57
+ - `simpler:` the specific shorter path (reuse existing `X` / stdlib `Y` / native `Z` / one line / delete)
58
+ - one-line rationale
59
+
60
+ Close with a verdict:
61
+
62
+ - `GO` — the diff is already at or near minimal; nothing to trim.
63
+ - `TRIM` — findings listed above; apply, then re-verify.
64
+
65
+ No score, no line-count target. A net-negative diff is a nice side effect, not the goal. Optimizing for fewer lines invites golfing and deletion of things that earn their keep; the ladder, not a number, decides.
66
+
67
+ ## Review Only
68
+
69
+ This skill reports; it does not edit. Apply the trims yourself or route them through `proceed-with-the-recommendation`, then run the `verification-loop` ladder on what changed. This mirrors `audit`'s confirm-before-fix: a finding is a hypothesis until the simpler path is proven to exist and to preserve behavior.
70
+
71
+ ## Overlap With `simplify`
72
+
73
+ The Claude Code built-in `simplify` and this skill share intent but differ in kind. `simplify` auto-applies broad reuse, efficiency, and altitude cleanups across changed code. `simplicity-review` is a repo-owned, Law-4-tagged, review-only lens scoped to over-engineering in the current diff, with an explicit safety carve-out, that feeds its findings into the 7-Laws flow. Use `simplify` when you want the fixes applied; use `simplicity-review` when you want the diff judged first.
74
+
75
+ ## Pairs With
76
+
77
+ - **`verification-loop`** (Law 4) — the build/test/lint ladder you run after applying a trim.
78
+ - **`gateguard`** (Law 1) — the write-time reuse gate ("confirm no existing file serves the same purpose"); this skill catches at review time what slipped past it.
79
+ - **`proceed-with-the-recommendation`** — applies the trims under the 7 Laws.
80
+ - **`wild-risa-balance`** (Law 2) — the recommendation-layer analog: the same anti-padding instinct applied to advice instead of code.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.20.4",
3
+ "version": "3.22.0",
4
4
  "mode": "expert",
5
5
  "description": "Expert mode: tune confidence, manage instincts, and persist plans on disk. Adds safety, token-budget, and strategic-compact skills plus the /learn-eval command so long sessions stay sharp and learnings survive context resets.",
6
6
  "tools": [
@@ -213,6 +213,7 @@ Rows whose **Preferred skill** is not bundled with the `continuous-improvement`
213
213
  | Fix bug / investigate failure | `superpowers:systematic-debugging` | Hypothesis → add logs/tests → reproduce → smallest fix → verify with the failing repro. (Reference behavior — does not require `superpowers:systematic-debugging`.) |
214
214
  | Write tests / add coverage | `superpowers:test-driven-development` or `tdd-workflow` | RED (failing test) → GREEN (minimal code) → REFACTOR; one test, one behavior |
215
215
  | Refactor / dead code cleanup | `simplify` | Find dupes/unused exports, delete in place, re-run type check and smallest test. (Reference behavior — does not require `simplify`.) |
216
+ | Over-engineering check on a diff | `simplicity-review` (bundled) | Walk the reuse ladder (existing file, stdlib, native feature, one line) over the current diff and report GO/TRIM without editing; apply trims, then re-run the smallest check. Never flags input validation, data-loss handling, security, or accessibility. |
216
217
  | Security review / auth audit | `security-review` | Scan for hardcoded secrets, unsanitized input, missing authz, SQL string concat, open CORS. (Reference behavior — does not require `security-review`.) |
217
218
  | Code review before merge | `superpowers:requesting-code-review` or `code-review` | Read diff top-to-bottom, flag CRITICAL / HIGH / MEDIUM. (Reference behavior — does not require `code-review`.) |
218
219
  | Verify before shipping | `superpowers:verification-before-completion` | Smallest check that proves correctness: typecheck + one test + one curl. (Reference behavior — does not require `superpowers:verification-before-completion`.) |
@@ -20,27 +20,65 @@ Law 1 says research before executing. The most expensive skipped research is the
20
20
 
21
21
  ## Establish Ground Truth First
22
22
 
23
- Read before you write. Capture the full state in one pass:
23
+ Read before you write. One command runs the whole pass and prints the resolved-state block:
24
24
 
25
25
  ```
26
- git branch --show-current
27
- git status --porcelain=v1
28
- git rev-list --left-right --count '@{u}...HEAD' # behind / ahead of upstream (quote the ref bare @{u} trips the Bash parser)
26
+ npx ci-reconcile # resolved-state block; exit 1 if anything blocks a mutation
27
+ npx ci-reconcile --json # the same state, machine-readable
28
+ npx ci-reconcile --explain # print the probe set and why each probe runs
29
+ ```
30
+
31
+ Exit codes: `0` nothing blocks, `1` at least one blocker, `2` not a git repository. The probe set is defined once in `src/lib/git-state.mts`, and `npm run verify:reconcile-parity` fails if this document drifts from it — the list below is the list the runner executes.
32
+
33
+ Run the pass by hand when the runner is not installed:
34
+
35
+ ```
36
+ git rev-parse --show-toplevel # inside a work tree, and where
37
+ git rev-parse HEAD # the sha every later claim is relative to
38
+ git symbolic-ref --quiet --short HEAD # branch name; NON-ZERO EXIT = detached HEAD
39
+ git rev-parse --abbrev-ref --symbolic-full-name @{u} # upstream, or non-zero = none configured
40
+ git rev-list --left-right --count @{u}...HEAD # behind/ahead — only after the line above succeeded
41
+ git status --porcelain=v1 # reported changes (inflated by autocrlf)
42
+ git diff --name-only --ignore-all-space # real content drift — the number to trust
29
43
  git stash list
30
- git worktree list
31
- ls .git/MERGE_HEAD .git/rebase-merge .git/rebase-apply 2>/dev/null # in-progress operation?
44
+ git worktree list --porcelain
45
+ git rev-parse --git-path MERGE_HEAD # in-progress op: test the RESOLVED path for existence
32
46
  ```
33
47
 
34
- 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.
48
+ Four boundaries make the obvious commands lie. Each was reproduced against real git; do not simplify them back.
49
+
50
+ - **No configured upstream.** Asking `git rev-list` for counts against `@{u}` exits **128** with `fatal: no upstream configured` — it does not return zeros. Probe for the upstream first and ask for counts only once it resolved. With no upstream, compare against `origin/<default>` explicitly; never read the failure as "even".
51
+ - **Detached HEAD.** The `--show-current` form of `git branch` prints an empty string and exits **0**, so a detached HEAD is indistinguishable from a successful read. `git symbolic-ref --quiet --short HEAD` exits non-zero instead, which is checkable. A detached HEAD blocks: there is no branch to commit onto, push, or name in a PR.
52
+ - **Linked worktrees.** Inside a worktree `.git` is a *file*, not a directory, so listing a `.git/`-relative path for `MERGE_HEAD` fails with "Not a directory" and exit **2** — byte-identical to the "no operation in progress" result on a clean tree. A real conflicted merge therefore reads as clean. Resolve the marker with `git rev-parse --git-path MERGE_HEAD` and test *that* path; it is correct in a main checkout and in a worktree alike. Same for `rebase-merge`, `rebase-apply`, `CHERRY_PICK_HEAD`, `REVERT_HEAD`, `BISECT_LOG`.
53
+ - **Windows `autocrlf=true`.** `git status` reports phantom line-ending-only modifications. Trust `git diff --stat` / `git diff --name-only --ignore-all-space` for real content drift. Never stage with `git add -A` / `git add .` on such a tree — stage by explicit filename. The runner prints both numbers so the gap is visible instead of assumed.
54
+
55
+ ## Compatibility
56
+
57
+ The ground-truth pass has to work wherever the agent runs, not only in Bash. `ci-reconcile` spawns `git` argv directly with no shell, so it needs no `bash`, no coreutils, and no `.git/`-relative path.
58
+
59
+ | Surface | PowerShell / cmd | Git Bash / WSL | POSIX shell | Linked worktree | Detached HEAD | No upstream |
60
+ |---|---|---|---|---|---|---|
61
+ | `ci-reconcile` (Node) | yes | yes | yes | correct | blocks | warns |
62
+ | `scripts/git-state-snapshot.sh` | needs Git Bash | yes | yes | root/branch only | reports `detached` | reports `none` |
63
+ | Hand-run probe list above | yes | yes | yes | correct | non-zero exit | non-zero exit |
64
+
65
+ Smoke-test on the OS you actually ship on. Both surfaces emit the same `{head, upstream, dirty, root, branch}` envelope — `ci-reconcile --snapshot` adds `contentDrift` and `inProgress` — and a test pins that parity so the two cannot drift apart silently.
35
66
 
36
67
  ## Detect a Concurrent Writer
37
68
 
38
69
  When another session/loop may be active, do not assume the tree is yours:
39
70
 
40
- - 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.
41
- - Re-read the current branch immediately before any mutation; if it shifted since your snapshot, re-survey from the top.
42
- - If `.git/index` keeps changing while you are idle, a writer is active. Pause and surface it rather than racing.
43
- - If `gateguard` is installed, its Parallel-Actor Gate already captured this baseline on the session's first mutation by running `bash "${CLAUDE_PLUGIN_ROOT}/scripts/git-state-snapshot.sh"` (source: `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.
71
+ - 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. The runner reports this as a blocker; the retired `.git/`-relative probe could not see it inside a worktree at all.
72
+ - **Re-read HEAD and the branch immediately before every mutation, not once per session.** Capture a baseline, then compare right before you commit, push, or rebase:
73
+ ```
74
+ npx ci-reconcile --snapshot > .git/reconcile-baseline.json # or any scratch path
75
+ # ... do work ...
76
+ npx ci-reconcile --snapshot # compare head + branch against the baseline
77
+ ```
78
+ If either field moved, another writer got there first — re-survey from the top instead of committing onto an unexpected base. A missing or unparseable field counts as *shifted*; "we could not tell" is never "nothing moved".
79
+ - More than one entry in `git worktree list --porcelain` means a sibling checkout exists that another session may be writing to. The runner flags this.
80
+ - If the git index keeps changing while you are idle, a writer is active. Pause and surface it rather than racing.
81
+ - If `gateguard` is installed, its Parallel-Actor Gate already captured this baseline on the session's first mutation by running `bash "${CLAUDE_PLUGIN_ROOT}/scripts/git-state-snapshot.sh"` (source: `scripts/git-state-snapshot.sh`) and divergence-checks every later mutation — `reconcile` complements that gate, it does not replace it. That shell snapshot needs Git Bash and derives its `dirty` count from `git status`, which overstates drift on an `autocrlf` tree; `ci-reconcile --snapshot` is the same envelope without either limitation. Without gateguard, run one of them yourself.
44
82
 
45
83
  ## Classify, Then Act
46
84
 
@@ -99,12 +137,24 @@ Once ground truth is known and the halt gates are clear, carry the work to an op
99
137
 
100
138
  A push that printed no error is still a claim. Confirm:
101
139
 
140
+ ```
141
+ npx ci-reconcile --verify-push <branch> # exit 0 only when the remote tip equals local HEAD
142
+ ```
143
+
144
+ or by hand:
145
+
102
146
  ```
103
147
  git rev-parse HEAD
104
148
  git ls-remote origin refs/heads/<branch> # remote tip must equal local HEAD
105
149
  ```
106
150
 
107
- If the remote ref is absent or behind, the push did not land investigate before reporting success.
151
+ There are **three** outcomes here, not two, and collapsing them is how a false report gets made:
152
+
153
+ - **landed** — the probe succeeded and the remote tip equals local HEAD.
154
+ - **not-landed** — the probe succeeded and the ref is absent, or points at a different sha. The push really did not land.
155
+ - **unverified** — `git ls-remote` itself failed (network, auth, remote down). This is *not* evidence the push failed; it is evidence you do not know. Retry the probe. Never report success, and never report failure, from a probe that did not run.
156
+
157
+ Report only what the probe proved.
108
158
 
109
159
  ## Sync the Default Branch After the PR Merges
110
160
 
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: simplicity-review
3
+ tier: "2"
4
+ description: Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Reviews the current diff for over-engineering (code that could reuse an existing file, a stdlib or native feature, or fewer lines) and reports trim findings without touching code, so 'it works' is never mistaken for 'it is the minimum that works'.
5
+ origin: continuous-improvement
6
+ user-invocable: true
7
+ ---
8
+
9
+ # Simplicity Review — Flag the Over-Build Before It Ships
10
+
11
+ Law 4 says verify before reporting. "It compiles and the test passes" is a claim about correctness, not about whether the change is the minimum that works. This skill runs a diff-scoped review with one question: could this have been smaller? It reads the change like the laziest senior dev in the room, walks a fixed reuse ladder, and reports what to trim. It never edits code. The best code is the code you never wrote.
12
+
13
+ ## When to Activate
14
+
15
+ - After writing a feature or fix, before opening a PR, when the diff feels larger than the task warranted.
16
+ - When you reached for a new file, a new dependency, or a wrapper component and a native or existing option might already cover it.
17
+ - As a routed step from `proceed-with-the-recommendation` at the "Refactor / dead code cleanup" line, as the repo-owned alternative to the built-in `simplify`.
18
+ - Before a release cut, over the diff since the last tag, as a last pass on accreted complexity.
19
+
20
+ ## The Ladder
21
+
22
+ Read each added or changed block and stop at the first rung that holds:
23
+
24
+ ```
25
+ 1. Does this need to exist? -> skip it (YAGNI)
26
+ 2. Already in this codebase? -> reuse it
27
+ 3. Stdlib does it? -> use it
28
+ 4. Native platform feature? -> use it
29
+ 5. Installed dependency? -> use it
30
+ 6. One line? -> one line
31
+ 7. Only then: the minimum that works
32
+ ```
33
+
34
+ Most real cuts come from rungs 2 to 4: a hand-rolled helper that duplicates an existing one, a component built where a native input, a stdlib call, or a platform primitive already does the job.
35
+
36
+ ## Read Before You Cut
37
+
38
+ Lazy about the solution, never about the reading. The ladder shortens the solution, not the investigation. Trace the whole change and what it touches first. A "simpler" path proposed without reading the surrounding code is a guess, and a wrong trim is worse than the over-build.
39
+
40
+ ## Safety Carve-Out (Never Flag)
41
+
42
+ Lazy, not negligent. These are never on the chopping block, no matter how many lines they cost:
43
+
44
+ - Input validation at trust boundaries.
45
+ - Error handling that prevents data loss.
46
+ - Security controls (authz checks, escaping, secret handling).
47
+ - Accessibility.
48
+
49
+ This aligns with `rules/common/security.md` and `rules/common/coding-style.md`. If a trim would weaken any of the above, it is not a finding.
50
+
51
+ ## Output
52
+
53
+ A findings list. For each item:
54
+
55
+ - `file:line`
56
+ - `over-built:` what the code does the long way
57
+ - `simpler:` the specific shorter path (reuse existing `X` / stdlib `Y` / native `Z` / one line / delete)
58
+ - one-line rationale
59
+
60
+ Close with a verdict:
61
+
62
+ - `GO` — the diff is already at or near minimal; nothing to trim.
63
+ - `TRIM` — findings listed above; apply, then re-verify.
64
+
65
+ No score, no line-count target. A net-negative diff is a nice side effect, not the goal. Optimizing for fewer lines invites golfing and deletion of things that earn their keep; the ladder, not a number, decides.
66
+
67
+ ## Review Only
68
+
69
+ This skill reports; it does not edit. Apply the trims yourself or route them through `proceed-with-the-recommendation`, then run the `verification-loop` ladder on what changed. This mirrors `audit`'s confirm-before-fix: a finding is a hypothesis until the simpler path is proven to exist and to preserve behavior.
70
+
71
+ ## Overlap With `simplify`
72
+
73
+ The Claude Code built-in `simplify` and this skill share intent but differ in kind. `simplify` auto-applies broad reuse, efficiency, and altitude cleanups across changed code. `simplicity-review` is a repo-owned, Law-4-tagged, review-only lens scoped to over-engineering in the current diff, with an explicit safety carve-out, that feeds its findings into the 7-Laws flow. Use `simplify` when you want the fixes applied; use `simplicity-review` when you want the diff judged first.
74
+
75
+ ## Pairs With
76
+
77
+ - **`verification-loop`** (Law 4) — the build/test/lint ladder you run after applying a trim.
78
+ - **`gateguard`** (Law 1) — the write-time reuse gate ("confirm no existing file serves the same purpose"); this skill catches at review time what slipped past it.
79
+ - **`proceed-with-the-recommendation`** — applies the trims under the 7 Laws.
80
+ - **`wild-risa-balance`** (Law 2) — the recommendation-layer analog: the same anti-padding instinct applied to advice instead of code.