← Back to library

Have the agent port your hooks when you switch tools

esperent canceled Claude over usage limits that swung week to week and moved to the pi coding agent. Skills transferred easily, but months of hooks lived in a Claude-only format. Following advice he had heard, he pointed the new agent at the hooks folder and asked for pi extensions that do the same job, which it delivered quickly.

  • OutcomeWhen moving from one coding agent to another, point the new agent at your old hooks folder and have it rebuild them as extensions.
  • SetupMinutes
  • LevelIntermediate
  • Creditesperent on Hacker News
View original
Works with
Claude CodeCustom agent

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 23, 2026

When should you use it?

  • You are switching coding agents
  • You built many hooks
  • You want to avoid rewriting by hand

Not for: Hooks that enforce security you cannot test; Tools without an extension system

What do you need, and what do you get?

You need

  • Old hooks folder
  • Target agent's extension docs
  • A test repo

You get

  • Ported extensions
  • A mapping of old to new
  • Test results

How does it work, step by step?

  1. Copy the hooksPut the old hooks folder where the new agent can read it.
  2. Ask for a portHave it rebuild each hook as an extension for the new tool.
  3. Map themAsk for a table of each old hook and its new equivalent.
  4. TestTrigger each hook in a scratch repo.
  5. Keep the old setLeave the originals until the new ones pass.

The prompt

Our own prompt, inspired by esperent on Hacker News and written to work in Claude Code and Custom agent. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt4 variables
Read the hooks in {old_hooks_folder}, written for {old_tool}. Using {extension_docs}, recreate every hook as a {new_tool} extension.
Return a table: old hook, trigger event, new extension, and any behavior you could not reproduce.
Do not delete the originals. Write a short test for each port.

Inspired by esperent on Hacker News: Comment in Changes in the system prompt between Claude Opus 4.6 and 4.7. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Event names and timing may differ between tools.
  • A silently missing guard hook is worse than none.
  • Test safety hooks first.

Our take

Switching costs keep people on tools they dislike, and hooks are a hidden part of that cost because they are usually tool-specific. Letting the new agent translate them is sensible, but verify the result rather than trusting a bulk conversion. Ask for an explicit mapping from each old hook to its new counterpart so you can see anything that was dropped or weakened, then trigger each one in a scratch repository. Start with the guards that block dangerous commands, since those are the ones you least want to discover are missing in production work. Keep the old set until the new one passes those tests, and write down any behavior the port could not reproduce so you can rebuild it by hand. Skills that are plain instructions usually move with little trouble; hooks that shell out or call APIs need the most attention. Budget an afternoon for the switch so you are not debugging hooks in the middle of real work.

Where the time goes back: Switching tools stops meaning a weekend of rewriting your guardrails.

FAQ

Why are hooks hard to move?
Unlike skills, they are written in a tool-specific format.
Did it work?
He says yes, and quickly.

Source and credit

Inspired by esperent on Hacker News. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
Comment in Changes in the system prompt between Claude Opus 4.6 and 4.7
Creator
esperent on Hacker News
Published on
Hacker News
Original date
Apr 20, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Custom agent
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends, bookings or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in IT & Security

All 82 IT & Security playbooks →

Related playbooks

IT & SecurityWorkflow✓ AI dry run

Get consent first, then audit with a second agent

Have a different coding agent review your work in an isolated copy with editing turned off, and require it to ask before using any account or login.

Credit: u/Bulldagshunter on r/ClaudeCode

Under an hour
IT & SecurityWorkflow✓ AI dry run

Turn a public advisory into a tested exploit in a lab

See how fast an agent can go from a patched vulnerability to a working proof of concept inside an isolated lab, so you can judge real patch urgency.

Credit: Kev Breen

An afternoon+