Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG LongShot Plan Extractor
ComfyUI Node

VRGDG LongShot Plan Extractor

VRGDG LongShot Plan Extractor

By vrgamegirl19·Created about a year ago·Updated a day ago· 742
VRGDG LongShot Plan Extractor
    • video_idea
    • chunk_direction
    • dialogue_this_chunk
    • previous_dialogue_carryover
    • character_bible
    • plan_status
    ◄director_plan—►
    ◄chunk_number1►

    The node that saves you the copy-paste

    You planned a whole story in one LLM pass. Now you need chunk 3's slice of it: what the chunk is for, what it opens on, what the camera does, what the characters say, and what the previous chunk's last line was so nobody repeats it. You could scroll through the JSON and paste six fields by hand, six times, per render.

    This node does it for you, deterministically, with no LLM call. It reads the plan JSON, pulls chunk N out of it, and re-exposes the pieces that the pack's LongShot LLM Prompt Context node expects as inputs.

    How it works

    director_plan comes in as a link (it's forceInput, so you drag it from your LLM node's text output), along with chunk_number. The node strips Markdown fences, slices between the first { and last }, parses, and builds a lookup of chunks keyed by their chunk_number field - falling back to array position when that field is missing or unreadable. Ask for a chunk that isn't in the plan and you get The Auto Director plan does not contain chunk 7.

    Then it flattens the schema into prose fields:

    • video_idea is assembled from the plan's title, logline, format_mode, visual_bible, setting_bible, audio_bible, plus a rendered character list. Each character becomes Name (S1): visual description. Voice: voice description. Characters with no id are dropped - silently, which is worth knowing when someone's missing from your prompt.
    • chunk_direction is purpose, opening_state, action, camera, sound, ending_state - the story function and the physical camera plan, in one block.
    • dialogue_this_chunk formats the chunk's dialogue entries as NAME (S1): exact words, mapping speaker IDs to names where the cast list has them. If the plan put dialogue in as a plain string, that passes through untouched.
    • previous_dialogue_carryover is just the last line of the previous chunk's dialogue - a cheap anti-repetition guard for the seam.
    • character_bible is the same rendered cast list, exposed separately in case you want it in a text node.
    • plan_status is a one-liner: Extracted chunk 3 of 4: 14 dialogue tokens in formatted text. It counts words in the formatted dialogue, despite saying "tokens".

    No model, no network, no randomness. Same input, same output, every queue.

    Wiring it

    video_idea, chunk_direction and dialogue_this_chunk go into the corresponding sockets on VRGDG LongShot LLM Prompt Context, and previous_dialogue_carryover goes into previous_lyric_carryover. That replaces six manual transcriptions with three links.

    You need one Plan Extractor per chunk, each with its own chunk_number, since the field is a widget rather than a socket. Four extractors and four context nodes for a four-chunk story is normal; group them and keep the numbering visible, because a mismatched pair is the easiest mistake to make in this chain and it fails quietly - chunk 3 renders chunk 2's action and you won't notice until you watch it.

    character_bible and plan_status are the debugging pair. plan_status after a re-queue tells you the extract worked; character_bible empty tells you the plan's characters array was malformed, which is a prompting problem, not a code problem.

    Install

    Manager → search vrgamedev, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl.git
    python -m pip install -r comfyui-vrgamedevgirl/requirements.txt
    

    Restart and hard-refresh the browser. This node is pure Python with no dependencies of its own, though the pack it lives in installs a lot more than this.

    When it goes wrong

    • "does not contain a JSON object" or an invalid-JSON error with a line number. Your LLM answered in prose or emitted broken JSON. The parser handles fences and surrounding chatter; it can't salvage a missing comma.
    • "The Auto Director plan has no chunks array." The model returned the story fields but no chunk list. Re-ask with the schema spelled out.
    • Dialogue comes through with raw IDs like S2: instead of names. The plan's characters array didn't include that speaker. Fix the plan, not the node.
    • previous_dialogue_carryover is empty on chunk 1. Correct - there's no prior chunk, and the LLM Context node handles that case.
    • A character vanished from the bible. No id field in the plan entry. The node requires it because everything downstream keys off speaker IDs.

    It's a small utility, and its value is entirely in removing a transcription step. But in a four-chunk loop that's run a dozen times while you dial in a look, that's hundreds of copy-pastes you didn't do, and zero chances to paste the wrong chunk into the wrong node at two in the morning.

    CategoryVRGDG/Video/Long Shot

    Inputs (2)

    NameTypeDefaultDescription
    director_planSTRING—
    chunk_numberINT11–16—

    Outputs (6)

    NameTypeDescription
    video_ideaSTRING—
    chunk_directionSTRING—
    dialogue_this_chunkSTRING—
    previous_dialogue_carryoverSTRING—
    character_bibleSTRING—
    plan_statusSTRING—