claudeers.

🔓 unclaimed — this page was auto-generated from GitHub. Are you the creator?

Claim this page →
// RAG & Knowledge

memU

From workspace to agent memory

Actively maintained
100/100
last commit 3 days ago
last release 4 months ago
releases 24
open issues 61
// install
git clone https://github.com/NevaMind-AI/memU

MemU Banner

memU

Every agent needs a workspace runtime

NevaMind-AI%2FmemU | Trendshift

English | 中文 | 日本語 | 한국어 | Español | Français


memU is a workspace runtime for AI agents.

Every agent needs a workspace runtime. memU compiles any workspace — chat logs, documents, code, images, audio, and tool traces — into three durable layers so agents can act with context, continuity, and control:

  • Index — a navigable map across everything the agent knows, so it knows where to look before it reads (INDEX.md)
  • Skill — learned skills and tool patterns: what worked, what to avoid, and how to repeat recurring tasks (SKILL.md)
  • Memory — the agent's living memory: who the user is, their preferences, goals, and the events extracted from every source (MEMORY.md)
workspace/
├── INDEX.md              ← Index: map of everything — categories, files, and summaries
├── MEMORY.md             ← Memory: profile, preferences, goals, and key events
└── skill/
    ├── {skill_name}/
    │   └── SKILL.md       ← Skill: a learned skill or tool pattern
    └── {another_skill}/
        └── SKILL.md

memU compiles raw sources into this workspace once, then serves it back on demand — the agent memorize()s new sources into the layers and retrieve()s only the parts that matter:

  • Context — agents act on the right facts, preferences, and source material instead of a cold prompt.
  • Continuity — the workspace persists and self-organizes across sessions, sources, and tasks, so nothing has to be relearned.
  • Control — every layer is a structured, inspectable record that traces back to its source, so you can audit and edit what the agent knows.

🔄 How It Works

Think of it as two runtime operations: compiling raw sources into the workspace, and serving the right layers back to the agent.

WRITE — memorize()                                         READ — retrieve()
──────────────────────────────────────────────            ──────────────────────────────────────────────
raw files        →  extract  →  files + folders            query  →  walk folders  →  ranked files
─────────────       ─────────    ──────────────            ─────     ────────────     ─────────────
chat logs        →  parse    →  profile / event items      user / task query
documents / URLs →  facts    →  knowledge / skill items       │
images / video   →  caption  →  resources + summaries         ├─ route + scope    → relevant folders (categories)
audio            →  transcribe→ event / knowledge items       ├─ rank by relevance → matching files (items)
tool logs        →  mine      → tool / skill items            └─ trace to source   → original resources

Compiling the workspace (memorize)

  1. Ingest — store each source as a Resource (the raw file) with its modality and source location
  2. Preprocess — parse text, caption images/video, transcribe audio, and normalize inputs
  3. Extract — turn raw content into typed MemoryItems (the files): profile, event, knowledge, behavior, skill, or tool memories
  4. Organize — sort items into MemoryCategory folders, cross-link, embed, and summarize into a browsable tree
  5. Persist — write records, relations, embeddings, and folder summaries through the configured backend

Serving the workspace (retrieve)

  1. Retrieve — navigate the folders and return only the files relevant to the current user, agent, session, or task

🗂️ The Compiled Workspace

memU compiles its primary output into a navigable workspace — Index, Skill, and Memory layers backed by the source artifacts behind them — persisted through repository contracts and returned as dictionaries from memorize() and retrieve().

MemoryCategory                       ← folder: a topic with an evolving summary
├── name, description, summary
├── embedding
└── MemoryItem[]                     ← files: typed, atomic memories
    ├── memory_type: profile | event | knowledge | behavior | skill | tool
    ├── summary, extra, happened_at, embedding
    └── Resource                     ← source: the raw file this memory came from
        └── url, modality, local_path, caption, embedding
RecordFile-System RoleUsed By
MemoryCategoryFolder — groups related memories and keeps a topic-level summaryLoad compact context for broad queries
MemoryItemFile — a typed atomic memory with a summary and optional metadataInject precise facts, preferences, events, skills, and tool patterns
ResourceSource artifact — the original file behind a memory, with caption/textTrace context back to where it came from
CategoryItemLink — the edge that files an item under a folderNavigate related memories without reprocessing the source

This gives agents a stable workspace runtime: compile raw sources once, then request scoped and ranked layers instead of rereading every source artifact.


🧩 What memU Builds

Every layer of the workspace is stored as a structured record:

LayerWhat It RepresentsWhy Agents Use It
MemoryCategoryAuto-generated folder: a topic with an evolving summaryLoad high-level context before drilling into details
MemoryItemA file: atomic structured memory with a type and summaryInject precise facts, preferences, events, skills, and tool patterns
ResourceSource artifact behind a file: conversation, document, image, video, audio, URL, or fileTrace memory back to its source
CategoryItemThe link that files an item under a folderNavigate related memories without reprocessing the source
EmbeddingVector index over folders, files, and sourcesRetrieve relevant context with low latency

Example memorize() output:

{
  "resource": {
    "id": "res_01",
    "url": "files/launch-meeting.mp4",
    "modality": "video",
    "caption": "A product planning discussion about onboarding and launch risks."
  },
  "items": [
    {
      "id": "mem_01",
      "memory_type": "event",
      "summary": "The team decided to simplify onboarding before the next launch review."
    },
    {
      "id": "mem_02",
      "memory_type": "profile",
      "summary": "The user prefers concise implementation plans with explicit verification steps."
    },
    {
      "id": "mem_03",
      "memory_type": "tool",
      "summary": "Use repository-wide search before editing configuration files to avoid missing duplicated settings."
    }
  ],
  "categories": [
    {
      "id": "cat_01",
      "name": "product_goals",
      "summary": "Current launch priorities, onboarding decisions, and unresolved risks."
    }
  ],
  "relations": [
    { "item_id": "mem_01", "category_id": "cat_01" }
  ]
}

Then an agent can call retrieve() to get a scoped, ranked context payload:

context = await service.retrieve(
    queries=[{"role": "user", "content": {"text": "What context matters for this launch task?"}}],
    where={"user_id": "123"},
)

⭐️ Star the repository

memU

If you find memU useful or interesting, a GitHub Star ⭐️ would be greatly appreciated.


✨ Core Features

CapabilityDescription
🗂️ Multimodal IngestionWrite conversations, documents, images, video, audio, URLs, logs, and local files into memory
📁 Compiled WorkspacePersist the Index, Skill, and Memory layers — folders (categories), files (items), source artifacts, links, summaries, and embeddings
🧠 Typed Memory ExtractionExtract profile, event, knowledge, behavior, skill, and tool memories from raw sources
🧭 Self-Organizing FoldersAuto-build categories, links, summaries, and embeddings without manual tagging
🤖 Agent-Ready RetrievalRead scoped, ranked context that can be injected into any agent workflow
🧱 Pluggable StorageUse in-memory, SQLite, or Postgres backends with the same repository contracts
🔀 Profile-Based LLM RoutingRoute chat, embedding, vision, and transcription work through configurable LLM profiles

🎯 Use Cases

1. Conversation Memory

Turn chat logs into user preferences, goals, events, and relationship context.

await service.memorize(
    resource_url="examples/resources/conversations/conv1.json",
    modality="conversation",
    user={"user_id": "123"},
)

context = await service.retrieve(
    queries=[{"role": "user", "content": {"text": "What should I remember about this user?"}}],
    where={"user_id": "123"},
)

2. Workspace Context for Coding Agents

Convert docs, PR notes, logs, and design decisions into reusable project memory.

await service.memorize(resource_url="docs/architecture.md", modality="document")
await service.memorize(resource_url="examples/resources/logs/log1.txt", modality="document")

context = await service.retrieve(
    queries=[{"role": "user", "content": {"text": "How should I structure this module?"}}],
)

3. Multimodal Knowledge Layer

Extract searchable facts from documents, screenshots, images, videos, and audio notes.

await service.memorize(resource_url="examples/resources/docs/doc1.txt", modality="document")
await service.memorize(resource_url="examples/resources/images/image1.png", modality="image")
# Audio is supported for your own .mp3/.wav/.m4a files.
await service.memorize(resource_url="meeting-audio.mp3", modality="audio")

context = await service.retrieve(
    queries=[{"role": "user", "content": {"text": "What matters for the next research plan?"}}],
)

4. Tool and Agent Learning

Turn execution traces into tool memories that tell future agents when to use a tool and what mistakes to avoid.

await service.memorize(resource_url="examples/resources/logs/log1.txt", modality="document")

context = await service.retrieve(
    queries=[{"role": "user", "content": {"text": "Which tools worked for config editing?"}}],
)

🗂️ Architecture

The compiled workspace is hierarchical enough for browsing and structured enough for direct retrieval:

structure
LayerPrimary RoleRetrieval Role
Category (folder)Maintain topic-level summariesAssemble compact context for broad queries
Item (file)Store typed atomic memoriesLoad precise facts, events, preferences, skills, and tool patterns
Resource (source)Preserve source artifacts and captionsRecall original context when item/category summaries are not enough

See docs/architecture.md for the runtime view of MemoryService, workflow pipelines, storage backends, and LLM routing.


🚀 Quick Start

Option 1: Cloud Version

👉 memu.so — Hosted API for managed ingestion, structured memory, and retrieval

For enterprise deployment: [email protected]

Cloud API (v3)

Base URLhttps://api.memu.so
AuthAuthorization: Bearer <token>
MethodEndpointDescription
POST/api/v3/memory/memorizeIngest raw data and build structured memory
GET/api/v3/memory/memorize/status/{task_id}Check processing status
POST/api/v3/memory/categoriesList auto-generated categories
POST/api/v3/memory/retrieveQuery memory for agent context

📚 Full API Documentation


Option 2: Self-Hosted

Installation

From a clone of this repository:

uv sync
# or, for the full development setup:
make install

To install the published package instead:

pip install memu-py

Requirements: Python 3.13+. The default examples use OpenAI, so set OPENAI_API_KEY or pass another provider through llm_profiles.

Run an in-memory smoke script:

export OPENAI_API_KEY=your_key
cd tests
uv run python test_inmemory.py

Run with PostgreSQL + pgvector:

uv sync --extra postgres
docker run -d --name memu-postgres \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=memu \
  -p 5432:5432 \
  pgvector/pgvector:pg16

export OPENAI_API_KEY=your_key
export POSTGRES_DSN=postgresql+psycopg://postgres:[email protected]:5432/memu
cd tests
uv run python test_postgres.py

Custom LLM and Embedding Providers

from memu import MemUService

service = MemUService(
    llm_profiles={
        "default": {
            "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
            "api_key": "your_key",
            "chat_model": "qwen3-max",
            "client_backend": "sdk"
        },
        "embedding": {
            "base_url": "https://api.voyageai.com/v1",
            "api_key": "your_key",
            "embed_model": "voyage-3.5-lite"
        }
    },
)

OpenRouter Integration

from memu import MemoryService

service = MemoryService(
    llm_profiles={
        "default": {
            "provider": "openrouter",
            "client_backend": "httpx",
            "base_url": "https://openrouter.ai",
            "api_key": "your_key",
            "chat_model": "anthropic/claude-3.5-sonnet",
            "embed_model": "openai/text-embedding-3-small",
        },
    },
    database_config={"metadata_store": {"provider": "inmemory"}},
)

📖 Core APIs

memorize() — Structure Raw Data

memorize
result = await service.memorize(
    resource_url="path/to/file.json",    # local file path or HTTP URL
    modality="conversation",            # conversation | document | image | video | audio
    user={"user_id": "123"},            # optional: scope to a user or agent
)
# Returns after processing completes:
# { "resource": {...}, "items": [...], "categories": [...], "relations": [...] }
  • Converts raw input into typed memory items
  • Categorizes and embeds items without manual tagging
  • Preserves source resources and item-category relations

retrieve() — Load Agent Context

retrieve
# The retrieval strategy is set once on the service via retrieve_config:
#   MemoryService(retrieve_config={"method": "rag"})   # vector-first recall
#   MemoryService(retrieve_config={"method": "llm"})   # LLM-ranked recall
result = await service.retrieve(
    queries=[{"role": "user", "content": {"text": "What are their preferences?"}}],
    where={"user_id": "123"},   # scope filter
)
# Returns:
# {
#   "needs_retrieval": true,
#   "original_query": "...",
#   "rewritten_query": "...",
#   "next_step_query": "...",
#   "categories": [...],
#   "items": [...],
#   "resources": [...]
# }
retrieve_config.methodBehaviorCostBest For
ragVector-first category/item/resource recall, with optional LLM routing and sufficiency checks enabled by defaultEmbeddings plus LLM calls unless route_intention and sufficiency_check are disabledFast scoped recall with controllable reasoning
llmLLM-ranked category/item/resource recallLLM ranking at each tierDeeper semantic ranking

💡 Example Workflows

Always-Learning Assistant

export OPENAI_API_KEY=your_key
uv run python examples/example_1_conversation_memory.py

Automatically extracts preferences, builds relationship models, and surfaces relevant context in future conversations.

Self-Improving Agent

uv run python examples/example_2_skill_extraction.py

Monitors agent actions, identifies patterns in successes and failures, auto-generates skill guides from experience.

Multimodal Context Builder

uv run python examples/example_3_multimodal_memory.py

Cross-references text, images, and documents automatically into a unified memory layer.


📊 Performance

memU achieves 92.09% average accuracy on the Locomo benchmark across all reasoning tasks.

benchmark

View detailed results: memU-experiment


🧩 Ecosystem

RepositoryDescription
memUCore workspace runtime — ingestion, extraction, retrieval
memU-serverBackend with real-time sync and webhook triggers
memU-uiVisual dashboard for browsing and monitoring memory

Quick Links:


🤝 Partners

Ten OpenAgents Milvus xRoute Jazz Buddie Bytebase LazyLLM Clawdchat


🤝 Contributing

# Fork and clone
git clone https://github.com/YOUR_USERNAME/memU.git
cd memU

# Install dev dependencies
make install

# Run quality checks before submitting
make check

See CONTRIBUTING.md for full guidelines.

Prerequisites: Python 3.13+, uv, Git


📄 License

Apache License 2.0


🌍 Community


Star us on GitHub to get notified about new releases!

// compatibility

Platformsapi
Operating systems
AI compatibilityclaude
LicenseNOASSERTION
Pricingopen-source
LanguagePython

// faq

What is memU?

From workspace to agent memory. It is open-source on GitHub.

Is memU free to use?

memU is open-source under the NOASSERTION license, so it is free to use.

What category does memU belong to?

memU is listed under mcp-servers in the Claudeers registry of Claude-compatible tools.

0 views
13,991 stars
unclaimed
updated 15 days ago

// embed badge

memU on Claudeers
[![Claudeers](https://claudeers.com/api/badge/memu.svg)](https://claudeers.com/memu)

// retro hit counter

memU hit counter
[![Hits](https://claudeers.com/api/counter/memu.svg)](https://claudeers.com/memu)

// reviews

// guestbook

0/500

// related in RAG & Knowledge

🔓

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 60-95% fewer tokens, same answers. Library, proxy, MCP server.

// ragheadroomlabs-ai/Python56,255Apache-2.0[ claude ]
🔓

A collection of notebooks/recipes showcasing some fun and effective ways of using Claude.

// raganthropics/Jupyter Notebook46,409MIT[ claude ]
🔓

✨ Light and Fast AI Assistant. Support: Web | iOS | MacOS | Android | Linux | Windows

// ragChatGPTNextWeb/TypeScript88,415MIT[ claude ]
🔓

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant contex…

// ragthedotmack/JavaScript86,462Apache-2.0[ claude ]

// built by

Ecosystem hubone of the most connected projects in the claude ecosystem · 28 connections

1 of its contributors also build on official projectsclaude-cookbooks

→ see how memU connects across the ecosystem