
Why Your AI Code Agent Goes Off the Rails After 5 Minutes: Context Window, Harness, and RuFlo
Vũ Khôi
Tác giả tại Wotech Electronics Blog

Why do Claude Code and Codex get "loopy" after running for a while?
You hand Claude Code or Codex a fairly big job: build a new feature, fix a bug, run tests. The first few minutes go smoothly. Then the bot starts "drifting": asking about things it just did, re-editing the same spot over and over, inventing functions that don't exist, even stomping on old code that worked fine. This "loopiness" isn't a random glitch — it has a clear technical cause, and understanding that cause will change how your business thinks about its AI infrastructure.
A familiar story for anyone using AI to write code
This situation is extremely common among users of AI code agents like Claude Code or Codex. The bot codes away, fixing bugs for a while, and then suddenly: the context window overflows, a huge number of tokens get burned, and the result is hallucination or the destruction of working code.
Many people blame a "bad model." But in reality, the model is only one component of the system. The part that often gets overlooked — and that actually determines the experience — is the harness (the orchestration layer).
Context window: finite working memory
The context window is the maximum amount of text a large language model (LLM) can "see" in a single pass, measured in tokens — the small units the system chops text into as numbers.
The crucial point: an LLM has no natural long-term memory. On every response, the entire session history — the initial prompt, the contents of files read, command output, error logs, code diffs — must be packaged up and sent to the model again. The longer the session, the more the "working memory" swells. An agent left to run free for 5 minutes may have read a pile of files and run a pile of commands, with every step piling on new context.
When the pile hits the limit, the system is forced to truncate or summarize older content to make room. And the first things "summarized away" are usually the important instructions from the start of the session: coding conventions, business constraints, the note "don't touch module X." Having lost those markers, the model starts to hallucinate — producing output that sounds perfectly plausible but is wrong — or to redo old work, overwriting good code.
In other words: the bot isn't "going crazy." It's just being forced to work inside an ever-thickening fog.
Harness: the "nervous system" the model is missing
Remember one fundamental fact: the model only knows how to generate text. To do big jobs — reading a repo, running commands, editing many files, checking results — there must be an orchestration layer standing between the model and your computer. That layer is the harness, which people in the industry liken to the "central nervous system" of the entire AI agent system.
A good harness handles the jobs the model could never do on its own:
- Context management: deciding what information to keep, compress, or drop so the context window doesn't overflow.
- Task decomposition: breaking large tasks into small steps, each running in a tidy, contained context.
- Tool provisioning: giving the model the right to read files, run the terminal, query databases — in a controlled way.
- Cost control: tracking token spend, warning and blocking when the budget is exceeded.
- Long-term memory: storing lessons across sessions, so you don't have to repeat everything from scratch on every run.
Without a good harness, even the most capable model is like a talented employee with no process, no tools, and no logbook of what's been done: the talent never gets to show.
RuFlo: the open-source harness with over 75,400 stars
Among open-source harness projects, RuFlo (repo ruvnet/ruflo on GitHub) is drawing major attention after crossing the 75,400-star mark. RuFlo's four most notable features:
- Swarm Intelligence: automatically splitting work across more than 100 specialized expert bots instead of funneling everything into a single agent. Each bot has its own context — far leaner, cleaner, and much harder to overflow.
- RuVector Memory (long-term memory): learning from its own mistakes during work and recording them as experience. Notably, retrieving this memory costs zero LLM tokens — that is, 0% of the cost of stuffing the entire history back into the prompt.
- Enterprise Federation: securely connecting multiple machines into a working cluster, suited to internal data security requirements.
- TUI Console (terminal user interface console): tracking cost and progress in real time — something any engineering team running AI seriously needs.
Installation takes a single command: npx ruflo@latest init wizard. The project is released under the MIT license — a permissive open-source license that allows free use even for commercial purposes, with no legal strings attached later.
So the cause of the bot's "loopiness" lies in finite context memory, and the solution lies in a harness that knows how to divide the work, compress context, and accumulate lessons.
A perspective for Vietnamese businesses
For businesses bringing AI into their engineering workflows, a few lessons are worth noting:
- Don't judge an AI code agent by its model name alone. The same model with a different harness produces different productivity. The right question is: how does the orchestration layer manage context, permissions, and cost?
- Control token costs from day one. An agent running free can burn tokens very fast without you knowing. A real-time cost dashboard is not a luxury.
- Prioritize data autonomy. For sensitive data, the ability to self-deploy on internal infrastructure and securely federate machines — exactly RuFlo's design direction — should be considered before sending data to an outside service.
- Choose solutions with clear licensing. An open-source project under the MIT license lets an engineering team integrate it into commercial products with peace of mind.
Conclusion
An AI code agent going "loopy" after a few minutes of heavy work is not a sign of immature technology — it's the inevitable consequence of finite context memory, and the fix already exists at the architecture layer: a harness that decomposes tasks, manages context, accumulates long-term memory, and controls cost. Businesses that understand this will invest in the right place: not just buying a model, but building the orchestration system around it.
Source: compiled from technical discussions on Facebook (VGU Tech Alumni), edited by Wotech Electronics.
Does your business need advice on building safe, cost-efficient AI agent operations infrastructure? Contact Wotech for an assessment and a proposal that fits.
Bài viết liên quan

25 tháng 10, 2026 · 5 phut doc
The 40,000-star Claude Code playbook from a Vietnamese engineer in Paris: harnessing AI fully
Claude Code has become a familiar tool for many programmers, but as a post now circulating in the Vietnamese tech community puts it: most users tap only a fraction of its power. Behind that claim is …

25 tháng 10, 2026 · 6 phut doc
Security Alert: AI-Accelerated Password Cracking — How Businesses Should Defend
A tool called BruteForceAI recently appeared on GitHub and quickly racked up 1.6 thousand stars, according to shares within the cybersecurity community: a Python program that combines a large languag…

25 tháng 10, 2026 · 6 phut doc
A 240-Thousand-Star GitHub Repo That Isn't an AI Model: What Is ECC?
A repo just crossed 240 thousand stars and 36 thousand forks on GitHub — numbers most open-source projects can only dream of. The surprise: it isn't a new AI model. So what exactly is it, and what le…