RDS ContextDB quick start

Updated at:

RDS ContextDB is an enterprise-grade context database service designed for agents, with rapid integration support for Qoder, QoderWork, Claude Code, Codex, OpenClaw, OpenCode, Hermes, and QwenWork. Instead of focusing solely on static data storage, RDS ContextDB reshapes storage into an efficient, structured, and understandable context supply for Agents, providing unified Context lifecycle management covering multi-source ingestion, refinement and assetization, retrieval and composition, governance and evolution, permission control, and Agent-oriented service supply.

Feature overview

Context management challenges

As Agents evolve from simple conversational tools into intelligent systems capable of continuously executing tasks, the traditional reliance on local sessions and short-term context no longer meets enterprise requirements.

In real-world business scenarios, an Agent must not only understand the current problem but also persistently retain historical task progress, key decision-making processes, multi-Agent collaboration states, long-term project experience, and enterprise knowledge and operational context. Such context is typically scattered across different devices, systems, and Agents, and lacks unified consolidation, sharing, and governance. As a result, Agents cannot build genuine long-term memory or achieve continuous evolution.

RDS ContextDB addresses the issues of scattered storage, difficulty in continuous accumulation, lack of business semantics, and inability to securely reuse and uniformly govern sessions, documents, business data, and execution feedback through the Context Growth Loop closed-loop of "Record — Organize — Recall and Compose — Execution Feedback — Evaluate and Evolve". This continuously improves the quality and reuse value of Context, serving enterprise and Agent application developers building enterprise-grade Agents and multi-Agent collaboration platforms.

Key advantages of RDS ContextDB

RDS ContextDB is an enterprise-grade context database service designed for agents, which supports rapid integration with major platforms such as Qoder, QoderWork, Claude Code, Codex, OpenClaw, OpenCode, Hermes, and QwenWork. It reshapes memory and knowledge management into a context supply that Agents can directly consume. Through unified context storage, collaborative sharing, lifecycle management, and intelligent retrieval, RDS ContextDB helps Agents evolve from single-session memory into system services with long-term memory, sustained collaboration, and experience accumulation.

RDS ContextDB provides the following core capabilities:

  • Ready to use and rapid integration: Supports short-term memory, long-term memory, and knowledge base capabilities. Seamlessly integrates with various Agents through an API Key (including minute-level integration through natural language or CLI, with support for DingTalk and Feishu document sync) for on-demand invocation, delivering a lighter and more flexible architecture.

  • Intelligent context management: Stores context in a structured graph, supporting real-time incremental updates and complex relationship inference. A nightly service evolves the context and resolves redundancy and conflicts.

  • Cross-Agent sharing and enterprise-grade permissions: Permissions are isolated between different workspaces. Context under the same API Key can be shared across multiple Agents. A workspace can enable advanced permission mode to configure fine-grained user access permissions at the knowledge base level.

  • Unified management: Inherits the enterprise-grade high availability, high reliability, and permission isolation of RDS.

Billing

RDS ContextDB uses the pay-as-you-go billing method and charges you based on the amount of resources that you actually use. ContextDB billable items fall into two categories:

  • Memory and knowledge write, retrieval, and evolution fees: fees generated by memory writes/retrievals, knowledge writes/retrievals, context evolution, and other operations that invoke large language models (LLMs) and computing resources. These fees are charged in Credits.

  • Storage fees: fees generated by storing data (including original knowledge documents, memories, and knowledge indexes). These fees are charged based on the amount of storage space used (GB/hour).

Fee category

Billable item

Billable item code

Billing description

Unit price

Memory and knowledge write/retrieval/evolution

Memory write

contextdb_mem_add_requests

Fees generated when you write memories, charged in Credits

CNY 1/Credit

Memory retrieval

contextdb_mem_retrieval

Fees generated when you retrieve memories, charged in Credits

Knowledge write

contextdb_rag_add_requests

Fees generated when you write knowledge (including multimodal knowledge and knowledge graphs), charged in Credits.

Knowledge retrieval

contextdb_rag_retrieval

Fees generated when you retrieve knowledge, charged in Credits

Context evolution

context_growth

Fees generated during memory promotion (including scheduled promotions, such as those for user profiles and project profiles), knowledge review, and knowledge wiki compilation, charged in Credits.

Storage

Source storage space

agent_service_storage

Storage space occupied by original knowledge documents, charged based on usage (GB/hour)

CNY 0.00017/GB/hour

Context storage space

Storage space occupied by memories and knowledge indexes, charged based on usage (GB/hour)

CNY 0.0021/GB/hour

Credits packs can offset the fees generated by memory and knowledge writes, retrievals, and evolution, but cannot offset storage fees:

  • Purchase: Purchase Credits packs on the Credits pack buy page. Available pack options are subject to the buy page.

  • Validity period: Each Credits pack is valid for one month. Unused Credits automatically expire when the pack expires.

  • Unsubscription: Credits packs cannot be unsubscribed.

Note

From 2026-09-20 to 2026-12-31, new ContextDB users who have completed Alibaba Cloud identity verification can claim a free CNY 799 Credits pack after they enable ContextDB. The Credits pack is valid for one month. Each user can participate only once.

Limitations

  • Rapid integration with major platforms: Supports rapid integration with Qoder, QoderWork, Claude Code, Codex, OpenClaw, OpenCode, Hermes, and QwenWork. Other platforms can be integrated through API, MCP, or other methods.

  • Memory sharing: Memories are shared within the same Agent, including across sessions. Memory data export is not supported.

  • Knowledge base: Members within the same workspace can share knowledge base content, enabling cross-Agent business context sharing. You can upload knowledge documents from the console, from the CLI, or through Agent conversations. Knowledge base export is not supported.

  • Memory isolation: Memories are isolated between different members. Memories are not isolated between different API Keys of the same member.

  • RAM user limit: If you access the ContextDB console as a RAM user, the Alibaba Cloud account must first enable ContextDB and create a workspace.

Step 1: Enable RDS ContextDB

  1. Go to the RDS ContextDB page.

  2. Click Enable RDS ContextDB. If you previously used ContextDB during public preview, click Officially Enable to continue using ContextDB.

Step 2: Create and configure a workspace

After RDS ContextDB is enabled, create a workspace as a logical collection for context, memory, and knowledge bases. Then create an API Key for the workspace to authenticate client requests.

  1. Go to the RDS ContextDB page.

  2. Click Create. In the dialog box that appears, enter a Workspace Name and an Initial Administrator Name, and then click OK.

  3. An API Key is automatically generated. Save the API Key immediately. It cannot be retrieved after the dialog box is closed. Click I have saved it.

Note

You can also manage ContextDB directly by using OpenAPI. For more information, see RDS ContextDB API reference.

Step 3: Install and connect to ContextDB

RDS ContextDB supports rapid integration with major platforms such as Qoder, QoderWork, Claude Code, Codex, OpenClaw, OpenCode, Hermes, and QwenWork. Other platforms require manual configuration.

Note

In the following installation methods, <API_KEY> must be replaced with the API Key you saved in the previous step.

Method 1: Integrate through natural language

Copy the following text and send it to your Agent. The Agent will automatically complete the installation and integration.

Read https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.md, follow the script instructions to install the ctxdb CLI, and use API Key <API_KEY> to complete the integration configuration for yourself.

Method 2: Integrate through the CLI

Qoder

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent qoder --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent qoder -ApiKey <API_KEY>

Claude

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent claude --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent claude -ApiKey <API_KEY>

Codex

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent codex --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent codex -ApiKey <API_KEY>

OpenCode

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent opencode --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent opencode -ApiKey <API_KEY>

OpenClaw

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent openclaw --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent openclaw -ApiKey <API_KEY>

Hermes

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent hermes --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent hermes -ApiKey <API_KEY>

QwenWork

Linux/macOS/WSL

curl -fsSL 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.sh' | bash -s -- --agent qwenwork --api-key <API_KEY>

Windows PowerShell

& ([ScriptBlock]::Create((irm 'https://context-database-client.oss-cn-hangzhou.aliyuncs.com/install.ps1'))) -Agent qwenwork -ApiKey <API_KEY>

Method 3: Integrate through MCP

  • MCP server endpoint

    https://context-database.aliyuncs.com/v1/mcp
  • Configuration for each application

Qoder

{
  "mcpServers": {
    "contextdb": {
      "type": "http",
      "url": "https://context-database.aliyuncs.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer <API_KEY>"
      }
    }
  }
}

Claude

{
  "mcpServers": {
    "contextdb": {
      "type": "http",
      "url": "https://context-database.aliyuncs.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer <API_KEY>"
      }
    }
  }
}

Codex

[mcp_servers.contextdb]
url = "https://context-database.aliyuncs.com/v1/mcp"

[mcp_servers.contextdb.http_headers]
Authorization = "Bearer <API_KEY>"

OpenCode

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "contextdb": {
      "type": "remote",
      "url": "https://context-database.aliyuncs.com/v1/mcp",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer <API_KEY>"
      }
    }
  }
}

OpenClaw

{
  "mcp": {
    "servers": {
      "contextdb": {
        "url": "https://context-database.aliyuncs.com/v1/mcp",
        "transport": "streamable-http",
        "headers": {
          "Authorization": "Bearer <API_KEY>"
        }
      }
    }
  }
}

Hermes

mcp_servers:
  contextdb:
    url: "https://context-database.aliyuncs.com/v1/mcp"
    headers:
      Authorization: "Bearer <API_KEY>"

QwenWork

{
  "mcpServers": {
    "contextdb": {
      "type": "streamable-http",
      "url": "https://context-database.aliyuncs.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer <API_KEY>"
      }
    }
  }
}

Core features

Each RDS ContextDB workspace provides overview, API Key management, memory, knowledge promotion, knowledge base, and usage and audit log management capabilities.

1. Workspace overview

The Workspace Overview page is the home page of an RDS ContextDB workspace. It centralizes the basic information, quota usage, and permission mode of the current workspace.

  • Basic information at a glance: View basic information about the current workspace, such as the number of memories, the number of knowledge bases, documents pending review, memory promotions pending approval, and the workspace name and ID.

  • Advanced permissions: Click Enable Advanced Permissions to configure fine-grained user access permissions at the knowledge base level.

  • Resource usage: Displays the number of reads and writes on knowledge bases and memory stores, and the source file storage usage, over the last 30 days.

2. Context assets

2.1 Memories

Memory facts are objective information fragments extracted from conversations. They capture user preferences, project facts, and tool experience. RDS ContextDB stores and manages Agent memories in a structured way, based on the "Facts - Entities - Memory Rules" model:

  • Facts: Atomic statements (self-contained short sentences) decomposed from the context. Facts are the primary retrieval targets and are vectorized. Semantic matching during recall typically occurs at this layer.

  • Entities: Frequently mentioned people, organizations, projects, and tools are consolidated into persistent Entity Cards that carry attributes, aliases, and importance scores. Entity Cards bind to subsequent conclusion entries, so the Agent does not restart from scratch when a session resumes. All entities can be assembled into an entity relationship graph that visualizes the connections between entities.

  • Memory rules: Customize memory rules for members based on business requirements.

  • Forgetting management: After you enable Auto Forgetting, ContextDB automatically forgets memories that are no longer active based on custom forgetting conditions and recall activity, while protecting important content.

2.2 Knowledge base

The knowledge base module manages the external knowledge resources within a workspace that Agents can retrieve. You can create knowledge bases, upload files, and recall knowledge from the console, through natural language, or by using CLI commands:

Note

You can also use the ContextDB Sync tool to automatically synchronize your DingTalk, Lark, or local data to ContextDB.

Manage from the console

  1. Create a knowledge base.

    1. In the navigation pane, choose Knowledge Base to open the Knowledge Base List page.

    2. Click Create Knowledge Base, enter a Name, choose whether to enable Knowledge Graph and Knowledge Review, and then click OK.

      • Knowledge Graph: When enabled, ContextDB converts unstructured or semi-structured knowledge into structured graph data and returns graph-augmented index information during knowledge retrieval.

      • Knowledge Review: When enabled, uploaded documents are automatically evaluated for quality, self-contradiction, and rewrite suggestions. Based on your configuration, documents are then either ingested automatically or sent for manual review.

  2. Upload a file.

    1. Select the knowledge base to which you want to upload files.

    2. Click Upload File, select Perform knowledge review after upload if needed, choose the file, and then click OK.

      1. When the ingestion status shows Success, the document has been uploaded to the knowledge base.

      2. When the ingestion status shows Pending manual review, go to the Knowledge Review page to review the document manually.

  3. View the knowledge base graph.

    1. In the navigation pane, choose Knowledge Base to open the Knowledge Graph page.

    2. View graph: View the connections between entities in the knowledge base. You can select an entity name and a file scope to narrow the search.

    3. Entity management: View all entities in the current knowledge base and manually add entities.

Manage through natural language

After you connect to ContextDB, you can instruct the Agent to perform knowledge base operations directly in natural language, without writing any API calls.

  1. Create a knowledge base.

    Create a new knowledge base named "Aliyun RDS MySQL Operations Knowledge Base".
  2. Upload a file.

    Upload ~/docs/aliyun-rds-mysql-overview.pdf to the "Aliyun RDS MySQL Operations Knowledge Base".
  3. Recall knowledge.

    Using the "Aliyun RDS MySQL Operations Knowledge Base", answer: When read request volume increases significantly, what capabilities does RDS MySQL offer to scale read capacity? What are the respective use cases for read-only instances and read/write splitting?

Manage through the CLI

  1. Create a knowledge base.

    # The id returned by the command is kb_id, used for subsequent operations.
    curl -X POST "https://context-database.aliyuncs.com/v1/knowledge/knowledge_bases" \
      -H "Authorization: Token $API_KEY" -H "Content-Type: application/json" \
      -d '{"name": "my-kb", "description": "Test knowledge base"}'
  2. Upload text or a local file.

    # Upload text
    curl -X POST "https://context-database.aliyuncs.com/v1/knowledge/documents" \
      -H "Authorization: Token $API_KEY" -H "Content-Type: application/json" \
      -d '{"knowledge_base_id": "'$KB_ID'", "name": "intro.md", "text": "Full document content...", "mime_type": "text/plain"}'
    
    # Upload a local file
    curl -X POST "https://context-database.aliyuncs.com/v1/knowledge/files" \
      -H "Authorization: Token $API_KEY" \
      -F "knowledge_base_id=$KB_ID" \
      -F "file=@/path/to/your-doc.pdf"
  3. Recall knowledge.

    # If dataset_ids is an empty array, the query searches all knowledge bases.
    curl -X POST "https://context-database.aliyuncs.com/v1/knowledge/query" \
      -H "Authorization: Token $API_KEY" -H "Content-Type: application/json" \
      -d '{"question": "Your question", "dataset_ids": [], "top_k": 6}'

3. Context evolution

3.1 Memory consolidation

  • Automatic consolidation: Every day, the system automatically updates entity attributes, archives conflicting memories, merges duplicate relationships, and adjusts the heat and archive status of memories.

  • Manual consolidation: Click Consolidate Now to start a consolidation task.

3.2 Knowledge promotion

Knowledge promotion provides the memory-to-document feature, which automatically converts memories accumulated during Agent usage into reusable team knowledge. Instead of simply concatenating memories, this feature orchestrates a set of Agent roles that collaborate on material retrieval, fact verification, document writing, quality review, and risk flagging, turning scattered experience into structured, reviewable, and archivable knowledge documents.

Create a promotion task

  1. In the navigation pane, choose Knowledge Promotion.

  2. (Optional) Promotion template: Use a template to predefine the section structure and writing guidelines of the generated file, so that memories are automatically promoted into reviewable knowledge files that meet your team standards.

  3. Click Create Promotion Task, enter a promotion topic, and select a promotion template (optional) and a target knowledge base.

  4. The system automatically generates a knowledge document around the keyword based on the memory content. After generation is complete, the document enters the review process.

Review a document

For a document in the Pending Review state, you can perform the following operations on the review page:

  1. Edit the document information: Modify the document title and content.

  2. Resolve the question list: Review the uncertain points flagged by the system (such as fact conflicts or insufficient evidence), and select from the provided options or provide custom answers.

After you complete the changes, you can:

  • Click Approve and Ingest. The document enters the knowledge review process.

  • Click Reject. The document is marked as unsuitable for the knowledge base.

To review a large number of similar tasks in batches or automatically, you can:

  • Batch review: Select the tasks and click Batch Approve or Batch Reject.

  • Auto-ingestion: Turn on the switch, set the quality score threshold and the target knowledge base, and then click OK. Promoted files whose quality score is at or above the threshold are ingested automatically. Files below the threshold are sent for manual review (knowledge review).

3.3 Knowledge review

When a file is uploaded to a knowledge base, the system automatically evaluates its quality, checks for self-contradictions, calculates an overall confidence score, and makes an ingestion decision:

  • Auto-approved: A file whose confidence score is above the threshold and that contains no hallucinations is ingested directly.

  • Pending manual review: A file whose confidence score is below the threshold requires manual review. On the Knowledge Review page, select a file in the Pending Manual Review state to view the review details. You can Reject the file, Ingest As Is, or Adopt Rewrite.

Important

Knowledge review supports only the following file formats: txt, md, pdf, doc, and docx.

3.4 Policies and templates

Knowledge promotion

Configure a promotion template

  1. Go to the Policies and Templates page and click Promotion Templates.

  2. Select a member and click Create Template.

  3. On the configuration page, enter a template name, configure the section structure and content, and then click OK.

Knowledge review

Configure a review policy

  1. Go to the Policies and Templates page, click Review Policies, and select a knowledge base.

  2. Specify whether to enable knowledge review, auto-ingestion of rewritten files, and knowledge rewriting, and set the auto-ingestion threshold:

    1. Knowledge review: When enabled, each file uploaded to the knowledge base is automatically evaluated for quality and self-contradictions. The system calculates an overall confidence score and makes an ingestion decision.

    2. Knowledge rewriting: When enabled, a file whose confidence score is below the threshold triggers an intelligent rewrite that reduces noise, improves structure, and removes hallucinations and duplicates.

    3. Auto-ingest rewritten files: When enabled, a rewritten file whose score is at or above the auto-ingestion threshold is ingested automatically.

    4. Auto-ingestion threshold: A file whose confidence score is at or above this threshold is ingested automatically and can be recalled by Agents.

  3. Click Save Configuration.

Configure a rewrite template

You can configure a custom template for knowledge rewriting to define the section structure and writing guidelines of rewritten files. The AI generates the rewritten content based on the template.

  1. Go to the Policies and Templates page, click Rewrite Templates, and select a knowledge base.

  2. Click Create Template. On the configuration page, enter a template name, configure the section structure and content, and then click OK.

4. User management

The User Management page centrally manages workspace members and permissions, API Key credentials, and other information.

  • Member management: Add or remove workspace members.

  • API Key management: Configure or revoke API Keys for each member.

5. Audit

The Audit page shows the API calls and operation records within the workspace. You can filter records by action, time, execution status, or other conditions.

Appendix: File size and format limits

RDS ContextDB imposes file size and format limits on files uploaded to the knowledge base:

File type

Maximum file size

Supported formats

Plain text

20 MB

  • Text: txt, md, csv, tsv, log

  • Markup/Data: json, xml, yaml, yml, html, htm

  • Code: java, py, js, ts, jsx, tsx, go, rs, c, cpp, h, hpp, cs, rb, php, swift, kt, scala, lua, r, m

  • Scripts: sh, bash, zsh, bat, ps1

  • Query/API: sql, graphql, proto

  • Styles: css, scss, less, sass

  • Frameworks: vue, svelte

  • Config: toml, ini, cfg, conf, properties, env, dockerfile, makefile, cmake, gitignore, editorconfig

Complex documents/Images

500 MB

  • Complex documents: pdf, doc, docx, ppt, pptx, xls, xlsx, epub

  • Images: png, jpg, jpeg, gif, bmp, webp, tiff, tif, svg

Audio

10 MB/5 minutes

mp3, wav, flac, ogg, m4a, aac, wma

Video

2 GB

mp4, avi, mov, mkv, webm, flv, wmv, 3gp, mpeg, mpg