Vector search is useful for finding relevant material, but it is not a complete memory system. Internal assistants handle several kinds of context, each with different requirements for accuracy, retention, authorization, and updates. Treating every remembered item as an embedding can blur those differences and make it harder to determine what is current, who may change it, and how an action occurred.
A durable AI agent memory architecture separates semantic retrieval, task state, explicit user preferences, authoritative system records, and audit history. Retrieval helps a model locate potentially relevant knowledge. Structured state records work in progress. Preference records preserve approved choices. Systems of record remain responsible for business facts. Audit records provide evidence of requests, decisions, and actions.
This separation aligns with published agent-memory patterns. MemGPT describes tiers that distinguish in-context memory from recall and archival storage, with explicit operations for managing persistent state. MemGPT: Towards LLMs as Operating Systems LangGraph likewise distinguishes thread-scoped short-term state from long-term memory that persists across threads. LangGraph memory concepts
Start with the memory decision
The first question is not which database to deploy. Ask what the assistant is being asked to remember, who owns that information, and what happens when it is wrong.
For example, a user’s chosen report format is a preference. An invoice status is a business fact owned by a finance system. A pending approval is task state. A tool invocation or approval decision is evidence for an audit trail. These records may all be represented as text, but they do not have the same authority or write rules.
Define a write policy before selecting storage. A model can identify a possible memory candidate, but the application should determine whether it becomes a durable preference, a state transition, or no stored record at all. The durable-memory argument is principally about governing writes: deciding what may be retained, who may write it, how it is validated, how long it remains valid, and how it can be corrected or removed. Durable Memory: Why Vector Databases Aren’t Enough
Separate the memory layers
A practical internal-assistant design can use five layers. A small implementation may run more than one layer on the same infrastructure, but the data contracts, ownership rules, and access controls should remain distinct.
Working context
Working context is the bounded information assembled for the current interaction or task. It can include recent messages, the current workflow step, retrieved policy excerpts, and a concise task summary. It is useful for continuity, but it is not automatically durable truth.
Chat history should not be mistaken for validated state. A message that says an action will be taken does not establish that it completed. Long conversations also need reduction or summarization. Semantic Kernel’s enterprise context guidance separates short-term message handling from deterministic state and describes scoped context across user, session, and tenant boundaries. Semantic Kernel enterprise context management
Task state
Task state represents the status of work: a selected account, a current approval stage, a pending confirmation, a checkpoint, or the outcome of a tool call. Store it as structured, thread-scoped data with explicit transitions and a versioned representation.
This state must support recovery. When execution pauses after an external operation, the application needs a defined way to determine whether work completed, failed, or needs reconciliation. LangGraph documents thread-level persistence through checkpointers for execution state, including recovery and human-in-the-loop workflows. LangGraph memory concepts
For Java services, model task state as a typed record or entity. Update it through validated application commands instead of appending a model-generated summary to a conversation transcript.
Preference memory
Preference memory contains durable, user-scoped choices such as report format, notification channel, language, units, or an opted-in writing style. Keep it small, inspectable, editable, and attributable to a user or authorized administrator action.
Preferences need provenance. Record whether a value was explicitly set by the user, assigned by an administrator, or proposed by an inference process. For consequential behavior, an inferred preference should not become a durable rule without confirmation or a governed policy. Separating long-term profile information from short-term context is consistent with Semantic Kernel’s enterprise guidance. Semantic Kernel enterprise context management
Semantic recall
Semantic recall is the appropriate role for vector retrieval. It can index approved unstructured material such as policy documents, product documentation, project notes, and resolved support material. It provides relevance, not proof that content is current, authorized, or authoritative.
Retrieved material should retain metadata appropriate to the application, such as tenant, source system, document identifier, version, classification, timestamps, and retention status. Enforce access rules before content is supplied to the model. Relevance ranking must operate within the caller’s permitted corpus.
Spring AI documents chat-memory handling and vector-store question answering as separate advisor concerns. That design supports a modular distinction between turn-by-turn conversational context and semantic retrieval. Spring AI Advisors reference
Evidence and system records
Audit history captures meaningful events, including user requests, retrieved source identifiers, policy decisions, tool invocations, approvals, errors, and externally visible outcomes. It should be time-stamped, access-controlled, and queryable for investigation.
Business facts should remain in their owning systems. An assistant can obtain an invoice status from finance, a role from identity infrastructure, or a change window from service management through authorized integrations. It should not rely on a prior model-memory copy as the current source of truth.
AWS’s context-aware generative AI architecture separates persistent session and transactional information from knowledge retrieval, using DynamoDB alongside retrieval services for persisted application data. AWS: Building Context-Aware Generative AI Agents
Choose storage by responsibility
| Information type | Appropriate home | Write rule | Assistant use |
|---|---|---|---|
| Current workflow step or pending approval | Transactional task-state store | Validated application transition | Control next action and recovery |
| User-selected output format | User preference profile | User or authorized administrator update | Personalize presentation |
| Approved handbook content | Document repository and vector index | Ingestion from an approved source | Retrieve and ground an answer |
| Invoice or identity status | Owning system of record | The source application controls writes | Read through an authorized integration |
| Tool call, decision, or approval | Audit or event store | Application emits an event | Explain and investigate behavior |
| Temporary task summary | Thread context or checkpoint | Bounded, versioned update | Continue work without replaying all messages |
Build a controlled write path
The application should own durable memory writes. The model may propose a candidate fact, preference, state update, or note, but the application should classify, authorize, validate, and route that request to the correct store.
- Propose: identify a candidate item to retain.
- Classify: assign a memory type and scope, such as thread, user, team, tenant, or global.
- Authorize: verify that the acting user, service, and tenant may write that category.
- Validate: enforce schema rules, allowed values, freshness expectations, and source references.
- Persist: write through the repository responsible for that memory class, recording actor, time, version, and retention policy.
- Audit: emit records for consequential accepted or rejected write attempts.
This prevents an assistant from turning an ambiguous statement into a persistent rule. The model can surface an observation, while an explicit user action or governed workflow decides whether it becomes a preference or business record.
Reflect the design in Java services
Use interfaces that make memory responsibilities visible. A TaskStateRepository should have a different contract from a PreferenceRepository. A KnowledgeRetriever should return provenance-bearing passages, not write user data. A system-of-record client should retrieve or mutate data only through the owning application’s authorized API.
Spring AI’s advisor model provides an integration pattern for composing cross-cutting request behavior, including chat-memory and vector-store concerns. Spring AI Advisors reference Adapt that separation so retrieval, context assembly, policy enforcement, tool execution, and observability remain independently testable.
A request flow can be organized as follows:
- Authenticate the caller and establish tenant and role context.
- Load bounded task state and explicit preferences.
- Retrieve only documents authorized for that scope.
- Assemble current-state fields and retrieved material with source identifiers.
- Use structured tool requests for authoritative lookups and mutations.
- Validate and execute tool requests server-side, checkpoint task state, and emit audit events.
- Return an answer that distinguishes retrieved guidance from live system results.
Vector databases remain valuable in this design. Their focused responsibility is finding semantically relevant content from an approved corpus, rather than serving as a universal source of memory.
Plan for correction, expiry, and deletion
Durable does not mean permanent. Each memory class needs lifecycle rules. Preferences need a correction path. Task state needs expiry and reconciliation. Semantic indexes need updates when their source documents change or are removed. Audit records need retention rules defined with the relevant security, privacy, and legal stakeholders.
Keep source references where possible instead of retaining only generated summaries. A reference can support refresh, access re-evaluation, and traceability when the source changes. MemGPT’s tiered model supports the broader design principle that not all context belongs in one storage tier or in active model context. MemGPT: Towards LLMs as Operating Systems
Deletion procedures should account for derived retrieval data. When a source document is revoked, the application should handle associated indexed and cached representations according to its retention and access policies.
Implementation checklist
- Define memory categories before choosing storage products.
- Assign an owner and source-of-truth rule to every category.
- Apply tenant, user, role, and document-level scope metadata where applicable.
- Keep task state structured, versioned, and recoverable.
- Require explicit confirmation or governed rules for durable preferences.
- Use vector retrieval for relevance, with provenance and access filtering.
- Read consequential business facts from their owning systems.
- Record tool calls, approvals, policy outcomes, and state transitions in audit history.
- Define retention, expiry, correction, and deletion behavior for each memory type.
- Test interrupted workflows, permission changes, stale documents, retries, and conflicting updates.
FAQ
Can a vector database store all assistant memory?
It can store searchable representations of many kinds of content, but it should not be the universal source of truth. Transactional state, explicit preferences, live business data, and audit evidence need their own contracts, write controls, and lifecycle handling.
What should an internal assistant remember across conversations?
Retain explicit, useful preferences and approved long-term information only when they have a clear owner, scope, and correction path. Keep workflow state for the duration required by the task, and obtain operational facts from authoritative source systems.
How is chat history different from task state?
Chat history records what was said. Task state records the validated status of work. Conversation may express intent, while task state should identify whether the relevant action completed, was rejected, or is awaiting approval.
What is a minimum starting architecture?
Start with bounded thread context, a structured task-state store, an explicit preference profile, an access-filtered retrieval layer, and an audit log. Add storage technologies when a specific memory class requires a capability those components do not provide.
Sources
- MemGPT: Towards LLMs as Operating Systems
- LangGraph Concepts: Short-Term Checkpointing and Long-Term Memory Stores
- Spring AI Reference Documentation: Advisors and Chat Memory Architecture
- AWS: Building Context-Aware Generative AI Agents
- Semantic Kernel Architecture: Enterprise Context and Agent Memory Management
- Durable Memory: Why Vector Databases Aren’t Enough
Editorial note: AI assisted with research and drafting. Sources were selected for verification.
Full-Stack Developer & Solutions Architect · Casablanca, Morocco
7+ years building Java/Spring Boot/Angular enterprise solutions. Former Senior Software Engineer at NTT Data and Satec. Authorized Google Workspace and Microsoft 365 Partner for Morocco.