Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/steve-magne/hookstack/hook-authorgit clone --depth 1 https://github.com/steve-magne/hookstackWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00080 | $0.01095 |
| Opus 5 | $0.00040 | $0.00548 |
| Sonnet 5 | $0.00016 | $0.00219 |
| Haiku 4.5 | $0.00008 | $0.00110 |
Grade A, and why
hook-author scanned grade A with 1 finding 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 yesterday.
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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
toucher à stdin/stdout/`process.exit`. Les effets de bord (`execSync`, `fs`, `fetch`, How it starts
The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Hook Author — Hookstack
Mission
Créer ou modifier un hook du catalogue. Un hook est un script Node .mjs branché sur le
cycle de vie de l'agent (PreToolUse, PostToolUse, SessionStart, Stop…). Portable multi-agent
(Claude Code / Codex / Copilot) — le code .mjs est identique, seul le format de config diffère.
Source de vérité (à retenir)
Le .mjs sur disque est la source de vérité du code. registry/registry.json est la source
des métadonnées ; son champ code_snippet est dérivé du .mjs par le sync — jamais édité à la main.
Pattern OBLIGATOIRE — run() + garde + injection de dépendances
Tout hook expose une fonction pure qui contient la logique et retourne son résultat, sans
toucher à stdin/stdout/process.exit. Les effets de bord (execSync, fs, fetch,
process.platform, horloge) passent par des dépendances injectées avec valeurs par défaut réelles.
#!/usr/bin/env node
// @hookstack <slug> // injected automatiquement par le sync — ne pas éditer à la main
export function run(input, { exec = defaultExec } = {}) { /* logique pure, retourne un résultat */ }
/* v8 ignore next 5 */
if (process.argv[1] === fileURLToPath(import.meta.url)) {
const input = JSON.parse(readFileSync(0, 'utf8'));
const result = run(input);
if (result) process.stdout.write(JSON.stringify(result));
}
Règles d'écriture
- Langue : Node
.mjs, OS-agnostique, dépendances builtins uniquement (fs,child_process,path). Pas de npm. - Un fichier = une responsabilité.
- PostToolUse sont non bloquants : erreurs d'outils absents (
--no-install) silencieuses. - PreToolUse bloquants :
reasonactionnable, pas juste « interdit ». - Timeout explicite sur tout
execSync. Filtrer par extension avant un outil lourd (/\.tsx?$/.test(p)). - Hooks Python :
.mjsqui appelleuv run <tool>(ruff/pytest/pyright) —uv runrésout le venv. Filtrer.endsWith('.py').
Workflow d'ajout / modif d'un hook
- Écrire/modifier
.claude/hooks/<slug>.mjs(pattern ci-dessus). - Ajouter/maj le test
tests/hooks/<slug>.test.mjs(importerun, injecte des fakesvi.fn()).pnpm test. - Métadonnées dans
registry/registry.json(typeHook) :name,benefit(≤ ~60 car., orienté résultat),description,use_cases(anglais, champs racine, pas d'overlay i18n),implementation.config(fragment{ hooks: { [Event]: [...] } }fusionnable),implementation.script_path→ le.mjs. Laissercode_snippetvide : rempli par le sync. Annoterstackseulement si le code filtre par extension ou appelle un outil non universel — ne jamais déduire lestackdepuis lestagsseuls, lire le code. node .claude/sync-hooks.mjs— injecte// @hookstack <slug>en ligne 2, recopie danscode_snippet, reconstruitsettings.json.- Outil externe requis (jscpd, gh, uv…) → ajouter une entrée dans
PREREQ_HINTS(packages/cli/bin/core.mjs). - Après commit du
.mjs:pnpm timeline(régénèreregistry/hooks-timeline.json,public/hooks-timeline.svg, bloc README).
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.
- yesterday First seen · 72 lines · 80 tokens per session scan A 97340157a6f0
hook-author is an agent published in the GitHub repository steve-magne/hookstack (7 stars, last pushed 8d ago), licensed MIT. It adds 80 tokens to every session and 1,095 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.
AVM Owner Triage
Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.
Ultimate Transparent Thinking Beast Mode
Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.
code-reviewer
Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.