Nodes/SDXL Auto Prompter/APNext H3 Claude Code Continue Writer
ComfyUI Node

APNext H3 Claude Code Continue Writer

Make the next clip actually continue the last one

By dagthomas·Created 3 years ago·Updated about 6 hours ago· 287
APNext H3 Claude Code Continue Writer
  • frames
  • llm
  • h3_prompt
  • integrated_multimodal_description
  • overall_soundscape
  • non_diegetic_music
  • session_id
  • info
  • first_frame
  • context_frames
frame_count4
frame_stride6
idea
continuation_modeI2VA (last frame becomes the first frame)
duration_seconds6.0
shot_planAuto
visual_styleAuto
wildness25
camera_motionAuto
camera_amplitudeAuto
camera_speedAuto
include_dialoguetrue
dialogue_languageEnglish
include_on_screen_textfalse
include_soundscapetrue
include_non_diegetic_musictrue
modelsonnet
researchfalse
directortrue
use_subscriptiontrue
timeout_seconds1200
seed-1
previous_prompt
extra_instructions
custom_dialogue_language
custom_visual_style
resume_session_id
working_dir
context_1
context_2
context_3
context_4
context_5
context_6
context_7
context_8

MiniMax-H3 renders clips, not movies. Every video node takes a prompt and produces one chunk - 5 to 15 seconds, give or take - and if you want a longer piece you have to keep the story going across clips. APNext H3 Claude Code Continue Writer is the node that does the hand-off: it looks at the frames of the clip you just rendered, shows them to Claude Code, and writes the H3 prompt for the next clip - with the last frame already designated as the new clip's first frame.

That last bit is the whole trick. Video models are allergic to continuity you don't spell out, so this node writes an I2VA prompt (image-to-video: the first frame is a given image) where the last frame of the old clip is <Picture 1> at 0.00s of the new clip. It hands that frame back out as first_frame so you can wire it straight into the video node. Continuation becomes a matter of "start here, go there" instead of "hopefully start near here."

How it samples what Claude sees

You feed the rendered clip's frames into frames (a decoded video batch). The node doesn't dump the whole thing at the model - it takes frame_count frames every frame_stride frames, counting back from the end. Defaults are 4 frames, one every 6 (a quarter second at 24fps), and the final frame is always included. The earlier frames are context only: they tell the model which way the camera and the action were moving, so the continuation doesn't reverse a pan or freeze mid-swing. Those sampled frames come back out as context_frames so you can preview exactly what it saw - worth doing once, because if the sampling strip looks wrong, the continuation will too.

Switch continuation_mode to T2VA and it instead writes a cut to a fresh scene of the same story; the frames only inform look and mood.

Inputs that matter

  • frames - the rendered clip (decode it first).
  • frame_count / frame_stride - how many frames Claude sees and how far apart.
  • idea - what happens next. Leave empty and Claude decides how the scene naturally carries on; that's often the better first pass.
  • previous_prompt - the H3 prompt that made the clip you're continuing. For a long chain, paste every prompt so far, oldest first. Not needed if you use resume_session_id.
  • resume_session_id - the killer feature. Feed it the writer's session_id (or the previous Continue Writer's) and Claude Code still has the guide, the earlier frames and every prompt in context, so characters, speaker IDs and the soundscape stay consistent across many clips.
  • duration_seconds, visual_style (Auto keeps the previous clip's look - almost always what you want), wildness, the camera block, dialogue toggles - same controls as the base writer.
  • llm (optional) - connect an H3 LLM Backend to write with Ollama instead of the CLI.

Outputs: h3_prompt plus the split-out section fields (integrated_multimodal_description, overall_soundscape, non_diegetic_music), session_id, info, first_frame and context_frames.

Installing

Part of dagthomas/comfyui_dagthomas. ComfyUI Manager → search comfyui_dagthomas, or clone into custom_nodes + pip install -r requirements.txt, restart. Under APNext → H3.

The one real prerequisite: Claude Code must be installed and logged in (claude on PATH, or CLAUDE_CODE_PATH set). If claude isn't found, the node can't run - there's no API-key fallback for the default engine. Calls are slower than an API hit (tens of seconds; 25–60s is normal for an H3 prompt, longer with research on), and each call carries Claude Code's ~35k-token tool preamble, so a long chain burns your subscription window - that's the trade for a session that remembers everything. Keep timeout_seconds above the default 900 for research runs, and don't forget use_subscription is on by default, which is what makes it bill your seat rather than an API key.

Categorycomfyui_dagthomas/H3

Inputs (38)

NameTypeDefaultDescription
framesIMAGEThe frames of the clip to continue - wire a decoded video batch in here. Only the last frames are sent to Claude Code; the very last one is the next clip's first frame.
frame_countINT41–20How many of the last frames to show Claude Code. The final frame is always included; the ones before it only show which way things were moving.
frame_strideINT61–120Gap between the sampled frames. 1 = strictly consecutive frames (nearly identical at 24 fps); 6 = one every quarter second. Counting back from the last frame.
ideaSTRINGWhat should happen next. Leave empty and Claude Code decides how the scene naturally carries on.
continuation_modeCOMBOI2VA (last frame becomes the first frame)I2VA: the last frame is <Picture 1> at 0.00s of the new clip - wire first_frame into the video node. T2VA: cut to a fresh scene that follows on; the frames only inform look and story.
duration_secondsFLOAT6.01–60Length of the NEW clip.
shot_planCOMBOAuto5 options: Auto, Single shot, Two shots, Three shots, Four shots
visual_styleCOMBOAutoAuto keeps the style of the previous clip, which is almost always what you want. The list is the guide's styles plus the APNext Cinematic vocabulary (film stock, grading, aesthetics); pick Custom and fill in custom_visual_style to write your own.
wildnessINT250–1000 = literal and conservative, 100 = fully unhinged. Above 40 the node also injects concrete surreal elements picked from the seed.
camera_motionCOMBOAuto21 options: Auto, Static Shot, Zoom In, Zoom Out, Push In, Pull Out, +15
camera_amplitudeCOMBOAuto4 options: Auto, with small amplitude, medium (omit), with large amplitude
camera_speedCOMBOAuto4 options: Auto, at slow speed, normal (omit), at fast speed
include_dialogueBOOLEANtrue
dialogue_languageCOMBOEnglishThe language the characters actually speak, and the tag written inside <d>[...]</d>. Auto lets the model pick one that fits the setting. Pick Custom (or just fill in custom_dialogue_language) for anything not listed.
include_on_screen_textBOOLEANfalse
include_soundscapeBOOLEANtrue
include_non_diegetic_musicBOOLEANtrue
modelCOMBOsonnetWho writes the prompt. sonnet / opus / haiku / fable / default are Claude Code aliases (`default` = whatever the CLI is configured for). ollama: / lmstudio: / local: entries are whatever your local servers were serving when the page loaded; pick one to run fully offline. Anything not listed goes in model_override.
researchBOOLEANfalseLet Claude Code search the web for real references before writing - the actual location, wardrobe, lighting and physics. Slower, and it reaches the internet.
directorBOOLEANtrueLoad the H3 director skills (data/h3/skills): the core writing rules, the format this node emits, and style/motion craft, each with a reference library of gold examples and style anchors that Claude Code reads on demand. Costs a few extra seconds and tokens per run.
use_subscriptionBOOLEANtrueHide ANTHROPIC_API_KEY from the CLI so it uses your Claude Code login and subscription seat. Turn off to bill the API key instead.
timeout_secondsINT120060–7200How long to wait PER CALL before the node gives up on the CLI (this is the node's own watchdog, not a Claude limit). Single H3 prompts take 25-60s; a multi-scene chunk with director/research on can take 10-20 minutes. The multi-scene writers retry a timed-out chunk at half size automatically.
seedINT-1-1–18446744073709550000Picks the surreal elements at high wildness, and controls ComfyUI caching. -1 re-rolls and re-runs every queue.
previous_promptoptSTRINGThe H3 prompt that generated the clip you are continuing - wire the writer's h3_prompt output in here. For a longer chain, paste every prompt so far, oldest first. Not needed when resume_session_id is set.
extra_instructionsoptSTRING
custom_dialogue_languageoptSTRINGAny language or dialect not in the dropdown, e.g. 'Norwegian (Bergen dialect)' or 'Latin'. Overrides the dropdown when filled in.
custom_visual_styleoptSTRINGAny visual style not in the dropdown, e.g. 'hand-painted cel animation' or 'Kodak Vision3 500T, anamorphic'. Overrides the dropdown when filled in.
resume_session_idoptSTRINGThe session_id of the writer (or the previous Continue Writer). Claude Code then still has the guide, the earlier frames and every prompt so far in context, so the story stays consistent across many clips.
working_diroptSTRINGA folder Claude Code may read while writing - a script, a shot list, lookbook notes. Empty uses a throwaway scratch folder, which is the safe default.
llmoptAPNEXT_LLMOptional. Connect an APNext H3 LLM Backend node to write with Ollama, LM Studio, another OpenAI-compatible server or an API model instead of Claude Code. Overrides the model dropdown while connected.
context_1optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_2optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_3optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_4optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_5optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_6optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_7optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.
context_8optSTRINGSteering input from another APNext node (Time, Scene, Poses, Plots, Feelings, Cinematic, Science, Geography, Architecture, Fashion, ...). The node detects which kind it is and tells Claude how to use it. Sockets grow as you connect them.

Outputs (8)

NameTypeDescription
h3_promptSTRING
integrated_multimodal_descriptionSTRING
overall_soundscapeSTRING
non_diegetic_musicSTRING
session_idSTRING
infoSTRING
first_frameIMAGE
context_framesIMAGE