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 bundled at 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.0.tar.gz (16.1 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.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quinesmith-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 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.0.tar.gz
Algorithm Hash digest
SHA256 07698eb763b22e572c02543e702c8ebb4af80f9b48366f559e725138f345240b
MD5 4d1e21989c3871319b55513de5a10f6a
BLAKE2b-256 87c931899315f6c5e619127245e18110895eaec6d0138b6960db3e1e0fdf9764

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quinesmith-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc53b14ac9454bc20dcdee8ddb5ea87478725a5e2ddaed22dba3db57369f86fb
MD5 1127097c62148a0764ab68b701b96bdd
BLAKE2b-256 42d2908e692e5145a86e4caf3dac054a7880465e2ac2a6f85e109b8d51f6e414

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