Skip to main content

AI Agent Portable Memory

Carry your context across any AI — ChatGPT, Claude, Gemini, Grok, or any LLM.

Instead of losing your work every time you switch AI tools or start a new chat, AI Agent Portable Memory lets you save compact, structured session summaries and load them instantly into any AI conversation.


The Problem

Every AI session starts blank. You lose:

  • What you were building
  • Decisions you already made
  • Where you stopped

Copy-pasting raw chat logs wastes too many context tokens and is unmanageable.

The Solution

A portable memory store that:

  1. Compresses your session into a structured, token-efficient summary using an LLM
  2. Lets you review and edit the summary before saving
  3. Stores it locally (SQLite) or in the cloud (Supabase, S3/R2, Firebase)
  4. Loads it as a clean context block you paste into any AI

Install

pip install ai-agent-portable-memory

Or from source:

git clone https://github.com/your-username/AI-Agent-Portable-Memory
cd AI-Agent-Portable-Memory
pip install -e .

For cloud storage backends:

pip install "ai-agent-portable-memory[supabase]"   # Supabase
pip install "ai-agent-portable-memory[s3]"         # AWS S3 or Cloudflare R2
pip install "ai-agent-portable-memory[firebase]"   # Firebase Firestore
pip install "ai-agent-portable-memory[all]"        # Everything

Quick Start

1. Set your LLM API key

export OPENAI_API_KEY=sk-...          # OpenAI (default)
# or
export ANTHROPIC_API_KEY=sk-ant-...   # Claude
# or
export GROQ_API_KEY=gsk_...           # Groq (free tier available)

2. Save a session

memory save

Paste your chat transcript, press Ctrl+D. The LLM compresses it into a structured summary, your editor opens for review, and it's saved.

3. List your sessions

memory list
╭────┬──────────┬──────────────────────────────────┬───────────┬──────────────────╮
│ #  │ ID       │ Title                            │ Project   │ Updated          │
├────┼──────────┼──────────────────────────────────┼───────────┼──────────────────┤
│ 1  │ a3f2c1b0 │ JWT Auth Middleware — halfway     │ ecommerce │ 2026-11-18 14:30 │
│ 2  │ 9e1d4a72 │ PostgreSQL schema design         │ ecommerce │ 2026-11-17 09:15 │
│ 3  │ 7c8b3f91 │ React dashboard setup            │ dashboard │ 2026-11-16 18:00 │
╰────┴──────────┴──────────────────────────────────┴───────────┴──────────────────╯

4. Load context into any AI

memory load 1          # by list number
memory load a3f2c1b0   # by ID prefix
memory load 1 --copy   # copy to clipboard

Paste the output at the start of your new AI chat. The AI instantly knows where you left off.


What a session summary looks like

## Title
JWT Auth Middleware — halfway through refresh token rotation

## Project
ecommerce

## What we were doing
Building JWT authentication for a React + Node.js e-commerce app.

## What was completed
- Login page UI (src/pages/Login.tsx)
- JWT token generation on backend (src/auth/jwt.js)
- httpOnly cookie setup on login endpoint

## Key decisions made
- httpOnly cookies instead of localStorage — XSS protection
- Access token TTL: 15min, Refresh token TTL: 7 days
- Library: jsonwebtoken v9

## Current state / where we stopped
Halfway through refresh token rotation middleware.
File: src/middleware/refreshToken.js — function written, error handling missing.

## Next steps
1. Finish error handling in refreshToken.js
2. Add protected route wrapper component
3. Test full auth flow with Postman

## Important context
- Backend: Express.js on port 3001
- Frontend: React + Vite on port 5173
- DB: PostgreSQL with Prisma ORM
- Auth route prefix: /api/auth

## Tags
react, nodejs, jwt, auth, express, postgresql

Compact. Structured. Ready to paste.


Configuration

Create a .env file or set environment variables:

# Storage backend (default: sqlite)
MEMORY_BACKEND=sqlite

# LLM provider for compression (default: openai)
MEMORY_LLM_PROVIDER=openai

# LLM API keys
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GROQ_API_KEY=gsk_...

Storage Backends

SQLite (default — no setup required)

MEMORY_BACKEND=sqlite
SQLITE_DB_PATH=~/.ai-memory/memory.db   # optional, this is the default

Supabase

MEMORY_BACKEND=supabase
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_KEY=your-anon-key

Run this SQL in your Supabase project:

CREATE TABLE sessions (
    id          TEXT PRIMARY KEY,
    project     TEXT NOT NULL DEFAULT 'default',
    title       TEXT NOT NULL,
    summary     TEXT NOT NULL,
    tags        JSONB NOT NULL DEFAULT '[]',
    created_at  TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at  TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX ON sessions USING GIN (to_tsvector('english', title || ' ' || summary));

Cloudflare R2 / AWS S3

MEMORY_BACKEND=s3
S3_BUCKET_NAME=my-memory-bucket
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...

# For Cloudflare R2 (add this):
S3_ENDPOINT_URL=https://<account_id>.r2.cloudflarestorage.com

Firebase Firestore

MEMORY_BACKEND=firebase
FIREBASE_CREDENTIALS_PATH=./serviceAccountKey.json
FIREBASE_PROJECT_ID=my-firebase-project

CLI Reference

memory list                      List all sessions
memory list --project myapp      Filter by project

memory load <id>                 Print session context
memory load <id> --copy          Copy context to clipboard

memory save                      Save new session (paste transcript)
memory save --provider anthropic Use a specific LLM provider
memory save --project myapp      Set project name
memory save --no-edit            Skip editor review

memory search <query>            Search sessions by keyword
memory search auth --project api Filter search by project

memory delete <id>               Delete a session

memory config                    Show current configuration

How it works

Your chat  →  memory save  →  LLM compresses  →  You review  →  Stored
                                                                    ↓
New AI chat  ←  paste  ←  memory load  ←  compact summary  ←  Retrieved

Contributing

PRs welcome. To add a new storage backend, implement the BaseBackend interface in memory/backends/base.py.

License

MIT

Metadata

Release files for ai-agent-portable-memory 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-agent-portable-memory 0.1.2
File Size Uploaded Provenance Actions
ai_agent_portable_memory-0.1.2.tar.gz 14.9 kB Without provenance Details for ai_agent_portable_memory-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-agent-portable-memory 0.1.2
File Interpreter ABI Platform Actions
ai_agent_portable_memory-0.1.2-py3-none-any.whl Python 3 none any Details for ai_agent_portable_memory-0.1.2-py3-none-any.whl

Total release size: 32.0 kB

Release files / ai_agent_portable_memory-0.1.2.tar.gz

Download URL ai_agent_portable_memory-0.1.2.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3583899cb2a848ec3fa11127297039e17d99e92932c375c438a217dd6eadfcca
BLAKE2b-256 checksum
How to use checksums
80e6aee8bc9dab87e6e9f29365f99526e0eb318402a9c3c45e6eff8ada59f147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / ai_agent_portable_memory-0.1.2-py3-none-any.whl

Download URL ai_agent_portable_memory-0.1.2-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1256295d7c3360aa490996557dcf1a58bb931662df397cb241a51d1cc687591
BLAKE2b-256 checksum
How to use checksums
4f93a12b0c68ed87f06d667a4cdc5162b1b411087bbfb2499ff034a84bed2278
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for ai-agent-portable-memory 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page