Get started

While your agent edits

What the Carrick hooks do in a coding agent's session after carrick init: when each one runs, what it tells the agent, how long it holds the agent, and how to turn it off.

After carrick init, Carrick runs small hooks in your coding agent’s session. A hook is a command the agent’s host (Claude Code or Codex) runs at a fixed moment, such as after a file edit. Each hook can add a few lines to what the agent reads next. None of them changes your code. The edit hook holds the agent for a moment, and no hook holds it at the end of a turn.

When each hook runs

Moment What Carrick may tell the agent Claude Code Codex
Session start A short line about the index (how fresh it is, or that a build is pending), and notices about the carrick version or a slow hook Yes Yes
After the agent opens a TypeScript file Who depends on the file: callers of its functions, operations that read its types, and the other side of each route or call in it. Once per file per session Yes No
After the agent edits a file The contract facts and types for a route or call the edit touches, an existing function that does the same job as a new one, a note when a new dependency version differs from the one other services pin, and the result of an earlier background check Yes Yes, for patches (apply_patch)
After a shell command The same as the open and edit hooks, for a TypeScript file the command read or wrote, and any finished background check Yes No
After a search or an MCP call Only a finished background check Yes No
End of a turn Finished background checks, once. It never waits for a running one Yes No
Next prompt Background checks that finished after the turn ended Yes Yes

Codex has no end-of-turn hook that can add text for the agent, so its next-prompt hook delivers the answer instead.

The edit hook reads TypeScript files (.ts, .tsx, .mts, .cts) and GraphQL files (.graphql, .gql). It reads JavaScript files and package.json for the facts above only. Each line is said once per session, and one edit prints at most three fact lines.

A line appears only when the files it names are checked out on your machine and still match the commit the index was built from. A repository you have not cloned, or a file that has changed since, makes that line silent.

The background check

Carrick re-checks every edited file in the background. The answer arrives with a later tool call or with the next turn, whichever comes first. The agent is not told to run a check or to wait for one: the rules in .carrick/RULES.md say Carrick’s answer comes with a later tool call or the next turn. This holds from carrick 0.3.178.

A background check has a cap of three minutes. A check that finds a problem is reported to the agent. A check that finds nothing is silent, except that the end-of-turn hook names the operations it checked, once per set.

How long a hook holds the agent

No hook waits for a running check. At the edit, the hook gives its quick check 0.6 seconds, and then sends anything slower to the background. The end-of-turn hook does not wait at all.

The hooks do run a short local step before they print: reading the local index and asking git. How long that takes on your machine is measured, not promised. Carrick writes one line per hook run to .carrick/hook-timings.jsonl, with the hook name, the start time, the duration, the time spent waiting on a check and whether it printed. The file holds no code and no file contents, only the edited file’s path relative to the workspace. At session start, Carrick tells the agent when a hook’s p90 over the last seven days is above one second.

What Carrick reads

Hooks answer from the index of your default branch, held on your machine in .carrick/. They do not call a model at edit time. Uncommitted and unpushed edits are not in the hosted index. A line states what the index holds, not what your working copy has become.

The index refreshes by itself:

  • The session-start hook refreshes the facts file the edit hooks read in the background, at most once a minute.
  • When your checkout holds the hosted index, the session-start hook moves your local copy to the cloud’s newer index in the background, at most once every 15 minutes, when that commit is in your branch’s history.
  • When a connected repository has no hosted index yet, the session-start hook starts a refresh, at most once an hour.

Run carrick refresh to read the index in yourself.

Limits

  • Git worktrees. The compiler engine reads only the main checkout. For a file in a linked git worktree, the hook says the file is not type-checked and why. Fact lines for a file that a shell command wrote in a different worktree are skipped.
  • Protocols. Edit-time lines cover HTTP, GraphQL, pub/sub and socket operations. Queues and RPC routers have no edit-time lines yet, and are a gap. Call-chain lines that reach a route from a function cover HTTP routes only.
  • Languages. JavaScript and package.json get fact lines but no background check. Deno import maps and deno.json are not read for dependency notes.
  • Lines are not edits. A line names a caller or a fact. It does not change the agent’s code, and the agent decides what to do with it.

Turn a hook off or see what it did

  • CARRICK_CHANNEL=off silences every hook, including the session-start line. Set it in the environment of the agent’s host.
  • CARRICK_FACT_LINES=0 stops the fact lines and the local facts file. CARRICK_COMPILER_LINES=0 stops the background compiler engine and its type checks.
  • carrick remove deletes the hook entries from .claude/settings.json, .claude/settings.local.json and .codex/hooks.json, with the task skills and .carrick/. It lists what it will delete and asks for a typed answer first. See the CLI.
  • carrick doctor lists the hook entries installed and any that differ from what this version writes.
  • .carrick/hook-timings.jsonl shows what each hook did and how long it took.