The 'Three-File' Pattern: How Manus and Claude Code Are Converging on a Solution for LLM Context Drift

Reverse-engineering the 'read-update-act' loop that keeps autonomous agents from getting lost in the middle.

· 4 min read · PSEEDR Editorial

While the industry anticipates massive context windows, a reverse-engineered workflow from the Manus agent suggests the immediate solution to autonomous reliability lies in a surprisingly low-tech architecture: three specific Markdown files designed to force attention refocusing.

As the race for autonomous software engineering agents accelerates, a distinct architectural pattern is emerging from the noise. Recent analysis of the Manus agent workflow-alongside similar structures in Anthropic's Claude Code-indicates that the industry is converging on file-based state management to solve the persistent 'Lost in the Middle' phenomenon. Rather than relying solely on massive context windows or complex vector retrieval systems, the most effective agents appear to be adopting a disciplined 'Three-File' context solution to maintain coherence over long-running tasks.

The Mechanics of Context Drift

Large Language Models (LLMs) suffer from a well-documented degradation in performance as the conversation history lengthens. Instructions provided at the beginning of a prompt often get drowned out by subsequent noise-a failure mode known as context drift.

According to reverse-engineered analysis of the Manus workflow, the solution is not necessarily to reduce token count, but to actively manipulate the model's attention. The investigation notes that "writing operations indeed generate token consumption... but the key is not reducing token quantity, but attention manipulation". By forcing the agent to interact with static files, the system ensures critical instructions remain within the model's primary attention window.

The Three-File Architecture

The Manus workflow reportedly utilizes a strict compartmentalization strategy using three Markdown files:

  1. task_plan.md: A dynamic checklist of the project's status. The agent must read this before every decision.
  2. notes.md: A repository for research and intermediate findings.
  3. deliverable.md: The dedicated space for the final output.

This structure forces a "read-update-act" loop. The analysis highlights that "the Agent re-reads the plan file before every decision, ensuring the goal always stays within the attention window". This prevents the agent from hallucinating next steps or getting distracted by the minutiae of code execution. It effectively externalizes the agent's memory, treating the context window as a processor rather than a storage drive.

Sub-Agent Delegation and Hygiene

A critical component of this architecture is the separation of concerns between a 'Main Agent' and ephemeral 'Sub-Agents.' In this model, the Main Agent acts as a project manager, maintaining the task_plan.md and keeping its own context window lightweight. When a context-heavy task is required-such as reading documentation or debugging a specific error-the Main Agent delegates this to a sub-agent.

The sub-agent spins up, performs the heavy lifting in an isolated environment, and reports only the necessary results back to the notes.md or deliverable.md files. As noted in the investigation, developers should "use sub-Agents to handle context-intensive tasks... sub-Agents report results after completing heavy work in independent contexts". This ensures the Main Agent never pollutes its context with irrelevant tokens that could trigger drift.

Industry Convergence and Limitations

This file-based approach is not unique to Manus. It mirrors the architecture seen in Anthropic's Claude Code and open-source tools like Spec-kit, validating this as a current best practice for DevTools. However, this approach introduces friction. It transforms the agent from a "magic button" into a collaborative workflow that requires supervision.

The analysis warns that this is an "8-hour workday rhythm, not 'set and forget' automation". The human operator must treat the agent like a junior employee, reviewing the task_plan.md updates to ensure the trajectory remains correct. Furthermore, the constant reading and rewriting of state files increases token consumption, trading higher operational costs for increased reliability.

Market Speculation

The efficacy of this workflow has coincided with unverified rumors regarding a potential $2 billion acquisition of Manus by Meta. While the acquisition remains unconfirmed, the valuation rumors underscore the immense market value placed on agents that can reliably execute multi-step engineering tasks without succumbing to context failure. Whether or not the acquisition is real, the architectural lesson is clear: structure and state management are currently more valuable than raw model intelligence.

Key Takeaways

Sources