[{"data":1,"prerenderedAt":1957},["ShallowReactive",2],{"guide:/guides/claude-code-hooks":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"tag":10,"date":11,"body":12,"_type":1951,"_id":1952,"_source":1953,"_file":1954,"_stem":1955,"_extension":1956},"/guides/claude-code-hooks","guides",false,"","Claude Code hooks: the complete guide","What Claude Code hooks are, every lifecycle event they fire on, how to configure them in settings.json, and practical examples you can copy.","Hooks","2026-08-15",{"type":13,"children":14,"toc":1938},"root",[15,23,28,35,48,62,68,89,146,151,316,343,356,362,367,548,561,567,594,846,857,863,868,964,1025,1174,1179,1185,1198,1361,1514,1525,1531,1536,1607,1626,1645,1651,1663,1829,1841,1847,1875,1881,1893,1899,1927,1932],{"type":16,"tag":17,"props":18,"children":19},"element","p",{},[20],{"type":21,"value":22},"text","Claude Code hooks let you run your own shell command every time the agent reaches a point in its lifecycle: it starts a session, calls a tool, needs your permission, finishes a turn. They are the official, supported way to react to what Claude Code is doing without polling anything or parsing its output.",{"type":16,"tag":17,"props":24,"children":25},{},[26],{"type":21,"value":27},"This guide covers what hooks are, every event they fire on, how to configure them, what your command receives, how it can talk back, and a few examples you can paste straight into your settings.",{"type":16,"tag":29,"props":30,"children":32},"h2",{"id":31},"what-a-hook-actually-is",[33],{"type":21,"value":34},"What a hook actually is",{"type":16,"tag":17,"props":36,"children":37},{},[38,40,46],{"type":21,"value":39},"A hook is a ",{"type":16,"tag":41,"props":42,"children":43},"strong",{},[44],{"type":21,"value":45},"command",{"type":21,"value":47}," Claude Code runs when a given event happens. Claude pipes a small JSON payload describing the event to your command on standard input; your command does whatever it wants with it (send a notification, write a log, format a file, block a dangerous call) and exits.",{"type":16,"tag":17,"props":49,"children":50},{},[51,53,60],{"type":21,"value":52},"That is the whole model. There is no plugin API and no long-running process to manage: just a command, run at the right moment, with the event on ",{"type":16,"tag":54,"props":55,"children":57},"code",{"className":56},[],[58],{"type":21,"value":59},"stdin",{"type":21,"value":61},".",{"type":16,"tag":29,"props":63,"children":65},{"id":64},"where-hooks-live",[66],{"type":21,"value":67},"Where hooks live",{"type":16,"tag":17,"props":69,"children":70},{},[71,73,79,81,87],{"type":21,"value":72},"Hooks are declared in a ",{"type":16,"tag":54,"props":74,"children":76},{"className":75},[],[77],{"type":21,"value":78},"settings.json",{"type":21,"value":80}," file, under a top-level ",{"type":16,"tag":54,"props":82,"children":84},{"className":83},[],[85],{"type":21,"value":86},"hooks",{"type":21,"value":88}," key. Claude Code layers several of them, most specific winning:",{"type":16,"tag":90,"props":91,"children":92},"ul",{},[93,112,129],{"type":16,"tag":94,"props":95,"children":96},"li",{},[97,102,104,110],{"type":16,"tag":41,"props":98,"children":99},{},[100],{"type":21,"value":101},"Local project settings",{"type":21,"value":103},": ",{"type":16,"tag":54,"props":105,"children":107},{"className":106},[],[108],{"type":21,"value":109},".claude/settings.local.json",{"type":21,"value":111},", your personal overrides for one repository, kept out of git.",{"type":16,"tag":94,"props":113,"children":114},{},[115,120,121,127],{"type":16,"tag":41,"props":116,"children":117},{},[118],{"type":21,"value":119},"Project settings",{"type":21,"value":103},{"type":16,"tag":54,"props":122,"children":124},{"className":123},[],[125],{"type":21,"value":126},".claude/settings.json",{"type":21,"value":128}," in your repository, shared with your team.",{"type":16,"tag":94,"props":130,"children":131},{},[132,137,138,144],{"type":16,"tag":41,"props":133,"children":134},{},[135],{"type":21,"value":136},"User settings",{"type":21,"value":103},{"type":16,"tag":54,"props":139,"children":141},{"className":140},[],[142],{"type":21,"value":143},"~/.claude/settings.json",{"type":21,"value":145},", applied to every project on your machine.",{"type":16,"tag":17,"props":147,"children":148},{},[149],{"type":21,"value":150},"A minimal file looks like this:",{"type":16,"tag":152,"props":153,"children":157},"pre",{"className":154,"code":155,"language":156,"meta":7,"style":7},"language-json shiki shiki-themes github-light github-dark","{\n  \"hooks\": {\n    \"Stop\": [\n      {\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"echo done >> ~/claude.log\" }\n        ]\n      }\n    ]\n  }\n}\n","json",[158],{"type":16,"tag":54,"props":159,"children":160},{"__ignoreMap":7},[161,173,188,202,211,224,271,280,289,298,307],{"type":16,"tag":162,"props":163,"children":166},"span",{"class":164,"line":165},"line",1,[167],{"type":16,"tag":162,"props":168,"children":170},{"style":169},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[171],{"type":21,"value":172},"{\n",{"type":16,"tag":162,"props":174,"children":176},{"class":164,"line":175},2,[177,183],{"type":16,"tag":162,"props":178,"children":180},{"style":179},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[181],{"type":21,"value":182},"  \"hooks\"",{"type":16,"tag":162,"props":184,"children":185},{"style":169},[186],{"type":21,"value":187},": {\n",{"type":16,"tag":162,"props":189,"children":191},{"class":164,"line":190},3,[192,197],{"type":16,"tag":162,"props":193,"children":194},{"style":179},[195],{"type":21,"value":196},"    \"Stop\"",{"type":16,"tag":162,"props":198,"children":199},{"style":169},[200],{"type":21,"value":201},": [\n",{"type":16,"tag":162,"props":203,"children":205},{"class":164,"line":204},4,[206],{"type":16,"tag":162,"props":207,"children":208},{"style":169},[209],{"type":21,"value":210},"      {\n",{"type":16,"tag":162,"props":212,"children":214},{"class":164,"line":213},5,[215,220],{"type":16,"tag":162,"props":216,"children":217},{"style":179},[218],{"type":21,"value":219},"        \"hooks\"",{"type":16,"tag":162,"props":221,"children":222},{"style":169},[223],{"type":21,"value":201},{"type":16,"tag":162,"props":225,"children":227},{"class":164,"line":226},6,[228,233,238,242,248,253,257,261,266],{"type":16,"tag":162,"props":229,"children":230},{"style":169},[231],{"type":21,"value":232},"          { ",{"type":16,"tag":162,"props":234,"children":235},{"style":179},[236],{"type":21,"value":237},"\"type\"",{"type":16,"tag":162,"props":239,"children":240},{"style":169},[241],{"type":21,"value":103},{"type":16,"tag":162,"props":243,"children":245},{"style":244},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[246],{"type":21,"value":247},"\"command\"",{"type":16,"tag":162,"props":249,"children":250},{"style":169},[251],{"type":21,"value":252},", ",{"type":16,"tag":162,"props":254,"children":255},{"style":179},[256],{"type":21,"value":247},{"type":16,"tag":162,"props":258,"children":259},{"style":169},[260],{"type":21,"value":103},{"type":16,"tag":162,"props":262,"children":263},{"style":244},[264],{"type":21,"value":265},"\"echo done >> ~/claude.log\"",{"type":16,"tag":162,"props":267,"children":268},{"style":169},[269],{"type":21,"value":270}," }\n",{"type":16,"tag":162,"props":272,"children":274},{"class":164,"line":273},7,[275],{"type":16,"tag":162,"props":276,"children":277},{"style":169},[278],{"type":21,"value":279},"        ]\n",{"type":16,"tag":162,"props":281,"children":283},{"class":164,"line":282},8,[284],{"type":16,"tag":162,"props":285,"children":286},{"style":169},[287],{"type":21,"value":288},"      }\n",{"type":16,"tag":162,"props":290,"children":292},{"class":164,"line":291},9,[293],{"type":16,"tag":162,"props":294,"children":295},{"style":169},[296],{"type":21,"value":297},"    ]\n",{"type":16,"tag":162,"props":299,"children":301},{"class":164,"line":300},10,[302],{"type":16,"tag":162,"props":303,"children":304},{"style":169},[305],{"type":21,"value":306},"  }\n",{"type":16,"tag":162,"props":308,"children":310},{"class":164,"line":309},11,[311],{"type":16,"tag":162,"props":312,"children":313},{"style":169},[314],{"type":21,"value":315},"}\n",{"type":16,"tag":17,"props":317,"children":318},{},[319,321,326,328,334,336,341],{"type":21,"value":320},"Each event maps to an array of ",{"type":16,"tag":41,"props":322,"children":323},{},[324],{"type":21,"value":325},"matchers",{"type":21,"value":327},", and each matcher holds an array of hooks (",{"type":16,"tag":54,"props":329,"children":331},{"className":330},[],[332],{"type":21,"value":333},"type: \"command\"",{"type":21,"value":335}," with a ",{"type":16,"tag":54,"props":337,"children":339},{"className":338},[],[340],{"type":21,"value":45},{"type":21,"value":342}," string). For events tied to a tool, the matcher can filter by tool name; for lifecycle events, you leave the matcher out and the hooks always run.",{"type":16,"tag":17,"props":344,"children":345},{},[346,348,354],{"type":21,"value":347},"You can also edit all of this from inside Claude Code with the ",{"type":16,"tag":54,"props":349,"children":351},{"className":350},[],[352],{"type":21,"value":353},"/hooks",{"type":21,"value":355}," slash command, which writes the same JSON for you.",{"type":16,"tag":29,"props":357,"children":359},{"id":358},"every-hook-event",[360],{"type":21,"value":361},"Every hook event",{"type":16,"tag":17,"props":363,"children":364},{},[365],{"type":21,"value":366},"Claude Code exposes a hook for each meaningful moment in a session. Here is what each one fires on:",{"type":16,"tag":368,"props":369,"children":370},"table",{},[371,390],{"type":16,"tag":372,"props":373,"children":374},"thead",{},[375],{"type":16,"tag":376,"props":377,"children":378},"tr",{},[379,385],{"type":16,"tag":380,"props":381,"children":382},"th",{},[383],{"type":21,"value":384},"Event",{"type":16,"tag":380,"props":386,"children":387},{},[388],{"type":21,"value":389},"Fires when",{"type":16,"tag":391,"props":392,"children":393},"tbody",{},[394,412,429,446,463,480,497,514,531],{"type":16,"tag":376,"props":395,"children":396},{},[397,407],{"type":16,"tag":398,"props":399,"children":400},"td",{},[401],{"type":16,"tag":54,"props":402,"children":404},{"className":403},[],[405],{"type":21,"value":406},"SessionStart",{"type":16,"tag":398,"props":408,"children":409},{},[410],{"type":21,"value":411},"A session opens (or resumes, or is cleared).",{"type":16,"tag":376,"props":413,"children":414},{},[415,424],{"type":16,"tag":398,"props":416,"children":417},{},[418],{"type":16,"tag":54,"props":419,"children":421},{"className":420},[],[422],{"type":21,"value":423},"UserPromptSubmit",{"type":16,"tag":398,"props":425,"children":426},{},[427],{"type":21,"value":428},"You send a prompt and the turn begins.",{"type":16,"tag":376,"props":430,"children":431},{},[432,441],{"type":16,"tag":398,"props":433,"children":434},{},[435],{"type":16,"tag":54,"props":436,"children":438},{"className":437},[],[439],{"type":21,"value":440},"PreToolUse",{"type":16,"tag":398,"props":442,"children":443},{},[444],{"type":21,"value":445},"Just before Claude runs a tool (Bash, Edit, Read…).",{"type":16,"tag":376,"props":447,"children":448},{},[449,458],{"type":16,"tag":398,"props":450,"children":451},{},[452],{"type":16,"tag":54,"props":453,"children":455},{"className":454},[],[456],{"type":21,"value":457},"PostToolUse",{"type":16,"tag":398,"props":459,"children":460},{},[461],{"type":21,"value":462},"Right after a tool call returns.",{"type":16,"tag":376,"props":464,"children":465},{},[466,475],{"type":16,"tag":398,"props":467,"children":468},{},[469],{"type":16,"tag":54,"props":470,"children":472},{"className":471},[],[473],{"type":21,"value":474},"Notification",{"type":16,"tag":398,"props":476,"children":477},{},[478],{"type":21,"value":479},"Claude needs your attention, e.g. to approve a step.",{"type":16,"tag":376,"props":481,"children":482},{},[483,492],{"type":16,"tag":398,"props":484,"children":485},{},[486],{"type":16,"tag":54,"props":487,"children":489},{"className":488},[],[490],{"type":21,"value":491},"Stop",{"type":16,"tag":398,"props":493,"children":494},{},[495],{"type":21,"value":496},"Claude finishes its turn and hands control back to you.",{"type":16,"tag":376,"props":498,"children":499},{},[500,509],{"type":16,"tag":398,"props":501,"children":502},{},[503],{"type":16,"tag":54,"props":504,"children":506},{"className":505},[],[507],{"type":21,"value":508},"SubagentStop",{"type":16,"tag":398,"props":510,"children":511},{},[512],{"type":21,"value":513},"A spawned subagent (Task) finishes.",{"type":16,"tag":376,"props":515,"children":516},{},[517,526],{"type":16,"tag":398,"props":518,"children":519},{},[520],{"type":16,"tag":54,"props":521,"children":523},{"className":522},[],[524],{"type":21,"value":525},"PreCompact",{"type":16,"tag":398,"props":527,"children":528},{},[529],{"type":21,"value":530},"Claude compacts the context on a long run.",{"type":16,"tag":376,"props":532,"children":533},{},[534,543],{"type":16,"tag":398,"props":535,"children":536},{},[537],{"type":16,"tag":54,"props":538,"children":540},{"className":539},[],[541],{"type":21,"value":542},"SessionEnd",{"type":16,"tag":398,"props":544,"children":545},{},[546],{"type":21,"value":547},"The session closes.",{"type":16,"tag":17,"props":549,"children":550},{},[551,553,560],{"type":21,"value":552},"Between them, these events let you follow a session from start to finish: idle, working, waiting on you, compacting, done. Each one is detailed in ",{"type":16,"tag":554,"props":555,"children":557},"a",{"href":556},"/guides/claude-code-hook-events",[558],{"type":21,"value":559},"what every Claude Code hook event means",{"type":21,"value":61},{"type":16,"tag":29,"props":562,"children":564},{"id":563},"filtering-by-tool",[565],{"type":21,"value":566},"Filtering by tool",{"type":16,"tag":17,"props":568,"children":569},{},[570,572,577,579,584,586,592],{"type":21,"value":571},"For ",{"type":16,"tag":54,"props":573,"children":575},{"className":574},[],[576],{"type":21,"value":440},{"type":21,"value":578}," and ",{"type":16,"tag":54,"props":580,"children":582},{"className":581},[],[583],{"type":21,"value":457},{"type":21,"value":585},", the ",{"type":16,"tag":54,"props":587,"children":589},{"className":588},[],[590],{"type":21,"value":591},"matcher",{"type":21,"value":593}," selects which tools trigger the hook. The matcher is a regular expression tested against the tool name, so you can target one tool or several:",{"type":16,"tag":152,"props":595,"children":597},{"className":154,"code":596,"language":156,"meta":7,"style":7},"{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"echo 'about to run a shell command'\" }\n        ]\n      },\n      {\n        \"matcher\": \"Edit|Write\",\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"echo 'about to touch a file'\" }\n        ]\n      }\n    ]\n  }\n}\n",[598],{"type":16,"tag":54,"props":599,"children":600},{"__ignoreMap":7},[601,608,619,631,638,660,671,711,718,726,733,753,765,806,814,822,830,838],{"type":16,"tag":162,"props":602,"children":603},{"class":164,"line":165},[604],{"type":16,"tag":162,"props":605,"children":606},{"style":169},[607],{"type":21,"value":172},{"type":16,"tag":162,"props":609,"children":610},{"class":164,"line":175},[611,615],{"type":16,"tag":162,"props":612,"children":613},{"style":179},[614],{"type":21,"value":182},{"type":16,"tag":162,"props":616,"children":617},{"style":169},[618],{"type":21,"value":187},{"type":16,"tag":162,"props":620,"children":621},{"class":164,"line":190},[622,627],{"type":16,"tag":162,"props":623,"children":624},{"style":179},[625],{"type":21,"value":626},"    \"PreToolUse\"",{"type":16,"tag":162,"props":628,"children":629},{"style":169},[630],{"type":21,"value":201},{"type":16,"tag":162,"props":632,"children":633},{"class":164,"line":204},[634],{"type":16,"tag":162,"props":635,"children":636},{"style":169},[637],{"type":21,"value":210},{"type":16,"tag":162,"props":639,"children":640},{"class":164,"line":213},[641,646,650,655],{"type":16,"tag":162,"props":642,"children":643},{"style":179},[644],{"type":21,"value":645},"        \"matcher\"",{"type":16,"tag":162,"props":647,"children":648},{"style":169},[649],{"type":21,"value":103},{"type":16,"tag":162,"props":651,"children":652},{"style":244},[653],{"type":21,"value":654},"\"Bash\"",{"type":16,"tag":162,"props":656,"children":657},{"style":169},[658],{"type":21,"value":659},",\n",{"type":16,"tag":162,"props":661,"children":662},{"class":164,"line":226},[663,667],{"type":16,"tag":162,"props":664,"children":665},{"style":179},[666],{"type":21,"value":219},{"type":16,"tag":162,"props":668,"children":669},{"style":169},[670],{"type":21,"value":201},{"type":16,"tag":162,"props":672,"children":673},{"class":164,"line":273},[674,678,682,686,690,694,698,702,707],{"type":16,"tag":162,"props":675,"children":676},{"style":169},[677],{"type":21,"value":232},{"type":16,"tag":162,"props":679,"children":680},{"style":179},[681],{"type":21,"value":237},{"type":16,"tag":162,"props":683,"children":684},{"style":169},[685],{"type":21,"value":103},{"type":16,"tag":162,"props":687,"children":688},{"style":244},[689],{"type":21,"value":247},{"type":16,"tag":162,"props":691,"children":692},{"style":169},[693],{"type":21,"value":252},{"type":16,"tag":162,"props":695,"children":696},{"style":179},[697],{"type":21,"value":247},{"type":16,"tag":162,"props":699,"children":700},{"style":169},[701],{"type":21,"value":103},{"type":16,"tag":162,"props":703,"children":704},{"style":244},[705],{"type":21,"value":706},"\"echo 'about to run a shell command'\"",{"type":16,"tag":162,"props":708,"children":709},{"style":169},[710],{"type":21,"value":270},{"type":16,"tag":162,"props":712,"children":713},{"class":164,"line":282},[714],{"type":16,"tag":162,"props":715,"children":716},{"style":169},[717],{"type":21,"value":279},{"type":16,"tag":162,"props":719,"children":720},{"class":164,"line":291},[721],{"type":16,"tag":162,"props":722,"children":723},{"style":169},[724],{"type":21,"value":725},"      },\n",{"type":16,"tag":162,"props":727,"children":728},{"class":164,"line":300},[729],{"type":16,"tag":162,"props":730,"children":731},{"style":169},[732],{"type":21,"value":210},{"type":16,"tag":162,"props":734,"children":735},{"class":164,"line":309},[736,740,744,749],{"type":16,"tag":162,"props":737,"children":738},{"style":179},[739],{"type":21,"value":645},{"type":16,"tag":162,"props":741,"children":742},{"style":169},[743],{"type":21,"value":103},{"type":16,"tag":162,"props":745,"children":746},{"style":244},[747],{"type":21,"value":748},"\"Edit|Write\"",{"type":16,"tag":162,"props":750,"children":751},{"style":169},[752],{"type":21,"value":659},{"type":16,"tag":162,"props":754,"children":756},{"class":164,"line":755},12,[757,761],{"type":16,"tag":162,"props":758,"children":759},{"style":179},[760],{"type":21,"value":219},{"type":16,"tag":162,"props":762,"children":763},{"style":169},[764],{"type":21,"value":201},{"type":16,"tag":162,"props":766,"children":768},{"class":164,"line":767},13,[769,773,777,781,785,789,793,797,802],{"type":16,"tag":162,"props":770,"children":771},{"style":169},[772],{"type":21,"value":232},{"type":16,"tag":162,"props":774,"children":775},{"style":179},[776],{"type":21,"value":237},{"type":16,"tag":162,"props":778,"children":779},{"style":169},[780],{"type":21,"value":103},{"type":16,"tag":162,"props":782,"children":783},{"style":244},[784],{"type":21,"value":247},{"type":16,"tag":162,"props":786,"children":787},{"style":169},[788],{"type":21,"value":252},{"type":16,"tag":162,"props":790,"children":791},{"style":179},[792],{"type":21,"value":247},{"type":16,"tag":162,"props":794,"children":795},{"style":169},[796],{"type":21,"value":103},{"type":16,"tag":162,"props":798,"children":799},{"style":244},[800],{"type":21,"value":801},"\"echo 'about to touch a file'\"",{"type":16,"tag":162,"props":803,"children":804},{"style":169},[805],{"type":21,"value":270},{"type":16,"tag":162,"props":807,"children":809},{"class":164,"line":808},14,[810],{"type":16,"tag":162,"props":811,"children":812},{"style":169},[813],{"type":21,"value":279},{"type":16,"tag":162,"props":815,"children":817},{"class":164,"line":816},15,[818],{"type":16,"tag":162,"props":819,"children":820},{"style":169},[821],{"type":21,"value":288},{"type":16,"tag":162,"props":823,"children":825},{"class":164,"line":824},16,[826],{"type":16,"tag":162,"props":827,"children":828},{"style":169},[829],{"type":21,"value":297},{"type":16,"tag":162,"props":831,"children":833},{"class":164,"line":832},17,[834],{"type":16,"tag":162,"props":835,"children":836},{"style":169},[837],{"type":21,"value":306},{"type":16,"tag":162,"props":839,"children":841},{"class":164,"line":840},18,[842],{"type":16,"tag":162,"props":843,"children":844},{"style":169},[845],{"type":21,"value":315},{"type":16,"tag":17,"props":847,"children":848},{},[849,855],{"type":16,"tag":54,"props":850,"children":852},{"className":851},[],[853],{"type":21,"value":854},"mcp__.*",{"type":21,"value":856}," matches every tool coming from an MCP server, which is a handy way to audit third-party tooling separately from Claude's built-ins.",{"type":16,"tag":29,"props":858,"children":860},{"id":859},"what-your-command-receives",[861],{"type":21,"value":862},"What your command receives",{"type":16,"tag":17,"props":864,"children":865},{},[866],{"type":21,"value":867},"Claude writes a JSON object to your command's standard input. Every event carries the same base fields:",{"type":16,"tag":368,"props":869,"children":870},{},[871,887],{"type":16,"tag":372,"props":872,"children":873},{},[874],{"type":16,"tag":376,"props":875,"children":876},{},[877,882],{"type":16,"tag":380,"props":878,"children":879},{},[880],{"type":21,"value":881},"Field",{"type":16,"tag":380,"props":883,"children":884},{},[885],{"type":21,"value":886},"Contains",{"type":16,"tag":391,"props":888,"children":889},{},[890,907,924,941],{"type":16,"tag":376,"props":891,"children":892},{},[893,902],{"type":16,"tag":398,"props":894,"children":895},{},[896],{"type":16,"tag":54,"props":897,"children":899},{"className":898},[],[900],{"type":21,"value":901},"session_id",{"type":16,"tag":398,"props":903,"children":904},{},[905],{"type":21,"value":906},"The id of the session that fired the event.",{"type":16,"tag":376,"props":908,"children":909},{},[910,919],{"type":16,"tag":398,"props":911,"children":912},{},[913],{"type":16,"tag":54,"props":914,"children":916},{"className":915},[],[917],{"type":21,"value":918},"transcript_path",{"type":16,"tag":398,"props":920,"children":921},{},[922],{"type":21,"value":923},"Path to the session's conversation log.",{"type":16,"tag":376,"props":925,"children":926},{},[927,936],{"type":16,"tag":398,"props":928,"children":929},{},[930],{"type":16,"tag":54,"props":931,"children":933},{"className":932},[],[934],{"type":21,"value":935},"cwd",{"type":16,"tag":398,"props":937,"children":938},{},[939],{"type":21,"value":940},"The directory the session is running in.",{"type":16,"tag":376,"props":942,"children":943},{},[944,953],{"type":16,"tag":398,"props":945,"children":946},{},[947],{"type":16,"tag":54,"props":948,"children":950},{"className":949},[],[951],{"type":21,"value":952},"hook_event_name",{"type":16,"tag":398,"props":954,"children":955},{},[956,958,963],{"type":21,"value":957},"The event name, e.g. ",{"type":16,"tag":54,"props":959,"children":961},{"className":960},[],[962],{"type":21,"value":491},{"type":21,"value":61},{"type":16,"tag":17,"props":965,"children":966},{},[967,969,975,976,982,984,990,992,997,998,1004,1005,1010,1011,1017,1018,1023],{"type":21,"value":968},"Event-specific fields come on top: ",{"type":16,"tag":54,"props":970,"children":972},{"className":971},[],[973],{"type":21,"value":974},"tool_name",{"type":21,"value":578},{"type":16,"tag":54,"props":977,"children":979},{"className":978},[],[980],{"type":21,"value":981},"tool_input",{"type":21,"value":983}," for tool events, ",{"type":16,"tag":54,"props":985,"children":987},{"className":986},[],[988],{"type":21,"value":989},"tool_response",{"type":21,"value":991}," for ",{"type":16,"tag":54,"props":993,"children":995},{"className":994},[],[996],{"type":21,"value":457},{"type":21,"value":252},{"type":16,"tag":54,"props":999,"children":1001},{"className":1000},[],[1002],{"type":21,"value":1003},"prompt",{"type":21,"value":991},{"type":16,"tag":54,"props":1006,"children":1008},{"className":1007},[],[1009],{"type":21,"value":423},{"type":21,"value":252},{"type":16,"tag":54,"props":1012,"children":1014},{"className":1013},[],[1015],{"type":21,"value":1016},"message",{"type":21,"value":991},{"type":16,"tag":54,"props":1019,"children":1021},{"className":1020},[],[1022],{"type":21,"value":474},{"type":21,"value":1024},". The fastest way to see the real shape is to dump it:",{"type":16,"tag":152,"props":1026,"children":1028},{"className":154,"code":1027,"language":156,"meta":7,"style":7},"{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \".*\",\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"cat >> ~/claude-events.jsonl\" }\n        ]\n      }\n    ]\n  }\n}\n",[1029],{"type":16,"tag":54,"props":1030,"children":1031},{"__ignoreMap":7},[1032,1039,1050,1061,1068,1088,1099,1139,1146,1153,1160,1167],{"type":16,"tag":162,"props":1033,"children":1034},{"class":164,"line":165},[1035],{"type":16,"tag":162,"props":1036,"children":1037},{"style":169},[1038],{"type":21,"value":172},{"type":16,"tag":162,"props":1040,"children":1041},{"class":164,"line":175},[1042,1046],{"type":16,"tag":162,"props":1043,"children":1044},{"style":179},[1045],{"type":21,"value":182},{"type":16,"tag":162,"props":1047,"children":1048},{"style":169},[1049],{"type":21,"value":187},{"type":16,"tag":162,"props":1051,"children":1052},{"class":164,"line":190},[1053,1057],{"type":16,"tag":162,"props":1054,"children":1055},{"style":179},[1056],{"type":21,"value":626},{"type":16,"tag":162,"props":1058,"children":1059},{"style":169},[1060],{"type":21,"value":201},{"type":16,"tag":162,"props":1062,"children":1063},{"class":164,"line":204},[1064],{"type":16,"tag":162,"props":1065,"children":1066},{"style":169},[1067],{"type":21,"value":210},{"type":16,"tag":162,"props":1069,"children":1070},{"class":164,"line":213},[1071,1075,1079,1084],{"type":16,"tag":162,"props":1072,"children":1073},{"style":179},[1074],{"type":21,"value":645},{"type":16,"tag":162,"props":1076,"children":1077},{"style":169},[1078],{"type":21,"value":103},{"type":16,"tag":162,"props":1080,"children":1081},{"style":244},[1082],{"type":21,"value":1083},"\".*\"",{"type":16,"tag":162,"props":1085,"children":1086},{"style":169},[1087],{"type":21,"value":659},{"type":16,"tag":162,"props":1089,"children":1090},{"class":164,"line":226},[1091,1095],{"type":16,"tag":162,"props":1092,"children":1093},{"style":179},[1094],{"type":21,"value":219},{"type":16,"tag":162,"props":1096,"children":1097},{"style":169},[1098],{"type":21,"value":201},{"type":16,"tag":162,"props":1100,"children":1101},{"class":164,"line":273},[1102,1106,1110,1114,1118,1122,1126,1130,1135],{"type":16,"tag":162,"props":1103,"children":1104},{"style":169},[1105],{"type":21,"value":232},{"type":16,"tag":162,"props":1107,"children":1108},{"style":179},[1109],{"type":21,"value":237},{"type":16,"tag":162,"props":1111,"children":1112},{"style":169},[1113],{"type":21,"value":103},{"type":16,"tag":162,"props":1115,"children":1116},{"style":244},[1117],{"type":21,"value":247},{"type":16,"tag":162,"props":1119,"children":1120},{"style":169},[1121],{"type":21,"value":252},{"type":16,"tag":162,"props":1123,"children":1124},{"style":179},[1125],{"type":21,"value":247},{"type":16,"tag":162,"props":1127,"children":1128},{"style":169},[1129],{"type":21,"value":103},{"type":16,"tag":162,"props":1131,"children":1132},{"style":244},[1133],{"type":21,"value":1134},"\"cat >> ~/claude-events.jsonl\"",{"type":16,"tag":162,"props":1136,"children":1137},{"style":169},[1138],{"type":21,"value":270},{"type":16,"tag":162,"props":1140,"children":1141},{"class":164,"line":282},[1142],{"type":16,"tag":162,"props":1143,"children":1144},{"style":169},[1145],{"type":21,"value":279},{"type":16,"tag":162,"props":1147,"children":1148},{"class":164,"line":291},[1149],{"type":16,"tag":162,"props":1150,"children":1151},{"style":169},[1152],{"type":21,"value":288},{"type":16,"tag":162,"props":1154,"children":1155},{"class":164,"line":300},[1156],{"type":16,"tag":162,"props":1157,"children":1158},{"style":169},[1159],{"type":21,"value":297},{"type":16,"tag":162,"props":1161,"children":1162},{"class":164,"line":309},[1163],{"type":16,"tag":162,"props":1164,"children":1165},{"style":169},[1166],{"type":21,"value":306},{"type":16,"tag":162,"props":1168,"children":1169},{"class":164,"line":755},[1170],{"type":16,"tag":162,"props":1171,"children":1172},{"style":169},[1173],{"type":21,"value":315},{"type":16,"tag":17,"props":1175,"children":1176},{},[1177],{"type":21,"value":1178},"Open that file while you work and you will see exactly what each event carries.",{"type":16,"tag":29,"props":1180,"children":1182},{"id":1181},"reading-the-payload-in-a-real-script",[1183],{"type":21,"value":1184},"Reading the payload in a real script",{"type":16,"tag":17,"props":1186,"children":1187},{},[1188,1190,1196],{"type":21,"value":1189},"Inline one-liners get unreadable fast. Point the hook at a script instead, and use ",{"type":16,"tag":54,"props":1191,"children":1193},{"className":1192},[],[1194],{"type":21,"value":1195},"$CLAUDE_PROJECT_DIR",{"type":21,"value":1197}," so the path works from any subdirectory:",{"type":16,"tag":152,"props":1199,"children":1201},{"className":154,"code":1200,"language":156,"meta":7,"style":7},"{\n  \"hooks\": {\n    \"Stop\": [\n      {\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"$CLAUDE_PROJECT_DIR/.claude/hooks/notify.sh\",\n            \"timeout\": 10\n          }\n        ]\n      }\n    ]\n  }\n}\n",[1202],{"type":16,"tag":54,"props":1203,"children":1204},{"__ignoreMap":7},[1205,1212,1223,1234,1241,1252,1260,1280,1301,1318,1326,1333,1340,1347,1354],{"type":16,"tag":162,"props":1206,"children":1207},{"class":164,"line":165},[1208],{"type":16,"tag":162,"props":1209,"children":1210},{"style":169},[1211],{"type":21,"value":172},{"type":16,"tag":162,"props":1213,"children":1214},{"class":164,"line":175},[1215,1219],{"type":16,"tag":162,"props":1216,"children":1217},{"style":179},[1218],{"type":21,"value":182},{"type":16,"tag":162,"props":1220,"children":1221},{"style":169},[1222],{"type":21,"value":187},{"type":16,"tag":162,"props":1224,"children":1225},{"class":164,"line":190},[1226,1230],{"type":16,"tag":162,"props":1227,"children":1228},{"style":179},[1229],{"type":21,"value":196},{"type":16,"tag":162,"props":1231,"children":1232},{"style":169},[1233],{"type":21,"value":201},{"type":16,"tag":162,"props":1235,"children":1236},{"class":164,"line":204},[1237],{"type":16,"tag":162,"props":1238,"children":1239},{"style":169},[1240],{"type":21,"value":210},{"type":16,"tag":162,"props":1242,"children":1243},{"class":164,"line":213},[1244,1248],{"type":16,"tag":162,"props":1245,"children":1246},{"style":179},[1247],{"type":21,"value":219},{"type":16,"tag":162,"props":1249,"children":1250},{"style":169},[1251],{"type":21,"value":201},{"type":16,"tag":162,"props":1253,"children":1254},{"class":164,"line":226},[1255],{"type":16,"tag":162,"props":1256,"children":1257},{"style":169},[1258],{"type":21,"value":1259},"          {\n",{"type":16,"tag":162,"props":1261,"children":1262},{"class":164,"line":273},[1263,1268,1272,1276],{"type":16,"tag":162,"props":1264,"children":1265},{"style":179},[1266],{"type":21,"value":1267},"            \"type\"",{"type":16,"tag":162,"props":1269,"children":1270},{"style":169},[1271],{"type":21,"value":103},{"type":16,"tag":162,"props":1273,"children":1274},{"style":244},[1275],{"type":21,"value":247},{"type":16,"tag":162,"props":1277,"children":1278},{"style":169},[1279],{"type":21,"value":659},{"type":16,"tag":162,"props":1281,"children":1282},{"class":164,"line":282},[1283,1288,1292,1297],{"type":16,"tag":162,"props":1284,"children":1285},{"style":179},[1286],{"type":21,"value":1287},"            \"command\"",{"type":16,"tag":162,"props":1289,"children":1290},{"style":169},[1291],{"type":21,"value":103},{"type":16,"tag":162,"props":1293,"children":1294},{"style":244},[1295],{"type":21,"value":1296},"\"$CLAUDE_PROJECT_DIR/.claude/hooks/notify.sh\"",{"type":16,"tag":162,"props":1298,"children":1299},{"style":169},[1300],{"type":21,"value":659},{"type":16,"tag":162,"props":1302,"children":1303},{"class":164,"line":291},[1304,1309,1313],{"type":16,"tag":162,"props":1305,"children":1306},{"style":179},[1307],{"type":21,"value":1308},"            \"timeout\"",{"type":16,"tag":162,"props":1310,"children":1311},{"style":169},[1312],{"type":21,"value":103},{"type":16,"tag":162,"props":1314,"children":1315},{"style":179},[1316],{"type":21,"value":1317},"10\n",{"type":16,"tag":162,"props":1319,"children":1320},{"class":164,"line":300},[1321],{"type":16,"tag":162,"props":1322,"children":1323},{"style":169},[1324],{"type":21,"value":1325},"          }\n",{"type":16,"tag":162,"props":1327,"children":1328},{"class":164,"line":309},[1329],{"type":16,"tag":162,"props":1330,"children":1331},{"style":169},[1332],{"type":21,"value":279},{"type":16,"tag":162,"props":1334,"children":1335},{"class":164,"line":755},[1336],{"type":16,"tag":162,"props":1337,"children":1338},{"style":169},[1339],{"type":21,"value":288},{"type":16,"tag":162,"props":1341,"children":1342},{"class":164,"line":767},[1343],{"type":16,"tag":162,"props":1344,"children":1345},{"style":169},[1346],{"type":21,"value":297},{"type":16,"tag":162,"props":1348,"children":1349},{"class":164,"line":808},[1350],{"type":16,"tag":162,"props":1351,"children":1352},{"style":169},[1353],{"type":21,"value":306},{"type":16,"tag":162,"props":1355,"children":1356},{"class":164,"line":816},[1357],{"type":16,"tag":162,"props":1358,"children":1359},{"style":169},[1360],{"type":21,"value":315},{"type":16,"tag":152,"props":1362,"children":1366},{"className":1363,"code":1364,"language":1365,"meta":7,"style":7},"language-bash shiki shiki-themes github-light github-dark","#!/usr/bin/env bash\n# .claude/hooks/notify.sh\npayload=$(cat)\nproject=$(basename \"$(echo \"$payload\" | jq -r '.cwd')\")\nnotify-send \"Claude Code\" \"$project finished\"\n","bash",[1367],{"type":16,"tag":54,"props":1368,"children":1369},{"__ignoreMap":7},[1370,1379,1387,1417,1487],{"type":16,"tag":162,"props":1371,"children":1372},{"class":164,"line":165},[1373],{"type":16,"tag":162,"props":1374,"children":1376},{"style":1375},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[1377],{"type":21,"value":1378},"#!/usr/bin/env bash\n",{"type":16,"tag":162,"props":1380,"children":1381},{"class":164,"line":175},[1382],{"type":16,"tag":162,"props":1383,"children":1384},{"style":1375},[1385],{"type":21,"value":1386},"# .claude/hooks/notify.sh\n",{"type":16,"tag":162,"props":1388,"children":1389},{"class":164,"line":190},[1390,1395,1401,1406,1412],{"type":16,"tag":162,"props":1391,"children":1392},{"style":169},[1393],{"type":21,"value":1394},"payload",{"type":16,"tag":162,"props":1396,"children":1398},{"style":1397},"--shiki-default:#D73A49;--shiki-dark:#F97583",[1399],{"type":21,"value":1400},"=",{"type":16,"tag":162,"props":1402,"children":1403},{"style":169},[1404],{"type":21,"value":1405},"$(",{"type":16,"tag":162,"props":1407,"children":1409},{"style":1408},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[1410],{"type":21,"value":1411},"cat",{"type":16,"tag":162,"props":1413,"children":1414},{"style":169},[1415],{"type":21,"value":1416},")\n",{"type":16,"tag":162,"props":1418,"children":1419},{"class":164,"line":204},[1420,1425,1429,1433,1438,1443,1448,1453,1458,1463,1468,1473,1478,1483],{"type":16,"tag":162,"props":1421,"children":1422},{"style":169},[1423],{"type":21,"value":1424},"project",{"type":16,"tag":162,"props":1426,"children":1427},{"style":1397},[1428],{"type":21,"value":1400},{"type":16,"tag":162,"props":1430,"children":1431},{"style":169},[1432],{"type":21,"value":1405},{"type":16,"tag":162,"props":1434,"children":1435},{"style":1408},[1436],{"type":21,"value":1437},"basename",{"type":16,"tag":162,"props":1439,"children":1440},{"style":244},[1441],{"type":21,"value":1442}," \"$(",{"type":16,"tag":162,"props":1444,"children":1445},{"style":179},[1446],{"type":21,"value":1447},"echo",{"type":16,"tag":162,"props":1449,"children":1450},{"style":244},[1451],{"type":21,"value":1452}," \"",{"type":16,"tag":162,"props":1454,"children":1455},{"style":169},[1456],{"type":21,"value":1457},"$payload",{"type":16,"tag":162,"props":1459,"children":1460},{"style":244},[1461],{"type":21,"value":1462},"\" ",{"type":16,"tag":162,"props":1464,"children":1465},{"style":1397},[1466],{"type":21,"value":1467},"|",{"type":16,"tag":162,"props":1469,"children":1470},{"style":1408},[1471],{"type":21,"value":1472}," jq",{"type":16,"tag":162,"props":1474,"children":1475},{"style":179},[1476],{"type":21,"value":1477}," -r",{"type":16,"tag":162,"props":1479,"children":1480},{"style":244},[1481],{"type":21,"value":1482}," '.cwd')\"",{"type":16,"tag":162,"props":1484,"children":1485},{"style":169},[1486],{"type":21,"value":1416},{"type":16,"tag":162,"props":1488,"children":1489},{"class":164,"line":213},[1490,1495,1500,1504,1509],{"type":16,"tag":162,"props":1491,"children":1492},{"style":1408},[1493],{"type":21,"value":1494},"notify-send",{"type":16,"tag":162,"props":1496,"children":1497},{"style":244},[1498],{"type":21,"value":1499}," \"Claude Code\"",{"type":16,"tag":162,"props":1501,"children":1502},{"style":244},[1503],{"type":21,"value":1452},{"type":16,"tag":162,"props":1505,"children":1506},{"style":169},[1507],{"type":21,"value":1508},"$project",{"type":16,"tag":162,"props":1510,"children":1511},{"style":244},[1512],{"type":21,"value":1513}," finished\"\n",{"type":16,"tag":17,"props":1515,"children":1516},{},[1517,1523],{"type":16,"tag":54,"props":1518,"children":1520},{"className":1519},[],[1521],{"type":21,"value":1522},"timeout",{"type":21,"value":1524}," is in seconds and caps how long Claude waits for your command (60 by default). Keep hooks fast: they run on the critical path of the session.",{"type":16,"tag":29,"props":1526,"children":1528},{"id":1527},"how-a-hook-talks-back",[1529],{"type":21,"value":1530},"How a hook talks back",{"type":16,"tag":17,"props":1532,"children":1533},{},[1534],{"type":21,"value":1535},"Exit codes are the simple channel:",{"type":16,"tag":90,"props":1537,"children":1538},{},[1539,1561,1590],{"type":16,"tag":94,"props":1540,"children":1541},{},[1542,1551,1553,1559],{"type":16,"tag":41,"props":1543,"children":1544},{},[1545],{"type":16,"tag":54,"props":1546,"children":1548},{"className":1547},[],[1549],{"type":21,"value":1550},"0",{"type":21,"value":1552},": success. Anything on ",{"type":16,"tag":54,"props":1554,"children":1556},{"className":1555},[],[1557],{"type":21,"value":1558},"stdout",{"type":21,"value":1560}," is shown in the transcript.",{"type":16,"tag":94,"props":1562,"children":1563},{},[1564,1573,1575,1581,1583,1588],{"type":16,"tag":41,"props":1565,"children":1566},{},[1567],{"type":16,"tag":54,"props":1568,"children":1570},{"className":1569},[],[1571],{"type":21,"value":1572},"2",{"type":21,"value":1574},": blocking error. ",{"type":16,"tag":54,"props":1576,"children":1578},{"className":1577},[],[1579],{"type":21,"value":1580},"stderr",{"type":21,"value":1582}," is fed back to Claude, and on ",{"type":16,"tag":54,"props":1584,"children":1586},{"className":1585},[],[1587],{"type":21,"value":440},{"type":21,"value":1589}," the tool call is cancelled.",{"type":16,"tag":94,"props":1591,"children":1592},{},[1593,1598,1600,1605],{"type":16,"tag":41,"props":1594,"children":1595},{},[1596],{"type":21,"value":1597},"anything else",{"type":21,"value":1599},": non-blocking error. ",{"type":16,"tag":54,"props":1601,"children":1603},{"className":1602},[],[1604],{"type":21,"value":1580},{"type":21,"value":1606}," is shown to you and the session carries on.",{"type":16,"tag":17,"props":1608,"children":1609},{},[1610,1612,1617,1619,1624],{"type":21,"value":1611},"For finer control, print a JSON object on ",{"type":16,"tag":54,"props":1613,"children":1615},{"className":1614},[],[1616],{"type":21,"value":1558},{"type":21,"value":1618},". On ",{"type":16,"tag":54,"props":1620,"children":1622},{"className":1621},[],[1623],{"type":21,"value":440},{"type":21,"value":1625}," you can decide the permission outright:",{"type":16,"tag":152,"props":1627,"children":1629},{"className":1363,"code":1628,"language":1365,"meta":7,"style":7},"echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"never touch .env\"}}'\n",[1630],{"type":16,"tag":54,"props":1631,"children":1632},{"__ignoreMap":7},[1633],{"type":16,"tag":162,"props":1634,"children":1635},{"class":164,"line":165},[1636,1640],{"type":16,"tag":162,"props":1637,"children":1638},{"style":179},[1639],{"type":21,"value":1447},{"type":16,"tag":162,"props":1641,"children":1642},{"style":244},[1643],{"type":21,"value":1644}," '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"never touch .env\"}}'\n",{"type":16,"tag":29,"props":1646,"children":1648},{"id":1647},"a-useful-example-react-when-claude-finishes",[1649],{"type":21,"value":1650},"A useful example: react when Claude finishes",{"type":16,"tag":17,"props":1652,"children":1653},{},[1654,1656,1661],{"type":21,"value":1655},"The ",{"type":16,"tag":54,"props":1657,"children":1659},{"className":1658},[],[1660],{"type":21,"value":491},{"type":21,"value":1662}," event is the one most people want first: it tells you a run is done. On macOS, this posts a notification:",{"type":16,"tag":152,"props":1664,"children":1666},{"className":154,"code":1665,"language":156,"meta":7,"style":7},"{\n  \"hooks\": {\n    \"Stop\": [\n      {\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"osascript -e 'display notification \\\"Claude finished\\\" with title \\\"Claude Code\\\"'\" }\n        ]\n      }\n    ]\n  }\n}\n",[1667],{"type":16,"tag":54,"props":1668,"children":1669},{"__ignoreMap":7},[1670,1677,1688,1699,1706,1717,1794,1801,1808,1815,1822],{"type":16,"tag":162,"props":1671,"children":1672},{"class":164,"line":165},[1673],{"type":16,"tag":162,"props":1674,"children":1675},{"style":169},[1676],{"type":21,"value":172},{"type":16,"tag":162,"props":1678,"children":1679},{"class":164,"line":175},[1680,1684],{"type":16,"tag":162,"props":1681,"children":1682},{"style":179},[1683],{"type":21,"value":182},{"type":16,"tag":162,"props":1685,"children":1686},{"style":169},[1687],{"type":21,"value":187},{"type":16,"tag":162,"props":1689,"children":1690},{"class":164,"line":190},[1691,1695],{"type":16,"tag":162,"props":1692,"children":1693},{"style":179},[1694],{"type":21,"value":196},{"type":16,"tag":162,"props":1696,"children":1697},{"style":169},[1698],{"type":21,"value":201},{"type":16,"tag":162,"props":1700,"children":1701},{"class":164,"line":204},[1702],{"type":16,"tag":162,"props":1703,"children":1704},{"style":169},[1705],{"type":21,"value":210},{"type":16,"tag":162,"props":1707,"children":1708},{"class":164,"line":213},[1709,1713],{"type":16,"tag":162,"props":1710,"children":1711},{"style":179},[1712],{"type":21,"value":219},{"type":16,"tag":162,"props":1714,"children":1715},{"style":169},[1716],{"type":21,"value":201},{"type":16,"tag":162,"props":1718,"children":1719},{"class":164,"line":226},[1720,1724,1728,1732,1736,1740,1744,1748,1753,1758,1763,1767,1772,1776,1781,1785,1790],{"type":16,"tag":162,"props":1721,"children":1722},{"style":169},[1723],{"type":21,"value":232},{"type":16,"tag":162,"props":1725,"children":1726},{"style":179},[1727],{"type":21,"value":237},{"type":16,"tag":162,"props":1729,"children":1730},{"style":169},[1731],{"type":21,"value":103},{"type":16,"tag":162,"props":1733,"children":1734},{"style":244},[1735],{"type":21,"value":247},{"type":16,"tag":162,"props":1737,"children":1738},{"style":169},[1739],{"type":21,"value":252},{"type":16,"tag":162,"props":1741,"children":1742},{"style":179},[1743],{"type":21,"value":247},{"type":16,"tag":162,"props":1745,"children":1746},{"style":169},[1747],{"type":21,"value":103},{"type":16,"tag":162,"props":1749,"children":1750},{"style":244},[1751],{"type":21,"value":1752},"\"osascript -e 'display notification ",{"type":16,"tag":162,"props":1754,"children":1755},{"style":179},[1756],{"type":21,"value":1757},"\\\"",{"type":16,"tag":162,"props":1759,"children":1760},{"style":244},[1761],{"type":21,"value":1762},"Claude finished",{"type":16,"tag":162,"props":1764,"children":1765},{"style":179},[1766],{"type":21,"value":1757},{"type":16,"tag":162,"props":1768,"children":1769},{"style":244},[1770],{"type":21,"value":1771}," with title ",{"type":16,"tag":162,"props":1773,"children":1774},{"style":179},[1775],{"type":21,"value":1757},{"type":16,"tag":162,"props":1777,"children":1778},{"style":244},[1779],{"type":21,"value":1780},"Claude Code",{"type":16,"tag":162,"props":1782,"children":1783},{"style":179},[1784],{"type":21,"value":1757},{"type":16,"tag":162,"props":1786,"children":1787},{"style":244},[1788],{"type":21,"value":1789},"'\"",{"type":16,"tag":162,"props":1791,"children":1792},{"style":169},[1793],{"type":21,"value":270},{"type":16,"tag":162,"props":1795,"children":1796},{"class":164,"line":273},[1797],{"type":16,"tag":162,"props":1798,"children":1799},{"style":169},[1800],{"type":21,"value":279},{"type":16,"tag":162,"props":1802,"children":1803},{"class":164,"line":282},[1804],{"type":16,"tag":162,"props":1805,"children":1806},{"style":169},[1807],{"type":21,"value":288},{"type":16,"tag":162,"props":1809,"children":1810},{"class":164,"line":291},[1811],{"type":16,"tag":162,"props":1812,"children":1813},{"style":169},[1814],{"type":21,"value":297},{"type":16,"tag":162,"props":1816,"children":1817},{"class":164,"line":300},[1818],{"type":16,"tag":162,"props":1819,"children":1820},{"style":169},[1821],{"type":21,"value":306},{"type":16,"tag":162,"props":1823,"children":1824},{"class":164,"line":309},[1825],{"type":16,"tag":162,"props":1826,"children":1827},{"style":169},[1828],{"type":21,"value":315},{"type":16,"tag":17,"props":1830,"children":1831},{},[1832,1834,1840],{"type":21,"value":1833},"On Linux, swap in ",{"type":16,"tag":54,"props":1835,"children":1837},{"className":1836},[],[1838],{"type":21,"value":1839},"notify-send \"Claude Code\" \"Claude finished\"",{"type":21,"value":61},{"type":16,"tag":29,"props":1842,"children":1844},{"id":1843},"debugging-a-hook-that-does-nothing",[1845],{"type":21,"value":1846},"Debugging a hook that does nothing",{"type":16,"tag":17,"props":1848,"children":1849},{},[1850,1852,1857,1859,1865,1867,1873],{"type":21,"value":1851},"Two things catch everyone out. First, Claude Code snapshots your hooks when a session starts, so a hook you add mid-session will not fire until you restart or review it from ",{"type":16,"tag":54,"props":1853,"children":1855},{"className":1854},[],[1856],{"type":21,"value":353},{"type":21,"value":1858},". Second, hooks run without your interactive shell setup, so a command that works in your terminal can fail here on a missing ",{"type":16,"tag":54,"props":1860,"children":1862},{"className":1861},[],[1863],{"type":21,"value":1864},"PATH",{"type":21,"value":1866}," entry. Run ",{"type":16,"tag":54,"props":1868,"children":1870},{"className":1869},[],[1871],{"type":21,"value":1872},"claude --debug",{"type":21,"value":1874}," to see each hook being matched, executed and its exit code.",{"type":16,"tag":29,"props":1876,"children":1878},{"id":1877},"a-word-on-safety",[1879],{"type":21,"value":1880},"A word on safety",{"type":16,"tag":17,"props":1882,"children":1883},{},[1884,1886,1891],{"type":21,"value":1885},"Hooks run arbitrary commands on your machine, with your permissions, automatically. Only add hooks you understand, keep project-level hooks in review like any other code, and be wary of copying a ",{"type":16,"tag":54,"props":1887,"children":1889},{"className":1888},[],[1890],{"type":21,"value":78},{"type":21,"value":1892}," you did not read. A hook is as powerful as anything you would type in your own shell.",{"type":16,"tag":29,"props":1894,"children":1896},{"id":1895},"let-a-mascot-read-the-hooks-for-you",[1897],{"type":21,"value":1898},"Let a mascot read the hooks for you",{"type":16,"tag":17,"props":1900,"children":1901},{},[1902,1904,1910,1912,1918,1920,1925],{"type":21,"value":1903},"Wiring hooks by hand is great for one-off scripts, but if all you want is to ",{"type":16,"tag":1905,"props":1906,"children":1907},"em",{},[1908],{"type":21,"value":1909},"see",{"type":21,"value":1911}," what every session is doing, that is exactly what ",{"type":16,"tag":554,"props":1913,"children":1915},{"href":1914},"/",[1916],{"type":21,"value":1917},"Blooby",{"type":21,"value":1919}," does. It sets up its own Claude Code hooks for you, with no ",{"type":16,"tag":54,"props":1921,"children":1923},{"className":1922},[],[1924],{"type":21,"value":78},{"type":21,"value":1926}," editing, and turns every event above into a live desktop mascot: idle when waiting, busy while working, looking up the moment it needs permission, celebrating when a run finishes.",{"type":16,"tag":17,"props":1928,"children":1929},{},[1930],{"type":21,"value":1931},"One session or five, you read the room at a glance instead of tailing a log.",{"type":16,"tag":1933,"props":1934,"children":1935},"style",{},[1936],{"type":21,"value":1937},"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":175,"depth":175,"links":1939},[1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950],{"id":31,"depth":175,"text":34},{"id":64,"depth":175,"text":67},{"id":358,"depth":175,"text":361},{"id":563,"depth":175,"text":566},{"id":859,"depth":175,"text":862},{"id":1181,"depth":175,"text":1184},{"id":1527,"depth":175,"text":1530},{"id":1647,"depth":175,"text":1650},{"id":1843,"depth":175,"text":1846},{"id":1877,"depth":175,"text":1880},{"id":1895,"depth":175,"text":1898},"markdown","content:guides:claude-code-hooks.md","content","guides/claude-code-hooks.md","guides/claude-code-hooks","md",1]