What is Context0

Updated at:

Context0 is a full-lifecycle context management service for AI agents, covering context writing, distillation, retrieval, assembly, and evolution. Context0 is fully compatible with the Mem0 API and provides three built-in core capabilities: long-term memory, knowledge base, and context assembly. No additional vector databases, graph databases, or RAG pipelines are required.

Note

Context0 is currently in public preview. If you have any requirements, submit a ticket to contact us.

Overview

Context0 provides three core capabilities:

  • Long-term memory: Fully compatible with the Mem0 API for zero-modification migration. A three-layer memory distillation pipeline (raw conversations → atomic facts → entity profiles) and a hybrid retrieval mechanism support cross-session memory persistence, improving retrieval accuracy and context relevance.

  • Knowledge base: Enterprise documents are indexed upon upload. RAG retrieval, Wiki knowledge distillation, and knowledge graphs enable multiple retrieval methods for the same knowledge.

  • Context assembly: Two core APIs (ingest for writing + assemble for assembly) curate memory, knowledge, and conversation history within a specified token budget, returning structured content that can be directly appended to prompts.

Vector database selection, retrieval fusion, summary compression, multi-tenant isolation, offline evolution, and governance auditing are all built-in capabilities. No third-party middleware is required.

Capability overview

Covering the full context lifecycle of writing → distillation → retrieval → assembly → evolution, Context0 provides the following built-in capabilities, eliminating the need to build your own vector databases, graph databases, RAG pipelines, and memory frameworks.

1787185805405-c5442ab0-3990-477b-b840-885d3cf1a096

These capabilities fall into four categories:

Category

Capabilities

Problem solved

Memory and distillation

Three-layer long-term memory, memory promotion, Dream nighttime evolution, and context compression

Enables agents to retain memory across sessions and better understand users over time

Retrieval and assembly

Hybrid intelligent retrieval, context assembly, and configurable strategies

Curates the most relevant context within a token budget

Knowledge and multimodal

Knowledge base RAG, knowledge graphs, and multimodal support

Ingest enterprise knowledge once and use it in multiple ways

Enterprise governance

Multi-tenant isolation, observability, and compliance

Production-grade security, isolation, and governance out of the box

Note

For details on how to use and configure each capability, see User Guide.

Benefits

Benefit

Description

Mem0 compatible, ready to use out of the box

Fully compatible with the Mem0 API, enabling zero-modification migration for existing agents. Three-layer memory distillation and hybrid retrieval deliver higher retrieval accuracy and context relevance.

Two APIs cover the entire pipeline

The ingest and assemble APIs handle the entire pipeline of writing, distillation, retrieval, and assembly, replacing the need to build your own combination of vector databases, graph databases, RAG pipelines, and memory frameworks.

Precise and controllable token budget

A single token_budget parameter allows the server to automatically allocate tokens by importance. The budget is never exceeded, and LLM costs are predictable.

Memory automatically distills into knowledge

High-value memories are automatically distilled into knowledge base documents or reusable skills, forming a continuous evolution loop of memory → knowledge → skill. Agents become smarter with use.

Hybrid retrieval

Vector, BM25, and graph retrieval run in parallel, with RRF fusion and rerank refinement. Complex queries use the agentic deep mode to support multi-hop queries.

Multiple agents share a single profile

Multiple agents within the same workspace share memory and user profiles, enabling seamless service handoff without requiring users to repeat their context.

Switch strategies without code changes

Five preset strategies and six configurable parameters allow the same memory to produce different context for different scenarios. Configuration changes adapt the system to various business requirements without code modifications.

Enterprise-grade security and isolation

Workspace-level physical isolation, three-tier API key permissions, audit logs, quota throttling, and GDPR-compliant data export are all built-in. No additional security components are required.

Asynchronous writing without blocking conversations

The ingest API returns within P99 < 200ms. Distillation and evolution run asynchronously in the background without affecting agent response latency.

Architecture

1787185820300-b1c7e97c-d952-42c9-8691-a93023946b23

Context0 is a stateless backend service that can be horizontally scaled. Writing and distillation are decoupled through asynchronous event-driven architecture (event queue and background evolution processors), ensuring that writes return immediately while distillation runs in the background.

Storage layer

Storage

Content

PolarDB-X

Metadata, authentication, event queues, quotas, and auditing

PolarDB-X Intelligent search (Search engine)

Vector, full-text, and relational indexes for memory, knowledge, and graphs

OSS

Multimodal originals and large files

Dual-port isolation

Context0 uses a dual-port architecture with physical isolation between the data plane and the management plane. This is a core security and separation design:

Plane

Default port

Purpose

Data plane

:4040

Used by AI agents to call all business APIs (ingest, assemble, memory, and knowledge)

Management plane

:4041

Operations, console, auditing, and other management tasks. Isolated from business traffic.

Three-layer memory model

Long-term memory is not a flat table. Instead, it is organized as a three-layer progressive distillation structure.

1787185829071-e6753e37-2235-4b0f-add1-c27530abc4ae

Layer

Description

Features

Example

L2 raw conversations

Complete conversation records

Immutable and permanently retained for tracing and auditing

Verbatim messages between users and agents

L1 atomic facts

Facts extracted from conversations by the LLM

Tagged with confidence scores and time windows (valid_at) to support fast retrieval

"User prefers TypeScript", "Target memory < 50MB"

L0 entity profiles

Structured profile cards (approximately 150 tokens)

Aggregatable and evolvable, supporting relationship graphs

{type: person, name: Alex, preferences: [literature, handicrafts]}

Traceability

Each L1 fact carries a source_episode_id that points back to L2. Each L0 profile is aggregated from a set of L1 facts. The LLM can respond using the condensed L0 profiles without reading through thousands of conversations. When verification is needed, the system can trace back to the original messages.

Token economy example

A user has approximately 1,000 messages over 30 days (approximately 30K tokens). Context0 applies two rounds of distillation:

  • 1,000 raw conversation messages (30K tokens).

  • After the first distillation, 50 L1 atomic facts are produced (approximately 30 tokens each, totaling 1.5K tokens).

  • After the second distillation, 5 L0 entity profile cards are produced (approximately 150 tokens each, totaling 0.75K tokens).

If only L0 profiles are fed to the LLM, 30K tokens can be compressed to 0.75K. Structured profiles have higher information density than scattered raw conversations, which helps improve LLM comprehension and reasoning.

Context asset types

Context0 manages three types of core context assets, assembled through a unified assemble API.

Long-term memory (Memory)

Facts, preferences, decisions, and user profiles accumulated across sessions, organized as the three-layer memory model. Features:

  • Asynchronous distillation. Writes return within P99 < 200ms without blocking conversations.

  • Retrieval supports three scopes: session, user, and workspace.

  • Supports memory pinning (pin), invalidation marking (invalidate), and scope promotion (promote).

  • Dream nighttime evolution: automatically decays outdated preferences, detects contradictory memories, and consolidates entity profiles.

Knowledge base (Knowledge)

Unified management of enterprise documents, manuals, runbooks, and RAG corpora. Unlike a standard vector database, the Context0 knowledge base provides four capabilities:

Capability

Description

RAG retrieval

Documents are automatically parsed upon upload with two-level chunking (small chunks for precise matching and large chunks for context backfill), vectorized, and indexed. Vector, BM25, and rerank retrieval are fused.

Wiki knowledge distillation

Automatically discovers high-value memory clusters and enables agents to synthesize Markdown knowledge documents, forming an evolution loop where knowledge accumulates and the knowledge base grows organically.

Knowledge graph

Optionally enables entity relationship graph indexes to support multi-hop relationship retrieval.

Content review

Memory promotion to knowledge requires manual review before being ingested, ensuring knowledge quality.

Supports multiple formats including PDF, Markdown, Word, Excel, PPT, RTF, EPUB, images, and audio. Updated documents are automatically re-chunked and re-embedded incrementally.

Skill

Hosts skill definitions and tool contexts that agents can invoke, assembled together with memory and knowledge into the context window.

Core concepts

Understanding the following concepts is fundamental to using Context0.

Concept

Definition

Workspace

The top-level tenant isolation unit. Indexes are physically partitioned by workspace, and data across workspaces is completely invisible to each other.

Member

A member identity within a workspace (typically corresponding to an agent). Multiple members within the same workspace can share memory.

User ID

The end-user identifier within an application (such as a customer or a developer). Used only in the memory domain to isolate profiles by user.

API Key

Three permission levels: ADMIN (management plane), OWNER (workspace owner), and USER (bound to an end user). Identity is injected on the server side and cannot be forged by clients.

Session

A session that carries a continuous stream of conversation messages. The ingest API writes data by session_id.

Strategy

Retrieval and assembly strategies. Five presets are provided: chat, coding, rag-only, agent, and custom. Six configurable parameters allow strategy switching without code changes.

Note

Tenant isolation anchor: (workspace_id, member_id) is the core anchor for isolation. user_id is used only within the memory domain to distinguish end users.

Use cases

Use case

Typical usage

Recommended strategy

AI coding assistant

Remembers developer technical preferences and project decisions for instant session recovery. Code semantic retrieval uses the knowledge base.

coding preset

Intelligent customer service and sales assistant

Remembers user profiles and historical decisions. Multiple agents share user_id profiles during service handoff.

chat preset

Enterprise knowledge base RAG

Policy documents, manuals, and runbooks are available for Q&A upon upload. Pure retrieval without memory extraction.

rag-only preset

Multi-agent collaboration

Different members within the same workspace share the memory store, enabling seamless handoff from reception to technical support to escalation.

agent preset

For detailed integration and configuration for each use case, see Common scenarios.

Public preview notes

Context0 is currently in public preview. During the public preview period:

  • The full data plane (ingest, assemble, memory, and knowledge) and management plane (console, auditing, and quotas) capabilities are available.

  • We recommend that you verify strategy effectiveness and retrieval quality in a test workspace before production integration.

  • Memory and knowledge data can be exported. No vendor lock-in risk exists.

If you have any requirements, submit a ticket to contact us.