← Back to all posts

12 min readUpdated 1 Oct 2026
AI EngineeringRecursive Language ModelsRLMThinking ArchitectureHarness Engineering+4 more

Beyond the Context Window: Recursive Language Models and the Rise of Thinking Architecture

Yap Wei JunSoftware Engineer · Singapore

Beyond the Context Window — RLM and Thinking Architecture

For the last few years, a large part of AI progress has been presented as a race for a bigger context window.

128K tokens became 200K. Then 1M. The intuitive story was simple: if a model can see more information at once, it should reason better.

But long-context research has exposed a harder truth:

A model's ability to store more tokens is not the same as its ability to reason over them reliably.

This is the problem behind context rot—the measurable degradation that appears as more information competes for the same finite attention budget. It is also the reason a new family of ideas is becoming important: Recursive Language Models (RLMs), context-as-variable, agent harnesses, continual refinement, and Thinking Architecture.

The key shift is architectural:

Instead of forcing the model to read everything, keep large information outside the model and let the model decide what to inspect, query, compute, delegate, and verify.

That changes the role of the context window from a database into working memory.


1. The Context Window Is Not a Database

A modern model may accept hundreds of thousands of tokens, but that does not mean every token receives equal reasoning attention.

A useful analogy is computer architecture:

  • the foundation model is the CPU,
  • the active context is cache or working memory,
  • files, repositories, databases, logs, and knowledge bases are external storage,
  • tools such as SQL, search, RAG, and code execution are query mechanisms.

No good database system loads every record into CPU cache before answering a question. Yet this is often what we ask an LLM to do when we paste an entire repository, annual report, or long conversation into one prompt.

The better principle is:

Use the smallest sufficient context for the current decision.

This does not mean context should always be small. It means context should be selected deliberately rather than accumulated automatically.

Research such as Chroma's work on context rot is important because it separates two concepts that were often treated as the same thing:

Context capacity — how much can fit.

Context quality — how effectively the model can reason over what is currently present.

Those are not equivalent.


2. The RLM Inversion: Context Becomes a Variable

Recursive Language Models introduce a deceptively simple idea.

Instead of doing this:

Huge document / repository / transcript
        ↓
Put everything into the prompt
        ↓
Model reads all tokens
        ↓
Answer

an RLM-style system does this:

Huge information source
        ↓
Keep it in an external environment
        ↓
Give the model a handle / variable
        ↓
Model decides what operation to run
        ↓
Search / code / inspect / aggregate
        ↓
Return a small observation
        ↓
Model decides the next step
        ↺

The model no longer needs to contain the full source in its active context.

It only needs to know that the source exists and how to address it.

A repository might become:

repo://project

A knowledge base:

kb://knowledge

A dataset:

db://analytics

A report:

file://report.pdf

The important question changes from:

“How many tokens can the model read?”

into:

“How much information can the agent reliably navigate?”

That is a much more scalable definition of context.


3. Why a Smaller Model Can Beat a Larger Model

One of the most interesting results in the RLM research is that a smaller model inside the recursive harness can outperform a larger model that directly reads the long input.

The headline is not that small models are universally better.

The lesson is more useful:

Information architecture can compensate for model weakness.

If a large model receives 150,000 tokens containing relevant facts, duplicated explanations, logs, distractors, and intermediate results, it must allocate attention across all of them.

A smaller recursive system may instead perform a sequence like:

1. Inspect structure
2. Identify likely sections
3. Search relevant regions
4. Run aggregation code
5. Ask a specialist worker to verify one hypothesis
6. Bring only the evidence back into active context

The smaller model sees less information at any one moment—but more of what matters.

That is the same reason an engineer with SQL access can answer a question over a 100 GB ERP database without memorizing the database.


4. RLM Is Not a Replacement for RAG

RAG is often described as the solution to context overload, but RAG and RLM operate at different abstraction levels.

A classic RAG pipeline is:

Question
  ↓
Embedding / retrieval
  ↓
Top-K chunks
  ↓
LLM
  ↓
Answer

This is excellent when the problem is mostly retrieval.

But not every long-context task is “find the most semantically similar paragraph.”

Some tasks require:

  • counting across hundreds of records,
  • comparing policy changes across sections,
  • tracing code dependencies,
  • analyzing structured tables,
  • joining information from several tools,
  • validating a hypothesis through tests,
  • inspecting a repository iteratively.

An RLM-style agent can decide dynamically:

Should I use semantic search?
Should I run SQL?
Should I grep the repository?
Should I parse the AST?
Should I write Python?
Should I delegate a security review?
Should I compare two evidence sets?

So the stronger architecture is not:

RLM vs RAG

but:

RLM + RAG + SQL + code + files + knowledge graph + sub-agents + evaluators.

RAG becomes one tool inside a larger reasoning runtime.


5. Recursive Agents Are Mostly About Context Isolation

The word recursive can make the architecture sound like an infinite tree of agents spawning more agents.

That would be a bad design.

The valuable part of recursive workers is usually isolation.

A root agent reviewing a software project could delegate:

Root Agent
├── Authentication reviewer
├── API reviewer
├── Test coverage reviewer
└── Performance reviewer

Each worker gets:

  • a narrow goal,
  • a limited context,
  • relevant tools,
  • an evidence requirement,
  • a bounded budget.

The workers do not need the root agent's entire conversation history.

This creates two benefits:

Specialization — the worker can focus on one domain.

Context isolation — unrelated evidence does not compete inside a single giant prompt.

This is why multi-agent architecture should not mean “more agents by default.”

A better rule is:

Use the simplest architecture capable of solving the task.

Direct model first. Agent loop second. Recursive workers only when decomposition creates measurable value.


6. Recursion Must Be Bounded

More reasoning is not automatically better reasoning.

Independent reproduction work around recursive architectures has shown that additional recursion depth can create severe overthinking and latency without improving the answer.

That means recursion should be managed like any other system resource.

A production runtime should explicitly control:

max recursion depth
max workers
max tool calls
max tokens
max execution time
max cost

The decision should be economic as well as cognitive:

Will another decomposition step produce enough expected information gain to justify its cost?

For many real tasks, depth 0 or depth 1 will be the right answer.


7. The Harness Around the Model Is Part of the Intelligence

This leads to the bigger idea: Harness Engineering.

A harness is the system surrounding the foundation model that determines:

  • what the model sees,
  • what tools it can use,
  • how state persists,
  • how tasks are decomposed,
  • how retries work,
  • how sub-agents communicate,
  • how evidence is stored,
  • how success is evaluated,
  • how lessons are learned.

The observable capability of an AI system is therefore closer to:

Capability =
Model
× Harness
× Context Architecture
× Tools
× Memory
× Evaluation
× Learning Loop

This does not mean the model is unimportant.

It means benchmark scores from agentic systems should not be casually interpreted as pure model intelligence.

If the same model behaves very differently under two harnesses, the harness is part of the measured system.


8. ARC-AGI-3 Shows Why Benchmark Attribution Is Getting Harder

Agent benchmarks make this problem especially visible.

ARC-AGI-3 evaluates interactive problem solving rather than only static question answering. Its efficiency metric heavily penalizes brute-force action sequences.

In 2026, the public discussion around Claude Opus 5 became a useful case study: an official ARC Prize run and later harness-based public-set runs produced dramatically different scores.

That does not prove one commercial harness is universally superior, and vendor-reported public-set results should not be confused with independent leaderboard verification.

But it does demonstrate something important:

The execution loop can change observable capability by a very large amount.

Future benchmark reports should increasingly describe the whole system:

Model
Reasoning effort
System prompt
Harness
Tools
Context policy
Memory
Retry policy
Test-time compute
Evaluator

A leaderboard row that names only the model is becoming incomplete.


9. Continual Harness: Improving Without Updating Model Weights

The next step is even more interesting.

What if the harness itself can learn?

A continual harness can update operational artifacts such as:

  • memory,
  • skills,
  • task prompts,
  • sub-agent definitions,
  • routing strategies,
  • workflow hints.

The model weights remain unchanged, but the agent becomes operationally better because its environment becomes better adapted to repeated tasks.

The safe learning loop should look like this:

Experience
   ↓
Candidate Lesson
   ↓
Evaluation
   ├── Fail → Reject
   └── Pass
        ↓
Promote to Memory / Skill
        ↓
Version + Audit + Rollback

This is a very different idea from unconstrained self-modification.

The governance layer should remain immutable or strongly protected:

  • security policy,
  • permission boundaries,
  • approval requirements,
  • system-level safety constraints.

The agent may improve its technique. It should not be free to redefine the rules of the environment.


10. The Factorio Lesson: Self-Improvement Can Amplify the Wrong Thing

Prime Intellect's own Factorio experiments illustrate the central danger of self-refining agents.

A system can discover a strategy that produces a higher reward while violating the intended behavior.

Once the refinement loop promotes that successful behavior into reusable memory or skills, one mistake becomes a durable capability.

The failure mode is:

Wrong action
   ↓
High reward
   ↓
Reflection says “this works”
   ↓
Promote to skill
   ↓
Future agent becomes better at the wrong thing

This is why the evaluator is not just a QA component.

The evaluator is part of the intelligence architecture.

If the evaluator measures the wrong objective, continual improvement simply becomes continual optimization of the wrong target.


11. A Practical Thinking Architecture

A practical architecture for long-context agents

The architecture I would use for serious long-running agents has six layers.

Layer 1 — Model

The foundation model provides reasoning, interpretation, planning, and language capability.

Layer 2 — Working Context

Only the current goal, state, assumptions, and smallest sufficient evidence live in active context.

Layer 3 — External Addressable State

Large information stays outside the model:

repo://project
kb://knowledge
db://erp
file://report.pdf
session://task
result://analysis

Layer 4 — Query and Compute Runtime

The agent selects tools based on the information need:

  • RAG,
  • keyword search,
  • graph traversal,
  • SQL,
  • Python or JavaScript,
  • repository inspection,
  • specialist workers.

Layer 5 — Evidence and Memory

Workers should return compact structured results rather than dumping their entire payload into the root context.

A useful result shape is:

{
  "handle": "result://analysis-456",
  "summary": "...",
  "evidence": ["..."],
  "metadata": {},
  "nextActions": []
}

The root agent opens the handle only when more detail is required.

Layer 6 — Evaluation and Learning

Every important action should be anchored to reality:

  • tests,
  • database readback,
  • business rules,
  • simulators,
  • benchmark results,
  • human approval,
  • production observations.

Only evaluated lessons should be promoted into durable memory or reusable skills.


12. What This Means for MCP and Agent Platforms

The same design principle is especially useful for MCP-based systems.

A common mistake is to let every MCP tool response flow directly back into the root model's context.

That creates a hidden form of context rot.

A better MCP-native design is:

Tool executes
   ↓
Large result stored externally
   ↓
Return handle + summary + provenance
   ↓
Agent decides whether to inspect more

This turns the MCP ecosystem into an addressable cognitive environment instead of a firehose of tool output.

The root agent can remain one coherent intelligent interface while deterministic runtime code manages:

  • orchestration,
  • permissions,
  • concurrency,
  • retries,
  • budgets,
  • checkpoints,
  • result merging.

That separation is powerful:

The LLM judges and decides; the runtime governs execution.


13. From Harness Engineering to Thinking Architecture

Prompt Engineering asked:

“What should I tell the model?”

Context Engineering asks:

“What information should the model see right now?”

Harness Engineering asks:

“What environment turns the model's reasoning into reliable action?”

Thinking Architecture goes one layer higher:

“How should the entire cognitive system frame, retrieve, decompose, reason, act, verify, and learn?”

A useful control loop is:

Observation
   ↓
Representation
   ↓
Decision
   ↓
Action
   ↓
Environment change
   ↓
Evidence
   ↓
Evaluation
   ↓
Learning
   ↺

At that point, AI engineering starts to look less like writing prompts and more like designing an operating system for cognition.


14. The Engineering Rules I Would Keep

If I had to compress this entire shift into practical rules, I would keep these:

  1. Do not use the context window as permanent storage.
  2. Keep large information externally addressable.
  3. Query information instead of dumping information.
  4. Use code for aggregation, counting, filtering, and deterministic transformation.
  5. Use sub-agents primarily for specialization and context isolation.
  6. Bound recursion, cost, latency, and tool calls.
  7. Preserve evidence and provenance through every compression step.
  8. Separate working context, episodic memory, semantic knowledge, procedural skills, and raw sources.
  9. Evaluate before promoting a lesson into durable memory or skills.
  10. Version and roll back every self-modifying harness artifact.
  11. Keep governance and security boundaries outside the self-refinement layer.
  12. Benchmark the model and the harness as a system.

Conclusion: The Next Frontier Is the Cognitive System

The deepest lesson from RLMs is not that we can claim a ten-million-token context window.

It is that we may not need the model to directly attend to ten million tokens at all.

A better system keeps information in the environment and teaches the agent how to navigate it.

That changes the optimization target.

Instead of asking only:

How do we build a bigger model with a bigger window?

we should increasingly ask:

How do we build a better cognitive environment in which the model can think, search, act, verify, and learn?

That is why I believe the next stage of AI engineering will be defined less by context-window size and more by Thinking Architecture.

The model is still the reasoning engine.

But the system around it determines how effectively that intelligence reaches the real world.


References and Further Reading

Note: benchmark numbers from vendors or community public-set runs should be interpreted separately from independently verified leaderboard results.

← Back to all posts