Skip to main content

sovereign-sieve

Zero-dependency standalone Prose Tax token optimization utility.

sovereign-sieve extracts the payload-cleansing mechanics from the Sovereign Systems SDK into a pure, synchronous micro-library with no web framework or ML library dependencies. Use it in scripts, batch pipelines, and offline data-processing workers to strip conversational boilerplate and measure immediate token savings — all on local silicon.


Installation

pip install sovereign-sdk-sieve

Or, within a uv workspace:

uv add sovereign-sdk-sieve

Quick Start

pure_sieve — drop-in string cleaner

from sovereign_sieve import pure_sieve

raw = "Hello! Please just help me analyze this dataset."
clean = pure_sieve(raw)
print(clean)
# → "! help me analyze this dataset."

sieve_with_metrics — cleaner + FinOps telemetry

from sovereign_sieve import sieve_with_metrics

result = sieve_with_metrics(
    "Hi! I hope this helps. Please just run the pipeline."
)
print(result.text)
# → "! helps. run the pipeline."

print(result.raw_token_count)        # estimated tokens before sieve
print(result.optimized_token_count)  # estimated tokens after sieve
print(result.tax_savings_percentage) # e.g. 66.6667 (%)

Offline batch pipeline

from sovereign_sieve import pure_sieve

records = load_jsonl("prompts.jsonl")
cleaned = [pure_sieve(r["text"]) for r in records]
save_jsonl("prompts_clean.jsonl", cleaned)

What gets stripped

Category Examples stripped Examples preserved
Greeting tokens hi, hello, hey, greetings hi-fi, hello-world
Hedging adverbs please, just, simply, actually, basically, probably just-in-time, simply-typed
Affirmation filler of course, certainly, absolutely, sure (standalone) make sure to, be sure to, certainly-not
Preamble phrases I hope this, I hope that, I hope you trailing sentence content preserved
Degenerate markdown ****, _____ (4+ bare markers) **bold**, *italic*, ***bold-italic***
Duplicate headings consecutive identical ## Heading\n## Heading headings differing in case or level

SieveOutput fields

from sovereign_sieve import SieveOutput

result: SieveOutput = sieve_with_metrics("Hello! Please help me now.")
result.text                  # str  — minimized payload
result.raw_token_count       # int  — byte-density token estimate before sieve
result.optimized_token_count # int  — byte-density token estimate after sieve
result.tax_savings_percentage # float — reduction percentage, 4 decimal places

Token counts use the UTF-8 byte-density heuristic (÷ 4), matching the average density of the cl100k_base tokenizer across mixed English/code content. No external tokenizer is invoked.


Key manager usage (sovereign-core)

For cryptographic signing of sieved payloads, use SovereignGateway from sovereign-core:

import asyncio
from sovereign_core.gateway import SovereignGateway

async def main():
    gateway = SovereignGateway(signing_key=".keys/sovereign_identity.pem")
    result = await gateway.sieve_and_sign("Hello! Please just help me.")
    print(result.content)          # minimized text
    print(result.receipt["signature"])  # Ed25519 signature

asyncio.run(main())

License

MIT

Metadata

Release files for sovereign-sdk-sieve 1.3.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 sovereign-sdk-sieve 1.3.0
File Size Uploaded
sovereign_sdk_sieve-1.3.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sovereign-sdk-sieve 1.3.0
File Interpreter ABI Platform
sovereign_sdk_sieve-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / sovereign_sdk_sieve-1.3.0.tar.gz

Download URL sovereign_sdk_sieve-1.3.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ea063bb94221fb44e4fbe34bd0db21c177f2f3c57f7761e6ad5ce8695f7bc35
BLAKE2b-256 checksum
How to use checksums
d977b0333dc8702f403f8512776411c9418f2edc73c26114173720fb03398320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / sovereign_sdk_sieve-1.3.0-py3-none-any.whl

Download URL sovereign_sdk_sieve-1.3.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5438fefd51edcac0a1923fd12e51ce67c5ec1f4b69425985c1e618fe87905e05
BLAKE2b-256 checksum
How to use checksums
349f762b51c269efc534645a12b91703a0e250ed4cf557daa084c9ef94e93db9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

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