Skip to main content

A cognitive memory system for AI agents — neuroscience-inspired, zero dependencies by default

Project description

Verity

A cognitive memory system for AI agents and applications — inspired by how the brain actually stores, recalls, and forgets.

What it does

AI memory systems treat memory as a database: store a string, retrieve a string. Verity treats memory as cognition. It uses a dual-speed store (fast episodic buffer + slow semantic store), runs a sleep consolidation cycle between sessions to decay, prune, and abstract memories, and applies reconsolidation rules that let memories update without drifting. The result is a memory system that behaves more like a mind than a key-value store.

Three things Verity does that no other package does: reconsolidation stability (memories update on access but cannot drift — a four-tier Bayesian system gates every modification), sleep consolidation (an offline decay → prune → abstract cycle that runs between sessions, mirrors the SO-spindle-ripple cascade), and tiered temporal weighting (the system auto-graduates from exponential to Bayesian renewal to Hawkes processes as event history grows, per-memory, without any configuration).

The API is seven methods. Zero configuration. No GPU. No cloud. No API key required. Runs on a Raspberry Pi and in a Kubernetes pod identically. Works with nothing but Python's stdlib, and gets progressively smarter as you add optional packages.

Install

pip install veritycog                    # stdlib only — text search
pip install "veritycog[cognitive]"       # + model2vec + hnswlib (recommended)
pip install "veritycog[connectors]"      # + dlt (60+ data sources)
pip install "veritycog[full]"            # everything

Quickstart

from verity import Memory

m = Memory()                                      # SQLite, zero config
m.add("I prefer dark mode")                       # store
m.add("Team standup every day at 9am")
m.add("The API uses JWT authentication")

results = m.search("daily schedule")              # retrieve
for r in results:
    print(r["content"], f"({r['confidence']:.0%} confidence)")

m.update(results[0]["id"], "standup moved to 10am")  # update
m.consolidate()                                   # sleep cycle
m.export()                                        # GDPR portability
m.delete(results[0]["id"])                        # GDPR erasure

The cognitive layer

Component Neuroscience model What it does Maps to
DualSpeedStore Complementary Learning Systems Fast episodic buffer + slow semantic store SQLite + numpy
ImportanceScorer Predictive Processing Prediction error as surprise signal Embedding cosine distance
ReconsolidationEngine Memory Reconsolidation 4-tier stability prevents drift Bayesian Beta-Bernoulli
ConsolidationCycle Sleep Consolidation Decay/prune/abstract between sessions Scheduled background pass
TemporalWeighter Temporal Point Processes Auto-selects exponential/renewal/Hawkes Tiered by event density
GlobalWorkspace Global Workspace Theory K=5 competitive selection + position-aware output Mitigates lost-in-middle

Advanced: Engine API

Memory wraps the lower-level Engine API, which provides the full RELATE/NAVIGATE/GOVERN/REMEMBER loop with connectors, profiles, consent management, and a Merkle-chained audit trail. See examples/01_personal_notes.py for a complete walkthrough.

For AI agents

from verity import Memory

memory = Memory()

def agent_response(user_input: str) -> str:
    # Recall relevant context
    context = memory.search(user_input, k=5)
    context_str = "\n".join(r["content"] for r in context)

    # ... call your LLM with context_str ...

    # Remember the interaction
    memory.add(f"User asked: {user_input}")
    return response

License

Apache-2.0

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

veritycog-0.1.1.tar.gz (174.3 kB view details)

Uploaded Source

Built Distribution

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

veritycog-0.1.1-py3-none-any.whl (100.7 kB view details)

Uploaded Python 3

File details

Details for the file veritycog-0.1.1.tar.gz.

File metadata

  • Download URL: veritycog-0.1.1.tar.gz
  • Upload date:
  • Size: 174.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for veritycog-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8025ab1e5721dd33343667414a29b5a2442e3d0d7e6a1ac9c3aecd39c60f4759
MD5 04628291fb651fd6181c0472e43b7c3a
BLAKE2b-256 77f2073eb9947c6cc66568a342e79865f7dc664c8b1717337940a3d13f1cd30e

See more details on using hashes here.

Provenance

The following attestation bundles were made for veritycog-0.1.1.tar.gz:

Publisher: release.yml on bnyhil31-afk/verity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file veritycog-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: veritycog-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 100.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for veritycog-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d24ed231c0d05faef16b18aa69fb11dc88d3579a9e05174292c42d9d6f3653ec
MD5 9f3592b0e97846de7f3c14b0a45101b7
BLAKE2b-256 b94f334f22b25358bb4658b384f96c64c4454966a927eb2246643e738e36d9c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for veritycog-0.1.1-py3-none-any.whl:

Publisher: release.yml on bnyhil31-afk/verity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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