- Python 61%
- JavaScript 30%
- CSS 6%
- Jinja-like 2%
- HTML 1%
LUKI - Luki's Universal Kollection Interface #
A trait-driven generative collection IDE for ComfyUI.
LUKI helps you design, balance, render, and ship generative art collections.
Define your categories, write a main prompt with __PLACEHOLDER__ tokens,
add traits per category, mark rarity tiers, and let LUKI handle the math,
the renders, and the metadata.
Features #
- Trait-driven prompts with
__CATEGORY__placeholder substitution and dynamic syntax ({a|b|c}, weight expressions). - ComfyUI rendering pipeline with automatic workflow inspection — drop in
any workflow JSON (editor or API format, subgraphs included) and LUKI
detects the prompt input, save nodes, and seed nodes for you. A
/wizardpage lets you fix the mapping by hand if auto-detection misses anything. - Rarity math to balance supply across categories and traits.
- Live state in the browser with autosave; user-added categories survive restarts.
- No hardcoded paths or node IDs — everything is configurable via
config.json.
Requirements #
- Python 3.10+
- A running ComfyUI instance
(defaults to
127.0.0.1:8188) - A ComfyUI workflow exported as JSON (either editor format or API format)
Install #
git clone https://codeberg.org/karmicgrid/luki.git
cd luki
python3.10 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Configure #
Copy the example config and edit it:
cp config.example.json config.json
Three things you must set:
comfyui.workflow_path— path to your ComfyUI workflow JSON (use ComfyUI's "Save (API Format)" or just save the editor JSON; LUKI handles both).paths.comfy_image_output_dir— must point at ComfyUI's actual output directory (e.g./home/you/ComfyUI/output). ComfyUI refuses to write outside this directory, and LUKI scans it to retrieve rendered images.collection.categories— list your trait categories. Eachnamebecomes a__NAME__placeholder you can reference inmain_prompt.
For production, set LUKI_USERNAME and LUKI_PASSWORD environment
variables instead of relying on the fallback credentials.
Run #
luki
Or, if you prefer not to install the entry point:
python -m luki
Then open http://localhost:8080 in your browser. Log in with the
configured credentials (default user / changeme from the example
config).
On first run, if workflow_mapping.json doesn't exist or its node IDs
don't match your workflow, LUKI auto-detects the bindings. If detection
fails or you want to override it, visit http://localhost:8080/wizard.
Usage flow #
- Master Prompt tab — write the template using
__CATEGORY__placeholders. - Add traits per category. Each trait can carry its own modifiers
that override the main prompt locally (
__EXPRESSION__etc.). - Render previews from each trait row. Up to 3 sample renders per trait. Click ⬆️ to upload your own.
- Stats tab — set target supply, tune rarity tiers, and watch LUKI distribute counts.
- Builder tab — combine specific traits and render one-offs.
- Save — your work autosaves to
data/saves/<timestamp>/state.json.
Project layout #
src/luki/
config.py # config loading + validation
models.py # pydantic models
server.py # FastAPI app + lifecycle
__main__.py # CLI entry point
core/
comfyui.py # ComfyUI client + workflow injection
prompt.py # placeholder + dynamic syntax resolver
state_manager.py # save/load state
workflow_inspector.py # auto-detect node mapping; editor→API conversion
images.py
routes/ # FastAPI routers
templates/ # Jinja2
static/ # JS + CSS
tests/ # 80 passing tests
config.example.json
workflow_mapping.example.json
Development #
pip install -e ".[dev]"
ruff check src/ tests/
pytest
License #
MIT — see LICENSE.