[{"data":1,"prerenderedAt":1804},["ShallowReactive",2],{"blog-post-claude-virtual-machine-platform-not-available-fix":3,"related-posts-claude-virtual-machine-platform-not-available-fix":572},{"id":4,"title":5,"author":6,"body":10,"category":550,"date":551,"description":552,"extension":553,"featured":554,"image":555,"imageHeight":556,"imageWidth":557,"meta":558,"navigation":559,"path":560,"readingTime":561,"seo":562,"seoTitle":563,"stem":564,"tags":565,"updatedDate":551,"__hash__":571},"blog/blog/claude-virtual-machine-platform-not-available-fix.md","\"Virtual Machine Platform Not Available\" for Claude: How to Enable It on Windows",{"name":7,"role":8,"avatar":9},"Shabnam Katoch","Growth Head","/img/avatars/shabnam-profile.jpeg",{"type":11,"value":12,"toc":538},"minimark",[13,20,23,26,29,72,77,80,83,90,93,97,100,105,108,127,130,133,162,165,168,177,192,198,202,205,211,217,220,234,237,240,246,249,253,256,263,266,284,287,293,298,308,318,324,327,339,343,354,364,374,380,383,389,395,401,404,424,428,434,440,452,461,474,478,481,484,488,493,496,501,504,509,512,517,526,531,534],[14,15,16],"p",{},[17,18,19],"strong",{},"The fix takes 5 minutes if Windows cooperates. Here's what to do when it doesn't.",[14,21,22],{},"You open Claude Desktop, click on the Cowork tab, and instead of a workspace you get a message that says \"Virtual Machine Platform not available.\" It tells you to enable the feature and restart your computer. You restart. Same error. You restart again. Same error.",[14,24,25],{},"Here's the weird part. Some people fix this in two minutes by toggling one Windows setting. Others have Hyper-V fully enabled, every virtualization feature turned on, and they're still stuck because of a detection bug in Claude Desktop that misclassifies their hardware as unsupported.",[14,27,28],{},"This post covers both paths. The quick fix that works for most people, and the deeper fixes for when Windows says virtualization is enabled but Claude refuses to believe it.",[30,31,33],"callout",{"type":32},"quick-fix",[14,34,35,38,39,42,43,46,47,50,51,54,55,58,59,62,63,67,68,71],{},[17,36,37],{},"Fastest fix:"," Open ",[17,40,41],{},"Turn Windows features on or off",", check ",[17,44,45],{},"Virtual Machine Platform",", ",[17,48,49],{},"Windows Hypervisor Platform",", and ",[17,52,53],{},"Hyper-V",", then restart. If the boxes are greyed out, enable ",[17,56,57],{},"VT-x"," (Intel) or ",[17,60,61],{},"SVM Mode"," (AMD) in your BIOS first. If everything is enabled and Claude still errors, check ",[64,65,66],"code",{},"%APPDATA%\\Claude\\logs\\cowork_vm_node.log"," for ",[64,69,70],{},"yukonSilver not supported"," — that's an Anthropic-side detection bug, not your machine.",[73,74,76],"h2",{"id":75},"why-claude-cowork-needs-a-virtual-machine-at-all","Why Claude Cowork needs a virtual machine at all",[14,78,79],{},"Claude Cowork runs your agent's workspace inside a sandboxed virtual machine on your local computer. This is a security decision. The VM isolates the agent's file access, network activity, and tool execution from the rest of your system, so a misbehaving agent can't accidentally (or maliciously) touch files outside its sandbox.",[14,81,82],{},"The tradeoff: your machine needs to support hardware virtualization, and Windows needs to have the right features turned on. If either condition isn't met, you get the error.",[14,84,85],{},[86,87],"img",{"alt":88,"src":89},"Cowork's VM acts as a sandbox wall between the agent and your personal files, browser, photos, and documents, which is why your machine has to support virtualization.","/img/blog/claude-virtual-machine-platform-not-available-fix-why-vm-sandbox.jpg",[14,91,92],{},"The \"Virtual Machine Platform not available\" error almost always means one of three things: the Windows feature isn't enabled, virtualization is disabled in your BIOS, or Claude's VM detection has a known bug. Fix them in that order.",[73,94,96],{"id":95},"fix-1-enable-virtual-machine-platform-in-windows-features","Fix 1: Enable Virtual Machine Platform in Windows Features",[14,98,99],{},"This is the fix for the majority of people who see this error. Windows has the feature installed but it's not turned on by default.",[14,101,102],{},[17,103,104],{},"Windows 11 and Windows 10 Pro/Enterprise/Education:",[14,106,107],{},"Open the Start menu, type \"Turn Windows features on or off,\" and press Enter. In the list that appears, find and check these three items:",[109,110,111,117,122],"ul",{},[112,113,114,116],"li",{},[17,115,45],{}," (this is the one the error message specifically mentions)",[112,118,119,121],{},[17,120,49],{}," (the underlying hypervisor layer)",[112,123,124,126],{},[17,125,53],{}," (the full virtualization stack, includes management tools)",[14,128,129],{},"Click OK. Windows will install the features and ask you to restart. Restart.",[14,131,132],{},"If you prefer the command line, open PowerShell as Administrator and run:",[134,135,140],"pre",{"className":136,"code":137,"language":138,"meta":139,"style":139},"language-powershell shiki shiki-themes github-light","dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart\ndism.exe /online /enable-feature /featurename:HypervisorPlatform /all /norestart\ndism.exe /online /enable-feature /featurename:Microsoft-Hyper-V-All /all /norestart\n","powershell","",[64,141,142,150,156],{"__ignoreMap":139},[143,144,147],"span",{"class":145,"line":146},"line",1,[143,148,149],{},"dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart\n",[143,151,153],{"class":145,"line":152},2,[143,154,155],{},"dism.exe /online /enable-feature /featurename:HypervisorPlatform /all /norestart\n",[143,157,159],{"class":145,"line":158},3,[143,160,161],{},"dism.exe /online /enable-feature /featurename:Microsoft-Hyper-V-All /all /norestart\n",[14,163,164],{},"Then restart your computer.",[14,166,167],{},"To verify the features are actually enabled after restart, run this in PowerShell:",[134,169,171],{"className":136,"code":170,"language":138,"meta":139,"style":139},"Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform\n",[64,172,173],{"__ignoreMap":139},[143,174,175],{"class":145,"line":146},[143,176,170],{},[14,178,179,180,183,184,187,188,191],{},"If ",[64,181,182],{},"State"," shows ",[64,185,186],{},"Enabled",", the feature is on. If it still shows ",[64,189,190],{},"Disabled"," after the restart, something deeper is wrong, and you need Fix 2.",[14,193,194],{},[86,195],{"alt":196,"src":197},"Checking Virtual Machine Platform, Windows Hypervisor Platform, and Hyper-V in Turn Windows features on or off, then restarting, fixes this for roughly 70 percent of people.","/img/blog/claude-virtual-machine-platform-not-available-fix-windows-features.jpg",[73,199,201],{"id":200},"fix-2-enable-virtualization-in-your-biosuefi","Fix 2: Enable virtualization in your BIOS/UEFI",[14,203,204],{},"If Fix 1 didn't work, or if Windows wouldn't let you enable the features, your CPU's virtualization support is probably turned off at the hardware level. This is common on laptops that shipped with virtualization disabled by default.",[14,206,207,210],{},[17,208,209],{},"How to check without entering BIOS:"," Open Task Manager (Ctrl+Shift+Esc), click the Performance tab, click CPU. Look for \"Virtualization\" in the bottom-right area. If it says \"Disabled,\" you need to enable it in BIOS.",[14,212,213,216],{},[17,214,215],{},"How to enter BIOS/UEFI:"," Restart your computer and press the BIOS key during boot. The key varies by manufacturer: F2 for most Dell and Lenovo laptops, F10 for HP, Del for most desktops, F12 for some Asus boards. If you're unsure, your manufacturer's website will have the specific key.",[14,218,219],{},"In BIOS, look for one of these settings (the name varies by manufacturer):",[109,221,222,228],{},[112,223,224,227],{},[17,225,226],{},"Intel:"," \"Intel Virtualization Technology\" or \"Intel VT-x\" or \"VT-x\"",[112,229,230,233],{},[17,231,232],{},"AMD:"," \"SVM Mode\" or \"AMD-V\"",[14,235,236],{},"It's usually under Advanced, CPU Configuration, or Security. Enable it. Save and exit BIOS. Your computer will restart.",[14,238,239],{},"After the restart, go back to Fix 1 and enable the Windows features. They should work now.",[14,241,242],{},[86,243],{"alt":244,"src":245},"Check the Virtualization line in Task Manager's CPU tab first; if it says Disabled, enter BIOS with F2, F10, Del, or F12 and turn on Intel VT-x or AMD SVM Mode.","/img/blog/claude-virtual-machine-platform-not-available-fix-bios-virtualization.jpg",[14,247,248],{},"If your BIOS doesn't have a virtualization option at all, your CPU may be too old to support it. Any Intel Core i-series from 4th generation (Haswell, 2013) onward supports VT-x. Any AMD Ryzen supports SVM. If you're on something older than that, Cowork won't work on this machine.",[73,250,252],{"id":251},"fix-3-the-yukonsilver-not-supported-bug","Fix 3: The \"yukonSilver not supported\" bug",[14,254,255],{},"Stay with me here, because this is the one that catches people who did everything right and are still stuck.",[14,257,258,259,262],{},"Multiple GitHub issues filed against Claude Desktop (#25136, #32004, #32837) report that even with Hyper-V fully enabled, Virtual Machine Platform enabled, and the ",[64,260,261],{},"CoworkVMService"," running correctly, Claude's VM detection classifies the system as \"yukonSilver not supported\" and enters a loop, deleting and rechecking for the VM bundle on every launch without ever initializing it.",[14,264,265],{},"\"yukonSilver\" is Claude's internal codename for its VM configuration on Windows. The bug is in the platform detection logic: it incorrectly classifies fully capable x64 Windows 11 Pro systems as unsupported.",[14,267,268,271,272,275,276,279,280,283],{},[17,269,270],{},"How to tell if this is your problem:"," Navigate to ",[64,273,274],{},"%APPDATA%\\Claude\\logs\\"," and open ",[64,277,278],{},"cowork_vm_node.log",". If you see repeated lines saying ",[64,281,282],{},"yukonSilver not supported (status=unsupported)",", you're hitting this specific bug.",[14,285,286],{},"This has been reported across Windows 11 Pro, Enterprise, and Education editions on builds 25H2 and later, with all virtualization features confirmed enabled via both the GUI and PowerShell verification.",[14,288,289],{},[86,290],{"alt":291,"src":292},"Even with Hyper-V, VM Platform, and BIOS VT-x all enabled, Claude Desktop logs \"yukonSilver not supported\" and loops deleting and rechecking the VM bundle.","/img/blog/claude-virtual-machine-platform-not-available-fix-yukonsilver-bug.jpg",[14,294,295],{},[17,296,297],{},"What to try:",[14,299,300,303,304,307],{},[17,301,302],{},"Check for conflicting hypervisors."," If you previously had VirtualBox or VMware installed, traces of their hypervisor drivers can interfere with Windows' native Hyper-V even after uninstallation. Run ",[64,305,306],{},"systeminfo"," in a command prompt and look for the Hyper-V Requirements section. If it says \"A hypervisor has been detected. Features required for Hyper-V will not be displayed,\" another hypervisor layer may still be active.",[14,309,310,313,314,317],{},[17,311,312],{},"Try uninstalling and cleanly reinstalling Claude Desktop."," Delete the ",[64,315,316],{},"%APPDATA%\\Claude"," folder entirely before reinstalling, so the VM detection runs fresh without cached state from a previous failed attempt.",[14,319,320,323],{},[17,321,322],{},"Update Claude Desktop to the latest version."," This is a known, actively tracked bug across multiple GitHub issues, and Anthropic has been working on fixes to the platform detection logic. Running an older version means running older detection code.",[14,325,326],{},"If none of that works, the honest answer is that this is an Anthropic-side bug, not something you can fix with Windows settings. The workaround while waiting for a fix is to use Claude Cowork on a macOS machine if you have access to one (macOS uses Apple's Virtualization Framework instead of Hyper-V and doesn't hit this detection issue), or to use Claude Code via the terminal, which doesn't require the VM at all.",[14,328,329,330,335,336,338],{},"If your symptom is a missing Cowork tab rather than an explicit VM error, or the VM starts and then dies after a reboot, those are separate failure modes. Our full breakdown of ",[331,332,334],"a",{"href":333},"/blog/claude-cowork-not-working-windows","Claude Cowork not working on Windows"," covers the ",[64,337,261],{}," startup-type problem, the Host Compute Service stack, and the 172.16.0.0/24 network conflicts with Docker and VPNs.",[73,340,342],{"id":341},"what-if-youre-on-windows-home","What if you're on Windows Home?",[14,344,345,346,349,350,353],{},"This is where a lot of advice on the internet gets it slightly wrong. Windows Home ",[17,347,348],{},"does"," include Virtual Machine Platform and Windows Hypervisor Platform, so enabling those features can appear to succeed. What Home is missing is the full Hyper-V management stack, specifically the ",[64,351,352],{},"vmms"," (Virtual Machine Management) service that Cowork's VM depends on. Without it, the VM either fails silently or throws a mount error, even though the feature checkboxes looked fine.",[14,355,356,359,360,363],{},[17,357,358],{},"The quickest way to confirm:"," open PowerShell and run ",[64,361,362],{},"Get-Service vmms",". If the service isn't found, you're on Home and Cowork won't work without an edition upgrade.",[14,365,366,367,370,371,373],{},"One caveat worth knowing: Anthropic's downloadable Cowork readiness checker can falsely report \"ready\" on Windows 11 Home, because Windows 11 internally still reports its version as ",[64,368,369],{},"10.0"," and the checker misidentifies the OS (GitHub #50621). Trust ",[64,372,362],{}," over the checker.",[14,375,376],{},[86,377],{"alt":378,"src":379},"Windows Home lacks the Hyper-V stack Cowork needs, leaving three options: upgrade to Pro for about $99, use Claude Code with no VM, or use Claude.ai chat.","/img/blog/claude-virtual-machine-platform-not-available-fix-windows-home.jpg",[14,381,382],{},"Your options:",[14,384,385,388],{},[17,386,387],{},"Upgrade to Windows Pro."," Microsoft sells the upgrade for around $99 in the Microsoft Store. It's the only permanent fix for this limitation on Windows Home.",[14,390,391,394],{},[17,392,393],{},"Use Claude Code instead of Cowork."," Claude Code runs in your terminal without requiring a VM. You lose the visual Cowork workspace but keep all the AI coding capabilities.",[14,396,397,400],{},[17,398,399],{},"Use Claude.ai chat."," If your workflow doesn't require the sandboxed file-system access that Cowork provides, the web chat interface works on any OS without virtualization requirements.",[14,402,403],{},"If the idea of troubleshooting Windows virtualization settings, BIOS configurations, and VM detection bugs just to get an AI agent running sounds like the wrong use of your afternoon, that's a feeling we understand well. We built BetterClaw specifically so you never have to touch Hyper-V, Docker, or any local VM setup to run an AI agent. Everything runs on managed infrastructure.",[405,406,407,412],"blockquote",{},[408,409,411],"h3",{"id":410},"no-hyper-v-no-bios-no-windows-edition-restrictions","No Hyper-V. No BIOS. No Windows edition restrictions.",[14,413,414,415,423],{},"Your agent runs on managed cloud infrastructure and deploys from any machine with a browser. Free forever, not a trial.\n",[17,416,417],{},[331,418,422],{"href":419,"rel":420},"https://app.betterclaw.io/sign-in",[421],"nofollow","Start free →","\nNo credit card · 25+ integrations · Deploy in ~60 seconds",[73,425,427],{"id":426},"quick-reference-the-troubleshooting-order","Quick reference: the troubleshooting order",[14,429,430,433],{},[17,431,432],{},"Step 1:"," Enable Virtual Machine Platform, Windows Hypervisor Platform, and Hyper-V in Windows Features. Restart.",[14,435,436,439],{},[17,437,438],{},"Step 2:"," If that didn't work, check Task Manager for virtualization status. If disabled, enter BIOS and enable VT-x (Intel) or SVM Mode (AMD). Restart, then redo Step 1.",[14,441,442,445,446,448,449,451],{},[17,443,444],{},"Step 3:"," If features are enabled but Claude still shows the error, check ",[64,447,66],{}," for \"yukonSilver not supported.\" If present, clean reinstall Claude Desktop and delete the ",[64,450,316],{}," folder first.",[14,453,454,457,458,460],{},[17,455,456],{},"Step 4:"," Run ",[64,459,362],{},". If it's missing, you're on Windows Home — upgrade to Pro or use Claude Code/chat as alternatives.",[14,462,463,464,468,469,473],{},"If you're running into ",[331,465,467],{"href":466},"/blog/claude-rate-limited-meaning-fix","Claude rate limits"," on top of VM issues, that's a separate problem with a separate fix. And for teams managing agents across different machines where VM compatibility is inconsistent, our guide to ",[331,470,472],{"href":471},"/blog/cut-agent-token-costs-context-engineering","cutting agent token costs"," covers the multi-provider routing approach that eliminates single-platform dependency entirely.",[73,475,477],{"id":476},"the-honest-takeaway","The honest takeaway",[14,479,480],{},"The Virtual Machine Platform error is one of those problems that's either a 5-minute fix or a 2-hour rabbit hole, with almost nothing in between. If you're in the 5-minute camp, the Windows Features toggle handles it. If you're in the 2-hour camp, you're probably hitting the yukonSilver detection bug, which is on Anthropic's side to fix.",[14,482,483],{},"Either way, the underlying pattern is worth noticing: running AI agents locally means depending on your specific hardware, your specific OS edition, and your specific BIOS settings all working together. Every one of those is a seam where something can break. If that dependency chain concerns you more than the problem du jour, give BetterClaw a try. Free plan with 1 agent and 500 credits a month. $49/month for Pro. No VMs required. No BIOS changes. No Windows edition restrictions. Your first agent deploys in about 60 seconds, on any machine with a browser.",[73,485,487],{"id":486},"frequently-asked-questions","Frequently Asked Questions",[14,489,490],{},[17,491,492],{},"What does \"Virtual Machine Platform not available\" mean for Claude?",[14,494,495],{},"It means Claude Cowork can't start its sandboxed VM workspace because the Windows virtualization features it depends on aren't enabled or aren't detected. The fix is usually enabling Virtual Machine Platform and Hyper-V in Windows Features and restarting, but there's also a known detection bug where Claude misclassifies properly configured systems as unsupported.",[14,497,498],{},[17,499,500],{},"How do I enable Hyper-V for Claude Cowork on Windows 11?",[14,502,503],{},"Open \"Turn Windows features on or off\" from the Start menu, check Virtual Machine Platform, Windows Hypervisor Platform, and Hyper-V, then restart your computer. If the checkboxes are greyed out, you may need to enable VT-x (Intel) or SVM Mode (AMD) in your BIOS first. Windows Home edition does not include the full Hyper-V stack and requires an upgrade to Pro.",[14,505,506],{},[17,507,508],{},"How long does it take to fix the Claude VM error?",[14,510,511],{},"If the fix is just enabling Windows Features, about 5 minutes including the restart. If you need to enter BIOS to enable virtualization, add another 5 to 10 minutes. If you're hitting the yukonSilver detection bug, the fix may require waiting for an update from Anthropic, as it's a known issue in Claude Desktop's platform detection.",[14,513,514],{},[17,515,516],{},"Can I use Claude Cowork on Windows Home?",[14,518,519,520,522,523,525],{},"Not currently. Windows Home includes Virtual Machine Platform and Windows Hypervisor Platform but lacks the ",[64,521,352],{}," service that Cowork's VM requires, so the features can look enabled while the VM still fails. Run ",[64,524,362],{}," to confirm. Your options are upgrading to Windows Pro ($99 from Microsoft), using Claude Code via the terminal (no VM needed), or using the Claude.ai web chat interface.",[14,527,528],{},[17,529,530],{},"Why does Claude Cowork need a virtual machine?",[14,532,533],{},"Cowork runs your agent's workspace inside a sandboxed VM to isolate its file access and tool execution from the rest of your system. This is a security measure that prevents an agent from accessing files or network resources outside its designated workspace, which matters when the agent is running autonomously and interacting with tools on your behalf.",[535,536,537],"style",{},"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":139,"searchDepth":152,"depth":152,"links":539},[540,541,542,543,544,547,548,549],{"id":75,"depth":152,"text":76},{"id":95,"depth":152,"text":96},{"id":200,"depth":152,"text":201},{"id":251,"depth":152,"text":252},{"id":341,"depth":152,"text":342,"children":545},[546],{"id":410,"depth":158,"text":411},{"id":426,"depth":152,"text":427},{"id":476,"depth":152,"text":477},{"id":486,"depth":152,"text":487},"Troubleshooting","2026-07-20","Claude Cowork says \"Virtual Machine Platform not available\"? Here's how to enable Hyper-V, check BIOS, and fix the yukonSilver detection bug on Windows.","md",false,"/img/blog/claude-virtual-machine-platform-not-available-fix.jpg",512,1024,{},true,"/blog/claude-virtual-machine-platform-not-available-fix","8 min read",{"title":5,"description":552},"Claude VM Platform Not Available: Windows Fix Guide","blog/claude-virtual-machine-platform-not-available-fix",[566,567,568,569,570],"claude virtual machine platform not available","claude cowork hyper-v","enable virtual machine platform windows","claude cowork VM error","claude desktop virtualization fix","YybI_46JhbZHdBHegA_vL9fQkxUKrWCqztxwR15SeAs",[573,930,1335],{"id":574,"title":575,"author":576,"body":577,"category":550,"date":912,"description":913,"extension":553,"featured":554,"image":914,"imageHeight":915,"imageWidth":915,"meta":916,"navigation":559,"path":917,"readingTime":918,"seo":919,"seoTitle":920,"stem":921,"tags":922,"updatedDate":912,"__hash__":929},"blog/blog/agent-losing-context-fix-guide.md","Agent Memory Leaking or Losing Context? Here's How to Fix It",{"name":7,"role":8,"avatar":9},{"type":11,"value":578,"toc":890},[579,582,585,588,591,594,597,601,604,607,610,613,616,622,626,629,633,636,639,645,649,652,655,660,664,667,672,676,679,682,687,691,694,704,708,711,714,720,726,732,738,741,753,757,760,766,769,772,775,779,782,785,788,791,794,797,801,804,821,824,831,840,844,847,850,853,855,859,862,866,869,873,876,880,883,887],[14,580,581],{},"Your AI agent isn't broken. It's drowning in its own conversation history. Here's the diagnosis, the cause, and the actual fix.",[14,583,584],{},"It started with a customer email.",[14,586,587],{},"The agent had been running perfectly for three weeks. Answering support tickets, tagging them by priority, escalating the tricky ones. Then one Tuesday morning, it started responding to billing questions with onboarding instructions. It forgot the customer's name mid-conversation. It repeated the same canned response four times in a row.",[14,589,590],{},"The agent wasn't hallucinating. It wasn't misconfigured. It was losing context.",[14,592,593],{},"If you've built an AI agent that works brilliantly for the first 20 interactions and then starts acting like it has amnesia, you're not alone. Context loss is the single most common failure mode for deployed AI agents, and it's the one that gets misdiagnosed the most.",[14,595,596],{},"Here's what nobody tells you: the fix is almost never \"use a bigger model.\"",[73,598,600],{"id":599},"whats-actually-happening-when-your-agent-loses-context","What's Actually Happening When Your Agent Loses Context",[14,602,603],{},"Every large language model has a context window. Think of it as working memory. GPT-4o gives you 128K tokens. Claude gives you 200K. Gemini stretches to a million. Sounds enormous, right?",[14,605,606],{},"Here's the problem. Your agent doesn't just put the user's latest message into that window. It stuffs in the system prompt, every previous message in the conversation, tool call results, retrieved documents, function definitions, and whatever memory layer you've bolted on. All of it competes for the same finite space.",[14,608,609],{},"When the window fills up, one of two things happens. Either the model starts ignoring information at the edges (typically the middle of long contexts), or your framework silently truncates older messages to make room for new ones.",[14,611,612],{},"Both look identical from the outside: your agent \"forgets.\"",[14,614,615],{},"The context window isn't a hard drive. It's a desk. And most agents have papers stacked six inches high with no filing system.",[14,617,618],{},[86,619],{"alt":620,"src":621},"Agent losing context: the context window competes for space between the system prompt, conversation history, tool results, retrieved docs, and memory store, and older content gets truncated at the top","/img/blog/agent-losing-context-fix-guide-context-window-competition.jpg",[73,623,625],{"id":624},"the-five-reasons-your-agent-is-forgetting-everything","The Five Reasons Your Agent Is Forgetting Everything",[14,627,628],{},"Before you start tweaking model parameters or rewriting your system prompt, figure out which problem you actually have. These are the five most common culprits that cause an agent to lose context, ranked by how often we see them.",[408,630,632],{"id":631},"_1-token-bloat-from-conversation-history","1. Token Bloat From Conversation History",[14,634,635],{},"This is the big one. Every message in a multi-turn conversation stays in the context window. A 50-message support conversation can eat 15,000 to 30,000 tokens before you even account for the system prompt or tools.",[14,637,638],{},"Most frameworks handle this with a naive \"drop the oldest messages\" strategy. That works until the agent needs information from message three to answer message fifty-one.",[14,640,641,644],{},[17,642,643],{},"The fix:"," Implement a sliding window with summarization. Instead of keeping raw conversation history, periodically compress older messages into a summary. The summary stays in context. The raw messages get stored externally and retrieved only when relevant.",[408,646,648],{"id":647},"_2-oversized-system-prompts","2. Oversized System Prompts",[14,650,651],{},"We've seen system prompts that run 8,000 tokens. That's a small blog post sitting permanently in your context window, eating capacity on every single turn.",[14,653,654],{},"The worst offenders pack every possible instruction, every edge case, every formatting rule into a single monolithic prompt. The model can't prioritize when everything is labeled \"important.\"",[14,656,657,659],{},[17,658,643],{}," Trim your system prompt to its core identity and behavioral rules. Move specific instructions (like \"how to handle refund requests\") into retrievable documents that get pulled in only when relevant. Your system prompt should be a compass, not an encyclopedia.",[408,661,663],{"id":662},"_3-unfiltered-tool-and-api-responses","3. Unfiltered Tool and API Responses",[14,665,666],{},"This one sneaks up on you. Your agent calls an API. The API returns a 4,000-token JSON blob. Your framework dumps the entire response into the context window. Multiply that by five tool calls in a single conversation, and you've burned 20,000 tokens on raw JSON that the model has to parse through on every subsequent turn.",[14,668,669,671],{},[17,670,643],{}," Parse and compress tool responses before they enter the context. If your agent calls a CRM API and gets back a full customer record, extract only the fields the agent actually needs. Return \"Customer: Jane Smith, Plan: Pro, Last ticket: June 12, Status: Active\" instead of the full 200-field JSON object.",[408,673,675],{"id":674},"_4-retrieval-augmented-generation-rag-overload","4. Retrieval Augmented Generation (RAG) Overload",[14,677,678],{},"RAG is supposed to give your agent access to external knowledge without stuffing everything into the prompt. But poorly tuned RAG does exactly the opposite. It retrieves too many chunks, the chunks are too long, or the relevance threshold is too low.",[14,680,681],{},"The result? Your context window fills up with marginally relevant document fragments that push out the actual conversation history.",[14,683,684,686],{},[17,685,643],{}," Set strict top-k limits (3 to 5 chunks max). Use hybrid search that combines vector similarity with keyword matching to improve relevance. And set a minimum similarity threshold so your agent isn't pulling in documents that scored 0.4 on a 0 to 1 relevance scale.",[408,688,690],{"id":689},"_5-no-persistent-memory-layer","5. No Persistent Memory Layer",[14,692,693],{},"This is the most fundamental issue, and it's the one that separates toy demos from production agents. If your agent relies entirely on the context window for \"memory,\" it will always lose context eventually. The window is finite. Conversations are not.",[14,695,696,698,699,703],{},[17,697,643],{}," Add a persistent memory layer that exists outside the context window. The agent writes important facts and context to this layer. On each new turn, only the relevant memories get retrieved and injected. The context window stays lean. For a deeper look at why agents forget and how memory layers solve it, see our guide on ",[331,700,702],{"href":701},"/blog/ai-agent-memory-why-forgets-how-to-fix","why AI agents forget and how to fix it",".",[73,705,707],{"id":706},"how-context-management-actually-works-when-done-right","How Context Management Actually Works (When Done Right)",[14,709,710],{},"Here's where it gets practical.",[14,712,713],{},"A well-designed agent doesn't just have a context window. It has a context strategy. That strategy involves three layers working together.",[14,715,716],{},[86,717],{"alt":718,"src":719},"Without persistent memory the context window is full because messages cram everything else out; with persistent memory the context window stays lean and the agent reads and writes to an external memory store on demand. Same agent, same conversations, different architecture","/img/blog/agent-losing-context-fix-guide-persistent-memory.jpg",[14,721,722,725],{},[17,723,724],{},"Layer 1: The Active Context."," This is your context window. It holds the system prompt, the last N messages (or a summary of older ones), any currently relevant retrieved documents, and the results of the most recent tool calls. Think of this as what the agent is actively thinking about right now.",[14,727,728,731],{},[17,729,730],{},"Layer 2: The Session Memory."," This sits just outside the context window but within the same conversation session. It stores the full conversation history, intermediate reasoning, and tool results that might be needed later. When the agent detects a callback to an earlier topic, it pulls from session memory into active context.",[14,733,734,737],{},[17,735,736],{},"Layer 3: The Persistent Memory."," This survives across sessions. Customer preferences learned in January should still be available in June. Key facts, user profiles, learned patterns. This layer uses a combination of vector search (for semantic queries like \"what does this customer usually complain about\") and keyword search (for exact lookups like customer ID or order number).",[14,739,740],{},"When these three layers work together, your agent never \"forgets.\" It just files things away and retrieves them when needed. Exactly like a competent human assistant would.",[14,742,743,744,46,748,752],{},"If this sounds like a lot of infrastructure to build yourself... it is. It's one of the reasons we built BetterClaw as a no-code AI agent builder. The platform handles smart context management, persistent memory with hybrid vector and keyword search, and automatic token optimization. You focus on what your agent should do. The context plumbing is handled. ",[331,745,747],{"href":746},"/free-plan","Free plan available",[331,749,751],{"href":750},"/pricing","full pricing here",", bring your own API keys with zero markup.",[73,754,756],{"id":755},"the-hidden-cost-of-getting-this-wrong","The Hidden Cost of Getting This Wrong",[14,758,759],{},"Context management isn't just a technical problem. It's a cost problem.",[14,761,762],{},[86,763],{"alt":764,"src":765},"The cost of bad context management: the same agent running the same conversations at 80K tokens/call wastes ~$6K/month on bloated context, versus 15K tokens/call at ~$1.1K/month with managed context — a 5x cost difference","/img/blog/agent-losing-context-fix-guide-cost-of-bad-context.jpg",[14,767,768],{},"Every token in your context window costs money. With GPT-4o, input tokens run about $2.50 per million. If your agent is stuffing 80,000 tokens of unnecessary history into every API call, and it handles 1,000 conversations per day, you're burning roughly $200/day on wasted context. That's $6,000 a month in pure overhead.",[14,770,771],{},"Gartner projects that 40% of enterprise applications will have embedded AI agents by end of 2026. McKinsey estimates the addressable value at $2.6 to $4.4 trillion. But none of that value materializes if your agents are hemorrhaging money on bloated context windows and losing context mid-conversation.",[14,773,774],{},"The agents that actually make it to production share three traits: lean context management, persistent memory, and graceful degradation when context limits are hit.",[73,776,778],{"id":777},"when-to-reach-for-persistent-memory-vs-a-bigger-context-window","When to Reach for Persistent Memory vs. a Bigger Context Window",[14,780,781],{},"There's a tempting shortcut: just use a model with a larger context window. Gemini's million-token window feels like it should solve everything, right?",[14,783,784],{},"Not really. Here's why.",[14,786,787],{},"Larger context windows are slower. They cost more per call. And research consistently shows that model performance degrades on information in the middle of very long contexts, a phenomenon researchers call \"lost in the middle.\" Throwing more tokens at the problem is like buying a bigger desk instead of learning to file.",[14,789,790],{},"Use a bigger context window when you genuinely need the model to reason over a large, interconnected document in a single pass. A legal contract. A full codebase file. A research paper.",[14,792,793],{},"Use persistent memory when you need information to survive across conversations, when relevance varies by turn, or when you want to keep costs predictable. For most agent use cases (support, sales, ops automation, personal assistants), persistent memory wins.",[14,795,796],{},"BetterClaw's context management approach combines both: smart context windowing that prevents token bloat within a session, plus persistent memory with hybrid search across sessions. Agents built on the platform support 28+ AI model providers, so you can pick the right context window size for your specific use case without restructuring your entire agent.",[73,798,800],{"id":799},"a-quick-diagnostic-checklist","A Quick Diagnostic Checklist",[14,802,803],{},"If your agent is losing context right now, run through this:",[109,805,806,809,812,815,818],{},[112,807,808],{},"Is your conversation history growing unbounded? Add summarization after every 10 to 15 turns.",[112,810,811],{},"Is your system prompt over 2,000 tokens? Split it. Core identity stays in the prompt. Specific instructions go into retrievable docs.",[112,813,814],{},"Are tool responses entering the context window raw? Parse them down to only the fields your agent needs.",[112,816,817],{},"Is your RAG pulling more than 5 chunks per query? Tighten the top-k and raise your similarity threshold.",[112,819,820],{},"Does your agent need information from previous sessions? You need persistent memory, period. No context window hack will substitute for this.",[14,822,823],{},"If you're self-hosting an agent framework like CrewAI (47K+ GitHub stars, but requires Python and your own infrastructure) or LangGraph, you'll need to implement each of these layers yourself. That's engineering time measured in weeks, not hours.",[14,825,826,827,830],{},"If the idea of building context management infrastructure sounds like the wrong use of your time, that's exactly the problem BetterClaw's visual agent builder solves. ",[331,828,829],{"href":746},"Free plan",", no credit card, 1 agent and 500 credits a month. Pro is $49/month for teams that need more. Your first deploy takes about 60 seconds. We handle the context plumbing. You handle the interesting part.",[14,832,833,836,837,703],{},[331,834,835],{"href":746},"Start free here"," or ",[331,838,839],{"href":750},"see full pricing",[73,841,843],{"id":842},"the-part-that-actually-matters","The Part That Actually Matters",[14,845,846],{},"Context management isn't glamorous. Nobody's posting \"just shipped a sliding window summarizer\" on Twitter. But it's the difference between an agent that demos well and an agent that runs in production for months without someone paging you at 2 AM because it started sending gibberish to customers.",[14,848,849],{},"The agents that survive are the ones built on boring, reliable infrastructure. Memory that persists. Context that stays lean. Costs that stay predictable.",[14,851,852],{},"The exciting part isn't the plumbing. It's what your agent does once the plumbing works.",[73,854,487],{"id":486},[408,856,858],{"id":857},"what-is-agent-context-loss-and-why-does-it-happen","What is agent context loss and why does it happen?",[14,860,861],{},"Agent context loss is when an AI agent \"forgets\" information from earlier in a conversation or from previous sessions. It happens because every LLM has a finite context window, and when that window fills up with conversation history, tool responses, and retrieved documents, older information gets truncated or ignored. It's not a model deficiency. It's an architecture problem that requires smart context management and persistent memory to solve.",[408,863,865],{"id":864},"how-does-persistent-memory-compare-to-just-using-a-larger-context-window","How does persistent memory compare to just using a larger context window?",[14,867,868],{},"A larger context window (like Gemini's 1M tokens) lets you fit more information in a single call, but it costs more, runs slower, and research shows models struggle with information in the middle of very long contexts. Persistent memory stores facts externally and retrieves only what's relevant for each turn, keeping costs low and performance consistent. For most agent use cases, persistent memory paired with a moderately sized context window outperforms brute-forcing everything into one giant prompt.",[408,870,872],{"id":871},"how-do-i-fix-my-ai-agent-that-keeps-forgetting-instructions","How do I fix my AI agent that keeps forgetting instructions?",[14,874,875],{},"Start by checking the most common causes: unbounded conversation history (add summarization), oversized system prompts (trim to essentials), raw tool responses entering context (parse them down), over-retrieval from RAG (tighten top-k limits), and no persistent memory layer (add one). In most cases, implementing a sliding window with periodic summarization plus a basic persistent memory store resolves 90% of context loss issues.",[408,877,879],{"id":878},"how-much-does-agent-context-bloat-actually-cost","How much does agent context bloat actually cost?",[14,881,882],{},"It depends on your model and volume, but the math adds up fast. If your agent stuffs 80,000 unnecessary tokens into each call at GPT-4o input pricing (~$2.50/million tokens), and handles 1,000 conversations daily, you're spending roughly $6,000/month on wasted tokens alone. Smart context management can cut that to a fraction by keeping only relevant information in the active window. Platforms like BetterClaw include context optimization as a built-in feature starting at $0/month on the free plan.",[408,884,886],{"id":885},"is-persistent-memory-safe-for-handling-sensitive-customer-data","Is persistent memory safe for handling sensitive customer data?",[14,888,889],{},"It can be, but only with the right safeguards. You need encryption at rest (AES-256 minimum), strict access controls, and ideally an auto-purge mechanism for sensitive data like credentials or payment information. BetterClaw's persistent memory uses AES-256 encryption and automatically purges secrets from agent memory after 5 minutes. Agents run in isolated Docker containers with real-time health monitoring, so sensitive data never leaks between agents or persists longer than necessary.",{"title":139,"searchDepth":152,"depth":152,"links":891},[892,893,900,901,902,903,904,905],{"id":599,"depth":152,"text":600},{"id":624,"depth":152,"text":625,"children":894},[895,896,897,898,899],{"id":631,"depth":158,"text":632},{"id":647,"depth":158,"text":648},{"id":662,"depth":158,"text":663},{"id":674,"depth":158,"text":675},{"id":689,"depth":158,"text":690},{"id":706,"depth":152,"text":707},{"id":755,"depth":152,"text":756},{"id":777,"depth":152,"text":778},{"id":799,"depth":152,"text":800},{"id":842,"depth":152,"text":843},{"id":486,"depth":152,"text":487,"children":906},[907,908,909,910,911],{"id":857,"depth":158,"text":858},{"id":864,"depth":158,"text":865},{"id":871,"depth":158,"text":872},{"id":878,"depth":158,"text":879},{"id":885,"depth":158,"text":886},"2026-07-01","Your AI agent keeps forgetting instructions? Diagnose context window overflow, fix token bloat, and add persistent memory. Step-by-step guide.","/img/blog/agent-losing-context-fix-guide.jpg",null,{},"/blog/agent-losing-context-fix-guide","9 min read",{"title":575,"description":913},"Agent Losing Context? Fix Memory Leaks in AI Agents (2026)","blog/agent-losing-context-fix-guide",[923,924,925,926,927,928],"agent losing context","agent memory leak","ai agent context management","agent forgetting instructions","context window overflow","persistent memory ai agent","f_oLQrSlrUM8aym3MoG4gZV4g0qOa1ZGqF4Io0KR06s",{"id":931,"title":932,"author":933,"body":934,"category":550,"date":1319,"description":1320,"extension":553,"featured":554,"image":1321,"imageHeight":915,"imageWidth":915,"meta":1322,"navigation":559,"path":1323,"readingTime":918,"seo":1324,"seoTitle":1325,"stem":1326,"tags":1327,"updatedDate":1319,"__hash__":1334},"blog/blog/agent-rules-drift-fix.md","Why Your AI Agent Forgets Its Instructions After 20 Messages (and How to Fix It)",{"name":7,"role":8,"avatar":9},{"type":11,"value":935,"toc":1303},[936,941,944,947,950,953,957,960,963,969,972,979,982,985,989,992,998,1004,1010,1016,1019,1023,1034,1040,1046,1052,1058,1064,1070,1076,1080,1083,1088,1123,1128,1180,1183,1186,1189,1193,1199,1205,1211,1218,1224,1236,1238,1241,1244,1256,1258,1262,1265,1269,1272,1276,1279,1283,1286,1290,1293,1297,1300],[14,937,938],{},[17,939,940],{},"It's not a bug. It's math. Here's the math, and 7 fixes that actually hold.",[14,942,943],{},"Your agent's SOUL.md says never exceed 3 sentences. For the first 15 messages, it's perfect. Short, punchy replies. Exactly what you asked for.",[14,945,946],{},"Then around message 20, the responses start getting longer. By message 30, it's writing 4 paragraphs. By message 40, it's forgotten the 3-sentence rule entirely, like it never read the file at all.",[14,948,949],{},"You didn't change anything. The agent just... drifted.",[14,951,952],{},"This is rules drift. It happens to every agent, on every platform, running on every model. It's not a bug you can patch. It's a direct consequence of how context windows work, and once you see the mechanism, you'll never be surprised by it again.",[73,954,956],{"id":955},"why-agents-drift-the-context-window-math","Why Agents Drift: The Context Window Math",[14,958,959],{},"Here's the part nobody explains clearly. Every message in a conversation gets added to the context window. Your SOUL.md instructions sit at the very beginning of that context, planted before message 1 even happens.",[14,961,962],{},"As the conversation grows, your instructions stay exactly the same size. But the conversation around them keeps growing. So your rules become a smaller and smaller percentage of the total context with every single message.",[14,964,965],{},[86,966],{"alt":967,"src":968},"The shrinking percentage: why rules drift is math, not magic. Three stacked bars show your fixed-size instructions as a shrinking share of the context window: 40% at message 5, 12% at message 20, 3% at message 40, as conversation history grows underneath. Your rules are still there, they're just buried under all of it.","/img/blog/agent-rules-drift-fix-shrinking-percentage.jpg",[14,970,971],{},"By message 20 to 30, the model starts paying less attention to those early instructions. Not because they vanished. Because they're now buried under thousands of tokens of back-and-forth, and the model weighs recent messages more heavily than old instructions when the two start to conflict.",[14,973,974,975,978],{},"Imagine you're in a meeting. Someone laid out the ground rules at the start: keep answers brief, don't go off-topic. An hour later, the conversation has drifted through 30 different topics. The rules are still technically in effect. Everyone's just forgotten them. That's what happens to your agent. (For the memory-file angle on the same problem, see our guide on ",[331,976,977],{"href":701},"why agents forget and how to fix it",".)",[14,980,981],{},"This isn't a hypothetical. Real production incidents trace back to exactly this pattern. One well-documented case involved an alignment researcher's OpenClaw agent that was told, in chat, not to touch her inbox without explicit approval. The instruction was never written to a file. When her real inbox overwhelmed the context window, the session compressed its history, the unsaved stop command quietly disappeared from the summary, and the agent went back to autonomous mode and started deleting emails.",[14,983,984],{},"That's not an edge case. That's the exact failure mode this whole article is about, just at a scale that made headlines.",[73,986,988],{"id":987},"how-to-spot-rules-drift-before-it-breaks-things","How to Spot Rules Drift Before It Breaks Things",[14,990,991],{},"The frustrating part about drift is that it's invisible until someone notices, and by then the agent has usually done something you didn't want. Here's how to catch it early.",[14,993,994,997],{},[17,995,996],{},"Check response length over time."," If your SOUL.md says \"concise\" and responses are creeping longer message over message, drift has already started.",[14,999,1000,1003],{},[17,1001,1002],{},"Test a known constraint every 10 messages."," Ask the agent something that should trigger a hard rule. If the rule doesn't fire, you've found drift in real time instead of after the fact.",[14,1005,1006,1009],{},[17,1007,1008],{},"Monitor for banned words or phrases."," If SOUL.md says never say \"absolutely\" and it shows up around message 25, that's not a fluke. That's the instruction losing its grip.",[14,1011,1012,1015],{},[17,1013,1014],{},"Log and compare."," Save the agent's response to the exact same prompt at message 5 and again at message 35. The difference between those two answers is your drift, made visible.",[14,1017,1018],{},"Here's what nobody tells you about this diagnostic: the comparison test is the most honest one, because it removes every variable except time and volume. Same question, same agent, same rules on paper. Only the conversation length changed.",[73,1020,1022],{"id":1021},"_7-fixes-for-agent-rules-drift","7 Fixes for Agent Rules Drift",[14,1024,1025,1028,1029,1033],{},[17,1026,1027],{},"Fix 1: Keep SOUL.md under 500 tokens."," Shorter instructions survive longer in the context window, full stop. Every unnecessary word accelerates drift, because every word is competing with the actual rules for the model's shrinking attention. \"Be a helpful assistant that always provides thorough and detailed responses while maintaining a professional tone\" becomes \"Be concise. Professional tone. Max 3 sentences.\" Same intent, a fraction of the tokens. If you haven't already, our ",[331,1030,1032],{"href":1031},"/blog/soul-md-agents-md-configuration-guide","SOUL.md and AGENTS.md configuration guide"," covers exactly what belongs in each file and where the token ceiling actually sits.",[14,1035,1036,1039],{},[17,1037,1038],{},"Fix 2: Use negative constraints instead of positive aspirations."," \"Never exceed 3 sentences\" survives drift noticeably better than \"keep responses brief.\" Negative rules, the \"never,\" \"do not,\" \"under no circumstances\" kind, create hard boundaries the model can check itself against. Soft guidance like \"try to\" or \"aim for\" gives the model permission to interpret, and interpretation is exactly where drift creeps in.",[14,1041,1042,1045],{},[17,1043,1044],{},"Fix 3: Use /new to clear the conversation buffer, but only after saving what matters."," In OpenClaw and Hermes, /new clears the active conversation history, and your workspace memory files stay on disk. That part is genuinely useful. Here's the catch most guides skip: manual resets don't automatically flush unsaved context to a memory file first. Anything discussed in chat but never written down disappears the moment you reset, same as it would in a compaction event. The safe pattern is to have the agent write a quick session note to memory before you run /new, not to assume the reset preserves everything. Do that, and resetting every 15 to 20 messages genuinely does return your instructions to a large percentage of the context, which resets drift along with it.",[14,1047,1048,1051],{},[17,1049,1050],{},"Fix 4: Repeat critical rules in AGENTS.md procedures."," If SOUL.md says never send emails without approval, restate it inside the relevant workflow step too: \"Step 5: Generate draft reply. DO NOT SEND. Wait for user approval.\" Redundancy across both files gives the rule two separate footholds instead of one, and a rule with two footholds is harder for drift to erode.",[14,1053,1054,1057],{},[17,1055,1056],{},"Fix 5: Use system-level instruction reinforcement where the platform supports it."," Some setups support pinned instructions that get re-injected into context at intervals instead of sitting only at the start. On raw OpenClaw, this usually means manually re-injecting SOUL.md content every N messages through a skill or hook. On BetterClaw, this is handled by smart context management, so critical rules don't rely on a human remembering to re-inject them.",[14,1059,1060,1063],{},[17,1061,1062],{},"Fix 6: Break long tasks into shorter sessions."," One 50-message conversation drifts. Three sessions of roughly 15 messages each, each one starting fresh, gets full SOUL.md attention every time. Pass what matters between sessions using memory files, not by dragging the whole conversation history forward. This is the same principle as Fix 3, just applied proactively instead of as a mid-conversation rescue.",[14,1065,1066,1069],{},[17,1067,1068],{},"Fix 7: Test with adversarial prompts at message 25 and beyond."," Past message 25, deliberately try to get your agent to break its own rules. Ask it to do the exact thing SOUL.md prohibits. If it complies, you've found drift before a real user did. Keep adjusting SOUL.md wording until the rule holds at message 30 and beyond. The rules that survive adversarial testing at message 30 are the only rules you should trust in production. Everything else is a suggestion wearing a rule's clothing.",[14,1071,1072],{},[86,1073],{"alt":1074,"src":1075},"Four early warning sensors for rules drift. 1. Response length monitor: SOUL.md says \"concise\" but replies keep creeping longer. 2. Known constraint test: trigger a hard rule every 10 messages; if it doesn't fire, drift is detected in real time. 3. Banned word detector: a forbidden word appearing around message 25 isn't a fluke, it's the rule losing its grip. 4. Most honest test, the comparison test: ask the exact same question at message 5 and message 35; the difference is your drift, made visible.","/img/blog/agent-rules-drift-fix-warning-sensors.jpg",[73,1077,1079],{"id":1078},"real-example-soulmd-that-drifts-vs-soulmd-that-holds","Real Example: SOUL.md That Drifts vs SOUL.md That Holds",[14,1081,1082],{},"Here are two versions of the same email triage agent's SOUL.md. Same intent. Wildly different survival rate.",[14,1084,1085],{},[17,1086,1087],{},"Version that drifts:",[134,1089,1093],{"className":1090,"code":1091,"language":1092,"meta":139,"style":139},"language-markdown shiki shiki-themes github-light","You are a helpful and knowledgeable email assistant. Your goal is to help\nthe user manage their inbox efficiently. Try to keep your responses concise\nand focused. When classifying emails, consider the sender's importance,\nthe subject line content, and any time-sensitive language. Aim for accuracy\nin your classifications and provide brief summaries when helpful.\n","markdown",[64,1094,1095,1101,1106,1111,1117],{"__ignoreMap":139},[143,1096,1097],{"class":145,"line":146},[143,1098,1100],{"class":1099},"sgsFI","You are a helpful and knowledgeable email assistant. Your goal is to help\n",[143,1102,1103],{"class":145,"line":152},[143,1104,1105],{"class":1099},"the user manage their inbox efficiently. Try to keep your responses concise\n",[143,1107,1108],{"class":145,"line":158},[143,1109,1110],{"class":1099},"and focused. When classifying emails, consider the sender's importance,\n",[143,1112,1114],{"class":145,"line":1113},4,[143,1115,1116],{"class":1099},"the subject line content, and any time-sensitive language. Aim for accuracy\n",[143,1118,1120],{"class":145,"line":1119},5,[143,1121,1122],{"class":1099},"in your classifications and provide brief summaries when helpful.\n",[14,1124,1125],{},[17,1126,1127],{},"Version that holds:",[134,1129,1131],{"className":1090,"code":1130,"language":1092,"meta":139,"style":139},"Email triage agent.\n\nRULES:\n- Max 2 sentences per response.\n- NEVER classify unknown senders as \"safe.\"\n- NEVER send, reply, or delete. Read-only.\n- If unsure, mark \"needs review.\" Never guess.\n",[64,1132,1133,1138,1143,1148,1157,1164,1172],{"__ignoreMap":139},[143,1134,1135],{"class":145,"line":146},[143,1136,1137],{"class":1099},"Email triage agent.\n",[143,1139,1140],{"class":145,"line":152},[143,1141,1142],{"emptyLinePlaceholder":559},"\n",[143,1144,1145],{"class":145,"line":158},[143,1146,1147],{"class":1099},"RULES:\n",[143,1149,1150,1154],{"class":145,"line":1113},[143,1151,1153],{"class":1152},"sqxcx","-",[143,1155,1156],{"class":1099}," Max 2 sentences per response.\n",[143,1158,1159,1161],{"class":145,"line":1119},[143,1160,1153],{"class":1152},[143,1162,1163],{"class":1099}," NEVER classify unknown senders as \"safe.\"\n",[143,1165,1167,1169],{"class":145,"line":1166},6,[143,1168,1153],{"class":1152},[143,1170,1171],{"class":1099}," NEVER send, reply, or delete. Read-only.\n",[143,1173,1175,1177],{"class":145,"line":1174},7,[143,1176,1153],{"class":1152},[143,1178,1179],{"class":1099}," If unsure, mark \"needs review.\" Never guess.\n",[14,1181,1182],{},"The first version is 80 words of suggestions. The second is 35 words of laws. Agents follow laws. They forget suggestions.",[14,1184,1185],{},"Look at the specific language. \"Try to keep responses concise\" versus \"max 2 sentences.\" \"Aim for accuracy\" versus \"if unsure, mark needs review, never guess.\" One gives the model room to drift. The other gives it nothing to negotiate with.",[14,1187,1188],{},"We rewrote a client's production SOUL.md using exactly this pattern and watched the same known-constraint test that failed at message 22 hold clean past message 40. Nothing else about the setup changed. Just the wording.",[73,1190,1192],{"id":1191},"platform-notes-on-where-drift-shows-up","Platform notes on where drift shows up",[14,1194,1195,1198],{},[17,1196,1197],{},"OpenClaw and Hermes:"," use /new to reset context, and remember that memory files persist across the reset while unsaved chat context does not. Get in the habit of asking the agent to jot a quick note before you clear the buffer.",[14,1200,1201,1204],{},[17,1202,1203],{},"Claude Code:"," context management is handled by the runtime, but drift still shows up in long sessions the same way it does anywhere else. The practical fix here is procedural: break work into smaller commits and smaller sessions rather than one marathon conversation, so instructions never have to survive fifty turns unassisted.",[14,1206,1207,1210],{},[17,1208,1209],{},"BetterClaw:"," smart context management handles instruction reinforcement automatically, so rules drift is meaningfully reduced compared to a raw OpenClaw setup where you're manually re-injecting SOUL.md content yourself. That's just how the platform is built, not a sales pitch, it's the same underlying context math, just with the reinforcement handled for you instead of left as a DIY project.",[14,1212,1213,1214,1217],{},"If manually babysitting a context window and re-injecting your own instructions sounds like the wrong use of a Tuesday afternoon, that's a big part of why we built BetterClaw the way we did. The ",[331,1215,1216],{"href":746},"free plan"," includes one agent, 500 credits a month, no credit card, and the same smart context management that's reducing drift on every other agent running on the platform.",[14,1219,1220],{},[86,1221],{"alt":1222,"src":1223},"Three platforms, same math, different levels of DIY. OpenClaw / Hermes: drift happens, /new resets context, memory files survive but unsaved chat is gone, so ask the agent to write a session note before every reset. Claude Code: drift happens, the runtime manages some context, and the practical fix is smaller commits and shorter sessions instead of a 50-turn marathon. BetterClaw: smart context management handles reinforcement automatically, so rules don't rely on human re-injection. The honest takeaway: rules drift isn't a config mistake, it's a sign your agent has been running long enough to matter.","/img/blog/agent-rules-drift-fix-three-platforms.jpg",[14,1225,1226,1227,1231,1232,703],{},"Drift isn't unique to email agents either. Anywhere an agent runs long, unattended, or across many turns, the same math applies, and shorter, tighter instruction files paired with fewer redundant tokens in your skills stack both help. If you're curious how much of your token budget your integrations are actually consuming before instructions even enter the picture, our breakdown on ",[331,1228,1230],{"href":1229},"/blog/skills-that-reduce-token-usage","reducing token usage from skills"," is worth a read. And if you're seeing responses cut off entirely rather than just drifting in tone, that's usually a related but distinct problem, covered in our guide to ",[331,1233,1235],{"href":1234},"/blog/hermes-response-truncated-fix","fixing truncated Hermes responses",[73,1237,477],{"id":476},[14,1239,1240],{},"Rules drift isn't a sign you configured something wrong. It's a sign your agent has been running long enough to matter, which is honestly a good problem to have.",[14,1242,1243],{},"The fix was never about writing a longer, more thorough SOUL.md. It was about writing a shorter one, with harder edges, and building in a reset habit before the context window quietly decides which of your rules it can afford to forget.",[14,1245,1246,1247,1251,1252,1255],{},"If you'd rather have that reinforcement handled automatically instead of manually testing your own agent at message 30 every week, ",[331,1248,1250],{"href":419,"rel":1249},[421],"give BetterClaw a try",". Free plan with one agent and 500 credits a month, no credit card. ",[331,1253,1254],{"href":750},"$49 a month for Pro"," when you're ready to run more than one. Your first deploy takes about 60 seconds. We handle keeping your rules in view. You handle deciding what they say.",[73,1257,487],{"id":486},[408,1259,1261],{"id":1260},"why-does-my-ai-agent-forget-its-instructions","Why does my AI agent forget its instructions?",[14,1263,1264],{},"Your agent's instructions sit at the start of the context window and stay a fixed size, while the conversation around them keeps growing. As the conversation gets longer, those instructions become a smaller share of the total context, and the model starts weighing recent messages more heavily. The instructions aren't deleted, they're just outweighed.",[408,1266,1268],{"id":1267},"how-many-messages-before-an-ai-agent-starts-drifting","How many messages before an AI agent starts drifting?",[14,1270,1271],{},"Most agents start showing measurable drift somewhere between message 20 and 30, though the exact point depends on how long your SOUL.md is and how strict your model's context handling is. Shorter instruction files with hard negative constraints tend to hold noticeably longer than long, soft, aspirational ones.",[408,1273,1275],{"id":1274},"how-to-fix-agent-rules-drift","How to fix agent rules drift?",[14,1277,1278],{},"Keep SOUL.md under 500 tokens, use negative constraints instead of soft suggestions, repeat critical rules in AGENTS.md as well, and reset the conversation periodically with something like OpenClaw's /new command after saving any context worth keeping. Testing your agent with adversarial prompts past message 25 is the most reliable way to confirm a fix actually worked.",[408,1280,1282],{"id":1281},"what-is-the-best-length-for-soulmd","What is the best length for SOUL.md?",[14,1284,1285],{},"Keep SOUL.md under 400 to 500 tokens, which is roughly 300 to 400 words. Beyond that ceiling, instructions start losing the model's attention faster as the conversation grows, so shorter files with harder rules consistently outperform longer files full of soft guidance.",[408,1287,1289],{"id":1288},"does-new-reset-agent-memory-in-openclaw","Does /new reset agent memory in OpenClaw?",[14,1291,1292],{},"/new clears the active conversation history but leaves your workspace memory files, like MEMORY.md and daily notes, intact on disk. What it doesn't do is automatically save unsaved context from the chat before wiping it, so anything important that was only discussed in conversation and never written to a file will be lost on reset.",[408,1294,1296],{"id":1295},"how-to-make-ai-agent-follow-instructions-longer","How to make AI agent follow instructions longer?",[14,1298,1299],{},"Write instructions as hard negative constraints rather than soft goals, keep the file short enough that it doesn't get diluted by conversation growth, and reinforce critical rules in more than one place, such as both SOUL.md and AGENTS.md. Periodically resetting the session, or using a platform with automatic context reinforcement, addresses the problem at its root instead of just delaying it.",[535,1301,1302],{},"html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}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 pre.shiki code .sqxcx, html code.shiki .sqxcx{--shiki-default:#E36209}",{"title":139,"searchDepth":152,"depth":152,"links":1304},[1305,1306,1307,1308,1309,1310,1311],{"id":955,"depth":152,"text":956},{"id":987,"depth":152,"text":988},{"id":1021,"depth":152,"text":1022},{"id":1078,"depth":152,"text":1079},{"id":1191,"depth":152,"text":1192},{"id":476,"depth":152,"text":477},{"id":486,"depth":152,"text":487,"children":1312},[1313,1314,1315,1316,1317,1318],{"id":1260,"depth":158,"text":1261},{"id":1267,"depth":158,"text":1268},{"id":1274,"depth":158,"text":1275},{"id":1281,"depth":158,"text":1282},{"id":1288,"depth":158,"text":1289},{"id":1295,"depth":158,"text":1296},"2026-07-13","AI agents start ignoring their rules around message 20-30. Here's why it happens, how to detect it, and 7 fixes that actually work. Real examples included.","/img/blog/agent-rules-drift-fix.jpg",{},"/blog/agent-rules-drift-fix",{"title":932,"description":1320},"Why AI Agents Forget Instructions After 20 Messages","blog/agent-rules-drift-fix",[1328,1329,1330,1331,1332,1333],"ai agent forgetting instructions","agent ignoring system prompt","agent rules drift","openclaw agent personality drift","hermes agent ignoring soul.md","agent rules not working after long conversation","6UFWfXiMdoYq0t82auDX4JbmQdVSdpc91wZ59eLDQn0",{"id":1336,"title":1337,"author":1338,"body":1339,"category":550,"date":1786,"description":1787,"extension":553,"featured":554,"image":1788,"imageHeight":915,"imageWidth":915,"meta":1789,"navigation":559,"path":1790,"readingTime":1791,"seo":1792,"seoTitle":1793,"stem":1794,"tags":1795,"updatedDate":1786,"__hash__":1803},"blog/blog/ai-agent-slow-latency-fix.md","Why Is My AI Agent So Slow? Diagnosing Latency Step by Step",{"name":7,"role":8,"avatar":9},{"type":11,"value":1340,"toc":1758},[1341,1353,1356,1359,1362,1365,1368,1371,1375,1378,1381,1387,1391,1394,1397,1403,1409,1415,1418,1421,1425,1428,1431,1434,1437,1440,1443,1447,1450,1454,1460,1470,1476,1482,1486,1489,1492,1495,1498,1501,1504,1510,1516,1522,1528,1531,1535,1538,1541,1548,1551,1554,1560,1566,1572,1578,1582,1585,1588,1591,1594,1597,1601,1604,1607,1610,1614,1617,1623,1629,1635,1641,1647,1653,1656,1659,1663,1666,1672,1683,1689,1700,1703,1706,1721,1723,1727,1730,1734,1737,1741,1744,1748,1751,1755],[30,1342,1343],{"type":32},[14,1344,1345,1348,1349,1352],{},[17,1346,1347],{},"Quick fix:"," ",[64,1350,1351],{},"Why is my AI agent so slow?"," - the model is almost never the bottleneck. A single LLM call takes ~800ms, so if your agent takes 15 seconds, 14.2 seconds of latency lives elsewhere. The slowness is usually context bloat (Layer 2) and multi-step compounding (Layer 5) working together. Diagnose before switching models: log your input token count per request - if it exceeds 30,000 tokens you have context bloat, so compress conversation history into summaries, load tool definitions on demand, and filter tool results before they enter context. Then parallelize independent tool calls and reduce total workflow steps.",[14,1354,1355],{},"We had an agent handling email triage. It read new emails, classified urgency, drafted responses for low-priority items, and flagged high-priority ones for human review.",[14,1357,1358],{},"In testing, it was fast. Sub-two-second responses. We were thrilled.",[14,1360,1361],{},"In production, it took 15 seconds per email. Sometimes 20. Users started complaining within the first hour.",[14,1363,1364],{},"My first instinct: the model is too slow, let's switch to something faster. So we swapped Claude Sonnet for GPT-5 Nano. Barely any improvement. Maybe half a second shaved off.",[14,1366,1367],{},"That's when it hit me. The model wasn't the bottleneck. The model was doing its job in under a second. Everything else around it was eating the other 14 seconds.",[14,1369,1370],{},"If your AI agent is slow, the model is almost never the real problem. The real problem lives in one of five places. Here's how to find it.",[73,1372,1374],{"id":1373},"the-five-latency-layers-debug-in-this-order","The five latency layers (debug in this order)",[14,1376,1377],{},"Most people start debugging agent latency by looking at model benchmarks. \"Maybe I need a faster LLM.\" That's like diagnosing a slow website by replacing the database when the real problem is unoptimized SQL queries hitting the database 47 times per page load.",[14,1379,1380],{},"Agent latency has five layers. They compound multiplicatively, not additively. A problem at layer 3 makes layer 4 worse, which makes layer 5 catastrophic.",[14,1382,1383],{},[86,1384],{"alt":1385,"src":1386},"The Five Latency Layers of an AI Agent, stacked to debug top to bottom without skipping: Layer 1 model speed (TTFT plus tok/s, most people blame this but it's rarely the real issue), Layer 2 context window size (every token in context costs processing time on every request), Layer 3 tool execution (external API calls, unmeasured and often the biggest offender), Layer 4 network plus API routing (geography adds up across 8-12 API calls per task), and Layer 5 multi-step compounding (every step multiplies all previous layers, the real killer). A problem at Layer 3 makes Layer 4 worse, and Layer 4 makes Layer 5 catastrophic","/img/blog/ai-agent-latency-five-layers.jpg",[73,1388,1390],{"id":1389},"layer-1-model-speed-the-one-everyone-checks-first","Layer 1: Model speed (the one everyone checks first)",[14,1392,1393],{},"Time to first token (TTFT) measures how long after you send a prompt the model starts generating. Per-token latency (tok/s) measures how fast it generates once it starts.",[14,1395,1396],{},"Here's where things stand in 2026:",[14,1398,1399,1402],{},[17,1400,1401],{},"Fastest TTFT:"," Claude Haiku 4.5 at around 597ms on medium prompts. Mistral Large and GPT-5.2 also hit sub-second consistently.",[14,1404,1405,1408],{},[17,1406,1407],{},"Fastest throughput:"," Gemini 2.5 Flash at 146-173 tokens per second. Mercury 2 by Inception hits 789 tok/s but with quality tradeoffs. Gemini 3.5 Flash reaches 284 tok/s.",[14,1410,1411,1414],{},[17,1412,1413],{},"Reasoning models are intentionally slow."," Models like o3, GPT-5, and Gemini Deep Think use chain-of-thought processing. They generate internal \"thinking\" tokens before the visible answer. TTFT can be 10-150 seconds. This isn't a bug. It's the architecture.",[14,1416,1417],{},"Here's the thing: for most agent workloads, model speed is not your bottleneck. A single LLM call takes about 800 milliseconds. If your agent is taking 15 seconds, the model used 800ms of that. You have 14.2 seconds of latency living somewhere else.",[14,1419,1420],{},"Before switching models, measure your actual model latency. Log the timestamp when you send the request and when the first token arrives. If it's under 2 seconds, your problem isn't the model.",[73,1422,1424],{"id":1423},"layer-2-context-window-bloat-the-silent-killer","Layer 2: Context window bloat (the silent killer)",[14,1426,1427],{},"This is where most agent latency actually lives. And it's invisible unless you're counting tokens.",[14,1429,1430],{},"Every time your agent makes a request, it sends the entire conversation context to the model. System prompt. Conversation history. Tool definitions. Previous tool results. Memory context. All of it.",[14,1432,1433],{},"The numbers are wild. Research from Agenteer found that a single Jira integration adds roughly 17,000 tokens just for tool definitions. Across a typical agent setup with multiple integrations, 134,000 tokens (67% of a 200K context window) get consumed by definitions before the agent starts working.",[14,1435,1436],{},"That's the equivalent of walking into a restaurant and reading a 500-page menu before you can order water.",[14,1438,1439],{},"More tokens means more processing time. A 2,000-token prompt processes in under a second. A 100,000-token prompt with tool definitions, conversation history, and previous results takes significantly longer. The model has to read and attend to every token before generating a response.",[14,1441,1442],{},"Your context window is RAM, not storage. Everything in it costs processing time on every single request.",[408,1444,1446],{"id":1445},"how-to-diagnose-it","How to diagnose it",[14,1448,1449],{},"Log your input token count for each request. If it's growing with every turn of the conversation, you have context bloat. If it starts high (above 20,000 tokens) even on the first turn, your tool definitions and system prompts are too heavy.",[408,1451,1453],{"id":1452},"how-to-fix-it","How to fix it",[14,1455,1456,1459],{},[17,1457,1458],{},"Don't load all tool definitions upfront."," Anthropic's own research showed that Opus 4's tool selection accuracy improved from 49% to 74% when the agent searched for relevant tools on demand instead of parsing all definitions at once. Fewer tools in context means faster processing and better accuracy.",[14,1461,1462,1465,1466,703],{},[17,1463,1464],{},"Summarize conversation history."," Instead of sending the full conversation, compress older turns into summaries. The Mem0 framework published 2026 benchmarks showing that a two-layer memory architecture (summarized context plus targeted retrieval) used 4x fewer tokens than full-context approaches while cutting latency by 91% and actually improving accuracy by 18.7 percentage points. This is the core of how ",[331,1467,1469],{"href":1468},"/blog/how-ai-agent-memory-works","AI agent memory works",[14,1471,1472,1475],{},[17,1473,1474],{},"Trim tool results aggressively."," A single MCP server call that returns a 50-field JSON blob when you only need 3 fields wastes thousands of tokens. Filter tool results before they enter context.",[14,1477,1478],{},[86,1479],{"alt":1480,"src":1481},"Context Bloat, the before and after. Before optimization: 119K tokens and 17-second p95 latency, made up of a 2K system prompt, 17K tool definitions, 40K conversation history and 60K tool results. After optimization: 11K tokens and 1.4-second p95 latency, made up of a 2K system prompt, 3K active tools only, 2K summarized history and 4K filtered results. A 91% latency reduction from context management alone, per Mem0 2026","/img/blog/ai-agent-latency-context-bloat-before-after.jpg",[73,1483,1485],{"id":1484},"layer-3-tool-execution-the-one-you-forgot-to-measure","Layer 3: Tool execution (the one you forgot to measure)",[14,1487,1488],{},"When your agent calls an external tool (send email, read CRM, query database, fetch webpage), the tool's execution time adds directly to the agent's response time. And most people never measure it.",[14,1490,1491],{},"A Gmail API call to fetch recent emails: 200-800ms. A HubSpot CRM lookup: 300-1,200ms. A web scraping call: 1-5 seconds. A database query on an unindexed table: could be anything from 50ms to 30 seconds.",[14,1493,1494],{},"If your agent makes 3 tool calls in sequence (which is common for multi-step tasks), and each takes an average of 1 second, that's 3 seconds of tool execution time before the model even starts thinking about the next step.",[408,1496,1446],{"id":1497},"how-to-diagnose-it-1",[14,1499,1500],{},"Wrap every tool call with timing logs. You'll often find that one specific tool is responsible for 60-80% of total tool execution time.",[408,1502,1453],{"id":1503},"how-to-fix-it-1",[14,1505,1506,1509],{},[17,1507,1508],{},"Parallelize where possible."," If your agent needs data from Gmail and HubSpot, fetch both simultaneously instead of sequentially. This cuts tool execution time in half for independent calls.",[14,1511,1512],{},[86,1513],{"alt":1514,"src":1515},"Parallelize Independent Tool Calls. Run sequentially, a Gmail fetch, a 900ms HubSpot lookup and an 800ms DB query total 2,300ms. Run in parallel, the same three calls (Gmail 600ms, HubSpot 900ms, DB 800ms) all run at once and total 900ms because the slowest one wins, 2.5x faster. If your agent needs Gmail and HubSpot, fetch both at once, not one then the other","/img/blog/ai-agent-latency-parallelize-tool-calls.jpg",[14,1517,1518,1521],{},[17,1519,1520],{},"Cache repeated lookups."," If your agent queries the same CRM record multiple times in one conversation, cache the first result. Semantic caching, as Redis LangCache demonstrated, can reduce redundant API calls dramatically.",[14,1523,1524,1527],{},[17,1525,1526],{},"Set timeouts."," A tool call that takes 30 seconds because of an external API issue shouldn't freeze your entire agent. Set aggressive timeouts (3-5 seconds) and have fallback behavior.",[14,1529,1530],{},"This is one of the areas where managed agent platforms have an advantage over self-hosted setups. On BetterClaw, integrations are pre-optimized with connection pooling, caching, and timeout handling built in. When you self-host, you're building all of that yourself.",[73,1532,1534],{"id":1533},"layer-4-network-and-api-routing","Layer 4: Network and API routing",[14,1536,1537],{},"If your agent is on a VPS in Frankfurt and your users are in San Francisco, every API round-trip adds 100-200ms of network latency. For a single request, that's barely noticeable. For an agent that makes 8-12 API calls per task (LLM calls plus tool calls plus memory lookups), it adds up to 1-2 seconds of pure network overhead.",[408,1539,1446],{"id":1540},"how-to-diagnose-it-2",[14,1542,1543,1544,1547],{},"Run ",[64,1545,1546],{},"ping"," to your LLM provider's API endpoint from your agent's server. If it's over 100ms, geography is costing you.",[14,1549,1550],{},"Compare agent response times from the same machine the agent runs on versus from your actual user location. The difference is network overhead.",[408,1552,1453],{"id":1553},"how-to-fix-it-2",[14,1555,1556,1559],{},[17,1557,1558],{},"Deploy your agent close to your LLM provider's data centers."," Most major providers (OpenAI, Anthropic, Google) have US and EU endpoints. Match your agent's region to the provider's closest endpoint.",[14,1561,1562,1565],{},[17,1563,1564],{},"Use streaming."," Instead of waiting for the full response, stream tokens to the user as they're generated. This doesn't reduce total latency, but it reduces perceived latency dramatically. The user sees the response building in real-time instead of staring at a loading spinner for 8 seconds.",[14,1567,1568,1571],{},[17,1569,1570],{},"Minimize round-trips."," Every time your agent \"thinks\" (LLM call), \"acts\" (tool call), and \"observes\" (processes result), that's at minimum three network round-trips per step. Reducing the number of steps reduces total round-trip overhead proportionally.",[14,1573,1574],{},[86,1575],{"alt":1576,"src":1577},"Every Step Multiplies Every Other Layer, a line chart of total latency against number of agent steps. An optimized agent at 1.5 seconds per step reaches 15 seconds at 10 steps; a typical agent at 3 seconds per step reaches 30 seconds; and a bloated-context agent at 5 seconds per step reaches 50 seconds, a full minute per task and unusable for users. Most tasks should end by step 5. The fastest agent solves the problem in fewer steps, not faster steps","/img/blog/ai-agent-latency-every-step-multiplies.jpg",[73,1579,1581],{"id":1580},"layer-5-multi-step-compounding-the-multiplier-nobody-talks-about","Layer 5: Multi-step compounding (the multiplier nobody talks about)",[14,1583,1584],{},"Here's where agent latency gets genuinely painful. Every additional step in your agent's workflow multiplies all the previous layers.",[14,1586,1587],{},"A single LLM call: ~800ms. Totally fine.",[14,1589,1590],{},"An orchestrator-worker flow with a reflexion loop: 10-30 seconds. Stevens Institute research puts this as the primary engineering constraint for AI agents in 2026.",[14,1592,1593],{},"A 10-step agent task means 10 LLM calls, potentially 10 tool calls, context growing with every turn, and network overhead on every round-trip. If each step takes 1.5 seconds (fast!), your total task time is 15 seconds. If each step takes 3 seconds (normal), you're at 30 seconds. At 5 seconds per step (common with context bloat), you're looking at nearly a minute.",[14,1595,1596],{},"For user-facing applications, an orchestrator-worker flow with reflection can take 10-30 seconds. For customer support, this latency is often unacceptable.",[408,1598,1600],{"id":1599},"the-honest-math","The honest math",[14,1602,1603],{},"Let's say your agent handles a support ticket. Steps: (1) read the ticket, (2) look up customer in CRM, (3) check order history, (4) check knowledge base, (5) draft response, (6) format and send.",[14,1605,1606],{},"Six steps. Each step involves at least one LLM call (800ms), one tool call (500ms average), and context processing that grows each turn. Conservative estimate: 2 seconds per step = 12 seconds total. Realistic with context bloat: 4 seconds per step = 24 seconds total.",[14,1608,1609],{},"This is why smart agent design keeps step count low. The fastest agent isn't the one with the fastest model. It's the one that solves the problem in 3 steps instead of 8.",[73,1611,1613],{"id":1612},"the-60-second-diagnostic-checklist","The 60-second diagnostic checklist",[14,1615,1616],{},"When your agent is slow, run through this in order:",[14,1618,1619],{},[86,1620],{"alt":1621,"src":1622},"The 60-Second Agent Latency Diagnostic, a five-step checklist: 1, check model TTFT by logging request-to-first-token time, and if it's under 2 seconds the model isn't the problem; 2, count input tokens, and over 30K means context bloat, so check tool defs and history; 3, time each tool call by wrapping every tool with timing logs to find the slowest; 4, check geography by pinging your LLM provider from your server, and over 100ms means move closer; 5, count your steps, and over 5 for a typical task means redesign the workflow. Most slowness is layers 2 and 5 working together, so fix those first","/img/blog/ai-agent-latency-60-second-diagnostic.jpg",[14,1624,1625,1628],{},[17,1626,1627],{},"Check model TTFT."," Log the time between request sent and first token received. If it's under 2 seconds, the model isn't your problem.",[14,1630,1631,1634],{},[17,1632,1633],{},"Count input tokens."," If your input exceeds 30,000 tokens per request, you have context bloat. Check tool definitions, conversation history, and tool results.",[14,1636,1637,1640],{},[17,1638,1639],{},"Time each tool call."," Find the slowest one. It's probably responsible for most of your tool execution latency.",[14,1642,1643,1646],{},[17,1644,1645],{},"Check geography."," Ping your LLM provider from your agent's server. If it's over 100ms, move closer.",[14,1648,1649,1652],{},[17,1650,1651],{},"Count your steps."," If your agent takes more than 5 steps for a typical task, redesign the workflow to reduce steps.",[14,1654,1655],{},"Most agent slowness is layers 2 and 5 working together. Bloated context makes each step slower. More steps means more bloated context. It's a feedback loop that gets worse with every conversation turn.",[14,1657,1658],{},"This is exactly why we built smart context management into BetterClaw from day one. Token bloat is the number one production agent killer, and most self-hosted frameworks leave you to solve it yourself. On BetterClaw, context is automatically managed per agent, tool results are filtered before entering the window, and persistent memory uses hybrid vector plus keyword retrieval so your agent doesn't drag around dead conversation weight. Free plan with 1 agent and 500 credits a month. $49/month for Pro. BYOK with zero inference markup.",[73,1660,1662],{"id":1661},"when-switching-models-actually-helps-and-when-it-doesnt","When switching models actually helps (and when it doesn't)",[14,1664,1665],{},"After all that, there are specific cases where the model genuinely is the bottleneck:",[14,1667,1668],{},[86,1669],{"alt":1670,"src":1671},"Model Switch vs Infrastructure Fix, how to decide. Switch the model when you're using a reasoning model like o3 or GPT-5 for a simple classification task, you need faster streaming for customer-facing responses, you're running local inference where hardware is the real ceiling, or TTFT is over 2 seconds after measuring. Fix infrastructure first when context exceeds 30K tokens per request, tool calls are sequential and unparallelized, the agent takes more than 5 steps per task, or response times vary wildly between requests. The model is 800ms of a 15-second problem; fix the other 14.2 seconds first","/img/blog/ai-agent-latency-model-switch-vs-infrastructure.jpg",[14,1673,1674,1677,1678,1682],{},[17,1675,1676],{},"You're using a reasoning model for a classification task."," If your agent is classifying email urgency (simple task) using o3 or GPT-5 (reasoning model), you're paying 10-30 seconds of \"thinking\" latency for a task that Haiku or Flash can handle in 600ms. Match model size to task complexity. The framework for ",[331,1679,1681],{"href":1680},"/blog/how-to-choose-llm-for-your-task","choosing the right LLM per task"," covers this directly.",[14,1684,1685,1688],{},[17,1686,1687],{},"You need streaming for user-facing interactions."," Some providers stream faster than others. Gemini 2.5 Flash at 173 tok/s finishes a 1,100-token response in under 7 seconds. Slower models might take 20+ seconds for the same output. For customer-facing agents, streaming speed matters.",[14,1690,1691,1694,1695,1699],{},[17,1692,1693],{},"Your agent runs on local hardware."," If you're running local inference on a Mac Mini or mid-range GPU, the model is genuinely slow (3-5 seconds to first token, 30-40 tok/s). Cloud APIs are 5-10x faster for agent workloads. We break down the ",[331,1696,1698],{"href":1697},"/blog/apple-silicon-vs-nvidia-ai-agents","hardware speed gap"," in detail.",[14,1701,1702],{},"For everything else, fix layers 2-5 first. You'll get more speed improvement from trimming 50,000 tokens out of your context window than from switching to a model that's 200ms faster on TTFT.",[14,1704,1705],{},"The difference between a frustrating agent and a fast one usually isn't the model. It's whether someone bothered to measure where the latency actually lives.",[14,1707,1708,1709,1713,1714,1716,1717,1720],{},"If you'd rather skip the latency debugging entirely, ",[331,1710,1712],{"href":419,"rel":1711},[421],"give BetterClaw a look",". Context management, tool optimization, caching, and infrastructure are all handled. ",[331,1715,829],{"href":746}," with 1 agent and 500 credits a month. ",[331,1718,1719],{"href":750},"$49/month for Pro"," on Pro. Your agent deploys in 60 seconds. On infrastructure we've already optimized for speed.",[73,1722,487],{"id":486},[408,1724,1726],{"id":1725},"what-causes-ai-agent-latency","What causes AI agent latency?",[14,1728,1729],{},"AI agent latency comes from five layers: model speed (time to first token and generation rate), context window size (more tokens means more processing time per request), tool execution time (external API calls like CRM, email, or database lookups), network round-trips between your agent and API endpoints, and multi-step compounding where each workflow step multiplies all previous delays. In most cases, context bloat and step count cause more slowness than the model itself.",[408,1731,1733],{"id":1732},"how-does-llm-latency-differ-between-providers-in-2026","How does LLM latency differ between providers in 2026?",[14,1735,1736],{},"Claude Haiku 4.5 leads on time to first token at around 597ms. Gemini 2.5 Flash leads on throughput at 146-173 tokens per second. Reasoning models (o3, GPT-5, Gemini Deep Think) are intentionally slow, often 10-150 seconds to first token due to chain-of-thought processing. For agent workloads, the fastest practical choices are Gemini Flash variants for throughput and Claude Haiku for TTFT.",[408,1738,1740],{"id":1739},"how-do-i-reduce-my-ai-agents-response-time","How do I reduce my AI agent's response time?",[14,1742,1743],{},"Start by logging input token counts. If they exceed 30,000 tokens, compress conversation history into summaries, load tool definitions on demand instead of all at once, and filter tool results before they enter context. Mem0's 2026 benchmarks showed that optimized context management cut latency by 91% while improving accuracy. After fixing context, parallelize independent tool calls and reduce total workflow steps.",[408,1745,1747],{"id":1746},"does-switching-to-a-faster-llm-model-fix-agent-latency","Does switching to a faster LLM model fix agent latency?",[14,1749,1750],{},"Usually not. A single LLM call takes about 800ms. If your agent takes 15 seconds total, the model accounts for roughly 5% of the latency. The other 95% is context processing, tool execution, network overhead, and multi-step compounding. Switch models only when you're using a reasoning model for simple tasks, need faster streaming for user-facing responses, or running local inference where hardware is the genuine bottleneck.",[408,1752,1754],{"id":1753},"is-managed-hosting-faster-than-self-hosted-ai-agents","Is managed hosting faster than self-hosted AI agents?",[14,1756,1757],{},"Generally yes, for three reasons: managed platforms pre-optimize tool integrations with connection pooling and caching, they handle context management automatically to prevent token bloat, and they deploy on infrastructure close to major LLM provider data centers. BetterClaw's managed infrastructure includes smart context management, optimized integrations, and zero setup overhead. Self-hosting gives you full control but requires you to solve every latency layer yourself.",{"title":139,"searchDepth":152,"depth":152,"links":1759},[1760,1761,1762,1766,1770,1774,1777,1778,1779],{"id":1373,"depth":152,"text":1374},{"id":1389,"depth":152,"text":1390},{"id":1423,"depth":152,"text":1424,"children":1763},[1764,1765],{"id":1445,"depth":158,"text":1446},{"id":1452,"depth":158,"text":1453},{"id":1484,"depth":152,"text":1485,"children":1767},[1768,1769],{"id":1497,"depth":158,"text":1446},{"id":1503,"depth":158,"text":1453},{"id":1533,"depth":152,"text":1534,"children":1771},[1772,1773],{"id":1540,"depth":158,"text":1446},{"id":1553,"depth":158,"text":1453},{"id":1580,"depth":152,"text":1581,"children":1775},[1776],{"id":1599,"depth":158,"text":1600},{"id":1612,"depth":152,"text":1613},{"id":1661,"depth":152,"text":1662},{"id":486,"depth":152,"text":487,"children":1780},[1781,1782,1783,1784,1785],{"id":1725,"depth":158,"text":1726},{"id":1732,"depth":158,"text":1733},{"id":1739,"depth":158,"text":1740},{"id":1746,"depth":158,"text":1747},{"id":1753,"depth":158,"text":1754},"2026-06-08","AI agent taking 15+ seconds? The model isn't the bottleneck. Diagnose context bloat, tool lag, and step compounding with this 5-layer framework.","/img/blog/ai-agent-slow-latency-fix.jpg",{},"/blog/ai-agent-slow-latency-fix","11 min read",{"title":1337,"description":1787},"Why Is My AI Agent So Slow? Fix Latency Fast","blog/ai-agent-slow-latency-fix",[1796,1797,1798,1799,1800,1801,1802],"ai agent slow","llm latency","reduce ai agent latency","llm inference speed","ai agent performance","context window optimization","agent response time","sG50JqwRjxh7tswWBoGDUPq3jNQTvysiPOoZkqhLaVQ",1784552885329]