# What Is Stored in the L0 Conversation Layer? Complete Guide to TencentDB Agent Memory

> Discover what the L0 Conversation layer stores in TencentDB Agent Memory. Learn how it preserves complete dialogues, timestamps, and metadata for memory processing.

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

---

**The L0 Conversation layer stores the complete, unaltered dialogue between users and agents, preserving every message's full text, timestamps, session identifiers, and source metadata to serve as the authoritative foundation for all higher-level memory processing.**

The L0 Conversation layer is the lowest-level memory asset in the TencentDB Agent Memory architecture. As implemented in the `TencentCloud/TencentDB-Agent-Memory` repository, this layer captures raw dialogue exactly as it occurs, creating an immutable record that downstream systems use to extract facts, preferences, and long-term profiles. Understanding what resides in this foundational layer is critical for developers building reliable agent systems that require exact audit trails or session-based isolation.

## Core Data Stored in the L0 Conversation Layer

The L0 layer functions as a durable log of raw interaction data. According to the source code in [`sdk/memory-core/typescript/src/v3/types.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/sdk/memory-core/typescript/src/v3/types.ts), this layer persists structured conversation records containing specific metadata fields that enable precise retrieval and verification.

### Raw Message Content and Turn Metadata

Each entry in the L0 Conversation layer captures the **full text of every dialogue turn**, including both user and assistant messages exactly as transmitted. The storage schema defined in `ConversationMessage` interfaces includes:

- **Complete message content** for both directions (user→assistant and assistant→user)
- **Timestamps** marking when each message was generated
- **Message identifiers** that support later operations like search, delete, and count
- **Source information** specifying which team, agent, and user produced the message

This unaltered storage ensures that systems can verify exact wording during audits or reproduce prior exchanges with complete fidelity.

### Session Isolation and Cross-Session Aggregation

The L0 layer implements **session-level isolation** through the `session_id` field, partitioning messages so that long-running dialogues remain grouped and retrievable as discrete units. However, the architecture also supports **cross-session aggregation** when developers omit the `session_id` parameter, enabling analysis across multiple conversation contexts. This dual-mode design appears in the `MemoryClient` implementation within [`sdk/memory-core/typescript/src/v3/client.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/sdk/memory-core/typescript/src/v3/client.ts), where the `sessionId` parameter remains optional in methods like `queryConversation`.

## Why the L0 Layer Matters for Agent Memory

Beyond simple storage, the L0 Conversation layer serves specific architectural purposes that make it indispensable for sophisticated agent systems.

### Authoritative Source for Verification

Because L0 preserves raw dialogue without transformation, it acts as the **single source of truth** for exact wording verification. When higher-level layers (L1 Atom, L2 Scenario, L3 Persona) contain distilled or summarized information, developers can reference the L0 layer to audit the original text, timestamps, and sources that generated those abstractions. This capability proves essential for debugging agent behavior or meeting compliance requirements that demand verbatim record-keeping.

### Foundation for Asynchronous Memory Extraction

Higher-level memory assets derive entirely from L0 data through **asynchronous processing pipelines**. The README.md's "Technical Implementation" section explains that L1 Atom, L2 Scenario, and L3 Persona layers are built by processing raw L0 conversations to extract facts, user preferences, and long-term profiles. Without the comprehensive raw data capture in L0, these derived layers would lack the source material necessary for accurate user modeling and context retention across sessions.

## Working with L0 Conversations in Code

The TypeScript SDK in [`sdk/memory-core/typescript/src/v3/client.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/sdk/memory-core/typescript/src/v3/client.ts) exposes methods for interacting with L0 storage, allowing developers to append, query, and purge conversation data programmatically.

### Adding Conversation Records

Use the `addConversation` method to append raw dialogue to the L0 layer. The following example demonstrates creating a client with session isolation and storing a user-assistant exchange:

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

// Create a client (session_id is optional for cross-session aggregation)
const client = new MemoryClient({ teamId: 'team-1', agentId: 'agent-1', userId: 'user-1' })
  .withIsolation({ sessionId: 'sess-abc' });

// Append a new user-assistant exchange
await client.addConversation({
  messages: [
    { role: 'user', content: 'How do I reset my password?', timestamp: Date.now() },
    { role: 'assistant', content: 'You can reset it via the account page.', timestamp: Date.now() },
  ],
});

```

### Querying Raw Dialogue

Retrieve stored conversations using `queryConversation`, which returns complete message objects including all metadata fields:

```typescript
const result = await client.queryConversation({ limit: 20, sessionId: 'sess-abc' });
console.log(result.total);          // total number of L0 messages
console.log(result.messages[0]);    // first raw message in the session

```

### Deleting Messages and Sessions

The L0 layer supports precise deletion through the `deleteConversation` method, with batch limits enforced at the API level. Delete specific messages by their identifiers:

```typescript
await client.deleteConversation({
  messageIds: ['msg-123', 'msg-124'],   // up to 5,000 IDs per request
});

```

Alternatively, wipe entire sessions in bulk (up to 100 sessions per request):

```typescript
await client.deleteConversation({
  sessionIds: ['sess-abc', 'sess-def'],
});

```

## Implementation Details and Source Files

The L0 Conversation layer implementation spans several key files in the `TencentCloud/TencentDB-Agent-Memory` repository:

- **[`sdk/memory-core/typescript/src/v3/types.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/sdk/memory-core/typescript/src/v3/types.ts)** – Defines TypeScript interfaces including `ConversationMessage` and `AddConversationRequest` that specify the data structure for L0 storage.

- **[`sdk/memory-core/typescript/src/v3/client.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/sdk/memory-core/typescript/src/v3/client.ts)** – Implements the `MemoryClient` class with L0-specific methods: `addConversation`, `queryConversation`, and `deleteConversation`.

- **[`README.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/README.md)** – Contains the "Technical Implementation" section explaining the L0-L3 memory hierarchy and the role of raw conversation storage.

- **[`MemoryCore/v3-api-memorycore-doc.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/v3-api-memorycore-doc.md)** – Documents the formal API contract for `/v3/conversation/*` routes, detailing request parameters and batch operation limits.

These files collectively demonstrate that the L0 Conversation layer operates as an immutable append-only log (with selective deletion capabilities) that anchors the entire memory system architecture.

## Summary

- The **L0 Conversation layer** stores raw, unaltered dialogue with complete message text, timestamps, and source metadata.
- **Session isolation** via `session_id` keeps conversations partitioned, while optional omission enables cross-session aggregation.
- This layer serves as the **authoritative source** for exact wording verification and compliance auditing.
- **Higher-level memory layers** (L1-L3) derive their data through asynchronous pipelines processing L0 records.
- The TypeScript SDK provides methods like `addConversation`, `queryConversation`, and `deleteConversation` to interact with this foundational storage.

## Frequently Asked Questions

### What is the maximum number of messages that can be deleted in a single L0 Conversation API call?

The `deleteConversation` method supports batch operations of up to **5,000 message IDs** per request when deleting specific messages, or up to **100 session IDs** when wiping entire sessions. These limits are enforced in the API implementation documented in [`MemoryCore/v3-api-memorycore-doc.md`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/v3-api-memorycore-doc.md).

### How does the L0 Conversation layer differ from L1, L2, and L3 memory layers?

While L0 stores **raw, verbatim dialogue**, higher layers contain processed abstractions: **L1 Atom** stores extracted facts, **L2 Scenario** maintains contextual preferences, and **L3 Persona** holds long-term user profiles. According to the repository's README, these higher layers are derived from L0 data through asynchronous processing pipelines, making L0 the foundational source for all persistent agent memory.

### Can I query L0 conversations across multiple sessions simultaneously?

Yes. The `MemoryClient` supports **cross-session aggregation** when you omit the `sessionId` parameter in `queryConversation` calls. This design allows developers to analyze conversation patterns across a user's entire history while maintaining the ability to isolate specific sessions when needed, as implemented in [`sdk/memory-core/typescript/src/v3/client.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/sdk/memory-core/typescript/src/v3/client.ts).

### Does the L0 layer modify or summarize message content before storage?

No. The L0 Conversation layer specifically preserves **unaltered, raw dialogue** exactly as transmitted between users and agents. This immutability ensures that systems can verify exact wording and timestamps during audits, and provides the pristine source material required for downstream extraction pipelines to build higher-level memory assets accurately.