# Local-First Project Memory for AI Coding: What to Save and Why

AI coding sessions are fast but temporary. Your product decisions are not.

When the useful context of a project exists only in chat history, every new session starts with a tax: rediscover the architecture, infer old decisions, repeat investigations, and risk undoing work that was already settled.

A local-first project memory solves a specific problem. It keeps durable context beside the code, under the project owner's control, so agents can resume from verified facts instead of reconstructing the past.

Project memory is not a transcript

Saving every prompt and response creates a large archive, not useful memory. The next agent still has to decide which statements are current, which were guesses, and which were later disproved.

Useful memory is selective. It answers questions that will matter again:

  • What outcome is the project pursuing?
  • Which product boundaries are intentional?
  • Where does authoritative state live?
  • What decisions have been confirmed?
  • What evidence proves the current implementation?
  • What remains unfinished?
  • What is the next safe action?

The goal is not to remember everything. It is to prevent costly rediscovery and accidental reversal.

Why local-first matters

Project memory often contains more than technical notes. It may reveal product strategy, customer problems, unreleased features, infrastructure choices, and operational incidents.

A local-first approach keeps that context in files the project owner can inspect, version, back up, and remove. Cloud services may still support collaboration or optional synchronization, but the project should not become unusable when that service is unavailable.

Local ownership also improves accuracy. A memory file can sit next to the code and be checked against the current repository. When memory conflicts with tests, logs, or runtime evidence, the current evidence wins.

The seven kinds of context worth saving

1. The current outcome

Write one sentence describing the user result currently being pursued. Update it when the goal genuinely changes, not whenever implementation changes.

2. Product invariants

Record boundaries that future work must preserve: local data ownership, stable URLs, one content authority, a familiar user action, or a required deployment path.

These notes stop “helpful” changes from silently rewriting the product.

3. Confirmed decisions

A decision record should include the choice, the reason, its consequences, and what new evidence would justify revisiting it.

Do not store a preference as a universal fact. Make the scope explicit.

4. Verified project facts

Useful facts include the real application entry point, the authoritative data source, the release command, or the relationship between services.

Facts should point to evidence when possible. If a fact is only suspected, keep it in a temporary inbox rather than stable memory.

5. Reusable patterns

Some lessons apply beyond one incident: verify generated output instead of only templates, use stable idempotency keys for external mutations, or preserve last-known-good content during a temporary outage.

Store a pattern only after it has been validated and is likely to be reused.

6. Active session state

An active handoff describes what is happening now: completed steps, exact identifiers, current blocker, and next action.

Unlike stable decisions, it is expected to change frequently and should be cleaned up when the work closes.

7. Evidence references

Memory becomes more trustworthy when it points to a file, test, commit, deployment, event, or runtime check. The reference lets the next session verify the claim instead of accepting it blindly.

What not to store as stable memory

Avoid promoting these items:

  • raw command output;
  • entire diffs;
  • secrets or credentials;
  • guesses that have not been verified;
  • temporary debug observations;
  • generic completion language;
  • instructions that only apply to one short-lived run.

These items create noise and can become dangerously stale.

A simple file structure

A small project can begin with:

  • a project overview for stable facts;
  • a decisions folder;
  • a patterns file;
  • an active handoff;
  • an inbox for unverified observations.

The exact names do not matter. The separation does. Stable knowledge, current work, and uncertain observations have different lifetimes and should not overwrite one another.

The evidence-first update rule

Before writing memory, classify the information:

1. Is it a preference, rule, project fact, decision, pattern, domain fact, temporary observation, or active handoff? 2. Has current evidence verified it? 3. Is it likely to matter in a future session? 4. Which existing entry should it update instead of duplicate?

If the information is unverified, keep it temporary. If it is verified but one-time, it may not need long-term storage at all.

How an agent should retrieve memory

Memory should narrow investigation, not replace it.

A good resume sequence is:

1. Read the current goal and active handoff. 2. Retrieve only entries related to the feature, boundary, or failure. 3. Follow their evidence references into current code or runtime state. 4. Treat mismatches as a reason to update memory, not ignore reality. 5. Continue from the last verified state.

This keeps context small and reduces the chance that an old note controls a changed system.

Memory and roadmaps solve different problems

Memory preserves what the project knows. A roadmap chooses what the project should accomplish next.

They should connect, but they should not collapse into one document. A decision can remain true across many roadmap stages. An active handoff may belong to one stage. A useful pattern may apply across multiple projects.

Keeping these roles separate makes both tools easier to trust.

A practical end-of-session checklist

Before ending meaningful work, ask:

  • Did the current outcome change?
  • Did we confirm a decision that will constrain future work?
  • Did we discover a stable project fact?
  • Is there an unfinished object or exact identifier the next session needs?
  • Did a temporary observation become verified?
  • Can any outdated handoff now be removed or replaced?

Update only the relevant entries. A concise, accurate handoff is better than a comprehensive diary.

The result: continuity without surrendering control

Local-first project memory gives AI coding work a durable spine. The code remains the implementation truth. Runtime evidence remains the behavior truth. Memory preserves the decisions and context needed to interpret both.

That combination lets a solo developer stop and resume without losing direction, while keeping strategic project knowledge inspectable and owned alongside the work itself.