# TencentDB Agent Memory Injectors Explained: Skill, Knowledge, and Profile Modules

> Understand TencentDB Agent Memory injectors skill knowledge and profile modules. Learn how they enrich LLM agent capabilities with dynamic XML context for better performance.

- Repository: [Tencent Cloud/TencentDB-Agent-Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory)
- Tags: deep-dive
- Published: 2026-09-01

---

**TencentDB Agent Memory uses a modular injector system to dynamically prepend XML-formatted context blocks—skills, knowledge resources, and long-term memory profiles—to the LLM system prompt at session initialization, enriching agent capabilities while maintaining efficient cache strategies.**

The TencentDB Agent Memory repository implements a sophisticated prompt engineering architecture through pluggable injectors that assemble contextual data for large language models. These injectors fetch domain-specific information from cloud services and internal stores, format it as structured XML blocks, and splice it into system prompts at defined semantic anchors. Understanding the distinct roles of skill, knowledge, and profile injectors is essential for configuring agent behavior and optimizing context window usage in production deployments.

## Skill Injectors: Cloud Capability Discovery

The skill injector pair exposes cloud-native tool capabilities to the LLM, combining dynamic service catalogs with static invocation recipes.

### Skill Injector (Dynamic Catalog)

Located in [`MemoryProxy/src/injection/injectors/skill-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryProxy/src/injection/injectors/skill-injector.ts), the **Skill Injector** queries the agent’s authorized cloud services and emits the `<available_skills>` block. This injector filters resources by `team-id` and `agent-id` to ensure the LLM only sees relevant capabilities. It operates with `cacheStrategy: "session_init"`, executing once per conversation to pre-warm the context without repeated API calls.

The block contains the skill catalog and mandatory usage instructions, enabling the model to understand which operations it can request during the session.

### Skill Tools Injector (Static Recipes)

The **Skill Tools Injector** ([`skill-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/skill-tools-injector.ts)) complements the dynamic catalog by injecting a static `<skill_tools>` block. This self-contained guide provides curl recipes for calling the skill-bridge endpoints—including search, view, read, and create operations—allowing the LLM to construct valid Bash commands for skill invocation.

Both skill injectors activate when `config.injection.injectors` includes `"skill"` (or `"tdai-memory"` with skill support enabled).

## Knowledge Injectors: Team Resource Access

Knowledge injectors bridge the gap between the LLM and organizational documentation, surfacing wiki pages and code repositories as structured tool references.

### Knowledge Tools Injector

Implemented in [`knowledge-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/knowledge-tools-injector.ts), the **Knowledge Tools Injector** produces the `<knowledge_tools>` block describing team knowledge resources such as wikis and code graphs. When enabled via `injectors.includes("knowledge")`, it generates telemetry-aware curl commands alongside resource-specific metadata attributes including `type`, `id`, `url`, `match`, `branch`, and `about`.

This injector enables the LLM to discover and query internal documentation without hardcoding repository locations, facilitating dynamic knowledge retrieval based on the current session context.

## Profile and Memory Injectors: Long-Term Context

The Tdai memory injectors manage the agent’s persistent identity and historical context through layered memory architecture.

### Tdai Profile Memory Injector

The **Tdai Profile Memory Injector** ([`tdai-profile-memory-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-profile-memory-injector.ts)) inserts the `<tdai_profile_memory>` block containing **L3 (long-term persona)** and **L2 (scene-index)** memory snapshots. This injector activates only when `injectors.includes("tdai-memory")` evaluates true alongside `config.tdai.memory.enabled && config.tdai.memory.inject`.

The output includes structured XML describing per-agent personality layers and a `<memory-tools-guide>` explaining how to manipulate the `<tdai_memory_tools>` interface, effectively giving the LLM instructions for managing its own long-term state.

### Tdai Tools Injector

Working in concert with the profile injector, the **Tdai Tools Injector** ([`tdai-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-tools-injector.ts)) supplies the static `<tdai_memory_tools>` block. This component lists curl recipes for memory-search tools such as `tdai_conversation_search` and `tdai_memory_search`, providing the mechanical interface for the LLM to query its historical context.

### Asset Reflection Injector

The **Asset Reflection Injector** ([`asset-reflection-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/asset-reflection-injector.ts)) operates as infrastructure rather than content provider. Running at high priority after all other injectors, it registers static asset metadata (for example, fixed-asset IDs) into internal caches without emitting a user-visible XML block. Other injectors consume this metadata to compute asset ownership for the current session, ensuring consistent resource scoping across the injection pipeline.

Note that the **Tdai L1 Recall Injector** ([`tdai-l1-recall-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-l1-recall-injector.ts)) is deprecated and now functions as a no-op maintained for backward compatibility; the system now relies on on-demand tools rather than pre-injected full-session recall blocks.

## The Injection Pipeline Architecture

All injectors instantiate through a common factory pattern defined in [`MemoryProxy/src/injection/provider.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryProxy/src/injection/provider.ts), which creates standardized `InjectionHook` instances from content providers and declarative specifications.

The orchestration occurs within `InjectionPipeline.resolveHookBlocks`, which traverses registered injectors in priority order, executes each hook to collect `ContextBlock` objects, optionally wraps them, and splices the final blocks into the system prompt at their defined anchor points.

```typescript
// Example: Registering injectors based on runtime configuration
// (excerpt from MemoryProxy/src/server.ts)

if (injectors.includes("skill")) {
  // Dynamic skill listing + static tool recipes
  registry.register(new SkillInjector({ coreSkill: skillConfig }));
  registry.register(new SkillToolsInjector({ proxyBaseUrl, allowLlmWrite: true }));
}

if (injectors.includes("knowledge")) {
  registry.register(new KnowledgeToolsInjector({ coreSkill: skillConfig }));
}

if (injectors.includes("tdai-memory") && config.tdai.enabled && config.tdai.memory.enabled) {
  registry.register(new TdaiProfileMemoryInjector(memoryConfig, skillConfig));
  registry.register(new TdaiToolsInjector({ proxyBaseUrl }));
}

```

```typescript
// Example: Rendering a knowledge-tools block (simplified)
const block = renderKnowledgeToolsBlock(resources, "my-service-id", {
  sessionKey: "conv-123",
  userId: "u-456",
});
/* Returns:
<knowledge_tools>
  **团队知识库资源**：…
  <knowledge type="wiki" id="w-001" url="http://…"
    name="Project Overview" about="项目整体设计" />
  <knowledge type="code-graph" id="c-002" url="http://…" 
    name="Repo A" match="org/repo-a" branch="main" />
</knowledge_tools>
*/

```

## Summary

- **Skill Injectors** ([`skill-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/skill-injector.ts), [`skill-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/skill-tools-injector.ts)) expose cloud capabilities through dynamic catalogs and static curl recipes, activated by the `"skill"` configuration flag.
- **Knowledge Tools Injector** ([`knowledge-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/knowledge-tools-injector.ts)) surfaces team wikis and code repositories as queryable resources when `"knowledge"` is enabled in the injector list.
- **Profile Memory Injectors** ([`tdai-profile-memory-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-profile-memory-injector.ts), [`tdai-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-tools-injector.ts)) provide long-term persona data and memory manipulation interfaces under the `"tdai-memory"` configuration key.
- **Asset Reflection Injector** ([`asset-reflection-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/asset-reflection-injector.ts)) maintains internal asset metadata caches to support resource scoping without visible prompt injection.
- The **InjectionPipeline** orchestrates these components through [`provider.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/provider.ts) factories, executing hooks once per session to balance context richness with token efficiency.

## Frequently Asked Questions

### What is the difference between SkillInjector and SkillToolsInjector?

**SkillInjector** ([`skill-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/skill-injector.ts)) generates a dynamic `<available_skills>` block tailored to the specific agent and team IDs, listing only authorized cloud capabilities. **SkillToolsInjector** ([`skill-tools-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/skill-tools-injector.ts)) provides a static `<skill_tools>` block containing universal curl recipes for invoking those capabilities. The former changes based on permissions; the latter remains constant across sessions.

### How do I enable the knowledge injector in TencentDB Agent Memory?

Set the `config.injection.injectors` array to include `"knowledge"` (e.g., `injectors: ["skill", "knowledge"]`). When this condition is met, the `KnowledgeToolsInjector` class registers automatically during server initialization in [`MemoryProxy/src/server.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/MemoryProxy/src/server.ts), injecting the `<knowledge_tools>` block at session start.

### What data does the TdaiProfileMemoryInjector actually inject?

According to the source code in [`tdai-profile-memory-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/tdai-profile-memory-injector.ts), this injector inserts the `<tdai_profile_memory>` XML block containing **L3 persona** snapshots (stable long-term personality traits) and **L2 scene-index** data (structured historical interaction contexts), plus a `<memory-tools-guide>` explaining how to query and update these memory layers.

### Why is the AssetReflectionInjector necessary if it doesn't output visible blocks?

The **AssetReflectionInjector** ([`asset-reflection-injector.ts`](https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/main/asset-reflection-injector.ts)) maintains internal caches of static asset metadata that other injectors reference to determine resource ownership and scope. Running at high priority after other injectors, it enables cross-injector coordination—for example, ensuring that skill and knowledge injectors compute consistent asset IDs—without consuming valuable context window tokens with user-facing content.