# tencentcloud/tencentdb-agent-memory architecture

> Architecture diagram of the GitHub repository tencentcloud/tencentdb-agent-memory, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tencentcloud/tencentdb-agent-memory
- Repository: https://github.com/tencentcloud/tencentdb-agent-memory
- Video tour (about a minute): https://gitdiagram.com/tencentcloud/tencentdb-agent-memory/video

## Overview

This repository combines a layered agent-memory service with a knowledge hub, a cross-agent proxy, and a management panel. The main memory workflow captures conversations and distills them through L0–L3; agents can then recall memory and use skills, while the hub adds Wiki and CodeGraph capabilities. The graph includes documented product branches and only source-level relationships visible in the excerpts or SOURCE INDEX; several unsampled subsystem links are therefore omitted.

Main entry points: [`MemoryKnowledge/src/server.ts`](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/server.ts) (Knowledge API), [`MemoryKnowledge/src/engines/wiki/manager.ts`](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/wiki/manager.ts) (Wiki ingestion and search), [`MemoryCore/src/core/hooks/auto-capture.ts`](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/hooks/auto-capture.ts) (Conversation capture), [`MemoryCore/src/core/conversation/l0-recorder.ts`](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/conversation/l0-recorder.ts) (L0 recording)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Memory Core"]
  node_capture["Conversation capture<br/>[auto-capture.ts]"]
  node_l0["L0 recording<br/>[l0-recorder.ts]"]
  node_l1["L1 extraction<br/>[l1-extractor.ts]"]
  node_l2["L2 scenes<br/>[scene-extractor.ts]"]
  node_l3["L3 persona"]
  node_recall["Memory recall<br/>[auto-recall.ts]"]
  node_skill["Skill library<br/>[skill-core.ts]"]
  node_corestore[("Memory storage<br/>[adapter.ts]")]
  node_gateway["Memory gateway<br/>[server.ts]"]
end

subgraph group_knowledge["Knowledge Hub"]
  node_hubapi["Knowledge API<br/>[server.ts]"]
  node_wiki["Wiki ingestion and search<br/>[manager.ts]"]
  node_wikidb[("Wiki index<br/>[index-db.ts]")]
  node_wikiimport["External Wiki import<br/>[routes.ts]"]
  node_codegraph["CodeGraph<br/>[index.ts]"]
end

subgraph group_proxy["Agent Proxy"]
  node_proxy["Request injection<br/>[pipeline.ts]"]
  node_proxyserver["Proxy service<br/>[server.ts]"]
end

subgraph group_panel["Management Panel"]
  node_panelroutes["Wiki management routes<br/>[wiki-routes.ts]"]
  node_knowledgeclient["Knowledge client"]
end

node_agents(("Agent clients"))
node_human(("Team members"))

node_agents -.->|"send conversations"| node_capture
node_capture -.->|"record messages"| node_l0
node_l0 -.->|"distill atoms"| node_l1
node_l1 -.->|"derive scenes"| node_l2
node_l2 -.->|"synthesize persona"| node_l3
node_agents -.->|"request recall"| node_recall
node_agents -.->|"use skills"| node_skill
node_gateway -.->|"adapt storage"| node_corestore
node_hubapi -->|"serve Wiki"| node_wiki
node_hubapi -->|"serve CodeGraph"| node_codegraph
node_wiki -->|"read index"| node_wikidb
node_wikiimport -->|"import pages"| node_wiki
node_proxyserver -->|"run injection"| node_proxy
node_agents -.->|"send requests"| node_proxyserver
node_human -.->|"manage Wiki"| node_panelroutes
node_panelroutes -->|"call client"| node_knowledgeclient
node_knowledgeclient -.->|"call API"| node_hubapi

click node_capture "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/hooks/auto-capture.ts"
click node_l0 "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/conversation/l0-recorder.ts"
click node_l1 "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/record/l1-extractor.ts"
click node_l2 "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/scene/scene-extractor.ts"
click node_l3 "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/persona/persona-generator.ts"
click node_recall "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/hooks/auto-recall.ts"
click node_skill "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/skill/skill-core.ts"
click node_corestore "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/storage/adapter.ts"
click node_gateway "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/gateway/server.ts"
click node_hubapi "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/server.ts"
click node_wiki "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/wiki/manager.ts"
click node_wikidb "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/wiki/index-db.ts"
click node_wikiimport "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/wiki-source/routes.ts"
click node_codegraph "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/code/index.ts"
click node_proxy "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryProxy/src/injection/pipeline.ts"
click node_proxyserver "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryProxy/src/server.ts"
click node_panelroutes "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryPanel/src/panel/http/routes/knowledge/wiki-routes.ts"
click node_knowledgeclient "https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryPanel/src/panel/kernel/adapters/http-knowledge-client.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_capture,node_l0,node_l1,node_l2,node_l3,node_recall,node_skill,node_corestore,node_gateway,node_agents toneBlue
class node_hubapi,node_wiki,node_wikidb,node_wikiimport,node_codegraph toneAmber
class node_proxy,node_proxyserver toneMint
class node_panelroutes,node_knowledgeclient toneRose
class node_human toneIndigo
```

## Components

### Memory Core

- [Conversation capture](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/hooks/auto-capture.ts): `MemoryCore/src/core/hooks/auto-capture.ts`
- [L0 recording](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/conversation/l0-recorder.ts): `MemoryCore/src/core/conversation/l0-recorder.ts`
- [L1 extraction](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/record/l1-extractor.ts): `MemoryCore/src/core/record/l1-extractor.ts`
- [L2 scenes](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/scene/scene-extractor.ts): `MemoryCore/src/core/scene/scene-extractor.ts`
- [L3 persona](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/persona/persona-generator.ts): `MemoryCore/src/core/persona/persona-generator.ts`
- [Memory recall](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/hooks/auto-recall.ts): `MemoryCore/src/core/hooks/auto-recall.ts`
- [Skill library](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/skill/skill-core.ts): `MemoryCore/src/core/skill/skill-core.ts`
- [Memory storage](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/core/storage/adapter.ts): `MemoryCore/src/core/storage/adapter.ts`
- [Memory gateway](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryCore/src/gateway/server.ts): `MemoryCore/src/gateway/server.ts`

### Knowledge Hub

- [Knowledge API](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/server.ts): `MemoryKnowledge/src/server.ts`
- [Wiki ingestion and search](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/wiki/manager.ts): `MemoryKnowledge/src/engines/wiki/manager.ts`
- [Wiki index](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/wiki/index-db.ts): `MemoryKnowledge/src/engines/wiki/index-db.ts`
- [External Wiki import](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/wiki-source/routes.ts): `MemoryKnowledge/src/wiki-source/routes.ts`
- [CodeGraph](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryKnowledge/src/engines/code/index.ts): `MemoryKnowledge/src/engines/code/index.ts`

### Agent Proxy

- [Request injection](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryProxy/src/injection/pipeline.ts): `MemoryProxy/src/injection/pipeline.ts`
- [Proxy service](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryProxy/src/server.ts): `MemoryProxy/src/server.ts`

### Management Panel

- [Wiki management routes](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryPanel/src/panel/http/routes/knowledge/wiki-routes.ts): `MemoryPanel/src/panel/http/routes/knowledge/wiki-routes.ts`
- [Knowledge client](https://github.com/tencentcloud/tencentdb-agent-memory/blob/feat/server_team/MemoryPanel/src/panel/kernel/adapters/http-knowledge-client.ts): `MemoryPanel/src/panel/kernel/adapters/http-knowledge-client.ts`

### Other components

- **Agent clients**
- **Team members**

## Connections

- Agent clients → Conversation capture: send conversations (evidence: `README.md`)
- Conversation capture → L0 recording: record messages (evidence: `README.md`)
- L0 recording → L1 extraction: distill atoms (evidence: `README.md`)
- L1 extraction → L2 scenes: derive scenes (evidence: `README.md`)
- L2 scenes → L3 persona: synthesize persona (evidence: `README.md`)
- Agent clients → Memory recall: request recall (evidence: `README.md`)
- Agent clients → Skill library: use skills (evidence: `README.md`)
- Memory gateway → Memory storage: adapt storage
- Knowledge API → Wiki ingestion and search: serve Wiki (evidence: `MemoryKnowledge/src/server.ts`)
- Knowledge API → CodeGraph: serve CodeGraph (evidence: `MemoryKnowledge/src/server.ts`)
- Wiki ingestion and search → Wiki index: read index (evidence: `MemoryKnowledge/src/engines/wiki/manager.ts`)
- External Wiki import → Wiki ingestion and search: import pages (evidence: `MemoryKnowledge/src/wiki-source/routes.ts`)
- Proxy service → Request injection: run injection (evidence: `MemoryProxy/src/server.ts`)
- Agent clients → Proxy service: send requests (evidence: `README.md`)
- Team members → Wiki management routes: manage Wiki (evidence: `README.md`)
- Wiki management routes → Knowledge client: call client (evidence: `MemoryPanel/src/panel/http/routes/knowledge/wiki-routes.ts`)
- Knowledge client → Knowledge API: call API
