Claude Code Hooks Let Agents Fix Their Own Failures
We break down Claude Code 2.1.163’s new hook behavior, where failed Stop and SubagentStop validations can feed compiler or linter output back into Claude for a self-correcting loop. The episode also covers new plugin list filters and a handy /btw clipboard shortcut for faster terminal workflows.
Is this your podcast and want to remove this banner? Click here.
Chapter 1
Smarter Automation with Stop Hook Context in Claude Code
Lachlan Reed
G'day everyone! [excited] Lachlan Reed here, joined by James Turner, and thanks to Jellypod for helping make this daily show a reality. Now, James, if you've ever spent your evening babying an automated CLI tool only for it to fail right at the finish line because of a silly syntax error, you're going to love this. The latest Claude Code update--we are talking version 2.1.163--just dropped a massive workflow lifesaver.
James Turner
Oh, I know exactly what you mean. [chuckles] There is nothing worse than waiting for an agent to finish a complex multi-file edit, only for it to exit, run your linter, find one missing comma, and just throw its hands up. You're saying version 2.1.163 actually lets Claude fix its own homework before it exits?
Lachlan Reed
Spot on! [matter-of-fact] It's all down to a clever upgrade to the lifecycle hooks, specifically the `Stop` and `SubagentStop` phases. Previously, if your post-execution hooks failed--say, a test runner spat out an error--the agent would just halt and throw an error. Now, developers can return a property called `additionalContext` inside `hookSpecificOutput`. It feeds those validation failures right back into Claude's context window.
James Turner
Wait, so instead of the hook failing the entire run, the hook basically tells Claude, "Hey, look at this compiler error I just found, go fix it and try stopping again"? That's a built-in self-correction loop! [genuinely surprised] What does that look like structurally? Is it just a standard JSON payload?
Lachlan Reed
Exactly. Under the hood, your hook returns a JSON schema. You pass an object with `status: "failure"`, and then inside `hookSpecificOutput`, you define `additionalContext` as a string. For example, you can dump the exact CLI output of your failed Vitest or ESLint run right into that string. Claude parses that, realizes the job isn't actually done, and spins up an extra reasoning turn to patch the code.
James Turner
[excited] That is incredibly elegant. It turns validation from a binary pass-fail gate into an active feedback channel. I can write a hook that runs my TypeScript compiler on `Stop`, and if `tsc` barks, Claude gets the compiler output directly and resolves the type mismatch on the fly. No human intervention needed.
Lachlan Reed
Exactly! It's like having a junior dev who actually listens to the linter before pushing to main. [laughs] And look, they also snuck in a couple of great quality-of-life wins in this release. We've got new filters for `/plugin list` using `--enabled` and `--disabled` flags, which is handy when your plugin stack gets messy.
James Turner
Oh, thank goodness. Managing third-party extensions was getting a bit cluttered. [relieved] And didn't they also tweak the `/btw` shortcut?
Lachlan Reed
Yeah, they did! If you use `/btw` to capture context, you can now press 'c' as a quick shortcut to instantly copy the output directly to your clipboard. It's a tiny change, but when you're jumping between terminal windows all day, those saved keystrokes really add up.
James Turner
It really keeps you in flow state. [reflective] This whole release feels like Anthropic is focusing hard on making Claude Code feel less like a novelty sandbox and more like a rugged, production-ready toolchain that plays nice with local development environments.
Lachlan Reed
Absolutely. It makes you wonder--as these local agents get better at correcting their own mistakes through native hooks, how long until we stop writing manual test runners and just let the environment heal itself?
James Turner
That is the ultimate goal, isn't it? [warmly] Thanks for listening, everyone. We'll catch you in the next one.
Lachlan Reed
See ya!
