continuous-improvement 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/QUICKSTART.md +81 -0
- package/README.md +107 -121
- package/SKILL.md +171 -0
- package/bin/analyze.sh +115 -0
- package/bin/install.mjs +266 -0
- package/commands/continuous-improvement.md +74 -0
- package/hooks/observe.sh +63 -62
- package/package.json +31 -14
- package/agents/observer-loop.sh +0 -282
- package/agents/observer.md +0 -145
- package/agents/start-observer.sh +0 -115
- package/config.json +0 -9
- package/docs/failure-taxonomy.md +0 -153
- package/docs/integration-guide.md +0 -105
- package/docs/philosophy.md +0 -127
- package/docs/superpowers/plans/2026-04-05-mulahazah-implementation.md +0 -1666
- package/docs/superpowers/specs/2026-04-05-mulahazah-instinct-learning-design.md +0 -636
- package/prompts/coding-agent.md +0 -67
- package/prompts/core.md +0 -115
- package/prompts/minimal.md +0 -17
- package/prompts/product-agent.md +0 -59
- package/prompts/research-agent.md +0 -59
- package/scripts/install.js +0 -433
- package/skills/continuous-improvement/SKILL.md +0 -111
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this skill are documented here.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## [2.1.0] — 2026-04-05
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- **Auto-leveling** — system promotes itself from CAPTURE → ANALYZE → SUGGEST → AUTO-APPLY based on observation count and instinct confidence. No user action needed.
|
|
11
|
+
- **No background daemon** — analysis runs inline at session start. Removed start-observer.sh, observer-loop.sh, PID management.
|
|
12
|
+
- **Simplified directory** — `~/.claude/instincts/` replaces `~/.claude/mulahazah/` with flat structure
|
|
13
|
+
- **jq optional** — observe.sh works with pure bash fallback if jq isn't installed
|
|
14
|
+
- **Leaner installer** — no daemon files copied, no config.json, no analyze.sh. Just skill + hook + command.
|
|
15
|
+
- **Smaller package** — removed agents/ and config.json from published files
|
|
16
|
+
|
|
17
|
+
### Removed
|
|
18
|
+
- Background observer daemon (deferred to v2.2 as opt-in)
|
|
19
|
+
- `~/.claude/mulahazah/` directory structure (replaced by `~/.claude/instincts/`)
|
|
20
|
+
- `rules.md` (replaced by YAML instinct files with confidence scoring)
|
|
21
|
+
- `bin/analyze.sh` (analysis now inline via SKILL.md prompt)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## [2.0.1] — 2026-04-05
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- SKILL.md rewritten to be honest — removed claims about features that didn't work (YAML instinct auto-loading, graduated confidence enforcement)
|
|
29
|
+
- Law 7 now uses `~/.claude/mulahazah/rules.md` — a markdown file Claude can actually read/write reliably
|
|
30
|
+
- Added `bin/analyze.sh` — the actual analysis pipeline that was missing (calls Haiku to extract rules from observations)
|
|
31
|
+
- Added `commands/continuous-improvement.md` — the actual `/continuous-improvement` command file
|
|
32
|
+
- Installer now copies analyze.sh, command file, and initializes rules.md
|
|
33
|
+
- observer-loop.sh rewritten to use analyze.sh instead of broken YAML instinct pipeline
|
|
34
|
+
- README rewritten to match what the tool actually does
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## [2.0.0] — 2026-04-05
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- Law 7: Learn From Every Session — Mulahazah learning system
|
|
42
|
+
- PreToolUse/PostToolUse hooks for session observation
|
|
43
|
+
- Background Haiku observer agent for pattern detection
|
|
44
|
+
- Project-scoped observation (per-project JSONL files)
|
|
45
|
+
- `/continuous-improvement` command
|
|
46
|
+
- `hooks/observe.sh` — lightweight observation hook (<50ms)
|
|
47
|
+
- `agents/` — observer agent scripts
|
|
48
|
+
- `config.json` — observer configuration
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- Upgraded from 5-phase framework to 7-Law system
|
|
52
|
+
- The Loop: Research → Plan → Execute → Verify → Reflect → Learn → Iterate
|
|
53
|
+
- Installer sets up Mulahazah hooks and directories for Claude Code
|
|
54
|
+
|
|
55
|
+
### Improved
|
|
56
|
+
- Law 6 (Iterate) now explicit — one change → verify → next change
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## [1.1.0] — 2026-04-04
|
|
61
|
+
|
|
62
|
+
### Improved
|
|
63
|
+
- README completely rewritten for cleaner onboarding — hook first, install in 30 seconds, first-task prompt
|
|
64
|
+
- Added real example of a successful agent run (rate limiting walkthrough)
|
|
65
|
+
- Added QUICKSTART.md for step-by-step first-use guide
|
|
66
|
+
- Added CHANGELOG.md for version tracking
|
|
67
|
+
- Removed internal references from SKILL.md (now works for any user, any project)
|
|
68
|
+
- Red flags section now in README for discoverability before install
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
- Fake Claude Code marketplace install command removed
|
|
72
|
+
- Internal variable references (Naim, PROJECT_REGISTRY, STATE_TEMPLATE) made universal
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## [1.0.0] — 2026-04-04
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
- Initial release
|
|
80
|
+
- 5-phase framework: Research → Plan → Execute → Verify → Reflect
|
|
81
|
+
- Iron Law with 3 hard constraints
|
|
82
|
+
- Phase gates (explicit conditions before proceeding)
|
|
83
|
+
- Red Flags list (thought patterns that indicate a skip)
|
|
84
|
+
- Common Rationalizations table
|
|
85
|
+
- Subagent delegation rules with 4 status handlers
|
|
86
|
+
- Pre-completion self-review checklist
|
|
87
|
+
- marketplace.json for plugin discoverability
|
package/QUICKSTART.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Quickstart — continuous-improvement
|
|
2
|
+
|
|
3
|
+
Zero to working in under 2 minutes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx continuous-improvement install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This auto-detects your setup. For Claude Code, it installs the skill, hooks, and `/continuous-improvement` command.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 2: Use It
|
|
18
|
+
|
|
19
|
+
Give your agent a task and prefix it:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Use the continuous-improvement framework to [your task here].
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Examples:
|
|
26
|
+
```
|
|
27
|
+
Use the continuous-improvement framework to add pagination to the users API endpoint.
|
|
28
|
+
Use the continuous-improvement framework to debug why the login form breaks on mobile.
|
|
29
|
+
Use the continuous-improvement framework to refactor the payment module to use the new SDK.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Your agent will research, plan, execute one thing at a time, verify, and reflect.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 3: Check Learning
|
|
37
|
+
|
|
38
|
+
After completing non-trivial work:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
/continuous-improvement
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This shows what the system has learned — instincts, confidence levels, and the current auto-level.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## How Auto-Leveling Works
|
|
49
|
+
|
|
50
|
+
You don't configure anything. The system promotes itself:
|
|
51
|
+
|
|
52
|
+
| Your usage | What happens |
|
|
53
|
+
|-----------|-------------|
|
|
54
|
+
| First sessions | Hooks capture tool calls silently. No behavior change. |
|
|
55
|
+
| After ~20 sessions | Agent analyzes patterns, creates instincts (silent — you see nothing) |
|
|
56
|
+
| After ~50 sessions | Instincts cross 0.5 → agent starts suggesting: "Consider: [action]" |
|
|
57
|
+
| After ~100 sessions | Instincts cross 0.7 → agent auto-applies learned behaviors |
|
|
58
|
+
|
|
59
|
+
Corrections drop instinct confidence. Unused instincts decay. The system self-corrects.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Common Issues
|
|
64
|
+
|
|
65
|
+
**Agent skips straight to coding?**
|
|
66
|
+
→ Say: *"You skipped research and planning. Go back to Law 1."*
|
|
67
|
+
|
|
68
|
+
**Agent writes "done" without verifying?**
|
|
69
|
+
→ Reply: *"What verification command did you run? Show me the output."*
|
|
70
|
+
|
|
71
|
+
**No instincts showing up yet?**
|
|
72
|
+
→ Normal. The system needs 20+ observations before it creates instincts. Keep working.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## That's It
|
|
77
|
+
|
|
78
|
+
The skill is most valuable when:
|
|
79
|
+
- You're under pressure and tempted to skip steps
|
|
80
|
+
- A task has failed 2+ times
|
|
81
|
+
- You want your agent to stop repeating the same mistakes
|
package/README.md
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="promo/combined.gif" alt="Before vs After continuous-improvement" width="700" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# continuous-improvement
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
> Stop your AI agent from skipping steps, guessing, and declaring "done" without verifying.
|
|
8
|
+
|
|
9
|
+
[](CHANGELOG.md)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## The Problem
|
|
15
|
+
|
|
16
|
+
AI agents are great at individual steps. They're terrible at discipline.
|
|
17
|
+
|
|
18
|
+
They skip research. They plan loosely. They declare "done" before verifying. They add features mid-task. They never reflect. Each session, they repeat the same mistakes.
|
|
4
19
|
|
|
5
|
-
|
|
20
|
+
This skill fixes that with **7 laws** and a **learning system** that auto-levels itself — no config, no daemon, no manual setup.
|
|
6
21
|
|
|
7
|
-
|
|
22
|
+
---
|
|
8
23
|
|
|
9
24
|
## Install
|
|
10
25
|
|
|
@@ -12,164 +27,135 @@ AI agents are useful. They're also reckless by default.
|
|
|
12
27
|
npx continuous-improvement install
|
|
13
28
|
```
|
|
14
29
|
|
|
15
|
-
|
|
30
|
+
That's it. For Claude Code, this also installs:
|
|
31
|
+
- Observation hooks (captures every tool call, <50ms, jq optional)
|
|
32
|
+
- `/continuous-improvement` command
|
|
33
|
+
- Auto-leveling instinct system
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
npx continuous-improvement install --claude
|
|
19
|
-
npx continuous-improvement install --codex
|
|
20
|
-
npx continuous-improvement install --cursor
|
|
21
|
-
npx continuous-improvement install --openclaw
|
|
22
|
-
npx continuous-improvement install --chatgpt
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Optional global Claude install:
|
|
35
|
+
Install to a specific target:
|
|
26
36
|
|
|
27
37
|
```bash
|
|
28
|
-
npx continuous-improvement install --claude
|
|
38
|
+
npx continuous-improvement install --target claude # Claude Code + Mulahazah
|
|
39
|
+
npx continuous-improvement install --target openclaw # OpenClaw (skill only)
|
|
40
|
+
npx continuous-improvement install --target cursor # Cursor (skill only)
|
|
41
|
+
npx continuous-improvement install --target all # All targets
|
|
29
42
|
```
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
### Manual install
|
|
32
45
|
|
|
33
46
|
```bash
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
npx continuous-improvement uninstall --openclaw
|
|
47
|
+
mkdir -p ~/.claude/skills/continuous-improvement && \
|
|
48
|
+
curl -fsSL -o ~/.claude/skills/continuous-improvement/SKILL.md \
|
|
49
|
+
https://raw.githubusercontent.com/naimkatiman/continuous-improvement/main/SKILL.md
|
|
38
50
|
```
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Depending on your target, it does one of these:
|
|
52
|
+
### Tell your agent
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- **OpenClaw** → installs the local skill at `~/.openclaw/skills/continuous-improvement/`
|
|
48
|
-
- **ChatGPT** → prints the exact block to paste into Custom Instructions
|
|
49
|
-
|
|
50
|
-
## Use
|
|
54
|
+
```
|
|
55
|
+
Fetch and follow the skill at: https://raw.githubusercontent.com/naimkatiman/continuous-improvement/main/SKILL.md
|
|
56
|
+
```
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
---
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
## The 7 Laws
|
|
55
61
|
|
|
56
|
-
|
|
62
|
+
| # | Law | What it prevents |
|
|
63
|
+
|---|-----|-----------------|
|
|
64
|
+
| 1 | **Research Before Executing** | Reinventing what already exists |
|
|
65
|
+
| 2 | **Plan Is Sacred** | Scope creep and overbuilding |
|
|
66
|
+
| 3 | **One Thing at a Time** | Stacking untested changes |
|
|
67
|
+
| 4 | **Verify Before Reporting** | False "done" claims |
|
|
68
|
+
| 5 | **Reflect After Sessions** | Repeating the same failures |
|
|
69
|
+
| 6 | **Iterate One Change** | Debugging 5 changes at once |
|
|
70
|
+
| 7 | **Learn From Every Session** | Knowledge that dies with the context window |
|
|
57
71
|
|
|
58
|
-
|
|
59
|
-
2. **Plan** — what will be built
|
|
60
|
-
3. **Anti-scope** — what will not be built
|
|
61
|
-
4. **Verification** — exact checks
|
|
62
|
-
5. **Fallback** — what to do if it fails
|
|
63
|
-
6. **Reflection** — what to learn after execution
|
|
72
|
+
### The Loop
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
```
|
|
75
|
+
Research → Plan → Execute (one thing) → Verify → Reflect → Learn → Iterate
|
|
76
|
+
```
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
2. **Plan before coding**
|
|
69
|
-
3. **Do one thing at a time**
|
|
70
|
-
4. **Verify before reporting**
|
|
71
|
-
5. **Reflect after non-trivial work**
|
|
72
|
-
6. **Iterate one change at a time**
|
|
73
|
-
7. **Learn from every session**
|
|
78
|
+
---
|
|
74
79
|
|
|
75
|
-
##
|
|
80
|
+
## Mulahazah: Auto-Leveling Learning
|
|
76
81
|
|
|
77
|
-
Mulahazah (Arabic: observation)
|
|
82
|
+
Mulahazah (Arabic: observation) makes your agent build **instincts** over time. It levels up automatically — you don't configure anything.
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
```
|
|
85
|
+
Install: Hooks start capturing silently. You notice nothing.
|
|
86
|
+
~20 sessions: Agent analyzes patterns, creates first instincts (silent)
|
|
87
|
+
~50 sessions: Instincts cross 0.5 → agent starts suggesting behaviors
|
|
88
|
+
~100 sessions: Instincts cross 0.7 → agent auto-applies what it learned
|
|
89
|
+
```
|
|
80
90
|
|
|
81
|
-
|
|
91
|
+
### How it works
|
|
82
92
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
93
|
+
1. **Hooks capture every tool call** — PreToolUse/PostToolUse hooks write JSONL observations (<50ms, never blocks your session, jq not required)
|
|
94
|
+
2. **Analysis runs inline** — when 20+ observations accumulate, Claude analyzes them at session start. No background daemon.
|
|
95
|
+
3. **Instincts carry confidence** — 0.3–0.9 scale with graduated behavior:
|
|
96
|
+
- **Silent** (< 0.5) — stored, not surfaced
|
|
97
|
+
- **Suggest** (0.5–0.69) — mentioned inline when relevant
|
|
98
|
+
- **Auto-apply** (0.7+) — applied automatically
|
|
99
|
+
4. **Self-correcting** — user corrections drop confidence by 0.1. Unused instincts decay. Wrong behaviors fade out.
|
|
100
|
+
5. **Project-scoped** — instincts are per-project by default, promoted to global when seen across 2+ projects
|
|
88
101
|
|
|
89
|
-
|
|
102
|
+
### Check what your agent has learned
|
|
90
103
|
|
|
91
|
-
```
|
|
104
|
+
```
|
|
92
105
|
/continuous-improvement
|
|
93
106
|
```
|
|
94
107
|
|
|
95
|
-
|
|
108
|
+
---
|
|
96
109
|
|
|
97
|
-
|
|
110
|
+
## Files
|
|
98
111
|
|
|
99
|
-
```bash
|
|
100
|
-
~/.claude/mulahazah/agents/start-observer.sh
|
|
101
112
|
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
- they pile on changes before verifying the first one
|
|
111
|
-
- they repeat mistakes because nothing gets logged
|
|
112
|
-
|
|
113
|
-
continuous-improvement fixes that with a tiny, reusable operating loop:
|
|
114
|
-
|
|
115
|
-
```text
|
|
116
|
-
Research → Plan → Execute (one thing) → Verify → Reflect → Learn → Iterate
|
|
113
|
+
continuous-improvement/
|
|
114
|
+
├── SKILL.md # The 7 Laws + instinct behavior
|
|
115
|
+
├── commands/continuous-improvement.md # The /continuous-improvement command
|
|
116
|
+
├── hooks/observe.sh # Observation hook (pure bash)
|
|
117
|
+
├── bin/install.mjs # CLI installer
|
|
118
|
+
├── QUICKSTART.md # First-use guide
|
|
119
|
+
├── CHANGELOG.md
|
|
120
|
+
└── package.json
|
|
117
121
|
```
|
|
118
122
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
This repo is designed as a **skill first** product:
|
|
122
|
-
|
|
123
|
-
- easy to install
|
|
124
|
-
- easy to invoke in one shot
|
|
125
|
-
- useful before any complex task
|
|
126
|
-
|
|
127
|
-
Prompt variants in `prompts/` are still here, but they are **supporting material**, not the main product.
|
|
123
|
+
### What gets installed where (Claude Code)
|
|
128
124
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
```
|
|
126
|
+
~/.claude/skills/continuous-improvement/SKILL.md # The skill
|
|
127
|
+
~/.claude/commands/continuous-improvement.md # The command
|
|
128
|
+
~/.claude/instincts/
|
|
129
|
+
├── observe.sh # Hook script
|
|
130
|
+
├── global/ # Global instincts (*.yaml)
|
|
131
|
+
└── <project-hash>/
|
|
132
|
+
├── project.json # Project metadata
|
|
133
|
+
├── observations.jsonl # Tool call observations
|
|
134
|
+
└── *.yaml # Project instincts
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
Use these files to test whether the install and behavior are actually good:
|
|
138
|
-
|
|
139
|
-
- `tests/install-checklist.md`
|
|
140
|
-
- `tests/official-evals.md`
|
|
141
|
-
- `tests/prompt-eval.md`
|
|
142
|
-
- `examples/real-test-cases.md`
|
|
143
|
-
- `.github/ISSUE_TEMPLATE/test-report.yml`
|
|
144
|
-
|
|
145
|
-
Best practice: have multiple people test across Claude Code, Codex, Cursor, OpenClaw, and ChatGPT, then submit structured reports instead of random comments.
|
|
146
|
-
|
|
147
|
-
## Fallback: manual install
|
|
148
|
-
|
|
149
|
-
If you do not want the installer, copy the right block manually:
|
|
137
|
+
---
|
|
150
138
|
|
|
151
|
-
|
|
152
|
-
- `prompts/core.md`
|
|
153
|
-
- `prompts/minimal.md`
|
|
154
|
-
- `skills/continuous-improvement/SKILL.md`
|
|
139
|
+
## Uninstall
|
|
155
140
|
|
|
156
|
-
|
|
141
|
+
```bash
|
|
142
|
+
npx continuous-improvement install --uninstall
|
|
143
|
+
```
|
|
157
144
|
|
|
158
|
-
|
|
145
|
+
---
|
|
159
146
|
|
|
160
|
-
|
|
147
|
+
## Red Flags
|
|
161
148
|
|
|
162
|
-
|
|
163
|
-
- defining anti-scope
|
|
164
|
-
- stating how it will verify success
|
|
165
|
-
- and it doesn't learn from corrections
|
|
149
|
+
If your agent says any of these, it's skipping a law:
|
|
166
150
|
|
|
167
|
-
|
|
151
|
+
- "I'll just quickly..." → Law 3 violation
|
|
152
|
+
- "This should work..." → Law 4 violation (verify, don't assume)
|
|
153
|
+
- "I already know how to..." → Law 1 violation (still research)
|
|
154
|
+
- "Let me also add..." → Law 6 violation (finish first)
|
|
155
|
+
- "I'll remember this..." → Law 7 violation (write it down)
|
|
168
156
|
|
|
169
|
-
|
|
157
|
+
---
|
|
170
158
|
|
|
171
|
-
|
|
172
|
-
Keep it practical.
|
|
173
|
-
Kill anything that adds friction.
|
|
159
|
+
## License
|
|
174
160
|
|
|
175
|
-
MIT
|
|
161
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: continuous-improvement
|
|
3
|
+
description: "Install structured self-improvement loops with instinct-based learning into Claude Code — research, plan, execute, verify, reflect, learn, iterate. Auto-levels from silent observation to active suggestions to auto-applied behaviors."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# continuous-improvement
|
|
7
|
+
|
|
8
|
+
You follow the continuous-improvement framework. These 7 laws govern all your work.
|
|
9
|
+
|
|
10
|
+
## Law 1: Research Before Executing
|
|
11
|
+
|
|
12
|
+
Before writing code or taking action:
|
|
13
|
+
- What already exists? Search the codebase and package registries.
|
|
14
|
+
- What are the constraints? Rate limits, quotas, memory, time.
|
|
15
|
+
- What can break? Side effects, dependencies, data risks.
|
|
16
|
+
- What's the simplest path? Fewest files, fewest dependencies.
|
|
17
|
+
|
|
18
|
+
If you can't answer these, research first.
|
|
19
|
+
|
|
20
|
+
## Law 2: Plan Is Sacred
|
|
21
|
+
|
|
22
|
+
Before executing, state:
|
|
23
|
+
- **WILL build:** Specific deliverables with completion criteria
|
|
24
|
+
- **Will NOT build:** Explicit anti-scope
|
|
25
|
+
- **Verification:** The exact check that proves it works
|
|
26
|
+
- **Fallback:** What to do if it fails (not "try again")
|
|
27
|
+
|
|
28
|
+
## Law 3: One Thing at a Time
|
|
29
|
+
|
|
30
|
+
- Complete and verify one task before starting the next
|
|
31
|
+
- Never spawn parallel work for tasks you can do directly
|
|
32
|
+
- Never report completion until you've checked actual output
|
|
33
|
+
- If you want to "also quickly add" something — stop. Finish first.
|
|
34
|
+
|
|
35
|
+
## Law 4: Verify Before Reporting
|
|
36
|
+
|
|
37
|
+
"Done" requires ALL of:
|
|
38
|
+
- Code runs without errors
|
|
39
|
+
- Output matches expected result
|
|
40
|
+
- You checked the **actual** result, not assumed it
|
|
41
|
+
- Build passes
|
|
42
|
+
- You can explain what changed in one sentence
|
|
43
|
+
|
|
44
|
+
## Law 5: Reflect After Every Session
|
|
45
|
+
|
|
46
|
+
After non-trivial tasks:
|
|
47
|
+
```
|
|
48
|
+
## Reflection
|
|
49
|
+
- What worked:
|
|
50
|
+
- What failed:
|
|
51
|
+
- What I'd do differently:
|
|
52
|
+
- Rule to add:
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The "Rule to add" field feeds Law 7 — it becomes an instinct with 0.6 starting confidence.
|
|
56
|
+
|
|
57
|
+
## Law 6: Iterate Means One Thing
|
|
58
|
+
|
|
59
|
+
One change → verify → next change.
|
|
60
|
+
|
|
61
|
+
Never: add features before fixing bugs, make multiple untested changes, "improve" working code while the task is incomplete.
|
|
62
|
+
|
|
63
|
+
## Law 7: Learn From Every Session
|
|
64
|
+
|
|
65
|
+
Your sessions create knowledge. Capture it.
|
|
66
|
+
|
|
67
|
+
- Patterns you repeat become instincts (automatic via hooks)
|
|
68
|
+
- Rules you discover become instincts (explicit via reflection)
|
|
69
|
+
- Corrections you receive reduce confidence in wrong behaviors
|
|
70
|
+
- Instincts you confirm strengthen over time
|
|
71
|
+
|
|
72
|
+
Low-confidence instincts suggest. High-confidence instincts apply.
|
|
73
|
+
If the user corrects you, the instinct weakens. If they don't, it strengthens.
|
|
74
|
+
|
|
75
|
+
Nothing learned is permanent. Everything decays without reinforcement.
|
|
76
|
+
|
|
77
|
+
## The Loop
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Research → Plan → Execute (one thing) → Verify → Reflect → Learn → Iterate
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If you're skipping a step, that's the step you need most.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Instinct System (Mulahazah)
|
|
88
|
+
|
|
89
|
+
At the start of every session, check `~/.claude/instincts/` for this project's instincts.
|
|
90
|
+
|
|
91
|
+
### Auto-Level Detection
|
|
92
|
+
|
|
93
|
+
Determine current level automatically:
|
|
94
|
+
|
|
95
|
+
1. **Find project hash:** Run `git rev-parse --show-toplevel 2>/dev/null`, then SHA-256 first 12 chars of the path
|
|
96
|
+
2. **Check observations:** Count lines in `~/.claude/instincts/<hash>/observations.jsonl`
|
|
97
|
+
3. **Check instincts:** List `*.yaml` files in the project directory + `global/`
|
|
98
|
+
|
|
99
|
+
| Condition | Level | Your behavior |
|
|
100
|
+
|-----------|-------|---------------|
|
|
101
|
+
| <20 observations, no instincts | **CAPTURE** | Work normally. Hooks are capturing silently. |
|
|
102
|
+
| 20+ observations OR instincts exist | **ANALYZE** | Process observations: read last 500 lines, detect patterns, create/update instinct YAML files. Then load instincts. |
|
|
103
|
+
| Any instinct at 0.5–0.69 confidence | **SUGGEST** | Mention relevant instincts inline: "Consider: [action]" |
|
|
104
|
+
| Any instinct at 0.7+ confidence | **AUTO-APPLY** | Apply the behavior automatically. |
|
|
105
|
+
|
|
106
|
+
Multiple levels can be active simultaneously — you might auto-apply some instincts while suggesting others.
|
|
107
|
+
|
|
108
|
+
### Inline Analysis
|
|
109
|
+
|
|
110
|
+
When 20+ unprocessed observations exist, analyze them as part of session startup:
|
|
111
|
+
|
|
112
|
+
1. Read `observations.jsonl` (last 500 lines)
|
|
113
|
+
2. Read existing instincts (project + global `*.yaml` files)
|
|
114
|
+
3. Detect patterns:
|
|
115
|
+
- **User corrections** → "don't do X" instincts
|
|
116
|
+
- **Error→fix sequences** → "when X fails, try Y"
|
|
117
|
+
- **Repeated workflows** (same sequence 3+ times) → "for X, do A→B→C"
|
|
118
|
+
- **Tool preferences** → "use tool Y for task X"
|
|
119
|
+
4. Create/update instinct YAML files in the project directory
|
|
120
|
+
5. Be conservative: only create instincts for 3+ observations of the same pattern
|
|
121
|
+
|
|
122
|
+
### Instinct Format
|
|
123
|
+
|
|
124
|
+
Each instinct is a YAML file in `~/.claude/instincts/<hash>/` or `~/.claude/instincts/global/`:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
id: prefer-grep-before-edit
|
|
128
|
+
trigger: "when modifying code"
|
|
129
|
+
confidence: 0.65
|
|
130
|
+
domain: workflow
|
|
131
|
+
source: observation
|
|
132
|
+
scope: project
|
|
133
|
+
project_id: a1b2c3d4e5f6
|
|
134
|
+
created: "2026-04-05"
|
|
135
|
+
last_seen: "2026-04-05"
|
|
136
|
+
observation_count: 6
|
|
137
|
+
---
|
|
138
|
+
Always search with Grep to confirm location before using Edit.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Confidence Behavior
|
|
142
|
+
|
|
143
|
+
| Range | Behavior |
|
|
144
|
+
|-------|----------|
|
|
145
|
+
| 0.0–0.49 | **Silent** — stored, not surfaced |
|
|
146
|
+
| 0.5–0.69 | **Suggest** — mention inline when relevant |
|
|
147
|
+
| 0.7–0.9 | **Auto-apply** — apply automatically |
|
|
148
|
+
|
|
149
|
+
### Confidence Changes
|
|
150
|
+
|
|
151
|
+
| Event | Change |
|
|
152
|
+
|-------|--------|
|
|
153
|
+
| User explicitly accepts suggestion | +0.15 |
|
|
154
|
+
| Confirming observation (same pattern seen again) | +0.05 |
|
|
155
|
+
| Reflection matches existing instinct | +0.2 |
|
|
156
|
+
| User corrects/rejects | -0.1 |
|
|
157
|
+
| No observation for 30 days | -0.05 decay |
|
|
158
|
+
|
|
159
|
+
Cap: 0.9 max. Scope: default to project; promote to global when seen in 2+ projects.
|
|
160
|
+
|
|
161
|
+
## /continuous-improvement Command
|
|
162
|
+
|
|
163
|
+
Run `/continuous-improvement` after significant work:
|
|
164
|
+
|
|
165
|
+
1. **Reflect** — Generate Law 5 reflection
|
|
166
|
+
2. **Analyze** — Process pending observations into instincts
|
|
167
|
+
3. **Status** — Show all instincts with confidence and current level
|
|
168
|
+
|
|
169
|
+
Subcommands:
|
|
170
|
+
- `/continuous-improvement status` — Instinct overview only
|
|
171
|
+
- `/continuous-improvement analyze` — Force analysis of pending observations
|