# What Information Is Stored in the L3 Memory Layer of TencentDB Agent Memory?

> Discover what the L3 memory layer stores in TencentDB Agent Memory. Learn about long-term persona profiles, user preferences, habits, and identity for instant context bootstrapping.

- Repository: [Tencent Cloud/TencentDB-Agent-Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory)
- Tags: deep-dive
- Published: 2026-08-24

---

**The L3 memory layer stores long-term persona profiles containing stable user preferences, habits, high-level cognition, and enduring identity characteristics that enable agents to bootstrap context instantly without re-processing raw conversation history.**

The TencentDB Agent Memory system organizes knowledge into four progressive layers (L0–L3), with the L3 layer serving as the permanent **Core/Persona** storage. As implemented in the [TencentCloud/TencentDB-Agent-Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory) repository, this layer captures distilled identity profiles that persist across sessions, allowing AI agents to maintain consistent personality awareness and quickly enter context without retrieving granular conversation atoms.

## Core Contents of the L3 Memory Layer

The L3 layer functions as the final output of an asynchronous memory pipeline that refines raw data into actionable identity constructs.

### Stable Patterns and Preferences

At this layer, the system stores **stable patterns** derived from long-term observation, including personal preferences, recurring habits, and high-level cognitive tendencies. Unlike transient conversation atoms stored in L0 or L1, these patterns represent enduring characteristics that change infrequently and define how an agent should interact with a specific user or team.

### Long-Term Persona Profiles

The primary storage format is a **long-term profile** (persona) that summarizes a user’s identity, professional role, and overarching goals. According to the layer table in [`README.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/README.md), these personas capture the essential identity information needed for contextual continuity. The profiles are physically stored as JSON or Markdown files (conventionally named [`persona.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/persona.md)) and indexed in the vector database for retrieval.

### High-Level Contextual Knowledge

L3 contains **high-level knowledge** that enables an agent to "quickly enter" a context without re-reading all raw conversations from L0 or scenario summaries from L2. This distilled information acts as a cognitive shortcut, allowing the system to inject relevant background directly into the system prompt when a session begins.

## Technical Implementation and Storage Architecture

Understanding the physical storage and access patterns of the L3 layer is critical for effective integration.

### Persistence and File Structure

The L3 persona persists as a structured file (JSON or Markdown) stored alongside vector embeddings. Key characteristics include:

- **Scope**: Team-wide and agent-specific; critically, it does **not** depend on a `session_id`, making it truly cross-session
- **Storage Format**: JSON/Markdown persona files alongside vector store indices
- **Synchronization**: Handled by [`MemoryCore/src/core/profile/profile-sync.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/src/core/profile/profile-sync.ts), which manages synchronization between local storage and the remote vector database

### System Prompt Injection

Unlike lower layers that may require tool calls or retrieval-augmented generation, the L3 persona is injected directly into the system prompt. The implementation in [`MemoryProxy/src/injection/injectors/tdai-profile-memory-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryProxy/src/injection/injectors/tdai-profile-memory-injector.ts) demonstrates how this content is automatically prepended to agent instructions, ensuring immediate contextual awareness without runtime retrieval latency.

### Pipeline Generation

The persona file ([`persona.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/persona.md)) is generated asynchronously by [`MemoryCore/src/core/persona/persona-generator.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/src/core/persona/persona-generator.ts), which distills raw conversations (L0) into atoms (L1), scenarios (L2), and finally into the consolidated persona (L3).

## How to Access and Modify L3 Memory Programmatically

Developers interact with the L3 layer through the `memory-core` SDK using the `readCore()` and `writeCore()` methods. Notably, initialization for L3 operations requires only `teamId` and `agentId`, with `sessionId` explicitly omitted.

### TypeScript SDK Example

```typescript
import { MemoryClient } from '@tencentdb-agent-memory/memory-core';

// Initialise client – L3 does NOT require a session_id
const client = new MemoryClient({
  teamId: 'my-team',
  agentId: 'my-agent',
  userId: 'user-123',          // optional – ties persona to specific user
});

// Read the L3 persona (core memory)
const persona = await client.readCore();
console.log('L3 Persona:', persona);

// Update the L3 persona
await client.writeCore({
  content: `User prefers TypeScript, works on fintech projects, enjoys concise prompts.`,
});

```

### Python SDK Example

```python
from tencentdb_agent_memory.memory_core import MemoryClient

# Initialise client – no session_id needed for L3

client = MemoryClient(
    team_id="my-team",
    agent_id="my-agent",
    user_id="user-123",   # optional

)

# Read the persona (L3 core)

persona = client.read_core()
print("L3 Persona:", persona)

# Write / replace the persona

client.write_core(
    content=(
        "User is a data-science lead, prefers Python, "
        "values reproducible pipelines, and enjoys quick iterations."
    )
)

```

### Alternative Editing Methods

Beyond SDK calls, operators can edit L3 content through the **Memory Hub UI** panel, providing a no-code interface for persona management.

## L3 Memory vs. Other Layers

While L0 (raw conversations) and L1 (memory atoms) provide granular factual recall, and L2 (scenarios) offers recent contextual summaries, **L3 serves as the permanent identity layer**. When precise facts are required, the system falls back to L1/L0 retrieval, but for personality consistency and rapid context bootstrapping, L3 provides the essential high-level profile.

## Summary

- The L3 layer stores **long-term persona profiles** containing stable preferences, habits, and identity characteristics distilled from conversation history.
- Content persists as **[`persona.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/persona.md)** files and vector embeddings, independent of session state.
- Access requires **no `session_id`**; use `readCore()` and `writeCore()` via the TypeScript or Python SDKs.
- The system injects L3 content **directly into system prompts** through [`tdai-profile-memory-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-profile-memory-injector.ts) for zero-latency context retrieval.
- Personas are generated via an **async pipeline** (L0→L1→L2→L3) implemented in [`persona-generator.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/persona-generator.ts).

## Frequently Asked Questions

### How does L3 memory differ from L2 memory?

L2 (Scenario) memory contains recent contextual summaries tied to specific interaction patterns, while L3 (Core) stores enduring persona traits that persist indefinitely. L2 provides "what happened recently" context, whereas L3 provides "who is this user" identity anchoring.

### Is a session ID required to access L3 memory?

**No**. Unlike L0 and L1 layers that require a `session_id` for retrieval, the L3 layer is designed for cross-session persistence. Initialization only requires `teamId` and `agentId`, making it accessible before any specific conversation begins.

### How is the L3 persona generated from raw conversations?

The system employs an asynchronous pipeline implemented in [`MemoryCore/src/core/persona/persona-generator.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/src/core/persona/persona-generator.ts) that progressively distills data: raw conversations (L0) are processed into discrete atoms (L1), aggregated into scenarios (L2), and finally consolidated into the enduring persona profile stored in L3.

### Can developers programmatically overwrite the L3 persona?

**Yes**. While the system auto-generates personas through the pipeline, developers can explicitly write or update L3 content using the `writeCore()` method in the SDK (available in both TypeScript and Python) or through the Memory Hub UI panel for manual adjustments.