feat(go): complete Go kernel — full TS hook parity, 145x faster#1300
Merged
feat(go): complete Go kernel — full TS hook parity, 145x faster#1300
Conversation
Go kernel now handles all Claude Code hook events with full feature parity: - PreToolUse: policy eval, invariant checking, enforcement mode routing (enforce/guide/educate/monitor), read-only tool fail-open, session state, identity wizard, retry tracking, cloud telemetry, lesson capture - PostToolUse: bash error reporting, format/test pass tracking, PR detection - Stop: session viewer generation, root session cleanup - Notification: live session viewer spawn New files: env.go, session.go, identity.go, lesson.go, telemetry.go Key fix: FromStdin() fallback — Claude Code sends payloads via stdin, not env vars. This was the root cause of Go fast-path never executing. Performance: 2ms Go vs 290ms TS — 145x faster hook evaluation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jpleva91
added a commit
that referenced
this pull request
Mar 29, 2026
- Health: yellow — PR #1303 (sprint #955/#957) CONFLICTING after PR #1300 merged - PR #1300 MERGED: complete Go kernel (145x faster, 2ms vs 290ms) — major milestone - PR #1295 MERGED: bootstrap catch-22 fix (#995) - PR #1296 MERGED: site-only PR CI skip fix (#1267) - PR #969 MERGED: fix claude-init binary path (closes #964) - PR #1303: sprint work CONFLICTING — senior must assess rebase vs close - No P0/P1 issues open - PR #1317 (Gemini tests, 4/4 CI green, copilot squad): ready for human review - Dogfood #1323 filed: pnpm install --frozen-lockfile bootstrap hang in non-TTY Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
FromStdin()fallback — Claude Code sends payloads via stdin, not env vars. The Go fast-path was never actually executing.New Go files (975 lines added)
env.go— .env loading (AGENTGUARD_* vars from project root)session.go— session state persistence (format/test pass, written files, retry counts) + root session trackingidentity.go— agent identity resolution + wizard promptlesson.go— denial lesson capture for educate mode learningtelemetry.go— cloud telemetry client (async HTTP, 2s timeout)Key changes
types.go—FromStdin()reads JSON from stdin when env vars aren't sethandler.go— monitor/guide/educate/enforce mode routing, read-only tool fail-open, invariant checking, retry trackingclaude.go— full PreToolUse/PostToolUse/Stop/Notification event handlingTest plan
go test ./...)🤖 Generated with Claude Code