TrueHeart Core
Purpose
TrueHeart Core 0.1.0 is a model-independent Python library for governed long-term memory in AI agents. It gives a host application explicit contracts for ingesting source events, materializing derived memories, deterministic recall, retention, lineage, governance, and body-free audit records.
It supports Python 3.11 or newer, is licensed under MIT, has no runtime dependencies outside the standard library, and invokes no model or network.
Guarantees
- Every public operation uses an exact caller-supplied
Scope(tenant_id, owner_id, subject_id)and fails closed on mismatches. - Inputs are validated and bounded; public datetimes are timezone-aware and normalized to UTC.
- Trust is explicit and a derived memory cannot exceed its least-trusted source.
- Materialization, lineage, tombstones, and audit changes are transactional.
- Recall is deterministic: clarity descending, creation time descending, then
memory ID ascending. Clarity is
1.0throughclear_until, then fades linearly to0.0atrecall_until. - Tombstones and audit records contain no event or memory bodies.
- The core performs no model calls, networking, plugin loading, shell execution, vector search, prompt rendering, or background work.
Within the library-controlled SQLite database, body-free tombstones prevent recreation of forgotten or deleted scoped IDs and exact dependency fingerprints. This is not cryptographic erasure and does not remove copied databases, snapshots, backups, WAL or filesystem artifacts, host logs, or provider content.
Five-minute example
Start from a repository checkout because the runnable example is a repository file and is not installed by the wheel:
git clone https://github.com/qingyou0420/trueheart-core.git
cd trueheart-core
python -m pip install -e ".[dev]"
python examples/basic_memory.py
It prints exactly:
1 governed memory recalled at clarity 1.00
The example uses TemporaryDirectory, creates one local file-backed SQLite
database, ingests a RawEventDraft, creates a caller-authored MemoryDraft,
and recalls it with a RecallQuery. It reads no environment variables, makes
no network requests, and removes the temporary database on exit. See
examples/basic_memory.py
for the full code.
The high-level API is TrueHeart:
ingest_event(RawEventDraft)records a source receipt and its local body.materialize_once(MemoryDraft)stores caller-derived content with lineage.recall(RecallQuery)returns an immutable tuple ofRecallItemvalues.govern(GovernanceCommand)seals, restores, forgets, or deletes.expire_raw_content(as_of=...)removes eligible raw bodies.audit(scope, limit=...)returns body-free lifecycle records.
SQLiteRepository is the supported adapter. Stable imports also include the
immutable DTOs and enums (Scope, SourceRef, RetentionPolicy,
RawEventDraft, RawEventReceipt, MemoryDraft, MemoryRecord,
MemoryStatus, RecallQuery, RecallItem, GovernanceCommand,
GovernanceAction, GovernanceResult, EntityType, AuditRecord, and
TrustLevel) and the documented TrueHeartError subclasses.
Lifecycle
- The host supplies an event, exact scope, provenance, trust, and retention.
- The host—not this library—derives a memory and names its source event IDs.
- Recall returns only active, unexpired memories in deterministic order.
- The host explicitly calls raw-body expiry; no scheduler runs in the core.
- Seal and restore are reversible. Forget and delete remove controlled bodies and create non-resurrection tombstones inside the current database.
Deleting a raw event also deletes and tombstones dependent memories in one transaction. Forgetting a memory does not delete its source events.
Installation
The source repository is public. Publishing the v0.1.0 GitHub Release will
run the package publication workflow. After successful package publication,
install from PyPI with:
python -m pip install trueheart-core==0.1.0
For development from a checkout:
python -m pip install -e ".[dev]"
The default adapter stores bodies as plaintext in local SQLite. Version 0.1 provides no encryption at rest.
Security boundaries
The core treats content and metadata as data and never interprets them as instructions. It cannot prevent prompt injection, establish truth, or control how a host constructs prompts or sends content to a provider.
Scope is caller-supplied database isolation, not authentication or
authorization. TrueHeart Core is not a multi-tenant service or API auth layer.
When a requested ID is absent from the exact scope but exists elsewhere in the
same database, materialization and governance can distinguish that one-bit
existence through ScopeMismatch rather than EntityNotFound. IDs are
sensitive; hosts must authenticate and authorize both scope and ID use. The
core does not protect against a malicious local administrator or compromised
host. Body-free audit and tombstone records omit event and memory bodies, but
their identifiers and metadata can still be sensitive.
Metadata is limited to 64 JSON container levels, integer magnitude of at most
4096 bits, and 16 KiB after canonical serialization. The SQLite adapter checks
for the standard json_valid function when it opens a connection and fails
closed if that required capability is unavailable.
Read the security guarantees, the threat model, and security reporting before using the library with sensitive data.
Architecture
Immutable domain contracts feed the TrueHeart lifecycle service, which uses
an internal repository boundary implemented by SQLiteRepository. Policy and
validation live in the domain/service layer; persistence, transactions, and
projection assembly live in the adapter. See the
architecture.
Development
python -m pytest tests -q
python -m ruff check src/trueheart_core tests examples
python -m ruff format --check src/trueheart_core tests examples
python -m mypy src/trueheart_core
python -m build
Tests and examples use synthetic data and temporary file-backed databases.
Contributing
Contributions are welcome under the requirements in CONTRIBUTING.md. Report ordinary usage questions as described in SUPPORT.md, and report vulnerabilities privately as described in SECURITY.md.
Status
Version 0.1.0 has a public source repository and an intentionally small API.
Publishing the v0.1.0 GitHub Release runs the package publication workflow.
Semantic search, embeddings, model integration, service authentication,
provider deletion, backup management, and encryption at rest are out of scope.
Metadata
Release files for trueheart-core 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trueheart_core-0.1.0.tar.gz | 46.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trueheart_core-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.8 kB
Release files / trueheart_core-0.1.0.tar.gz
| Download URL | trueheart_core-0.1.0.tar.gz |
|---|---|
| Size | 46.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34f1bcb12137c0699290c151be8e084da0f2bcb8da4f02bca29f6a4cab3b817c
|
|
BLAKE2b-256 checksum How to use checksums |
9c8080cf287faa6536baa3cdab19bcf68b91441feb9d2c402e2fffc14c4d6b59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / trueheart_core-0.1.0-py3-none-any.whl
| Download URL | trueheart_core-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1c497f007b7f4a2bd24bd698b3e813055b993e8fa9ff961e7b8c9bfc297b967
|
|
BLAKE2b-256 checksum How to use checksums |
406736cbae7bff601cd3297402cbc9bd76714ff9e1149d39ec34c8f137c387a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency log