sinc-prompt
Validator and converter for the sinc-prompt structured LLM prompt format.
x(t) = Sigma x(nT) * sinc((t - nT) / T)
sinc-prompt applies Nyquist sampling theory to prompt engineering. A raw prompt is a continuous signal; sinc-prompt samples it at exactly 6 bands -- the minimum rate to reconstruct intent without aliasing (hallucination).
| Band | Weight | Purpose |
|---|---|---|
| PERSONA | 7.0% | Who should answer |
| CONTEXT | 6.3% | Situation and facts |
| DATA | 3.8% | Specific inputs |
| CONSTRAINTS | 42.7% | Rules to follow |
| FORMAT | 26.3% | Output structure |
| TASK | 2.8% | The objective |
Zero dependencies. Uses only Python stdlib.
Install
pip install sinc-prompt
Quick Start
import sinc_prompt
# Validate a sinc-prompt JSON file
is_valid, errors = sinc_prompt.validate("prompt.sinc.json")
# Parse into a dataclass
prompt = sinc_prompt.parse("prompt.sinc.json")
print(prompt.get_band("CONSTRAINTS").x)
# Format into a readable prompt string
text = sinc_prompt.format_prompt(prompt)
# Check Nyquist completeness (0.0 to 1.0)
score = sinc_prompt.nyquist_completeness(prompt)
print(f"Completeness: {score:.1%}")
# Compute signal-to-noise ratio
snr = sinc_prompt.compute_snr(prompt)
# Scatter a raw prompt into 6 bands (no LLM needed)
scattered = sinc_prompt.scatter("You are an expert. Write a sorting function in Python. Use only stdlib.")
print(sinc_prompt.format_prompt(scattered))
# Export back to JSON
data = sinc_prompt.to_json(scattered)
CLI
# Validate a file
sinc-prompt validate prompt.sinc.json
# Format to readable text
sinc-prompt format prompt.sinc.json
# Show completeness score with per-band breakdown
sinc-prompt completeness prompt.sinc.json
# Scatter a raw prompt into 6 bands
sinc-prompt scatter "Write a Python function that sorts a list"
# Scatter with JSON output
sinc-prompt scatter --json "Write a Python function that sorts a list"
sinc-prompt JSON Format
{
"formula": "x(t) = Sigma x(nT) * sinc((t - nT) / T)",
"T": "specification-axis",
"fragments": [
{"n": 0, "t": "PERSONA", "x": "You are a senior Python developer."},
{"n": 1, "t": "CONTEXT", "x": "Django REST API project with PostgreSQL."},
{"n": 2, "t": "DATA", "x": "Error traceback shows 500 on /api/users/."},
{"n": 3, "t": "CONSTRAINTS", "x": "Do not modify the database schema. Use only stdlib. Keep backward compatibility. Must pass all existing tests."},
{"n": 4, "t": "FORMAT", "x": "Return the fix as a unified diff. Include one-sentence root cause."},
{"n": 5, "t": "TASK", "x": "Fix the 500 error on the users endpoint."}
]
}
API Reference
validate(sinc_json) -> (bool, list[str])
Validate a sinc-prompt document. Accepts a dict, JSON string, or file Path. Returns (is_valid, errors).
parse(input) -> SincPrompt
Parse a sinc-prompt from dict, JSON string, or file Path. Returns a SincPrompt dataclass. Raises ValueError if invalid.
format_prompt(sinc) -> str
Format a sinc-prompt into a [BAND]\ncontent string.
compute_snr(sinc) -> float
Signal-to-noise ratio measuring how well band distribution matches ideal weights.
nyquist_completeness(sinc) -> float
Weighted completeness score from 0.0 (empty) to 1.0 (all 6 bands present).
scatter(raw_prompt) -> SincPrompt
Heuristic decomposition of a raw prompt into 6 bands. No LLM required.
to_json(sinc) -> dict
Export a sinc-prompt back to a plain dict in sinc JSON format.
Types
SincFragment(n, t, x)-- A single band fragment.SincPrompt(formula, T, fragments)-- A complete sinc-prompt with helper methods:get_band(),is_complete(),band_names(),to_dict().
Constants
SINC_BANDS-- List of the 6 band names in order.BAND_IMPORTANCE-- Dict mapping band names to their quality weights.SINC_PROMPT_SCHEMA-- JSON Schema (draft-07) as a Python dict.
Why sinc-prompt?
A raw prompt to an LLM is like a single sample of a continuous signal. By Nyquist's theorem, you need at least 2x the highest frequency component to reconstruct without aliasing. In prompt engineering, "aliasing" manifests as hallucination, off-topic responses, and format violations.
sinc-prompt defines 6 bands as the minimum sampling rate. The weights are empirically derived: CONSTRAINTS at 42.7% dominates because rules are the highest-frequency component of intent -- the most likely to be lost in a raw prompt.
Links
License
MIT
Metadata
Release files for sinc-prompt 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sinc_prompt-1.0.0.tar.gz | 17.4 kB | Without provenance | Details for sinc_prompt-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sinc_prompt-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sinc_prompt-1.0.0-py3-none-any.whl |
Total release size: 32.5 kB
Release files / sinc_prompt-1.0.0.tar.gz
| Download URL | sinc_prompt-1.0.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3162e63f07e30bf381d4e5292862adfe16541a3891a6e291a42f94faeeac7bd6
|
|
BLAKE2b-256 checksum How to use checksums |
2af1957be90d2a99dcb41809c8a5ea0206c3d958520266bee46646501390dce7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / sinc_prompt-1.0.0-py3-none-any.whl
| Download URL | sinc_prompt-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2dc9edc2cef5048e72bc8687a312ae5620e7b257e930de1b9fd7df76e754b4f
|
|
BLAKE2b-256 checksum How to use checksums |
14cca7710d4640d1ec26b35b570b308b802563cd0b4d2b365a26f1ed824b6719
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for sinc-prompt 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.