Cognitive Memory Agent: Building Stateful AI Agents with Multi-Layer Memory Architecture

linkedin · Tech · 2026 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.5 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Stateful memory infrastructure for recruiter-facing AI agents

LinkedIn needed Hiring Assistant and future agents to remember recruiter context, infer preferences, and improve over time without leaking tenant/user data or exceeding latency and context limits.

Constraints:

Architecture

LinkedIn built Cognitive Memory Agent as a horizontal memory platform for stateful agents. CMA exposes conversational, episodic, semantic, and procedural memory layers as tools; ingests user activity through streaming and batch pipelines; stores raw and aggregated preferences with ownership metadata; and uses an LLM-powered retrieval orchestrator to plan across memory providers, synthesize context, and personalize Hiring Assistant responses.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  application-agent["application agent"] --> cma-ingestion-api["CMA ingestion API"]
  application-agent --> cma-retrieval-api["CMA retrieval API"]
  application-agent --> business-context-and-tool-descriptions["business context and tool descriptions"]
  cma-ingestion-api --> streaming-ingestion-pipeline["streaming ingestion pipeline"]
  cma-ingestion-api --> batch-ingestion-pipeline["batch ingestion pipeline"]
  streaming-ingestion-pipeline --> conversational-memory["conversational memory"]
  streaming-ingestion-pipeline --> episodic-memory["episodic memory"]
  batch-ingestion-pipeline --> semantic-memory["semantic memory"]
  batch-ingestion-pipeline --> hierarchical-semantic-index["hierarchical semantic index"]
  hierarchical-semantic-index --> semantic-memory
  cma-retrieval-api --> access-control-layer["access-control layer"]
  cma-retrieval-api --> retrieval-orchestrator["retrieval orchestrator"]
  business-context-and-tool-descriptions --> retrieval-orchestrator
  retrieval-orchestrator --> conversational-memory
  retrieval-orchestrator --> episodic-memory
  retrieval-orchestrator --> semantic-memory
  retrieval-orchestrator --> procedural-memory["procedural memory"]
  access-control-layer --> conversational-memory
  access-control-layer --> episodic-memory
  access-control-layer --> semantic-memory
  evaluation-framework["evaluation framework"] --> retrieval-orchestrator
  evaluation-framework --> semantic-memory
  evaluation-framework --> application-agent
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
application agent Product-facing agent such as Hiring Assistant that sends activity data and retrieval queries to CMA. CMA ingestion API, CMA retrieval API, business context and tool descriptions
CMA ingestion API Accepts user activity and conversations from applications for memory indexing. application agent, streaming ingestion pipeline, batch ingestion pipeline
streaming ingestion pipeline Handles latency-sensitive conversational summarization and episodic memory ingestion. CMA ingestion API, conversational memory, episodic memory
batch ingestion pipeline Runs compute-intensive semantic-memory extraction and hierarchical aggregation. CMA ingestion API, semantic memory, hierarchical semantic index
conversational memory Stores chronological dialogue turns, embeddings, and compressed conversation summaries. streaming ingestion pipeline, retrieval orchestrator
episodic memory Stores timestamped activity traces and recent events with context. streaming ingestion pipeline, retrieval orchestrator
semantic memory Stores generalized preferences and facts derived from repeated interactions. batch ingestion pipeline, hierarchical semantic index, retrieval orchestrator
procedural memory Captures user-specific workflow patterns and memory-tool choices. retrieval orchestrator
hierarchical semantic index Organizes activity-derived Q&A pairs, summaries, and facets into a tree-like structure for scalable retrieval. batch ingestion pipeline, semantic memory
CMA retrieval API Receives natural-language queries and metadata from application agents. application agent, retrieval orchestrator, access-control layer
retrieval orchestrator LLM-powered planner that chooses memory tools, refines queries, and synthesizes responses across memory layers. CMA retrieval API, conversational memory, episodic memory, semantic memory, procedural memory
access-control layer Enforces application isolation, ownership metadata, logged-in-user restrictions, and tenant boundaries. CMA retrieval API, conversational memory, episodic memory, semantic memory
evaluation framework Measures memory representation quality, query-context-answer alignment, and task success. retrieval orchestrator, semantic memory, application agent
business context and tool descriptions Application-provided context, hooks, and tool descriptions that customize generic CMA tools to a product domain. application agent, retrieval orchestrator

Data flow

Application agents ingest user activity and conversation data into CMA. Streaming paths summarize conversations and extract episodic activity for low-latency freshness, while batch paths aggregate semantic memory with hierarchical summaries, Q&A pairs, and facets. At serving time an application sends a natural-language query and memory metadata to the retrieval API; the orchestrator selects conversational, episodic, semantic, or procedural tools, refines intermediate queries when needed, and synthesizes a response constrained by per-application, per-user memory access controls.

3 supporting quotes
“Raw user activity and conversation data must be indexed into various memory formats before being stored, enhancing retrieval efficiency.”article, stated
“The CMA orchestrator receives the natural language query, relevant memory keys, and the available memory tools. It then generates a retrieval plan.”article, stated
“The application agent can query CMA using retrieval API and pass natural language query and relevant meta-data as arguments.”article, stated

Why this architecture

LinkedIn treats memory as infrastructure rather than incidental prompt context because stateful personalization requires durable layered stores, asynchronous ingestion, access controls, and a planner that can decide where to look and how to reconcile memory signals.

3 supporting quotes
“Memory stops being incidental context and becomes a first-class primitive with explicit read/write semantics and lifecycle management.”article, stated
“Rather than assuming that all relevant context lives in one store, the orchestrator determines where to look, in what order, and how to reconcile signals across stores.”article, stated
“Large language models provide powerful reasoning primitives but without memory, they remain stateless. Without domain grounding, they lack context. Without infrastructure, they cannot improve over time. Delivering a truly agentic experience requires weaving”article, stated

Models used: open-source LLM hosted on LinkedIn internal infrastructure · LLM calls for memory extraction and summarization · embeddings in vector store · SFT and RL planned for orchestrator improvement

Scale

Alternatives considered (roads not taken)

Traditional user-specified memory

Rejected because: It requires users to explicitly say what to remember, while CMA stores and retrieves contextual information automatically.

“Traditional memory systems require users to explicitly specify what they want an agent to remember. By contrast, CMA intelligently stores and retrieves contextually relevant information.”article, stated

Experiential memory as a bare hierarchical key-value store

Rejected because: It lacked intelligence, leaving each application to build extraction, indexing, storage, and retrieval logic manually.

“applications could use to store and retrieve preferences. The limitation was that this was just systems infrastructure with no intelligence. Each application had to handle preference extraction, determine how to index it, and then use the provided read/write APIs for storage and retrieval. This made”article, stated
“Each application had to handle preference extraction, determine how to index it, and then use the provided read/write APIs for storage and retrieval.”article, stated

Simple embed-query-retrieve-synthesize RAG

Rejected because: Static retrieval breaks down when memory is layered, heterogeneous, and continuously evolving.

“Traditional retrieval pipelines treat memory as a static corpus. They embed the query, retrieve the top-k results, append them to the prompt, and let the LLM synthesize an answer.”article, stated
“this approach breaks down when memory is layered, heterogeneous, and continuously evolving, as is the case in CMA.”article, stated

GraphRAG or flattened RAG for semantic memory aggregation

Rejected because: LinkedIn chose a hierarchy to reduce edge-determination LLM calls and avoid feeding all leaf nodes into context at once.

“offers several advantages over existing methods like GraphRAG and flattened RAG. By leveraging the natural hierarchy of data, we reduce the need for numerous LLM calls to determine edges, enhancing overall efficiency of memory construction. This also”article, stated
“we reduce the need for numerous LLM calls to determine edges, enhancing overall efficiency of memory construction.”article, stated

One memory store for all applications or users

Rejected because: The access-control design isolates each application and enforces no data sharing across tenants or users.

“Each application operates within its isolated memory store, ensuring that data specific to an application remains confined and protected.”article, stated
“No data sharing across tenants/users: Data sharing restrictions are strictly enforced, ensuring no unauthorized access across different tenants and users (In the Hiring Assistant for example, the memory is per recruiter and per customer tenant). This is”article, stated

Patterns

agent-memory (memory)

CMA provides conversational, episodic, semantic, and procedural memory layers so agents can remember interactions, preferences, events, and workflows across sessions.

“CMA maintains multiple types of memory, each with different semantics, latency characteristics, and abstraction levels.”article, stated
“Together, episodic, semantic and procedural memory enable an agent to move from session-level coherence to longitudinal intelligence.”article, stated

tool-use-orchestration (orchestration)

The retrieval orchestrator treats memory providers as tools and plans which providers to call for each query.

“It also uses reasoning and planning over memory tools to generate contextually relevant responses.”article, stated
“For more complex questions, the orchestrator may sequentially invoke multiple memory providers, refine intermediate queries, and synthesize results across layers”article, stated

context-compaction (context-management)

Conversational memory periodically summarizes dialogue so future turns can retrieve relevant history without exceeding context windows.

“Past dialogues are summarized periodically to achieve context compression.”article, stated
“preventing overly long conversations that exceed retrieval agents' context limits.”article, stated

batch-offline-processing (data-processing)

CMA separates latency-sensitive streaming memory updates from batch semantic-memory aggregation and incremental updates.

“we perform asynchronous indexing to avoid disrupting online interactions. For this, we offer two pathways: streaming and batch.”article, stated
“Batch processing is employed for computation-intensive tasks, like extracting and aggregating semantic memory nodes.”article, stated

privacy-preserving-processing (security)

CMA isolates application stores, tags ownership metadata, restricts access to logged-in sessions, and prevents tenant/user data sharing.

“Each application operates within its isolated memory store, ensuring that data specific to an application remains confined and protected.”article, stated
“* User session restriction: Memory access is strictly limited to the logged-in user. This restriction helps ensure that data access is secure and confined to authorized user contexts.”article, stated

eval-driven-development (evaluation)

LinkedIn evaluates CMA through a three-tier framework for memory correctness, retrieval/answer alignment, and task success.

“we use a three-tiered quality evaluation framework. It measures memory representation correctness, query–context–answer alignment, and task-success rate.”article, stated

llm-as-judge (evaluation)

Tier-2 evaluation uses an LLM judge to assess orchestrator response quality and grounding.

“Tier-2 metrics measure CMA’s response quality using llm-as-judge.”article, stated
“whether the response is grounded in the retrieved memories and not hallucinated”article, stated

retrieval-ranking (retrieval)

The orchestrator ranks and combines relevant memory layers through a retrieval plan instead of retrieving from one static index.

“the orchestrator determines where to look, in what order, and how to reconcile signals across stores.”article, stated

Tradeoffs

Use a layered cognitive memory architecture.

Chose Separate conversational, episodic, semantic, and procedural memory stores over One generic memory store.

Rationale: Different memory types have different semantics, latency needs, and abstraction levels, so one store cannot represent all useful agent memory equally well.

“CMA maintains multiple types of memory, each with different semantics, latency characteristics, and abstraction levels.”article, stated
“Long-term memory is organized into three sub-categories that mirror cognitive models”article, stated

Split ingestion between streaming and batch.

Chose Streaming for conversational/episodic freshness and batch for semantic aggregation over One synchronous indexing path.

Rationale: The split keeps online interactions responsive while allowing heavier semantic extraction and aggregation to run asynchronously.

3 supporting quotes
“To optimize retrieval latency, we offload data processing to the ingestion phase.”article, stated
“Diagram of asynchronous processing Streaming processing handles latency-sensitive tasks, such as conversational memory summarization, preventing overly long conversations that exceed retrieval agents' context limits.”article, stated
“Batch processing is employed for computation-intensive tasks, like extracting and aggregating semantic memory nodes.”article, stated

Use hierarchical semantic memory indexing.

Chose Tree-like aggregation of Q&A pairs, summaries, and facets over GraphRAG or flattened RAG.

Rationale: The hierarchy reduces LLM edge construction, avoids feeding all leaf nodes to the LLM, and supports parallel batch updates.

“By leveraging the natural hierarchy of data, we reduce the need for numerous LLM calls to determine edges”article, stated
“The tree-like structure allows full parallel processing at each layer, making it well suited for batch workloads.”article, stated

Couple planning, memory tool calls, and answer generation in one orchestrator loop.

Chose An internal open-source LLM orchestrator with unified reasoning over Separate retrieval planner and answer synthesizer services.

Rationale: LinkedIn says tight integration simplifies the system and keeps retrieval reasoning connected to answer synthesis.

3 supporting quotes
“The orchestrator is currently powered by an open-source LLM hosted on LinkedIn’s internal infrastructure.”article, stated
“It handles planning, memory tool calls, and final response generation within one unified reasoning loop.”article, stated
“This simplifies the system design and keeps retrieval reasoning tightly integrated with answer synthesis.”article, stated

Keep application-specific context outside the generic CMA core.

Chose Generic CMA tools customized by business context, tool descriptions, hooks, embeddings, or fine-tuned models over Hard-coding each application into the memory platform.

Rationale: This keeps CMA horizontal while still allowing each application to improve domain-specific retrieval behavior.

“CMA tools are generic, customizations to specific applications are provided via business context and detailed descriptions of memory tools.”article, stated
“Optionally, the application team can provide custom embeddings or fine-tuned models to override the default ones, for EBR.”article, stated

Gotchas (what bit them)

Persistent memory turns prompt context into production state.

Root cause: Once agent state persists across steps, memory must handle lifecycle, read/write semantics, consistency, latency, isolation, privacy, compaction, and observability.

Resolution: Treat memory as a first-class platform primitive with explicit layers, access controls, and lifecycle management.

“Once a state persists across steps, a well-architected memory system must handle consistency, latency, storage and access patterns, isolation, privacy, compaction, and observability.”article, stated
“Memory stops being incidental context and becomes a first-class primitive with explicit read/write semantics and lifecycle management.”article, stated

Bare key-value memory does not create reusable agent intelligence.

Root cause: The original experiential memory layer provided storage APIs but made each application implement extraction, indexing, storage, and retrieval manually.

Resolution: Add dynamic extraction and synthesis so memory prompts can mine implicit preferences into structured records.

“The limitation was that this was just systems infrastructure with no intelligence. Each application had to handle preference extraction, determine how to index it, and then use the provided read/write APIs for storage and retrieval.”article, stated
“we enhanced long-term memory to dynamically extract and synthesize implicit preferences.”article, stated

Episodic memory extraction is easy to over- or under-segment.

Root cause: Events overlap, interleave, become stale, or conflict, and the memory must capture enough detail without overfitting.

Resolution: Model episodic memory as timestamped contextual records and explicitly account for boundaries, staleness, conflict resolution, and context association.

“The obvious challenge in extracting this memory is correctly identifying episode boundaries, staleness and conflict resolution.”article, stated
“capturing just enough details to make the episode useful for the future without overfitting.”article, stated

Static RAG breaks down over layered evolving memory.

Root cause: A single search operation cannot determine which memory layer is relevant or coordinate signals across heterogeneous stores.

Resolution: Use a lightweight agentic orchestrator that plans memory-provider calls and synthesizes across layers.

“A single search operation cannot reliably determine which layer is relevant for a given query, nor can it coordinate interactions across them.”article, stated
“Retrieval, in this case, becomes a multi-step reasoning process rather than a one-shot search.”article, stated

Memory can make an agent worse if persisted facts are wrong or stale.

Root cause: Incorrect memory can increase friction, cost, latency, and hallucinated or stale responses.

Resolution: Evaluate representation correctness, retrieval alignment, task success, latency, planning steps, token usage, and ingestion LLM calls.

“Memory can make an agent helpful over time, but it also has the potential to introduce user friction, higher cost and latency if persisted information in memory layers is incorrect”article, stated
“Specifically, we monitor response latency, number of reasoning tokens and planning steps generated by the orchestrator and lastly token usage and LLM calls during ingestion.”article, stated

Memory systems create data-leakage risk across products, users, and tenants.

Root cause: Shared memory without ownership metadata and session restrictions could expose one user's or tenant's data to another.

Resolution: Isolate memory stores, tag ownership metadata, restrict access to logged-in users, and enforce no cross-tenant/user sharing.

“proper setup of memory WRITE/READ permissions is crucial. This ensures effective memory sharing while preventing data leaks.”article, stated
“Data sharing restrictions are strictly enforced, ensuring no unauthorized access across different tenants and users”article, stated

Evaluation

LinkedIn evaluates CMA with a three-tier framework covering memory representation correctness and coverage, query-context-answer alignment via LLM-as-judge, and end-to-end product task success, while also tracking latency, reasoning tokens, planning steps, ingestion token usage, and LLM calls.

Metrics: memory representation correctness · memory coverage · retrieved information relevance · response grounding · answer completeness · task success rate · user satisfaction studies · online A/B tests · response latency · reasoning tokens · planning steps · ingestion token usage · LLM calls during ingestion

4 supporting quotes
“we use a three-tiered quality evaluation framework. It measures memory representation correctness, query–context–answer alignment, and task-success rate.”article, stated
“These metrics measure if CMA’s orchestrator retrieves information that is relevant to the user’s query, whether the response is grounded in the retrieved memories and not hallucinated”article, stated
“We specifically look for improvement in (sub) task success rate and reduction in user friction.”article, stated
“we monitor response latency, number of reasoning tokens and planning steps generated by the orchestrator and lastly token usage and LLM calls during ingestion.”article, stated

Outcomes

The article positions CMA as a horizontal memory platform at LinkedIn scale, initially applied to Hiring Assistant after its global English availability in 2025; it does not provide production adoption counts beyond global availability and product use-case descriptions.

4 supporting quotes
“Using CMA, the Hiring Assistant personalizes interactions with recruiters by leveraging past hiring projects and individual recruiter preferences.”article, stated
“CMA is leveraged by the Hiring Assistant to fetch the recruiter's past projects and preferences to suggest a role or title that they can start hiring for.”article, stated
“preference derived from memory using CMA helps recruiters auto-populate information for a new project”article, stated
“the recruiter can get insights about their past hiring projects and activities on those projects.”article, stated