Complete worked example
python
from hashlib import sha256
from pathlib import Path
def inspect_example(text):
payload = text.encode('utf-8')
revision = sha256(payload).hexdigest()
path = Path('bronze') / (revision + '.jsonl')
path.parent.mkdir(exist_ok=True)
if not path.exists():
path.write_bytes(payload)
repeated = Path('bronze') / (sha256(payload).hexdigest() + '.jsonl')
return {'sameObject': path == repeated, 'bytes': path.stat().st_size,
'roundTrip': path.read_bytes().decode('utf-8') == text,
'objects': len(list(path.parent.glob('*.jsonl')))}- Reasoning
- The example encodes text once, calculates its digest, and writes the payload beneath an owned bronze directory. A second reference to the same payload resolves to the same path. The report independently reads the stored bytes and compares them with the original input.