hooks-automation

hooks-automation is a skill for Claude Code from monoes/monomind. It costs 38 tokens per session (4,291 once invoked), scanned D, original, Apache-2.0.

An automation system for running actions before and after code edits, commands, and tasks, while saving session and routing history.

In plain words
What is it for?
It helps set up operation hooks, persist and restore sessions, route tasks to agents or models, log outcomes, and run background workers.
Why use it?
It records operational history and risk checks so later work can restore sessions, suggest agents, and use stored patterns.

Skill for Claude Code

Written for Claude Code: $CLAUDE_PROJECT_DIR variable. Also seen: reads .claude/ paths; mentions Claude Code; installed under .agents/ (shared by several agents).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is npx monomind hooks transfer from-project --source ../other-project.

Good fit It helps set up operation hooks, persist and restore sessions, route tasks to agents or models, log outcomes, and run background workers.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/monoes/monomind
agentmods
npx agentmods add skills/monoes/monomind/hooks-automation

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hooks-automation

README.md
[![agentmods](https://agentmods.dev/badge/skills/monoes/monomind/hooks-automation/github.svg)](https://agentmods.dev/skills/monoes/monomind/hooks-automation)
Your own site
<a href="https://agentmods.dev/skills/monoes/monomind/hooks-automation"><img src="https://agentmods.dev/badge/skills/monoes/monomind/hooks-automation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hooks-automation

Your own site · 80×15
<a href="https://agentmods.dev/skills/monoes/monomind/hooks-automation"><img src="https://agentmods.dev/badge/skills/monoes/monomind/hooks-automation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,291 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.04291
Opus 5.5 $0.00015 $0.01716
Sonnet 5.5 $0.00008 $0.00858
Haiku 4.5 $0.00004 $0.00429

Measured 2d ago against content hash 56b776a7e9d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

hooks-automation scanned grade D with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

(The generated commands also walk up the directory tree to find `.claude/helpers`; the version above is simplified.)

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

npx monomind hooks pre-command -c "rm -rf ./build"
.agents/skills/hooks-automation/SKILL.md · 497 lines

How it starts

The opening of the file, as written. The whole thing — 497 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hooks Automation

Coordinate, validate, and learn from Claude Code operations through the monomind hooks command group and the hook handlers that monomind init installs into .claude/settings.json.

What This Skill Does

The hooks system records what happens during a session (edits, commands, tasks) and uses that history to suggest agents, assess command risk, and persist session state. It enables:

  • Pre-operation hooks: context and agent suggestions before an edit, risk assessment before a command, agent suggestions before a task
  • Post-operation hooks: record edit, command, and task outcomes in local logs that routing statistics read
  • Session management: persist state at session end and restore it later
  • Routing: route a task to the best agent (or model) and explain the decision
  • Pattern store: log trajectories and search stored patterns (hooks intelligence); hooks pretrain scans the repository (file types, import lines) into the memory store and local pattern log — no model is trained
  • Background workers: run @monoes/hooks workers in-process

Prerequisites

Required:

  • Monomind CLI (npm install -g monomind@latest, or use npx monomind)
  • Claude Code with hooks enabled in .claude/settings.json

Optional:

  • Git repository (for the Git hook examples)
  • A test framework (for quality gates)

Quick Start

Initialize Hooks

# Write the hooks configuration into .claude/settings.json
npx monomind init hooks

# Only the essential hooks
npx monomind init hooks --minimal

This wires Claude Code's PreToolUse, PostToolUse, and session events to the helper .claude/helpers/hook-handler.cjs (installed by monomind init), which handles pre-bash, pre-search (Grep/Glob), pre-agent, post-edit, session-restore, session-end, and related events.

Basic Hook Usage

# Record task start and get agent suggestions
npx monomind hooks pre-task --description "Implement authentication"

# Record an edit outcome
npx monomind hooks post-edit --file "src/auth.js" --success true

# End the session and persist state
npx monomind hooks session-end

Read the full file on GitHub · 497 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 497 lines · 38 tokens per session scan D 56b776a7e9d6

Subscribe to this mod's changes

hooks-automation is a skill published in the GitHub repository monoes/monomind (23 stars, last pushed 2d ago), licensed Apache-2.0. It adds 38 tokens to every session and 4,291 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it D with 2 findings (reads agent configuration directories, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-26.