continuous-improvement 3.1.0 → 3.9.1
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 +66 -0
- package/CHANGELOG.md +216 -0
- package/QUICKSTART.md +79 -12
- package/README.md +229 -349
- package/SKILL.md +87 -9
- package/action.yml +1 -1
- package/bin/analyze.sh +9 -1
- package/bin/backfill.mjs +172 -0
- package/bin/check-doc-runtime-claims.mjs +120 -0
- package/bin/check-docs-substrings.mjs +333 -0
- package/bin/check-everything-mirror.mjs +145 -0
- package/bin/check-routing-targets.mjs +151 -0
- package/bin/check-skill-law-tag.mjs +128 -0
- package/bin/check-skill-mirror.mjs +119 -0
- package/bin/check-skill-tiers.mjs +116 -0
- package/bin/check-third-party-shape.mjs +202 -0
- package/bin/generate-plugin-manifests.mjs +171 -0
- package/bin/harvest-friction.mjs +279 -0
- package/bin/hook-stats.mjs +258 -0
- package/bin/install.mjs +407 -499
- package/bin/lint-transcript.mjs +182 -210
- package/bin/mcp-server.mjs +834 -608
- package/bin/observe.mjs +148 -0
- package/bin/pre-commit-block-strays.sh +49 -0
- package/bin/refresh-third-party.mjs +416 -0
- package/bin/unified-cli.mjs +533 -0
- package/commands/continuous-improvement.md +43 -2
- package/commands/discipline.md +14 -0
- package/commands/harvest.md +76 -0
- package/commands/learn-eval.md +117 -0
- package/commands/planning-with-files.md +66 -0
- package/commands/proceed-with-the-recommendation.md +62 -0
- package/commands/ralph.md +103 -0
- package/commands/release-train.md +81 -0
- package/commands/seven-laws.md +16 -0
- package/commands/superpowers.md +180 -0
- package/commands/swarm.md +101 -0
- package/commands/workspace-surface-audit.md +77 -0
- package/hooks/gateguard.mjs +172 -0
- package/hooks/observe.sh +42 -4
- package/hooks/session.sh +3 -3
- package/hooks/three-section-close.mjs +181 -0
- package/instinct-packs/meta.json +16 -0
- package/lib/cli-anything.mjs +401 -0
- package/lib/compound-engineering.mjs +831 -0
- package/lib/gateguard-state.mjs +85 -0
- package/lib/observe-event.mjs +128 -0
- package/lib/plugin-metadata.mjs +435 -0
- package/lib/pm-marketplace.mjs +61 -0
- package/lib/pm-skills.mjs +1274 -0
- package/lib/resolve-home-dir.mjs +43 -0
- package/lib/skill-tiers.mjs +137 -0
- package/lib/unified-plugin.mjs +924 -0
- package/llms.txt +32 -7
- package/package.json +29 -19
- package/plugins/beginner.json +17 -6
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
- package/plugins/continuous-improvement/LICENSE +21 -0
- package/plugins/continuous-improvement/README.md +57 -0
- package/plugins/continuous-improvement/agents/README.md +120 -0
- package/plugins/continuous-improvement/agents/code-reviewer.md +97 -0
- package/plugins/continuous-improvement/agents/security-auditor.md +101 -0
- package/plugins/continuous-improvement/agents/test-engineer.md +95 -0
- package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +889 -0
- package/plugins/continuous-improvement/bin/observe.mjs +148 -0
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
- package/plugins/continuous-improvement/commands/dashboard.md +56 -0
- package/plugins/continuous-improvement/commands/discipline.md +51 -0
- package/plugins/continuous-improvement/commands/harvest.md +76 -0
- package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
- package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
- package/plugins/continuous-improvement/commands/ralph.md +103 -0
- package/plugins/continuous-improvement/commands/release-train.md +81 -0
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
- package/plugins/continuous-improvement/commands/superpowers.md +180 -0
- package/plugins/continuous-improvement/commands/swarm.md +101 -0
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
- package/plugins/continuous-improvement/hooks/gateguard.mjs +172 -0
- package/plugins/continuous-improvement/hooks/hooks.json +65 -0
- package/plugins/continuous-improvement/hooks/observe.sh +172 -0
- package/plugins/continuous-improvement/hooks/session.sh +106 -0
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
- package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +435 -0
- package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
- package/plugins/continuous-improvement/skills/README.md +37 -0
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +178 -0
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +163 -0
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +447 -0
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
- package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +73 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
- package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +63 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +219 -0
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +224 -0
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
- package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
- package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +66 -0
- package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
- package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
- package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
- package/plugins/expert.json +26 -5
- package/skills/README.md +79 -0
- package/skills/deploy-receipt.md +178 -0
- package/skills/gateguard.md +163 -0
- package/skills/para-memory-files.md +108 -0
- package/skills/proceed-with-the-recommendation.md +447 -0
- package/skills/ralph.md +221 -0
- package/skills/recovery-classification.md +73 -0
- package/skills/safety-guard.md +76 -0
- package/skills/state-reconciliation.md +63 -0
- package/skills/strategic-compact.md +104 -0
- package/skills/superpowers.md +219 -0
- package/skills/tdd-workflow.md +411 -0
- package/skills/token-budget-advisor.md +136 -0
- package/skills/verification-loop.md +224 -0
- package/skills/wild-risa-balance.md +191 -0
- package/skills/workspace-surface-audit.md +147 -0
- package/skills/worktree-safety.md +66 -0
- package/templates/insights-claude-md.md +91 -0
- package/templates/planning-with-files/findings.md +8 -0
- package/templates/planning-with-files/progress.md +7 -0
- package/templates/planning-with-files/task_plan.md +23 -0
- package/templates/verify-ladder.example.json +60 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: superpowers
|
|
3
|
+
description: "Law activator and dispatcher — route the task to the right Law-aligned specialist across continuous-improvement and four vendored upstream skill libraries (Obra superpowers, addy-agent-skills, ruflo-swarm, oh-my-claudecode)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /superpowers
|
|
7
|
+
|
|
8
|
+
`/superpowers` is **the dispatcher**, not a peer skill. It does not do work itself; it routes each user task to the correct Law-aligned specialist so the right discipline fires automatically instead of the agent skipping a step.
|
|
9
|
+
|
|
10
|
+
The 7 Laws define *what* discipline must be applied. `/superpowers` decides *which specialist* enforces it for this specific task, across five sources installed from this marketplace.
|
|
11
|
+
|
|
12
|
+
## Routing surface (five sources)
|
|
13
|
+
|
|
14
|
+
| Source | Where it lives | Examples of what it routes to |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `continuous-improvement` (this plugin) | bundled — always present | `gateguard` (Law 1), `tdd-workflow` (Law 3+4), `verification-loop` (Law 4), `wild-risa-balance` (Law 2), `safety-guard` (Law 3), `proceed-with-the-recommendation` (all 7), `ralph` (Law 6), `workspace-surface-audit` (Law 1) |
|
|
17
|
+
| `obra/superpowers` (Jesse Vincent) | vendored at `third-party/superpowers/`, pinned SHA `f2cbfbe` (v5.1.0) | `superpowers:brainstorming`, `:writing-plans`, `:executing-plans`, `:test-driven-development`, `:systematic-debugging`, `:requesting-code-review`, `:receiving-code-review`, `:verification-before-completion`, `:dispatching-parallel-agents`, `:using-git-worktrees`, `:finishing-a-development-branch`, `:subagent-driven-development`, `:writing-skills`, `:using-superpowers` |
|
|
18
|
+
| `addyosmani/agent-skills` | vendored at `third-party/addy-agent-skills/`, pinned SHA `742dca5` (v1.0.0) | `spec-driven-development`, `source-driven-development`, `context-engineering`, `idea-refine`, `incremental-implementation`, `code-review-and-quality`, `code-simplification`, `security-and-hardening`, `debugging-and-error-recovery`, `performance-optimization`, `api-and-interface-design`, `frontend-ui-engineering`, `browser-testing-with-devtools`, `ci-cd-and-automation`, `deprecation-and-migration`, `documentation-and-adrs`, `git-workflow-and-versioning`, `planning-and-task-breakdown`, `shipping-and-launch` |
|
|
19
|
+
| `ruflo-swarm` (ruvnet) | vendored at `third-party/ruflo-swarm/`, pinned SHA `addb5cd` (v0.2.0) | `swarm-init`, `monitor-stream`; `swarm_*` and `agent_*` MCP tools; `/swarm`, `/watch` |
|
|
20
|
+
| `oh-my-claudecode` (Yeachan-Heo) | vendored at `third-party/oh-my-claudecode/`, pinned SHA `aacde3e` (v4.13.6) | 39 skills + 19 agents — `release`, `ultrawork`, `ultraqa`, `team`, `trace`, `visual-verdict`, `debug`, `deep-dive`, `deep-interview`, `autopilot`, `autoresearch`, plus a separate `ralph` (overlaps with our `/ralph` — see "Distinct variants" below) |
|
|
21
|
+
|
|
22
|
+
PM coverage (product-management skills) lives **outside** this marketplace. If you need it, install [`phuryn/pm-skills`](https://github.com/phuryn/pm-skills) separately via Claude Code's host marketplace; the dispatcher names it as a routing target without pre-resolving the namespace. See [docs/THIRD_PARTY.md § Routing in /superpowers](../docs/THIRD_PARTY.md#routing-in-superpowers).
|
|
23
|
+
|
|
24
|
+
## Distinct variants — never collapse them
|
|
25
|
+
|
|
26
|
+
Two routing targets carry the same short name across sources. Treat them as distinct; do not silently substitute one for the other.
|
|
27
|
+
|
|
28
|
+
| Short name | `obra/superpowers` (Obra) | `continuous-improvement` (CI fork) |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `superpowers` (skill) | activator routing into Obra skills | `superpowers` skill in this repo: Law-aligned activator wrapping the dispatcher commitments below |
|
|
31
|
+
| `ralph` | not present in Obra | bundled here; `oh-my-claudecode` ships its own `ralph` — pick deliberately, do not auto-merge |
|
|
32
|
+
|
|
33
|
+
If both Obra `superpowers` and continuous-improvement are loaded, you can call either explicitly: `superpowers:test-driven-development` (Obra) or `tdd-workflow` (CI). Same Law (3+4), different implementation depth.
|
|
34
|
+
|
|
35
|
+
## Dispatcher commitments (override looser global defaults when `/superpowers` is in scope)
|
|
36
|
+
|
|
37
|
+
When this dispatcher is active for a task, these six rules apply over any looser convention:
|
|
38
|
+
|
|
39
|
+
1. **Subagent-driven development is the default for non-trivial tasks.** Two-stage spec + quality review per [obra/superpowers § subagent-driven-development](https://github.com/obra/superpowers).
|
|
40
|
+
2. **Parallel fan-out goes through `superpowers:dispatching-parallel-agents`** (or `/swarm`), not hand-rolled `Task` calls.
|
|
41
|
+
3. **TDD runs RED → GREEN → REFACTOR.** Code written before its test is **deleted**, not retrofitted. Routes to `tdd-workflow` (CI) or `superpowers:test-driven-development` (Obra) — pick by depth, never both for the same task.
|
|
42
|
+
4. **Branch isolation is `using-git-worktrees`** by default for any task that touches more than one file.
|
|
43
|
+
5. **`finishing-a-development-branch` runs before any push.** No bypass via `--no-verify`, `--force`, or direct push to `main`.
|
|
44
|
+
6. **Obra `superpowers` and `continuous-improvement:superpowers` stay distinct.** Both can be installed; neither shadows the other; the dispatcher names which one is firing.
|
|
45
|
+
|
|
46
|
+
## Routing rules (which source wins)
|
|
47
|
+
|
|
48
|
+
| User intent | Preferred routing target | Source |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| New feature, vague requirements | `superpowers:brainstorming` → `:writing-plans` | `obra/superpowers` |
|
|
51
|
+
| Fix this bug | `superpowers:systematic-debugging` → `tdd-workflow` (RED first) → `verification-loop` | Obra → CI → CI |
|
|
52
|
+
| Walk an agent's recommendation list | `proceed-with-the-recommendation` | CI |
|
|
53
|
+
| Write tests for new code | `tdd-workflow` (CI default) or `superpowers:test-driven-development` (Obra, deeper) | CI / Obra |
|
|
54
|
+
| Verify before reporting "done" | `verification-loop` | CI |
|
|
55
|
+
| Refactor, multi-file | `superpowers:using-git-worktrees` → `:writing-plans` → `tdd-workflow` → `:finishing-a-development-branch` | Obra → Obra → CI → Obra |
|
|
56
|
+
| Long autonomous PRD execution | `/ralph` (CI variant) | CI |
|
|
57
|
+
| Parallel sub-agent fan-out | `superpowers:dispatching-parallel-agents` or `/swarm` | Obra / ruflo-swarm |
|
|
58
|
+
| Spec-first, contract-first feature | `spec-driven-development` | addy-agent-skills |
|
|
59
|
+
| Frontend / UI generation | `frontend-design` (external plugin) | external |
|
|
60
|
+
| Diff walk + severity tagging | `code-review` (external plugin) or `superpowers:requesting-code-review` | external / Obra |
|
|
61
|
+
| Library / framework docs lookup | `documentation-lookup` (Context7 MCP) | external |
|
|
62
|
+
| Compliance / security gate | `security-and-hardening` (addy) → `security-review` (host built-in) | addy → host |
|
|
63
|
+
| Release coordination across PRs | `/release-train` | CI |
|
|
64
|
+
|
|
65
|
+
## Missing-companion detection
|
|
66
|
+
|
|
67
|
+
If `/superpowers` is asked to route to a source that is not installed, it does not silently fall back to the inline placeholder. It must:
|
|
68
|
+
|
|
69
|
+
1. **Name the missing source** explicitly (e.g. `obra/superpowers` not loaded).
|
|
70
|
+
2. **Quote the exact install line** for it from the marketplace already added in setup, e.g. `/plugin install superpowers@continuous-improvement`.
|
|
71
|
+
3. **State the inline-fallback equivalent** that will run if the user declines to install (and which Law that fallback enforces).
|
|
72
|
+
4. **Stop and ask** before continuing. Do not silently downgrade.
|
|
73
|
+
|
|
74
|
+
This is the same hard-halt discipline used by `proceed-with-the-recommendation` for `needs-approval` items.
|
|
75
|
+
|
|
76
|
+
## Subcommands
|
|
77
|
+
|
|
78
|
+
### `/superpowers status`
|
|
79
|
+
|
|
80
|
+
Show which routing sources are loaded, which workflow stages are active for the current task, and which sources are **missing**:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
=== Superpowers Status ===
|
|
84
|
+
|
|
85
|
+
Sources:
|
|
86
|
+
[x] continuous-improvement (bundled)
|
|
87
|
+
[x] obra/superpowers v5.1.0 (vendored)
|
|
88
|
+
[ ] addyosmani/agent-skills MISSING — /plugin install agent-skills@continuous-improvement
|
|
89
|
+
[x] ruflo-swarm v0.2.0 (vendored)
|
|
90
|
+
[ ] oh-my-claudecode MISSING — /plugin install oh-my-claudecode@continuous-improvement
|
|
91
|
+
|
|
92
|
+
Active for current task:
|
|
93
|
+
[x] brainstorming (trigger: new feature request)
|
|
94
|
+
[ ] using-git-worktrees (waiting: design approval)
|
|
95
|
+
[ ] writing-plans (waiting: worktree ready)
|
|
96
|
+
[ ] test-driven-development (waiting: plan approved)
|
|
97
|
+
[ ] requesting-code-review (waiting: implementation)
|
|
98
|
+
[ ] finishing-a-development-branch (waiting: completion)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### `/superpowers enable <skill>`
|
|
102
|
+
|
|
103
|
+
Explicitly enable a skill for the current session — useful when the dispatcher's intent detection guesses wrong:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
/superpowers enable test-driven-development
|
|
107
|
+
/superpowers enable superpowers:writing-plans # namespaced form for Obra
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `/superpowers workflow <type>`
|
|
111
|
+
|
|
112
|
+
Activate a complete workflow preset:
|
|
113
|
+
|
|
114
|
+
| Preset | Skills activated (in order) |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `new-feature` | `superpowers:brainstorming` → `:using-git-worktrees` → `:writing-plans` → `tdd-workflow` → `verification-loop` → `:requesting-code-review` → `:finishing-a-development-branch` |
|
|
117
|
+
| `bug-fix` | `superpowers:systematic-debugging` → `verification-loop` → `tdd-workflow` (regression test first) → `:requesting-code-review` |
|
|
118
|
+
| `refactor` | `superpowers:using-git-worktrees` → `:writing-plans` → `tdd-workflow` → `:requesting-code-review` → `:finishing-a-development-branch` |
|
|
119
|
+
| `review` | `superpowers:requesting-code-review` → `:receiving-code-review` |
|
|
120
|
+
| `release` | `/release-train` → `verification-loop` → `superpowers:finishing-a-development-branch` |
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
```
|
|
124
|
+
/superpowers workflow new-feature
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Verification protocol (Law 4)
|
|
128
|
+
|
|
129
|
+
Every routed skill must verify before reporting completion. The dispatcher refuses to advance to the next stage until the current one shows:
|
|
130
|
+
|
|
131
|
+
1. Code runs without errors
|
|
132
|
+
2. Output matches expected result
|
|
133
|
+
3. Actual result checked — not assumed
|
|
134
|
+
4. Build passes
|
|
135
|
+
5. Change explainable in one sentence
|
|
136
|
+
|
|
137
|
+
This is `verification-loop` from `continuous-improvement`. It runs after every workflow stage, not just at the end.
|
|
138
|
+
|
|
139
|
+
## Integration
|
|
140
|
+
|
|
141
|
+
`/superpowers` integrates with:
|
|
142
|
+
|
|
143
|
+
- **`/seven-laws`** — runs after each stage to capture the reflection block and update instincts (Laws 5 + 7)
|
|
144
|
+
- **`/proceed-with-the-recommendation`** — orchestrates a list of recommendations end-to-end, using `/superpowers` per item
|
|
145
|
+
- **`/workspace-surface-audit`** — runs at task start to confirm the right routing surface is actually present (Law 1 pre-flight)
|
|
146
|
+
- **`/ralph`** — autonomous variant; takes a PRD and walks it story-by-story under the same routing table
|
|
147
|
+
|
|
148
|
+
## Example session
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
User: "Build a checkout flow"
|
|
152
|
+
|
|
153
|
+
[/superpowers status] →
|
|
154
|
+
Sources: continuous-improvement [x], obra/superpowers [x], others [ ]
|
|
155
|
+
Routing intent: new-feature
|
|
156
|
+
|
|
157
|
+
[brainstorming activates — obra/superpowers]
|
|
158
|
+
AI: "Clarifying questions: 1) Payment provider? 2) Guest checkout?"
|
|
159
|
+
|
|
160
|
+
User: "Stripe, yes guest checkout"
|
|
161
|
+
|
|
162
|
+
[using-git-worktrees activates — obra/superpowers]
|
|
163
|
+
AI: "Created worktree at ../checkout-feature"
|
|
164
|
+
|
|
165
|
+
[writing-plans activates — obra/superpowers]
|
|
166
|
+
AI: "Plan created with 6 tasks. Approve?"
|
|
167
|
+
|
|
168
|
+
User: "Approved"
|
|
169
|
+
|
|
170
|
+
[tdd-workflow activates — continuous-improvement]
|
|
171
|
+
AI: "Task 1 RED: write failing test for cart validation..."
|
|
172
|
+
AI: "Task 1 GREEN: minimal handler. Verifying with `npm test cart.test.ts`..."
|
|
173
|
+
AI: "Task 1 REFACTOR: extract validator, tests still green. Committing."
|
|
174
|
+
|
|
175
|
+
[verification-loop activates — continuous-improvement]
|
|
176
|
+
AI: "Build [x] Types [x] Lint [x] Tests 42/42 [x] Security scan clean [x]"
|
|
177
|
+
|
|
178
|
+
[finishing-a-development-branch activates — obra/superpowers]
|
|
179
|
+
AI: "Options: merge / PR / keep / discard?"
|
|
180
|
+
```
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: swarm
|
|
3
|
+
description: "Fan out N parallel sub-agents on isolated worktrees with a shared contract test, produce a comparison report. Driven by report.html horizon item 'Parallel Provider-Migration Agents' — pick winners from real evidence instead of discovering tier limits in production."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /swarm
|
|
7
|
+
|
|
8
|
+
Parallel-agent fan-out for evidence-based decision-making. Driven by the user's session report: provider-swap epics (Trading Economics → Forex Factory, ETF → CFD, Finnhub → R StocksTrader, Stooq removal) each took multiple sessions and hit fallback bugs in production because alternatives were not vetted upfront.
|
|
9
|
+
|
|
10
|
+
This command does not replace the `superpowers:dispatching-parallel-agents` skill — it builds on top of it with a contract-pinned, worktree-isolated, comparison-report shape.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
The right trigger is "I need to pick between N options and I have a contract test that defines what 'works' means." Examples:
|
|
15
|
+
|
|
16
|
+
- Evaluating N candidate providers behind a shared interface (the report's recurring need)
|
|
17
|
+
- Trying N candidate refactors against the same test suite
|
|
18
|
+
- Prototyping N candidate library upgrades and measuring which breaks the fewest tests
|
|
19
|
+
- Generating N candidate UI designs that all pass the same accessibility + performance budget
|
|
20
|
+
|
|
21
|
+
Do NOT use this command for:
|
|
22
|
+
|
|
23
|
+
- Open-ended exploration without a contract — use `superpowers:brainstorming` instead
|
|
24
|
+
- Single-implementation tasks — use the `superpowers:dispatching-parallel-agents` skill directly
|
|
25
|
+
- Tasks where the candidates have different contracts — that is N separate jobs, not a swarm
|
|
26
|
+
|
|
27
|
+
## Preconditions
|
|
28
|
+
|
|
29
|
+
1. A shared contract test exists at a path the agents can reference (e.g. `tests/contracts/<name>.test.ts`).
|
|
30
|
+
2. Candidates are listed up front (3-6 typical; 8 max). Letting agents propose candidates is allowed but the list freezes before fan-out.
|
|
31
|
+
3. The base branch is clean.
|
|
32
|
+
4. Each candidate has a clear evaluation rubric: PASS/FAIL per contract test, plus per-candidate measurements (latency, coverage, cost, free-tier limits, etc. — domain-specific).
|
|
33
|
+
|
|
34
|
+
## Behavior
|
|
35
|
+
|
|
36
|
+
1. **Plan** — restate the objective, list candidates, confirm contract test path. If unclear, halt and ask.
|
|
37
|
+
2. **Bootstrap** — for each candidate, create an isolated worktree off `origin/main`: `git worktree add -b swarm/<objective>-<candidate> ../<candidate>`. Pin the base SHA in the swarm log.
|
|
38
|
+
3. **Fan out** — dispatch one fresh sub-agent per candidate via the `Agent` tool, in a single message (parallel, not serial). Each agent receives the contract test path, the candidate name, the rubric, and the worktree path.
|
|
39
|
+
4. **Run** — each agent implements the candidate behind the shared interface, runs the contract test against it, captures measurements per the rubric, and writes findings to `reports/<objective>/<candidate>.md`.
|
|
40
|
+
5. **Synthesize** — when all agents complete, this command produces a decision matrix (candidates × rubric metrics) and recommends a winner with citations to the per-candidate reports.
|
|
41
|
+
6. **Stop** — does NOT merge any candidate's worktree. Does NOT modify production. Output is evidence; the operator decides which candidate to advance.
|
|
42
|
+
|
|
43
|
+
## Topology
|
|
44
|
+
|
|
45
|
+
The default topology is **flat fan-out** — all agents run in parallel, no inter-agent communication. This matches the report's actual gap (provider migrations were each independent prototypes).
|
|
46
|
+
|
|
47
|
+
When `ruflo-swarm` is installed (`/plugin install ruflo-swarm@continuous-improvement`), an alternate topology becomes available: `hierarchical-mesh` with a coordinator role brokering stage hand-off. Activate via `/swarm --topology hierarchical-mesh`.
|
|
48
|
+
|
|
49
|
+
Available topologies (when ruflo-swarm installed):
|
|
50
|
+
|
|
51
|
+
| Topology | When to use |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `flat` (default) | Independent prototypes, no shared state |
|
|
54
|
+
| `hierarchical` | One coordinator + N workers; workers report to coordinator only |
|
|
55
|
+
| `mesh` | Workers can share intermediate findings |
|
|
56
|
+
| `hierarchical-mesh` | Coordinator plus worker-to-worker chat |
|
|
57
|
+
| `ring` | Each worker hands off to the next; sequential within a parallel start |
|
|
58
|
+
| `star` | All workers report to a central evaluator that filters before synthesis |
|
|
59
|
+
| `adaptive` | Topology selected per-step based on intermediate findings |
|
|
60
|
+
|
|
61
|
+
## Stop conditions
|
|
62
|
+
|
|
63
|
+
Halt and surface to the operator if:
|
|
64
|
+
|
|
65
|
+
- Any agent reports the contract test is itself broken (test suite is the source of truth; if it is wrong, no candidate can win).
|
|
66
|
+
- A candidate's evaluation reveals the rubric is incomplete (a metric the rubric doesn't measure changes the answer).
|
|
67
|
+
- More than 50% of agents fail to produce a report (likely environment or harness issue, not candidate quality).
|
|
68
|
+
- The winner-by-rubric and the reports' qualitative findings disagree (surface the conflict; do not paper over it).
|
|
69
|
+
|
|
70
|
+
## Stream observation
|
|
71
|
+
|
|
72
|
+
Long swarm runs feel opaque. When `ruflo-swarm:monitor-stream` is installed, this command emits live progress events to a stream the operator can tail. Without it, this command writes per-step lines to `reports/<objective>/swarm.log` that can be tailed with `tail -f`.
|
|
73
|
+
|
|
74
|
+
## Composition
|
|
75
|
+
|
|
76
|
+
This command activates the unified `/superpowers` dispatcher and routes through:
|
|
77
|
+
|
|
78
|
+
- `superpowers:dispatching-parallel-agents` for the fan-out shape
|
|
79
|
+
- `ruflo-swarm:swarm-init` (when installed) for contract-pinned bootstrap
|
|
80
|
+
- `ruflo-swarm:monitor-stream` (when installed) for stream observation
|
|
81
|
+
- `superpowers:writing-plans` (or inline fallback) for the candidate list + rubric
|
|
82
|
+
- `proceed-with-the-recommendation` for walking the synthesis output as a recommendation list
|
|
83
|
+
|
|
84
|
+
## Anti-patterns this command refuses
|
|
85
|
+
|
|
86
|
+
- **Letting one candidate run before others start.** All worktrees and agents bootstrap together; no early-bird advantage.
|
|
87
|
+
- **Modifying the contract test mid-run.** Test is source of truth; halt instead.
|
|
88
|
+
- **Picking a winner without measurements.** The synthesis must cite the rubric, not just the agents' summaries.
|
|
89
|
+
- **Merging any worktree.** Output is evidence; operator decides advancement.
|
|
90
|
+
|
|
91
|
+
## Example
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
/swarm "Pick the next market data provider"
|
|
95
|
+
|
|
96
|
+
Candidates: Swissquote, R StocksTrader, Twelve Data, Finnhub
|
|
97
|
+
Contract: tests/contracts/provider-contract.test.ts
|
|
98
|
+
Rubric: PASS/FAIL per contract test, p50/p99 latency, symbol coverage for 50 tracked instruments, free-tier limits, monthly cost at expected volume
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The orchestrator opens four worktrees, runs four agents in parallel, produces `reports/market-data-provider/{swissquote,rstockstrader,twelve-data,finnhub}.md`, and a `decision-matrix.md` with the recommended winner cited from the rubric.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workspace-surface-audit
|
|
3
|
+
description: "Audit workspace capabilities and recommend continuous-improvement-native skills, hooks, and workflows"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /workspace-surface-audit
|
|
7
|
+
|
|
8
|
+
Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup. Returns a 5-section report with specific next moves.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
/workspace-surface-audit
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## What It Checks
|
|
17
|
+
|
|
18
|
+
1. **Repo surface** — `package.json`, lockfiles, framework config, `.mcp.json`, `.claude/settings*.json`, `AGENTS.md`
|
|
19
|
+
2. **Environment surface** — `.env*` files (key names only, no secrets)
|
|
20
|
+
3. **Connected tools** — installed plugins, MCP servers, LSPs, app integrations
|
|
21
|
+
4. **continuous-improvement surface** — existing skills, commands, hooks, agents
|
|
22
|
+
|
|
23
|
+
## Output Format
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
=== Workspace Surface Audit ===
|
|
27
|
+
|
|
28
|
+
## Current Surface
|
|
29
|
+
- [What is usable right now]
|
|
30
|
+
|
|
31
|
+
## Parity
|
|
32
|
+
- [Where continuous-improvement matches or exceeds benchmarks]
|
|
33
|
+
|
|
34
|
+
## Primitive-Only Gaps
|
|
35
|
+
- [Tools exist, but continuous-improvement lacks clean operator skills]
|
|
36
|
+
|
|
37
|
+
## Missing Integrations
|
|
38
|
+
- [Capabilities not available yet]
|
|
39
|
+
|
|
40
|
+
## Top 3-5 Next Moves
|
|
41
|
+
1. [Concrete continuous-improvement-native addition]
|
|
42
|
+
2. [Ordered by impact]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Rules
|
|
46
|
+
|
|
47
|
+
- **Never print secrets** — only provider names, capability names, file paths
|
|
48
|
+
- **Prefer continuous-improvement** over generic "install another plugin" advice
|
|
49
|
+
- **Organize by workflows**, not API brands
|
|
50
|
+
- **Specific recommendations** — concrete enough to implement without another discovery pass
|
|
51
|
+
|
|
52
|
+
## Example Output
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
## Current Surface
|
|
56
|
+
- MCP: filesystem, github, playwright
|
|
57
|
+
- Plugins: beginner, expert (continuous-improvement)
|
|
58
|
+
- Env: STRIPE_API_KEY, FAL_KEY configured
|
|
59
|
+
- Framework: Next.js 15, React 19, TypeScript
|
|
60
|
+
|
|
61
|
+
## Parity
|
|
62
|
+
- Continuous improvement: covered (native)
|
|
63
|
+
- Testing discipline: covered (TDD workflows)
|
|
64
|
+
|
|
65
|
+
## Primitive-Only Gaps
|
|
66
|
+
- Stripe connected but no billing-operator skill
|
|
67
|
+
- GitHub MCP available but no issue-triage workflow
|
|
68
|
+
|
|
69
|
+
## Missing Integrations
|
|
70
|
+
- No Linear connector detected
|
|
71
|
+
- No Slack webhook configured
|
|
72
|
+
|
|
73
|
+
## Top 3-5 Next Moves
|
|
74
|
+
1. Create billing-operator skill (Stripe integration)
|
|
75
|
+
2. Create github-ops workflow for issue triage
|
|
76
|
+
3. Add Linear connector skill for project management
|
|
77
|
+
```
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Runtime PreToolUse gateguard hook.
|
|
4
|
+
*
|
|
5
|
+
* Stdin : JSON { tool_name, tool_input }
|
|
6
|
+
* Stdout : JSON { decision: "allow" | "block", reason?: string }
|
|
7
|
+
* Exit : 0 always (decision is in stdout, fail-open on parse error).
|
|
8
|
+
*
|
|
9
|
+
* Three-stage gate per skills/gateguard.md:
|
|
10
|
+
* - DENY : first mutating tool call per file, with fact-list reason
|
|
11
|
+
* - FORCE : agent presents facts (model-side; out of band)
|
|
12
|
+
* - ALLOW : retry once `_gateguard_facts_presented: true` is set or the
|
|
13
|
+
* per-file marker is recorded in session state
|
|
14
|
+
*
|
|
15
|
+
* Read-only and exploratory tools (Read, Grep, Glob, routine Bash) bypass
|
|
16
|
+
* unconditionally. Destructive Bash gates EVERY call, not just first.
|
|
17
|
+
*
|
|
18
|
+
* V1 honest limitations (see src/lib/gateguard-state.mts header):
|
|
19
|
+
* honor-system flag, state-file deletion, parallel-hook race.
|
|
20
|
+
*
|
|
21
|
+
* MultiEdit handling (V1): gates on edits[0].file_path only. Per-file
|
|
22
|
+
* batching is not implemented — TODO: extend to gate every entry in
|
|
23
|
+
* edits[]. Tracked in issue #106 acceptance criteria item 5.
|
|
24
|
+
*/
|
|
25
|
+
import { readFileSync } from "node:fs";
|
|
26
|
+
import { isCapReached, loadState, markFileCleared, resolveSessionDir, saveState, } from "../lib/gateguard-state.mjs";
|
|
27
|
+
const TOOL_ROUTE = {
|
|
28
|
+
Read: "allow",
|
|
29
|
+
Grep: "allow",
|
|
30
|
+
Glob: "allow",
|
|
31
|
+
LS: "allow",
|
|
32
|
+
NotebookRead: "allow",
|
|
33
|
+
Write: "mutating-file",
|
|
34
|
+
Edit: "mutating-file",
|
|
35
|
+
MultiEdit: "mutating-file",
|
|
36
|
+
NotebookEdit: "mutating-file",
|
|
37
|
+
Bash: "allow",
|
|
38
|
+
};
|
|
39
|
+
const DESTRUCTIVE_PATTERNS = [
|
|
40
|
+
"rm -rf",
|
|
41
|
+
"rm -fr",
|
|
42
|
+
"git reset --hard",
|
|
43
|
+
"git push --force",
|
|
44
|
+
"git push -f",
|
|
45
|
+
"--force-with-lease",
|
|
46
|
+
"git branch -D",
|
|
47
|
+
"drop table",
|
|
48
|
+
"drop database",
|
|
49
|
+
"drop schema",
|
|
50
|
+
"truncate ",
|
|
51
|
+
"mkfs",
|
|
52
|
+
"dd if=",
|
|
53
|
+
"format ",
|
|
54
|
+
"rmdir /s",
|
|
55
|
+
"del /f /q",
|
|
56
|
+
"del /q /f",
|
|
57
|
+
"Remove-Item -Recurse",
|
|
58
|
+
"Remove-Item -Force",
|
|
59
|
+
];
|
|
60
|
+
function isDestructiveBash(command) {
|
|
61
|
+
const lower = command.toLowerCase();
|
|
62
|
+
return DESTRUCTIVE_PATTERNS.some((p) => lower.includes(p.toLowerCase()));
|
|
63
|
+
}
|
|
64
|
+
function classifyTool(toolName, toolInput) {
|
|
65
|
+
const route = TOOL_ROUTE[toolName] ?? "allow";
|
|
66
|
+
if (route !== "allow")
|
|
67
|
+
return route;
|
|
68
|
+
if (toolName === "Bash" && typeof toolInput.command === "string") {
|
|
69
|
+
if (isDestructiveBash(toolInput.command))
|
|
70
|
+
return "destructive-bash";
|
|
71
|
+
}
|
|
72
|
+
return "allow";
|
|
73
|
+
}
|
|
74
|
+
function extractFilePath(toolInput) {
|
|
75
|
+
if (typeof toolInput.file_path === "string")
|
|
76
|
+
return toolInput.file_path;
|
|
77
|
+
// MultiEdit V1: first edit's file_path is the canonical key.
|
|
78
|
+
if (Array.isArray(toolInput.edits) && toolInput.edits.length > 0) {
|
|
79
|
+
const first = toolInput.edits[0];
|
|
80
|
+
if (first && typeof first.file_path === "string")
|
|
81
|
+
return first.file_path;
|
|
82
|
+
}
|
|
83
|
+
if (typeof toolInput.command === "string")
|
|
84
|
+
return toolInput.command;
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
function buildMutatingFileReason(toolName, filePath) {
|
|
88
|
+
return [
|
|
89
|
+
`Before ${toolName === "Write" ? "creating" : "editing"} ${filePath || "<unknown>"}, present these facts:`,
|
|
90
|
+
"",
|
|
91
|
+
" 1. List ALL files that import/require this file (use Grep)",
|
|
92
|
+
" 2. List the public functions/classes affected by this change",
|
|
93
|
+
" 3. If this file reads/writes data files, show field names, structure, and date format",
|
|
94
|
+
" 4. Quote the user's current instruction verbatim",
|
|
95
|
+
"",
|
|
96
|
+
"After presenting the facts, retry with `_gateguard_facts_presented: true` in tool_input,",
|
|
97
|
+
"or with the same file_path after a previous clearance has been recorded for this session.",
|
|
98
|
+
].join("\n");
|
|
99
|
+
}
|
|
100
|
+
function buildDestructiveBashReason(command) {
|
|
101
|
+
return [
|
|
102
|
+
`Destructive command requested: ${command}`,
|
|
103
|
+
"",
|
|
104
|
+
" 1. List ALL files/data this command will modify or delete",
|
|
105
|
+
" 2. Write a one-line rollback procedure",
|
|
106
|
+
" 3. Quote the user's current instruction verbatim",
|
|
107
|
+
"",
|
|
108
|
+
"Destructive Bash gates EVERY call — clearance is not cached.",
|
|
109
|
+
].join("\n");
|
|
110
|
+
}
|
|
111
|
+
function buildCapReachedReason() {
|
|
112
|
+
return [
|
|
113
|
+
"Gateguard session clearance cap reached (50 distinct files).",
|
|
114
|
+
"Start a new Claude Code session to reset the gate. The cap exists to bound",
|
|
115
|
+
"stuck-loop or rogue-agent clearance from compounding within a single session.",
|
|
116
|
+
].join("\n");
|
|
117
|
+
}
|
|
118
|
+
function emit(decision) {
|
|
119
|
+
process.stdout.write(`${JSON.stringify(decision)}\n`);
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
function main() {
|
|
123
|
+
let raw = "";
|
|
124
|
+
try {
|
|
125
|
+
raw = readFileSync(0, "utf8");
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
emit({ decision: "allow" });
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
let payload;
|
|
132
|
+
try {
|
|
133
|
+
payload = JSON.parse(raw);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
emit({ decision: "allow" }); // fail-open
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const toolName = typeof payload.tool_name === "string" ? payload.tool_name : "";
|
|
140
|
+
const toolInput = payload.tool_input ?? {};
|
|
141
|
+
const gate = classifyTool(toolName, toolInput);
|
|
142
|
+
if (gate === "allow") {
|
|
143
|
+
emit({ decision: "allow" });
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (gate === "destructive-bash") {
|
|
147
|
+
const cmd = typeof toolInput.command === "string" ? toolInput.command : "";
|
|
148
|
+
emit({ decision: "block", reason: buildDestructiveBashReason(cmd) });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// mutating-file
|
|
152
|
+
const sessionDir = resolveSessionDir();
|
|
153
|
+
const state = loadState(sessionDir);
|
|
154
|
+
const filePath = extractFilePath(toolInput);
|
|
155
|
+
const factsFlagged = toolInput._gateguard_facts_presented === true;
|
|
156
|
+
const alreadyCleared = filePath !== "" && filePath in state.cleared_files;
|
|
157
|
+
if (!factsFlagged && !alreadyCleared) {
|
|
158
|
+
emit({ decision: "block", reason: buildMutatingFileReason(toolName, filePath) });
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (factsFlagged && !alreadyCleared) {
|
|
162
|
+
if (isCapReached(state)) {
|
|
163
|
+
emit({ decision: "block", reason: buildCapReachedReason() });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (filePath !== "") {
|
|
167
|
+
saveState(sessionDir, markFileCleared(state, filePath));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
emit({ decision: "allow" });
|
|
171
|
+
}
|
|
172
|
+
main();
|
package/hooks/observe.sh
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# observe.sh — Mulahazah PreToolUse/PostToolUse observation hook
|
|
3
|
-
#
|
|
2
|
+
# observe.sh — Mulahazah PreToolUse/PostToolUse observation hook.
|
|
3
|
+
#
|
|
4
|
+
# Two-phase design:
|
|
5
|
+
# 1. PREFERRED: exec the Node observer (bin/observe.mjs) which captures the
|
|
6
|
+
# rich event schema (tool_input.command for Bash, file_path for Edit/
|
|
7
|
+
# Write/Read, tool_output) without depending on jq.
|
|
8
|
+
# 2. FALLBACK: if either node is missing OR the Node observer file is not
|
|
9
|
+
# installed alongside this script, fall through to the in-bash thin-
|
|
10
|
+
# schema path below. The fallback preserves prior behavior so an
|
|
11
|
+
# operator who never re-runs `npx continuous-improvement install` is
|
|
12
|
+
# no worse off than today.
|
|
13
|
+
#
|
|
14
|
+
# Always exits 0 — never blocks the Claude session.
|
|
4
15
|
# Usage: echo '<hook_json>' | observe.sh
|
|
5
16
|
|
|
6
|
-
# Always exit 0 — never block the Claude session
|
|
7
17
|
trap 'exit 0' EXIT ERR INT TERM
|
|
8
18
|
|
|
19
|
+
# Phase 1 — try the Node observer. The shim copies bin/observe.mjs and
|
|
20
|
+
# lib/observe-event.mjs alongside this script under ${HOME}/.claude/instincts/
|
|
21
|
+
# preserving the bin/ + lib/ subdirectory layout so the relative import
|
|
22
|
+
# resolves: observe.mjs lives at .../instincts/bin/observe.mjs, the imported
|
|
23
|
+
# observe-event.mjs at .../instincts/lib/observe-event.mjs.
|
|
24
|
+
NODE_OBSERVER="$(dirname "${BASH_SOURCE[0]}")/bin/observe.mjs"
|
|
25
|
+
if [[ -f "$NODE_OBSERVER" ]] && command -v node &>/dev/null; then
|
|
26
|
+
exec node "$NODE_OBSERVER"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Phase 2 — bash fallback (thin schema; preserved for back-compat).
|
|
9
30
|
INSTINCTS_DIR="${HOME}/.claude/instincts"
|
|
10
31
|
|
|
11
32
|
# ---------------------------------------------------------------------------
|
|
@@ -16,6 +37,11 @@ INPUT="$(cat)"
|
|
|
16
37
|
|
|
17
38
|
# ---------------------------------------------------------------------------
|
|
18
39
|
# Parse hook payload — use jq if available, otherwise basic extraction
|
|
40
|
+
#
|
|
41
|
+
# When jq is missing, observation rows lack tool_input/tool_output, which
|
|
42
|
+
# defeats the auto-instinct pipeline. Emit a one-shot stderr warning per
|
|
43
|
+
# project so the operator notices at the next session start instead of
|
|
44
|
+
# discovering the gap weeks later. The marker file makes it idempotent.
|
|
19
45
|
# ---------------------------------------------------------------------------
|
|
20
46
|
if command -v jq &>/dev/null; then
|
|
21
47
|
read -r TOOL_NAME SESSION_ID HAS_OUTPUT INPUT_JSON OUTPUT_JSON <<< "$(
|
|
@@ -28,6 +54,15 @@ if command -v jq &>/dev/null; then
|
|
|
28
54
|
' | paste - - - - -
|
|
29
55
|
)"
|
|
30
56
|
else
|
|
57
|
+
# One-shot stderr warning per HOME so the operator learns the constraint.
|
|
58
|
+
# Marker lives next to instincts/ (not inside it) so it never collides with
|
|
59
|
+
# tests or analysis loops that iterate INSTINCTS_DIR for project-hash dirs.
|
|
60
|
+
JQ_WARN_MARKER="${HOME}/.claude/.continuous-improvement-jq-warned"
|
|
61
|
+
if [[ ! -f "$JQ_WARN_MARKER" ]]; then
|
|
62
|
+
mkdir -p "${HOME}/.claude" 2>/dev/null
|
|
63
|
+
printf '[continuous-improvement] jq not found on PATH — observe.sh is using thin-schema fallback. Install jq to enable auto-instinct detection (winget install jqlang.jq | brew install jq | apt install jq). This warning is one-shot per host.\n' >&2
|
|
64
|
+
: > "$JQ_WARN_MARKER"
|
|
65
|
+
fi
|
|
31
66
|
# Fallback: extract tool_name with basic pattern matching
|
|
32
67
|
TOOL_NAME="$(printf '%s' "$INPUT" | sed -n 's/.*"tool_name" *: *"\([^"]*\)".*/\1/p' | head -1)"
|
|
33
68
|
SESSION_ID="$(printf '%s' "$INPUT" | sed -n 's/.*"session_id" *: *"\([^"]*\)".*/\1/p' | head -1)"
|
|
@@ -83,7 +118,10 @@ OBS_FILE="${PROJECT_DIR}/observations.jsonl"
|
|
|
83
118
|
if [[ -f "$OBS_FILE" ]]; then
|
|
84
119
|
LINE_COUNT="$(wc -l < "$OBS_FILE")"
|
|
85
120
|
if (( LINE_COUNT >= 10000 )); then
|
|
86
|
-
mv "$OBS_FILE" "${PROJECT_DIR}/observations.$(date -u +"%Y-%m-%d").jsonl"
|
|
121
|
+
mv "$OBS_FILE" "${PROJECT_DIR}/observations.$(date -u +"%Y-%m-%d-%H%M%S").jsonl"
|
|
122
|
+
|
|
123
|
+
# Clean up old archives - keep only 10 most recent
|
|
124
|
+
ls -t "${PROJECT_DIR}"/observations.*.jsonl 2>/dev/null | tail -n +11 | xargs -r rm -f
|
|
87
125
|
fi
|
|
88
126
|
fi
|
|
89
127
|
|
package/hooks/session.sh
CHANGED
|
@@ -78,9 +78,9 @@ if [[ "$EVENT_TYPE" == "SessionStart" || "$EVENT_TYPE" == "unknown" ]]; then
|
|
|
78
78
|
[[ -f "$f" ]] || continue
|
|
79
79
|
conf="$(grep '^confidence:' "$f" 2>/dev/null | head -1 | sed 's/confidence: *//')"
|
|
80
80
|
if [[ -n "$conf" ]]; then
|
|
81
|
-
# Compare as integer (multiply by 100)
|
|
82
|
-
int_conf="$(printf '
|
|
83
|
-
if (( int_conf >= 70 )); then
|
|
81
|
+
# Compare as integer (multiply by 100) using awk for portability
|
|
82
|
+
int_conf="$(printf '%s' "$conf" | awk '{printf "%.0f", $1 * 100}')"
|
|
83
|
+
if [[ -n "$int_conf" ]] && (( int_conf >= 70 )); then
|
|
84
84
|
LEVEL="AUTO-APPLY"
|
|
85
85
|
break 2
|
|
86
86
|
elif (( int_conf >= 50 )); then
|