[{"data":1,"prerenderedAt":303},["ShallowReactive",2],{"docs-\u002Fagent\u002Fpatch-mode":3},{"id":4,"title":5,"body":6,"description":294,"extension":295,"meta":296,"navigation":298,"path":299,"seo":300,"stem":301,"__hash__":302},"docs\u002Fdocs\u002Fagent\u002Fpatch-mode.md","Patch mode & AI",{"type":7,"value":8,"toc":287},"minimark",[9,13,30,33,38,107,110,142,144,148,174,177,196,198,202,205,225,232,234,238,269,271,283],[10,11,5],"h1",{"id":12},"patch-mode-ai",[14,15,16,17,21,22,25,26,29],"p",{},"The agent can patch your files in two ways: ",[18,19,20],"strong",{},"AST-based"," (syntax-aware, deterministic) or ",[18,23,24],{},"AI-based"," (LLM rewrites whole files). By default it uses ",[18,27,28],{},"hybrid"," mode.",[31,32],"hr",{},[34,35,37],"h2",{"id":36},"modes","Modes",[39,40,41,57],"table",{},[42,43,44],"thead",{},[45,46,47,51,54],"tr",{},[48,49,50],"th",{},"Mode",[48,52,53],{},"Flag",[48,55,56],{},"Description",[58,59,60,77,92],"tbody",{},[45,61,62,67,74],{},[63,64,65],"td",{},[18,66,28],{},[63,68,69,73],{},[70,71,72],"code",{},"--patch-mode hybrid"," (default)",[63,75,76],{},"Try AST patching first; fall back to AI if needed and configured",[45,78,79,84,89],{},[63,80,81],{},[18,82,83],{},"ast",[63,85,86],{},[70,87,88],{},"--patch-mode ast",[63,90,91],{},"AST-only. No LLM, no API key. Best when your code layout is standard.",[45,93,94,99,104],{},[63,95,96],{},[18,97,98],{},"ai",[63,100,101],{},[70,102,103],{},"--patch-mode ai",[63,105,106],{},"AI-first. Send entire files to an LLM for patching. Useful for complex or unusual layouts.",[14,108,109],{},"Example — use AI for everything:",[111,112,117],"pre",{"className":113,"code":114,"language":115,"meta":116,"style":116},"language-bash shiki shiki-themes github-dark","npx @synchronized-studio\u002Fcmsassets-agent init --patch-mode ai\n","bash","",[70,118,119],{"__ignoreMap":116},[120,121,124,128,132,135,139],"span",{"class":122,"line":123},"line",1,[120,125,127],{"class":126},"svObZ","npx",[120,129,131],{"class":130},"sU2Wk"," @synchronized-studio\u002Fcmsassets-agent",[120,133,134],{"class":130}," init",[120,136,138],{"class":137},"sDLfK"," --patch-mode",[120,140,141],{"class":130}," ai\n",[31,143],{},[34,145,147],{"id":146},"when-to-use-ai-mode","When to use AI mode",[149,150,151,158,164],"ul",{},[152,153,154,157],"li",{},[18,155,156],{},"AST fails"," — e.g. non-standard formatting, mixed patterns, or edge cases the parser doesn’t handle.",[152,159,160,163],{},[18,161,162],{},"Unusual structure"," — large files, many injection points, or custom patterns.",[152,165,166,169,170,173],{},[18,167,168],{},"Extra safety"," — you can combine AI patching with ",[18,171,172],{},"AI verification"," (see below).",[14,175,176],{},"AI mode requires:",[149,178,179,185],{},[152,180,181,184],{},[70,182,183],{},"OPENAI_API_KEY"," in the environment",[152,186,187,188,191,192,195],{},"Optional dependency ",[70,189,190],{},"openai"," (install if you use AI: ",[70,193,194],{},"npm install openai",").",[31,197],{},[34,199,201],{"id":200},"ai-verification-optional","AI verification (optional)",[14,203,204],{},"After patching, you can run an AI review over the changed files to catch mistakes:",[111,206,208],{"className":113,"code":207,"language":115,"meta":116,"style":116},"npx @synchronized-studio\u002Fcmsassets-agent verify --dir .\n",[70,209,210],{"__ignoreMap":116},[120,211,212,214,216,219,222],{"class":122,"line":123},[120,213,127],{"class":126},[120,215,131],{"class":130},[120,217,218],{"class":130}," verify",[120,220,221],{"class":137}," --dir",[120,223,224],{"class":130}," .\n",[14,226,227,228,231],{},"With the right profile, the verifier uses an LLM to check that each patched file still makes sense (no broken exports, no unreachable code, correct transformer usage). Useful after ",[70,229,230],{},"apply"," or when you’ve run the agent in AI mode.",[31,233],{},[34,235,237],{"id":236},"summary","Summary",[149,239,240,246,254,261],{},[152,241,242,243,245],{},"Default ",[18,244,28],{}," is enough for most projects.",[152,247,248,249,253],{},"Use ",[18,250,251],{},[70,252,88],{}," for a strict, no-API, deterministic run.",[152,255,248,256,260],{},[18,257,258],{},[70,259,103],{}," when AST struggles or you want the model to handle tricky files.",[152,262,248,263,268],{},[18,264,265],{},[70,266,267],{},"verify"," for an extra AI check after patching.",[31,270],{},[14,272,273,278,279],{},[274,275,277],"a",{"href":276},"\u002Fdocs\u002Fagent\u002Fcommands","← Commands & options"," · ",[274,280,282],{"href":281},"\u002Fdocs\u002Fagent\u002Fframeworks","Supported frameworks →",[284,285,286],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}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":116,"searchDepth":288,"depth":288,"links":289},2,[290,291,292,293],{"id":36,"depth":288,"text":37},{"id":146,"depth":288,"text":147},{"id":200,"depth":288,"text":201},{"id":236,"depth":288,"text":237},"ast, ai, hybrid and optional AI verification.","md",{"parent":297},"\u002Fdocs\u002Fagent",true,"\u002Fdocs\u002Fagent\u002Fpatch-mode",{"title":5,"description":294},"docs\u002Fagent\u002Fpatch-mode","ErtVq_35sGe4YUw94IiussTE0zYtaX8gXsZgf1gLw-8",1777579477800]