continuous-improvement 3.11.0 → 3.12.3
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 +3 -3
- package/CHANGELOG.md +34 -0
- package/LICENSE +21 -21
- package/QUICKSTART.md +1 -1
- package/README.md +16 -15
- package/SKILL.md +1 -1
- package/bin/analyze.sh +161 -161
- package/bin/backfill.mjs +19 -19
- package/bin/check-doc-runtime-claims.mjs +0 -0
- package/bin/check-docs-substrings.mjs +0 -0
- package/bin/check-everything-mirror.mjs +0 -0
- package/bin/check-routing-targets.mjs +0 -0
- package/bin/check-scripts-citation-drift.mjs +0 -0
- package/bin/check-skill-count.mjs +0 -0
- package/bin/check-skill-law-tag.mjs +0 -0
- package/bin/check-skill-mirror.mjs +0 -0
- package/bin/check-skill-tiers.mjs +0 -0
- package/bin/check-test-imports-only.mjs +0 -0
- package/bin/check-third-party-shape.mjs +0 -0
- package/bin/check-tool-count.mjs +129 -0
- package/bin/companion-preference-status.mjs +0 -0
- package/bin/gateguard-clear.mjs +0 -0
- package/bin/generate-plugin-manifests.mjs +1 -0
- package/bin/harvest-friction.mjs +1 -1
- package/bin/hook-stats.mjs +21 -21
- package/bin/install.mjs +3 -2
- package/bin/lint-transcript.mjs +0 -0
- package/bin/mcp-server.mjs +1 -1
- package/bin/observe.mjs +0 -0
- package/bin/pre-commit-block-strays.sh +0 -0
- package/bin/refresh-third-party.mjs +0 -0
- package/bin/unified-cli.mjs +0 -0
- package/commands/continuous-improvement.md +115 -115
- package/commands/dashboard.md +56 -56
- package/commands/harvest.md +1 -1
- package/commands/seven-laws.md +16 -16
- package/commands/superpowers.md +1 -1
- package/commands/workspace-surface-audit.md +77 -77
- package/hooks/companion-preference.mjs +0 -0
- package/hooks/gateguard.mjs +22 -10
- package/hooks/goal-drift-stop.mjs +0 -0
- package/hooks/observe.sh +0 -0
- package/hooks/recall-briefing.mjs +167 -0
- package/hooks/route-prompt.mjs +0 -0
- package/hooks/session.sh +106 -106
- package/hooks/three-section-close.mjs +0 -0
- package/instinct-packs/go.json +58 -58
- package/instinct-packs/meta.json +16 -16
- package/instinct-packs/python.json +58 -58
- package/instinct-packs/react.json +58 -58
- package/lib/cli-anything.mjs +0 -0
- package/lib/compound-engineering.mjs +0 -0
- package/lib/gateguard-state.mjs +0 -0
- package/lib/goal-drift-gate.mjs +0 -0
- package/lib/goal-state.mjs +8 -8
- package/lib/observe-event.mjs +0 -0
- package/lib/plugin-metadata.mjs +12 -7
- package/lib/pm-marketplace.mjs +0 -0
- package/lib/pm-skills.mjs +0 -0
- package/lib/recall-briefing.mjs +57 -0
- package/lib/recall-index.mjs +2 -2
- package/lib/resolve-home-dir.mjs +0 -0
- package/lib/skill-distill.mjs +0 -0
- package/lib/skill-tiers.mjs +0 -0
- package/lib/unified-plugin.mjs +0 -0
- package/llms.txt +2 -2
- package/package.json +4 -3
- package/plugins/beginner.json +3 -3
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
- package/plugins/continuous-improvement/LICENSE +21 -21
- package/plugins/continuous-improvement/agents/README.md +3 -3
- package/plugins/continuous-improvement/bin/backfill.mjs +19 -19
- package/plugins/continuous-improvement/bin/gateguard-clear.mjs +0 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +1 -1
- package/plugins/continuous-improvement/bin/observe.mjs +0 -0
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -115
- package/plugins/continuous-improvement/commands/dashboard.md +56 -56
- package/plugins/continuous-improvement/commands/harvest.md +1 -1
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -16
- package/plugins/continuous-improvement/commands/superpowers.md +1 -1
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -77
- package/plugins/continuous-improvement/hooks/companion-preference.mjs +0 -0
- package/plugins/continuous-improvement/hooks/gateguard.mjs +22 -10
- package/plugins/continuous-improvement/hooks/goal-drift-stop.mjs +0 -0
- package/plugins/continuous-improvement/hooks/hooks.json +6 -1
- package/plugins/continuous-improvement/hooks/observe.sh +0 -0
- package/plugins/continuous-improvement/hooks/recall-briefing.mjs +167 -0
- package/plugins/continuous-improvement/hooks/route-prompt.mjs +0 -0
- package/plugins/continuous-improvement/hooks/session.sh +106 -106
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +0 -0
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -58
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -16
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -58
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -58
- package/plugins/continuous-improvement/lib/gateguard-state.mjs +0 -0
- package/plugins/continuous-improvement/lib/goal-drift-gate.mjs +0 -0
- package/plugins/continuous-improvement/lib/goal-state.mjs +8 -8
- package/plugins/continuous-improvement/lib/observe-event.mjs +0 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +12 -7
- package/plugins/continuous-improvement/lib/recall-briefing.mjs +57 -0
- package/plugins/continuous-improvement/lib/recall-index.mjs +2 -2
- package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +0 -0
- package/plugins/continuous-improvement/lib/skill-distill.mjs +0 -0
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -411
- package/plugins/expert.json +2 -2
- package/skills/superpowers.md +1 -1
- package/skills/tdd-workflow.md +411 -411
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"plugins": [
|
|
8
8
|
{
|
|
9
9
|
"name": "continuous-improvement",
|
|
10
|
-
"description": "
|
|
11
|
-
"version": "3.
|
|
10
|
+
"description": "Makes Claude Code reason harder, recall past corrections, and learn from every session so its competence compounds run over run. The Mulahazah engine turns each fix into a reusable instinct, so a lesson learned once is applied automatically next time — no re-teaching. Built on the 7 Laws of AI Agent Discipline (research, plan, verify, reflect, learn) and shipped as 25 bundled skills, instinct-aware hooks, an MCP toolset for recall and reflection, and a GitHub Action transcript linter that feeds real work history back into sharper instincts.",
|
|
11
|
+
"version": "3.12.3",
|
|
12
12
|
"source": "./plugins/continuous-improvement",
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "naimkatiman"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"name": "oh-my-claudecode",
|
|
56
|
-
"description": "Multi-agent orchestration system for Claude Code —
|
|
56
|
+
"description": "Multi-agent orchestration system for Claude Code — 38 skills + 19 agents covering audit, plan, build, verify, ship, release, retrospective, and ops. Includes ralph (autonomous PRD loop), release, ultrawork, ultraqa, team, trace, visual-verdict, debug, deep-dive, deep-interview, autopilot, autoresearch. Vendored snapshot at third-party/oh-my-claudecode/ pinned to upstream SHA aacde3e (v4.13.6). Heavy overlap with continuous-improvement /ralph and /superpowers — pick per task.",
|
|
57
57
|
"version": "4.13.6",
|
|
58
58
|
"source": "./third-party/oh-my-claudecode",
|
|
59
59
|
"author": {
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,40 @@ All notable changes to this skill are documented here.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [3.12.3] — 2026-06-08
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Completed the OIDC trusted-publishing pipeline by restoring setup-node `registry-url`** — #211 had removed it to kill the dummy-token `.npmrc`, but that left npm with no registry anchor for the OIDC token exchange (`ENEEDAUTH` on 3.12.1/3.12.2). With `registry-url` back, Node 22 (#213), npm ≥ 11.5.1, and a configured trusted publisher, npm mints and uses the OIDC token. **3.12.3 is the first version actually published to npm** carrying the 3.12.0 changes (#198 positioning, #199 recall hook, #202 OIDC, #203 doc-drift, #204 tool-count); 3.12.0–3.12.2 were never published. (#215)
|
|
14
|
+
|
|
15
|
+
## [3.12.2] — 2026-06-08
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Release workflow now runs on Node 22 so OIDC trusted publishing actually authenticates** — npm trusted publishing requires npm ≥ 11.5.1 **and Node ≥ 22.14.0** ([docs.npmjs.com/trusted-publishers](https://docs.npmjs.com/trusted-publishers)). `release.yml` ran on Node 20, below the floor, so the OIDC token exchange never engaged: the `v3.12.0` publish fell back to setup-node's dummy `.npmrc` token (`E404`) and `v3.12.1` had no auth at all (`ENEEDAUTH`). Bumping `setup-node` to Node 22 (plus #211 dropping the token-bearing `.npmrc`) completes the OIDC pipeline. **3.12.2 is the first npm artifact to carry the 3.12.0 changes** (#198 positioning, #199 recall hook, #202 OIDC pipeline, #203 doc-drift, #204 tool-count invariant); `3.12.0` and `3.12.1` were never published to npm. (#211, #213)
|
|
20
|
+
|
|
21
|
+
## [3.12.1] — 2026-06-08
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **npm release pipeline now authenticates via OIDC instead of a dummy token** — the `v3.12.0` tag publish failed with `E404` on the registry PUT: `actions/setup-node` with `registry-url` wrote an `.npmrc` carrying `_authToken=${NODE_AUTH_TOKEN}` set to its placeholder value, so npm used that dummy token for the publish instead of OIDC trusted publishing (provenance still signed, since the sigstore OIDC token is separate). Dropping `registry-url` from `release.yml` lets `npm publish --provenance` fall back to OIDC as intended. **3.12.1 is the first npm artifact to carry the 3.12.0 changes** (intelligence-amplifier positioning #198, recall-briefing hook #199, OIDC pipeline #202, doc-drift fixes #203, `verify:tool-count` invariant #204); the `3.12.0` version was never published to npm. (#211)
|
|
26
|
+
|
|
27
|
+
## [3.12.0] — 2026-06-07
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **Proactive recall-briefing hook (opt-in episodic memory)** — `hooks/recall-briefing.mjs` runs on `UserPromptSubmit`, queries the BM25 observation index in-process, and surfaces the most relevant prior corrections as a briefing before the agent acts. First capability increment of the intelligence-amplifier reframe: a lesson learned once is recalled automatically on the next related prompt instead of being re-taught. Opt-in — disabled unless wired into the hook config.
|
|
32
|
+
- **`verify:tool-count` content invariant (12th in `verify:all`)** — `bin/check-tool-count.mjs` pins MCP tool-count claims in docs and source to the generated `plugins/{expert,beginner}.json` `tools[].length`, so a count can't drift when a tool is added — the gap that let "12 tools" pass `verify:all` green in the 2026-06-07 audit. Pins four claims across `docs/skills.md`, `README.md`, `QUICKSTART.md`, and the `mcp-server` banner. Follow-up to #203 (PR #204).
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **Positioning reframed from "seatbelt" to intelligence amplifier across every user-facing surface** — the 7 Laws of AI Agent Discipline keep their names but each is reframed from a restriction into a capability the agent gains. README h1 "A seatbelt for Claude Code" → "Claude Code that gets sharper every session"; landing page title/hero/CTA, `SHARED_PLUGIN_DESCRIPTION` (the source of truth that propagates to `package.json` + all generated manifests + `llms.txt`), SKILL.md, and CONTRIBUTING.md all reframed from "Stops Claude Code from…" loss-framing to capability-led copy. Honesty held: recall stays lexical/BM25, instincts decay, GateGuard still blocks (framed as forced grounding) — no over-claiming. Plan: `docs/plans/2026-06-07-intelligence-amplifier-reframe.md`.
|
|
37
|
+
- **npm release now publishes via OIDC trusted publishing instead of `NPM_TOKEN`** — the account enforces 2FA-on-writes, which makes long-lived granular tokens hit EOTP in CI. `release.yml` upgrades npm to ≥ 11.5.1 and publishes with `npm publish --access public --provenance` (signed provenance from the OIDC claims); the `NPM_TOKEN` secret dependency is gone. See `docs/RELEASING.md` for the one-time trusted-publisher setup.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **Doc/count drift surfaced by a post-merge audit** — corrected prose/count claims that drifted from the v3.11.0 implementation and that no `verify:all` invariant covers: MCP expert surface is 18 tools (not 12); the CONTRIBUTING release checklist now defers to `docs/RELEASING.md` instead of describing the retired manual publish flow; `agents/README.md` repointed off a non-existent reference doc; the oh-my-claudecode vendored snapshot count corrected to 38 skills; `harvest` observe-path corrected to `instincts/bin/observe.mjs`; and reports/update-card test counts synced to 793.
|
|
42
|
+
|
|
9
43
|
## [3.11.0] — 2026-06-07
|
|
10
44
|
|
|
11
45
|
### Added
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Naim Katiman
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Naim Katiman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/QUICKSTART.md
CHANGED
|
@@ -130,7 +130,7 @@ Corrections drop instinct confidence. Unused instincts decay. The system self-co
|
|
|
130
130
|
|
|
131
131
|
## Expert (npx) — only if you want MCP, hooks, or instinct packs
|
|
132
132
|
|
|
133
|
-
The Beginner path above is enough for most users. Pick this only if you want the MCP tools (
|
|
133
|
+
The Beginner path above is enough for most users. Pick this only if you want the MCP tools (18 of them, including `ci_plan_init` / `ci_plan_status` for `task_plan.md`-style planning), the session hooks that feed Mulahazah, or the starter instinct packs.
|
|
134
134
|
|
|
135
135
|
Do not run both paths against the same `~/.claude/` — that produces duplicated state. Pick one and stick with it.
|
|
136
136
|
|
package/README.md
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
<img src="assets/combined.gif" alt="Before vs After — The 7 Laws of AI Agent Discipline" width="700" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
<h1 align="center">
|
|
7
|
+
<h1 align="center">Claude Code that gets sharper every session</h1>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<b>
|
|
10
|
+
<b>Reasons deeper. Recalls what it already solved. Verifies before "done". Keeps every lesson.</b>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
|
-
<i>The 7 Laws of AI Agent Discipline — runtime hooks,
|
|
14
|
+
<i>The 7 Laws of AI Agent Discipline — runtime hooks, instinct memory, and skills that compound what it learns.</i>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
<b>New here?</b> → <a href="QUICKSTART.md">QUICKSTART.md</a> (2 minutes) · <a href="https://continuous-improvement.dev">continuous-improvement.dev</a>
|
|
27
27
|
</p>
|
|
28
28
|
|
|
29
|
-
> **What this is *not*:** a prompt template, a `CLAUDE.md`, or a vibes-based reminder. It is a runtime hook (`hooks/gateguard.mjs`) plus a bundled skill set that physically blocks `Edit` / `Write` / destructive `Bash` until the
|
|
29
|
+
> **What this is *not*:** a prompt template, a `CLAUDE.md`, or a vibes-based reminder. It is a runtime hook (`hooks/gateguard.mjs`) plus a bundled skill set that makes the agent ground every change in real facts — it physically blocks `Edit` / `Write` / destructive `Bash` until the investigation is done, so edits land on understanding instead of guesses.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
33
|
## What this does
|
|
34
34
|
|
|
35
|
-
Claude Code is powerful but
|
|
35
|
+
Claude Code is powerful but leaves intelligence on the table: it edits before reading, guesses instead of checking, stacks five concerns into one commit, and says "done" without running tests. Continuous Improvement adds three layers that make it sharper:
|
|
36
36
|
|
|
37
37
|
1. **Before an edit** — [`gateguard`](skills/gateguard.md) ships as a `PreToolUse` hook (`hooks/gateguard.mjs`) that physically blocks `Edit` / `Write` / `MultiEdit` and destructive `Bash` until the agent presents a fact-list investigation.
|
|
38
38
|
2. **During work** — bundled skills enforce planning, one-thing-at-a-time execution, TDD ([`tdd-workflow`](skills/tdd-workflow.md)), and a six-phase verification ladder ([`verification-loop`](skills/verification-loop.md)) before "done".
|
|
@@ -52,7 +52,7 @@ With Continuous Improvement, the same prompt is forced through the gate:
|
|
|
52
52
|
|
|
53
53
|
> `gateguard` blocks the first `Edit` until Claude presents a fact list. Claude reads `useAuth.ts`, finds the existing `redirectAfterLogin` helper, traces *why* the redirect loops (a stale `from` query param), and edits one line in one file. `verification-loop` runs the tests. The reply names the file, the line, the cause.
|
|
54
54
|
|
|
55
|
-
Same agent. Same model. Different
|
|
55
|
+
Same agent. Same model. Different intelligence.
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
@@ -138,7 +138,7 @@ V1 honest limitations: the runtime gate is honor-system once the agent flips `_g
|
|
|
138
138
|
|
|
139
139
|
### Expert — adds MCP server, observation hooks, and instinct packs
|
|
140
140
|
|
|
141
|
-
Pick this if you want the MCP tools (
|
|
141
|
+
Pick this if you want the MCP tools (18 of them, including `ci_plan_init` / `ci_plan_status` for `task_plan.md`-style planning), the session hooks that feed Mulahazah, and starter packs.
|
|
142
142
|
|
|
143
143
|
Preconditions: Node 18 / 20 / 22, plus bash on Windows (Git Bash or WSL — `hooks/observe.sh` is a bash script and silently no-ops without it). **`jq` is no longer required**: as of v3.6.0, `observe.sh` prefers the Node observer (`bin/observe.mjs`) which writes the rich event schema natively without external dependencies. The bash thin-schema path is kept as a two-phase shim, so legacy installs that have not re-run `npx continuous-improvement install` since v3.5.x will still degrade silently without `jq` (`winget install jqlang.jq` on Windows, `brew install jq` on macOS, `apt install jq` on Debian/Ubuntu) — re-running the installer is the cleaner fix and removes the dependency entirely. See [CHANGELOG.md](CHANGELOG.md) `[3.6.0]` for the migration details.
|
|
144
144
|
|
|
@@ -171,20 +171,21 @@ The framework has documented operator-level modes that change hook behavior with
|
|
|
171
171
|
|---|---|---|
|
|
172
172
|
| `CLAUDE_THREE_SECTION_CLOSE_DISABLED=1` | `three-section-close.mjs` short-circuits before any enforcement or telemetry. Use when end-of-turn reflection should run as internal thinking rather than visible "What has been done / What is next / Recommendation" sections. Public default unchanged — the rule still fires for everyone else. | bash/zsh: `export CLAUDE_THREE_SECTION_CLOSE_DISABLED=1` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_THREE_SECTION_CLOSE_DISABLED=1` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_THREE_SECTION_CLOSE_DISABLED','1','User')` (persistent). |
|
|
173
173
|
| `CLAUDE_GOAL_DRIFT_GATE` | `goal-drift-stop.mjs` (a `Stop` hook) scores each turn's activity against the `## Goal` in `task_plan.md` and acts on drift. `warn` (default) prints a one-line stderr notice and never blocks; `block` re-prompts a substantive wrap-up that has drifted off-goal so the goal gates the close; `off` disables it. Reads the same observation feed as Mulahazah; fails open on any error. | bash/zsh: `export CLAUDE_GOAL_DRIFT_GATE=block` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_GOAL_DRIFT_GATE='block'` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_GOAL_DRIFT_GATE','block','User')` (persistent). |
|
|
174
|
+
| `CLAUDE_RECALL_BRIEFING=1` | `hooks/recall-briefing.mjs` (a UserPromptSubmit hook) makes episodic memory proactive: on the first substantive prompt of a session it searches this project's past observations (BM25) and injects a one-time `<system-reminder>` with the most relevant prior activity, so the agent reuses a past fix instead of re-deriving it. Opt-in and default off; it is an amplifier, never a gate — it cannot block a prompt and fails open. The `ci_recall` MCP tool stays available for explicit, deeper searches. | bash/zsh: `export CLAUDE_RECALL_BRIEFING=1` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_RECALL_BRIEFING=1` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_RECALL_BRIEFING','1','User')` (persistent). |
|
|
174
175
|
|
|
175
176
|
---
|
|
176
177
|
|
|
177
178
|
## The 7 Laws
|
|
178
179
|
|
|
179
|
-
| # | Law |
|
|
180
|
+
| # | Law | What it gives the agent |
|
|
180
181
|
|---|-----|----------------------|
|
|
181
|
-
| 1 | **Research Before Executing** |
|
|
182
|
-
| 2 | **Plan Is Sacred** |
|
|
183
|
-
| 3 | **One Thing at a Time** |
|
|
184
|
-
| 4 | **Verify Before Reporting** |
|
|
185
|
-
| 5 | **Reflect After Sessions** |
|
|
186
|
-
| 6 | **Iterate One Change** |
|
|
187
|
-
| 7 | **Learn From Every Session** |
|
|
182
|
+
| 1 | **Research Before Executing** | builds on what already exists instead of reinventing it |
|
|
183
|
+
| 2 | **Plan Is Sacred** | lands effort on the goal with success defined up front |
|
|
184
|
+
| 3 | **One Thing at a Time** | ships each change on a known-good base |
|
|
185
|
+
| 4 | **Verify Before Reporting** | backs every "done" with evidence you can trust |
|
|
186
|
+
| 5 | **Reflect After Sessions** | turns each session into a captured lesson |
|
|
187
|
+
| 6 | **Iterate One Change** | keeps debugging isolated and the signal clean |
|
|
188
|
+
| 7 | **Learn From Every Session** | compounds knowledge so next week's agent is sharper |
|
|
188
189
|
|
|
189
190
|
```
|
|
190
191
|
Research -> Plan -> Execute (one thing) -> Verify -> Reflect -> Learn -> Iterate
|
package/SKILL.md
CHANGED
|
@@ -6,7 +6,7 @@ description: "Install structured self-improvement loops with instinct-based lear
|
|
|
6
6
|
|
|
7
7
|
# continuous-improvement
|
|
8
8
|
|
|
9
|
-
You follow the continuous-improvement framework. These 7 laws
|
|
9
|
+
You follow the continuous-improvement framework. These 7 laws make every task sharper — each is a capability that compounds: research deeper, plan tighter, verify with evidence, reflect, and learn so the same lesson is never re-taught.
|
|
10
10
|
|
|
11
11
|
## Law 1: Research Before Executing
|
|
12
12
|
|
package/bin/analyze.sh
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# analyze.sh — Read observations.jsonl, detect patterns, create instinct YAML files
|
|
3
|
-
# Runs via /continuous-improvement command. Uses claude CLI with Haiku for cost-efficient analysis.
|
|
4
|
-
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
INSTINCTS_DIR="${HOME}/.claude/instincts"
|
|
8
|
-
|
|
9
|
-
# ---------------------------------------------------------------------------
|
|
10
|
-
# Detect project
|
|
11
|
-
# ---------------------------------------------------------------------------
|
|
12
|
-
PROJECT_ROOT=""
|
|
13
|
-
if [[ -n "${CLAUDE_PROJECT_DIR:-}" && -d "${CLAUDE_PROJECT_DIR}" ]]; then
|
|
14
|
-
PROJECT_ROOT="${CLAUDE_PROJECT_DIR}"
|
|
15
|
-
fi
|
|
16
|
-
if [[ -z "$PROJECT_ROOT" ]]; then
|
|
17
|
-
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
18
|
-
fi
|
|
19
|
-
if [[ -z "$PROJECT_ROOT" ]]; then
|
|
20
|
-
PROJECT_ROOT="global"
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# Use shasum on macOS, sha256sum on Linux
|
|
24
|
-
if command -v sha256sum &>/dev/null; then
|
|
25
|
-
PROJECT_HASH="$(printf '%s' "$PROJECT_ROOT" | sha256sum | cut -c1-12)"
|
|
26
|
-
elif command -v shasum &>/dev/null; then
|
|
27
|
-
PROJECT_HASH="$(printf '%s' "$PROJECT_ROOT" | shasum -a 256 | cut -c1-12)"
|
|
28
|
-
else
|
|
29
|
-
# Fallback: use project root basename if no hashing available
|
|
30
|
-
PROJECT_HASH="$(basename "$PROJECT_ROOT" | tr -cd 'a-zA-Z0-9' | cut -c1-12)"
|
|
31
|
-
fi
|
|
32
|
-
PROJECT_NAME="$(basename "${PROJECT_ROOT%.git}")"
|
|
33
|
-
PROJECT_DIR="${INSTINCTS_DIR}/${PROJECT_HASH}"
|
|
34
|
-
OBS_FILE="${PROJECT_DIR}/observations.jsonl"
|
|
35
|
-
|
|
36
|
-
# ---------------------------------------------------------------------------
|
|
37
|
-
# Check observations exist
|
|
38
|
-
# ---------------------------------------------------------------------------
|
|
39
|
-
if [[ ! -f "$OBS_FILE" ]] || [[ ! -s "$OBS_FILE" ]]; then
|
|
40
|
-
echo "No observations found at ${OBS_FILE}"
|
|
41
|
-
echo "Use Claude Code with hooks installed to generate observations."
|
|
42
|
-
exit 0
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
OBS_COUNT=$(wc -l < "$OBS_FILE")
|
|
46
|
-
echo "Found ${OBS_COUNT} observations in ${OBS_FILE}"
|
|
47
|
-
|
|
48
|
-
if (( OBS_COUNT < 20 )); then
|
|
49
|
-
echo "Need at least 20 observations for meaningful analysis. Keep using Claude Code (${OBS_COUNT}/20)."
|
|
50
|
-
exit 0
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
# ---------------------------------------------------------------------------
|
|
54
|
-
# Read existing instincts to avoid duplicates
|
|
55
|
-
# ---------------------------------------------------------------------------
|
|
56
|
-
EXISTING_INSTINCTS=""
|
|
57
|
-
for f in "${PROJECT_DIR}"/*.yaml "${INSTINCTS_DIR}/global"/*.yaml; do
|
|
58
|
-
[[ -f "$f" ]] && EXISTING_INSTINCTS="${EXISTING_INSTINCTS}$(cat "$f")"$'\n'
|
|
59
|
-
done
|
|
60
|
-
|
|
61
|
-
# ---------------------------------------------------------------------------
|
|
62
|
-
# Take last 500 observations
|
|
63
|
-
# ---------------------------------------------------------------------------
|
|
64
|
-
RECENT_OBS=$(tail -500 "$OBS_FILE")
|
|
65
|
-
|
|
66
|
-
# ---------------------------------------------------------------------------
|
|
67
|
-
# Build analysis prompt
|
|
68
|
-
# ---------------------------------------------------------------------------
|
|
69
|
-
ANALYSIS_PROMPT="Analyze these Claude Code session observations and extract behavioral patterns as instinct YAML files.
|
|
70
|
-
|
|
71
|
-
OBSERVATIONS (JSONL — each line is a tool call):
|
|
72
|
-
${RECENT_OBS}
|
|
73
|
-
|
|
74
|
-
EXISTING INSTINCTS (already learned — do NOT duplicate these):
|
|
75
|
-
${EXISTING_INSTINCTS}
|
|
76
|
-
|
|
77
|
-
YOUR TASK:
|
|
78
|
-
1. Look for REPEATED PATTERNS — same tool sequence used 3+ times
|
|
79
|
-
2. Look for ERROR-THEN-FIX sequences — tool fails, next tools fix it
|
|
80
|
-
3. Look for TOOL PREFERENCES — one tool consistently chosen over alternatives
|
|
81
|
-
4. Look for WORKFLOW PATTERNS — consistent ordering of operations
|
|
82
|
-
5. Look for USER CORRECTIONS — user says no/stop/don't after an action
|
|
83
|
-
|
|
84
|
-
OUTPUT FORMAT — output ONLY new instincts as YAML blocks, separated by ---:
|
|
85
|
-
|
|
86
|
-
id: descriptive-kebab-case-id
|
|
87
|
-
trigger: \"when [specific situation]\"
|
|
88
|
-
confidence: 0.5
|
|
89
|
-
domain: workflow|tooling|testing|patterns
|
|
90
|
-
source: observation
|
|
91
|
-
scope: project
|
|
92
|
-
project_id: ${PROJECT_HASH}
|
|
93
|
-
created: \"$(date -u +%Y-%m-%d)\"
|
|
94
|
-
last_seen: \"$(date -u +%Y-%m-%d)\"
|
|
95
|
-
observation_count: [number of times pattern was seen]
|
|
96
|
-
---
|
|
97
|
-
[One sentence describing the specific actionable behavior]
|
|
98
|
-
|
|
99
|
-
Rules:
|
|
100
|
-
- Only create instincts for patterns seen 3+ times
|
|
101
|
-
- Start confidence at 0.5 (suggest level)
|
|
102
|
-
- Be specific and actionable (not vague advice)
|
|
103
|
-
- Different from existing instincts listed above
|
|
104
|
-
|
|
105
|
-
If no new patterns are found, output exactly: NO_NEW_PATTERNS
|
|
106
|
-
|
|
107
|
-
Output ONLY the YAML blocks or NO_NEW_PATTERNS. No explanation, no preamble."
|
|
108
|
-
|
|
109
|
-
# ---------------------------------------------------------------------------
|
|
110
|
-
# Run analysis with Haiku
|
|
111
|
-
# ---------------------------------------------------------------------------
|
|
112
|
-
echo "Analyzing patterns with Haiku..."
|
|
113
|
-
RESULT=$(echo "$ANALYSIS_PROMPT" | claude --model haiku --print -p - 2>/dev/null) || {
|
|
114
|
-
echo "Analysis failed — claude CLI error. Try running manually."
|
|
115
|
-
exit 1
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if [[ "$RESULT" == "NO_NEW_PATTERNS" ]] || [[ -z "$RESULT" ]]; then
|
|
119
|
-
echo "No new patterns detected yet. Keep using Claude Code — patterns emerge over time."
|
|
120
|
-
exit 0
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
# ---------------------------------------------------------------------------
|
|
124
|
-
# Write instinct YAML files
|
|
125
|
-
# ---------------------------------------------------------------------------
|
|
126
|
-
mkdir -p "$PROJECT_DIR"
|
|
127
|
-
|
|
128
|
-
NEW_COUNT=0
|
|
129
|
-
INSTINCT_ID=""
|
|
130
|
-
BLOCK=""
|
|
131
|
-
|
|
132
|
-
while IFS= read -r line; do
|
|
133
|
-
if [[ "$line" == "---" ]] && [[ -n "$BLOCK" ]]; then
|
|
134
|
-
if [[ -n "$INSTINCT_ID" ]]; then
|
|
135
|
-
DEST="${PROJECT_DIR}/${INSTINCT_ID}.yaml"
|
|
136
|
-
printf '%s\n' "$BLOCK" > "$DEST"
|
|
137
|
-
echo " + ${INSTINCT_ID} -> ${DEST}"
|
|
138
|
-
NEW_COUNT=$((NEW_COUNT + 1))
|
|
139
|
-
fi
|
|
140
|
-
INSTINCT_ID=""
|
|
141
|
-
BLOCK=""
|
|
142
|
-
else
|
|
143
|
-
BLOCK="${BLOCK}${line}"$'\n'
|
|
144
|
-
if [[ "$line" =~ ^id:\ (.+) ]]; then
|
|
145
|
-
INSTINCT_ID="${BASH_REMATCH[1]}"
|
|
146
|
-
INSTINCT_ID="${INSTINCT_ID//\"/}"
|
|
147
|
-
INSTINCT_ID="${INSTINCT_ID//\'/}"
|
|
148
|
-
fi
|
|
149
|
-
fi
|
|
150
|
-
done <<< "$RESULT"
|
|
151
|
-
|
|
152
|
-
# Handle last block
|
|
153
|
-
if [[ -n "$INSTINCT_ID" ]] && [[ -n "$BLOCK" ]]; then
|
|
154
|
-
DEST="${PROJECT_DIR}/${INSTINCT_ID}.yaml"
|
|
155
|
-
printf '%s\n' "$BLOCK" > "$DEST"
|
|
156
|
-
echo " + ${INSTINCT_ID} -> ${DEST}"
|
|
157
|
-
NEW_COUNT=$((NEW_COUNT + 1))
|
|
158
|
-
fi
|
|
159
|
-
|
|
160
|
-
echo ""
|
|
161
|
-
echo "Created ${NEW_COUNT} new instinct(s) in ${PROJECT_DIR}/"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# analyze.sh — Read observations.jsonl, detect patterns, create instinct YAML files
|
|
3
|
+
# Runs via /continuous-improvement command. Uses claude CLI with Haiku for cost-efficient analysis.
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
INSTINCTS_DIR="${HOME}/.claude/instincts"
|
|
8
|
+
|
|
9
|
+
# ---------------------------------------------------------------------------
|
|
10
|
+
# Detect project
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
PROJECT_ROOT=""
|
|
13
|
+
if [[ -n "${CLAUDE_PROJECT_DIR:-}" && -d "${CLAUDE_PROJECT_DIR}" ]]; then
|
|
14
|
+
PROJECT_ROOT="${CLAUDE_PROJECT_DIR}"
|
|
15
|
+
fi
|
|
16
|
+
if [[ -z "$PROJECT_ROOT" ]]; then
|
|
17
|
+
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
18
|
+
fi
|
|
19
|
+
if [[ -z "$PROJECT_ROOT" ]]; then
|
|
20
|
+
PROJECT_ROOT="global"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Use shasum on macOS, sha256sum on Linux
|
|
24
|
+
if command -v sha256sum &>/dev/null; then
|
|
25
|
+
PROJECT_HASH="$(printf '%s' "$PROJECT_ROOT" | sha256sum | cut -c1-12)"
|
|
26
|
+
elif command -v shasum &>/dev/null; then
|
|
27
|
+
PROJECT_HASH="$(printf '%s' "$PROJECT_ROOT" | shasum -a 256 | cut -c1-12)"
|
|
28
|
+
else
|
|
29
|
+
# Fallback: use project root basename if no hashing available
|
|
30
|
+
PROJECT_HASH="$(basename "$PROJECT_ROOT" | tr -cd 'a-zA-Z0-9' | cut -c1-12)"
|
|
31
|
+
fi
|
|
32
|
+
PROJECT_NAME="$(basename "${PROJECT_ROOT%.git}")"
|
|
33
|
+
PROJECT_DIR="${INSTINCTS_DIR}/${PROJECT_HASH}"
|
|
34
|
+
OBS_FILE="${PROJECT_DIR}/observations.jsonl"
|
|
35
|
+
|
|
36
|
+
# ---------------------------------------------------------------------------
|
|
37
|
+
# Check observations exist
|
|
38
|
+
# ---------------------------------------------------------------------------
|
|
39
|
+
if [[ ! -f "$OBS_FILE" ]] || [[ ! -s "$OBS_FILE" ]]; then
|
|
40
|
+
echo "No observations found at ${OBS_FILE}"
|
|
41
|
+
echo "Use Claude Code with hooks installed to generate observations."
|
|
42
|
+
exit 0
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
OBS_COUNT=$(wc -l < "$OBS_FILE")
|
|
46
|
+
echo "Found ${OBS_COUNT} observations in ${OBS_FILE}"
|
|
47
|
+
|
|
48
|
+
if (( OBS_COUNT < 20 )); then
|
|
49
|
+
echo "Need at least 20 observations for meaningful analysis. Keep using Claude Code (${OBS_COUNT}/20)."
|
|
50
|
+
exit 0
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# ---------------------------------------------------------------------------
|
|
54
|
+
# Read existing instincts to avoid duplicates
|
|
55
|
+
# ---------------------------------------------------------------------------
|
|
56
|
+
EXISTING_INSTINCTS=""
|
|
57
|
+
for f in "${PROJECT_DIR}"/*.yaml "${INSTINCTS_DIR}/global"/*.yaml; do
|
|
58
|
+
[[ -f "$f" ]] && EXISTING_INSTINCTS="${EXISTING_INSTINCTS}$(cat "$f")"$'\n'
|
|
59
|
+
done
|
|
60
|
+
|
|
61
|
+
# ---------------------------------------------------------------------------
|
|
62
|
+
# Take last 500 observations
|
|
63
|
+
# ---------------------------------------------------------------------------
|
|
64
|
+
RECENT_OBS=$(tail -500 "$OBS_FILE")
|
|
65
|
+
|
|
66
|
+
# ---------------------------------------------------------------------------
|
|
67
|
+
# Build analysis prompt
|
|
68
|
+
# ---------------------------------------------------------------------------
|
|
69
|
+
ANALYSIS_PROMPT="Analyze these Claude Code session observations and extract behavioral patterns as instinct YAML files.
|
|
70
|
+
|
|
71
|
+
OBSERVATIONS (JSONL — each line is a tool call):
|
|
72
|
+
${RECENT_OBS}
|
|
73
|
+
|
|
74
|
+
EXISTING INSTINCTS (already learned — do NOT duplicate these):
|
|
75
|
+
${EXISTING_INSTINCTS}
|
|
76
|
+
|
|
77
|
+
YOUR TASK:
|
|
78
|
+
1. Look for REPEATED PATTERNS — same tool sequence used 3+ times
|
|
79
|
+
2. Look for ERROR-THEN-FIX sequences — tool fails, next tools fix it
|
|
80
|
+
3. Look for TOOL PREFERENCES — one tool consistently chosen over alternatives
|
|
81
|
+
4. Look for WORKFLOW PATTERNS — consistent ordering of operations
|
|
82
|
+
5. Look for USER CORRECTIONS — user says no/stop/don't after an action
|
|
83
|
+
|
|
84
|
+
OUTPUT FORMAT — output ONLY new instincts as YAML blocks, separated by ---:
|
|
85
|
+
|
|
86
|
+
id: descriptive-kebab-case-id
|
|
87
|
+
trigger: \"when [specific situation]\"
|
|
88
|
+
confidence: 0.5
|
|
89
|
+
domain: workflow|tooling|testing|patterns
|
|
90
|
+
source: observation
|
|
91
|
+
scope: project
|
|
92
|
+
project_id: ${PROJECT_HASH}
|
|
93
|
+
created: \"$(date -u +%Y-%m-%d)\"
|
|
94
|
+
last_seen: \"$(date -u +%Y-%m-%d)\"
|
|
95
|
+
observation_count: [number of times pattern was seen]
|
|
96
|
+
---
|
|
97
|
+
[One sentence describing the specific actionable behavior]
|
|
98
|
+
|
|
99
|
+
Rules:
|
|
100
|
+
- Only create instincts for patterns seen 3+ times
|
|
101
|
+
- Start confidence at 0.5 (suggest level)
|
|
102
|
+
- Be specific and actionable (not vague advice)
|
|
103
|
+
- Different from existing instincts listed above
|
|
104
|
+
|
|
105
|
+
If no new patterns are found, output exactly: NO_NEW_PATTERNS
|
|
106
|
+
|
|
107
|
+
Output ONLY the YAML blocks or NO_NEW_PATTERNS. No explanation, no preamble."
|
|
108
|
+
|
|
109
|
+
# ---------------------------------------------------------------------------
|
|
110
|
+
# Run analysis with Haiku
|
|
111
|
+
# ---------------------------------------------------------------------------
|
|
112
|
+
echo "Analyzing patterns with Haiku..."
|
|
113
|
+
RESULT=$(echo "$ANALYSIS_PROMPT" | claude --model haiku --print -p - 2>/dev/null) || {
|
|
114
|
+
echo "Analysis failed — claude CLI error. Try running manually."
|
|
115
|
+
exit 1
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if [[ "$RESULT" == "NO_NEW_PATTERNS" ]] || [[ -z "$RESULT" ]]; then
|
|
119
|
+
echo "No new patterns detected yet. Keep using Claude Code — patterns emerge over time."
|
|
120
|
+
exit 0
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# ---------------------------------------------------------------------------
|
|
124
|
+
# Write instinct YAML files
|
|
125
|
+
# ---------------------------------------------------------------------------
|
|
126
|
+
mkdir -p "$PROJECT_DIR"
|
|
127
|
+
|
|
128
|
+
NEW_COUNT=0
|
|
129
|
+
INSTINCT_ID=""
|
|
130
|
+
BLOCK=""
|
|
131
|
+
|
|
132
|
+
while IFS= read -r line; do
|
|
133
|
+
if [[ "$line" == "---" ]] && [[ -n "$BLOCK" ]]; then
|
|
134
|
+
if [[ -n "$INSTINCT_ID" ]]; then
|
|
135
|
+
DEST="${PROJECT_DIR}/${INSTINCT_ID}.yaml"
|
|
136
|
+
printf '%s\n' "$BLOCK" > "$DEST"
|
|
137
|
+
echo " + ${INSTINCT_ID} -> ${DEST}"
|
|
138
|
+
NEW_COUNT=$((NEW_COUNT + 1))
|
|
139
|
+
fi
|
|
140
|
+
INSTINCT_ID=""
|
|
141
|
+
BLOCK=""
|
|
142
|
+
else
|
|
143
|
+
BLOCK="${BLOCK}${line}"$'\n'
|
|
144
|
+
if [[ "$line" =~ ^id:\ (.+) ]]; then
|
|
145
|
+
INSTINCT_ID="${BASH_REMATCH[1]}"
|
|
146
|
+
INSTINCT_ID="${INSTINCT_ID//\"/}"
|
|
147
|
+
INSTINCT_ID="${INSTINCT_ID//\'/}"
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
done <<< "$RESULT"
|
|
151
|
+
|
|
152
|
+
# Handle last block
|
|
153
|
+
if [[ -n "$INSTINCT_ID" ]] && [[ -n "$BLOCK" ]]; then
|
|
154
|
+
DEST="${PROJECT_DIR}/${INSTINCT_ID}.yaml"
|
|
155
|
+
printf '%s\n' "$BLOCK" > "$DEST"
|
|
156
|
+
echo " + ${INSTINCT_ID} -> ${DEST}"
|
|
157
|
+
NEW_COUNT=$((NEW_COUNT + 1))
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
echo ""
|
|
161
|
+
echo "Created ${NEW_COUNT} new instinct(s) in ${PROJECT_DIR}/"
|
package/bin/backfill.mjs
CHANGED
|
@@ -27,25 +27,25 @@ const args = process.argv.slice(2);
|
|
|
27
27
|
const DRY_RUN = args.includes("--dry-run");
|
|
28
28
|
const HELP = args.includes("--help") || args.includes("-h");
|
|
29
29
|
if (HELP) {
|
|
30
|
-
console.log(`
|
|
31
|
-
backfill — Tag legacy thin-schema observation rows.
|
|
32
|
-
|
|
33
|
-
Usage:
|
|
34
|
-
npx continuous-improvement backfill Tag rows in place
|
|
35
|
-
npx continuous-improvement backfill --dry-run Report counts, write nothing
|
|
36
|
-
|
|
37
|
-
What it does:
|
|
38
|
-
Walks ~/.claude/instincts/<hash>/observations.jsonl files and adds a
|
|
39
|
-
schema field ("thin" or "rich") to every row that lacks one. Thin rows
|
|
40
|
-
came from the legacy bash fallback (jq missing) and have no input_summary;
|
|
41
|
-
rich rows came from the Node observer and have full tool_input.command /
|
|
42
|
-
Edit.file_path / etc.
|
|
43
|
-
|
|
44
|
-
Output:
|
|
45
|
-
- observations.jsonl rewritten in place (original kept as .bak)
|
|
46
|
-
- backfill-summary.json with per-project counts
|
|
47
|
-
|
|
48
|
-
Idempotent. Always exits 0 — failures go to stderr only.
|
|
30
|
+
console.log(`
|
|
31
|
+
backfill — Tag legacy thin-schema observation rows.
|
|
32
|
+
|
|
33
|
+
Usage:
|
|
34
|
+
npx continuous-improvement backfill Tag rows in place
|
|
35
|
+
npx continuous-improvement backfill --dry-run Report counts, write nothing
|
|
36
|
+
|
|
37
|
+
What it does:
|
|
38
|
+
Walks ~/.claude/instincts/<hash>/observations.jsonl files and adds a
|
|
39
|
+
schema field ("thin" or "rich") to every row that lacks one. Thin rows
|
|
40
|
+
came from the legacy bash fallback (jq missing) and have no input_summary;
|
|
41
|
+
rich rows came from the Node observer and have full tool_input.command /
|
|
42
|
+
Edit.file_path / etc.
|
|
43
|
+
|
|
44
|
+
Output:
|
|
45
|
+
- observations.jsonl rewritten in place (original kept as .bak)
|
|
46
|
+
- backfill-summary.json with per-project counts
|
|
47
|
+
|
|
48
|
+
Idempotent. Always exits 0 — failures go to stderr only.
|
|
49
49
|
`);
|
|
50
50
|
process.exit(0);
|
|
51
51
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|