ContextWorking context · durable memory · retrieval

Memory and context

The systems that decide what an agent sees now, what it can retrieve later, and which durable facts persist across sessions.

Use it when

  • Work spans multiple turns or sessions and useful state would otherwise be lost.
  • A large knowledge base should be retrieved selectively instead of always loaded.
  • Preferences or project observations need an editable, inspectable home.

Choose another layer when

  • Secrets, credentials, or sensitive data without an explicit storage policy.
  • Hard constraints that must be enforced independently of model attention.

Production path

Build it in this order

  1. 01

    Classify the information

    Separate task state, durable project truth, user preferences, retrieved evidence, and sensitive data before choosing storage.

    Quality check: Each item has an owner, lifetime, access boundary, and deletion path.

  2. 02

    Retrieve the smallest useful context

    Load only material relevant to the current decision, label provenance, and prefer summaries that link back to primary evidence.

    Quality check: Removing unrelated context does not reduce task quality.

  3. 03

    Make memory inspectable

    Let users review, edit, expire, and delete saved information. Test stale and contradictory memories.

    Quality check: A user can explain what was remembered and correct it without hidden state.

Artifacts you may see

  • MEMORY.md
  • project memory stores
  • retrieval indexes
  • session state

Evidence ledger

Primary documentation behind this guide

Provider-specific behavior is sourced to that provider. Open standards are sourced to their specifications and official maintainers.