Skip to main content

Human-like memory for AI applications

Project description

Recollect

Human-like memory for AI applications.

Why Recollect?

Vector databases retrieve documents by similarity. Recollect models how memory actually works: traces have activation levels, strength that decays over time, and associative links that spread activation to related memories. The result is retrieval that feels natural -- recent and reinforced memories surface first, while dormant ones gracefully fade.

Install

pip install recollect

# With OpenAI or OpenAI-compatible provider support
pip install recollect[openai]

Quick Start

import asyncio
from recollect import CognitiveMemory

async def main():
    memory = CognitiveMemory()
    await memory.initialize()

    # Store an experience -- extracts entities, concepts, significance
    await memory.experience("The team decided to migrate from Redis to PostgreSQL for persistence.")

    # Retrieve with a token budget -- fits the most relevant memories into N tokens
    thoughts = await memory.think_about("database decisions", token_budget=500)
    for thought in thoughts:
        print(f"[{thought.activation:.2f}] {thought.content}")

    await memory.close()

asyncio.run(main())

Features

  • Cognitive model -- activation, strength, decay, and significance on every memory trace
  • Working memory buffer -- 7 +/- 2 capacity models human short-term memory
  • Token budgets -- think_about() selects memories that fit within a token limit
  • Spreading activation -- associative links between entities and concepts propagate recall
  • LLM extraction -- automatic entity, concept, significance, and valence extraction
  • Three LLM providers -- Anthropic (default), OpenAI, OpenAI-compatible (Ollama, LM Studio)
  • Local embeddings -- FastEmbed with nomic-embed-text-v1.5-Q (768d), no API calls
  • Cross-encoder reranker -- optional reranking for precision-critical retrieval
  • Persona facts -- pin/unpin persistent facts; consolidate to merge and prune
  • Async-first -- built on asyncpg and Pydantic models with dependency injection via protocols

Requirements

  • Python 3.12+
  • PostgreSQL 17 with pgvector extension
# macOS
brew install postgresql@17
# Then install pgvector per its docs

Set the connection string in your environment:

export DATABASE_URL=postgresql://user@localhost:5432/mydb

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

recollect-0.3.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

recollect-0.3.0-py3-none-any.whl (62.3 kB view details)

Uploaded Python 3

File details

Details for the file recollect-0.3.0.tar.gz.

File metadata

  • Download URL: recollect-0.3.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for recollect-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b41ab609bc3e7c0624f500c52252d2f2b80c3198203920379f60447dd8cb57a9
MD5 7b1d7ee98345dd1419ef8732f0910eff
BLAKE2b-256 26cad32c6cb3b59df2566d7841e77c059b7fc84d56b0c81a328fc775c091ad52

See more details on using hashes here.

File details

Details for the file recollect-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: recollect-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 62.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for recollect-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a0048456f9da048e7d079ea06c8d73d8a1d077967b5bdee4cce94b09c348f34
MD5 e0dfc426ee77bdad5411ea10338d2f82
BLAKE2b-256 41f3274f136f371c0097af7223b3e739585642f8ba4733c59aa5ca2948147d7e

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