Skip to content

Commit 0e0a5f5

Browse files
unpingableclaude
andcommitted
Fix README quick-start example to match actual API
Preflight caught: wrong constructor args, wrong envelope params. Verified against clean venv install. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 573afaf commit 0e0a5f5

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,33 @@ pip install receipt-kernel
2525
## Quick start
2626

2727
```python
28-
from receipt_kernel import Verdict, BlobRef, RetentionPolicy
28+
from receipt_kernel import Verdict
2929
from receipt_kernel.store_sqlite import SqliteReceiptStore
30-
from receipt_kernel.stages import DEFAULT_STAGE_GRAPH
31-
from receipt_kernel.envelope import make_envelope, seal_envelope
30+
from receipt_kernel.envelope import make_envelope
3231

3332
# Create a store
34-
store = SqliteReceiptStore(":memory:", stage_graph=DEFAULT_STAGE_GRAPH)
33+
store = SqliteReceiptStore(":memory:")
34+
store.initialize_schema()
3535

3636
# Start a run
3737
run_id = "run-001"
38-
store.ensure_run(run_id, policy_id="default", policy_version="1.0")
38+
store.ensure_run(run_id, policy_id="default", policy_version="1.0", stage_graph_id="default")
3939

40-
# Append events through the stage graph
40+
# Append an event (store fills run_id, seq, prev_hash, event_hash)
4141
env = make_envelope(
42-
run_id=run_id,
4342
event_type="RUN_START",
4443
stage="START",
45-
actor={"kind": "system", "id": "test"},
46-
policy={"policy_id": "default", "policy_version": "1.0", "stage_graph_id": "default"},
44+
actor_kind="system",
45+
actor_id="test",
46+
policy_id="default",
47+
policy_version="1.0",
48+
stage_graph_id="default",
4749
payload={"task": "example"},
4850
)
49-
sealed = seal_envelope(env, prev_hash=None)
50-
store.append_event(sealed)
51+
store.append_event(run_id, env)
52+
53+
events = store.get_events(run_id)
54+
print(f"Events: {len(events)}, chain intact: {events[0]['event_hash'] is not None}")
5155
```
5256

5357
## Invariants

0 commit comments

Comments
 (0)