Skip to content
memtylabsPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Memty

Your AI memory, owned by you.

One private, local memory vault for every AI assistant you use: ChatGPT, Claude, Gemini, Perplexity, Cursor, and any MCP client.

PyPI Python License: MIT

Website · Quick start · How it works · Package docs · Changelog


Memty keeps the facts, decisions, and preferences you share with AI in one SQLite file on your own computer, and brings that memory to whichever assistant you open next. You stop repeating yourself, your memory isn't locked inside one company's product, and you can see, edit, and delete every fact.

  • Local-first: the vault lives at ~/.memty/ledger.sqlite3. There's no account, no cloud sync, and no telemetry.
  • Works everywhere: a browser extension for chat websites, MCP for desktop and coding tools, the clipboard for anything else, and a Python API.
  • You're in control: facts saved from chats are proposals you approve. You can edit, mark private, or permanently delete anything.
  • Private by design: private facts reach cloud AIs only as [private], and secret facts never leave your machine.

This repository contains two things:

What it is Status
The memty package The memory vault, CLI, MCP server, browser bridge and extension, and model-routing SDK On PyPI, v0.2.0
The web workspace A multi-provider AI chat app (Next.js, Express, and MongoDB) Run it yourself; see Web workspace

Status: Memty is in alpha (0.x). The vault's storage format is stable and covered by tests; commands and options may still change between minor versions.

🚀 Quick start

You need Python 3.10 or newer on Windows, macOS, or Linux.

pip install memty

memty serve --autostart   # start the local bridge now and at every login (one time)
memty extension --open    # install the browser extension folder and open it
memty connect             # optional: Claude Desktop, Claude Code, Cursor, Windsurf

Load the extension once: open chrome://extensions (or edge://extensions), turn on Developer mode, click Load unpacked, and choose the folder that opened. It pairs itself with Memty, so there's no token to copy.

Then, in ChatGPT, Claude.ai, Gemini, or Perplexity:

  • Select text → + Save to Memty. Memty proposes short facts. You edit or untick them, then save.

  • ⚡ Memty (Alt+M). Your facts go to the top of the message box, newest first, for you to check before sending:

    Database: PostgreSQL 16 on Neon
    Deploy target: Fly.io
    Editor: VS Code
    Client: [private]
    
  • ☰ Your facts. View, search, edit, add, delete, or mark facts private.

From the terminal:

memty remember work.project editor "VS Code"
memty recall "Which editor do I use?" --namespace work.project
memty clip work.project        # copy your facts for any AI app

🧭 How it works

flowchart TB
    W["ChatGPT · Claude.ai · Gemini · Perplexity"] -->|browser extension| B["memty serve<br/>local bridge, 127.0.0.1 only"]
    D["Claude Desktop · Claude Code · Cursor · Windsurf"] -->|MCP over stdio| M["memty mcp"]
    C["memty CLI · Python API"] --> Q
    B --> Q["memtyd<br/>one local daemon per vault"]
    M --> Q
    Q --> V[("~/.memty/ledger.sqlite3<br/>your vault")]
Loading
  1. Atomic facts: memory is stored as small namespace.slot = value facts of at most 40 tokens, for example work.project.editor = "VS Code". Saving a new value replaces the old one and keeps the history.
  2. Namespaces such as work.project and personal keep contexts apart. A chat only gets the namespace you choose.
  3. The compiler builds a small capsule for each request: newest facts first, or the most relevant ones for a question, always under a hard token budget.
  4. The privacy gate checks every capsule:
    • PUBLIC facts are shared.
    • INTERNAL facts only go to local or trusted providers.
    • CONFIDENTIAL facts appear as [private].
    • SECRET facts stop the request.
  5. You decide: automatic extraction can't overwrite facts you confirmed or bring back facts you deleted.

Picking facts from a chat uses fixed rules, not an AI model: bullets, Key: value lines, and short sentences are kept, while questions, headings, and code are skipped, and code blocks become one-line summaries. That makes it instant, free, and private. Set MEMTY_OLLAMA_MODEL to use a local Ollama model instead.

🔒 Privacy and data

What Where
Your facts ~/.memty/ledger.sqlite3, a single file on your disk
Extension pairing ledger.sqlite3.web-token and .web-paired.json, beside the vault (owner-only)
Browser storage Settings only (port, token, namespace, pill position), never facts
Cloud Nothing. Facts leave your computer only when you press Send in a chat.

How the local bridge is protected:

  • It listens only on 127.0.0.1.
  • Every request needs a token.
  • Web pages are refused, and only extensions you approved can connect (memty pair adds another browser).
  • It checks the Host header, which blocks DNS rebinding.

The vault file itself is not encrypted, so it relies on your computer account's protection. Keep it out of synced folders such as OneDrive or Dropbox unless you want it uploaded.

🧰 Commands

Command What it does
memty serve --autostart Start the browser bridge now and at every login (--no-autostart to undo)
memty extension Install or update the browser extension folder
memty pair Connect another browser or a reinstalled extension (two-minute window)
memty connect Connect Claude Desktop, Claude Code, Cursor, and Windsurf through their official installers
memty remember · recall · forget Save, compile, or permanently delete facts
memty list · history · stats Inspect facts, versions, and the vault
memty clip NS Copy a namespace's facts to the clipboard
memty summary · rule · rules Namespace summaries and logical rules
memty migrate PATH Import from an earlier Memty vault
memtyd status · start · stop Control the shared background daemon

The full reference, Python API, and security model are in the package README.

🖥️ Web workspace

The repository also contains a multi-provider AI chat workspace. Its account conversations and MongoDB memory are separate from the local vault and don't sync with it today.

Web workspace architecture: browser, Next.js, model providers, Express API, MongoDB, and optional local memory services

The browser talks to the Next.js app. Its chat route calls the selected model adapter and uses a private proxy to reach the Express service for account sessions and saved data.

flowchart LR
    U[Your message] --> C[Next.js chat route]
    C --> M[Context and memory lookup]
    M --> R[Selected provider adapter]
    R --> A[Assistant response]
    A --> P[Persist conversation and usage]
Loading

Run it locally

You need Node.js 20.9 or later, MongoDB for sign-in and saved data, and credentials for the providers you want to use.

npm install
cd backend
npm install
cd ..
Copy-Item .env.example .env
Copy-Item backend/.env.example backend/.env

Add your MongoDB URI and provider keys, keep these files private, then start two terminals from the repository root:

npm run dev              # Terminal 1: Next.js app on http://localhost:3001
cd backend; npm run dev  # Terminal 2: Express API on port 3002

Without provider credentials, those models are shown as unavailable.

Docker Compose

Compose starts the frontend, backend, and optional Memty HTTP vault service; MongoDB stays external. Before you start it:

  1. Create the environment files as above.
  2. In backend/.env, set a reachable MONGO_URI and a stable SESSION_SECRET.
  3. In .env, replace the example MEMORY_VAULT_API_TOKEN with a random secret of at least 32 characters.
docker compose up --build

Open http://localhost:3001. Stop the stack with Ctrl+C or docker compose down. Compose doesn't migrate MongoDB memories into the local vault.

Configuration

The root .env configures Next.js and the model providers. backend/.env configures MongoDB and the Express service; the backend loads the root file first, then applies its own values.

Setting Service Purpose
GEMINI_API_KEY, CLAUDE_API_KEY, GROK_API_KEY, KIMI_API_KEY Frontend and/or backend Enable the corresponding models
OPEN_ROUTER_OPEN_API_KEYS, OPEN_ROUTER_API_KEY Frontend Enable OpenRouter-backed models
MONGO_URI, MONGO_DATABASE, MEMORY_DATABASE Backend Account and memory databases
SESSION_SECRET Backend Signs sessions; use a stable, high-entropy value in production
PROXY_TARGET Frontend Backend URL (default http://localhost:3002)
MEMORY_VAULT_API_URL, MEMORY_VAULT_API_TOKEN Backend and vault Connect the backend to the optional vault API

See .env.example and backend/.env.example for every option. Never commit real credentials or paste them into issues.

For semantic memory retrieval, create the Atlas Search vector index on Memory.user_memories from backend/memory-vector-index.json. It expects 768-dimensional cosine vectors and filters on userId and status. Without the index or an embedding service, retrieval falls back to lexical and recency scoring.

🔀 Model-routing SDK

The same memty package includes prompt-aware model routing and a multi-provider chat client:

memty init      # writes ~/.memty/models.json; set each provider's API key in your environment
memty models
memty route "Review this Python function"
memty chat --interactive --chat-id work
from memty import load_client

client = load_client()  # reads ~/.memty/models.json
answer = client.chat("Review this Python function", chat_id="code-review")
print(answer.model_id, answer.text)

The router doesn't use the vault to choose models yet; memory-aware routing is on the roadmap.

🗺️ Project map

Path What lives here
memty/ The Python package: vault, compiler, CLI, daemon, MCP server, web bridge, and fact extraction
memty/browser_extension/ The Memty Bridge browser extension (shipped inside the package)
memoryport/ Model-routing SDK and compatibility code for older vaults
tests/ Package tests (python -m pytest tests)
GitPage/ The product website, deployed to GitHub Pages on every change to main
app/ Web workspace: Next.js pages, API routes, and chat orchestration
backend/ Web workspace: Express routes, authentication, and MongoDB models
providers/ Web workspace: model registry, provider adapters, and fallbacks
components/ · lib/ · public/ · templates/ · static/ Shared UI pieces, legacy markup, and static assets
assets/ Logos and artwork
scripts/ Helper scripts, including the extension icon generator
compose.yaml · Dockerfile · Dockerfile.vault Container builds and the Compose stack

🛣️ Progress and roadmap

Milestone Status
Week 1: atomic vault, versioning, permanent deletion, privacy gate, token-bounded compiler ✅ Shipped
Week 2: shared memtyd daemon, MCP server, safe memty connect ✅ Shipped
Week 3: browser extension, fact manager, readable capsules, local extraction, pairing, autostart, PyPI v0.2.0 ✅ Shipped
Chrome Web Store listing (one-click install) ⏭️ Next
Memory-aware model routing 🗓️ Planned
Reproducible public benchmarks (recall accuracy, tokens, cost) 🗓️ Planned

See the changelog for details.

⚠️ Known limitations

  • The extension isn't on the Chrome Web Store yet. It's loaded as an unpacked folder with Developer mode, in Chrome, Edge, or Brave.
  • The vault is plain SQLite on disk. There's no built-in encryption or sync.
  • Fact extraction reads the shape of text, not its meaning. That's why every proposal is reviewed before saving.
  • Chat sites change often, so the extension's page detection is best effort. Selecting text always works.
  • The web workspace isn't ready for a public launch as-is:
    • Chat responses aren't streamed.
    • Request limits are per process.
    • Launching publicly needs account deletion and retention, abuse controls, monitoring, backups, and a security review.
    • Model availability and prices depend on the providers.
    • Cost figures are estimates, not billing records.

Review the Privacy Notice and Terms against your deployment before releasing the web workspace.

📚 Documentation

🤝 Contributing

Start with the contributor guide, pick the guide for the area you're changing, and choose a focused issue. Run python -m pytest tests before opening a pull request, and keep credentials and personal data out of commits and issues.

📄 License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors