Skip to content
PC prompt-craft
v1.0.0 · stable interfaces, honest limits

Say what the picture must contain. Then check that it does.

A generative pipeline will hand you a hero with the wrong face and report success, because nothing looked. prompt-craft replaces the opaque prompt with a typed contract of depictable claims, uses that same list to write the prompt and to check the pixels, and blocks the asset when a required claim is not there.

Install

pip install -e ".[dev]"

Run the loop

pcraft demo # end-to-end, no GPU

Check an image

pcraft gate hero.png

What it actually does

One atom list, used twice — to write the prompt, and to check the result.

The same list, twice

The contract writes the prompt and gates the pixels from one source, so the thing you asked for is the thing that gets verified. That is what closes the loop an opaque prompt leaves open.

A different family checks it

The verifier is never the same model family as the generator, enforced by a guard that refuses to run otherwise. A model is a poor judge of its own output.

It can say "I could not check"

Four distinct exit codes separate a failed claim from an unreadable input from an unavailable verifier. Merging those is why browsers soft-fail certificate revocation.

Absence is verified, not requested

Anti-constraints are checked on the pixels rather than dropped into a negative prompt, because negative prompts leave residual features and fall to paraphrase.

Fail-closed inheritance

A character contract extends a faction and may raise a requirement — never relax or silently drop one it inherited.

Mutation-tested decisions

The eleven compound predicates in the core are mutation-tested: 20 of 21 mutants killed, and the survivor is named rather than hidden.

Usage

Install — the core is GPU-free

pip install -e ".[dev]"
pcraft --help

Run the whole loop with no GPU

pcraft demo

# synth -> generate -> gate -> repair -> bind,
# against deterministic stubs

Check an image against a contract

pcraft gate hero.png

# 0 passed - 2 a required atom failed
# 3 unconfirmed - 4 could not run

Re-read what was bound

pcraft replay records/hero.json

# contract hash, generator + seed,
# verifier version, per-atom transcript

Open a store that is not the demo

pcraft list --contracts-dir ./contracts
pcraft validate --contract char:y

Emit the Cloud recipe graph

pcraft recipe --out kontext-fill.recipe.json

# does not submit; --image-name remaps plates