What Dependencies Does TencentDB Agent Memory Use? A Complete Breakdown of the Monorepo Stack
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, MemoryKnowledge/package.json, and 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:
honoand@hono/node-serverfor HTTP routing,node-ptyfor PTY handling,ioredisfor Redis connectivity - Observability:
@opentelemetry/api,@opentelemetry/sdk-node,@opentelemetry/exporter-trace-otlp-http,@langfuse/otel, and@langfuse/tracingfor distributed tracing - Data and configuration:
@clickhouse/clientfor analytics storage,js-yamlfor 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 unifiedaiSDK for model interoperability - Graph processing:
graphologyandgraphology-communities-louvainfor code relationship analysis,@colbymchenry/codegraphfor repository parsing - Search and storage:
minisearchfor fuzzy search,drizzle-ormwithbetter-sqlite3,@node-rs/jiebafor Chinese text segmentation - Protocol support:
@modelcontextprotocol/sdkfor MCP integration,simple-gitfor 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-vecfor local vector storage,@tencentdb-agent-memory/tcvdb-textfor 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:
fflatefor compression,jszipfor archive handling,yamlandjson5for data parsing - Internal SDKs:
@tencentdb-agent-memory/memory-sdk-ts-v2for internal memory operations
Optional dependencies in 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, 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 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.
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:
// 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:
// 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:
// 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 fromjs-tiktokenand@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-ptysupports 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.
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.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →