Agent lifecycle hooks, explained from zero to registered: what hooks are, when they fire, the safety rules, the three patterns worth stealing, and the exact registration steps for Hermes, Claude Code, Codex, Cursor, and OpenCode.
Part of the open skills program by My AI Freedom Systems. Landing page + more skills: incredagents-site
- Teaches your agent what lifecycle hooks are and when each one fires — before/after a tool call, on session start, on session end, on compaction
- Ships three universal patterns: pre-dispatch validation, post-converge logging, and compaction survival (so your agent's rules survive context compression)
- Gives per-platform adapters and registration instructions instead of vague "it depends" advice
- Covers the manual workarounds for platforms with no native hook support
Hooks are how you enforce governance without forking the agent runtime — credential scanning, audit trails, pre-flight gates. But every platform names, fires, and registers them differently, and most agents guess. This skill is the reference that stops the guessing.
- An AI agent that can follow a
SKILL.md - No other dependencies
cd <your-agent-skills-folder>
git clone https://github.com/MyAiFreedomSystems/hooks-guide.gitOr download hooks-guide.skill from the
latest release
and unzip it into your skills folder.
One-command install for 70+ agents:
npx skills add MyAiFreedomSystems/hooks-guideTell your agent:
"Add a pre-flight gate that blocks git pushes with secrets, using hooks."
The agent reads the guide, picks the right lifecycle event for your platform, writes the hook script, and gives you the exact registration steps — with the safety rules baked in (hooks must be fast, side-effect-free unless that's their job, and never silently swallow errors).
- Concept core — what hooks are, the key lifecycle events, and the universal safety rules.
- Universal patterns — pre-dispatch validation, post-converge logging, compaction survival, each with working skeleton code.
- Platform adapters — what Hermes, Claude Code, Codex, Cursor, and OpenCode actually support, and the workaround when the answer is "nothing."
- Registration — the config file, the key, and the command per platform.
MIT — see LICENSE.