Skip to main content

Safe primitives and protocol for AI-assisted editing of templated code-generation in quine/capsule systems.

Project description

quinesmith

Safe primitives and protocol for AI-assisted editing of templated code-generation in quine/capsule systems.

quinesmith codifies the Quine Template Edit Protocol as a constructive suite of Python primitives for AI agents working on self-generating code.

It does not perform edits. It does not execute verification. It provides:

  • Level / brace tracking — the doubling rule (braces_required = 2^level) as a checked, typed primitive.
  • Transformation registry — the nine canonical Level-1 transforms.
  • Failure mode taxonomy — every known quine-template failure class as an enum, classifiable from symptom.
  • Audit checklists — the pre-edit and stop-and-audit conditions as callable predicates the agent must satisfy.
  • Verification preparers — boundary-respecting functions that return shell-runnable command strings for the human operator. The agent prepares; the operator runs.

This package is digital fire. See SECURITY.md for the threat model and the boundary statement.

Quine Forge is the project and repository. quinesmith is the Python package and import name.

What this is not

  • It is not an editor. It does not modify quine source.
  • It is not a runtime. It does not execute, compile, or regenerate.
  • It is not a doctrine. The operator contract that governs how an agent uses this package lives in brotology-field-guidequinesmith is the operational primitives, not the doctrinal stance.

Install

pip install quinesmith

With provenance / cascade-lattice receipts:

pip install "quinesmith[provenance]"

Quick example

from quinesmith import Level, braces_required, FailureMode
from quinesmith import verify

# How many braces does a literal `{x}` need at template level 1?
braces_required(Level.TEMPLATE)
# -> 2

# Diagnose a symptom against the canonical taxonomy:
FailureMode.from_symptom(
    "Compiles, emission produces {x} literal where a value was wanted"
)
# -> FailureMode.OVER_DOUBLED_BRACES

# Prepare verification commands. The OPERATOR runs these:
print(verify.prepare_commands("my_quine.py"))
# python -m py_compile my_quine.py
# python my_quine.py --verify-quine
# python my_quine.py --emit > regen.py
# python -m py_compile regen.py
# diff my_quine.py regen.py

Boundary

The agent prepares; the operator runs. There is no verify.run(...). There will not be one. The protocol's safety boundary (§7.7, §8) is enforced at the API level. See SECURITY.md.

Protocol reference

The full Quine Template Edit Protocol is published at docs/protocol.md and bundled in the source distribution under docs/protocol.md.

Provenance

Every release ships:

  • Apache-2.0 licensing
  • GitHub release workflow for PyPI Trusted Publishing
  • a no-execution verification boundary for AI-assisted quine work
  • optional cascade-lattice integration for downstream provenance receipts

Verify a release per SECURITY.md.

License

Apache License 2.0. See LICENSE.

Lineage

This package is part of the Ouroboros ecosystem. Companion packages:

  • cascade-lattice — composable provenance / audit primitives.
  • brotology-field-guide — the operator contract that governs how AI agents collaborate on living systems.
  • quinesmith (this package) — operational primitives for safe quine template editing.

Contributing

This is a small, security-focused package. Contributions follow the brotology operator contract: evidence-first, audit-before-implement, smallest honest slice. See SECURITY.md for boundary requirements that must not be relaxed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quinesmith-0.1.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quinesmith-0.1.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file quinesmith-0.1.1.tar.gz.

File metadata

  • Download URL: quinesmith-0.1.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for quinesmith-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b943fac5daf891eac99b4db4c7b9dddbd554687fd0d7cf1b9c7636067d3e76b4
MD5 9a10db49a392df1b649cc43615f526be
BLAKE2b-256 ace62338e0d935dc2d1de70453603436941883b25f9016966f67a9460ef1de70

See more details on using hashes here.

File details

Details for the file quinesmith-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: quinesmith-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for quinesmith-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4290ea8b48d22a8b92e0f48195601897238c5575dc9d59035dff5dcb2ccad28a
MD5 83658f058c0d6e48f3fb5a803ff935f8
BLAKE2b-256 ceee864f82a12ecaf02f3e00c3580d19c1ee3e45e40fc5d7af1c199fbb705749

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page