enolaDocsAgent hooks

Documentation

Agent hooks

Have Enola check each coding agent session, whether or not the agent remembers to ask.

01 · Why

What hooks add

Without hooks, an agent has Enola's tools and an instruction saying they exist, and may or may not use them. With hooks, Enola checks the session itself.

In your repositoryshell
enola install --hooks

The installer previews every change and asks before writing. It merges into your agent's settings, and enola uninstall removes only Enola's entries. You pass --hooks once: a later enola install keeps the hooks, and --no-hooks removes them. The Claude Code plugin includes the session hooks already.

02 · What runs

At the start and at the end

  1. The session starts. Enola pins the structure of the code as a baseline, in the background. The session does not wait for it. If an upgrade left installed files behind, Claude Code is told, and asks you to run enola install.
  2. The agent works. In Claude Code, the first two file searches of a session are refused with a pointer to the Enola tool that answers structural questions. A search run again after that goes through, and using any Enola tool ends the refusals.
  3. The agent finishes a turn. Enola compares the code with the baseline. If there is something to say, the agent is told before it reports the work as done.

It speaks up when the change broke a policy you set, or introduced a finding Enola computes exactly: a cycle, a violation of a declared layer, a broken rule. Estimates, such as a re-ranked hotspot list, never trigger it.

03 · Agents

What works where

Agent With --hooks
Claude Code Baseline at session start, check at the end, and the search pointers
Codex Baseline and check. Approve the hook once with /hooks inside Codex.
Pi Baseline and check, from Enola's extension
opencode No baseline or check. A plugin steers the first searches to Enola's tools; ENOLA_OPENCODE_GATE=off disables the refusals.
Cursor, Copilot No hooks. They get the instructions, the skills and the MCP tools.

Started in a folder that holds several repositories, Claude Code has each repository pinned just before the session first edits it, and checked at the end. A repository it only reads is never snapshotted. An edit made through a shell command pins nothing. Codex and Pi get no hooks in such a folder, so install inside each repository and start them there.

04 · Limits

What hooks never do

  • Block the agent. The verdict is information it can act on.
  • Replace your baseline. One you pinned yourself is left alone.
  • Decide for you. When nothing was enforced, the agent is told to show you the finding and ask, not to revert or refactor by itself.
  • Break a session. Without a snapshot, or outside a repository, they exit cleanly and say nothing.
  • Speak without a reason. No finding means no output.

05 · Verify

Check that they fire

In your repositoryshell
enola doctor

A hook configuration that an agent ignores looks the same as one it runs, so Enola records every time a hook fires, including when it has nothing to say. enola doctor shows when each last ran and what it concluded. NEVER FIRED after a real session means the agent is not running it. See Troubleshooting.

06 · Git hooks

Check before a commit

The same check runs in a git hook, with or without an agent. Pin a baseline before you start, and the commit is blocked only when the check exits 1:

.git/hooks/pre-commitshell
enola check --fail-on=layers,cycles
test $? -ne 1

Enola ships a ready-made pre-commit hook that skips the gate when there is no comparable baseline. To check on the server as well, use CI.