Skip to content

Make Claude Code hook wiring less invasive and self-contained#15

Merged
dropdevrahul merged 1 commit into
mainfrom
feat-1
Jun 16, 2026
Merged

Make Claude Code hook wiring less invasive and self-contained#15
dropdevrahul merged 1 commit into
mainfrom
feat-1

Conversation

@dropdevrahul

Copy link
Copy Markdown
Owner

What

Reduces the Claude Code adapter's footprint and makes the marketplace plugin wire itself with no manual settings.json editing.

Why

The adapter wired four hooks, two with matcher: "*":

  • PreToolUse / * spawned bun before every tool call (Read, Grep, Glob, everything) just to set a "thinking" state — latency on every tool, for a mood the post-action states already cover.
  • PostToolUse / * spawned bun after every tool, including read-only ones that don't change the pet's mood.

Changes

  • Removed PreToolUse and deleted hooks/pre-tool-use.sh. (The thinking event stays in core/events.ts — the Pi adapter still emits it.)
  • Scoped PostToolUse from "*" to "Edit|Write|MultiEdit|NotebookEdit|Bash", so read-only tools never spawn a process.
  • Added hooks/hooks.json so /plugin install campy auto-wires the three lean hooks (SessionStart, scoped PostToolUse, Stop) via ${CLAUDE_PLUGIN_ROOT}.
  • Added a statusLine block to plugin.json so the statusline is plugin-provided too.
  • Updated CLAUDE.md to match.

Net: 4 hooks → 3, the only per-tool hook fires on mutating tools instead of everything, and the marketplace install is self-contained.

Testing

  • npm run typecheck clean
  • hooks.json and plugin.json validated as JSON

Drop the PreToolUse hook that spawned a process before every tool call,
and scope PostToolUse to mutating tools (Edit|Write|MultiEdit|
NotebookEdit|Bash) so read-only tools never spawn anything.

Add hooks/hooks.json and a statusLine entry in plugin.json so the
marketplace plugin auto-wires hooks and the statusline via
${CLAUDE_PLUGIN_ROOT}, with no manual settings.json editing.
@dropdevrahul dropdevrahul merged commit 836bd61 into main Jun 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant