Metadata-Version: 2.4
Name: algovoi-keystone-runtime
Version: 0.1.1
Summary: Run a Keystone chain and keep the evidence in a durable, tamper-evident journal. Cython-compiled.
Author-email: AlgoVoi <chopmob@gmail.com>
License: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: NOTICE
Requires-Dist: algovoi-keystone-connect>=0.1.0
Requires-Dist: algovoi-keystone-agent>=0.1.0
Requires-Dist: algovoi-execution-ref>=0.1.0
Requires-Dist: rfc8785>=0.1.4
Dynamic: license-file

# algovoi-keystone-runtime

Run a Keystone chain and keep the evidence in a durable, queryable, tamper-evident
Journal. Every emitted reference recomputes offline from its own fields, and the
journal is a hash chain over those references.

```python
from algovoi_keystone_runtime import Journal, Runtime

rt = Runtime(Journal("keystone.db"), decision_ref=decision_ref)
rt.record_stage("mandate", {"passport_ref": passport_ref, "cap": "500USD"})
assert rt.journal.verify().ok
```

## Verifying against tampering

`Journal.verify()` proves three things: every record recomputes its own reference,
**every stored payload is bound to its chained reference** (a row's `record_json`
cannot be swapped while leaving `record_ref` untouched), and the hash chain is
intact (no insert / remove / reorder).

Tail truncation (dropping the newest rows) is only detectable against an external
anchor. Persist the last-known head and count, and pass them back:

```python
rep = journal.verify(expect_head=last_head, expect_count=last_count)
assert rep.ok
```

Apache-2.0. (c) AlgoVoi. NOTICE attribution required for redistribution.
