[{"data":1,"prerenderedAt":408},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fconcepts\u002Fhot-reload":3},{"id":4,"title":5,"body":6,"description":16,"extension":402,"meta":403,"navigation":169,"path":404,"seo":405,"stem":406,"__hash__":407},"docs\u002Fdocs\u002Fv2\u002Fconcepts\u002Fhot-reload.md","Hot Reload",{"type":7,"value":8,"toc":395},"minimark",[9,13,17,20,25,28,31,35,126,132,136,139,146,353,359,363,370,373,377,380,383,391],[10,11,5],"h1",{"id":12},"hot-reload",[14,15,16],"p",{},"Save a file. The agent updates. The session stays open, the thread history stays intact,\nand the next turn uses the new surface.",[14,18,19],{},"Hot reload is scoped to the file that changed. Nothing outside that scope is disturbed.",[21,22,24],"h2",{"id":23},"what-changes-and-when","What changes and when",[14,26,27],{},"In-flight turns complete on the surface revision they started with. The reload is applied\nafter the runtime reaches a safe point — in-flight tool calls are allowed to finish first.\nThe next turn picks up the new surface.",[14,29,30],{},"This means you can edit a tool mid-conversation, save it, and the next message in the same\nthread will have access to the updated implementation. The conversation history doesn't\nmove. The agent's position in the work doesn't move. Only the surface changes.",[21,32,34],{"id":33},"what-triggers-a-reload","What triggers a reload",[36,37,38,51],"table",{},[39,40,41],"thead",{},[42,43,44,48],"tr",{},[45,46,47],"th",{},"Changed file",[45,49,50],{},"What reloads",[52,53,54,66,83,93,106,116],"tbody",{},[42,55,56,63],{},[57,58,59],"td",{},[60,61,62],"code",{},"src\u002Ftools\u002F**",[57,64,65],{},"Manifest rescanned, capsule replaced, tool declarations updated",[42,67,68,80],{},[57,69,70,73,74,73,77],{},[60,71,72],{},"src\u002Fboot.vue",", ",[60,75,76],{},"src\u002Fidentity.md",[60,78,79],{},"src\u002Fsystem.md",[57,81,82],{},"Identity text re-rendered for future turns",[42,84,85,90],{},[57,86,87],{},[60,88,89],{},".env",[57,91,92],{},"Environment reloaded, capsule replaced",[42,94,95,100],{},[57,96,97],{},[60,98,99],{},"package.json",[57,101,102,105],{},[60,103,104],{},"bun install"," runs, then capsule replaced",[42,107,108,113],{},[57,109,110],{},[60,111,112],{},"src\u002Fprompts\u002F**",[57,114,115],{},"Prompt metadata rescanned",[42,117,118,123],{},[57,119,120],{},[60,121,122],{},"src\u002Fscripts\u002F**",[57,124,125],{},"Script source updated for future invocations",[14,127,128,131],{},[60,129,130],{},"axon.config.ts",", server routes, and module wiring require a process restart — their\neffects are too broad to apply atomically to a running session.",[21,133,135],{"id":134},"capsule-reloads","Capsule reloads",[14,137,138],{},"Tools and environment live inside the capsule subprocess. When either changes, the old\ncapsule is replaced with a new one. The swap is atomic — the old capsule handles any\nin-flight tool calls to completion, then shuts down.",[14,140,141,142,145],{},"Module-level state inside ",[60,143,144],{},"src\u002Ftools\u002F"," does not survive a capsule reload. Caches, SDK\nclients, and open connections are recreated.",[147,148,153],"pre",{"className":149,"code":150,"language":151,"meta":152,"style":152},"language-ts shiki shiki-themes dark-plus","\u002F\u002F src\u002Ftools\u002Fgithub.ts\n\n\u002F\u002F This is recreated on every capsule reload.\nconst octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })\n\nexport async function listOpenPrs() {\n    const { data } = await octokit.pulls.list({ state: \"open\", ...repo() })\n    return data.map(pr => ({ number: pr.number, title: pr.title }))\n}\n","ts","",[60,154,155,164,171,177,223,228,247,295,347],{"__ignoreMap":152},[156,157,160],"span",{"class":158,"line":159},"line",1,[156,161,163],{"class":162},"sOLPB","\u002F\u002F src\u002Ftools\u002Fgithub.ts\n",[156,165,167],{"class":158,"line":166},2,[156,168,170],{"emptyLinePlaceholder":169},true,"\n",[156,172,174],{"class":158,"line":173},3,[156,175,176],{"class":162},"\u002F\u002F This is recreated on every capsule reload.\n",[156,178,180,184,188,192,195,199,202,206,209,212,215,217,220],{"class":158,"line":179},4,[156,181,183],{"class":182},"scz_3","const",[156,185,187],{"class":186},"s9McN"," octokit",[156,189,191],{"class":190},"sTNBD"," = ",[156,193,194],{"class":182},"new",[156,196,198],{"class":197},"sCudf"," Octokit",[156,200,201],{"class":190},"({ ",[156,203,205],{"class":204},"s3F5K","auth:",[156,207,208],{"class":204}," process",[156,210,211],{"class":190},".",[156,213,214],{"class":204},"env",[156,216,211],{"class":190},[156,218,219],{"class":186},"GITHUB_TOKEN",[156,221,222],{"class":190}," })\n",[156,224,226],{"class":158,"line":225},5,[156,227,170],{"emptyLinePlaceholder":169},[156,229,231,235,238,241,244],{"class":158,"line":230},6,[156,232,234],{"class":233},"sYbnZ","export",[156,236,237],{"class":182}," async",[156,239,240],{"class":182}," function",[156,242,243],{"class":197}," listOpenPrs",[156,245,246],{"class":190},"() {\n",[156,248,250,253,256,259,262,265,267,269,272,274,277,279,282,286,289,292],{"class":158,"line":249},7,[156,251,252],{"class":182},"    const",[156,254,255],{"class":190}," { ",[156,257,258],{"class":186},"data",[156,260,261],{"class":190}," } = ",[156,263,264],{"class":233},"await",[156,266,187],{"class":204},[156,268,211],{"class":190},[156,270,271],{"class":204},"pulls",[156,273,211],{"class":190},[156,275,276],{"class":197},"list",[156,278,201],{"class":190},[156,280,281],{"class":204},"state:",[156,283,285],{"class":284},"sKc5r"," \"open\"",[156,287,288],{"class":190},", ...",[156,290,291],{"class":197},"repo",[156,293,294],{"class":190},"() })\n",[156,296,298,301,304,306,309,312,315,318,321,324,327,329,332,334,337,339,341,344],{"class":158,"line":297},8,[156,299,300],{"class":233},"    return",[156,302,303],{"class":204}," data",[156,305,211],{"class":190},[156,307,308],{"class":197},"map",[156,310,311],{"class":190},"(",[156,313,314],{"class":204},"pr",[156,316,317],{"class":182}," =>",[156,319,320],{"class":190}," ({ ",[156,322,323],{"class":204},"number:",[156,325,326],{"class":204}," pr",[156,328,211],{"class":190},[156,330,331],{"class":204},"number",[156,333,73],{"class":190},[156,335,336],{"class":204},"title:",[156,338,326],{"class":204},[156,340,211],{"class":190},[156,342,343],{"class":204},"title",[156,345,346],{"class":190}," }))\n",[156,348,350],{"class":158,"line":349},9,[156,351,352],{"class":190},"}\n",[14,354,355,356,211],{},"Module scope is the right place for cheap clients and caches. Anything the agent must\nremember across reloads, restarts, or deploys belongs in ",[60,357,358],{},"data\u002F",[21,360,362],{"id":361},"thread-history","Thread history",[14,364,365,366,369],{},"Hot reload does not rewrite history. If you edit ",[60,367,368],{},"boot.vue"," mid-session, the entries\nalready in the thread were produced under the old identity — they stay exactly as they\nwere. The new identity applies to new work only.",[14,371,372],{},"Start a new session if you want a clean read of the updated agent from the beginning.\nStay in the same session to continue with the current working context on the new surface.",[21,374,376],{"id":375},"failure","Failure",[14,378,379],{},"A broken tool file, failed dependency install, or runtime boundary violation surfaces as a\nreload failure in the thread. The runtime does not silently continue with a mixed surface.",[14,381,382],{},"Fix the file and save again. The watcher retries immediately.",[14,384,385,386,211],{},"For the state layers that hot reload operates on, see ",[387,388,390],"a",{"href":389},"\u002Fdocs\u002Fv2\u002Fconcepts\u002Fstate-model","State Model",[392,393,394],"style",{},"html pre.shiki code .sOLPB, html code.shiki .sOLPB{--shiki-default:#6A9955}html pre.shiki code .scz_3, html code.shiki .scz_3{--shiki-default:#569CD6}html pre.shiki code .s9McN, html code.shiki .s9McN{--shiki-default:#4FC1FF}html pre.shiki code .sTNBD, html code.shiki .sTNBD{--shiki-default:#D4D4D4}html pre.shiki code .sCudf, html code.shiki .sCudf{--shiki-default:#DCDCAA}html pre.shiki code .s3F5K, html code.shiki .s3F5K{--shiki-default:#9CDCFE}html pre.shiki code .sYbnZ, html code.shiki .sYbnZ{--shiki-default:#C586C0}html pre.shiki code .sKc5r, html code.shiki .sKc5r{--shiki-default:#CE9178}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);}",{"title":152,"searchDepth":166,"depth":166,"links":396},[397,398,399,400,401],{"id":23,"depth":166,"text":24},{"id":33,"depth":166,"text":34},{"id":134,"depth":166,"text":135},{"id":361,"depth":166,"text":362},{"id":375,"depth":166,"text":376},"md",{},"\u002Fdocs\u002Fv2\u002Fconcepts\u002Fhot-reload",{"title":5,"description":16},"docs\u002Fv2\u002Fconcepts\u002Fhot-reload","Oj5QDjvaNfhUtrqEI0jQ9Jm7eCz8I4dLU7dKFtBzsqg",1785671807705]