# What Dependencies Does TencentDB Agent Memory Use? A Complete Breakdown of the Monorepo Stack

> Uncover the dependencies of TencentDB Agent Memory. Explore its TypeScript monorepo stack, including OpenTelemetry, AI SDKs, SQLite-Vec, and ClickHouse, for seamless integration and robust performance.

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

---

**TencentDB Agent Memory relies on a TypeScript monorepo architecture with three distinct packages—Memory Proxy, Memory Knowledge, and Memory Core—that collectively depend on OpenTelemetry for observability, AI SDKs for LLM integration, and specialized libraries like SQLite-Vec and ClickHouse for vector storage and telemetry.**

This repository implements a four-layer local memory system plugin designed for database agent workflows. Understanding the dependency structure is essential for deployment, customization, and troubleshooting performance in production environments.

## Monorepo Package Structure

The codebase is organized into three main packages, each serving a specific architectural purpose. According to the source code in [`MemoryProxy/package.json`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryProxy/package.json), [`MemoryKnowledge/package.json`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryKnowledge/package.json), and [`MemoryCore/package.json`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/package.json), the **TencentDB Agent Memory dependencies** are distributed across these boundaries to separate concerns between proxy services, knowledge management, and core memory operations.

### Memory Proxy Dependencies

The **Memory Proxy** package functions as a lightweight LLM-request forwarding proxy. Its core runtime dependencies include:

- **Networking and server**: `hono` and `@hono/node-server` for HTTP routing, `node-pty` for PTY handling, `ioredis` for Redis connectivity
- **Observability**: `@opentelemetry/api`, `@opentelemetry/sdk-node`, `@opentelemetry/exporter-trace-otlp-http`, `@langfuse/otel`, and `@langfuse/tracing` for distributed tracing
- **Data and configuration**: `@clickhouse/client` for analytics storage, `js-yaml` for configuration parsing

Optional dependencies include `better-sqlite3` for local storage and `cos-nodejs-sdk-v5` for Tencent Cloud Object Storage integration.

### Memory Knowledge Dependencies

The **Memory Knowledge** package provides a standalone knowledge service combining Code-Graph and LLM-Wiki capabilities. Key dependencies include:

- **LLM providers**: `@ai-sdk/anthropic`, `@ai-sdk/openai`, and the unified `ai` SDK for model interoperability
- **Graph processing**: `graphology` and `graphology-communities-louvain` for code relationship analysis, `@colbymchenry/codegraph` for repository parsing
- **Search and storage**: `minisearch` for fuzzy search, `drizzle-orm` with `better-sqlite3`, `@node-rs/jieba` for Chinese text segmentation
- **Protocol support**: `@modelcontextprotocol/sdk` for MCP integration, `simple-git` for repository operations

This package maintains `js-tiktoken` for token counting and `zod` for schema validation across API boundaries.

### Memory Core Dependencies

The **Memory Core** package implements the central four-layer local memory system plugin for OpenClaw. Its dependency profile emphasizes:

- **Vector operations**: `sqlite-vec` for local vector storage, `@tencentdb-agent-memory/tcvdb-text` for Tencent Cloud Vector Database integration
- **Telemetry**: Comprehensive OpenTelemetry stack including `@opentelemetry/sdk-logs`, `@opentelemetry/exporter-logs-otlp-http`, and `@opentelemetry/semantic-conventions`
- **Compression and parsing**: `fflate` for compression, `jszip` for archive handling, `yaml` and `json5` for data parsing
- **Internal SDKs**: `@tencentdb-agent-memory/memory-sdk-ts-v2` for internal memory operations

Optional dependencies in [`MemoryCore/package.json`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/package.json) support enterprise deployments: `kafkajs` for event streaming, `mongodb` for document storage, and `@clickhouse/client` for high-performance analytics.

## Functional Dependency Categories

Beyond package boundaries, the **TencentDB Agent Memory dependencies** cluster into distinct functional layers that demonstrate the system's architectural priorities.

### Observability and Tracing

The monorepo implements comprehensive telemetry through OpenTelemetry. In [`MemoryCore/package.json`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/package.json), the tracing stack spans `@opentelemetry/api` for instrumentation, `@opentelemetry/sdk-node` for Node.js specific implementations, and OTLP exporters for both HTTP and gRPC protocols. The [`stateful-pipeline-manager.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/stateful-pipeline-manager.ts) file in Memory Core orchestrates these components to trace LLM calls, embedding generation, and vector search operations.

Langfuse integration appears in both Memory Proxy and Memory Knowledge through `@langfuse/tracing` and `@langfuse/otel`, providing cost tracking and prompt management capabilities.

### LLM Integration and AI SDKs

All three packages leverage the Vercel AI SDK ecosystem. Memory Core and Memory Knowledge depend on `@ai-sdk/openai`, while Memory Knowledge additionally includes `@ai-sdk/anthropic` for Claude model support. The unified `ai` package provides streaming abstractions that the core memory pipeline uses in [`stateful-pipeline-manager.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/stateful-pipeline-manager.ts).

Tokenization utilities `js-tiktoken` and `@node-rs/jieba` handle context window management and Chinese language processing respectively, critical for accurate memory retrieval in multilingual database agent scenarios.

### Data Storage and Vector Search

The storage layer exhibits polyglot persistence patterns. **SQLite-Vec** provides zero-configuration vector search for local deployments, while production environments can utilize **ClickHouse** (via `@clickhouse/client`) for analytics and **Tencent Cloud Vector Database** (via `@tencentdb-agent-memory/tcvdb-text`) for managed vector storage.

Relational data management uses **Drizzle ORM** in Memory Knowledge with `better-sqlite3` drivers, while Memory Core optionally supports **MongoDB** via the `mongodb` driver and **Redis** via `ioredis` for caching layers.

### Web Server and Networking

The proxy and knowledge layers standardize on **Hono** (`hono` and `@hono/node-server`), a lightweight Edge-compatible web framework. Memory Proxy specifically includes `node-pty` for terminal emulation support, while `@hono/swagger-ui` in Memory Knowledge provides OpenAPI documentation interfaces.

## Implementation Examples

The following examples demonstrate how these dependencies integrate in production code paths.

### Initializing the Memory Core with SQLite-Vec

This snippet from the core implementation shows how the package uses `sqlite-vec`, `ai`, and internal SDKs:

```typescript
// Import the core memory plugin (Memory Core)
import { createMemory } from '@tencentdb-agent-memory/memory-tencentdb-v2';

// Initialise with a SQLite‑Vec database
const memory = await createMemory({
  dbPath: './data/memory.sqlite',
  embeddingModel: 'openai:gpt-4o-mini',   // uses @ai-sdk/openai under the hood
  vectorStore: 'sqlite-vec',
});

// Simple usage – add a conversation turn and retrieve relevant context
await memory.addTurn({ role: 'user', content: 'How does replication work in MySQL?' });
const context = await memory.search('replication');
console.log(context);

```

### Configuring OpenTelemetry Tracing in Memory Proxy

The proxy service utilizes `@opentelemetry/api` and `@langfuse/tracing` for request tracing:

```typescript
// Enable OpenTelemetry tracing for the Proxy service
import { trace } from '@opentelemetry/api';
import { otelTracer } from '@langfuse/tracing';

otelTracer({
  endpoint: 'https://api.langfuse.com',
  apiKey: process.env.LANGFUSE_API_KEY!,
});

trace.getTracer('memory-proxy').startActiveSpan('handle-request', span => {
  // … proxy logic here …
  span.end();
});

```

### ClickHouse Telemetry Integration

The knowledge service implements analytics storage using the ClickHouse client, as referenced in [`MemoryKnowledge/src/clickhouse-telemetry.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryKnowledge/src/clickhouse-telemetry.ts):

```typescript
// Example pattern for ClickHouse telemetry (Knowledge service)
import { createClient } from '@clickhouse/client';

const client = createClient({
  host: process.env.CLICKHOUSE_HOST,
  username: process.env.CLICKHOUSE_USER,
  password: process.env.CLICKHOUSE_PASSWORD,
});

// Used for storing conversation metrics and retrieval analytics
await client.insert({
  table: 'memory.telemetry',
  values: [{ event: 'embedding_generated', timestamp: Date.now(), latency_ms: 45 }],
});

```

## Summary

- **TencentDB Agent Memory dependencies** are organized across three TypeScript packages: Memory Proxy (request forwarding), Memory Knowledge (graph and wiki services), and Memory Core (local memory system).
- **Observability stack** includes OpenTelemetry SDKs, Langfuse tracing, and ClickHouse clients distributed across all packages for comprehensive telemetry.
- **AI integration** relies on the Vercel AI SDK (`ai`, `@ai-sdk/openai`, `@ai-sdk/anthropic`) with tokenization support from `js-tiktoken` and `@node-rs/jieba`.
- **Storage layer** supports polyglot persistence: SQLite-Vec for local vector search, Drizzle ORM with Better-SQLite3 for relational data, and optional MongoDB, Redis, and Kafka for enterprise deployments.
- **Web infrastructure** standardizes on the Hono framework with Node.js server adapters, while `node-pty` supports terminal emulation in proxy scenarios.

## Frequently Asked Questions

### What database drivers are required for TencentDB Agent Memory?

The core system requires `sqlite-vec` for local vector operations and optionally `better-sqlite3` for relational storage. Production deployments may additionally require `mongodb`, `ioredis` for Redis caching, or `@clickhouse/client` for analytics storage, depending on the specific package configuration in [`MemoryCore/package.json`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryCore/package.json).

### Are all dependencies installed by default, or are some optional?

Several components are marked as optional in the package manifests. `better-sqlite3` and `cos-nodejs-sdk-v5` are optional for Memory Proxy, while Memory Core treats `@clickhouse/client`, `kafkajs`, `mongodb`, and `ioredis` as optional peer dependencies to support modular deployment architectures.

### Which package handles the LLM provider integrations?

Memory Knowledge and Memory Core both contain LLM provider dependencies. Memory Knowledge includes `@ai-sdk/anthropic` and `@ai-sdk/openai` alongside the `ai` SDK, while Memory Core specifically depends on `@ai-sdk/openai` for embedding generation and chat completions within the local memory pipeline.

### How does the tracing system work across the monorepo?

All three packages implement OpenTelemetry tracing through `@opentelemetry/api` and various SDK exporters. Memory Proxy and Memory Knowledge specifically integrate Langfuse via `@langfuse/tracing` for prompt and cost tracking, while Memory Core includes additional log exporters (`@opentelemetry/exporter-logs-otlp-http`) for comprehensive observability in [`stateful-pipeline-manager.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/stateful-pipeline-manager.ts).