Agent memory resolved?

By AI Jason

Share:

One Context: Enhanced Memory Management for Coding Agents

Key Concepts:

  • Context Window: The limited amount of text a Large Language Model (LLM) can process at once (currently ~120-200k tokens despite theoretical 1M token limits).
  • Memory Management: Techniques for enabling coding agents to retain and utilize information from past interactions beyond the context window.
  • Git Context Controller: A methodology for managing agent memory inspired by Git version control, utilizing a file-based structure.
  • One Context: A command-line tool implementing the Git Context Controller, facilitating persistent and shareable agent memory.
  • Branches, Commits, and Merges: Concepts borrowed from Git, used to organize and track different exploration paths and milestones within an agent's workflow.
  • Stop Hooks: Automated processes triggered at the end of agent sessions to save conversation history and generate summaries.

1. The Problem of Context Limitation in Coding Agents

The primary limitation of coding agents like Cloud Code and Cursor is context management. As tasks become more complex and agents work for longer durations, they tend to become “dumber,” repeating mistakes and forgetting previous attempts. This is fundamentally due to the context window limitations of the underlying LLMs. While models can theoretically handle up to 1 million tokens, the effective context window is significantly smaller (120-200k tokens). Current solutions, like Cloud Code’s memory feature, store information in separate MD files per “pair,” which can quickly become unwieldy for complex projects and are specific to Cloud Code. The ideal solution involves a shared, persistent memory accessible across all agent sessions and agents, enabling cumulative team knowledge and continuous agent improvement. This remains a challenging problem with no universally ideal solution currently available.

2. Introducing One Context and the Git Context Controller

The speaker highlights One Context, a recently released project utilizing a Git Context Controller to address the memory limitation. This controller defines a simple memory framework where the agent manages context like Git, ensuring persistence across sessions and agents. This allows for knowledge sharing and accumulation, improving agent performance over time. Testing has shown that using this method with Cloud Code results in a 13% performance improvement on software engineering tasks, and even allows smaller models like GPT-4.5 Air to perform at a level comparable to frontier models. Crucially, the setup is described as “extremely simple and basic.”

3. Methodology: The Git-Inspired Memory Framework

The Git Context Controller operates on a file-based structure with four key components:

  • main.md: Stores the global context and roadmap of the project.
  • Branches (Folders): Represent different exploration paths or approaches to a task (e.g., playwright).
  • commit.md: Logs high-level milestones achieved within a branch, similar to Git commits. Records significant progress or deliverables.
  • log.md: Stores the full raw conversation history (observations, actions, and metadata) for a specific commit, analogous to a Git log.

The agent utilizes four core actions:

  • branch: Initiates a new exploration path by creating a new folder and initializing commit.md and log.md.
  • commit: Records a milestone by updating commit.md and optionally revising main.md.
  • merge: Integrates the history of a completed branch into the main.md and log.md, providing a consolidated record.

Example: Building a LinkedIn Web Scraper

The speaker illustrates the process with a LinkedIn web scraper example:

  1. The agent starts with a main.md file outlining the project roadmap.
  2. It decides to explore a Playwright-based approach, creating a playwright branch.
  3. Within the playwright branch, it creates commit.md and log.md to track progress.
  4. As the agent completes subtasks (e.g., a functional v1 script), it uses commit to log milestones.
  5. Upon completion, it uses merge to integrate the playwright branch’s history into the main.md.
  6. If a different approach (e.g., using the LinkedIn API) is deemed better, a new branch is created.

This structure allows the agent to “fork” conversations without losing overall context, enabling complex, long-running tasks. The agent can retrieve information by examining main.md for the overall scope, specific branch files for detailed progress, and log.md for raw conversation history.

4. One Context Implementation and Features

The speaker demonstrates setting up and using One Context:

  1. Installation: npm i -g onecontext-ai
  2. Initialization: Running onecontext opens a split-view interface with the agent session on one side and the memory management on the other.
  3. Context Creation: Creating a "context" (essentially a memory group) named "demo project."
  4. Session Creation: Adding a new session within the context, selecting a coding agent (Cloud Code or Cursor) and workspace.
  5. Memory Persistence: Demonstrating that information provided to the agent is retained across sessions and folders, thanks to One Context’s memory system. The system avoids using Cloud Code’s native memory by explicitly removing it.
  6. File System Access: The underlying memory is stored locally in a line.db folder, replicating the Cloud Code conversation history and summaries.
  7. Search Capabilities: One Context utilizes a search function (code align) to locate relevant information within the memory, allowing the agent to retrieve past learnings. Search can be refined by session or turn.

5. Real-World Application: Multi-Agent Research

The speaker demonstrates a scenario involving multiple agents researching different memory setups:

  1. Two sessions are created: one with Cloud Code and one with Cursor.
  2. Each agent is tasked with researching Open Claw memory, Let us Context Repositories, and One Context memory mechanisms.
  3. A new session is created to ask the agents to compare the different memory setups based on their collective research.
  4. The agent successfully retrieves information from all previous sessions and provides a comparative analysis, demonstrating the power of shared memory.

6. Sharing and Collaboration

One Context allows for easy sharing of the memory context via a generated URL. This creates a simple chatbot interface loaded with the conversation history, enabling collaboration and knowledge sharing.

Quote: “...fundamentally the way it works is a file system to store and summarize abstract all the past actions which you can easily set up and achieve your own skill for your cloud code and save their memory locally.”

7. Resources and Further Learning

The speaker mentions a free resource from The Hustle offering 20 AI app ideas for practice, including step-by-step breakdowns and prompts for Cloud Code and Cursor. He also promotes AI Builder Club workshops focusing on agent memory management and production agent building.


Conclusion:

One Context, built on the Git Context Controller, offers a promising solution to the context limitation problem in coding agents. Its simple, file-based approach enables persistent, shareable memory, leading to improved agent performance and facilitating collaborative knowledge building. The ease of setup and integration with existing tools like Cloud Code and Cursor make it a valuable tool for developers looking to maximize the potential of AI-powered coding assistants. The system’s reliance on a file system for memory management provides a transparent and accessible way to understand and control the agent’s learning process.

Chat with this Video

AI-Powered

Hi! I can answer questions about this video "Agent memory resolved?". What would you like to know?

Chat is based on the transcript of this video and may not be 100% accurate.

Related Videos

Ready to summarize another video?

Summarize YouTube Video