NAME
Langertha::Raider::Plugin::ClaudeHooks - Internal plugin that runs the Claude Code PostToolUse and PostToolUseFailure hooks on tool results
VERSION
version 0.504
SYNOPSIS
# Internal to Langertha-Raider -- no API promise.
my $raider = Langertha::Raider->new(
engine => $engine,
plugins => [ '+Langertha::Raider::Plugin::ClaudeHooks' => { app => $app } ],
);
DESCRIPTION
Internal module. Its interface may change without notice.
The tool-result side of Claude Code's hooks (ADR 0022) in the Claude layout. After every tool call it
appends the
additionalContextaPreToolUsehook gave for this call ("tool_hook" in Langertha::Raider::Application keeps it),runs the
PostToolUsehooks of "hooks" in Langertha::Raider::Application on a result that is not an error and was not cut off by a cancel, withtool_nameandtool_inputin Claude Code's form andtool_responseas raider's result (an MCPcontentlist, not Claude Code's per-tool shape), and appends theiradditionalContextand the reason of adecision: "block"(or the stderr of exit 2) -- the tool already ran, so this is feedback for the model,runs the
PostToolUseFailurehooks instead on a result that is an error (isError: the tool failed, the gate or aPreToolUsehook refused the call, its arguments did not fit the schema) or was cut off by a cancel (ADR 0034), withtool_name,tool_input,tool_use_id(the model's id of the call, when it gave one),error(the result's text) andis_interrupt(true for a cancel), and appends their feedback the same way. Claude Code fires it for neither a refused call nor a schema error; raider does, as ADR 0034 decides,
each as one more text block wrapped in <system-reminder>, the way Langertha::Raider::Plugin::NestedMemory appends. It sits after NestedMemory and before the Events plugin, so tool.result in the journal is the result as the model gets it. The hook runs are reported by the application (hook.ran, hook.message) to "on_event"; a continue: false calls "on_stop" (default: the run is cancelled). The hook.ran of these tool hooks carry the call's id (call, ADR 0034).
app
The Langertha::Raider::Application. Required; held weakly.
on_event
Where the hook runs are reported, called as ->($type, %payload): the Events consumer of the raider (a subagent's journal). Default: the application's "event" in Langertha::Raider::Application.
input
Optional code ref whose pairs go into every hook input -- a subagent's agent_id, agent_type and permission_mode.
on_stop
Optional code ref called on a continue: false; default "cancel_run" in Langertha::Raider::Application.
SEE ALSO
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/langertha-raider/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.