Repository navigation
A Claude Code recipe: hooks that turn coding sessions into verified lessons (story 28.9) - #226
Merged
Merged
Conversation
… (story 28.9) aexp hook <event> handles SessionStart, UserPromptSubmit, PostToolUse, PostToolUseFailure, Stop and SessionEnd from the hook JSON on stdin; Stop finalizes the turn's run on the configured verifier inside the hook's time (an untrusted config records and injects but never runs it). aexp setup claude-code merges the hooks into .claude/settings.json, writes a default config and the .gitignore entry. aexp export --claude-md/--agents-md keeps a fenced, byte-stable section of the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
…tory 28.9) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
…ent (story 28.9) Tool results in a coding session are file contents and command output; the hooks pass them to capture only when a recipe consent for the tool asks for its result excerpt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
Pin each session to one holdout arm (run IDs drawn in the session's arm, fail closed past the bound); parse hook arguments inside the hook so every outcome exits 0; refuse without CLAUDE_PROJECT_DIR; keep a run linked when recall fails; configurable read-only tools and Bash prefixes; deny rules for user settings covering .aexp, .claude, the trust file and aexp trust; settings written through links with BOM, CRLF and mode kept; managed section under a lock, keeping mode and ownership; prune stale sessions; deterministic timeout tests and the listed test gaps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
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.
Story 28.9 of Epic 28. Built on the
aexptool (28.8).aexp hook <event>for Claude Code hooks (reference: code.claude.com/docs/en/hooks, fetched 2026-10-30): the first prompt opens a run and gets the Historical Reference block;PostToolUse/PostToolUseFailurerecord each call (allowed arguments only; results only under a recipe consent) and give the failure hint;Stopends a turn that changed something and finalizes it on the configured verifier (never the model's word), reporting with a one-linesystemMessageonly;SessionEndstores an open run for a lateraexp finalize. Every hook exits 0 and logs to an owner-only.aexp/hook.logwithout prompts or tool content.setupprints deny rules for user settings protecting.aexp/,.claude/, the trust file andaexp trust, and says plainly that Bash write paths stay open unless Bash is restricted.aexp setup claude-code: merges hooks into.claude/settings.jsonwithout removing anything (keeps escaping, BOM, CRLF, mode, symlinks), writes a default config only when none exists (verifier detected for dotnet/npm/pytest/go, else a placeholder that refuses to run), ignores.aexp/.CLAUDE.md/AGENTS.mdsection with the measured-helpful lessons: only the fenced section changes, byte-stable, locked, mode kept.Tests: Cli.Tests 97 (recorded hook inputs in the documented shapes, the built tool over real stdin), every Docker-free project, pack and verify-packages.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy