AI Coding Agents: Persistent Project Memory vs Large Context Windows

·5 min readairag

TL;DR: Large context windows are useful, but they are not a substitute for project memory. The most reliable AI coding workflows store decisions, architecture, and current state in version-controlled documents that can be reloaded by any agent session.

Many developers assume they need a 256K or 1M token context window to work effectively on large software projects. In practice, the limiting factor is rarely the source code itself. The real challenge is preserving decisions, requirements, architectural tradeoffs, and task state across long-running development efforts.

Modern coding agents such as Codex, OpenCode, Claude Code, and Aider often work more effectively when they reconstruct project state from repository documents rather than relying on a continuously growing conversation history.

The Problem with Long Conversations

A common workflow looks like this:

Day 1:
- Design authentication
- Discuss architecture
- Evaluate storage engines
Day 2:
- Add WAL support
- Change implementation details
- Review tests
Day 3:
- Debug edge cases
- Revisit earlier design decisions

After several days, the conversation history may contain hundreds of thousands of tokens.

The challenge is that the chat becomes the project’s source of truth. If the session is lost, the accumulated knowledge disappears with it.

Project Memory Instead of Chat Memory

A more resilient approach is to move durable knowledge into repository files.

docs/
├── ARCHITECTURE.md
├── PRD.md
├── CURRENT_STATE.md
├── NEXT_TASK.md
└── ADR/
├── 001-authentication.md
├── 002-storage.md
└── 003-wal.md

In this model:

FilePurpose
PRD.mdProduct goals and requirements
ARCHITECTURE.mdSystem design and technical structure
ADR/*.mdArchitectural decisions and rationale
CURRENT_STATE.mdProgress snapshot
NEXT_TASK.mdImmediate task for the next session
AGENTS.mdCoding rules and repository conventions

The repository itself becomes the memory system.

How Agents Reconstruct Context

Instead of resuming a months-long conversation, a new session begins with:

Read:
AGENTS.md
PRD.md
ARCHITECTURE.md
CURRENT_STATE.md
NEXT_TASK.md
Summarize current state before proceeding.

The agent reconstructs the project’s state from documentation.

This approach has several advantages:

  • Works with smaller context windows
  • Survives session resets
  • Allows switching models and providers
  • Makes decisions visible to human contributors
  • Keeps important knowledge under version control

A Practical Workflow

For an ongoing project, a session might follow four phases:

Research

The agent explores the repository.

Task:
Implement WAL support.
Read architecture documents.
Find all storage-related code.
Produce an implementation plan.

Planning

The proposed design is reviewed and approved.

Important decisions are recorded in an ADR.

Implementation

The agent modifies only the files required for the task.

This keeps context focused and reduces unnecessary noise.

State Update

Before ending the session:

Update:
CURRENT_STATE.md
NEXT_TASK.md

The next session can start immediately without relying on previous chat history.

Example Repository State Files

A minimal state file might look like this:

# CURRENT_STATE
Completed
- WAL writer
- WAL record format
- Unit tests for writer
In Progress
- WAL replay
Remaining
- Checkpoint compaction
- Recovery testing

And a task file:

# NEXT_TASK
Implement WAL replay during startup.
Files:
- wal.rs
- startup.rs
Requirements:
- Replay before serving requests
- Ignore partially written trailing records

These files often provide more value than preserving tens of thousands of tokens of conversation history.

Context Windows Still Matter

This does not mean context windows are unimportant.

Larger windows help with:

  • Reviewing large pull requests
  • Understanding multiple subsystems simultaneously
  • Working with large specifications
  • Performing repository-wide analysis

However, larger context windows should be viewed as a performance enhancement rather than a memory system.

The most reliable workflow combines:

  1. Persistent project documentation
  2. Focused task-specific context
  3. Automated repository exploration
  4. Structured state tracking

The result is an agent that can effectively “remember” a project even when every coding session starts fresh.


References

  1. Aider Documentation — Aider Project — https://aider.chat/
  2. Codex — OpenAI — https://openai.com/codex/
  3. Claude Code — Anthropic — https://www.anthropic.com/claude-code
  4. OpenCode — OpenCode Project — https://opencode.ai/

This article was written by ChatGPT (GPT-5.5 | OpenAI).