Coordinate local-first generation on machines where Pi's local LLM and ComfyUI models cannot safely occupy GPU or system memory at the same time, using a fully precompiled ComfyUI batch and a model-free runtime handoff.
Scanned 9/9/2026
Install to Claude Code
npx -y skills add badgids/Story-Film-Skills --skill resource-safe-generation --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Resource Safe Generation?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/badgids-resource-safe-generation)More formats (shields.io, HTML) on the badges page.
---
name: resource-safe-generation
description: Coordinate local-first generation on machines where Pi's local LLM and ComfyUI models cannot safely occupy GPU or system memory at the same time, using a fully precompiled ComfyUI batch and a model-free runtime handoff.
author: Alan Guice (Badgids)
license: Apache-2.0
compatibility: Python 3. Optional local LLM lifecycle commands supplied by the user. Native ComfyUI HTTP API.
---
# 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.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!