Skip to main content

soil-handover (Python)

The Python implementation of the Soil Handover Specification v1, a conformant preview. Standard library only, Python 3.10+.

It passes the same conformance fixtures as the TypeScript SDK, and the recipe, the rescue prompt, the restore prompt and the rail cards are byte-identical across the two.

from soil_handover import (
    HandoverStore,
    build_restore_prompt,
    normalize_handover,
    render_recipe,
    render_saved,
    validate_handover,
)

# 1. the text you paste into a model
recipe = render_recipe()

# 2. what comes back, however loosely it is shaped
handover = normalize_handover(json.loads(model_reply))

# 3. structure, then the fail-closed secret scan
result = validate_handover(handover)
if not result.valid:
    for issue in result.issues:
        print(issue.kind, issue.path, issue.message)

# 4. plain files under ~/.soil
store = HandoverStore()
entry = store.save(handover)
print(render_saved(handover, entry["code"]))

# 5. what you paste into the next session
print(build_restore_prompt(store.read(entry["code"])))

Install

Nothing is on PyPI yet. From a checkout of this repo:

pip install packages/sdk-py

Or run straight from the tree: the package has no dependencies, so adding packages/sdk-py to sys.path is enough.

What is here

Export Job
SECTION_KEYS, SECTION_TIERS, PROVENANCE_LABELS, LIMITS The format's fixed vocabulary
Handover and friends TypedDicts mirroring the JSON Schema; documents stay plain dicts
validate_handover, assert_handover Structure plus the safety rule, every problem reported at once
find_secret_material, assert_no_secret_material, SECRET_PATTERNS The fail-closed secret scan
normalize_handover, extract_json_block Loose model output to a spec-shaped document
build_recipe, render_recipe, SHARED_RULES, SECTION_GUIDANCE The extraction recipe, verbatim, as data
RESCUE_PROMPT For a thread that is already dead or full
HandoverStore, count_sections, format_code, parse_code The local file store
check_handover, check_observation, CHECK_RULES The open save-time baseline: deterministic checking and grading
build_restore_prompt A handover to a paste-ready restore prompt
render_saved, render_loaded, render_list, render_check, render_validation The rail card, pure and deterministic

Notes

validate_handover checks two things. The shape, and the safety rule: this writer scans every string in the document and refuses one carrying credential-shaped material or a private absolute path, so store.save never writes it. Issues carry a kind of structure or safety. Neither check is a judgement about content.

normalize_handover never invents. It accepts extractionSections, bare strings as sections, and absent sections, turning the last into a declared missing. It will not make up a project id, so validate can tell you it is missing. Observations pass through untouched.

The renderers are pure. No clock, no randomness, no I/O. Same input, same bytes, in both SDKs, which is why whole cards can be pinned in tests. They report counts and never a score.

The store is files. ~/.soil, or SOIL_HOME. One JSON document per handover, plus an index that can be rebuilt from the documents, because the documents are the truth. The layout and the file bytes match the TypeScript store, so both SDKs read the same ~/.soil.

The prompts are verbatim. The recipe and the rescue prompt are normative artifacts copied byte for byte from the published recipe; a parity test in tests/test_parity.py holds them identical to the TypeScript SDK's strings.

Tests

pip install pytest
pnpm build        # the parity tests read the TypeScript SDK's built output
python -m pytest packages/sdk-py

Metadata

Release files for soil-handover 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for soil-handover 0.2.0
File Size Uploaded Provenance Actions
soil_handover-0.2.0.tar.gz 115.5 kB With provenance Details for soil_handover-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for soil-handover 0.2.0
File Interpreter ABI Platform Actions
soil_handover-0.2.0-py3-none-any.whl Python 3 none any Details for soil_handover-0.2.0-py3-none-any.whl

Total release size: 198.1 kB

Release files / soil_handover-0.2.0.tar.gz

Download URL soil_handover-0.2.0.tar.gz
Size 115.5 kB
Tags Source
SHA-256 checksum
How to use checksums
135bd5d5584286528479a6ec69191ff7767518e6d0efbf39f7e628b89ab04bc4
BLAKE2b-256 checksum
How to use checksums
d766c50df609b090af69490aed00efc4e7bb8eb1834f6ee5653c02dab97210a7
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 Jul 31, 2026.

Transparency log

Release files / soil_handover-0.2.0-py3-none-any.whl

Download URL soil_handover-0.2.0-py3-none-any.whl
Size 82.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a8e0aa694707f21ba7fa8a64bb5e30f8718de532fc9cddacf757e1be798ebec
BLAKE2b-256 checksum
How to use checksums
8954a71dbe80265bc7a4a99ff2efd34f76a5cce3c3369903d37ed2461dce3410
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 Jul 31, 2026.

Transparency log

Security for soil-handover 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for soil_handover-0.2.0.tar.gz

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 Jul 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page