Skip to main content

Personal conversation knowledge base — import, search, and analyze conversations from ChatGPT, Claude, Gemini, and Claude Code

Project description

memex

Personal conversation knowledge base. Import, search, and analyze conversations from ChatGPT, Claude, Gemini, and Claude Code. MCP-first for LLM agent access.

Install

pip install py-memex

For development:

git clone https://github.com/queelius/memex
cd memex
pip install -e ".[dev]"

Quick Start

Import conversations:

memex import conversations.json          # auto-detects format
memex import ~/.claude/projects/          # directory of Claude Code sessions
memex import export.json --format openai  # force format

Browse and search:

memex show                               # list conversations
memex show <id>                          # view a conversation
memex show --search "topic"              # full-text search

Database stats (sqlflag-powered):

memex db                                 # list subcommands
memex db conversations --format json     # query conversations table
memex db schema                          # inspect structure
memex db sql "SELECT count(*) FROM conversations"

Export:

memex export output.md --format markdown
memex export output.json --format json
memex export ./archive --format arkiv    # universal archive format
memex export ./site --format html        # self-contained HTML SPA

MCP server (for Claude Desktop, agent SDKs, etc.):

memex mcp

Scripts:

memex run --list                                           # available scripts
memex run redact --words "secret" --level word --apply
memex run redact --pattern-file api_keys.txt --apply
memex run enrich_trivial --apply

Supported Formats

Format Import Export Notes
OpenAI (ChatGPT) Yes - JSON export
Anthropic (Claude) Yes - JSON export
Gemini Yes - JSON export
Claude Code Yes - JSONL, conversation-only mode
Claude Code (full) Yes - Full fidelity: tool_use, thinking, subagents
Markdown - Yes
JSON - Yes
HTML (SPA) - Yes Self-contained, light/dark, librarian chat
Arkiv - Yes Universal record format (JSONL + schema.yaml)

HTML Export

The HTML exporter builds a self-contained single-page app that loads the SQLite database client-side via sql.js (Wasm). Features:

  • Light/dark mode: follows OS preference with a manual toggle
  • Full browser UI: conversation list, search, filter by source/tag, timeline sparkline
  • Librarian chat: ask questions about your archive. An LLM queries the database via Anthropic tool use, using the metafunctor-edge proxy by default (no API key required). You can also configure a direct Anthropic endpoint.
  • Per-conversation resume chat: continue an existing conversation

Multi-Database Config

memex supports multiple named databases via ~/.memex/config.yaml:

primary: conversations
databases:
  conversations:
    path: ~/.memex/conversations
  claude_code_full:
    path: ~/.memex/claude_code_full
  sandbox:
    path: ~/.memex/sandbox

All CLI commands and MCP tools accept --db <name> (CLI) or db=<name> (MCP) to target a specific database. The primary database is used when no name is specified.

MCP Tools

When running as an MCP server, memex exposes 5 tools:

  • execute_sql: Primary read interface. All queries via SQL (read-only by default).
  • get_conversation: Tree-aware retrieval + export (metadata, messages, markdown/JSON).
  • get_conversations: Bulk retrieval with filters (tag, source, model, search, ids) and optional full messages.
  • update_conversations: Modify properties, tags, and enrichments (bulk).
  • append_message: Add messages to conversation trees.

Resources: memex://schema (DDL + query patterns), memex://databases (multi-db discovery + stats).

Development

pytest tests/memex/ -v             # run tests
pytest tests/memex/ --cov=memex    # with coverage

License

MIT

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

py_memex-0.10.1.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

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

py_memex-0.10.1-py3-none-any.whl (73.6 kB view details)

Uploaded Python 3

File details

Details for the file py_memex-0.10.1.tar.gz.

File metadata

  • Download URL: py_memex-0.10.1.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for py_memex-0.10.1.tar.gz
Algorithm Hash digest
SHA256 9ff57ddfcd97bb7c283da0e8ad26430cc80dc99d770fb64add18bfa4df579ba1
MD5 43e1ef9d1030386f7a331dcb286f777c
BLAKE2b-256 db3a54375299b482f344de331b6f85574e9a9e89220701b478762d5a53b456ad

See more details on using hashes here.

File details

Details for the file py_memex-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: py_memex-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 73.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for py_memex-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d700dd0370a93302162003bf1bce05aedaa37dbf3fbdb8b89c1caa49b088f7d
MD5 a692847f10255cff77b3ebef1f09eae5
BLAKE2b-256 ac8bd4b77d258f34d8df64e1417392cc757193599ff563987795c7fb5ac68104

See more details on using hashes here.

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