steinwall — Claude Code hook: what it does, how to install
The steinwall hook for Claude Code and Codex provides cost controls, action guards, and loop recovery for unattended agent sessions with shell execution.
FSL-1.1-MIT ★ 1,596 updated 2026-10-29
.claude/settings.jsonWhat steinwall does
The steinwall hook suite operates locally inside Claude Code and Codex environments. It intercepts agent workflow stages: before and after tool usage, on user prompt submissions, at session initialization, and when subagents shut down. Its built-in mechanisms halt runaway loops, monitor spending limits, check installed extensions, and handle token bounds.
Execution relies on dist/bin/codex-hook.js. The runner executes each hook through Node.js under a 10-second timeout. Reading PLUGIN_ROOT or CLAUDE_PLUGIN_ROOT happens directly inside the JavaScript runtime rather than relying on shell expansion. This ensures uniform behavior across Bash, Windows Command Prompt, and PowerShell.
Node.js must be available locally. While events like PreToolUse evaluate broadly, the PostToolUse trigger filters specifically for Bash executions and apply_patch updates.
What it helps with
- halt runaway agent loops during lengthy sessions
- prevent excessive token spending with a local cost brake
- intercept destructive tool invocations before execution
- verify installed extensions at session start
Example prompts for the agent
- Refactor the database layer and run test scripts via Bash
- Analyze project logs autonomously until all errors are resolved
- Start a new session and inspect recently modified extensions
How to install steinwall
Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about steinwall
How to install steinwall in Claude Code?
Add the hook definitions to .claude/settings.json. The configuration maps events to node -e commands pointing to codex-hook.js.
What does steinwall do?
It provides local safety mechanisms including action interceptors, loop recovery, cost safeguards, and extension scanning. It evaluates triggers during tool execution, prompt submission, and session lifecycle changes.
Which triggers are monitored by steinwall?
The suite attaches to PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, Stop, and SubagentStop. For PostToolUse, it specifically targets Bash and apply_patch calls.