resource-safe-generation

Installation
SKILL.md

Resource-Safe Generation

Read ../../references/RESOURCE_SAFE_GENERATION.md and ../../references/COMFYUI_OFFLINE_BATCH.md.

Use when the local LLM and ComfyUI generation models compete for VRAM/RAM.

Core rule: the LLM must finish every creative decision and every ComfyUI instruction before it is unloaded. The offline runner may execute, observe, retry transiently, collect outputs, and report state, but it may not invent prompts, choose new creative directions, repair semantics, or ask the unloaded model for help.

  1. Finish prompts, references, workflow mapping, seeds/parameters, output identities, and acceptance metadata.
  2. Build and validate 04_generation/comfyui/offline_batch.json with comfyui-offline-batch.
  3. Prove where Pi's active LLM runs before choosing a lifecycle mode. Run python ../../scripts/llm_runtime.py --endpoint <known-base-url> when an endpoint is available. A loopback endpoint such as 127.0.0.1, localhost, or ::1 is local. An OpenAI-compatible API does not imply a cloud model. If location is not proven, keep it unknown; never guess external.
  4. Configure 00_project/resource_policy.json with the verified location and a local LLM unload/reload adapter when exclusive mode is required.
  5. Arm scripts/resource_handoff.py. It starts a model-free runner and waits for the Pi agent turn to finish.
  6. The Pi extension writes the release signal on agent_end; without the extension, the user can run the explicit release command.
  7. The runner unloads the local LLM, executes the full ComfyUI batch deterministically, continuously updates project status/events, then calls ComfyUI /free with model unload and memory release.
  8. The runner reloads the local LLM and writes RESOURCE_RESUME.md containing results/blockers for the next model turn.
  9. If semantic repair is required, stop the batch, unload ComfyUI models, reload the LLM, and return the failed job plus evidence. Never improvise a new prompt while the LLM is absent.

The Pi progress extension renders resource phase and job progress from files on disk. These UI updates do not require an LLM call.

Installs
2
GitHub Stars
6
First Seen
Sep 19, 2026