Skip to main content

CLI distribution channel for memU (same engine as memu-py). Personal memory as files.

Project description

MemU Banner

memU

Personal memory, stored as files

Across Agents. Fast retrieval. Lower cost.

PyPI version License: Apache 2.0 Python 3.13+ Discord Twitter

NevaMind-AI%2FmemU | Trendshift


memU is a 500-line memory system for AI agents. Agents write what's worth keeping as Markdown; memU stores it, embeds it, and retrieves ranked context in a single call — embeddings are the only model calls it makes. The entire memory logic lives in agentic.py + service.py; everything else is pluggable storage and embedding transport.

Quick start

from memu.app import MemoryService

service = MemoryService(
    database_config={"metadata_store": {"provider": "sqlite", "dsn": "sqlite:///memu.sqlite3"}},
)

# 1. Persist agent-prepared memory: recall files (memory/skill tracks) + resources
await service.commit_results(
    recall_files=[
        {
            "name": "Profile",
            "track": "memory",
            "description": "who the user is",
            "content": "# Profile\n- prefers dark roast coffee\n- ships on Fridays",
        },
        {
            "name": "deploy-checklist",
            "track": "skill",
            "description": "how to deploy this repo",
            "content": "1. run tests\n2. tag\n3. push",
        },
    ],
    resource=[{"path": "/abs/path/notes.md", "description": "meeting notes from the launch review"}],
)

# 2. See what is stored, across every track
files = await service.list_all_recall_files()

# 3. Single-shot embedding retrieval over segments / files / resources
context = await service.progressive_retrieve("What should I know about this user's launch preferences?")

Or straight from the terminal — no code:

export OPENAI_API_KEY=sk-...    # embedding API key — the only model calls memU makes

npx memu-cli commit results.json     # {"recall_files": [...], "resource": [...]}
npx memu-cli list-files
npx memu-cli retrieve "What should I know about this user's launch preferences?"

State persists in a local SQLite database (./data/memu.sqlite3 by default), so commit in one invocation and retrieve in the next.

How it works

memU memory system architecture

The data model

Memory is a set of recall files — one Markdown document per topic (track="memory") or per learned skill (track="skill"). Committing a file also writes its search index:

Record What it is How it's embedded
RecallFile The Markdown document itself (name, track, description, content) name: description, once at creation
RecallFileSegment Searchable slices of a file memory track: one per content line (headings skipped); skill track: one name: description segment per skill
Resource A raw source on disk (url, caption) its one-line caption

Segments are reconciled on every commit: lines that disappeared are deleted, only genuinely new lines are embedded, unchanged lines keep their vectors — so re-committing a lightly edited file is nearly free.

Retrieval

progressive_retrieve(query) embeds the query once and returns three ranked layers:

  • segments — the matched slices, narrowest and usually most on-point, each with a score
  • files — the documents those segments belong to (usually what you want), each scored by its best segment and carrying its linked resource_urls
  • resources — matching raw sources, for when summaries are not enough

There is no intention routing, sufficiency checking, or summarization — one embedding call in, ranked context out.

Host adapter: memory for desktop coding agents

memu-codex runs memU as a sidecar to Codex-style agents (ADR 0008/0009). It binds two seams:

  • record — a scheduled bridging task slices new session logs into self-contained job files; the agent itself distills them into memory/skill Markdown; commit submits whatever the agent left on disk back through commit_results.
  • inject — a standing instruction in the host's global instruction file (~/.codex/AGENTS.md) tells the agent to run memu-codex retrieve (→ progressive_retrieve) before answering.

Installation is agent-driven. The install guide is written for the agent, not for you — install the package, then hand the guide to your agent and let it do the rest (configure the store, register the scheduled bridging task, patch the instruction file — each step ends with a verify gate):

pip install memu-cli    # puts memu + memu-codex on PATH

Then tell your agent:

Run memu-codex docs install, read the guide it prints, and follow it to install memU.

Afterwards memu-codex doctor proves the whole loop resolves: config, store, and a live retrieval.

Adding another host means implementing one TranscriptSource (where its session logs live, how its records are shaped) plus a thin CLI — the pipeline and instruction text are shared.

Installation

pip install memu-cli         # library + memu + memu-codex CLIs
npx memu-cli --help          # CLI via npm launcher (engine: PyPI package memu-cli)
uvx --from memu-cli memu     # CLI via uv, no install

Configuration

Values resolve in order: process env → ~/.memu/config.env → default. Every CLI flag has a matching variable:

Setting Env var Default
Store MEMU_DB ./data/memu.sqlite3 (CLI); required for host adapters
Embedding provider MEMU_EMBED_PROVIDER openai (also: jina, voyage, doubao, openrouter); legacy MEMU_LLM_PROVIDER still read
API key MEMU_API_KEY the provider's env var, e.g. OPENAI_API_KEY
Embedding model MEMU_EMBED_MODEL the provider's default
Base URL MEMU_BASE_URL the provider's default

Storage backends

Provider DSN Vector search Use for
inmemory brute-force cosine tests, throwaway sessions
sqlite sqlite:///path.sqlite3 brute-force cosine local/default, single writer
postgres postgresql://... pgvector concurrent access, large stores (pip install "memu-cli[postgres]")
service = MemoryService(
    database_config={"metadata_store": {"provider": "postgres", "dsn": "postgresql://..."}},
    embedding_profiles={"default": {"provider": "jina"}},
)

Multi-tenancy

Every record carries optional scope fields (user_id, agent_id by default). Pass user= on writes and where= on reads to partition one store:

await service.commit_results(recall_files=[...], user={"user_id": "alice"})
await service.progressive_retrieve("launch preferences", where={"user_id": "alice"})

Need different scope fields? Supply your own model — filters are validated against it, unknown fields raise:

from pydantic import BaseModel

class TeamScope(BaseModel):
    team_id: str | None = None
    user_id: str | None = None

service = MemoryService(user_config={"model": TeamScope})

Development

make install     # uv sync + pre-commit hooks
make test        # pytest with coverage
make check       # lock check, pre-commit, mypy, deptry

Architecture decisions live in docs/adr/ — notably tracked workspace memorization (ADR 0006), the segment/file/resource retrieval lines (ADR 0007), and the host-adapter seams (ADR 0008/0009).

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memu_cli-0.2.0.tar.gz (10.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

memu_cli-0.2.0-cp313-abi3-win_amd64.whl (202.4 kB view details)

Uploaded CPython 3.13+Windows x86-64

memu_cli-0.2.0-cp313-abi3-manylinux_2_39_x86_64.whl (334.8 kB view details)

Uploaded CPython 3.13+manylinux: glibc 2.39+ x86-64

memu_cli-0.2.0-cp313-abi3-manylinux_2_39_aarch64.whl (328.2 kB view details)

Uploaded CPython 3.13+manylinux: glibc 2.39+ ARM64

memu_cli-0.2.0-cp313-abi3-macosx_11_0_arm64.whl (303.6 kB view details)

Uploaded CPython 3.13+macOS 11.0+ ARM64

memu_cli-0.2.0-cp313-abi3-macosx_10_12_x86_64.whl (304.8 kB view details)

Uploaded CPython 3.13+macOS 10.12+ x86-64

File details

Details for the file memu_cli-0.2.0.tar.gz.

File metadata

  • Download URL: memu_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 10.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memu_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3dbbe90fb3fa39f7043e12c2031b0bd5db8865949cfffa20601628cd58562263
MD5 e07a9f3dfb3f19b1c575bfc12e05d13b
BLAKE2b-256 cfd9c2887711b07416c933ba7ef12a36dbddafb107f80d651e9066bcb19c4702

See more details on using hashes here.

Provenance

The following attestation bundles were made for memu_cli-0.2.0.tar.gz:

Publisher: publish-memu-cli.yml on NevaMind-AI/memU

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memu_cli-0.2.0-cp313-abi3-win_amd64.whl.

File metadata

  • Download URL: memu_cli-0.2.0-cp313-abi3-win_amd64.whl
  • Upload date:
  • Size: 202.4 kB
  • Tags: CPython 3.13+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memu_cli-0.2.0-cp313-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b5dcfa768d1f80dbff0c92defefda3317443377275b33979b352410f47b14f90
MD5 c43cc744f788d287f2803a82fe48c3da
BLAKE2b-256 16c4169c644934e3ae1ade608245a7d059546f34810414ff82caed080baf36f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for memu_cli-0.2.0-cp313-abi3-win_amd64.whl:

Publisher: publish-memu-cli.yml on NevaMind-AI/memU

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memu_cli-0.2.0-cp313-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for memu_cli-0.2.0-cp313-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f9caa24c9815c47592f33c0f6fe8314b82bf85f989bdb48cdfa7a3a08e767325
MD5 7cb64d9b367197e21de82b1e15d2fc4b
BLAKE2b-256 ba82e794f686f430ac432e7aab39f12bf516b22d18cd60aa3760a815d9a85efe

See more details on using hashes here.

Provenance

The following attestation bundles were made for memu_cli-0.2.0-cp313-abi3-manylinux_2_39_x86_64.whl:

Publisher: publish-memu-cli.yml on NevaMind-AI/memU

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memu_cli-0.2.0-cp313-abi3-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for memu_cli-0.2.0-cp313-abi3-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 aa12430049b8698f0ca6ac7eb2e29e7cffc441ce8c142dc3f1d115fa30acff96
MD5 7c0249a3a8c0663c3eb5850e2534bbf9
BLAKE2b-256 74d0e19f24a396d021f070cc05006f2eba00c8f32da72b1882fb7e4b5959a8b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for memu_cli-0.2.0-cp313-abi3-manylinux_2_39_aarch64.whl:

Publisher: publish-memu-cli.yml on NevaMind-AI/memU

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memu_cli-0.2.0-cp313-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for memu_cli-0.2.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dbf38c59259fe77793d6d82abf421bfc9e0909cc94b65bddd8a02cce0eba83a5
MD5 52ba635c46771c418fbc4a634055872d
BLAKE2b-256 914033400dff7f3fb4e9b1adb9c1a8839d357c8b94b634f5c13b7bb4e0aef82c

See more details on using hashes here.

Provenance

The following attestation bundles were made for memu_cli-0.2.0-cp313-abi3-macosx_11_0_arm64.whl:

Publisher: publish-memu-cli.yml on NevaMind-AI/memU

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memu_cli-0.2.0-cp313-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for memu_cli-0.2.0-cp313-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 340d234f58e79a1387ed7d97801463061c810be18520d3ade3772961884f683b
MD5 22add4aa953c44b4c1928861618642fb
BLAKE2b-256 051aa1289f28ac7e9141535d7908d15bd61e99a47267fb3261bbbf9aef6072ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for memu_cli-0.2.0-cp313-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-memu-cli.yml on NevaMind-AI/memU

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page