prehnite 0.1.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. prehnite-0.1.0a1/.gitignore +230 -0
  2. prehnite-0.1.0a1/LICENSE +21 -0
  3. prehnite-0.1.0a1/PKG-INFO +70 -0
  4. prehnite-0.1.0a1/README.md +236 -0
  5. prehnite-0.1.0a1/docs/PYPI_README.md +38 -0
  6. prehnite-0.1.0a1/pyproject.toml +61 -0
  7. prehnite-0.1.0a1/src/prehnite/__init__.py +2 -0
  8. prehnite-0.1.0a1/src/prehnite/_version.py +7 -0
  9. prehnite-0.1.0a1/src/prehnite/affine_contract.py +230 -0
  10. prehnite-0.1.0a1/src/prehnite/analytics.py +428 -0
  11. prehnite-0.1.0a1/src/prehnite/artifacts.py +64 -0
  12. prehnite-0.1.0a1/src/prehnite/brand.py +53 -0
  13. prehnite-0.1.0a1/src/prehnite/cache.py +154 -0
  14. prehnite-0.1.0a1/src/prehnite/cli.py +355 -0
  15. prehnite-0.1.0a1/src/prehnite/comfy.py +237 -0
  16. prehnite-0.1.0a1/src/prehnite/costing.py +53 -0
  17. prehnite-0.1.0a1/src/prehnite/crops.py +176 -0
  18. prehnite-0.1.0a1/src/prehnite/decision_engine.py +295 -0
  19. prehnite-0.1.0a1/src/prehnite/economics.py +159 -0
  20. prehnite-0.1.0a1/src/prehnite/engine.py +625 -0
  21. prehnite-0.1.0a1/src/prehnite/failures.py +240 -0
  22. prehnite-0.1.0a1/src/prehnite/gallery.py +242 -0
  23. prehnite-0.1.0a1/src/prehnite/hardware.py +142 -0
  24. prehnite-0.1.0a1/src/prehnite/images.py +110 -0
  25. prehnite-0.1.0a1/src/prehnite/jev_wire_fixture.py +236 -0
  26. prehnite-0.1.0a1/src/prehnite/judges.py +134 -0
  27. prehnite-0.1.0a1/src/prehnite/manifest.py +68 -0
  28. prehnite-0.1.0a1/src/prehnite/mcp_jobs.py +212 -0
  29. prehnite-0.1.0a1/src/prehnite/mcp_server.py +76 -0
  30. prehnite-0.1.0a1/src/prehnite/native_inspection.py +244 -0
  31. prehnite-0.1.0a1/src/prehnite/onboarding.py +123 -0
  32. prehnite-0.1.0a1/src/prehnite/parquet_export.py +264 -0
  33. prehnite-0.1.0a1/src/prehnite/pixel_comparison.py +280 -0
  34. prehnite-0.1.0a1/src/prehnite/position_audit.py +175 -0
  35. prehnite-0.1.0a1/src/prehnite/private_source_preflight.py +132 -0
  36. prehnite-0.1.0a1/src/prehnite/provenance.py +142 -0
  37. prehnite-0.1.0a1/src/prehnite/providers.py +221 -0
  38. prehnite-0.1.0a1/src/prehnite/real_cutout_eval.py +196 -0
  39. prehnite-0.1.0a1/src/prehnite/recipe_execution.py +94 -0
  40. prehnite-0.1.0a1/src/prehnite/recipe_resolver.py +195 -0
  41. prehnite-0.1.0a1/src/prehnite/recipes.py +223 -0
  42. prehnite-0.1.0a1/src/prehnite/registry.py +208 -0
  43. prehnite-0.1.0a1/src/prehnite/repair.py +357 -0
  44. prehnite-0.1.0a1/src/prehnite/reporting.py +212 -0
  45. prehnite-0.1.0a1/src/prehnite/review_intake.py +265 -0
  46. prehnite-0.1.0a1/src/prehnite/schema.py +196 -0
  47. prehnite-0.1.0a1/src/prehnite/store.py +381 -0
  48. prehnite-0.1.0a1/src/prehnite/tiled_alignment.py +266 -0
  49. prehnite-0.1.0a1/src/prehnite/typed_visual.py +263 -0
  50. prehnite-0.1.0a1/src/prehnite/visual_calibration.py +181 -0
@@ -0,0 +1,230 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ # Private, owner-authorized image corpora and source manifests (never upload)
223
+ /private-r2-pilot/
224
+ /private-r2-*.json
225
+ /prehnite-private-corpus/
226
+ /prehnite-private-reports/
227
+
228
+ # Private exploratory apparel masks and reports
229
+ /apparel-pilot-qa/
230
+ /private-apparel-pilot/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Studio Zettlerei
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.5
2
+ Name: prehnite
3
+ Version: 0.1.0a1
4
+ Summary: Local-first, quality-gated visual asset production with model-agnostic providers and MCP.
5
+ Project-URL: Homepage, https://github.com/interzettel/prehnite
6
+ Project-URL: Documentation, https://github.com/interzettel/prehnite/blob/main/README.md
7
+ Project-URL: Source, https://github.com/interzettel/prehnite
8
+ Project-URL: Issues, https://github.com/interzettel/prehnite/issues
9
+ Project-URL: Changelog, https://github.com/interzettel/prehnite/blob/main/CHANGELOG.md
10
+ Author: Studio Zettlerei
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: httpx<1,>=0.27
15
+ Requires-Dist: pillow<13,>=11
16
+ Requires-Dist: pydantic<3,>=2.9
17
+ Requires-Dist: pyyaml<7,>=6
18
+ Requires-Dist: typer<1,>=0.15
19
+ Provides-Extra: anthropic
20
+ Requires-Dist: anthropic<1,>=0.69; extra == 'anthropic'
21
+ Provides-Extra: dev
22
+ Requires-Dist: packaging<27,>=24; extra == 'dev'
23
+ Requires-Dist: pytest<10,>=8; extra == 'dev'
24
+ Requires-Dist: ruff<1,>=0.8; extra == 'dev'
25
+ Provides-Extra: fal
26
+ Requires-Dist: fal-client<1,>=0.7; extra == 'fal'
27
+ Provides-Extra: mcp
28
+ Requires-Dist: mcp<3,>=1.28; extra == 'mcp'
29
+ Provides-Extra: parquet
30
+ Requires-Dist: pyarrow<27,>=18; extra == 'parquet'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Prehnite
34
+
35
+ **Local-first, quality-gated visual asset production. No mandatory SaaS or platform fees.**
36
+
37
+ [Source and project README](https://github.com/interzettel/prehnite#readme) · [Roadmap](https://github.com/interzettel/prehnite/blob/main/docs/ROADMAP.md) · [Changelog](https://github.com/interzettel/prehnite/blob/main/CHANGELOG.md) · [Issues](https://github.com/interzettel/prehnite/issues)
38
+
39
+ Prehnite is an MIT-licensed Python CLI and optional MCP integration for batch image generation, masks/cutouts, technical validation, targeted repair, stateful replay, quality evidence, and reproducible export. It **orchestrates image models**; it does not include model weights, a photorealistic image generator, or a subscription service.
40
+
41
+ ## Quick start: no-cost local test
42
+
43
+ Requires Python 3.11 or later.
44
+
45
+ ```bash
46
+ python -m pip install prehnite
47
+ prehnite init --destination my-first-batch
48
+ prehnite doctor
49
+ prehnite --help
50
+ ```
51
+
52
+ The `init` command creates local starter configuration, but does not run model inference or incur fees. For a sample batch, follow the source repository's [two-minute demo](https://github.com/interzettel/prehnite#try-it-in-two-minutes).
53
+
54
+ For a sample zero-cost batch, follow the [up-to-date project README](https://github.com/interzettel/prehnite#try-it-in-two-minutes) and [onboarding guide](https://github.com/interzettel/prehnite/blob/main/docs/ONBOARDING.md).
55
+
56
+ ## What is actually implemented
57
+
58
+ - CLI, strict manifest/profile validation, stage journal, bounded attempts and safe archive/export paths.
59
+ - Offline synthetic demo flow, reports and reproducible zero-cost validation.
60
+ - Experimental local ComfyUI adapter and **opt-in** `prehnite-micro` recipe binding with immutable batch identity. You must separately install ComfyUI and supply licensed checkpoints and compatible graphs. No real GPU model/cutout quality or 4K VRAM tier is certified.
61
+ - Optional paid inference connectors require explicit operator-selected profiles, permissions and budgets. **Installing Prehnite does not authorize any cloud uploads or paid API calls.**
62
+ - `prehnite-macro` is currently a read-only workflow blueprint, not an installed or benchmarked high-quality image pipeline.
63
+
64
+ See the [implementation/evidence roadmap](https://github.com/interzettel/prehnite/blob/main/docs/ROADMAP.md), [recipe contract](https://github.com/interzettel/prehnite/blob/main/docs/MODEL_RECIPES.md) and [public release history](https://github.com/interzettel/prehnite/blob/main/CHANGELOG.md).
65
+
66
+ ## Release quality and licensing
67
+
68
+ The initial **0.1.0 alpha** is an early developer preview, **not production certified**. Passing synthetic CI does not prove realistic image quality, legal rights to separate checkpoints, accepted cutout accuracy, stable public APIs or physical GPU suitability.
69
+
70
+ Prehnite code: MIT. Checkpoint weights, providers and third-party assets are governed by their own licenses and usage terms. The package contains **no bundled checkpoint/model weights**.
@@ -0,0 +1,236 @@
1
+ <div align="center">
2
+ <img src="assets/prehnite-riso-green-coral.png" alt="Prehnite — Make the batch. Keep the best. Forest-green and coral Riso identity on warm paper." width="680" style="border-radius: 16px; clip-path: inset(0 round 16px);" />
3
+ <p><strong>Batch image production without the platform tax.</strong><br />
4
+ An open-source Python engine for generating, checking, refining and exporting visual assets.</p>
5
+ <p>
6
+ <a href="https://github.com/interzettel/prehnite/actions/workflows/ci.yml"><img alt="Tests" src="https://github.com/interzettel/prehnite/actions/workflows/ci.yml/badge.svg" /></a>
7
+ <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-075231" /></a>
8
+ <img alt="Python 3.11 or newer" src="https://img.shields.io/badge/python-3.11%2B-53675a" />
9
+ <img alt="Development version" src="https://img.shields.io/badge/status-development-a63d35" />
10
+ <img alt="Mandatory platform fees: zero" src="https://img.shields.io/badge/platform%20fees-%240-075231" />
11
+ </p>
12
+ <p>
13
+ <a href="#try-it-in-two-minutes">Quick start</a> ·
14
+ <a href="#how-it-works">How it works</a> ·
15
+ <a href="#where-things-stand">Project status</a> ·
16
+ <a href="docs/progress/STATUS.md">Progress</a> ·
17
+ <a href="CHANGELOG.md">Changelog</a> ·
18
+ <a href="docs/VERSIONING.md">Versioning</a> ·
19
+ <a href="https://github.com/orgs/interzettel/projects/1">Project board</a>
20
+ </p>
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## Ninety images is a different problem from one image
26
+
27
+ Generating a single good picture is easy to demonstrate. Making a *batch* of assets to a brief, with the correct dimensions, cutouts, filenames, and a predictable bill, is a different job.
28
+
29
+ Prehnite is an attempt to automate the boring, expensive middle: keeping track of prompts and seeds, trying variants, checking what worked, doing targeted repairs instead of blindly starting over, and handing back exactly the files you asked for.
30
+
31
+ The ambition is simple: **spend less per *usable* asset, not merely less per generation.** It is a design target, not a claim we've already established with real-world benchmarks.
32
+
33
+ **Free orchestration is non-negotiable.** Prehnite is MIT licensed, runs locally, and has no required account, hosted workflow subscription, or per-seat platform fee. Use a local model where practical; connect to a paid image API *only when you choose to*, with a budget you set.
34
+
35
+ ## Start with a zero-cost local batch
36
+
37
+ Run `prehnite init --destination my-first-batch` to get two safe sample
38
+ YAML files, then `prehnite doctor` to inspect your Python environment
39
+ without revealing any keys or contacting a service. For details, see
40
+ [the first-run guide](docs/ONBOARDING.md). These commands do not run AI
41
+ image generation or incur any inference costs.
42
+
43
+ For measured-versus-unknown OS/RAM/GPU inventory, run `prehnite hardware`.
44
+ This **offline, read-only** command can query local `nvidia-smi`; it never
45
+ certifies a GPU memory tier or recipe feasibility. See
46
+ [hardware doctor limitations](docs/HARDWARE_DOCTOR.md) (issue #134).
47
+
48
+ ## Try it in two minutes
49
+
50
+ You can test the complete workflow without a GPU, credentials, subscription, or inference charge. **The demo creates simple synthetic test images, not AI photographs.**
51
+
52
+ Clone the repo, create a Python 3.11+ environment, and install:
53
+
54
+ ```bash
55
+ git clone https://github.com/interzettel/prehnite.git
56
+ cd prehnite
57
+ python -m venv .venv
58
+ # Windows PowerShell: .\.venv\Scripts\Activate.ps1
59
+ # macOS/Linux: source .venv/bin/activate
60
+ python -m pip install -e .
61
+ ```
62
+
63
+ Run a preflight estimate, then the zero-cost sample batch:
64
+
65
+ ```bash
66
+ prehnite validate examples/manifest.yaml --profile examples/profile-demo.yaml
67
+ prehnite estimate examples/manifest.yaml --profile examples/profile-demo.yaml
68
+ prehnite run examples/manifest.yaml --profile examples/profile-demo.yaml --workspace workspace
69
+ ```
70
+
71
+ Look under `workspace/batches/portrait-pilot/`. You'll find the selected images, the state journal, JSON/CSV reports, an [offline visual gallery](docs/OFFLINE_GALLERY.md) (`gallery.html`), a [local provenance record](docs/PROVENANCE.md) (`provenance.json`), and a ZIP with the requested output paths. A second run reuses completed stages.
72
+
73
+ <details>
74
+ <summary><strong>What the output looks like</strong></summary>
75
+
76
+ ```text
77
+ workspace/
78
+ └── batches/
79
+ └── portrait-pilot/
80
+ ├── state.sqlite3
81
+ ├── intermediates/
82
+ ├── selected/
83
+ │ └── photos/
84
+ │ ├── street-001.jpg
85
+ │ └── interior-001.jpg
86
+ ├── report.json
87
+ ├── operations.csv
88
+ ├── report.html
89
+ ├── gallery.html
90
+ ├── provenance.json
91
+ └── prehnite-portrait-pilot.zip
92
+ ```
93
+
94
+ The ZIP preserves your requested relative filenames. Accepted cutouts, when configured, are transparent PNGs. Internally generated files stay separate from the deliverables.
95
+
96
+ </details>
97
+
98
+ ## How it works
99
+
100
+ | | Stage | What Prehnite does |
101
+ | :--- | :--- | :--- |
102
+ | 01 | **Describe** | Read a structured manifest: prompts or existing images, exact sizes, targets and output filenames |
103
+ | 02 | **Plan** | Choose model providers and variants; estimate request counts and spend before starting |
104
+ | 03 | **Make** | Run generation and optional upscaling; preserve seeds, inputs and intermediate artifacts |
105
+ | 04 | **Check** | Apply technical checks, and optional model-based judgments when configured |
106
+ | 05 | **Repair** | Retry selectively under a hard attempt limit; cutout errors needn't regenerate accepted photos |
107
+ | 06 | **Deliver** | Export accepted images, named cutouts, a ZIP and an inspectable report |
108
+
109
+ A small manifest can describe a portrait batch with precise delivery requirements:
110
+
111
+ ```yaml
112
+ id: street-pilot
113
+ assets:
114
+ - id: rainy-street
115
+ prompt: "A candid smartphone photograph of a rainy street at dusk"
116
+ aspect_ratio: "9:16"
117
+ target_size: [2160, 3840]
118
+ output:
119
+ image: photos/rainy-street.jpg
120
+ cutouts: {}
121
+ ```
122
+
123
+ The **manifest** says *what* to make. A separate **profile** says *how*: which provider/model to use, whether to compare 2K-upscaled and 4K variants, what to accept, the retry limit, and whether cloud calls may cost money. See the [working examples](examples/).
124
+
125
+ ### Model Recipe status: micro / macro
126
+
127
+ Prehnite now has **versioned model-workflow blueprints** rather than a single hard-coded model. `prehnite-micro` targets operator-configured, local-first ComfyUI runs; `prehnite-macro` explores later high-capability/hybrid workflows. The checked-in JSON recipes **do not contain models or execute on their own**.
128
+
129
+ | Capability | `prehnite-micro` | `prehnite-macro` |
130
+ | --- | --- | --- |
131
+ | Versioned manifest / capability graph | Implemented | Implemented |
132
+ | Local model/input hash resolver | Implemented, operator-supplied | Not implemented |
133
+ | Recipe-bound engine/journal execution path | Experimental, opt-in | Not implemented |
134
+ | Checkpoint installer and rights review | Planned | Planned |
135
+ | Real GPU & human-cutout-quality benchmark | Unverified | Unverified |
136
+
137
+ **Read the [recipe roadmap](docs/ROADMAP.md#model-recipes-workstream--versioned-micromacro-october-2026) and [recipe architecture](docs/MODEL_RECIPES.md)** for the work completed, outstanding milestones and exact evidence gates. Neither mode claims a tested 4/6/8/12 GB laptop tier or preinstalled models.
138
+
139
+ ### Explicit local ComfyUI recipe execution (experimental)
140
+
141
+ The existing `prehnite run` command can now pin an operator-supplied micro recipe
142
+ and exact local workflow/checkpoint SHA256 to a batch's SQLite journal using
143
+ `--recipe --bindings --workflows --checkpoints`. Model/graph mismatches and
144
+ unbound resumes fail closed; **actual ComfyUI execution requires the operator's
145
+ separate local ComfyUI process, checkpoints and compatible graphs** and has not
146
+ been GPU-benchmarked. See [recipe execution limitations](docs/RECIPE_EXECUTION.md).
147
+
148
+ ### Local micro recipe input verification (non-executable)
149
+
150
+ `prehnite recipe-resolve` verifies explicitly supplied local ComfyUI API graphs and
151
+ checkpoint bytes against SHA256 and operator-acknowledged terms without downloads,
152
+ cloud calls, credentials or inferred GPU suitability. This **inspection command**
153
+ produces a read-only, non-executable receipt; use the separate, opt-in
154
+ `prehnite run` recipe bridge above to bind those inputs to a real batch.
155
+ See the [operator setup and limitations](docs/LOCAL_MODEL_RESOLVER.md).
156
+
157
+ ### Bring your own models, not your own orchestration subscription
158
+
159
+ | Route | What it means today |
160
+ | --- | --- |
161
+ | **Demo (no-cost)** | Synthetic generator + Pillow resize and technical checks. Runs offline and is covered by CI. |
162
+ | **Local ComfyUI** | Adapter for your own ComfyUI API-format workflows on localhost. You supply model weights and real graph/node mappings; no validated GPU workflow is bundled yet. |
163
+ | **fal.ai (optional paid)** | Opt-in hosted image generation/upscaling/segmentation adapter. Interfaces exist, but real endpoint schemas, pricing and image results still require live integration tests. |
164
+ | **Anthropic judge (optional paid)** | An opt-in image comparison/rubric adapter. It is not a calibrated or production-validated quality benchmark. |
165
+
166
+ No paid stage can be enabled by simply running the demo. Real cloud profiles require explicit `allow_paid` and, where images leave your machine, `allow_cloud_uploads`. They also require per-stage cost estimates and a positive `max_usd` cap. **Reserved amounts are estimates, not provider invoices or guaranteed billing ceilings.**
167
+
168
+ You can inspect what each adapter is actually prepared to run using
169
+ `prehnite models`. The [typed capability catalogue](docs/PROVIDER_CONTRACTS.md)
170
+ lists operation/input types, supported tiers and formats, upload requirements,
171
+ schema references, licensing cautions, and unimplemented candidates. Preflight
172
+ checks unsupported paid models and incompatible options **before an API call**;
173
+ custom ComfyUI graphs remain user-defined. The catalogue never supplies a
174
+ live price: all paid quotes in example profiles must be verified and updated
175
+ by you.
176
+
177
+ For the locally hosted route, start with [the ComfyUI example profile](examples/profile-comfyui.yaml). For pay-per-use hosting, review [the fal profile](examples/profile-fal.yaml), verify endpoint contracts and current prices, and provide your own `FAL_KEY`. Do not use the sample prices as a quote.
178
+
179
+ ### Inspect detail without paying a judge
180
+
181
+ Image previews can hide important 4K defects. You can create **native-pixel detail crops** and an annotated overview entirely offline:
182
+
183
+ ```bash
184
+ prehnite crops my-photo.png --output detail-evidence --edge 1024
185
+ ```
186
+
187
+ The output includes five lossless corner/center crops and a SHA256 manifest. Add `--anchor-x 0.45 --anchor-y 0.35` for one manually chosen area. This creates review evidence, **not an automated quality score**. [Read the crop guide](docs/CROP_EVIDENCE.md).
188
+
189
+ ### Opt-in reuse for repeatable stages
190
+
191
+ Prehnite can keep locally verified stage outputs in a
192
+ [private, content-addressed cache](docs/CACHING.md). It is disabled unless
193
+ you specify an explicit owner namespace; prompts, seeds, input hashes,
194
+ model options, version and model revision participate in the cache key.
195
+ Cloud-model reuse requires a separate cache opt-in and a pinned model
196
+ revision. A cache hit has no *new* provider request, but it does not erase
197
+ historical charges or prove previously billed amounts.
198
+
199
+ ### Measure cost per usable asset, not raw generations
200
+
201
+ The offline [economics report](docs/ECONOMICS.md) distinguishes
202
+ **reserved/estimated spend** from **provider-reported partial amounts** and
203
+ **verified invoices** (currently unavailable). It tracks accepted versus
204
+ rejected assets, repeated stage invocations, local timing coverage and
205
+ cost-per-accepted output. Failures still contribute to reserved cost; a
206
+ batch with zero accepted assets has no meaningful cost-per-accepted figure.
207
+
208
+ ## Where things stand
209
+
210
+ **`0.1.0a1` · first public developer alpha candidate.** Public PyPI installation is available only after the separately gated, verified [publishing workflow](docs/PYPI_PUBLISHING.md) succeeds; a version number or Git tag alone does not prove publication. See [Changelog](CHANGELOG.md), [Versioning](docs/VERSIONING.md) and [Release policy](docs/RELEASING.md). The core synthetic workflow works; **photorealistic quality, 4K GPU feasibility, segmentation accuracy and actual API billing have not been certified**.
211
+
212
+ The tracker distinguishes implemented scaffolding from independently evidenced completions, and records issues blocked by local hardware, human calibration or paid-call authorization.
213
+
214
+ [![Prehnite roadmap and atomic-task delivery progress](docs/progress/atomic.svg)](docs/progress/ATOMIC.md)
215
+
216
+ **Two different measures:** The original 61-unit release roadmap counts complete, evidenced units. The [atomic task tracker](docs/progress/ATOMIC.md) counts smaller PR-sized deliverables **only within the initially unfinished roadmap units**. An atomic task may finish without completing its parent; neither percentage measures image quality or engineering hours. [Full original milestone chart](docs/progress/progress.svg).
217
+
218
+ [Read the 61-unit release ledger](docs/progress/STATUS.md) · [73 agent-sized tasks and acceptance criteria](docs/progress/ATOMIC.md) · [90-asset no-cost benchmark](docs/OFFLINE_90_BENCHMARK.md) · [Technical release gates](docs/PROGRESS.md) · [Offline production analytics](docs/OFFLINE_ANALYTICS.md) · [Private native source/output inspection](docs/NATIVE_INSPECTION.md) · [Pixel-grid diagnostics](docs/PIXEL_DIAGNOSTICS.md) · [Affine v2 registration contract](docs/AFFINE_CONTRACT.md) · [Experimental Jev typed visual judge](docs/JEV_VISUAL_JUDGE.md) · [Unified decision engine](docs/DECISION_ENGINE.md) · [Attested 4K tile diagnostics](docs/ALIGNMENT_TILES.md) · [Optional Parquet export](docs/PARQUET_EXPORT.md) · [1:1 native image inspection](docs/NATIVE_INSPECTION.md) · [Failure codes and recovery actions](docs/FAILURE_TAXONOMY.md) · [Current sprint](docs/SPRINT.md) · [Roadmap](docs/ROADMAP.md)
219
+
220
+ The [Produce / Explore / Experiment evaluation RFC](docs/BATCH_OBJECTIVES.md) describes future batch modes and a measurement framework; v0.1 implements neither a general exploration planner nor a Pareto dashboard.
221
+
222
+ GitHub [Project #1](https://github.com/orgs/interzettel/projects/1) tracks workflow; the version-controlled [ledger](progress/ledger.json) tracks evidence. They answer different questions. Native Project field syncing is still [planned](https://github.com/interzettel/prehnite/issues/44).
223
+
224
+ ## Built for a maintainer and their agents
225
+
226
+ Prehnite has a CLI first, optional [stdio MCP tools](src/prehnite/mcp_server.py) second. A person can run it directly; agents can submit preconfigured batches, check status, and request exports without being given arbitrary shell access. MCP workers now support [durable reconnect and cooperative pause/cancel/resume](docs/MCP_LIFECYCLE.md) on the main branch; a stop request does not immediately stop an in-flight provider request.
227
+
228
+ The project itself is managed the same way: small issue scopes, PR-based delivery, offline tests, and a persistent [agent-to-agent handoff thread](https://github.com/interzettel/prehnite/issues/9). One maintainer sets direction and approves spend and releases. Agents do the repeatable engineering work and leave evidence—not inflated status reports.
229
+
230
+ To contribute or extend the engine, start with [Contributing](CONTRIBUTING.md), [Architecture](docs/ARCHITECTURE.md), [Security](docs/SECURITY.md), and [Versioning](docs/VERSIONING.md). Issues are welcome, particularly for adapters that remain optional and testable without network access.
231
+
232
+ ## License and boundaries
233
+
234
+ **[MIT](LICENSE)** for Prehnite's own code. Image models, checkpoints, external APIs, datasets, and other installed applications retain **their own** terms; nothing about this repository grants a license to third-party weights. See [Licensing](docs/LICENSING.md) and the [release policy](docs/RELEASING.md).
235
+
236
+ No model checkpoint ships with the repo. No mandatory hosted product or subscription. No release tags until a version has passed its gates and the maintainer approves it.
@@ -0,0 +1,38 @@
1
+ # Prehnite
2
+
3
+ **Local-first, quality-gated visual asset production. No mandatory SaaS or platform fees.**
4
+
5
+ [Source and project README](https://github.com/interzettel/prehnite#readme) · [Roadmap](https://github.com/interzettel/prehnite/blob/main/docs/ROADMAP.md) · [Changelog](https://github.com/interzettel/prehnite/blob/main/CHANGELOG.md) · [Issues](https://github.com/interzettel/prehnite/issues)
6
+
7
+ Prehnite is an MIT-licensed Python CLI and optional MCP integration for batch image generation, masks/cutouts, technical validation, targeted repair, stateful replay, quality evidence, and reproducible export. It **orchestrates image models**; it does not include model weights, a photorealistic image generator, or a subscription service.
8
+
9
+ ## Quick start: no-cost local test
10
+
11
+ Requires Python 3.11 or later.
12
+
13
+ ```bash
14
+ python -m pip install prehnite
15
+ prehnite init --destination my-first-batch
16
+ prehnite doctor
17
+ prehnite --help
18
+ ```
19
+
20
+ The `init` command creates local starter configuration, but does not run model inference or incur fees. For a sample batch, follow the source repository's [two-minute demo](https://github.com/interzettel/prehnite#try-it-in-two-minutes).
21
+
22
+ For a sample zero-cost batch, follow the [up-to-date project README](https://github.com/interzettel/prehnite#try-it-in-two-minutes) and [onboarding guide](https://github.com/interzettel/prehnite/blob/main/docs/ONBOARDING.md).
23
+
24
+ ## What is actually implemented
25
+
26
+ - CLI, strict manifest/profile validation, stage journal, bounded attempts and safe archive/export paths.
27
+ - Offline synthetic demo flow, reports and reproducible zero-cost validation.
28
+ - Experimental local ComfyUI adapter and **opt-in** `prehnite-micro` recipe binding with immutable batch identity. You must separately install ComfyUI and supply licensed checkpoints and compatible graphs. No real GPU model/cutout quality or 4K VRAM tier is certified.
29
+ - Optional paid inference connectors require explicit operator-selected profiles, permissions and budgets. **Installing Prehnite does not authorize any cloud uploads or paid API calls.**
30
+ - `prehnite-macro` is currently a read-only workflow blueprint, not an installed or benchmarked high-quality image pipeline.
31
+
32
+ See the [implementation/evidence roadmap](https://github.com/interzettel/prehnite/blob/main/docs/ROADMAP.md), [recipe contract](https://github.com/interzettel/prehnite/blob/main/docs/MODEL_RECIPES.md) and [public release history](https://github.com/interzettel/prehnite/blob/main/CHANGELOG.md).
33
+
34
+ ## Release quality and licensing
35
+
36
+ The initial **0.1.0 alpha** is an early developer preview, **not production certified**. Passing synthetic CI does not prove realistic image quality, legal rights to separate checkpoints, accepted cutout accuracy, stable public APIs or physical GPU suitability.
37
+
38
+ Prehnite code: MIT. Checkpoint weights, providers and third-party assets are governed by their own licenses and usage terms. The package contains **no bundled checkpoint/model weights**.
@@ -0,0 +1,61 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "prehnite"
7
+ dynamic = ["version"]
8
+ description = "Local-first, quality-gated visual asset production with model-agnostic providers and MCP."
9
+ readme = "docs/PYPI_README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.11"
12
+ authors = [{name = "Studio Zettlerei"}]
13
+ dependencies = [
14
+ "pydantic>=2.9,<3",
15
+ "pillow>=11,<13",
16
+ "pyyaml>=6,<7",
17
+ "typer>=0.15,<1",
18
+ "httpx>=0.27,<1",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/interzettel/prehnite"
23
+ Documentation = "https://github.com/interzettel/prehnite/blob/main/README.md"
24
+ Source = "https://github.com/interzettel/prehnite"
25
+ Issues = "https://github.com/interzettel/prehnite/issues"
26
+ Changelog = "https://github.com/interzettel/prehnite/blob/main/CHANGELOG.md"
27
+
28
+ [project.optional-dependencies]
29
+ fal = ["fal-client>=0.7,<1"]
30
+ anthropic = ["anthropic>=0.69,<1"]
31
+ mcp = ["mcp>=1.28,<3"]
32
+ parquet = ["pyarrow>=18,<27"]
33
+ dev = ["pytest>=8,<10", "ruff>=0.8,<1", "packaging>=24,<27"]
34
+
35
+ [project.scripts]
36
+ prehnite = "prehnite.cli:app"
37
+ prehnite-mcp = "prehnite.mcp_server:main"
38
+
39
+ [tool.hatch.version]
40
+ path = "src/prehnite/_version.py"
41
+
42
+ # Public sdists contain only the package and release metadata. Never ship
43
+ # local .env templates, CI internals, uploaded photos or third-party weights.
44
+ [tool.hatch.build.targets.sdist]
45
+ include = [
46
+ "/pyproject.toml",
47
+ "/README.md",
48
+ "/LICENSE",
49
+ "/docs/PYPI_README.md",
50
+ "/src/prehnite",
51
+ ]
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["src/prehnite"]
55
+
56
+ [tool.pytest.ini_options]
57
+ testpaths = ["tests"]
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ target-version = "py311"
@@ -0,0 +1,2 @@
1
+ """Prehnite: quality-gated visual asset production."""
2
+ from ._version import __version__
@@ -0,0 +1,7 @@
1
+ """Authoritative PEP 440 package version for reviewed public alpha builds.
2
+
3
+ Hatchling discovers this value, and prehnite.__init__ imports it.
4
+ Change only in a dedicated, reviewed version-bump PR.
5
+ """
6
+
7
+ __version__ = "0.1.0a1"