Codex 0.114.0 adds experimental hooks for agent workflows

Codex shipped version 0.114.0 with a long-requested feature: hooks. The first release includes just two trigger points—SessionStart and Stop—but they already enable context injection, workflow guardrails, and end-of-turn automation.

Codex 0.114.0 adds experimental hooks for agent workflows

TL;DR

  • Codex 0.114.0 adds hooks (experimental), providing programmable lifecycle automation around agent sessions
  • Hook points: SessionStart (session begins/resumes) and Stop (agent about to finish its turn)
  • Enablement: feature flag via CLI codex features enable codex_hooks or config codex_hooks = true
  • Configuration: hooks.json in global .codex/ or project/subfolder .codex/; each hook runs a command with timeout/status
  • SessionStart uses: inject instructions, read handoff/task brief, run git status for branch/working tree context
  • Stop uses: gate completion on tests/verification, generate handoff summaries/logs, run linters/light code review, run test suite

Codex shipped version 0.114.0 with a long-requested capability: hooks. The initial release is intentionally narrow—only two hook points are available right now, SessionStart and Stop—but even that small surface area maps neatly onto the two moments that matter most in an agent loop: when a session spins up (or resumes) and when an agent is about to yield.

The feature is described as experimental and early release, and it’s positioned as foundational: a programmable layer around the agent lifecycle that can be used to inject context, enforce workflow rules, and trigger automation at consistent points in the run. In other words, it’s a step toward combining deterministic automation (scripts, checks, conventions) with the more fluid behavior of an LLM-driven agent.

Enabling Codex hooks

Hooks are guarded behind a feature flag in this release. There are two supported paths:

  1. Enable via CLI:
    • codex features enable codex_hooks
  2. Enable via config:
    • Add a features section with codex_hooks = true

How hooks are defined

Hook definitions live in a hooks.json file, and Codex will look for it in either:

  • a global .codex folder, or
  • project/subfolder .codex folders

Each hook runs a command, with a timeout and a status message associated with it. The two currently available events are:

  • SessionStart: fires when a session begins (or resumes)
  • Stop: fires when the agent is about to finish its turn

Practical use cases for SessionStart and Stop

Even with only two events, the examples land squarely in day-to-day agent reliability work.

SessionStart hooks can be used to establish operating context early, such as:

  • injecting project-specific instructions (for example: “use pnpm, not npm”)
  • reading a handoff file or task brief so a session starts with the right framing
  • running git status and passing along branch and working tree details

Stop hooks run right before the agent finishes a turn, and could be used to gate completion on checks or to generate structured output:

  • blocking weak completions unless verification or tests are included
  • generating a short handoff note, summary, or logs at the end of a turn
  • running a targeted linter or lightweight code review flow on changed files
  • running a test suite

There are also open questions. One reply asked how the output of a Stop hook is injected (for example, whether it becomes a normal user message), and the author noted they’d been writing results to a log and weren’t yet sure.

A small hook surface, a bigger automation story

The release is being framed as groundwork for “fast follows,” with multiple contributors involved in the PR. Community replies immediately pointed to broader agentic automation desires—more hook points (like pre/post tool use) and CLI loops/automation—suggesting hooks are likely to become a major extension point as Codex evolves.

Original source: https://x.com/LLMJunky/status/2031582374064951414

Continue the conversation on Slack

Did this article spark your interest? Join our community of experts and enthusiasts to dive deeper, ask questions, and share your ideas.

Join our community