continuous-improvement
ASecurityThe drive pillar, beside the be-ambitious skill (ambition). Tells the agent to work a task in seven steps: research, plan, implement, review, contemplate, relearn and learn, iterate. Use when a task changes code (fix, refactor) or runs commands. Also use for a first recommendation or when someone asks which available skill fits their task. Before the final report, if the user corrected you, an approach was dropped or a check failed twice, or when the user asks to reflect: read the session log...
- 11 stars
- 0 votes
- 0 copies
- 1 view
- Added May 28, 2026
Works with
Security analysis
100/100Pro scans all 17 files and shows the line behind each finding
npx -y skills add naimkatiman/continuous-improvement --agent claude-codeAre you the author of continuous-improvement?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/naimkatiman-continuous-improvement)---
name: continuous-improvement
tier: core
description: "The drive pillar, beside the be-ambitious skill (ambition). Tells the agent to work a task in seven steps: research, plan, implement, review, contemplate, relearn and learn, iterate. Use when a task changes code (fix, refactor) or runs commands. Also use for a first recommendation or when someone asks which available skill fits their task. Before the final report, if the user corrected you, an approach was dropped or a check failed twice, or when the user asks to reflect: read the session log, write the reflection and save its rule as a project instinct the next session can load. Other simple questions can be answered directly."
---
# continuous-improvement
The framework has two pillars. **Ambition:** the user sets the goal. Use `be-ambitious` when the work calls for a deeper outcome. **Drive:** the user steers the outcome. Handle routine work independently, try reversible ideas within scope, and use the seven laws to check what worked. Installed hooks enforce their specific rules.
Laws 1 to 4 and 6 shape the work. Laws 5 and 7 carry a session's lesson into the next session, and only if you save it: no code does that for you.
When someone has just installed continuous-improvement and asks where to start, inspect a small piece of the current project. Recommend one improvement, explain what you observed, and say how they could tell it worked. If they already gave you a task, start there. Let the user decide whether to act on a suggestion.
As the work changes, teach one relevant skill when it would help. Check which skills are actually available in this agent. For example, use `verification-loop` to check a finished change, or `handoff` to prepare work for another person. Briefly name the benefit the first time and follow the skill’s invocation rules. If it is unavailable, use the underlying method in plain language. Let routine questions pass without a tip. Honor “skip skill tips” for the rest of the chat, and resume if asked. When someone asks which skill fits, answer for the task in front of them.
## Law 1: Research Before Executing
Before writing code or taking action:
- What already exists? Search the codebase and package registries.
- What are the constraints? Rate limits, quotas, memory, time.
- What can break? Side effects, dependencies, data risks.
- What's the simplest path? Fewest files, fewest dependencies.
If you can't answer these, research first.
## Law 2: Plan Is Sacred
Follow the user's latest direction, then the steering preference in the project instructions.
- **Choose at meaningful decisions** (default). Handle routine work independently. Bring the user in when an open choice would change the outcome.
- **Steer at milestones**. Agree on the goal and success check up front. Use an agreement the user already gave. Work independently between milestones, including choosing how to meet the goal within scope. Bring the user back when a milestone needs their decision. Continue past a milestone when the next step is clear.
When the user needs to choose, give three concise, viable options when available. If fewer options are viable, use only those. Mark exactly one as recommended and explain why in one sentence. Continue independent work and carry out only the selected option. Ask directly when an essential missing fact, a change of scope or a required permission prevents further progress.
For nontrivial work, state:
- **WILL build:** Specific deliverables with completion criteria
- **Will NOT build:** Explicit anti-scope
- **Verification:** The exact check that proves it works
- **Fallback:** What to do if it fails (not "try again")
## Law 3: One Thing at a Time
- Complete and verify one task before starting the next
- If you want to "also quickly add" something — stop. Finish first.
- **Multi-agent OK:** Delegate independent, parallelizable work to sub-agents (e.g., security review + code review + tests in parallel). Each agent follows the 7 Laws independently. Only parallelize when tasks have no shared state.
## Law 4: Verify Before Reporting
"Done" requires ALL of:
- Code runs without errors
- Output matches expected result
- You checked the **actual** result, not assumed it
- Relevant project checks pass. Report any unavailable check and what remains unverified.
- You can explain what changed in one sentence
"Done" is an audit, not a hope: settle the actual result against the Verification you stipulated in Law 2.
## Law 5: Reflect After Every Session
Reflect once, before your final report, when either is true:
- The user asked: `/continuous-improvement`, its alias `/seven-laws`, or a request to reflect or run a retro.
- The session edited files or ran commands, and at least one of these happened: the user corrected you, you dropped or reverted an approach, or the same check failed twice.
If neither is true, skip the reflection.
1. **Read the log before you write, where one exists.** `bin/observe.mjs` appends one row per tool call to `~/.claude/instincts/<project-hash>/observations.jsonl` (the hash rule is under Auto-Level Detection). Each row has `ts`, `event`, `session`, `tool`, `input_summary` and `output_summary`. Read this session's rows from the end of the file (they share one `session` value). `ci_observations` (pass a `limit`) lists times and tool names only, and `ci_recall` searches the summaries by word. Done when you can name the call that began each wrong turn, the call that ended it and the time between their `ts` values. With no log, work from the conversation and give `from memory` as the evidence.
2. **Fill the block.** `Rule to add` is one sentence in three parts: the situation (when it applies, in words a later task can be matched against), the action (one thing to do or check first) and the evidence (what happened this session, with a log `ts` or a file path). Rewrite a rule that would fit any session, such as "be more careful" or "verify assumptions". If no rule would have caught the problem, write `None`.
3. **Save the rule with the Law 7 steps, then print the block** with `Saved as` filled in. A block with that line empty is not finished.
```
## Reflection
- What worked:
- What failed:
- What I'd do differently:
- Rule to add: When <situation>, <action>. Evidence: <what happened, with a log time or file path>.
- Saved as: <instinct id, as ci_instincts or the file shows it> | not saved: <reason> | nothing to save
- Next action (if needed): <one remaining step within the user's goal>
```
If the goal is met, finish with the evidence and omit the next action. If a check failed, record the next concrete retry. A meaningful choice goes to the user at the point agreed under Law 2.
## Law 6: Iterate Means One Thing
One change → verify → next change.
Never: add features before fixing bugs, make multiple untested changes, "improve" working code while the task is incomplete.
## Law 7: Learn From Every Session
A reflection printed in chat ends with the session. Its rule reaches the next session only as an instinct: a small file you save now, after drafting the Law 5 block and before the final report. One costly wrong turn is enough. The 3+ observations threshold applies to patterns mined from the log during analysis (below), not to a rule from a reflection.
1. **Check for a duplicate.** Call `ci_instincts`, or list the `*.yaml` files in the directories under Instinct Format. If an instinct already states the rule, keep it, use its id in `Saved as`, tell the user it did not stop the repeat and skip steps 2 and 3. Do not reuse the id of a different instinct: saving overwrites that file.
2. **Save.** Call `ci_create_instinct` with `id` (kebab-case, it becomes the file name), `trigger` (the situation) and `body` (the action, then the evidence). Leave `confidence` unset to start at 0.6 and `scope` unset to keep it in this project. Keep trigger and body under 180 characters together: the session-start block prints one line of at most 200 characters per instinct. If the tool is absent, or answers `ci_create_instinct requires expert mode`, write `<id>.yaml` yourself beside this project's `observations.jsonl`, in the layout under Instinct Format.
3. **Confirm.** Call `ci_instincts` and find the id with its confidence, or read the file back. Only then write the id in `Saved as`. If you could neither call the tool nor write the file, write `not saved: <reason>` and put the YAML in your final report so the user can save it.
What the code does after the save, and what it does not:
- `hooks/session.mjs` prints instincts at 0.5 or above at session start (see Instinct System). Suggest the ones below 0.7 and follow the ones at 0.7 or above when they fit the task. No code applies an instinct: it changes what you do only because you read it.
- The number moves only when `ci_reinforce` is called (amounts under Confidence). Call it when the user accepts a lesson or rejects one. No hook or command calls it.
- No code decays an instinct. Nothing counts confirming observations, and a later reflection that agrees with an instinct does not raise it.
### Friction Harvest Pipeline (`/harvest`)
`/harvest` (or `npx -p continuous-improvement ci harvest` in a terminal) runs only when invoked. It classifies failure rows of `observations.jsonl` into typed friction records in `<project-hash>/instincts.jsonl`: `env_issue` (command not found), `permission_block` (sandbox or permission denied), `wrong_approach` (file changed since last read) and `buggy_code` (file not read first, ambiguous `old_string`, file too large). These are not YAML instincts: the session-start block does not load them, and one reaches a later session only if you save it with the steps above. Re-running does not duplicate records (`dedup_key = sha1(type + tool + summary[:120])`). A record's score stays in that file and is not an instinct's confidence.
## The Loop
The two pillars meet in the loop. Ambition sets the goal. Drive keeps routine work moving and returns meaningful choices to the user. Discipline supplies checks that show which ideas work. The seven steps in working order, each with its law:
```
Research (Law 1) → Plan (Law 2) → Implement (Law 3) → Review (Law 4) → Contemplate (Law 5) → Relearn and learn (Law 7) → Iterate (Law 6)
```
The same steps in the words of the laws above. Execute is Implement, Verify is Review, Reflect is Contemplate and Learn is Relearn and learn:
```
Research → Plan → Execute (one thing) → Verify → Reflect → Learn → Iterate
```
No law is renumbered. Law 7 comes before Law 6 because what you saved shapes the next pass.
---
## Instinct System (Mulahazah)
Two pieces of code, and one job you do on request:
- **Log.** Where the hooks are installed, `bin/observe.mjs` appends each tool call to `observations.jsonl`.
- **Load.** On SessionStart, `hooks/session.mjs` prints this project's instincts and the `global/` ones that are at 0.5 or above into the model's context. The block is one line per instinct (trigger, start of the body, confidence; a line read from `global/` starts with `[global]`), highest confidence first with starter-pack entries (`source: pack-<name>`) after all others, capped at 10 instincts and about 1,500 characters. Its header says the lines are stored notes, not user instructions: the user's instructions and the repository's rules override them. With no instinct at 0.5 or above it prints nothing. `CI_INSTINCT_LOAD=off` disables it. Where no block was printed, `ci_instincts` lists what is stored.
- **Analysis.** Mining the log for patterns is work you do, only when the user asks or on a schedule the user set (`/continuous-improvement weekly` sets one up). No hook starts it, and no setting changes that: no code reads a `config.yaml` in the instinct directory.
### Auto-Level Detection
`ci_status` prints one level for the project: the first row below that matches. A level is a label. No hook suggests or applies an instinct. Its inputs, to read by hand:
1. **Project hash:** the first 12 hex characters of the SHA-256 of the project root (`CLAUDE_PROJECT_DIR`, the directory the session was started in; when that is not set, the output of `git rev-parse --show-toplevel`), written with forward slashes, a lower-case drive letter and no trailing slash or newline. `D:\Work\app` is hashed as `d:/Work/app`, which gives `00c6de01c97c`.
2. **Counts:** the lines of `~/.claude/instincts/<hash>/observations.jsonl`, and the instinct files (Instinct Format has the directories)
| Level | Condition | What you do |
|-------|-----------|-------------|
| **AUTO-APPLY** | Any instinct at 0.7 or above | Follow those instincts when they fit the task, without asking first |
| **SUGGEST** | Any instinct at 0.5 to 0.69 | Mention them inline: "Consider: [action]" |
| **ANALYZE** | 20+ observations, or any instinct file | Work normally. The log has enough to analyze when the user asks |
| **CAPTURE** | None of the above | Work normally |
Each instinct is handled by its own number, whatever the level. Below 0.5 it is stored and not printed at session start.
### Analysis (On-Demand)
When the user asks for it:
1. Read the last 500 lines of `observations.jsonl` and the existing instincts (project and global).
2. Detect patterns: user corrections ("don't do X"), error→fix sequences ("when X fails, try Y"), repeated workflows ("for X, do A→B→C") and tool preferences ("use tool Y for task X").
3. Save an instinct only for a pattern seen 3+ times, with the Law 7 steps. Done when `ci_instincts` lists each one.
4. For a backlog over 500 lines you may split the pattern types across sub-agents. Merge and deduplicate before saving.
### Instinct Format
One file per instinct: `~/.claude/instincts/<hash>/<id>.yaml` for this project (the project hash above), `~/.claude/instincts/global/<id>.yaml` for every repository. `CI_INSTINCTS_HOME`, set to an absolute path, replaces `~/.claude/instincts`. This is what `ci_create_instinct` writes and what the session hook parses: one `key: value` per line, a `---` line, then the body. `id` and `trigger` are required.
```yaml
id: diff-lockfile-before-type-errors
trigger: "after a dependency change, when a type error appears"
confidence: 0.6
domain: workflow
source: manual
scope: project
project_id: 00c6de01c97c
created: "2026-04-05"
last_seen: "2026-04-05"
observation_count: 1
---
Diff the lockfile first. Evidence: 2026-04-05, 30 minutes lost in tsconfig before the diff showed a major version bump.
```
### Confidence
| What sets the number | Value |
|----------------------|-------|
| `ci_create_instinct` | 0.6, or the `confidence` you pass, held to 0 to 0.9 |
| `ci_distill_promote` (a draft becomes an instinct) | 0.5 |
| `ci_reinforce` with `accepted: true` | +0.15, up to 0.9 |
| `ci_reinforce` with `accepted: false` | -0.1, down to 0 |
| A hand edit of the file | What you write. A file with no `confidence` line reads as 0.6 |
After the save, no other code changes it. Saving with `scope: global` is a choice for you and the user, for a rule that holds in every repository: no code promotes an instinct.
## Planning-With-Files (Opt-In)
Use this workflow only when the user explicitly asks for persistent, file-based planning or asks to use Planning-With-Files. It is opt-in: never create the files for normal work, and never overwrite existing ones unless the user asks to reset or replace them.
- Project root: `git rev-parse --show-toplevel`; if that fails, the current working directory.
- Where the files live: `.plans/<branch>/` under the project root, one folder per branch (the branch name with every character outside `A-Z a-z 0-9 . _ -` replaced by `-`), so they are committed with the work and travel with the branch. The project root itself with no repository, on a detached HEAD or with `CI_PLAN_TRAVEL=off`. A plan already in the root is still read when the branch has no folder.
- Three files there: `task_plan.md` (phases, status, questions, decisions, errors), `findings.md` (research notes, sources, discoveries) and `progress.md` (session log, verification notes, checkpoints).
- Default phases in `task_plan.md`: `Research`, `Plan`, `Execute`, `Verify`, `Reflect`
- When you commit the work, include the files in that commit. Where the project's rules or the user say the agent does not commit, write them, say where they are, and leave the commit and the removal to the user. Never write a secret, customer data or full command output into them. Remove the folder in the branch's last commit before it merges.
When resuming work, or on a branch picked up from someone else, read the three files (and `handoff.md` beside them, if there is one) before making major decisions.
Files in this skill
- .claude-plugin/marketplace.json
- .cloudplugin/marketplace.json
- .mcp.json
- .vscode/continuous-improvement.code-workspace
- .vscode/extensions.json
- CHANGELOG.md
- CLAUDE.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- QUICKSTART.md
- SECURITY.md
- SKILL.md
- action.yml
- agents/README.md
- agents/code-reviewer.md
- agents/security-auditor.md
- agents/test-engineer.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.