Skip to main content

retain-memory

retain-memory is a small command-line tool and MCP server for keeping categorized memories in one local SQLite database. Memories have priorities from 1 (lowest) to 5 (highest) and UTC creation/update timestamps.

Categories are intentionally managed only through the CLI. MCP clients can list categories and create, retrieve, update, or delete memories within them.

Installation

Install uv, then install the CLI from PyPI:

uv tool install retain-memory

To install the current source checkout instead:

uv tool install .

Set MEMORY_FILE to the database location. The directory and database are created on first use:

export MEMORY_FILE="$HOME/.local/share/retain/memory.db"

CLI

Create and inspect categories:

retain category create projects
retain category list
retain category delete projects
retain category delete projects --force

--force is required to delete a category that contains memories.

Manage memories:

retain memory add projects "Publish the first release" --priority 5
retain memory list projects
retain memory get MEMORY_ID
retain memory update MEMORY_ID --content "Publish version 1.0" --priority 4
retain memory delete MEMORY_ID

Commands that return data print JSON. Category memory lists are ordered by priority descending and creation time descending.

MCP Installation

The PyPI package includes the retain-mcp stdio server. An MCP client can launch it without a separate installation through uvx. For clients using the common mcpServers configuration format:

{
  "mcpServers": {
    "retain": {
      "command": "uvx",
      "args": ["--from", "retain-memory", "retain-mcp"],
      "env": {
        "MEMORY_FILE": "/absolute/path/to/memory.db"
      }
    }
  }
}

If the package was installed with uv tool install retain-memory, use "command": "retain-mcp" and omit args. For development from this checkout, use "command": "uv" with "args": ["run", "--directory", "/absolute/path/to/retain", "retain-mcp"].

The MCP server exposes:

  • list_categories
  • get_memories
  • add_memory
  • update_memory
  • delete_memory

It does not expose category creation or deletion. Create categories with retain category create NAME before adding memories through MCP.

Development

uv sync --all-groups
uv run ruff check .
uv run ruff format --check .
uv run pytest
uv build

Publishing

GitHub Actions runs checks on pushes and pull requests. Pushing a version tag builds the wheel and source distribution and publishes them to PyPI using trusted publishing. Tags must use a v prefix and exactly match the version in pyproject.toml:

uv version 0.2.0
git add pyproject.toml uv.lock
git commit -m "Release 0.2.0"
git tag v0.2.0
git push origin main v0.2.0

Before the first release, create the retain-memory project (or a pending publisher) on PyPI and configure a trusted publisher with this repository, workflow publish.yml, and environment pypi. No PyPI API token is stored in GitHub.

Download files

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

Source Distribution

retain_memory-0.1.0.tar.gz (54.7 kB view details)

Uploaded Source

Built Distribution

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

retain_memory-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file retain_memory-0.1.0.tar.gz.

File metadata

  • Download URL: retain_memory-0.1.0.tar.gz
  • Upload date:
  • Size: 54.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for retain_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c13d009e3a6172f4232918bfe687ee004121910653022d173a93a3590ab6d45e
MD5 2985ca02c75bb4b8b7ec61a67c620634
BLAKE2b-256 9bd753e5aad896cf950a8fab63eb51fb79468ca9e75962ec3f7891ba887ed3c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for retain_memory-0.1.0.tar.gz:

Publisher: publish.yml on marcosousapoza/retain

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

File details

Details for the file retain_memory-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: retain_memory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for retain_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 856d0241f1941973ef0c5fa5e08581b9b07408a0a5a107db5674f9d7ea4d3097
MD5 cbf7319c0cea02ac1c054e2a669315c4
BLAKE2b-256 98616081ad6c027c0fa6f6ace4f0ec23cc92d4390b1085a2f1fff79157dc2dd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for retain_memory-0.1.0-py3-none-any.whl:

Publisher: publish.yml on marcosousapoza/retain

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