Skip to content

What the hooks do, and what you see ​

ai-boost init installs small helpers (hooks). They keep your index up to date, show a status line, and ask for feedback at the end of a session. They never block your work. If something seems off, run ai-boost doctor.

The rest of this page is for people who want the detail: what each hook does, what you will see in the conversation because of it, and how the whole arrangement behaves once Claude Code starts running several agents at once. The claims were checked against the CLI's code.


The hooks it installs ​

One session hook per event the installed Claude Code supports, plus the two worktree hooks, in .claude/settings.json when the binary resolves by name (else .claude/settings.local.json), and two git hooks per repository. The ones you will notice:

WhenWhat runsWhat it does
Session startsai-boost hook session-startChecks this directory is set up, and tells the session which tools it has and how stale the index is. It also starts the automatic re-index in the background when the index has fallen far behind the default branch
Every promptai-boost hook user-prompt-submitThe first prompt snapshots which files were already modified — the baseline for "did this session change anything". Each prompt may add the code and conventions relevant to it (pushed context). After a compaction it restates the orientation, and it announces a workflow change once
After any ai-boost tool callai-boost hook post-tool-useCounts lookups, and notes when feedback was recorded
Session tries to endai-boost hook stopReports what the session consumed, asks for record_agent_feedback if code changed, and triggers judging
A worktree is createdai-boost worktree createMakes one worktree per repository — see below
A worktree is removedai-boost worktree removeRemoves them all again
git commit.hooks/post-commitIncremental index of what that commit touched
git pull / git merge.hooks/post-mergeIndexes the whole range the pull brought in

Both git hooks run in the background and append to .ai-boost/hook.log rather than writing into your terminal, so git commit stays as quiet as it was. That log is where to look if an index run failed.

They install wherever git actually looks

If you have core.hooksPath set — anywhere, including a relative path in ~/.gitconfig — the git hooks go into that directory, not .git/hooks. ai-boost doctor reports hooks stranded in the wrong place and names the config file that did it.

What you actually see ​

Five surfaces. The status line and the subagent rows appear in Claude Code in a terminal. We have not checked them in other places.

  • The status line, under the prompt: index age (it names ai-boost index once the index is stale), lookups this session, how many of the suggested files were opened, a tick once feedback is recorded, or no key — run ai-boost init in red. Details.
  • Subagent rows under the status line, one per running subagent. Every Claude Code terminal setup with the session hooks gets them.
  • With the mod (opt-in): each workflow agent gets its own line showing who is planning, building or reviewing. If the mod stops for a session, the status line says ⚠ mod off for this session — /reload-plugins.
  • A line on each tool result, from the server: ⚡ ai-boost · search_code_patterns · 5 matches across 4 files in ai-boost, ai-boost-cli · best match 66%. This is what makes a call that found something distinguishable from one that found nothing.
  • A line at the end of a turn, from the Stop hook, on turns that used ai-boost.
For engineers: what the PostToolUse hook says

The hook composes its own per-call line, such as search_code_patterns · 3 lookups this session, and returns it as a systemMessage. Measured: the hook runs (the counter advances every time) and that line never appears in the transcript. The ⚡ line you do see is a second content block the server attaches to the tool result, which is a different mechanism. So the count is real and visible on the status line; the per-call sentence from the hook is not.


Parallel work ​

Claude Code can split a task across subagents, agent teams, forks and workflow-driven agents. What follows is what ai-boost does in each case.

Tool calls from a subagent are counted, against the session that spawned it ​

Calls by sub-agents count toward the session that started them. A team of five agents searching the index is one session's worth of retrieval, the status line adds it up, and the analytics attribute it to the session a person started.

The lookup counter moves only on a retrieval tool. record_agent_feedback does not move it — a session that recorded a score but never consulted the index should not read 1 lookup — and neither does an unrelated tool whose arguments happen to mention ai-boost.

Delegated work is counted, and named in the ask ​

When sub-agents finish, Claude asks for feedback once for the whole session, and says how much was delegated, counted by role and never by agent name (CLI 3.86.3 or later):

1 worker and 1 reviewer finished during this session, so some of those changes are theirs.
Score the whole outcome, and say in `notes` which parts were delegated.
Main sessionSubagent
Tool calls countedyesyes (against the parent)
Retrieval attributed to the sessionyesyes (to the parent)
Covered by the feedback the parent recordsyesyes — and the ask says how much was delegated
Triggers the quality judgeyesyes, through the parent's row
Usage reportedyesyes — TranscriptUsage walks subagents/*.jsonl

Two things this deliberately does not do.

It never blocks a subagent. Asking the subagent itself, while its own context is live, is the obvious design and cannot be made to work: subagent types carry restricted tool sets and several have no ai-boost tools at all, so the demand would be unsatisfiable and the subagent would stall until the block cap released it. Enforcement nobody can comply with teaches nothing and costs real wall-clock. So the count is taken here and the parent — which has the tools, the tree and the watermark — is the one asked.

It does not produce a per-subagent score. One row still describes the whole session. That is the right grain: a subagent's edits land in the parent's working tree, so there is no separate diff to score, and the reason the count exists at all is that "I wrote this" and "I directed five agents that wrote this" are different claims about the same diff.

How the payload makes this possible

Measured against Claude Code 2.1.238 rather than assumed: a SubagentStop payload carries the parent session's session_id — identical to the value the parent's own Stop receives — plus agent_id, agent_type and agent_transcript_path. A subagent-scoped id would have written the count where nothing looks.

The same run settled a related question. The binary contains the strings Converting Stop hook to SubagentStop for … and (subagents trigger SubagentStop), which read as though a registered Stop might fire for subagents. It does not: the two hooks fired separately and the Stop payload carried no agent fields. Those strings sit beside Registered N frontmatter hook(s) from …, so the conversion applies to hooks declared in an agent definition's frontmatter.

After an upgrade, the next session start brings the hook entries up to date in place, in the file they already live in (ai-boost converge, run in the background). Until then doctor can show fewer registered than expected.

For engineers: the Claude Code events ai-boost does not listen to

The events ai-boost does not listen to ​

Coverage was audited against the full set Claude Code dispatches (as of Claude Code 2.1.238), so this is a list of decisions rather than of things nobody looked at. Thirteen are used: the eleven HookEvent cases (eight session events, PreToolUse (below), PostToolUseFailure and PreCompact), plus WorktreeCreate and WorktreeRemove. PostToolUseFailure covers three tool calls that never reach PostToolUse when they fail. A failed feedback call records why it failed. A workflow agent that died of an API error is reported as agent_failed. A Bash call that exited non-zero still records the files it changed, for the Stop hook's feedback ask and the review window. PreCompact is the only event whose output reaches the compaction summariser, so it asks the summary to keep the session id, and gives the one tool-search call that loads the ai-boost tools again.

Three rows, four events, are plausible and deliberately not done yet. They are recorded here so the next person weighs them instead of rediscovering them:

EventWhat it could doWhy not now
CwdChangedThe baseline and heads are only comparable against the directory they were taken in. A session that changes directory mid-way is measured against the wrong tree.Already handled a different way: the root is recorded in session state and the Stop hook reads it from there, not from the payload. A second mechanism would need to agree with the first.
StopFailureA Stop hook that fails is currently invisible — the one hook whose failure costs a feedback row and a judge verdict.No evidence it happens. Adding a reporter for an unobserved failure risks becoming the thing that fails.
TaskCreated · TaskCompletedAgent-team orchestration, the same delegation story SubagentStart/SubagentStop now cover for subagents.Measured: a task delegated to a subagent fires neither. They belong to teams, which nothing here has exercised yet.

Fourteen are structurally irrelevant to keeping an index fresh or a feedback loop closed:

  • Permissions — PermissionRequest, PermissionDenied. What a session is allowed to do says nothing about what it knows.
  • Display and interaction — Notification, MessageDisplay, Elicitation, ElicitationResult, UserPromptExpansion. Surfaces for talking to the developer; ai-boost already has the two it needs (SessionStart's line and Stop's summary).
  • Tool plumbing — PostToolBatch. PostToolUse already answers both questions ai-boost asks of a tool call.
  • Environment — ConfigChange, InstructionsLoaded, FileChanged, DirectoryAdded, Setup, TeammateIdle. Re-indexing on file change is the tempting one and the git post-commit and post-merge hooks already do it at the right granularity — a hook per keystroke would index work that is not finished.

PreToolUse is used for four things. When the workflow names the agents for its steps, it denies an Agent call that names a different one: that is the agent rule, and the only place this hook makes a permission decision. It records a workflow invocation made through the Skill tool. It photographs the working tree before a Bash command for attribution. And once per agent context (the main thread and each sub-agent separately), when a Bash grep carries a natural-language question, it adds one line of model-facing context pointing at search_code_patterns. That hint never blocks, makes no permission decision and shows the developer nothing; an exact identifier or an exhaustive list is left to grep.

A compaction is where a long session quietly loses the tools ​

After Claude shortens a long conversation, ai-boost reminds Claude of its tools, once per shortening.

For engineers: how the reminder works

PostCompact is the only place a compaction is observable, and it cannot add context: that event rejects additionalContext at Claude Code's schema. UserPromptSubmit accepts it. So the compaction sets a flag, and the next prompt restates the orientation and clears it. A compaction also fires SubagentStop with an empty agent_type; an absent agent_type is treated as "not a delegation".

Folder-scoped agents see their own repository's conventions ​

In a workspace, init writes a .claude/rules/ai-boost-<repo>.md per repository, scoped to <repo>/**. Claude Code loads a subdirectory's CLAUDE.md only once it reads a file there, so without these a session started at the parent begins without knowing what the second repository's conventions are. The rules file arrives the moment an agent opens a file in that folder — which matters more for parallel work than for a single session, because a subagent given one repository never reads anything outside it.


Isolated worktrees ​

Give each parallel session its own checkout and they stop sharing one HEAD. Without that, eight concurrent sessions share one working tree per repository, and one session's git reset --hard destroys another's uncommitted work.

Claude Code can do this by itself for a single repository. It cannot for a folder of repositories: it asks git about the directory the session started in, a workspace root is not a git repository, and it refuses —

Cannot create agent worktree: not in a git repository and no WorktreeCreate hooks are configured.

— through every route into the feature: Agent({isolation: "worktree"}), EnterWorktree, claude --worktree. That is the shape ai-boost recommends, so the developers with the most reason to isolate were the only ones who could not.

init therefore registers the WorktreeCreate and WorktreeRemove hooks, and they make one worktree per repository under a single parent, each branched from that repository's current HEAD:

meta/                            .claude/worktrees/fix-the-thing/
  ai-boost/          ────────▶     ai-boost/
  ai-boost-cli/                    ai-boost-cli/

The folder has the same shape as the one you started in, so every relative path still resolves.

Both hooks are installed, never one. With no WorktreeRemove hook Claude Code falls back to a plain git worktree remove, which cannot work against a path that holds several repositories rather than being one — so a create hook on its own accumulates a full checkout per isolated session with nothing reporting it.

What comes with it ​

A fresh git worktree has none of the git-excluded files a working checkout needs. These are carried in:

CarriedWhy
.env, .env.testingthe app cannot boot without it; the suite reads its own
auth.jsoncredentials for a private Composer registry
.claude/settings.local.jsonholds AI_BOOST_KEY — without it the worktree has no ai-boost at all
.ai-boost/local index and adapter state
the git hooks directoryshared, but the re-index hooks skip in a linked worktree; the main checkout re-indexes once the merge is pulled there

Each is copied only if it exists in the source checkout.

Where they go, and what to know ​

  • Default location .claude/worktrees/<name>/, inside the workspace and beside the ones Claude Code makes itself, so there is one place to look. It is kept out of git status.
  • Override with AI_BOOST_WORKTREE_DIR when the root cannot hold them — a read-only checkout, or a network automount, which Claude Code rejects as a worktree location outright.
  • A worktree searches the same project index as its source. The key comes from the carried settings.local.json. A worktree's own commits are not re-indexed by the hooks (a full ai-boost index or --allow-worktree still indexes them). The index holds what the main checkout last indexed, including an uncommitted edit to a tracked file if that edit was on disk when the main checkout ran an index.
  • Once a WorktreeCreate hook exists, it replaces Claude Code's git logic entirely. Neither .worktreeinclude nor worktree.baseRef is read any more; branching from HEAD and carrying the files above are the hook's job. If you have hand-written a .worktreeinclude, init leaves it alone but nothing reads it.
  • A leftover worktree is not another repository. A leftover linked worktree of one of the folder's own repositories is not treated as another repository by the session's change detection, and the judged diff includes a worktree only when the session itself edited a file in it. A worktree of a repository outside the folder is still treated as a repository of its own. git worktree list shows what exists.

When something is not working ​

sh
ai-boost doctor

It reports per directory — whether the key is there, whether the MCP entry is valid, whether the hooks are registered, whether the hook binary can be found from a hook's environment (which is not your terminal's PATH), whether parallel work and worktree isolation are enabled, and whether the generated assets match the version of the binary you are running. Those are all silent failures otherwise: a session with no tools looks exactly like a session that had nothing to look up.

If ai-boost seems to have stopped working, run ai-boost doctor. Hooks fail silently, so doctor is the way to find out: it names the problem and the fix in one line.