[{"data":1,"prerenderedAt":1169},["ShallowReactive",2],{"guide:/guides/claude-code-hook-events":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"tag":10,"date":11,"body":12,"_type":1163,"_id":1164,"_source":1165,"_file":1166,"_stem":1167,"_extension":1168},"/guides/claude-code-hook-events","guides",false,"","What every Claude Code hook event means","A reference for each Claude Code hook event (SessionStart, PreToolUse, PostToolUse, Notification, Stop, SubagentStop, PreCompact and more), with when it fires and what to use it for.","Hooks","2026-08-15",{"type":13,"children":14,"toc":1146},"root",[15,32,39,77,83,94,131,285,295,338,348,406,416,454,616,626,654,664,700,710,729,739,776,786,806,812,824,992,997,1003,1060,1066,1127,1140],{"type":16,"tag":17,"props":18,"children":19},"element","p",{},[20,23,30],{"type":21,"value":22},"text","Claude Code fires a hook at each meaningful point in a session. If you already know how hooks are wired up (see the ",{"type":16,"tag":24,"props":25,"children":27},"a",{"href":26},"/guides/claude-code-hooks",[28],{"type":21,"value":29},"complete guide to Claude Code hooks",{"type":21,"value":31},"), this page is the reference: what each event means, when it fires, what it carries, and what it is good for.",{"type":16,"tag":33,"props":34,"children":36},"h2",{"id":35},"what-every-event-carries",[37],{"type":21,"value":38},"What every event carries",{"type":16,"tag":17,"props":40,"children":41},{},[42,44,51,53,59,61,67,69,75],{"type":21,"value":43},"Whatever the event, your command receives a JSON object on standard input with the same four base fields: ",{"type":16,"tag":45,"props":46,"children":48},"code",{"className":47},[],[49],{"type":21,"value":50},"session_id",{"type":21,"value":52},", ",{"type":16,"tag":45,"props":54,"children":56},{"className":55},[],[57],{"type":21,"value":58},"transcript_path",{"type":21,"value":60}," (the session's log on disk), ",{"type":16,"tag":45,"props":62,"children":64},{"className":63},[],[65],{"type":21,"value":66},"cwd",{"type":21,"value":68}," (the directory the session runs in), and ",{"type":16,"tag":45,"props":70,"children":72},{"className":71},[],[73],{"type":21,"value":74},"hook_event_name",{"type":21,"value":76},". Everything below is what each event adds on top.",{"type":16,"tag":33,"props":78,"children":80},{"id":79},"the-session-lifecycle-event-by-event",[81],{"type":21,"value":82},"The session lifecycle, event by event",{"type":16,"tag":84,"props":85,"children":87},"h3",{"id":86},"sessionstart",[88],{"type":16,"tag":45,"props":89,"children":91},{"className":90},[],[92],{"type":21,"value":93},"SessionStart",{"type":16,"tag":17,"props":95,"children":96},{},[97,99,105,107,113,115,121,123,129],{"type":21,"value":98},"Fires when a session opens. The payload adds ",{"type":16,"tag":45,"props":100,"children":102},{"className":101},[],[103],{"type":21,"value":104},"source",{"type":21,"value":106},", telling you ",{"type":16,"tag":108,"props":109,"children":110},"em",{},[111],{"type":21,"value":112},"how",{"type":21,"value":114}," it opened: a fresh start, a resume, a ",{"type":16,"tag":45,"props":116,"children":118},{"className":117},[],[119],{"type":21,"value":120},"/clear",{"type":21,"value":122},", or a restart after a compaction. Good for setting up state, logging that a session began, or announcing a new agent. Anything your command prints on ",{"type":16,"tag":45,"props":124,"children":126},{"className":125},[],[127],{"type":21,"value":128},"stdout",{"type":21,"value":130}," is added to Claude's context, which makes this the place to inject the current branch, an open ticket number, or a deploy status.",{"type":16,"tag":132,"props":133,"children":137},"pre",{"className":134,"code":135,"language":136,"meta":7,"style":7},"language-json shiki shiki-themes github-light github-dark","{\n  \"hooks\": {\n    \"SessionStart\": [\n      { \"hooks\": [{ \"type\": \"command\", \"command\": \"echo \\\"Current branch: $(git branch --show-current)\\\"\" }] }\n    ]\n  }\n}\n","json",[138],{"type":16,"tag":45,"props":139,"children":140},{"__ignoreMap":7},[141,153,168,182,258,267,276],{"type":16,"tag":142,"props":143,"children":146},"span",{"class":144,"line":145},"line",1,[147],{"type":16,"tag":142,"props":148,"children":150},{"style":149},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[151],{"type":21,"value":152},"{\n",{"type":16,"tag":142,"props":154,"children":156},{"class":144,"line":155},2,[157,163],{"type":16,"tag":142,"props":158,"children":160},{"style":159},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[161],{"type":21,"value":162},"  \"hooks\"",{"type":16,"tag":142,"props":164,"children":165},{"style":149},[166],{"type":21,"value":167},": {\n",{"type":16,"tag":142,"props":169,"children":171},{"class":144,"line":170},3,[172,177],{"type":16,"tag":142,"props":173,"children":174},{"style":159},[175],{"type":21,"value":176},"    \"SessionStart\"",{"type":16,"tag":142,"props":178,"children":179},{"style":149},[180],{"type":21,"value":181},": [\n",{"type":16,"tag":142,"props":183,"children":185},{"class":144,"line":184},4,[186,191,196,201,206,211,217,221,225,229,234,239,244,248,253],{"type":16,"tag":142,"props":187,"children":188},{"style":149},[189],{"type":21,"value":190},"      { ",{"type":16,"tag":142,"props":192,"children":193},{"style":159},[194],{"type":21,"value":195},"\"hooks\"",{"type":16,"tag":142,"props":197,"children":198},{"style":149},[199],{"type":21,"value":200},": [{ ",{"type":16,"tag":142,"props":202,"children":203},{"style":159},[204],{"type":21,"value":205},"\"type\"",{"type":16,"tag":142,"props":207,"children":208},{"style":149},[209],{"type":21,"value":210},": ",{"type":16,"tag":142,"props":212,"children":214},{"style":213},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[215],{"type":21,"value":216},"\"command\"",{"type":16,"tag":142,"props":218,"children":219},{"style":149},[220],{"type":21,"value":52},{"type":16,"tag":142,"props":222,"children":223},{"style":159},[224],{"type":21,"value":216},{"type":16,"tag":142,"props":226,"children":227},{"style":149},[228],{"type":21,"value":210},{"type":16,"tag":142,"props":230,"children":231},{"style":213},[232],{"type":21,"value":233},"\"echo ",{"type":16,"tag":142,"props":235,"children":236},{"style":159},[237],{"type":21,"value":238},"\\\"",{"type":16,"tag":142,"props":240,"children":241},{"style":213},[242],{"type":21,"value":243},"Current branch: $(git branch --show-current)",{"type":16,"tag":142,"props":245,"children":246},{"style":159},[247],{"type":21,"value":238},{"type":16,"tag":142,"props":249,"children":250},{"style":213},[251],{"type":21,"value":252},"\"",{"type":16,"tag":142,"props":254,"children":255},{"style":149},[256],{"type":21,"value":257}," }] }\n",{"type":16,"tag":142,"props":259,"children":261},{"class":144,"line":260},5,[262],{"type":16,"tag":142,"props":263,"children":264},{"style":149},[265],{"type":21,"value":266},"    ]\n",{"type":16,"tag":142,"props":268,"children":270},{"class":144,"line":269},6,[271],{"type":16,"tag":142,"props":272,"children":273},{"style":149},[274],{"type":21,"value":275},"  }\n",{"type":16,"tag":142,"props":277,"children":279},{"class":144,"line":278},7,[280],{"type":16,"tag":142,"props":281,"children":282},{"style":149},[283],{"type":21,"value":284},"}\n",{"type":16,"tag":84,"props":286,"children":288},{"id":287},"userpromptsubmit",[289],{"type":16,"tag":45,"props":290,"children":292},{"className":291},[],[293],{"type":21,"value":294},"UserPromptSubmit",{"type":16,"tag":17,"props":296,"children":297},{},[298,300,306,308,314,316,321,323,328,330,336],{"type":21,"value":299},"Fires when you submit a prompt and a new turn begins, ",{"type":16,"tag":301,"props":302,"children":303},"strong",{},[304],{"type":21,"value":305},"before",{"type":21,"value":307}," Claude sees it. The payload adds ",{"type":16,"tag":45,"props":309,"children":311},{"className":310},[],[312],{"type":21,"value":313},"prompt",{"type":21,"value":315},", the text you typed. This is your \"the agent just started working\" signal: use it to mark a session as busy or to timestamp the start of a turn. Like ",{"type":16,"tag":45,"props":317,"children":319},{"className":318},[],[320],{"type":21,"value":93},{"type":21,"value":322},", its ",{"type":16,"tag":45,"props":324,"children":326},{"className":325},[],[327],{"type":21,"value":128},{"type":21,"value":329}," is appended to the context, and exiting with code ",{"type":16,"tag":45,"props":331,"children":333},{"className":332},[],[334],{"type":21,"value":335},"2",{"type":21,"value":337}," cancels the prompt entirely, which is a blunt but effective way to enforce a house rule.",{"type":16,"tag":84,"props":339,"children":341},{"id":340},"pretooluse",[342],{"type":16,"tag":45,"props":343,"children":345},{"className":344},[],[346],{"type":21,"value":347},"PreToolUse",{"type":16,"tag":17,"props":349,"children":350},{},[351,353,358,360,366,368,374,376,381,383,388,390,396,398,404],{"type":21,"value":352},"Fires ",{"type":16,"tag":301,"props":354,"children":355},{},[356],{"type":21,"value":357},"just before",{"type":21,"value":359}," Claude runs a tool (Bash, Edit, Read, Write, and so on). The payload adds ",{"type":16,"tag":45,"props":361,"children":363},{"className":362},[],[364],{"type":21,"value":365},"tool_name",{"type":21,"value":367}," and ",{"type":16,"tag":45,"props":369,"children":371},{"className":370},[],[372],{"type":21,"value":373},"tool_input",{"type":21,"value":375},", the exact arguments about to be used. Because it runs before the tool, it is the only event that can ",{"type":16,"tag":301,"props":377,"children":378},{},[379],{"type":21,"value":380},"inspect and gate",{"type":21,"value":382}," a tool call: exit ",{"type":16,"tag":45,"props":384,"children":386},{"className":385},[],[387],{"type":21,"value":335},{"type":21,"value":389}," to block it, or print a JSON decision to allow, deny or force a prompt. Its ",{"type":16,"tag":45,"props":391,"children":393},{"className":392},[],[394],{"type":21,"value":395},"matcher",{"type":21,"value":397}," selects which tools trigger it. See ",{"type":16,"tag":24,"props":399,"children":401},{"href":400},"/guides/claude-code-pretooluse-hook",[402],{"type":21,"value":403},"gate tool calls with the PreToolUse hook",{"type":21,"value":405}," for the details.",{"type":16,"tag":84,"props":407,"children":409},{"id":408},"posttooluse",[410],{"type":16,"tag":45,"props":411,"children":413},{"className":412},[],[414],{"type":21,"value":415},"PostToolUse",{"type":16,"tag":17,"props":417,"children":418},{},[419,420,425,427,432,433,438,439,445,447,452],{"type":21,"value":352},{"type":16,"tag":301,"props":421,"children":422},{},[423],{"type":21,"value":424},"right after",{"type":21,"value":426}," a tool call returns, with ",{"type":16,"tag":45,"props":428,"children":430},{"className":429},[],[431],{"type":21,"value":365},{"type":21,"value":52},{"type":16,"tag":45,"props":434,"children":436},{"className":435},[],[437],{"type":21,"value":373},{"type":21,"value":367},{"type":16,"tag":45,"props":440,"children":442},{"className":441},[],[443],{"type":21,"value":444},"tool_response",{"type":21,"value":446},". Use it to react to what a tool did: run a formatter after an edit, a linter after a write, or simply note that the agent is still working. Blocking here does not undo the tool call, but exit code ",{"type":16,"tag":45,"props":448,"children":450},{"className":449},[],[451],{"type":21,"value":335},{"type":21,"value":453}," feeds your message back to Claude, so a failing linter can push it to fix its own edit:",{"type":16,"tag":132,"props":455,"children":457},{"className":134,"code":456,"language":136,"meta":7,"style":7},"{\n  \"hooks\": {\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Edit|Write\",\n        \"hooks\": [{ \"type\": \"command\", \"command\": \"npx prettier --write \\\"$CLAUDE_PROJECT_DIR\\\"\" }]\n      }\n    ]\n  }\n}\n",[458],{"type":16,"tag":45,"props":459,"children":460},{"__ignoreMap":7},[461,468,479,491,499,521,584,592,600,608],{"type":16,"tag":142,"props":462,"children":463},{"class":144,"line":145},[464],{"type":16,"tag":142,"props":465,"children":466},{"style":149},[467],{"type":21,"value":152},{"type":16,"tag":142,"props":469,"children":470},{"class":144,"line":155},[471,475],{"type":16,"tag":142,"props":472,"children":473},{"style":159},[474],{"type":21,"value":162},{"type":16,"tag":142,"props":476,"children":477},{"style":149},[478],{"type":21,"value":167},{"type":16,"tag":142,"props":480,"children":481},{"class":144,"line":170},[482,487],{"type":16,"tag":142,"props":483,"children":484},{"style":159},[485],{"type":21,"value":486},"    \"PostToolUse\"",{"type":16,"tag":142,"props":488,"children":489},{"style":149},[490],{"type":21,"value":181},{"type":16,"tag":142,"props":492,"children":493},{"class":144,"line":184},[494],{"type":16,"tag":142,"props":495,"children":496},{"style":149},[497],{"type":21,"value":498},"      {\n",{"type":16,"tag":142,"props":500,"children":501},{"class":144,"line":260},[502,507,511,516],{"type":16,"tag":142,"props":503,"children":504},{"style":159},[505],{"type":21,"value":506},"        \"matcher\"",{"type":16,"tag":142,"props":508,"children":509},{"style":149},[510],{"type":21,"value":210},{"type":16,"tag":142,"props":512,"children":513},{"style":213},[514],{"type":21,"value":515},"\"Edit|Write\"",{"type":16,"tag":142,"props":517,"children":518},{"style":149},[519],{"type":21,"value":520},",\n",{"type":16,"tag":142,"props":522,"children":523},{"class":144,"line":269},[524,529,533,537,541,545,549,553,557,562,566,571,575,579],{"type":16,"tag":142,"props":525,"children":526},{"style":159},[527],{"type":21,"value":528},"        \"hooks\"",{"type":16,"tag":142,"props":530,"children":531},{"style":149},[532],{"type":21,"value":200},{"type":16,"tag":142,"props":534,"children":535},{"style":159},[536],{"type":21,"value":205},{"type":16,"tag":142,"props":538,"children":539},{"style":149},[540],{"type":21,"value":210},{"type":16,"tag":142,"props":542,"children":543},{"style":213},[544],{"type":21,"value":216},{"type":16,"tag":142,"props":546,"children":547},{"style":149},[548],{"type":21,"value":52},{"type":16,"tag":142,"props":550,"children":551},{"style":159},[552],{"type":21,"value":216},{"type":16,"tag":142,"props":554,"children":555},{"style":149},[556],{"type":21,"value":210},{"type":16,"tag":142,"props":558,"children":559},{"style":213},[560],{"type":21,"value":561},"\"npx prettier --write ",{"type":16,"tag":142,"props":563,"children":564},{"style":159},[565],{"type":21,"value":238},{"type":16,"tag":142,"props":567,"children":568},{"style":213},[569],{"type":21,"value":570},"$CLAUDE_PROJECT_DIR",{"type":16,"tag":142,"props":572,"children":573},{"style":159},[574],{"type":21,"value":238},{"type":16,"tag":142,"props":576,"children":577},{"style":213},[578],{"type":21,"value":252},{"type":16,"tag":142,"props":580,"children":581},{"style":149},[582],{"type":21,"value":583}," }]\n",{"type":16,"tag":142,"props":585,"children":586},{"class":144,"line":278},[587],{"type":16,"tag":142,"props":588,"children":589},{"style":149},[590],{"type":21,"value":591},"      }\n",{"type":16,"tag":142,"props":593,"children":595},{"class":144,"line":594},8,[596],{"type":16,"tag":142,"props":597,"children":598},{"style":149},[599],{"type":21,"value":266},{"type":16,"tag":142,"props":601,"children":603},{"class":144,"line":602},9,[604],{"type":16,"tag":142,"props":605,"children":606},{"style":149},[607],{"type":21,"value":275},{"type":16,"tag":142,"props":609,"children":611},{"class":144,"line":610},10,[612],{"type":16,"tag":142,"props":613,"children":614},{"style":149},[615],{"type":21,"value":284},{"type":16,"tag":84,"props":617,"children":619},{"id":618},"notification",[620],{"type":16,"tag":45,"props":621,"children":623},{"className":622},[],[624],{"type":21,"value":625},"Notification",{"type":16,"tag":17,"props":627,"children":628},{},[629,631,637,639,645,647,652],{"type":21,"value":630},"Fires when Claude needs your attention: most commonly to ask you to approve a step it cannot take on its own, and also when a prompt has been sitting idle for a while. The payload adds ",{"type":16,"tag":45,"props":632,"children":634},{"className":633},[],[635],{"type":21,"value":636},"message",{"type":21,"value":638},", the text Claude would have shown you. This is the event to wire to a ",{"type":16,"tag":24,"props":640,"children":642},{"href":641},"/guides/claude-code-notifications",[643],{"type":21,"value":644},"desktop notification",{"type":21,"value":646},": it means a session is blocked on ",{"type":16,"tag":301,"props":648,"children":649},{},[650],{"type":21,"value":651},"you",{"type":21,"value":653},", and every minute it waits is wasted.",{"type":16,"tag":84,"props":655,"children":657},{"id":656},"stop",[658],{"type":16,"tag":45,"props":659,"children":661},{"className":660},[],[662],{"type":21,"value":663},"Stop",{"type":16,"tag":17,"props":665,"children":666},{},[667,669,675,677,683,685,690,692,698],{"type":21,"value":668},"Fires when Claude finishes its turn and hands control back. This is the \"run is done\" signal, the one most people want first. The payload adds ",{"type":16,"tag":45,"props":670,"children":672},{"className":671},[],[673],{"type":21,"value":674},"stop_hook_active",{"type":21,"value":676},", which is ",{"type":16,"tag":45,"props":678,"children":680},{"className":679},[],[681],{"type":21,"value":682},"true",{"type":21,"value":684}," when the turn is already continuing because of a previous ",{"type":16,"tag":45,"props":686,"children":688},{"className":687},[],[689],{"type":21,"value":663},{"type":21,"value":691}," hook. Check it before blocking, or you will build an infinite loop. Full write-up in ",{"type":16,"tag":24,"props":693,"children":695},{"href":694},"/guides/claude-code-stop-hook",[696],{"type":21,"value":697},"the Claude Code Stop hook, explained",{"type":21,"value":699},".",{"type":16,"tag":84,"props":701,"children":703},{"id":702},"subagentstop",[704],{"type":16,"tag":45,"props":705,"children":707},{"className":706},[],[708],{"type":21,"value":709},"SubagentStop",{"type":16,"tag":17,"props":711,"children":712},{},[713,715,720,722,728],{"type":21,"value":714},"Fires when a subagent, spawned through the Task tool, finishes, distinct from ",{"type":16,"tag":45,"props":716,"children":718},{"className":717},[],[719],{"type":21,"value":663},{"type":21,"value":721},", which only fires when the whole turn ends. On a run that fans work out to several subagents, this lets you track them completing independently. More in ",{"type":16,"tag":24,"props":723,"children":725},{"href":724},"/guides/claude-code-subagents",[726],{"type":21,"value":727},"understanding Claude Code subagents",{"type":21,"value":699},{"type":16,"tag":84,"props":730,"children":732},{"id":731},"precompact",[733],{"type":16,"tag":45,"props":734,"children":736},{"className":735},[],[737],{"type":21,"value":738},"PreCompact",{"type":16,"tag":17,"props":740,"children":741},{},[742,744,750,752,758,760,766,768,774],{"type":21,"value":743},"Fires when Claude compacts the context on a long run to keep going. The payload adds ",{"type":16,"tag":45,"props":745,"children":747},{"className":746},[],[748],{"type":21,"value":749},"trigger",{"type":21,"value":751},", either ",{"type":16,"tag":45,"props":753,"children":755},{"className":754},[],[756],{"type":21,"value":757},"manual",{"type":21,"value":759}," (you typed ",{"type":16,"tag":45,"props":761,"children":763},{"className":762},[],[764],{"type":21,"value":765},"/compact",{"type":21,"value":767},") or ",{"type":16,"tag":45,"props":769,"children":771},{"className":770},[],[772],{"type":21,"value":773},"auto",{"type":21,"value":775}," (the window filled up). It is a good marker that a session is mid-maintenance rather than idle or stuck, and a decent cue that the session has been running long enough to be worth splitting.",{"type":16,"tag":84,"props":777,"children":779},{"id":778},"sessionend",[780],{"type":16,"tag":45,"props":781,"children":783},{"className":782},[],[784],{"type":21,"value":785},"SessionEnd",{"type":16,"tag":17,"props":787,"children":788},{},[789,791,797,799,804],{"type":21,"value":790},"Fires when the session closes, with ",{"type":16,"tag":45,"props":792,"children":794},{"className":793},[],[795],{"type":21,"value":796},"reason",{"type":21,"value":798}," explaining why. The counterpart to ",{"type":16,"tag":45,"props":800,"children":802},{"className":801},[],[803],{"type":21,"value":93},{"type":21,"value":805},": clean up state, close a log, or remove whatever you showed for that session. It cannot block the shutdown, so keep it to teardown.",{"type":16,"tag":33,"props":807,"children":809},{"id":808},"which-matcher-applies-where",[810],{"type":21,"value":811},"Which matcher applies where",{"type":16,"tag":17,"props":813,"children":814},{},[815,817,822],{"type":21,"value":816},"Only the tool events take a ",{"type":16,"tag":45,"props":818,"children":820},{"className":819},[],[821],{"type":21,"value":395},{"type":21,"value":823},", tested as a regular expression against the tool name:",{"type":16,"tag":825,"props":826,"children":827},"table",{},[828,852],{"type":16,"tag":829,"props":830,"children":831},"thead",{},[832],{"type":16,"tag":833,"props":834,"children":835},"tr",{},[836,842,847],{"type":16,"tag":837,"props":838,"children":839},"th",{},[840],{"type":21,"value":841},"Event",{"type":16,"tag":837,"props":843,"children":844},{},[845],{"type":21,"value":846},"Matcher",{"type":16,"tag":837,"props":848,"children":849},{},[850],{"type":21,"value":851},"Typical values",{"type":16,"tag":853,"props":854,"children":855},"tbody",{},[856,909,942,973],{"type":16,"tag":833,"props":857,"children":858},{},[859,874,879],{"type":16,"tag":860,"props":861,"children":862},"td",{},[863,868,869],{"type":16,"tag":45,"props":864,"children":866},{"className":865},[],[867],{"type":21,"value":347},{"type":21,"value":52},{"type":16,"tag":45,"props":870,"children":872},{"className":871},[],[873],{"type":21,"value":415},{"type":16,"tag":860,"props":875,"children":876},{},[877],{"type":21,"value":878},"Yes",{"type":16,"tag":860,"props":880,"children":881},{},[882,888,889,895,896,902,903],{"type":16,"tag":45,"props":883,"children":885},{"className":884},[],[886],{"type":21,"value":887},"Bash",{"type":21,"value":52},{"type":16,"tag":45,"props":890,"children":892},{"className":891},[],[893],{"type":21,"value":894},"Edit|Write",{"type":21,"value":52},{"type":16,"tag":45,"props":897,"children":899},{"className":898},[],[900],{"type":21,"value":901},"mcp__.*",{"type":21,"value":52},{"type":16,"tag":45,"props":904,"children":906},{"className":905},[],[907],{"type":21,"value":908},".*",{"type":16,"tag":833,"props":910,"children":911},{},[912,932,937],{"type":16,"tag":860,"props":913,"children":914},{},[915,920,921,926,927],{"type":16,"tag":45,"props":916,"children":918},{"className":917},[],[919],{"type":21,"value":625},{"type":21,"value":52},{"type":16,"tag":45,"props":922,"children":924},{"className":923},[],[925],{"type":21,"value":663},{"type":21,"value":52},{"type":16,"tag":45,"props":928,"children":930},{"className":929},[],[931],{"type":21,"value":709},{"type":16,"tag":860,"props":933,"children":934},{},[935],{"type":21,"value":936},"No",{"type":16,"tag":860,"props":938,"children":939},{},[940],{"type":21,"value":941},"omit the key",{"type":16,"tag":833,"props":943,"children":944},{},[945,965,969],{"type":16,"tag":860,"props":946,"children":947},{},[948,953,954,959,960],{"type":16,"tag":45,"props":949,"children":951},{"className":950},[],[952],{"type":21,"value":93},{"type":21,"value":52},{"type":16,"tag":45,"props":955,"children":957},{"className":956},[],[958],{"type":21,"value":785},{"type":21,"value":52},{"type":16,"tag":45,"props":961,"children":963},{"className":962},[],[964],{"type":21,"value":738},{"type":16,"tag":860,"props":966,"children":967},{},[968],{"type":21,"value":936},{"type":16,"tag":860,"props":970,"children":971},{},[972],{"type":21,"value":941},{"type":16,"tag":833,"props":974,"children":975},{},[976,984,988],{"type":16,"tag":860,"props":977,"children":978},{},[979],{"type":16,"tag":45,"props":980,"children":982},{"className":981},[],[983],{"type":21,"value":294},{"type":16,"tag":860,"props":985,"children":986},{},[987],{"type":21,"value":936},{"type":16,"tag":860,"props":989,"children":990},{},[991],{"type":21,"value":941},{"type":16,"tag":17,"props":993,"children":994},{},[995],{"type":21,"value":996},"Leaving the matcher out on a lifecycle event runs the hooks every time, which is what you want.",{"type":16,"tag":33,"props":998,"children":1000},{"id":999},"which-events-can-block",[1001],{"type":21,"value":1002},"Which events can block",{"type":16,"tag":17,"props":1004,"children":1005},{},[1006,1008,1013,1015,1020,1022,1027,1028,1033,1035,1040,1041,1046,1047,1052,1053,1058],{"type":21,"value":1007},"Not every event can influence the run. ",{"type":16,"tag":45,"props":1009,"children":1011},{"className":1010},[],[1012],{"type":21,"value":347},{"type":21,"value":1014}," can cancel a tool call before it happens. ",{"type":16,"tag":45,"props":1016,"children":1018},{"className":1017},[],[1019],{"type":21,"value":294},{"type":21,"value":1021}," can cancel a prompt. ",{"type":16,"tag":45,"props":1023,"children":1025},{"className":1024},[],[1026],{"type":21,"value":415},{"type":21,"value":367},{"type":16,"tag":45,"props":1029,"children":1031},{"className":1030},[],[1032],{"type":21,"value":663},{"type":21,"value":1034}," cannot undo what happened, but they can send a message back to Claude and ask it to keep going. ",{"type":16,"tag":45,"props":1036,"children":1038},{"className":1037},[],[1039],{"type":21,"value":625},{"type":21,"value":52},{"type":16,"tag":45,"props":1042,"children":1044},{"className":1043},[],[1045],{"type":21,"value":738},{"type":21,"value":52},{"type":16,"tag":45,"props":1048,"children":1050},{"className":1049},[],[1051],{"type":21,"value":93},{"type":21,"value":367},{"type":16,"tag":45,"props":1054,"children":1056},{"className":1055},[],[1057],{"type":21,"value":785},{"type":21,"value":1059}," are observational: whatever they return, the session carries on.",{"type":16,"tag":33,"props":1061,"children":1063},{"id":1062},"reading-a-session-as-states",[1064],{"type":21,"value":1065},"Reading a session as states",{"type":16,"tag":17,"props":1067,"children":1068},{},[1069,1071,1076,1078,1083,1085,1090,1092,1097,1099,1104,1106,1111,1113,1118,1120,1125],{"type":21,"value":1070},"Line these events up and a session tells a story: it starts (",{"type":16,"tag":45,"props":1072,"children":1074},{"className":1073},[],[1075],{"type":21,"value":93},{"type":21,"value":1077},"), you prompt it (",{"type":16,"tag":45,"props":1079,"children":1081},{"className":1080},[],[1082],{"type":21,"value":294},{"type":21,"value":1084},"), it works through tools (",{"type":16,"tag":45,"props":1086,"children":1088},{"className":1087},[],[1089],{"type":21,"value":347},{"type":21,"value":1091}," / ",{"type":16,"tag":45,"props":1093,"children":1095},{"className":1094},[],[1096],{"type":21,"value":415},{"type":21,"value":1098},"), it may pause for you (",{"type":16,"tag":45,"props":1100,"children":1102},{"className":1101},[],[1103],{"type":21,"value":625},{"type":21,"value":1105},"), it compacts on long runs (",{"type":16,"tag":45,"props":1107,"children":1109},{"className":1108},[],[1110],{"type":21,"value":738},{"type":21,"value":1112},"), and it finishes (",{"type":16,"tag":45,"props":1114,"children":1116},{"className":1115},[],[1117],{"type":21,"value":663},{"type":21,"value":1119},") before eventually closing (",{"type":16,"tag":45,"props":1121,"children":1123},{"className":1122},[],[1124],{"type":21,"value":785},{"type":21,"value":1126},").",{"type":16,"tag":17,"props":1128,"children":1129},{},[1130,1132,1138],{"type":21,"value":1131},"That mapping from events to states is exactly what ",{"type":16,"tag":24,"props":1133,"children":1135},{"href":1134},"/",[1136],{"type":21,"value":1137},"Blooby",{"type":21,"value":1139}," does automatically. It registers a hook on every event above and turns the stream into a live desktop mascot per session: idle, working, needs-you, compacting, done. You do not write any of the hooks yourself; you just watch the corner of your screen.",{"type":16,"tag":1141,"props":1142,"children":1143},"style",{},[1144],{"type":21,"value":1145},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":7,"searchDepth":155,"depth":155,"links":1147},[1148,1149,1160,1161,1162],{"id":35,"depth":155,"text":38},{"id":79,"depth":155,"text":82,"children":1150},[1151,1152,1153,1154,1155,1156,1157,1158,1159],{"id":86,"depth":170,"text":93},{"id":287,"depth":170,"text":294},{"id":340,"depth":170,"text":347},{"id":408,"depth":170,"text":415},{"id":618,"depth":170,"text":625},{"id":656,"depth":170,"text":663},{"id":702,"depth":170,"text":709},{"id":731,"depth":170,"text":738},{"id":778,"depth":170,"text":785},{"id":808,"depth":155,"text":811},{"id":999,"depth":155,"text":1002},{"id":1062,"depth":155,"text":1065},"markdown","content:guides:claude-code-hook-events.md","content","guides/claude-code-hook-events.md","guides/claude-code-hook-events","md",1]