Skip to main content

A brain for AI agents that actually learns — confidence scoring, negative results, gap detection. pip install attestdb && attest brain install

Project description

Attest

PyPI - attestdb PyPI - attest-py Tests Python 3.11+ License: BSL-1.1

Licensed under the Business Source License 1.1. Free to use, modify, and self-host. Cannot be offered as a competing managed service. Converts to Apache 2.0 after 4 years.

A brain for AI agents that actually learns. Give Claude Code, Cursor, OpenClaw, and any MCP-compatible agent a persistent knowledge system that tracks confidence, records what failed, detects gaps, and gets smarter every session. Free, open source, runs 100% locally.

pip install attestdb
attest brain install

What It Does

Your agent forgets everything between sessions. Attest Brain fixes that:

  • Session recall -- prior knowledge (warnings, patterns, dead ends) injected at session start
  • Pre-edit warnings -- known bugs and patterns surface before you edit a file
  • Post-test fixes -- prior solutions appear when tests fail
  • Negative results -- records what was tried and didn't work, so nobody repeats the search
  • Confidence scoring -- every fact has a 0-1 score that updates as evidence arrives
  • Contradiction resolution -- conflicting claims resolved with principled reasoning
  • Gap detection -- finds what the brain doesn't know and flags it

Works with Claude Code, OpenClaw, Cursor, Windsurf, Codex, and Gemini CLI.

Without Brain vs With Brain

Without With Brain
Same bug, second time Debug from scratch (40 min) Brain recalls the fix (3 min)
Preferences Asks the same questions every time Remembers and applies automatically
Dead ends Re-investigates failed approaches Skips known failures
Knowledge Resets to zero each session Compounds over time

Quick Start

import attestdb

db = attestdb.open("my_knowledge.db")

# Ingest a claim with provenance
db.ingest(
    subject=("BRCA1", "gene"),
    predicate=("associated_with", "relates_to"),
    object=("Breast Cancer", "disease"),
    provenance={"source_type": "database_import", "source_id": "PMID:12345"},
    confidence=0.9,
)

# Query the knowledge graph
frame = db.query("BRCA1", depth=2)
print(frame.focal_entity.name)
for rel in frame.direct_relationships:
    print(f"  --[{rel.predicate}]--> {rel.target.name} (conf={rel.confidence:.2f})")

db.close()

MCP Tools (84 total)

The brain exposes 84 MCP tools. Key ones for everyday use:

# Record knowledge
attest_learned("redis client", "v7 needs decode_responses=True", "warning")
attest_negative_result("session auth", "msgpack doesn't work for Redis 7 serialization")
attest_session_end("success", "Fixed auth tests after Redis upgrade")

# Recall knowledge
attest_get_prior_approaches("Redis serialization error")
attest_check_file("payment_handler.py")
attest_research_context("session management")

# Analyze knowledge
attest_blindspots()           # Find gaps
attest_confidence_trail("redis client")  # See confidence evolution
attest_predict("entity_a", "entity_b")   # Causal prediction via graph

CLI

attest brain install            # Install brain into your coding tools
attest brain status             # View brain statistics
attest brain uninstall          # Remove brain from coding tools
attest stats my.db              # Show database statistics
attest query my.db BRCA1        # Query knowledge around an entity
attest serve --port 8892        # Start MCP server (SSE/HTTP)

Under the Hood

Attest isn't a thin wrapper over SQLite or a vector store. It's a purpose-built claim-native database with a Rust storage engine.

  • 1.3M claims/sec ingestion, 8us entity query (LMDB via heed)
  • Atomic claims -- every fact is a (subject, predicate, object) triple with provenance
  • Dual IDs -- claim_id (SHA-256, globally unique) + content_id (SHA-256 of S+P+O, for corroboration)
  • 13 validation rules on every write
  • Merkle audit chain -- tamper-evident append-only log
  • Graph algorithms -- PageRank, betweenness centrality, SVD embeddings, causal prediction

Core Capabilities

  • Provenance-tracked claims -- every fact has a source chain
  • Confidence scoring -- evidence-weighted, updates on corroboration
  • Confidence decay -- stale knowledge loses confidence over time
  • Retraction with cascade -- db.retract("source_123") propagates downstream
  • Contradiction resolution -- evidence-weighted voting across sources
  • Snapshot/Restore -- db.snapshot(path) for backups
  • Embedding index -- HNSW similarity search via usearch
  • Multi-agent research -- agent registration, task queue, federation
  • Negative results -- first-class claims that prune the search tree
  • Enterprise RBAC -- groups, policies, entitlements for 10K+ orgs (enterprise)

Intelligence Layer (Enterprise)

LLM-powered features (curation, text extraction, connectors, insight engine) are available in attestdb-enterprise:

pip install attestdb-enterprise

Common Errors

ProvenanceError -- Every claim needs provenance={"source_type": "...", "source_id": "..."}. By design: claims without provenance can't be verified.

ImportError: requires attestdb-enterprise -- Methods like ingest_chat() and connect() need the enterprise package. Use db.ingest() for structured claims without it.

database is locked -- Only one process can write to a .attest file. Kill stale processes or use :memory: for testing.

Running Tests

pip install attestdb[dev]
pytest tests/unit/ tests/integration/   # ~1100 tests, <75s
cd rust && cargo test                   # Rust unit + golden vectors

Documentation

License

Business Source License 1.1 -- free to use, modify, and self-host. Converts to Apache 2.0 after 4 years.

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

attestdb-0.1.36.tar.gz (547.2 kB view details)

Uploaded Source

Built Distribution

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

attestdb-0.1.36-py3-none-any.whl (364.5 kB view details)

Uploaded Python 3

File details

Details for the file attestdb-0.1.36.tar.gz.

File metadata

  • Download URL: attestdb-0.1.36.tar.gz
  • Upload date:
  • Size: 547.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for attestdb-0.1.36.tar.gz
Algorithm Hash digest
SHA256 8c8bb193df30772ea4f7ab34d4f7e17e42dcb8ad97878fc5e6c099c56ebbe8bb
MD5 87ea9bd24c79b0cbc7cd7984e0848eaa
BLAKE2b-256 898c4f8ceffc0654ae0e7c8811744dfc91de07532022d3d614cc92df1303c334

See more details on using hashes here.

Provenance

The following attestation bundles were made for attestdb-0.1.36.tar.gz:

Publisher: publish.yml on omic/attest

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

File details

Details for the file attestdb-0.1.36-py3-none-any.whl.

File metadata

  • Download URL: attestdb-0.1.36-py3-none-any.whl
  • Upload date:
  • Size: 364.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for attestdb-0.1.36-py3-none-any.whl
Algorithm Hash digest
SHA256 a40cfcb649c4a61d58238c8defe14f444f2ad06caaedcc8785a48d8912fa7b22
MD5 8d7eb01a7b8bb162afe448781c51a4f7
BLAKE2b-256 0d8f6a21384c1455503cf39bc781ed125fdc9cdfde9582426e8f0e6bd39e784b

See more details on using hashes here.

Provenance

The following attestation bundles were made for attestdb-0.1.36-py3-none-any.whl:

Publisher: publish.yml on omic/attest

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