# What Memory Types Does memU Support? A Complete Guide to Profile, Knowledge, Skill, and More

> Explore memU's six supported memory types profile event knowledge behavior skill and tool. Learn how LLM prompts extract XML data for seamless storage and embedding.

- Repository: [NevaMind AI/memU](https://github.com/nevamind-ai/memu)
- Tags: deep-dive
- Published: 2026-02-19

---

**memU supports six distinct memory types—profile, event, knowledge, behavior, skill, and tool—each extracted via type-specific LLM prompts that return XML-structured data for embedding and storage.**

The NevaMind-AI/memU repository implements a sophisticated memory extraction system designed to categorize and persist user information for AI agents. Understanding what memory types memU supports and how the extraction pipeline processes raw resources into structured memories is essential for building effective long-term memory capabilities.

## The Six Memory Types Supported by memU

memU defines a `MemoryType` literal in [`src/memu/database/models.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/database/models.py) (line 12) that enumerates all supported categories. Each type serves a distinct purpose in capturing different aspects of user interactions and agent operations.

### Profile Memories

**Profile** memories store stable user facts that remain constant over time. These include demographic information such as age, occupation, location, and persistent preferences. The system treats these as foundational attributes that define the user's identity within the memory system.

### Event Memories

**Event** memories capture specific occurrences with defined temporal and spatial contexts. These include meetings, transactions, or significant incidents that involve particular times, places, or participants. Unlike profile data, events represent discrete moments rather than continuous attributes.

### Knowledge Memories

**Knowledge** memories contain objective facts, definitions, and concepts discussed during interactions. These represent the user's understanding of domains, terminology, or factual information that the agent should retain for future reference.

### Behavior Memories

**Behavior** memories document repeated user habits and patterns of action. These capture how the user typically approaches tasks, their workflow preferences, and recurring operational patterns that the agent can anticipate.

### Skill Memories

**Skill** memories record capabilities and techniques the user demonstrates or explains. These include technical proficiencies, methodologies, and expertise areas that inform how the agent should tailor its assistance.

### Tool Memories

**Tool** memories maintain records of tool-call usage, including inputs, outputs, and performance metrics. According to the source code in [`src/memu/utils/tool.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/utils/tool.py), these memories store additional structured data such as `when_to_use` guidelines, execution metadata, and call history. Helper utilities like `add_tool_call` and `get_tool_statistics` manage tool-specific memory operations, including MD5 hashing for call deduplication.

## How memU Extracts Memory Types: The Extraction Pipeline

The extraction process follows a unified seven-step pipeline defined in [`src/memu/app/memorize.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/memorize.py), with each memory type utilizing specialized prompts while sharing common infrastructure.

### 1. Prompt Selection via Type Registry

memU maintains a mapping from each `MemoryType` to a dedicated LLM prompt in [`src/memu/prompts/memory_type/__init__.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/prompts/memory_type/__init__.py) (line 6). This registry contains six distinct prompt definitions—one for each supported type—that encode domain-specific extraction rules and examples.

### 2. Resource Preprocessing

Raw resources including text transcripts, image captions, and documents undergo sanitization through `_preprocess_resource_url` in the memorizer. This step converts heterogeneous inputs into clean text blocks suitable for LLM processing.

### 3. Prompt Construction

The `_build_memory_type_prompt` method (line 65 in [`src/memu/app/memorize.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/memorize.py)) injects the sanitized resource text and memory category definitions into the type-specific prompt template. This ensures the LLM receives contextually appropriate instructions for extracting profile versus tool memories.

### 4. LLM Processing and XML Generation

The constructed prompt is transmitted to the configured LLM client. The model returns **XML-structured memory items** containing one `<memory>` element per extracted fact, with nested `<content>` and `<category>` tags.

### 5. XML Response Parsing

The `_parse_memory_type_response_xml` function (line 90 in [`src/memu/app/memorize.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/memorize.py)) processes the LLM output, extracting content strings and associated categories into a list of dictionaries. This structured format ensures consistent data handling regardless of memory type.

### 6. Embedding and Persistence

The `_persist_memory_items` method (line 78 in [`src/memu/app/memorize.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/memorize.py)) generates embeddings for extracted summaries and creates `MemoryItem` records linked to appropriate `MemoryCategory` entries. This step materializes the extracted information into the vector database.

### 7. Tool-Specific Handling

When processing **tool** type memories, the system stores additional fields including `when_to_use`, `metadata`, and `tool_calls` in the `extra` column of the `MemoryItem` record. This specialized handling accommodates the structured nature of tool execution data.

## Code Implementation Examples

The following examples demonstrate how to interact with memU's memory type system programmatically.

```python

# List all supported memory types

from memu.database.models import MemoryType

print("Supported memory types:", list(MemoryType.__args__))

# Output: ['profile', 'event', 'knowledge', 'behavior', 'skill', 'tool']

```

```python

# Manual extraction for a skill-type memory

from memu.app.memorize import MemU

memu = MemU()
resource_text = "I often deploy services using a blue‑green strategy with canary testing."
categories = ["deployment", "devops"]

# Build the skill-type prompt

prompt = memu._build_memory_type_prompt(
    memory_type="skill",
    resource_text=resource_text,
    categories_str="\n".join(f"- {c}" for c in categories),
)

# Simulate LLM response

llm_response = """
<skill>
  <memory>
    <content>Canary deployment with blue‑green rollout enables safe production releases</content>
    <categories><category>deployment</category></categories>
  </memory>
</skill>
"""

# Parse XML response

items = memu._parse_memory_type_response_xml(llm_response)
print(items)

# Output: [{'content': 'Canary deployment with ...', 'categories': ['deployment']}]

```

```python

# Adding tool call metadata to tool-type memories

from memu.utils.tool import add_tool_call
from memu.database.models import MemoryItem, ToolCallResult

item = MemoryItem(
    resource_id=None,
    memory_type="tool",
    summary="File‑reader usage",
)

call = ToolCallResult(
    tool_name="file_reader",
    input={"path": "/etc/config.yaml"},
    output="config: {...}",
    success=True,
    time_cost=0.12,
    token_cost=5,
)

add_tool_call(item, call)
print(item.extra["tool_calls"][0]["call_hash"])

# Output: 32-character MD5 hash for deduplication

```

## Summary

- **memU supports six memory types**: profile, event, knowledge, behavior, skill, and tool, defined in [`src/memu/database/models.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/database/models.py).
- **Type-specific extraction**: Each memory type uses a dedicated prompt from [`src/memu/prompts/memory_type/__init__.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/prompts/memory_type/__init__.py) to guide LLM extraction.
- **Unified XML pipeline**: All types follow the same flow through `_build_memory_type_prompt`, LLM generation, and `_parse_memory_type_response_xml` processing.
- **Tool specialization**: Tool memories store additional structured data including call history and performance metrics in the `extra` column.
- **Persistence layer**: The `_persist_memory_items` function handles embedding generation and database storage for all memory types.

## Frequently Asked Questions

### What are the six memory types supported by memU?

memU supports **profile**, **event**, **knowledge**, **behavior**, **skill**, and **tool** memories. Profile stores stable user attributes, event captures specific occurrences, knowledge retains objective facts, behavior tracks habits, skill records capabilities, and tool maintains function call histories. These are defined as a `MemoryType` literal in [`src/memu/database/models.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/database/models.py).

### How does memU extract different memory types from text?

memU extracts memories through a type-specific pipeline: it selects a dedicated prompt from the registry in `src/memu/prompts/memory_type/`, preprocesses the input resource, builds a contextual prompt via `_build_memory_type_prompt`, queries the LLM, and parses the XML response using `_parse_memory_type_response_xml`. Each memory type uses distinct extraction rules encoded in its specific prompt file.

### Where are memory type prompts defined in the memU codebase?

The prompt registry is located in [`src/memu/prompts/memory_type/__init__.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/prompts/memory_type/__init__.py) (line 6), which maps each `MemoryType` to its corresponding prompt template. Individual type-specific prompts and examples reside in separate files within `src/memu/prompts/memory_type/` (e.g., [`profile.py`](https://github.com/NevaMind-AI/memU/blob/main/profile.py), [`event.py`](https://github.com/NevaMind-AI/memU/blob/main/event.py), [`tool.py`](https://github.com/NevaMind-AI/memU/blob/main/tool.py)).

### How does memU handle tool-specific memory extraction differently?

Tool memories receive specialized handling in [`src/memu/utils/tool.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/utils/tool.py). Beyond standard content extraction, the system stores execution metadata including `when_to_use` guidelines, input/output parameters, success flags, and timing metrics in the `extra` JSON column of the `MemoryItem` record. The `add_tool_call` utility generates MD5 hashes for call deduplication and statistics tracking.