AgentStack
MCP verified MIT Self-run

Carrymem

mcp-lulin70-carrymem · by lulin70

Your portable AI memory — preferences, decisions, and corrections that follow you across models, tools, and devices. Zero-dependency, local-first, 85% PrefEval accuracy.

No reviews yet
0 installs
5 views
0.0% view→install

Install

$ agentstack add mcp-lulin70-carrymem

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Carrymem? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

CarryMem — Your AI Finally Remembers Who You Are

Stop teaching AI who you are every single conversation.

> Your portable AI memory — preferences, decisions, and corrections that follow you across models, tools, and devices.

Every time you open a new chat, you introduce yourself again. Your preferences, your decisions, your corrections — all forgotten. Switch from Cursor to Claude Code, from GPT to Claude, start from scratch every time.

You're not using AI. You're training it. Over and over.

CarryMem fixes this. It's a lightweight, zero-dependency memory system that stores who you are and makes that identity available to any AI tool. Your AI remembers your preferences, your past decisions, and the corrections you've made — so you can focus on building, not repeating yourself.

English | [中文](docs/i18n/README-CN.md) | [日本語](docs/i18n/README-JP.md) | [한국어](docs/i18n/README-KO.md) | [繁體中文](docs/i18n/README-ZH-TW.md)


🌟 The 30-Second Version

> 你每天见客户、开会、聊天,AI 问你一句你答一句,下次对话它又忘了你是谁。 > > CarryMem 让 AI 自动记住你的偏好和决策——不用每次重复说。装一次,所有 AI 工具通用。

Technical users: see PrefEval benchmarks (83.0% ICLR 2025 Oral) and [architecture docs](#-architecture) below.


Topics: ai-memory mcp claude-code agent-memory cursor obsidian preference-injection sqlite llm-tools portable-memory


What CarryMem Does

5 scenarios you'll recognize:

> "I don't want to tell AI my preferences every time" > "I prefer PostgreSQL" "Use React not Vue" "No comments in code" — say it once, remembered forever.

> "I switched AI tools and started from scratch" > Taught AI in Cursor, now teaching it again in Claude Code. CarryMem makes your AI memory follow you.

> "I want to take my data with me" > Your AI memory is yours. One file to pack, restore on any machine, any tool.

> "USB Carry — my memories in my pocket" 🔑 > Pack your memories to an encrypted .carry file, copy to USB, unpack on a new machine. Your AI identity travels with you — preferences, decisions, corrections, and rules all intact. Every agent on the new machine instantly knows who you are.

> "My team shares conventions across agents" > Team lead packs company rules as a Skill bundle, every team member installs it. All agents enforce the same conventions — no more "I didn't know we use SSL."


🎯 Real User Scenarios

Scenario 1: The Multi-Tool Developer

Monday:  Tell Cursor "I prefer dark mode, PostgreSQL, React"
Tuesday: Open Claude Code — it already knows your stack
Friday:  Switch to TRAE — same preferences, zero repetition

How: carrymem setup-mcp --all --global — one command, all tools share one memory.

Scenario 2: The USB Carry — New Machine, Same Identity

1. On your laptop:  carrymem pack -o my_identity.carry --encrypt
2. Copy my_identity.carry to USB drive
3. At new workplace: Install CarryMem on new machine
4. carrymem unpack my_identity.carry
5. Every agent on the new machine knows your preferences, decisions, and rules

Encrypted + SHA-256 checksum — your identity is safe even if the USB is lost.

Scenario 3: The Team Lead

1. Create team conventions as rules: "Always use SSL", "Never deploy on Friday"
2. Pack as Skill: carrymem rules pack rules.json --name team-conventions
3. Share the .json file with team
4. Each member: carrymem rules install team-conventions.json --scope company
5. All agents now enforce company conventions automatically

Scenario 4: The Long-Term User

Month 1: "I prefer dark mode" → stored as user_preference
Month 3: "Switch to light mode" → auto-supersedes old preference
Month 6: carrymem whoami → shows "I prefer light mode" (dark mode archived)

Preferences evolve. CarryMem tracks the history.


Get Started (pick your path)

Using Cursor / Claude Code / TRAE?

pip install carrymem && carrymem setup-mcp --all --global

Restart your AI tool. Done.

Verify it works (30 seconds)

Tell your AI:

Remember, I prefer PostgreSQL

Start a new conversation and ask:

What database do I prefer?

AI answers "PostgreSQL" — it works!

Need to move your memory?

carrymem pack                    # Creates carrymem_identity_20260526.carry
# Copy to USB / cloud / new machine
carrymem unpack my_identity.carry  # All memories restored

# With encryption for sensitive data
carrymem pack -o my_memories.carry --encrypt   # Password-encrypted .carry file
carrymem unpack my_memories.carry              # Auto-detects encryption, prompts for password

Auto-backup & Recovery

carrymem backup                  # Manual backup (also auto-backup every 20 writes)
carrymem backup --list           # List all backups
carrymem backup --restore memories_backup_20260527_120000.db  # Restore from backup

> 📊 Academically Verified: CarryMem's preference injection accuracy (83.0%) was measured using the PrefEval protocol (ICLR 2025 Oral, Amazon Science), outperforming simple reminder (80.0%) and zero-shot (71.5%) baselines across 200 test items. See [Citation](#citation) below.

4 Reasons to Choose CarryMem

These are what make CarryMem different from every other memory solution:

1. Preference Injection Precision — 83.0% (Academically Verified)

  • Measured by PrefEval (ICLR 2025 Oral, Amazon Science), 200-sample 3-condition comparison
  • CarryMem 83.0% > simple reminder 80.0% > zero-shot 71.5%
  • Proactive injection > full reminder — first system to prove this
  • 24% fewer unhelpful responses than reminder (28 vs 38) — more precise, less noisy

2. Zero-LLM Classification — 88% Without Calling Any LLM

  • Rule engine classifies 88% of memories with zero token cost
  • Only system with built-in rule engine (competitors: 0%)
  • P99 latency: 1.3ms — 93x faster than Mem0

3. Lightweight & Portable — SQLite Only

  • Zero external dependencies for core functionality
  • Single .db file — carry your identity anywhere
  • Works with Cursor, Claude Code, ChatGPT, any MCP client

4. Industrial-Grade Engineering — 4044 Tests / mypy 0 / ruff 0

  • 4044 tests passing with 82%+ coverage (tested: 7 memory types × 4 tiers × lifecycle)
  • mypy 0 errors across 143 source files — fully type-safe (CI blocking gate)
  • ruff 0 errors — clean codebase, no lint violations
  • 24 sensitive-pattern redaction — auto-detects API keys, passwords, tokens before storage
  • PatternAnalyzer God Class split (1547→171 LOC facade + 3 modules) — maintainable architecture
  • 394 docstrings added — 50%→100% public API documentation coverage
  • Maturity assessment: 80/100 (B) per 7-dimension DevSquad evaluation

How It Works

User Input → Auto-Classification (7 types, 88% rule-based) → Smart Storage (SQLite + FTS5)
    → Semantic Recall (cross-language) → Context Injection (token budget) → AI Tool

Quick Start

Install

pip install carrymem

> Requires Python 3.12+. Check your version: python --version

> From PyPI: https://pypi.org/project/carrymem/ > > For development: git clone https://github.com/lulin70/carrymem.git && cd carrymem && pip install -e ".[dev]"

System Requirements

  • Python: ≥3.12 (64-bit)
  • OS: macOS 10.15+, Ubuntu 20.04+, Windows 10+
  • Disk: ~5MB for core, ~200MB with semantic search
  • Memory: ~50MB base

Dependencies

| Feature | Package | Install | |---------|---------|---------| | Core | PyYAML≥5.0 | pip install carrymem (included) | | Multi-language | pycld2, langdetect | pip install carrymem[language] | | Semantic Search | sqlite-vec, sentence-transformers | pip install carrymem[semantic] | | Encryption | cryptography≥41.0 | pip install carrymem[encryption] | | Full (all features) | all above | pip install carrymem[full] | | Development | pytest, black, flake8... | pip install -e ".[dev]" |

> Zero LLM dependency for core features — classification uses rule engine only.

Verify Installation

carrymem version

If command not found, add Python bin to PATH:

# macOS (add to ~/.zshrc)
export PATH="$HOME/Library/Python/3.12/bin:$PATH"

# Linux (add to ~/.bashrc)
export PATH="$HOME/.local/bin:$PATH"

# Or use Python module directly
python3 -m carrymem.cli version

Then run carrymem doctor to check your setup.

5 Lines of Code

> ⚠️ Package vs Import Name: Install with pip install carrymem (lowercase), but import as from carrymem import CarryMem (CamelCase class). The package name (carrymem) and class name (CarryMem) differ in casing.

from carrymem import CarryMem

cm = CarryMem()
cm.classify_and_remember("I prefer dark mode")        # Auto-classified as preference
cm.classify_and_remember("Use PostgreSQL not MySQL")   # Auto-classified as correction
cm.classify_and_remember("I prefer light mode now", session_id="sess_002")  # Session-aware
memories = cm.recall_memories("database")              # Semantic recall
memories = cm.recall_memories("mode", filters={"session_id": "sess_002"})  # Filter by session
agg = cm.recall_aggregated()                           # Aggregate by type
timeline = cm.recall_timeline("database")              # Knowledge evolution
print(cm.build_system_prompt())                        # Inject into any AI
cm.close()

CLI (50+ commands)

carrymem init                           # Initialize
carrymem add "I prefer dark mode"       # Store a memory
carrymem add "test note" --force        # Force store (bypass classification)
carrymem list                           # List memories
carrymem search "theme"                 # Search memories
carrymem show                      # View memory details
carrymem edit  "new content"       # Edit a memory
carrymem forget                    # Delete a memory
carrymem whoami                         # Who your AI thinks you are
carrymem profile export --output identity.json   # Export your AI identity
carrymem stats                          # Memory statistics
carrymem check                          # Quality & conflict check
carrymem clean --expired --dry-run      # Preview cleanup
carrymem doctor                         # Diagnose installation
carrymem setup-mcp --tool cursor        # One-line MCP config
carrymem tui                            # Terminal UI
carrymem export backup.json             # Export all memories
carrymem import backup.json             # Import memories
carrymem pack -o my_memories.carry      # Pack into portable .carry file
carrymem pack -o my_memories.carry --encrypt  # Encrypted .carry file
carrymem unpack my_memories.carry       # Unpack .carry file
carrymem backup                         # Manual backup
carrymem backup --list                  # List backups
carrymem backup --restore         # Restore from backup
carrymem version                        # Show version
# Rule Engine commands
carrymem rules add "use SSL" --trigger "database" --type avoid  # Add a rule
carrymem rules list --status active                              # List active rules
carrymem rules suggest                                           # Suggest rules
# Also available: carrymem add-rule, carrymem list-rules (legacy aliases)
carrymem rules pack rules.json --name team-conventions   # Pack rules as Skill
carrymem rules install team-conventions.json --scope company  # Install Skill
carrymem rules verify team-conventions.json              # Verify Skill integrity

Core Features (powering the 3 advantages)

Memory That Understands You

Auto-Classification (7 Memory Types)

CarryMem automatically identifies what kind of information you're sharing:

| Type | Icon | Example | |------|------|---------| | user_preference | ⭐ | "I prefer dark mode" | | correction | 🔧 | "No, I meant Python 3.11 not 3.10" | | decision | 🎯 | "Let's use React for the frontend" | | fact_declaration | 📌 | "Python 3.12 is the runtime version" | | relationship | ❓ | "Sarah is my manager" | | task_pattern | 🔄 | "I always write tests first" | | sentiment_marker | 💭 | "This build is too slow" |

Semantic Recall (Cross-Language)
cm.classify_and_remember("我偏好使用PostgreSQL")

# All of these find it:
cm.recall_memories("PostgreSQL")     # Exact match
cm.recall_memories("数据库")          # Synonym expansion
cm.recall_memories("Postgres")       # Spell correction
cm.recall_memories("データベース")    # Cross-language (Japanese)
Identity Layer (whoami)
identity = cm.whoami()
print(identity["preferences"])   # ["I prefer dark mode", ...]
print(identity["decisions"])     # ["Let's use React", ...]
print(identity["corrections"])   # ["The port should be 5432", ...]
$ carrymem whoami

  Who You Are (according to your AI)
  ==================================================

  Your Preferences:
    ⭐ I prefer dark mode for all editors
    ⭐ I use PostgreSQL for databases
    ⭐ I always use Python for data analysis

  Your Decisions:
    🎯 Let's use React for the frontend

  Your Corrections:
    🔧 The port should be 5432, not 3306

  Memory Profile:
    Total: 19 | Dominant: user_preference | Avg Confidence: 73%

Preference Injection (advantage #1)

Version Chain — Preferences Evolve, Old Versions Auto-Archived
cm.update_memory(key, "Updated content")     # Creates version 2
history = cm.get_memory_history(key)          # [v1, v2]
cm.rollback_memory(key, version=1)            # Restore v1
Scope-Aware Injection — Only Inject Relevant Preferences Per Context

Preferences are injected based on context scope, so your database preferences don't clutter frontend discussions.

Token Budget — 60% Budget for Preferences, Never Truncated

CarryMem allocates 60% of the token budget to preferences, ensuring they're never cut off. This is the key to achieving 83.0% on PrefEval — structured preference injection beats simple reminders.

Memory Lifecycle (advantage #2)

Importance Scoring — Confidence × Type × Recency × Access

Every memory has an importance score that evolves over time:

importance = confidence × type_weight × recency_factor × access_factor
  • 30-day half-life decay — old memories fade unless accessed
  • Access reinforcement — frequently recalled memories stay fresh
  • Type weighting — corrections (1.3x) > decisions (1.2x) > preferences (1.1x)
Consolidation (P0/P1/P2) — Dedup + Decay + Pattern → Rules + Semantic Merge

Automatic memory lifecycle management with three phases:

# Preview what consolidation would do
report = cm.consolidate(dry_run=True)
print(f"Duplicates: {report['stats']['duplicates_found']}")
print(f"Decayed: {len(report['to_decay'])}")

# Run consolidation (P0: dedup + decay, P1: pattern promotion, P2: semantic merge)
report = cm.consolidate(dry_run=False, run_p1=True, run_p2=True)

| Phase | Function | Mechanism | |-------|----------|-----------| | P0 | Dedup + Decay | Jaccard similarity dedup, exponential half-life decay (preferences: 270d, facts: 90d, sentiments: 45d) | | P1 | Pattern → Rules | Detect repeated patterns → generate rule candidates for review | | P2 | Semantic Merge | Cluster related memories → request host LLM to consolidate |

Preferences are always preserved — never decayed or deduplicated.

Scheduled Consolidation — Automatic Background Maintenance

Run consolidation automatically on a recurring interval:

# Schedule consolidation every hour (runs in background thread)
cm.schedule_consolidation(interval_hours=1.0)

# Stop the scheduled consolidation
cm.stop_consolidation()

CLI:

carrymem consolidate --schedule 1h   # Run consolidation every hour
carrymem consolidate --stop          # Stop scheduled consolidation

Security & Portability (advantage #3)

Au

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.