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.
Files changed (96) hide show
  1. package/.claude-plugin/marketplace.json +2 -14
  2. package/CHANGELOG.md +25 -0
  3. package/LICENSE +21 -21
  4. package/QUICKSTART.md +148 -101
  5. package/README.md +50 -18
  6. package/action.yml +33 -33
  7. package/bin/analyze.sh +161 -161
  8. package/bin/backfill.mjs +19 -19
  9. package/bin/check-doc-runtime-claims.mjs +120 -0
  10. package/bin/generate-plugin-manifests.mjs +2 -0
  11. package/bin/hook-stats.mjs +21 -21
  12. package/bin/install.mjs +51 -44
  13. package/bin/mcp-server.mjs +43 -40
  14. package/bin/refresh-third-party.mjs +416 -416
  15. package/commands/continuous-improvement.md +115 -115
  16. package/commands/dashboard.md +56 -56
  17. package/commands/discipline.md +51 -51
  18. package/commands/proceed-with-the-recommendation.md +62 -62
  19. package/commands/seven-laws.md +16 -16
  20. package/commands/superpowers.md +119 -92
  21. package/commands/workspace-surface-audit.md +77 -77
  22. package/hooks/gateguard.mjs +172 -0
  23. package/hooks/observe.sh +172 -172
  24. package/hooks/session.sh +106 -106
  25. package/hooks/three-section-close.mjs +181 -181
  26. package/instinct-packs/go.json +58 -58
  27. package/instinct-packs/meta.json +16 -16
  28. package/instinct-packs/python.json +58 -58
  29. package/instinct-packs/react.json +58 -58
  30. package/lib/gateguard-state.mjs +85 -0
  31. package/lib/plugin-metadata.mjs +25 -18
  32. package/llms.txt +68 -68
  33. package/package.json +3 -2
  34. package/plugins/beginner.json +1 -1
  35. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +1 -1
  36. package/plugins/continuous-improvement/.claude-plugin/plugin.json +1 -1
  37. package/plugins/continuous-improvement/LICENSE +21 -21
  38. package/plugins/continuous-improvement/README.md +1 -0
  39. package/plugins/continuous-improvement/agents/README.md +120 -0
  40. package/plugins/continuous-improvement/agents/code-reviewer.md +97 -0
  41. package/plugins/continuous-improvement/agents/security-auditor.md +101 -0
  42. package/plugins/continuous-improvement/agents/test-engineer.md +95 -0
  43. package/plugins/continuous-improvement/bin/backfill.mjs +19 -19
  44. package/plugins/continuous-improvement/bin/mcp-server.mjs +43 -40
  45. package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -115
  46. package/plugins/continuous-improvement/commands/dashboard.md +56 -56
  47. package/plugins/continuous-improvement/commands/discipline.md +51 -51
  48. package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -62
  49. package/plugins/continuous-improvement/commands/seven-laws.md +16 -16
  50. package/plugins/continuous-improvement/commands/superpowers.md +119 -92
  51. package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -77
  52. package/plugins/continuous-improvement/hooks/gateguard.mjs +172 -0
  53. package/plugins/continuous-improvement/hooks/hooks.json +6 -1
  54. package/plugins/continuous-improvement/hooks/observe.sh +172 -172
  55. package/plugins/continuous-improvement/hooks/session.sh +106 -106
  56. package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -181
  57. package/plugins/continuous-improvement/instinct-packs/go.json +58 -58
  58. package/plugins/continuous-improvement/instinct-packs/meta.json +16 -16
  59. package/plugins/continuous-improvement/instinct-packs/python.json +58 -58
  60. package/plugins/continuous-improvement/instinct-packs/react.json +58 -58
  61. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +25 -18
  62. package/plugins/continuous-improvement/skills/README.md +4 -1
  63. package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +47 -0
  64. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +17 -9
  65. package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -108
  66. package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +1 -8
  67. package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -221
  68. package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +73 -0
  69. package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -76
  70. package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +63 -0
  71. package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -104
  72. package/plugins/continuous-improvement/skills/superpowers/SKILL.md +22 -15
  73. package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -411
  74. package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -136
  75. package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +32 -0
  76. package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -191
  77. package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +66 -0
  78. package/plugins/expert.json +1 -1
  79. package/skills/README.md +79 -79
  80. package/skills/deploy-receipt.md +47 -0
  81. package/skills/gateguard.md +17 -9
  82. package/skills/para-memory-files.md +108 -108
  83. package/skills/proceed-with-the-recommendation.md +1 -8
  84. package/skills/ralph.md +221 -221
  85. package/skills/recovery-classification.md +73 -0
  86. package/skills/safety-guard.md +76 -76
  87. package/skills/state-reconciliation.md +63 -0
  88. package/skills/strategic-compact.md +104 -104
  89. package/skills/superpowers.md +22 -15
  90. package/skills/tdd-workflow.md +411 -411
  91. package/skills/token-budget-advisor.md +136 -136
  92. package/skills/verification-loop.md +32 -0
  93. package/skills/wild-risa-balance.md +191 -191
  94. package/skills/worktree-safety.md +66 -0
  95. package/templates/insights-claude-md.md +91 -0
  96. package/templates/verify-ladder.example.json +37 -24
@@ -1,191 +1,191 @@
1
- ---
2
- name: wild-risa-balance
3
- tier: "2"
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
- origin: continuous-improvement
6
- ---
7
-
8
- # WILD / RISA Balance
9
-
10
- ## When to Use
11
-
12
- - Emitting a multi-item recommendation block (≥3 items)
13
- - Choosing between a safe option and a bold option
14
- - Reviewing your own plan for over-cautiousness or over-fantasy
15
- - Pairing with `proceed-with-the-recommendation` to decide which items belong above and below the cut
16
-
17
- ## The Two Modes
18
-
19
- ### RISA (Execution)
20
-
21
- - **R**ealistic — fits the constraints in front of you
22
- - **I**mportant — moves a stated goal, not a vanity metric
23
- - **S**pecific — names files, commands, or owners
24
- - **A**greeable — the operator can approve it without a meeting
25
-
26
- If you only stay in RISA, you ship safe, average results.
27
-
28
- ### WILD (Creation)
29
-
30
- - **W**ild — breaks the default frame
31
- - **I**maginative — invents an option that did not exist a minute ago
32
- - **L**imitless — ignores current budget, headcount, or stack
33
- - **D**isruptive — replaces a workflow rather than tuning it
34
-
35
- If you only stay in WILD, you generate cool ideas that never ship.
36
-
37
- ## The Trap
38
-
39
- RISA alone produces a backlog of incremental fixes that never compound. WILD alone produces a graveyard of demos that never reach production. The bigger failure is unconscious switching: drifting into WILD during execution, or drifting into RISA during brainstorming, without naming the switch. Name the mode you are in before you write the next line.
40
-
41
- ## Switching Deliberately
42
-
43
- | Phase | Mode | Why |
44
- |-------------------------|-------|----------------------------------------------------|
45
- | Brainstorm | WILD | Quantity and range beat early filtering |
46
- | Roadmap framing | WILD | Frame the bigger bet before scoping it down |
47
- | Per-item recommendation | Mixed | Top items can be WILD, baseline items must be RISA |
48
- | Per-item execution | RISA | One thing, verified, shipped |
49
- | Verification | RISA | Reality check, no new invention |
50
- | Reflection | WILD | Counterfactuals, "what would have been bolder" |
51
-
52
- WILD owns generation phases. RISA owns execution phases. The switch is intentional, not accidental.
53
-
54
- ## How to Apply in a Recommendation List
55
-
56
- When this skill is in play, every recommendation block ships **at least 7 items**, split as:
57
-
58
- 1. **Top block — WILD pilots: exactly 2 bold items.** Present both; the operator picks at most one to actually run. If you cannot find a second genuinely bold option, stretch — do not pad with a safe item dressed up as wild.
59
- 2. **Bottom block — RISA baseline: at least 5 safe items.** These ship now regardless of the WILD bet. If you cannot reach 5, the surface is under-explored — expand scope before emitting the list.
60
- 3. Within each block, rank descending by impact.
61
- 4. Once the list is composed, wait for the operator's "proceed" signal before invoking `proceed-with-the-recommendation`. Never auto-trigger it. This skill only changes how the list is composed.
62
-
63
- Total floor: **2 WILD + 5 RISA = 7 items minimum.** Going above is fine; going below means the skill was not applied.
64
-
65
- The point: the operator gets a real WILD/RISA contrast (2 bold bets weighed against a 5-deep trusted baseline), not a flat list where the bold option silently competes with safe ones and loses by default.
66
-
67
- ## Audience Tiers (beginner vs expert)
68
-
69
- Recommendation blocks ship in **two tiers** depending on the operator's signaled level. The 2 WILD + ≥5 RISA floor described above is the **expert** tier. Beginners get a different, lighter shape. The point: under-load for experts and overload for beginners are both failure modes — splitting the format prevents both.
70
-
71
- ### Tier selection
72
-
73
- **Default = expert.** Switch to beginner only when one of these triggers fires:
74
-
75
- - **Explicit flag** — the operator types `/beginner` or refers to themselves as a beginner ("for beginner", "as a beginner", "I'm new to this").
76
- - **Explicit lite framing** — "simple list", "just the top 3", "small list", "short version", "no need for surgical".
77
- - **Auto-detect heuristic** — the **first message of the thread** contains any of: `beginner`, `new to (this|claude|the system)`, `simple`, `explain like`, `first time`, `i'm just starting`, `i'm learning`. Single-message false positives are acceptable — the operator flips with `/expert` if mismatched.
78
-
79
- The operator can override mid-thread: `/expert` switches back to WILD+RISA, `/beginner` switches back to the lite tier. Apply the most recently named tier.
80
-
81
- ### Beginner tier (lite shape)
82
-
83
- When in beginner tier:
84
-
85
- - **3 minimum, 5 maximum** items. No padding past 5. Below 3 means there is no recommendation — write `Recommendation: no`.
86
- - **Goal-driven** — each item names the outcome, not the mechanism. Format: `<verb> <thing> → <observable result>`.
87
- - **Execution-first** — each item is a concrete next action, not a tradeoff to weigh.
88
- - **One-shot, iterate from there** — no "surgical change" framing, no phased sequencing, no commit-size gates. Get to a working pass, then improve.
89
- - **Optimized for the latest Opus model (Opus 4.7 at time of writing)** — assume the model holds the full task in one shot. Do not pre-decompose into micro-steps that fight the model's reasoning depth. Lean on broader, outcome-shaped instructions over fine-grained scripts.
90
- - Order: descending impact.
91
- - No WILD/RISA labels. No counts annotation. No tiered tables.
92
-
93
- ### Expert tier (default for Naim, default in this repo)
94
-
95
- The full WILD+RISA structure documented above: ≥7 items, exactly 2 WILD + ≥5 RISA, WILD on top descending, RISA below descending, counts annotated inline.
96
-
97
- Each item still leads with the outcome inside both WILD and RISA: `<verb> <thing> → <observable result>`.
98
-
99
- ### Tier signal in the 3-section close
100
-
101
- When Phase 7's three-section close lands, the `## Recommendation` header carries an explicit tier suffix:
102
-
103
- - Expert: `## Recommendation (expert)`
104
- - Beginner: `## Recommendation (beginner)`
105
-
106
- The Stop hook regex (`^#+ +Recommendation(?:\s|$)`) already accepts both forms — the suffix is documentation, not a gate. The point is a self-describing audit trail: a future reader (or an instinct scan) can tell which tier was applied without re-deriving it from item count or label presence.
107
-
108
- ### The "no" escape valve (both tiers)
109
-
110
- If neither tier can produce a real recommendation — every candidate item would be padding, or you cannot reach the tier's floor (3 for beginner, 7 for expert) without inventing busywork — write `Recommendation: no` and stop. This applies to **both tiers equally**.
111
-
112
- `no` is not absence. It is an explicit signal that the current session or perspective is exhausted on this surface and the operator should switch context: a fresh session (cold prompt cache, no carryover bias), a different specialist agent (different perspective on the same problem), a different framing (re-scoping the goal), or sleep on it. Padding to hit the floor is the failure mode this escape exists to prevent — a flat 3-item beginner list of "review the README, run the tests, commit your changes" is worse than `Recommendation: no` because it disguises an empty thought as work.
113
-
114
- When `no` ships, the Phase 7 close header still carries the tier suffix (`## Recommendation (expert)` or `## Recommendation (beginner)`) so the audit trail records which tier exhausted itself, and the body is just the literal `no` on its own line. No tiered tables, no WILD/RISA blocks, no "Want me to: A or B?" closer.
115
-
116
- ## Proactive Roadmap Surfacing (surface, do not execute)
117
-
118
- A "wait for instructions" agent fails by silence — sitting on a known next step (visible roadmap, deferred item from a prior session) until told. A "proactive" agent fails by running that step without being asked. Both lose. Surface bridges them: raise the next step as a recommendation item, never as a fait accompli.
119
-
120
- ### Trigger conditions
121
-
122
- Surface a next step when any of these are true:
123
-
124
- - A persistent roadmap names an undone step — MemoryCore `current-session.md`, `docs/plans/*`, `⚠️ Deferred` entries in a project `CLAUDE.md`, or pending operator actions logged in MemoryCore.
125
- - The current task is finished and a stated session goal implies the next one.
126
- - The session has drifted from a stated roadmap (asked to do A, but B is now blocked by A's choice).
127
- - An instinct or memory record predicts a near-term action the operator typically forgets (e.g., "rotate keys before next deploy", "push branch after N commits").
128
-
129
- ### Hard boundary — surface, do not execute
130
-
131
- Surfacing emits the next step as a recommendation item. It does **not** mean running the command, editing the file, or shipping the change. Execution still requires explicit "proceed", "go", "run it", or equivalent. The boundary is non-negotiable:
132
-
133
- - Global CLAUDE.md: "If instructions conflict or information is missing, stop and ask."
134
- - Auto Mode: even in autonomous execution, "anything that deletes data or modifies shared or production systems still needs explicit user confirmation."
135
- - Trust is asymmetric — one unauthorized "helpful" action costs more than a hundred missed surfacings. Recovery is one-way.
136
-
137
- ### Format
138
-
139
- A surfaced item lives inside the normal RISA block. Mark it inline as `(surfaced — <source>)` so the operator can tell which items came from the roadmap vs. the current request:
140
-
141
- ```
142
- RISA baseline — ship regardless (5 of ≥5)
143
- 1. Run remote D1 migration before next deploy → unblocks Close/Cancel admin button. (surfaced — pending operator action since 2026-05-04)
144
- 2. ...
145
- ```
146
-
147
- A WILD-tier reframe of the roadmap itself (not a single deferred step, but a re-shape of the whole next phase) goes in the WILD block instead, with the same `(surfaced — <source>)` marker.
148
-
149
- ### Anti-patterns
150
-
151
- - Re-surfacing an item the operator explicitly deferred — once is a reminder, three times is nagging. After one repeat, log the defer reason to memory and stop.
152
- - Surfacing speculative steps with no source in any roadmap or memory ("you should also consider…" without a citation).
153
- - Bundling a surface with execution ("I went ahead and started X"). Surface, wait, execute on go.
154
- - Treating absence of a roadmap as license to invent one — if no roadmap exists and none was requested, ask before drafting.
155
-
156
- The point: the operator never has to remember a deferred item, and never has to forgive an unauthorized one. Both at once.
157
-
158
- ## Integration with the 7 Laws
159
-
160
- | Mode | Reinforces | Tempered by |
161
- |------|---------------------------------------------------------|--------------------------|
162
- | RISA | Law 2 (Plan), Law 3 (One Thing), Law 4 (Verify) | Law 6 (Iterate One Thing) |
163
- | WILD | Law 1 (Research — broader exploration), Law 5 (Reflect) | Law 6 (Iterate One Thing) |
164
-
165
- Both modes pass through Law 6 before execution. WILD without Law 6 is a wishlist. RISA without Law 6 ships safe fixes while the real bottleneck waits.
166
-
167
- ## Example
168
-
169
- ```
170
- Recommendations (descending impact within each block)
171
-
172
- WILD pilots — pick at most one (2 of 2)
173
- 1. Replace the current review workflow with a single adversarial pair.
174
- 2. Drop the staging environment in favor of feature-flagged production.
175
-
176
- RISA baseline — ship regardless (5 of ≥5)
177
- 1. Add the missing test for the failure path noted in verification.
178
- 2. Rename the ambiguous flag to match its actual behavior.
179
- 3. Backfill the type on the public export that currently widens to `any`.
180
- 4. Wire the existing Stop hook into the new skill's checklist gate.
181
- 5. Update the README mirror so the bundled plugin matches the source skill. (surfaced — verify:skill-mirror gate flagged drift in last CI run)
182
- ```
183
-
184
- Total: 7 items (2 WILD + 5 RISA). That is the floor — emit more on either side if the surface warrants it. The fifth RISA item is marked `(surfaced — <source>)` to demonstrate the convention from the Proactive Roadmap Surfacing section: items lifted from a roadmap or memory carry an inline source attribution so the operator can tell roadmap-driven items apart from current-request items.
185
-
186
- ## Related
187
-
188
- - `continuous-improvement` — the 7 Laws card (core skill)
189
- - `proceed-with-the-recommendation` — execution arm; carries surfaced items across the surface → execute boundary defined in the Proactive Roadmap Surfacing section above
190
- - `superpowers:brainstorming` — upstream WILD generator
191
- - `verification-loop` — downstream RISA verifier
1
+ ---
2
+ name: wild-risa-balance
3
+ tier: "2"
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
+ origin: continuous-improvement
6
+ ---
7
+
8
+ # WILD / RISA Balance
9
+
10
+ ## When to Use
11
+
12
+ - Emitting a multi-item recommendation block (≥3 items)
13
+ - Choosing between a safe option and a bold option
14
+ - Reviewing your own plan for over-cautiousness or over-fantasy
15
+ - Pairing with `proceed-with-the-recommendation` to decide which items belong above and below the cut
16
+
17
+ ## The Two Modes
18
+
19
+ ### RISA (Execution)
20
+
21
+ - **R**ealistic — fits the constraints in front of you
22
+ - **I**mportant — moves a stated goal, not a vanity metric
23
+ - **S**pecific — names files, commands, or owners
24
+ - **A**greeable — the operator can approve it without a meeting
25
+
26
+ If you only stay in RISA, you ship safe, average results.
27
+
28
+ ### WILD (Creation)
29
+
30
+ - **W**ild — breaks the default frame
31
+ - **I**maginative — invents an option that did not exist a minute ago
32
+ - **L**imitless — ignores current budget, headcount, or stack
33
+ - **D**isruptive — replaces a workflow rather than tuning it
34
+
35
+ If you only stay in WILD, you generate cool ideas that never ship.
36
+
37
+ ## The Trap
38
+
39
+ RISA alone produces a backlog of incremental fixes that never compound. WILD alone produces a graveyard of demos that never reach production. The bigger failure is unconscious switching: drifting into WILD during execution, or drifting into RISA during brainstorming, without naming the switch. Name the mode you are in before you write the next line.
40
+
41
+ ## Switching Deliberately
42
+
43
+ | Phase | Mode | Why |
44
+ |-------------------------|-------|----------------------------------------------------|
45
+ | Brainstorm | WILD | Quantity and range beat early filtering |
46
+ | Roadmap framing | WILD | Frame the bigger bet before scoping it down |
47
+ | Per-item recommendation | Mixed | Top items can be WILD, baseline items must be RISA |
48
+ | Per-item execution | RISA | One thing, verified, shipped |
49
+ | Verification | RISA | Reality check, no new invention |
50
+ | Reflection | WILD | Counterfactuals, "what would have been bolder" |
51
+
52
+ WILD owns generation phases. RISA owns execution phases. The switch is intentional, not accidental.
53
+
54
+ ## How to Apply in a Recommendation List
55
+
56
+ When this skill is in play, every recommendation block ships **at least 7 items**, split as:
57
+
58
+ 1. **Top block — WILD pilots: exactly 2 bold items.** Present both; the operator picks at most one to actually run. If you cannot find a second genuinely bold option, stretch — do not pad with a safe item dressed up as wild.
59
+ 2. **Bottom block — RISA baseline: at least 5 safe items.** These ship now regardless of the WILD bet. If you cannot reach 5, the surface is under-explored — expand scope before emitting the list.
60
+ 3. Within each block, rank descending by impact.
61
+ 4. Once the list is composed, wait for the operator's "proceed" signal before invoking `proceed-with-the-recommendation`. Never auto-trigger it. This skill only changes how the list is composed.
62
+
63
+ Total floor: **2 WILD + 5 RISA = 7 items minimum.** Going above is fine; going below means the skill was not applied.
64
+
65
+ The point: the operator gets a real WILD/RISA contrast (2 bold bets weighed against a 5-deep trusted baseline), not a flat list where the bold option silently competes with safe ones and loses by default.
66
+
67
+ ## Audience Tiers (beginner vs expert)
68
+
69
+ Recommendation blocks ship in **two tiers** depending on the operator's signaled level. The 2 WILD + ≥5 RISA floor described above is the **expert** tier. Beginners get a different, lighter shape. The point: under-load for experts and overload for beginners are both failure modes — splitting the format prevents both.
70
+
71
+ ### Tier selection
72
+
73
+ **Default = expert.** Switch to beginner only when one of these triggers fires:
74
+
75
+ - **Explicit flag** — the operator types `/beginner` or refers to themselves as a beginner ("for beginner", "as a beginner", "I'm new to this").
76
+ - **Explicit lite framing** — "simple list", "just the top 3", "small list", "short version", "no need for surgical".
77
+ - **Auto-detect heuristic** — the **first message of the thread** contains any of: `beginner`, `new to (this|claude|the system)`, `simple`, `explain like`, `first time`, `i'm just starting`, `i'm learning`. Single-message false positives are acceptable — the operator flips with `/expert` if mismatched.
78
+
79
+ The operator can override mid-thread: `/expert` switches back to WILD+RISA, `/beginner` switches back to the lite tier. Apply the most recently named tier.
80
+
81
+ ### Beginner tier (lite shape)
82
+
83
+ When in beginner tier:
84
+
85
+ - **3 minimum, 5 maximum** items. No padding past 5. Below 3 means there is no recommendation — write `Recommendation: no`.
86
+ - **Goal-driven** — each item names the outcome, not the mechanism. Format: `<verb> <thing> → <observable result>`.
87
+ - **Execution-first** — each item is a concrete next action, not a tradeoff to weigh.
88
+ - **One-shot, iterate from there** — no "surgical change" framing, no phased sequencing, no commit-size gates. Get to a working pass, then improve.
89
+ - **Optimized for the latest Opus model (Opus 4.7 at time of writing)** — assume the model holds the full task in one shot. Do not pre-decompose into micro-steps that fight the model's reasoning depth. Lean on broader, outcome-shaped instructions over fine-grained scripts.
90
+ - Order: descending impact.
91
+ - No WILD/RISA labels. No counts annotation. No tiered tables.
92
+
93
+ ### Expert tier (default for Naim, default in this repo)
94
+
95
+ The full WILD+RISA structure documented above: ≥7 items, exactly 2 WILD + ≥5 RISA, WILD on top descending, RISA below descending, counts annotated inline.
96
+
97
+ Each item still leads with the outcome inside both WILD and RISA: `<verb> <thing> → <observable result>`.
98
+
99
+ ### Tier signal in the 3-section close
100
+
101
+ When Phase 7's three-section close lands, the `## Recommendation` header carries an explicit tier suffix:
102
+
103
+ - Expert: `## Recommendation (expert)`
104
+ - Beginner: `## Recommendation (beginner)`
105
+
106
+ The Stop hook regex (`^#+ +Recommendation(?:\s|$)`) already accepts both forms — the suffix is documentation, not a gate. The point is a self-describing audit trail: a future reader (or an instinct scan) can tell which tier was applied without re-deriving it from item count or label presence.
107
+
108
+ ### The "no" escape valve (both tiers)
109
+
110
+ If neither tier can produce a real recommendation — every candidate item would be padding, or you cannot reach the tier's floor (3 for beginner, 7 for expert) without inventing busywork — write `Recommendation: no` and stop. This applies to **both tiers equally**.
111
+
112
+ `no` is not absence. It is an explicit signal that the current session or perspective is exhausted on this surface and the operator should switch context: a fresh session (cold prompt cache, no carryover bias), a different specialist agent (different perspective on the same problem), a different framing (re-scoping the goal), or sleep on it. Padding to hit the floor is the failure mode this escape exists to prevent — a flat 3-item beginner list of "review the README, run the tests, commit your changes" is worse than `Recommendation: no` because it disguises an empty thought as work.
113
+
114
+ When `no` ships, the Phase 7 close header still carries the tier suffix (`## Recommendation (expert)` or `## Recommendation (beginner)`) so the audit trail records which tier exhausted itself, and the body is just the literal `no` on its own line. No tiered tables, no WILD/RISA blocks, no "Want me to: A or B?" closer.
115
+
116
+ ## Proactive Roadmap Surfacing (surface, do not execute)
117
+
118
+ A "wait for instructions" agent fails by silence — sitting on a known next step (visible roadmap, deferred item from a prior session) until told. A "proactive" agent fails by running that step without being asked. Both lose. Surface bridges them: raise the next step as a recommendation item, never as a fait accompli.
119
+
120
+ ### Trigger conditions
121
+
122
+ Surface a next step when any of these are true:
123
+
124
+ - A persistent roadmap names an undone step — MemoryCore `current-session.md`, `docs/plans/*`, `⚠️ Deferred` entries in a project `CLAUDE.md`, or pending operator actions logged in MemoryCore.
125
+ - The current task is finished and a stated session goal implies the next one.
126
+ - The session has drifted from a stated roadmap (asked to do A, but B is now blocked by A's choice).
127
+ - An instinct or memory record predicts a near-term action the operator typically forgets (e.g., "rotate keys before next deploy", "push branch after N commits").
128
+
129
+ ### Hard boundary — surface, do not execute
130
+
131
+ Surfacing emits the next step as a recommendation item. It does **not** mean running the command, editing the file, or shipping the change. Execution still requires explicit "proceed", "go", "run it", or equivalent. The boundary is non-negotiable:
132
+
133
+ - Global CLAUDE.md: "If instructions conflict or information is missing, stop and ask."
134
+ - Auto Mode: even in autonomous execution, "anything that deletes data or modifies shared or production systems still needs explicit user confirmation."
135
+ - Trust is asymmetric — one unauthorized "helpful" action costs more than a hundred missed surfacings. Recovery is one-way.
136
+
137
+ ### Format
138
+
139
+ A surfaced item lives inside the normal RISA block. Mark it inline as `(surfaced — <source>)` so the operator can tell which items came from the roadmap vs. the current request:
140
+
141
+ ```
142
+ RISA baseline — ship regardless (5 of ≥5)
143
+ 1. Run remote D1 migration before next deploy → unblocks Close/Cancel admin button. (surfaced — pending operator action since 2026-05-04)
144
+ 2. ...
145
+ ```
146
+
147
+ A WILD-tier reframe of the roadmap itself (not a single deferred step, but a re-shape of the whole next phase) goes in the WILD block instead, with the same `(surfaced — <source>)` marker.
148
+
149
+ ### Anti-patterns
150
+
151
+ - Re-surfacing an item the operator explicitly deferred — once is a reminder, three times is nagging. After one repeat, log the defer reason to memory and stop.
152
+ - Surfacing speculative steps with no source in any roadmap or memory ("you should also consider…" without a citation).
153
+ - Bundling a surface with execution ("I went ahead and started X"). Surface, wait, execute on go.
154
+ - Treating absence of a roadmap as license to invent one — if no roadmap exists and none was requested, ask before drafting.
155
+
156
+ The point: the operator never has to remember a deferred item, and never has to forgive an unauthorized one. Both at once.
157
+
158
+ ## Integration with the 7 Laws
159
+
160
+ | Mode | Reinforces | Tempered by |
161
+ |------|---------------------------------------------------------|--------------------------|
162
+ | RISA | Law 2 (Plan), Law 3 (One Thing), Law 4 (Verify) | Law 6 (Iterate One Thing) |
163
+ | WILD | Law 1 (Research — broader exploration), Law 5 (Reflect) | Law 6 (Iterate One Thing) |
164
+
165
+ Both modes pass through Law 6 before execution. WILD without Law 6 is a wishlist. RISA without Law 6 ships safe fixes while the real bottleneck waits.
166
+
167
+ ## Example
168
+
169
+ ```
170
+ Recommendations (descending impact within each block)
171
+
172
+ WILD pilots — pick at most one (2 of 2)
173
+ 1. Replace the current review workflow with a single adversarial pair.
174
+ 2. Drop the staging environment in favor of feature-flagged production.
175
+
176
+ RISA baseline — ship regardless (5 of ≥5)
177
+ 1. Add the missing test for the failure path noted in verification.
178
+ 2. Rename the ambiguous flag to match its actual behavior.
179
+ 3. Backfill the type on the public export that currently widens to `any`.
180
+ 4. Wire the existing Stop hook into the new skill's checklist gate.
181
+ 5. Update the README mirror so the bundled plugin matches the source skill. (surfaced — verify:skill-mirror gate flagged drift in last CI run)
182
+ ```
183
+
184
+ Total: 7 items (2 WILD + 5 RISA). That is the floor — emit more on either side if the surface warrants it. The fifth RISA item is marked `(surfaced — <source>)` to demonstrate the convention from the Proactive Roadmap Surfacing section: items lifted from a roadmap or memory carry an inline source attribution so the operator can tell roadmap-driven items apart from current-request items.
185
+
186
+ ## Related
187
+
188
+ - `continuous-improvement` — the 7 Laws card (core skill)
189
+ - `proceed-with-the-recommendation` — execution arm; carries surfaced items across the surface → execute boundary defined in the Proactive Roadmap Surfacing section above
190
+ - `superpowers:brainstorming` — upstream WILD generator
191
+ - `verification-loop` — downstream RISA verifier
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: worktree-safety
3
+ tier: "2"
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
+ origin: continuous-improvement
6
+ ---
7
+
8
+ # Worktree Safety Skill
9
+
10
+ A pre-dispatch invariant. Before any tool call that writes source files or runs git, validate that the current working directory is a registered worktree with a healthy `.git`, owned by this session, on the expected branch.
11
+
12
+ ## When to Use
13
+
14
+ - Before every Edit / Write / Bash that touches source code in a multi-worktree session.
15
+ - Before any `git` command in an auto-loop.
16
+ - After any pause/resume — CWD may have drifted, the worktree may have been pruned, the lease may have expired.
17
+ - When the verification ladder reports a class-`worktree` failure (see `recovery-classification`).
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 "Worktree Safety" as one of four runtime invariant modules. Common failure modes it catches:
22
+
23
+ - **Units dispatch into ghost / invalid worktree roots** — `.git` missing, fallback path-only creation, the worktree was pruned but the loop kept its handle.
24
+ - **Health checks unit-specific instead of lifecycle-wide** — earlier units (sketch, plan) write into invalid roots before any check runs.
25
+ - **Brittle exit / merge signals** — relying on artifact presence instead of authoritative branch and commit state.
26
+ - **Parallel actors mutating the working tree of a worktree they don't own** — a known hazard on this host (see `feedback_parallel_actor.md`).
27
+
28
+ The continuous-improvement repo runs on Windows + Git Bash with `autocrlf=true` and a parallel-actor expectation, both of which make weak worktree handling expensive.
29
+
30
+ ## The Five-Check Envelope
31
+
32
+ Before any source-writing call, verify all five. Fail closed on any miss.
33
+
34
+ 1. **Root validity** — `git rev-parse --show-toplevel` resolves; the resolved path matches CWD after symlink-safe canonicalization.
35
+ 2. **`.git` presence** — `.git` exists (file pointer for worktrees, directory for primary checkout). A missing or unreadable `.git` is an immediate stop.
36
+ 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
+ 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
+ Output a single fenced block before any source-writing dispatch:
41
+
42
+ ```
43
+ worktree-safety (resolved):
44
+ root: d:/Ai/ci-wt-skill-trio (matches CWD, canonicalized)
45
+ .git: file pointer → /shared/.git/worktrees/skill-trio (present)
46
+ registration: listed in `git worktree list` (not prunable)
47
+ branch: feat/verification-ladder-skill-trio (matches lease)
48
+ lease: owned by session 4f2a (this session) → CLEAR
49
+ ```
50
+
51
+ If any line is non-`CLEAR`, dispatch is blocked and the failure routes to `recovery-classification` as class `worktree`.
52
+
53
+ ## Anti-Patterns
54
+
55
+ - **Per-tool checks, not lifecycle checks.** Validating only at execute-task lets sketch / plan / research units write into invalid roots first.
56
+ - **Trusting CWD.** A `process.chdir` (or operator `cd`) in another loop iteration can leave CWD pointing at a pruned worktree. Re-resolve every time; do not cache.
57
+ - **Fallback-to-primary on worktree miss.** Silently writing to the primary checkout when the worktree is broken is the worst recovery — it corrupts the wrong branch with no audit trail.
58
+ - **Skipping lease ownership.** Two sessions in the same worktree race on every commit. The lease is the authoritative single-writer signal; do not skip it because "it's only one session" — that assumption breaks the moment a parallel actor appears.
59
+ - **Allowing detached HEAD silently.** A detached HEAD is sometimes legitimate (bisect, snapshot read), but every check must name whether detached is expected for this unit.
60
+
61
+ ## Pairs With
62
+
63
+ - [verification-loop](verification-loop.md) — runs as a pre-Phase-0 invariant; the resolved-safety block fires before the resolved-ladder block.
64
+ - [state-reconciliation](state-reconciliation.md) — both fire before dispatch; safety runs first because reconciliation depends on a valid worktree root.
65
+ - [recovery-classification](recovery-classification.md) — any non-`CLEAR` line routes here as class `worktree`.
66
+ - [gateguard](gateguard.md) — gateguard fires at the tool boundary; worktree-safety is the lifecycle counterpart that runs before tool dispatch is even considered.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.8.0",
3
+ "version": "3.9.2",
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 disciplined and learnings survive context resets.",
6
6
  "tools": [