fix(adapters): read tool_input.* in signal-detect for Claude Code#522
Open
TanveerKahlon wants to merge 1 commit intoEvoMap:mainfrom
Open
fix(adapters): read tool_input.* in signal-detect for Claude Code#522TanveerKahlon wants to merge 1 commit intoEvoMap:mainfrom
TanveerKahlon wants to merge 1 commit intoEvoMap:mainfrom
Conversation
Claude Code's PostToolUse hook payload nests tool args under
`tool_input` (e.g. `tool_input.content`, `tool_input.file_path`).
The previous lookup only checked top-level `content`/`file_path`,
so the hook silently returned `{}` on every real Write/Edit event
and never injected the `[Evolution Signal]` context block.
Fix the lookup to check `tool_input.*` and `tool_response.filePath`
first, then fall back to the legacy top-level shape for backward
compatibility. Also pick up `new_string` so Edit-tool payloads are
analysed (previously only Write was reachable).
Verified end-to-end against all four payload shapes: Claude Code
Write, Claude Code Edit, legacy top-level, and empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Claude Code adapter's signal-detect hook (`src/adapters/scripts/evolver-signal-detect.js`) silently returns `{}` on every real `PostToolUse` event because it reads `content`/`file_path` from the top level of the JSON payload, but Claude Code nests tool args under `tool_input` (`tool_input.content`, `tool_input.file_path`).
Net effect on a default install: the `[Evolution Signal] Detected: [...]` context block never fires. Session-start and session-end hooks are unaffected; only signal-detect is silently dead.
The fix
Check `tool_input.*` and `tool_response.filePath` first, fall back to the legacy top-level shape for backward compatibility. Also pick up `new_string` so Edit-tool payloads are analysed (previously only Write was reachable).
```diff
```
Verification
Pipe-tested against four payload shapes:
Reference for the Claude Code payload shape: https://docs.claude.com/en/docs/claude-code/hooks-guide#hook-input
Scope