Skip to main content

Biologically-inspired agent memory with decay, consolidation, and tiered storage

Project description

cognitive-memory

Biologically-inspired agent memory with decay, consolidation, and tiered storage.

PyPI version

Install

pip install cognitive-memory

Requires Python 3.10+.

Quick Start

from cognitive_memory import SyncCognitiveMemory

mem = SyncCognitiveMemory(embedder="hash")

mem.add("User is allergic to shellfish", category="core", importance=0.95)

response = mem.search("what allergies does the user have?")
for r in response.results:
    print(r.memory.content, f"(score: {r.combined_score:.2f})")

For production, use OpenAI embeddings (set OPENAI_API_KEY):

from cognitive_memory import CognitiveMemory

mem = CognitiveMemory()  # defaults to OpenAI embeddings

await mem.add("User prefers dark mode", category="semantic", importance=0.7)
response = await mem.search("UI preferences")

For sync usage in scripts and notebooks, use SyncCognitiveMemory (same API, no await).

Docs

Full documentation, guides, and API reference at bhekanik.github.io/cognitive-memory.

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

cognitive_memory-0.4.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

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

cognitive_memory-0.4.0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file cognitive_memory-0.4.0.tar.gz.

File metadata

  • Download URL: cognitive_memory-0.4.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cognitive_memory-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d43adb96be80742362fb25b33e540994b3dcf345fa6b28195b44528a4697db49
MD5 e8237039e865b60d981cd7e5f2eb3781
BLAKE2b-256 34d781b8bd021160d178360196e803609f42981e26ce5f8ee4d759ecad28055a

See more details on using hashes here.

File details

Details for the file cognitive_memory-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cognitive_memory-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a17f8e1be7cb9ae2cb18be434b8cfffe954e1b807f18df42f08af045b50ea4a
MD5 b26538453c479889d66e1d2113f020c7
BLAKE2b-256 7b10db58b0a140f3a7ac4d3d9d9501129abdd4bc85ca1c6256ee1bcfd24a6a31

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