feat(hooks): Claude Code API parity audit (July 2026) - #2
Open
darko-mijic wants to merge 6 commits into
Open
Conversation
Harden permission-update variants, notification types, Stop/SubagentStop feedback modes, and related schemas/docs so the library matches the refreshed official hook surface after the publication-blockers merge.
Finish the parity audit by aligning tool schemas with official examples, scoring SubagentStop final-message errors, tightening MCP name parsing, updating lifecycle/env docs, and making type-check, lint, tests, and build green.
…olish Add postToolUseContext and failureContext, enforce event-safe PreCompact output, align ExitPlanMode/Task/sessionStart edge cases, and document the block vs non-block builder paths before npm release.
darko-mijic
marked this pull request as ready for review
July 30, 2026 06:37
Stop overwriting detailed SessionStart restore context with the abbreviated
PreCompact board, and re-expand {title}/{message}/{priority}/{icon} in custom
notification commands while keeping CLAUDE_NOTIFICATION_* env exports.
Contributor
Author
Greptile P1 follow-upAddressed both verified P1 findings in 453473f:
Local: type-check + hooks tests + lint green. Full suite running/CI will re-verify. |
Map {title}/{message}/{priority}/{icon} to double-quoted
CLAUDE_NOTIFICATION_* expansions instead of interpolating raw notification
text into sh -c, closing command-injection via hostile titles or messages.
Expand {title}/{message}/{priority}/{icon} with shell quote context so
single-quoted legacy commands still receive env refs, without splicing raw
notification text into sh -c. Document Greptile as primary review tool.
Contributor
Author
|
All Greptile findings addressed on this branch (latest: a4fca4b — quote-aware notification placeholders; earlier PreCompact restore + injection-safe env refs + builder polish). Please run a full re-review and refresh the PR overview/summary against current HEAD. |
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
Completes the Claude Code hook API parity audit left uncommitted after PR #1, then polishes builder/schema contracts and fixes Greptile P1 regressions for the npm release cut.
API parity (commits 1–2)
prompt_id, eight Notification types, Stop/SubagentStop registries and dual feedback modes, six permission-update variants, event-aware handler matrix, tool-input deltas, and project docs.source: "compact"), MCP names enforcemcp__server__tool, dead retry helpers removed.docs/internal/feat-hook-api-parity-review.md(historical mid-flight notes ate67fb61) and updateddocs/internal/api-update-checklist.md.Release polish (commit 3 — adversarial review fixes)
feedback()stays block; newpostToolUseContext()for official replace/context-only output (nodecision)failureContext()for PostToolUseFailure context-only;failureFeedback()remains blockhookSpecificOutput; tests assert reject (no false-green)taskBlock/teammateStopmatch universal{ continue: false, stopReason }only.strict()); Task vs Agent isolation docs;sessionStartContextpreserves empty strings / emptywatchPathsGreptile P1 fixes (commit 4)
savePreCompactContextwrite: detailed body + abbreviated board{title}/{message}/{priority}/{icon}expansion; keepCLAUDE_NOTIFICATION_*env exportsBuilder surface (block vs non-block)
Test plan
pnpm run type-checkpnpm run lint(0 errors; 1 pre-existing warning insubagent-stop.ts)pnpm run test:run(34 files / 1426 tests)pnpm run build(prior commit; type-check green on latest)pnpm run docs:sync-upstreamand re-diff if Claude Code docs moved after 2026-07-12Notes
plans/agent scratch or local.grok/workflow definitions.docs/upstream/are official Anthropic content used as audit inputs.Greptile Summary
This update expands Claude Code hook API parity across types, validation, output builders, lifecycle handlers, and documentation.
Two changed runtime paths were exercised directly:
No defects were found.
Confidence Score: 5/5
What T-Rex did
Reviews (4): Last reviewed commit: "fix(hooks): quote-aware notification pla..." | Re-trigger Greptile