Back to animation Get started

Aim high. Stay in control.

Ambition & discipline
Read the guideClose guide
16 coding agents REV 3.31.0

Get started

Give your agent a goal. It can try an improvement, check whether it worked and tell you what changed.

Enter your goal or use the example. Copy the task into the agent you already use.

Read the task
Help a new contributor run this project. Look at how things work today and make the smallest useful improvement toward this goal. Use the closest existing check, or try one local example. If your change causes a failure, fix it and retry it once. Tell me what you changed and what you observed. When an available skill would help with a new stage, briefly show me how it helps. Skip skill tips if I ask.

Use this for every task

Run this once in your project folder. Setup recommends a first step and saves the workflow. Open your agent and ask “Where should I start?” to get one improvement based on your project, or give it a task of your own.

As the work changes, the agent can point out a useful skill. Ask “Which skill would help here?” or say “Skip skill tips” to pause suggestions for this chat. See skills by task.

npx continuous-improvement start
Optional checks for shell commands and file edits

Open a terminal in your project folder and run node --version. You need version 18 or newer. If the command is missing or older, install Node.js LTS and reopen the terminal.

npx continuous-improvement install --target codex --hooks

Run this in your project’s terminal. Follow the steps it prints, then start a new agent session. For Codex CLI, trust the project and each hook in /hooks. All install commands.

Check the installation. Ask the agent to run git rev-parse @{u} exactly as written. A working guard gives a reason starting with Unquoted git ref @{u}. A Git or shell message means the guard still needs checking.

/plugin marketplace add naimkatiman/continuous-improvement/plugin install continuous-improvement@continuous-improvement

Enter the two commands one at a time inside Claude Code. Restart it, then enter /verify-install. Look for the final “wired” result.

  • Ambition. You have big goals.The be-ambitious skill tells the agent to work on the goal behind the task, with a target and a check set before it starts. It is guidance the agent reads. No hook checks that it was followed. What it tells the agent
  • Discipline. You control the AI.With the hooks installed, hooks/gateguard.mjs refuses destructive commands and blind edits (an edit of an existing file the session has not read) before they run. bin/observe.mjs logs each tool call that runs, on your machine. Stricter gates are switches you set. What you control

Pillar two. You control the AI.

The AI does not control you. That is the goal. Here is what you control today, in four parts.

  • Refusedhooks/gateguard.mjs denies destructive commands and blind edits before they run when the guard hooks are installed and trusted.
  • Loggedbin/observe.mjs writes one redacted row per tool call that runs, on your own disk.
  • SwitchesStricter gates wait for a variable you set: pushes to main, guardrail config, a failing typecheck. Every switch
  • Where it runsOn your machine, as Node processes. The built-in rules make no model or network calls. Each agent has its own condition: the agent table.

Replay a call captured from hooks/gateguard.mjs

One force push, refused in each agent's own format.

hooks/gateguard.mjs

git push --force origin main, sent by six agents to one hook file. Each agent's PreToolUse payload from fixtures/agent-matrix on stdin, one temp HOME.

The command in each agent's tool call

$ git push --force origin main
  • Denied: how each agent got it
  • Claude Code "permissionDecision":"deny"
  • Codex CLI "permissionDecision":"deny"
  • Gemini CLI "decision":"deny"
  • Cursor "permission":"deny"
  • GitHub Copilot CLI "permissionDecision":"deny"
  • Kiro CLI exit 2, reason on stderr
  • Allowed
  • git status all 6: exit 0, no output

Every reason names the rule that matched: Matched rule: git-push-force

Each agent's payload and reply, as captured

Claude Code

payload  {"session_id":"claude-session","transcript_path":"~/transcript.jsonl","cwd":"~/project","permission_mode":"default","hook_event_name":"PreToolUse","tool_name":"Bash","tool_use_id":"toolu_1","tool_input":{"command":"git push --force origin main"}}

$ node hooks/gateguard.mjs
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Destructive command requested: git push --force origin main\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: git-push-force\nDestructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal."}}
(stderr empty, exit 0)

Codex CLI

payload  {"session_id":"codex-session","transcript_path":null,"cwd":"~/project","hook_event_name":"PreToolUse","model":"gpt-5.5","permission_mode":"default","turn_id":"turn-1","tool_name":"Bash","tool_use_id":"call_1","tool_input":{"command":"git push --force origin main"}}

$ node hooks/gateguard.mjs --agent codex
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Destructive command requested: git push --force origin main\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: git-push-force\nDestructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal."}}
(stderr empty, exit 0)

Gemini CLI

payload  {"session_id":"gemini-session","transcript_path":"~/gemini-session.json","cwd":"~/project","hook_event_name":"BeforeTool","timestamp":"2026-11-21T11:08:00.000Z","tool_name":"run_shell_command","tool_input":{"command":"git push --force origin main","description":"run","dir_path":"."}}

$ node hooks/gateguard.mjs --agent gemini
{"decision":"deny","reason":"Destructive command requested: git push --force origin main\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: git-push-force\nDestructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal."}
(stderr empty, exit 0)

Cursor

payload  {"conversation_id":"cursor-conv","generation_id":"gen-1","model":"claude-opus-4-7-thinking-max","hook_event_name":"preToolUse","cursor_version":"3.20.17","workspace_roots":["~/project"],"user_email":"[email protected]","transcript_path":"~/cursor-transcript.jsonl","tool_name":"Shell","tool_input":{"command":"git push --force origin main","cwd":"~/project"},"tool_use_id":"abc123","cwd":"~/project","agent_message":"Running a command"}

$ node hooks/gateguard.mjs --agent cursor
{"permission":"deny","user_message":"Destructive command requested: git push --force origin main\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: git-push-force\nDestructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal.","agent_message":"Destructive command requested: git push --force origin main\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: git-push-force\nDestructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal."}
(stderr empty, exit 0)

GitHub Copilot CLI

payload  {"sessionId":"copilot-session","timestamp":1763712000000,"cwd":"~/project","toolName":"bash","toolArgs":"{\"command\":\"git push --force origin main\"}"}

$ node hooks/gateguard.mjs --agent copilot
{"permissionDecision":"deny","permissionDecisionReason":"Destructive command requested: git push --force origin main\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: git-push-force\nDestructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal."}
(stderr empty, exit 0)

Kiro CLI

payload  {"hook_event_name":"PreToolUse","cwd":"~/project","session_id":"kiro-session","tool_name":"execute_bash","tool_input":{"command":"git push --force origin main"}}

$ node hooks/gateguard.mjs --agent kiro
(stdout empty)
stderr: Destructive command requested: git push --force origin main

  1. List ALL files/data this command will modify or delete
  2. Write a one-line rollback procedure
  3. Quote the user's current instruction verbatim

Matched rule: git-push-force
Destructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal.
(exit 2)

It is not a sandbox. The guard checks supported tool calls. Your operating system controls what a running program can access. See what it cannot do. One command per agent turns the hooks off: turn it off.

Claude Code ships the hooks. Not the rules.

A line-by-line comparison with one agent's built-in hooks. On Claude Code this installs as a plugin: the rule content, tested, plus a log. Where Claude Code already does the job, it says so.

  • Auto mode classifiera deny that holds in every mode
  • Deny rules and hooks13 scripts to fill them
  • Auto memorylessons at session start, not enforced
  • Transcriptsa searchable, redacted log
  • /goal and /verifyyour typecheck at turn end
  • Subagents, worktreesgit state as an exit code
  • Read before edittwo overlapping checks
  • Plan mode, /rewindnothing added
Compare line by line, with the Claude Code docs
CapabilityClaude Code, by itselfThis plugin adds
Auto mode classifier Blocks force pushes, git reset --hard, git checkout -- ., git restore ., git clean -fd, git stash drop, deploys and migrations by default. It allows “pushing to any branch of the repository you're working in, including the default branch”. Docs: permission modes A hook deny for the same class of commands that holds in every mode, bypass included (Exhibit A). An opt-in refusal of pushes to main, master and release/* (Exhibit B).
Deny rules and hooks “Deny rules block in every mode, including bypassPermissions”, and so does a hook deny. Both are empty until you write the rule or the script. Docs: permission modes, hooks The scripts: 13 of them on 14 hook registrations, each listed in Hooks with its default and its switch.
Auto memory and CLAUDE.md On by default in local sessions. The first 200 lines or 25KB of MEMORY.md load in every conversation and your corrections are saved. The docs call this “context, not enforced configuration”. Docs: memory Nothing that enforces. A second, smaller note channel: up to 10 lessons you recorded, printed at session start (Exhibit F).
Transcripts, resume, fork Every session is kept in full and can be resumed or forked. No search command over past tool calls is documented. Docs: how Claude Code works A local log with one redacted row per tool call (Exhibit D), and a ranked search over it (Exhibit E).
/goal and /verify /goal runs a fresh-model completion check after every turn. /verify observes the running app. Neither runs your typecheck, tests and lint as a pass or fail. Docs: goal, commands An optional turn-end check runs your project command. The TypeScript mode can return compiler output (Exhibit C).
Plan mode, checkpoints, /rewind Plan mode blocks edits until you approve the plan. Checkpoints undo file edits, within a session and across resumed ones. Docs: permission modes, how Claude Code works Nothing. Use them.
Subagents, worktrees, /code-review Per-agent tool and permission scoping, isolated worktrees with cleanup, a local bug-focused review and a multi-agent cloud review. Docs: subagents, worktrees, review Nothing that enforces. One command, ci-reconcile, reports git state with an exit code, for sessions that share a checkout (Exhibit G).
Read before edit, writes outside the project The Edit tool checks that a file was read first. The setting permissions.blockWritesOutsideWorkingDirectories (v2.1.314 and later) makes the file tools refuse paths outside the working directories. Docs: tools reference, permission modes Two overlapping hook checks: a deny on a blind edit of an existing file (on by default) and a wrong-repository write lock (off by default). If the native checks serve you, these add little.

14 hooks. Four are on.

Counted on Claude Code, where the plugin registers all 14. Other rules warn on stderr by default or wait for a switch. Set CI_HOOK_WARNINGS=visible to keep a warning summary. Pick a pylon.

  • denies by default
  • on, never denies
  • warns on stderr by default
  • off until switched

What it does, its default and switch

Every registration, its default, switch and cost

These are the Claude Code plugin's registrations. --hooks wires the same scripts for another agent, on the events that agent has.

14 hook registrations, 13 scripts. On by default: the destructive-command deny, the blind-edit check, the local log, and the lesson load, which is silent when there are no lessons. Three rules warn by default. Opt in to visible warnings to keep a project summary. Seven checks wait for a switch: six registrations and the wrong-repository lock in row 01. A shell call means the Bash, PowerShell or Monitor tool. Row numbers follow the order in hooks.json.

HookWhat it doesDefaultSwitchCost
01PreToolUse hooks/gateguard.mjs Four rules in one script. (a) Denies destructive shell commands. (b) Denies an unquoted git @{u} ref and prints the quoted command to run. (c) Denies an Edit or Write of an existing file unless this session's log shows a read of it, or a shell or search call whose command or output names the file. Direct literal shell redirections also pass through the file policy. (d) Wrong-repository write lock. (a) (b) (c) deny (d) off (a) and (b): none. (c): CI_GATEGUARD_FILE_GATE=off, read for a recognized same-session read receipt, or strict for a fact list on every first edit. (d): CI_GATEGUARD_TARGET_LOCK=block. CI_GATEGUARD_EXCLUDE skips (c) and (d) for matching path fragments. 1 process per edit or shell call. A deny reason to the model: about 300 characters for (a), two lines for (c).
02PreToolUse hooks/companion-preference.mjs Acts only when a Skill call names tdd-workflow, verification-loop, context-budget or ralph bare or with a ci: prefix: logs one row and allows the call. A plugin-namespaced name is not matched. logs, allows Not an environment variable: the key continuous_improvement.companion_preference in ~/.claude/settings.json. The value strict-companions denies. 1 process per Skill call. Writes companion-preference.jsonl.
03PreToolUse hooks/hook-pack.mjs Flags git push to main, master or release/*, and commits over 15 files, including tracked changes staged by --all (Exhibit B). warn only CI_HOOKPACK_GATE=block, warn or off. 1 process per shell call, plus git on push and commit commands.
04PreToolUse hooks/config-guard.mjs Flags a call that would change a file that wires the guardrails (.claude/settings.json, .mcp.json, hooks.json, the hooks and plugin directories) or run a mutating claude plugin, claude mcp or claude config command. warn only CI_CONFIG_GUARD=block, warn or off. CI_CONFIG_GUARD_ALLOW=true lets one call through. 1 process per edit or shell call.
05PostToolUse bin/observe.mjs Appends a local observation for each post-tool event. The default row uses redacted summaries (Exhibit D). on, logs CI_OBSERVATION_DETAIL=paths omits command bodies and tool output. 1 process per tool call. Writes observations.jsonl, rotated at 10,000 rows, and project.json.
06UserPromptSubmit hooks/route-prompt.mjs Matches requests such as testing a fix, reviewing a change or handing off work. Suggests one bundled skill to use where available. off CI_ROUTE_PROMPT=1 turns it on. CI_ROUTE_PROMPT_DISABLE=1 forces it off. 1 process per prompt. On: a short reminder on a match. Writes route-prompt.jsonl, one row per prompt with no prompt text.
07UserPromptSubmit hooks/recall-briefing.mjs Once per session, on the first prompt of 12 or more characters that matches the log, injects the top 3 search hits. off CI_RECALL_BRIEFING=1. 1 process per prompt. On: one reminder per session (533 characters in our capture).
08SessionStart hooks/session.mjs Gives supported hosts guidance for choosing skills in new project chats. The first chat also gets an introduction. Loads recorded lessons at confidence 0.5 or higher (Exhibit F). on, with guidance where supported CI_INSTINCT_LOAD=off. 1 process per session start, resume, /clear and compaction. At most 10 lessons and 1,500 characters.
09SessionEnd hooks/session.mjs Prints one reminder line to stderr. stderr only None. 1 process per session end.
10Stop hooks/three-section-close.mjs Sends back any reply of 600 or more characters that lacks three fixed headings. It checks headings, not evidence: a house style. It reads the reply from a Claude Code transcript, so it works on Claude Code only. off CI_THREE_SECTION_CLOSE=1 turns it on. CI_THREE_SECTION_CLOSE_DISABLED=1 forces it off. 1 process per turn end. On: a 359-character block reason and a rewritten reply. Writes one row per turn end with a reply to ~/.claude/hook-telemetry/.
11Stop hooks/goal-drift-stop.mjs Scores the last 30 logged tool calls for the repository against keywords from ## Goal in task_plan.md. Without a goal file it warns of nothing and only records no-goal in its state file. In block mode it uses a supported host’s final reply or transcript. Claude Code has a recorded host run. Six other adapters have fixture coverage. warn only CI_GOAL_DRIFT_GATE=block, warn or off. 1 process per turn end. Rewrites goal-drift-state.json at every turn end unless off.
12Stop hooks/workflow-distill.mjs After a Workflow run followed by a passing verify, suggests the ci_distill_from_workflow tool. The suggestion goes to stderr even when on. off CI_WORKFLOW_DISTILL_NUDGE=on. 1 process per turn end.
13Stop hooks/typecheck-stop.mjs Runs the command in CI_PROJECT_CHECK on a changed Git project, or the TypeScript check when enabled (Exhibit C). off CI_PROJECT_CHECK sets a trusted command. CI_TYPECHECK_GATE enables the TypeScript check when no project command is set. 1 process per turn end. When enabled, the check has a 25-second budget.
14Stop hooks/query-cost-nudge.mjs When .sql, .prisma, migrations/, db/, schema.* or drizzle paths changed, adds a query-cost reminder once per session. off CI_QUERY_COST_NUDGE=on. 1 process per turn end. On: one reminder per session and a marker file.

How the switches read.

Every switch but one is an environment variable, set in the shell your agent starts from or, on Claude Code, in a settings file's env block. Where a CI_* switch has an older CLAUDE_* name, such as CLAUDE_TYPECHECK_GATE or CLAUDE_CI_HOOKPACK_GATE, either name works. When both are set, the older name wins. The captures on this page use the older names. Use the spelling shown for each switch. CI_THREE_SECTION_CLOSE_DISABLED accepts exactly 1.

Also in the bundle, not hooks.

  • An MCP server, registered by the plugin and local to your machine: 19 tools for search, lessons, goal checks and planning files.
  • 22 skills, 26 commands, 3 agents. Prose the model reads on request. Only the hooks, the MCP server and the command-line tools execute.
  • ci-reconcile: git ground truth as a command with an exit code (Exhibit G).
  • A GitHub Action, naimkatiman/continuous-improvement@v3: lints an agent transcript in CI and outputs a score from 0 to 100.

Seven real runs.

Captured output, not mock-ups, each tagged with its step of the loop. Fake credentials, a scratch repository named acme-api.

One refusal in full.

Step 3, Implement · PreToolUse · hooks/gateguard.mjs

What the model received, 298 characters, for rm -rf build/ dist/

Destructive command requested: rm -rf build/ dist/

  1. List ALL files/data this command will modify or delete
  2. Write a one-line rollback procedure
  3. Quote the user's current instruction verbatim

Matched rule: rm-recursive-force
Destructive Bash gates EVERY call — clearance is not cached.
Raw output, fourteen more commands, default, switch and cost

Captured on 2026-11-20 and 2026-11-21 (UTC) on Windows 11 with Node v24.12.0, with a scratch home directory, a scratch repository named acme-api and fake credentials. Each $ line is the equivalent shell command, with paths relative to the plugin bundle. The lines under it are the output as printed. Notes such as (stderr empty, exit 0) are the capture's own. In a session the denied command does not run, and the model has no way to clear the deny. If you mean the command, you run it yourself.

payload  {"hook_event_name":"PreToolUse","session_id":"docs-capture","tool_name":"Bash","tool_input":{"command":"rm -rf build/ dist/"}}

$ HOME=home USERPROFILE=home CLAUDE_PROJECT_DIR=acme-api node hooks/gateguard.mjs < payload.json
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Destructive command requested: rm -rf build/ dist/\n\n  1. List ALL files/data this command will modify or delete\n  2. Write a one-line rollback procedure\n  3. Quote the user's current instruction verbatim\n\nMatched rule: rm-recursive-force\nDestructive Bash gates EVERY call — clearance is not cached."}}
(stderr empty, exit 0)

Historical output from the v3.29.0 capture. The last two cases led to changes in the current guard.

  • Denied
  • git push -f origin feature/x deny git-push-force
  • git push --force-with-lease origin feature/x deny git-push-force
  • git reset --hard HEAD~1 deny git-reset-hard
  • git -C ../other clean -fdx deny git-clean-force
  • git stash drop deny git-stash-drop
  • git branch -D old-feature deny git-branch-force-delete
  • find . -name '*.log' -delete deny find-delete
  • psql -c "DROP TABLE orders" deny substring:drop table
  • Remove-Item .\build -Recurse -Force deny powershell-remove-item
  • Allowed
  • rm -f notes.txt allow
  • git commit -m "remove the rm -rf call from cleanup" allow
  • Remove-Item .\notes.txt -Force allow
  • Original reports from v3.29.0
  • cat > notes.md <<'EOF', then a body line that mentions git reset --hard deny substring:git reset --hard In this original capture the fallback list read the literal body as a command.
  • echo "export const TAX = 0.2;" > src/price.ts allow The v3.29.0 guard did not apply the file policy to this output path.
Claude Code
In auto mode the classifier blocks force pushes, git reset --hard and git clean -fd. Deny rules and hook denies hold in every mode, bypassPermissions included, but Claude Code ships no rule content for either.
This adds
The rule content, as a hook deny: recursive deletes, discarding git commands, forced pushes, find -delete, SQL drops, PowerShell and cmd deletes, read through bash -c, pwsh -c and git -C. The reason names the rule.
Default
On, every call. Nothing is cached and the model cannot clear it.
Switch
None. To stop it, turn the hooks off.
Cost
One Node process per shell or edit call. About 300 characters to the model on a deny.

A push to main, refused.

Step 3, Implement · PreToolUse · hooks/hook-pack.mjs

Off until you set one variable. By default the same call only writes a stderr line, which the model never sees.

Tool call: Bash, git push origin main. Switch set

$ HOME=home USERPROFILE=home CLAUDE_PROJECT_DIR=acme-api CLAUDE_CI_HOOKPACK_GATE=block node hooks/hook-pack.mjs < payload.json
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Direct push to protected branch \"main\" — open a feature branch + PR instead."}}
(stderr empty, exit 0)
Same call with default settings, then default, switch and cost
$ HOME=home USERPROFILE=home CLAUDE_PROJECT_DIR=acme-api node hooks/hook-pack.mjs < payload.json
(stdout empty)
stderr: [hook-pack] Direct push to protected branch "main" — open a feature branch + PR instead.
(exit 0)

The config guard also defaults to warn: CI_CONFIG_GUARD=block refuses a change to the files that wire the guardrails (settings, MCP config, hooks and installed plugins). The wrong-repository lock defaults to off: CI_GATEGUARD_TARGET_LOCK=block refuses supported file writes and shell redirections with a recognized target outside the project.

Claude Code
The auto mode classifier allows a push to any branch of the repository you are working in, the default branch included.
This adds
A refusal of git push to main, master or release/*, and of commits over 15 files, including tracked changes an all-files commit would stage.
Default
Warn writes to stderr by default. With CI_HOOK_WARNINGS=visible, run ci warnings for the project summary.
Switch
CI_HOOKPACK_GATE=block
Cost
One Node process per shell call, plus git on push and commit commands.

A turn that could not end.

Step 4, Review · Stop · hooks/typecheck-stop.mjs

One changed file assigns a string to a number. The hook ran the typecheck and handed the compiler's line back to the model.

$ HOME=home USERPROFILE=home CLAUDE_PROJECT_DIR=acme-api CLAUDE_TYPECHECK_GATE=block node hooks/typecheck-stop.mjs < payload.json
{"decision":"block","reason":"Typecheck FAILED on changed TS files — fix before ending the turn:\nsrc/price.ts(2,9): error TS2322: Type 'string' is not assignable to type 'number'."}
stderr: (node:54464) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
(exit 0, 1785 ms)
Notes, default, switch and cost

The stderr lines are a Node 24 warning about how the hook starts npm. With the switch unset, the same fixture printed nothing and exited 0. This TypeScript mode needs tsconfig.json at the project root, and blocks again at every turn end until the error is fixed.

Claude Code
/goal judges the transcript with a fresh model after each turn. It runs no commands.
This adds
At turn end, if the working tree has an uncommitted TypeScript change, it runs your typecheck script (or the project's own tsc --noEmit) and returns the last 15 lines of output as the reason the turn cannot end.
Default
Off.
Switch
CI_TYPECHECK_GATE=block
Cost
Off: one Node process per turn end that exits at once. On: your typecheck's run time, capped at 25 seconds.

A token that never reached the log.

Step 6, Relearn and learn · PostToolUse · bin/observe.mjs

And, in the same run, a password that did. Every credential here is fake.

The command in the tool call

curl -s -H "Authorization: Bearer sk-FAKE0000000000000000000000DOCS" https://api.example.com/v1/orders && API_TOKEN=FAKEtoken1234567890 npm run deploy
The row written to the log, the miss, default, switch and cost
$ HOME=home USERPROFILE=home CLAUDE_PROJECT_DIR=acme-api node bin/observe.mjs < payload.json
(stdout empty, stderr empty, exit 0)
$ tail -1 home/.claude/instincts/67c11d834ccf/observations.jsonl
{"ts":"2026-11-20T16:03:10Z","event":"tool_complete","session":"docs-capture","tool":"Bash","input_summary":"curl -s -H \"Authorization: Bearer <redacted>\" https://api.example.com/v1/orders && API_TOKEN=<redacted> npm run deploy","output_summary":"{\"stdout\":\"{\\\"ok\\\":true,\\\"password\\\":\\\"<redacted>\\\"}\\ndeployed build 4f1c\",\"stderr\":\"\",\"interrupted\":false}","project_id":"67c11d834ccf","project_name":"acme-api"}

Same run, a shape the patterns do not know. One field of the stored row

"input_summary":"mysql -u admin -pFAKEpass99 -h db.example.com orders -e \"select 1\""
Claude Code
Keeps full transcripts, and auto memory keeps notes. Neither is a per-repository log of tool calls.
This adds
One row per tool call in a local file: time, tool, the first 500 characters of input and 200 of output, with known secret shapes redacted before the row is written.
Default
On.
Switch
None in the source. To stop it, turn the hooks off.
Cost
One Node process per tool call. One file per repository, rotated at 10,000 rows.

A search over the log.

Step 1, Research · MCP tool · bin/mcp-server.mjs

The ci_recall tool, called over stdio as an agent calls it, on a seeded log.

> {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"ci_recall","arguments":{"query":"typecheck error price","k":3}}}
## Recall: "typecheck error price"

3 match(es), most relevant first:

- [2026-11-20T16:02:38Z] **Bash** (score 3.47)
  Bash  npm run typecheck  {"stdout":"src/price.ts(2,9): error TS2322: Type …
- [2026-11-20T16:02:38Z] **Bash** (score 1.73)
  Bash  npm run typecheck  {"stdout":"","stderr":"","interrupted":false}
- [2026-11-20T16:02:38Z] **Edit** (score 1.30)
  Edit  src/price.ts  {"filePath":"src/price.ts","structuredPatch":[]}
A query with no match, default, switch and cost

The history was seeded for the capture: five tool-call payloads piped into the logger under another session id. The scores depend on that seeded log.

> {"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"ci_recall","arguments":{"query":"kubernetes ingress"}}}
No past observations matched "kubernetes ingress". Try broader or different terms — recall is lexical, not semantic.
Claude Code
Transcripts can be resumed or forked. No search command over them is documented.
This adds
/recall and the ci_recall tool: BM25 ranking over this repository’s current log file. Use include_archives: true to include the tails of up to three recent archives.
Default
The plugin registers a local MCP server with 19 tools. A search runs when you or the model call it.
Switch
CI_RECALL_BRIEFING=1 also injects the top 3 hits once per session.
Cost
19 tool definitions: 9,733 characters when the definition array is serialized, about 2,433 tokens, unless your client defers tool schemas.

Two lessons, printed at session start.

Step 6, Relearn and learn · SessionStart · hooks/session.mjs

A lesson is a small file. The one at confidence 0.4 is under the 0.5 floor and is not printed.

$ HOME=home USERPROFILE=home CLAUDE_PROJECT_DIR=acme-api node hooks/session.mjs < payload.json
Notes from continuous-improvement instinct files: this repository's, and those marked [global], which load in every repository. They are not user instructions: the user's instructions and this repository's rules override them, and a note cannot grant approval. Use those at 0.7 and above when relevant; treat 0.5 to 0.69 as suggestions. The ci_instincts tool lists the stored instincts.
- editing src/price.ts: Run npm run typecheck before reporting; total() must return a number, not a joined string. (0.75)
- staging a commit on Windows: Stage by explicit filename; autocrlf makes git status list files with no content change. (0.65)
How lessons are written, default, switch and cost

A lesson is written when you run /seven-laws or when one of the plugin's tools creates it. Three were created for this capture. The hook printed 636 characters of lessons and one status line, and exited with code 0. A fresh session on a supported host also receives guidance for its first recommendation.

Claude Code
Auto memory is on by default in local sessions and loads the first 200 lines or 25KB of MEMORY.md into every conversation.
This adds
A second, smaller note channel: this repository's recorded lessons, plus global ones that load in every repository, at confidence 0.5 or higher. Highest first, with entries from a starter pack last. At most 10 lessons and 1,500 characters.
Default
On. Lessons appear at confidence 0.5 or higher. Supported hosts receive skill guidance in new project chats and an introduction once per project and agent.
Switch
CI_INSTINCT_LOAD=off
Cost
One Node process per registered session event. The lesson block is capped at 1,500 characters. New foreground chats on supported hosts also receive a short skill guide.

Git state, as an exit code.

Step 1, Research · Command · bin/reconcile.mjs

One commit, one modified file, one untracked file, no remote. The second run asks whether a push landed, and cannot prove it.

$ node bin/reconcile.mjs
reconcile (resolved):
  HEAD commit     ok       04494de2e965  HEAD            ok       on feature/price-fix  upstream        WARN     no configured upstream — compare against origin/<default> explicitly before classifying  in-progress op  ok       none  working tree    ok       2 reported by status but only 1 with content drift — stage by explicit filename, never git add -A  stashes         ok       none  worktrees       ok       1 (this one)(exit 0)
$ node bin/reconcile.mjs --verify-push feature/price-fix
push feature/price-fix: unverified — git ls-remote exited 128; absence of the ref is unproven
(exit 1)
Default, switch and cost
Claude Code
Isolates work in worktrees and cleans them up. Ownership between sessions started separately in one checkout is not covered.
This adds
ci-reconcile: branch, upstream, in-progress operation, working tree, stashes and worktrees in one report. Exit 0 clear, 1 blocker, 2 not a repository.
Default
On demand. It is a command, not a hook.
Switch
None. The /reconcile command has the model run the copy in the plugin bundle. From a terminal, run npx -p continuous-improvement ci-reconcile.
Cost
One process when you run it. Every probe is a git call with no shell, and only --verify-push contacts the remote.

It costs Node processes, not tokens.

The built-in checks make no model or network calls and have zero runtime dependencies. A project command you configure uses its own dependencies and permissions. Each block is one Node process, counted on Claude Code. On another agent, each hook its install wired is one Node process per call.

  • 1Session start, and session end
  • 2Each prompt (both exit at once when off)
  • 1Read, Grep, Glob, any MCP tool
  • 2Skill
  • 3Edit, Write
  • 4Bash, PowerShell, Monitor
  • 5Each turn end (all exit at once when off)
0model calls
1,500character limit for saved lessons
Context added by default, itemised
  • Session start: new project chats on supported hosts receive brief skill guidance even before a lesson is saved. The first eligible chat also gets the welcome. Saved lessons use up to 1,500 additional characters (Exhibit F).
  • Skill and command listing: 33 names with descriptions. claude plugin details projected the always-on cost at about 4,500 tokens on Claude Code v2.1.325 for an earlier set of 41 names (before be-ambitious was added and token-budget-advisor, strategic-compact, state-reconciliation, recovery-classification, worktree-safety, workspace-surface-audit and ralph were retired, the last two with their commands, and before the /swarm and /learn-eval commands were retired), MCP tools not counted, and counts agents/README.md as a fourth agent.
  • MCP tool definitions: 19 tools, 9,733 characters (about 2,433 tokens), unless your client defers tool schemas.
  • Agent listing: 3 agents, 574 characters.
  • A denied call: the deny reason. About 300 characters for a destructive command, two lines for a blind edit.
  • Everything else: nothing until you switch it on.

The counts are Claude Code's, where the plugin registers all 14. One start per matching registration. A call denied before it runs starts one fewer, because there is nothing to log. The Skill and Monitor rows are derived from the hook matchers, not observed. No millisecond figure is given: none was measured. Each start costs your machine's Node startup time plus the hook's own work. Token figures are characters divided by four. No tokenizer was run.

The plugin keeps its logs on your machine.

The built-in hooks, logger and MCP server run locally. By default the observation log lives under ~/.claude/instincts/. A project command you enable can use its own network access.

When you request remote verification, ci-reconcile --verify-push asks your git remote for the branch tip.

Files the plugin can write

What they write stays on your machine: under ~/.claude/instincts/ and ~/.claude/hook-telemetry/, plus the planning files in the branch plan directory or project root when you ask for them.

PathHoldsWritten
…/observations.jsonlThe tool-call log. One row per call: time, tool, the first 500 characters of input and 200 of output, redacted by pattern. Rotated at 10,000 rows, and the 10 newest archives are kept.After every tool call that completes
…/project.jsonThe directory name and the project root path.With the log
…/<id>.yaml
~/.claude/instincts/global/<id>.yaml
A lesson: trigger, confidence, dates, body. The global directory holds lessons for every repository. Drafts from the distill tools go to …/drafts/.When a lesson is recorded
…/companion-preference.jsonlOne row per matching Skill call.On a Skill call for one of four skills
…/goal-drift-state.jsonThe last drift status, score and action.At every turn end, unless the drift gate is off
…/first-reply-<agent>.seen
…/latest-attempt.json
…/warnings/
The welcome marker, latest measured attempt and warning timestamps.On the first eligible session, when recording an attempt, or when visible warnings are enabled
…/sessions/<session-id>/gateguard-session.jsonFiles cleared through the file gate, with times, including files the log showed were read.When the file gate records a clearance
…/route-prompt.jsonl
…/recall-briefing-session.json
…/workflow-distill-state.json
…/query-cost-nudge/
State for four hooks that are off by default. route-prompt.jsonl holds one row per prompt, with no prompt text.By those hooks
~/.claude/hook-telemetry/<hash>.jsonlOne row per turn end with a reply: time, action (skipped, passed or blocked), reply length, missing headings and run time. No reply text.By the three-section close hook, which is off by default
task_plan.md
findings.md
progress.md
Planning files, in .plans/<branch>/ for the current branch, or in the project root with no branch or with CI_PLAN_TRAVEL=off. /handoff --repo writes handoff.md beside them. Project setup can also write agent instructions and hook configuration.When you run a planning or handoff command

… stands for ~/.claude/instincts/<project-hash>/, one directory per repository. The hash is the first 12 hex characters of the SHA-256 of the project root path.

Set CI_OBSERVATION_DETAIL=paths to omit command text and tool output from new observation rows. The default log stores redacted command summaries. A secret in an unknown shape is not, so review the log before sharing it. Uninstalling the plugin leaves both directories in place. The separate npm installer makes one throttled read of registry.npmjs.org to check for a newer version, and CI_UPDATE_CHECK=off skips it.

What the checks cover

What changed for each of the original 22 reports, and where the agent or operating system still decides.

  • Shell output can change a file.

    Direct output to a literal path goes through the file policy. Turn on CI_GATEGUARD_TARGET_LOCK=block to protect the project boundary. Programs can still open files themselves.

  • Writing an example into a note.

    A standalone quoted Bash heredoc sent through cat to a supported note is treated as text. Script input and complex commands still receive conservative checks.

Review all 22 reports
  • It is not a sandbox.

    For read-only work in Codex CLI, start it with codex --sandbox read-only. For other agents, choose their own filesystem and network permissions before granting access. The plugin checks only the calls a host sends it.

  • be-ambitious is guidance.

    Set an observable target before the work. Use ci_reflect to record the check and what happened. You decide whether the result meets the goal.

  • Contemplate and Iterate have no hook.

    Use ci_reflect to save a measured attempt. A retry requires a next attempt. The latest record is available in the next reflection.

  • Goal drift depends on the agent’s turn-end event.

    Claude Code has a recorded host run. Tests also exercise turn-end payloads from Codex, Devin, Gemini, Goose, Grok and Qwen. Actual delivery depends on the host and its setup.

  • Run your project’s own check.

    Set CI_PROJECT_CHECK to a trusted command such as npm test before starting your agent. On a supported turn-end hook, a dirty Git project gets up to 25 seconds. A failure or timeout asks for another turn.

  • What happens when a hook fails?

    Set CI_HOOK_FAILURE=block for recognized pre-tool errors. A process that never starts or that the host kills cannot send a refusal. The host’s own failure policy then applies.

  • Keep command and result text out of the log.

    Set CI_OBSERVATION_DETAIL=paths before starting your agent. New rows keep event metadata and recognized file paths. Existing rows stay on disk. The default richer log uses pattern-based redaction.

  • See a warning later.

    Set CI_HOOK_WARNINGS=visible to record the latest warning per source. Run npx -p continuous-improvement ci warnings in the project. Claude Code can also display a native notice.

  • Recover from a refused command.

    The refusal explains what matched. Ask the agent for a safer change. If you intend the original action, review it and use your own terminal. A retry cannot grant itself permission.

  • Install fewer background checks.

    For supported native-config installs, add --lean to --hooks to omit optional registrations. Some hosts load a fixed manifest, and each registered hook still starts a process.

  • Search older observations.

    Pass include_archives: true to ci_recall to search the current log and the tails of up to three recent archives. Hosts can omit failed or denied events.

  • Count files in an all-files commit.

    The commit gate counts the tracked changes an all-files commit would stage, together with staged paths. Untracked files are excluded.

  • Protect configuration writes.

    The guard checks recognized file tools and shell write forms. Code running inside a general-purpose interpreter still needs operating-system isolation to constrain its filesystem access.

  • Use checks in other languages.

    For a Python project, set CI_PROJECT_CHECK to python -m unittest. The existing TypeScript gate is still available. Run slower suites in CI.

  • Require a recorded file read.

    Set CI_GATEGUARD_FILE_GATE=read to require a matching file read in the current session before editing an existing file. A directory listing or missing log cannot qualify.

  • Carry a lesson into the next attempt.

    Save a lesson with the observed result in ci_reflect. A later reflection shows the latest record. A person or agent must still apply the lesson.

  • Choose when you need an automatic check.

    Skills guide the work. Use a project test when you need an executable condition. A passing test only answers the question that test covers.

  • Run both reports from your project.

    The plugin bundles /harvest and /companion-preference. The npm CLI exposes ci harvest and ci companion-preference.

  • Use the workflow without Node.

    Try the no-install task in your current chat. Automatic hooks require Node 18 or newer on the path used by the agent.

  • Check macOS test results.

    The CI workflow includes a macOS build and test job. Check its result for your release. A package test does not verify an installed agent.

Which setup fits my work?
  • For a one-off question or an agent with no hook support, use the no-install task.
  • If you maintain your own hooks, you can use the task and keep your existing rules.
  • If process startup cost matters, the no-install task adds zero processes.
  • To see whether the agent helped, compare its result with your original success check.
  • For macOS, check the latest macOS build and tests for the version you plan to use.

Five steps to try it. One line to turn it off.

  1. Install for your agent and do what it prints (Codex: trust each hook in /hooks). On Claude Code, restart once.
  2. Ask the agent to use the be-ambitious skill on a task you already have. On Claude Code: /be-ambitious <task>
  3. Ask the agent to run the read-only installation check. git rev-parse @{u} A working guard replies with a reason starting with Unquoted git ref @{u}.
  4. Work a few minutes, then have it search what ran with the ci_recall tool. On Claude Code: /recall typecheck
  5. In a TypeScript repository, on an agent in the full tier, start it with CI_TYPECHECK_GATE=block
EnabledOff switch, any agent installed with npxnpx continuous-improvement install --uninstall --target <agent>Off switch, Claude Codeclaude plugin disable continuous-improvement@continuous-improvement
Verify, remove, update, and other install paths

For hooks, use a supported agent with Node 18 or newer on its PATH. The step 3 probe only reads a Git reference. A refusal starting with Unquoted git ref @{u} confirms the guard ran.

For non-Claude agents, npx -p continuous-improvement ci doctor --agent <agent> shows what the agent loaded, using only its own listing commands. On Claude Code, run /verify-install. It confirms the commands loaded, probes the guard hook with an unquoted git rev-parse @{u}, which the hook refuses in every file-gate mode, and reads the log for a row. A wired install ends with ✓ wired — commands, gateguard, observe all confirmed.

One rule
Its switch in Hooks.
Claude Code: everything, kept installed
claude plugin disable continuous-improvement@continuous-improvement
Claude Code: remove
/plugin uninstall continuous-improvement@continuous-improvement Then delete ~/.claude/instincts/ and ~/.claude/hook-telemetry/ yourself.
Claude Code: update
claude plugin marketplace update continuous-improvement Then claude plugin update continuous-improvement@continuous-improvement. The new version loads in your next session.
Claude Code through npm
npx continuous-improvement install Installs the logger, 2 skills and 10 commands into ~/.claude. With --mode expert it also registers the session hook and writes an MCP server entry into ~/.claude/settings.json. Whether current Claude Code loads a server from that file was not verified. It installs none of the guard hooks, so /verify-install reports the missing guard on this path. Do not run both paths against the same ~/.claude.
Any other agent: install
npx continuous-improvement install --target codex --hooks Installs the hooks for that agent, and writes or prints the MCP server step. For a supported rules-only target, omitting --hooks installs project guidance. Every agent, its tier and what it cannot do: Agents.
Any other agent: remove
npx continuous-improvement install --uninstall --target codex Run it in the same project: it removes what --hooks recorded. A vendor mcp add has its own undo.

The claude plugin commands are from the plugin CLI reference. They were not run against a live install here. The switch above only dims the gate in this picture.

Why it exists.

Before a session starts: is this the task, or the goal behind it?

Before a session says done: was it checked, or hoped?

The wise one is the one who takes account of himself and works for what comes after death. The weak one is the one who follows his own desires and then merely wishes upon Allah.

Jami` at-Tirmidhi 2459, narrated by Shaddad ibn Aws. Tirmidhi graded it hasan; later scholars disputed the chain. Full sourcing in docs/philosophy.md.
The loop is the method, the hooks are the part that executes

As models improve, planning etiquette and reminders to verify merge into the model. A hook that refuses before a call runs (hooks/gateguard.mjs), a check that runs before the turn ends where the agent has a Stop gate, and a record of what was run do not. The loop is the method. The hooks and the log are the part that executes. This page says which is which.

An open paper ledger with ruled columns. One group of tally marks is orange among black ones.
A ledger settles by outcome, not by intention.

Colophon

  • 22Bundled skills
  • 0Runtime deps
  • 5,283Tests in the suite
  • MITLicense
  • v3.31.0Current rev
This repository's own checks

CI checks the stated total against the number of tests discovered. Each operating system can skip tests intended for another platform. Three numbers above are pinned by a check: the version in four places (verify:landing-version), the skill count (verify:skill-count) and the test count in two (verify:test-count).

checks     20 invariants + typecheck
tests      5,283 discovered
ci         Linux (Node 18, 20, 22) and macOS (Node 22)