aheadloop
Agents

Inside the agent loop, through hooks agents already have.

Claude Code and Codex already run commands at fixed points in a session. Aheadloop installs a small set of project-local hooks at those points. Any other agent uses the command line.

Claude Code

Hooks in .claude/settings.local.json (or .claude/settings.json with --scope project, to share with the team). A failure wakes the agent in the background.

aheadloop integration install claude-codeExercised with 2.1.329, non-interactive (claude -p)

Codex

Hooks in .codex/hooks.json. You trust the project and review each hook in Codex; Aheadloop never changes Codex trust settings.

aheadloop integration install codexExercised with Codex CLI 0.167.0-alpha.3.2 (codex exec)

Any other agent

Use verify --async, wait, feedback and gate. A managed instructions block is written to AGENTS.md.

aheadloop integration install genericFor any CLI agent that reads AGENTS.md
Fig. 4What happens at each pointTested
  1. SessionStart

    Attaches the agent session to the project and tells the agent how verification works.

  2. PostToolUse

    After edits and shell commands: a change signal. Signals are coalesced and one verification runs once the workspace goes quiet.

  3. background

    If a required check fails, the agent is told while it keeps working. A pass is reported at most once, as context.

  4. Stop

    When the agent tries to finish, the gate is checked for the current workspace. A failure sends it back with concise feedback.

  5. SessionEnd

    Ends the session. Requests already running finish.

Claude Code and Codex hook events, and what Aheadloop does with each.

It never traps an agent

  • By default, at most three blocks in a row.
  • Never blocks twice on a workspace that did not change.
  • A pending or unknown result lets the agent finish, with a message.
  • If anything goes wrong inside a hook, the agent continues as if Aheadloop were not there.

Installs like a careful colleague would

Project-local
Nothing global is written: no ~/.claude, no ~/.codex.
Preserving
Other hooks, keys and their order stay as they were. Invalid JSON is never overwritten.
Reviewable
--dry-run prints the diff; every write saves a timestamped backup first.
Reversible
uninstall removes only Aheadloop’s entries.