@webpieces/ai-hooks
v0.2.111
Published
Pluggable write-time validation framework for AI coding agents. Claude Code PreToolUse + openclaw before_tool_call adapters share one rule engine.
Readme
@webpieces/ai-hooks
Pluggable write-time validation framework for AI coding agents.
Status: under construction. See the plan file for the full design.
What it does
Intercepts AI file writes before they happen. Runs a configurable rule set against the proposed content. Rejects writes that violate rules with an educational message the AI can use to fix its own output, instead of waiting for a build to catch the problem.
Harnesses supported
- Claude Code — via
PreToolUsehook in.claude/settings.json - openclaw — via
before_tool_callplugin hook
Both share the same rules and the same webpieces.ai-hooks.json config file.
Install (Claude Code, per project)
npm install --save-dev @webpieces/dev-config # pulls in ai-hooks transitively
npx wp-setup-ai-hooks
# Restart your Claude Code sessionInstall (openclaw, per user)
openclaw plugins install @webpieces/ai-hooks
openclaw plugins enable @webpieces/ai-hooks
# Drop webpieces.ai-hooks.json into any project you want checkedStarter rules
no-any— disallow theanykeywordmax-file-lines— cap file lengthfile-location— every.tsmust belong to a project'ssrc/no-destructure— use explicit property accessrequire-return-type— every function declares its return typeno-unmanaged-exceptions—try/catchrequires an explicit disable comment
See webpieces.ai-hooks.json at your project root to toggle rules or tune options.
