Skip to main content

AgentRecall

PyPI Python License: MIT

Persistent two-tier memory for AI agents. Battle-tested across 134 sessions with 10 agent roles.

Short-term (markdown files, always loaded) + Long-term (SQLite + OpenAI embeddings, searched on-demand).

Install

pip install agentrecall-memory

Zero required dependencies. SQLite is Python stdlib.

Optional semantic search:

pip install agentrecall-memory[embeddings]
export OPENAI_API_KEY="sk-..."

Quick Start

CLI

# Initialize
agentrecall init

# Store a memory (auto-dedup via cosine similarity >0.92)
agentrecall store coder gotchas "kamal app exec spawns new container, use docker exec"
agentrecall store social exhausted_stories "blue-green deploy order loss" --tags deploy,sqlite

# Search (semantic + keyword fallback)
agentrecall search coder gotchas "kamal file not found"

# List categories
agentrecall list coder

# Check health
agentrecall check --all

Python API

from agentrecall import MemoryStore, MemorySearch

# Store
store = MemoryStore()
store.store("coder", "gotchas", "kamal spawns new container", tags=["kamal", "docker"])

# Search
search = MemorySearch()
results = search.search("coder", "gotchas", "kamal file not found")
for text in results:
    print(text)

# List categories
categories = store.list_categories("coder")

How It Works

Two-Tier Design

Short-term (memory/<role>.md) Long-term (SQLite + embeddings)
Active learnings, mistakes, feedback Growing lists (exhausted topics, defect patterns)
Max 80 lines, pruned regularly Unlimited entries, never pruned
Read in full at session start Searched on-demand per query

Semantic Dedup

Every store call embeds the text via OpenAI text-embedding-3-small and checks cosine similarity against all existing entries in the same role/category. Similarity > 0.92 blocks the store (raises DuplicateError).

Without an API key, falls back to exact text matching.

Search

  1. Embed the query
  2. Compute cosine similarity against all entries with embeddings
  3. Return entries above threshold (0.75), sorted by similarity
  4. If no embedding matches: keyword fallback (>=50% keyword match)
  5. No API key: keyword-only search

Graceful Degradation

Works fully offline without an OpenAI API key:

  • Store: exact text dedup (case-insensitive)
  • Search: keyword matching (>=50% of query words must appear)

Agent Skills

Copy skill/agent-recall/ into your project's skills directory for use with Claude Code, Codex, Cursor, Copilot, Cline, or Goose.

cp -r skill/agent-recall/ .claude/skills/agent-recall/

Configuration

Environment variables:

Variable Default Description
AGENT_RECALL_HOME ~/.agentrecall Memory storage directory
OPENAI_API_KEY (none) OpenAI API key for embeddings
UT_OPENAI_API_KEY (none) Preferred over OPENAI_API_KEY

CLI Reference

agentrecall store <role> <category> "text" [--tags t1,t2] [--db path]
agentrecall search <role> <category> "query" [--db path]
agentrecall list <role> [--db path]
agentrecall check [--fix] [--long-term] [--all] [--dir path] [--db path]
agentrecall init [--dir path]
agentrecall migrate [--dry-run] [--rebuild] [--dir path] [--db path]

Exit codes: 0 = success/found, 1 = not-found/validation-fail, 2 = input error.

Migration from JSONL

If you have existing JSONL memory files:

agentrecall migrate --dir /path/to/memory/
agentrecall migrate --rebuild  # Re-embed entries missing embeddings

License

MIT

Metadata

Release files for agentrecall-memory 0.1.1

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

Source distribution (sdist)

Source distribution for agentrecall-memory 0.1.1
File Size Uploaded Provenance
agentrecall_memory-0.1.1.tar.gz 23.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentrecall-memory 0.1.1
File Interpreter ABI Platform
agentrecall_memory-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 43.0 kB

Release files / agentrecall_memory-0.1.1.tar.gz

Download URL agentrecall_memory-0.1.1.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
04402b1c45d04588a3b5989e58187971d86eb41ac9134668aaa3403af711e1c6
BLAKE2b-256 checksum
How to use checksums
a077f7128cbedf4359c76efc295a66a251fc1f4c5ba545a17136e8fb74e32076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / agentrecall_memory-0.1.1-py3-none-any.whl

Download URL agentrecall_memory-0.1.1-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d00c8a8e7772564f36344c359a30e0a54b0c38c84ec419fd12a1423cb9a7d8a1
BLAKE2b-256 checksum
How to use checksums
6118a680322a8e251187dad70b04a6e280307da85b11ed1919c83b4cded69baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for agentrecall-memory 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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