refmod text lives only in subject_definitions - bodies reference <Subject N> alone, echo checked

This commit is contained in:
Z User 2026-10-30 21:07:31 +00:00
parent de19ecee44
commit 5ae3aacb73
4 changed files with 101 additions and 43 deletions

View File

@ -70,7 +70,9 @@ otherwise. Copy the user's quoted speech EXACTLY into the right scene's `dialogu
if the story has no quoted speech, every `dialogue` array stays `[]`. Only the last
scene's beat may come to rest. The `subjects` array is the cast inventory: collect the
full head-to-toe look there once — when writing scenes it is spent by weaving it into
each scene's [Shot 1] body, never parked in subject_definitions. If the story's script
each scene's [Shot 1] body, never parked in subject_definitions (a refmod subject is
the one exception: its verbatim identity/voice text is spent exactly once, in
subject_definitions, and the body references only `<Subject N>`). If the story's script
carries a `characters:` block with refmod entries — `sam:&identity: <identity text>;
voice: <voice text>&` — copy the identity and voice text verbatim into that subject's
inventory string (the & marks are delimiters, never content); the scene turns must carry
@ -180,14 +182,17 @@ and sampler latent or the video can come out square.
shows" (the writing LLM is multimodal — look at it); and a user
refmod (`sam:&identity: ...; voice: ...&` in the story's characters block) is
carried through VERBATIM as "<Subject 1> identity: ...; voice: ..." — never
rewritten, never trimmed, exempt from every defs limit. Weave the head-to-toe
rewritten, never trimmed, exempt from every defs limit; the refmod text lives
ONLY in subject_definitions, and the [Shot 1] body references that subject by
its `<Subject N>` label alone — never restating the refmod's identity, voice,
or look. For a no-image or binds subject, weave the head-to-toe
look into the action as the scene exposes it — hair, build, and face as they
move, each garment where the action touches it, footwear where steps land —
nothing is shared between scenes or from a prefix. Name every body part the
clothing leaves uncovered and call uncovered skin "nude", never "bare", where the
scene shows it ("a man wearing a white tank-top with nude arms").
- Scene composition, not word count: the [Shot 1] body must carry every element —
subject anchor (`<Subject 1>` restated, the full look woven in), style anchor,
subject anchor (`<Subject 1>` referenced; the full look woven in — a refmod subject needs only its label), style anchor,
continuity anchor
(opens inside the previous end_state), blocking, one camera idea, performance beats,
physical texture (wardrobe behavior, weather on skin and fabric, lighting), and a

View File

@ -127,7 +127,9 @@ Shots are flat. A shot never contains a nested object.
continuity text in it. Every scene's prompt must be self-sufficient:
subject_definitions anchors the <Subject 1> tag's identity in one of its three
forms and the [Shot 1] body carries the full look woven into the action in every
scene, because nothing is shared from a prefix or between scenes.
scene, because nothing is shared from a prefix or between scenes (a refmod
subject excepted: its verbatim definition carries the identity and look, and the
body references only `<Subject N>`).
- The [Shot 1] body of every scene's detailed_description must:
1. Continue the exact action, pose, camera direction, and lighting from the previous
scene's [Shot 1] body. Scene 1 instead sets the opening.
@ -142,11 +144,13 @@ Shots are flat. A shot never contains a nested object.
the character has no reference image ("is a ... with ..." — age, hair, eyes,
build), "binds to <Image N> : what the image actually shows" when one is wired
(you are multimodal — look at it), or the user's refmod carried through verbatim
("identity: ...; voice: ..."). The full look lives in the [Shot 1] body, woven
into the action as the scene exposes it: hair, build, and face as they move,
every garment where the action touches it, footwear where steps land, and every
body part the clothing leaves uncovered named "nude" (PROMPT CRAFT) where the
scene shows or uses that skin.
("identity: ...; voice: ..."). For a no-image or binds subject the full look
lives in the [Shot 1] body, woven into the action as the scene exposes it:
hair, build, and face as they move, every garment where the action touches it,
footwear where steps land, and every body part the clothing leaves uncovered
named "nude" (PROMPT CRAFT) where the scene shows or uses that skin. A refmod
subject's body references only its `<Subject N>` label — the refmod text never
leaves subject_definitions.
2. STYLE ANCHOR — the one consistent look: medium, lighting quality, palette.
3. CONTINUITY ANCHOR — open inside the previous scene's end state (scene 1 sets the
opening) and name what carries over: the stride, the camera direction, the light,
@ -211,7 +215,8 @@ Shots are flat. A shot never contains a nested object.
is a gap H3 fills by guessing, and guessed motion drifts off intent.
- Describe the complete look in every scene, inside the [Shot 1] body — subject
definitions never carry the scene's look; they only anchor identity in one of
their three forms. Weave the full
their three forms (a refmod subject is the exception: its definition carries the
look, so its body references only `<Subject N>`). Weave the full
head-to-toe appearance into the action according to what is going on in the scene:
face, hair, and build as the body moves, each garment where the action touches it
(a cuff sliding back, a hem swaying, fabric darkening), footwear where steps land.
@ -266,7 +271,7 @@ Shots are flat. A shot never contains a nested object.
fully_preserved).
4. "detailed_description:" then 1-2 style sentences (medium, lighting quality,
palette — the look the whole plan shares), then the "[Shot 1] ..." body — one
line holding the subject restatement, visual style cues, all action, camera
line holding the subject references, visual style cues, all action, camera
work, continuity cues, and any <d> dialogue. Every scene is its own single-shot
call, so the bracketed number is always [Shot 1].
5. "overall_soundscape:" then the sound the scene itself makes: weather, room tone,
@ -424,10 +429,11 @@ Correct reply:
scene except the last ends mid-action. subject_definitions anchors <Subject 1> in
one of its three forms in every scene (no-image physical traits / binds-to-image
describing what the image shows / the user's refmod verbatim; never a wardrobe
list, never a nude/bare state), and the [Shot 1] body re-states who <Subject 1>
is and carries the full head-to-toe look woven into the action, because the prefix
list, never a nude/bare state), and the [Shot 1] body references <Subject 1>
and carries the full head-to-toe look woven into the action, because the prefix
is empty — naming every uncovered body part as "nude", never "bare", where the
scene shows that skin.
scene shows that skin (a refmod subject needs only its `<Subject 1>` label in
the body — the refmod text never leaves subject_definitions).
8. Every [Shot 1] body carries every element of a scene composition — subject,
style, continuity, blocking, camera, performance, texture, exit state — and no
change anywhere is stated as a bare outcome like "is now"; every transformation is
@ -504,7 +510,8 @@ A retired boxer teaches his granddaughter to dance in their cluttered kitchen.
every scene — an identity anchor in subject_definitions (one of its three forms)
and the full look woven into
the [Shot 1] body, restated per scene — which also suits each scene being its own
generation. The validator accepts an empty prefix as
generation (a refmod subject excepted: its verbatim definition carries the identity
and look, and the body references only `<Subject N>`). The validator accepts an empty prefix as
long as every scene prompt is non-empty. If you reintroduce prose, expect some
format dilution.

View File

@ -93,7 +93,9 @@ Emit exactly this shape and no other keys:
fully enough to re-draw them identically in every scene. This array is the cast
inventory: collect the full head-to-toe look here once — when writing scenes it is
spent by weaving it into each scene's [Shot 1] body, never parked in
subject_definitions. If the story's script carries a `characters:` block with refmod
subject_definitions (a refmod subject is the one exception: its verbatim
identity/voice text is spent exactly once, in subject_definitions, and the body
references only `<Subject N>`). If the story's script carries a `characters:` block with refmod
entries — `sam:&identity: <identity text>; voice: <voice text>&` — copy the identity
and voice text verbatim into that subject's inventory string (the & marks are
delimiters, never content); the scene writers must carry them into subject_definitions
@ -226,7 +228,9 @@ identity and style from the story alone; without a handoff you are scene 1.
be self-sufficient — subject_definitions re-states <Subject 1> in one of its three
definition forms (REF2VA PROMPT below), and the [Shot 1] body carries the full
head-to-toe look woven into the action plus the visual style in every scene, even
though the previous scene already did.
though the previous scene already did. A refmod subject is the exception: its
definition already carries the identity and look verbatim, so the body references
only `<Subject N>` and never restates the refmod text.
- Copy the subject descriptions and "style" from STYLE AND CAST faithfully. Never change
wardrobe, hair, age, build, or look mid-plan.
- If PREVIOUS HANDOFF is a handoff object, your scene opens inside the exact end_state
@ -251,11 +255,13 @@ a number is as much a failure as a thin one-liner.
the character has no reference image ("is a ... with ..." — age, hair, eyes,
build), "binds to <Image N> : what the image actually shows" when one is wired
(you are multimodal — look at it), or the user's refmod carried through verbatim
("identity: ...; voice: ..."). The full look lives in the [Shot 1] body, woven
into the action as the scene exposes it: hair, build, and face as they move,
every garment where the action touches it, footwear where steps land, and every
body part the clothing leaves uncovered named "nude" (PROMPT CRAFT) where the
scene shows or uses that skin. Nothing is shared between scenes or from a prefix.
("identity: ...; voice: ..."). For a no-image or binds subject the full look
lives in the [Shot 1] body, woven into the action as the scene exposes it:
hair, build, and face as they move, every garment where the action touches it,
footwear where steps land, and every body part the clothing leaves uncovered
named "nude" (PROMPT CRAFT) where the scene shows or uses that skin. A refmod
subject's body references only its `<Subject N>` label — the refmod text never
leaves subject_definitions. Nothing is shared between scenes or from a prefix.
2. STYLE ANCHOR — the one consistent look: medium, lighting quality, palette.
3. CONTINUITY ANCHOR — open inside the previous end_state (scene 1 instead
establishes place, light, and the first action). Name what carries over: the
@ -327,7 +333,8 @@ The sound picture is its own element and lives in the overall_soundscape section
is a gap H3 fills by guessing, and guessed motion drifts off intent.
- Describe the complete look in every scene, inside the [Shot 1] body — subject
definitions never carry the scene's look; they only anchor identity in one of their
three forms. Weave the full
three forms (a refmod subject is the exception: its definition carries the look, so
its body references only `<Subject N>`). Weave the full
head-to-toe appearance into the action according to what is going on in the scene:
face, hair, and build as the body moves, each garment where the action touches it
(a cuff sliding back, a hem swaying, fabric darkening), footwear where steps land.
@ -380,7 +387,7 @@ The sound picture is its own element and lives in the overall_soundscape section
fully_preserved).
4. "detailed_description:" then 1-2 style sentences taken from the STYLE AND CAST
"style" (medium, lighting quality, palette), then the "[Shot 1] ..." body — one
line holding the subject restatement, visual style cues, all action, camera
line holding the subject references, visual style cues, all action, camera
work, continuity cues, and any <d> dialogue. Every scene is its own single-shot
call, so the bracketed number is always [Shot 1].
5. "overall_soundscape:" then the sound the scene itself makes: weather, room tone,
@ -533,9 +540,10 @@ Correct reply:
describing what the image actually shows when one is wired, or the user's refmod
identity/voice text carried through verbatim;
retention_analysis carries one valid entry per defined label; the [Shot 1] body
re-states <Subject 1> and carries the full head-to-toe look woven into the
references <Subject 1> and carries the full head-to-toe look woven into the
action, naming every uncovered body part "nude" — never "bare" — where the
scene shows that skin.
scene shows that skin (a refmod subject needs only its `<Subject 1>` label in
the body — the refmod text never leaves subject_definitions).
5. The [Shot 1] body opens by continuing the PREVIOUS HANDOFF's end_state (scene 1 sets
the opening instead) and ends mid-action — except the final outline scene.
6. The [Shot 1] body carries every element of a scene composition — subject anchor,
@ -581,7 +589,8 @@ Correct reply:
always gets `"prompt_prefix": [""]` (the empirically better empty prefix), and each
scene's subject_definitions (one of its three identity forms) plus its [Shot 1]
body — the full look woven into the action — restate identity/wardrobe/style because
nothing is shared from a prefix.
nothing is shared from a prefix (a refmod subject excepted: its verbatim definition
carries the identity and look, and the body references only `<Subject N>`).
- **Fragment file convention:** save each reply as `scene_NN.json` (zero-padded). The
assembler and `scripts/build_plan.py` accept the raw object; fenced output also
parses.

View File

@ -40,7 +40,9 @@ REF2VA_RETENTION_MARKERS = {"fully_preserved", "partially_preserved",
# - the user's own tested wording, carried through untouched (exempt from
# the no-image content bans: clothing and skin state)
# No form carries a length cap - describe fully what the model needs.
# In every form the full look is still woven into the [Shot 1] body.
# No-image and binds subjects get their full look woven into the [Shot 1] body;
# a refmod subject is referenced by its <Subject N> label alone - the refmod
# text never leaves subject_definitions.
REF2VA_REFMOD_RE = re.compile(r"^identity\s*:", re.I)
REF2VA_BINDS_RE = re.compile(r"^binds to <Image\s+\d+>\s*:\s*", re.I)
REF2VA_DEF_SKINSTATE_RE = re.compile(
@ -51,6 +53,26 @@ REF2VA_DEF_CLOTHING_RE = re.compile(
r"gown|hoodie|sweater|shoes|sneakers|boots|sandals|socks|stockings|gloves|"
r"helmet|lanyard)\b", re.I)
def _refmod_echo(anchor, text, n=5):
"""First run of >= n consecutive refmod words echoed in text, else None.
A refmod subject's definition is the single source of its identity and look:
the [Shot 1] body must reference the label, never restate the refmod text.
"""
aw = re.sub(r"[^a-z0-9]+", " ", anchor.lower()).split()
tw = re.sub(r"[^a-z0-9]+", " ", text.lower()).split()
if len(aw) < n:
s = " ".join(aw)
return s if s and s in " ".join(tw) else None
grams = {" ".join(aw[i:i + n]) for i in range(len(aw) - n + 1)}
tjoin = " ".join(tw)
for g in sorted(grams):
if g in tjoin:
return g
return None
FENCE_RE = re.compile(r"^\s*```[a-zA-Z0-9_-]*\s*\n(.*?)\n?\s*```\s*$", re.S)
DIALOGUE_SPAN_RE = re.compile(r"<d>(.*?)</d>")
MARKER_RE = re.compile(r"^\[[^\]]+\]\s*")
@ -163,6 +185,7 @@ def check_ref2va_prompt(lines, dur, where, prev_handoff=None):
if not defs:
raise ValueError(f"{where}: subject_definitions is empty")
defined = []
refmod_anchors = {}
for line in defs:
m = re.match(r"^(<(?:Subject|Picture|Video|Audio)\s+\d+>)\s+\S", line)
if not m:
@ -179,6 +202,7 @@ def check_ref2va_prompt(lines, dur, where, prev_handoff=None):
f"('<Subject N> identity: ...; voice: ...'): {line[:60]!r}")
if REF2VA_REFMOD_RE.match(anchor):
defined.append(m.group(1)) # verbatim user refmod text - never edited
refmod_anchors[m.group(1)] = anchor
continue
mb = REF2VA_BINDS_RE.match(anchor)
if mb:
@ -237,8 +261,18 @@ def check_ref2va_prompt(lines, dur, where, prev_handoff=None):
f"wardrobe, style, continuity, blocking, camera, performance, "
f"texture, sound, exit state)")
if "<Subject 1>" not in body:
raise ValueError(f"{where}: the [Shot 1] body must re-state <Subject 1> and "
f"carry the head-to-toe look woven into the action")
raise ValueError(f"{where}: the [Shot 1] body must reference <Subject 1> and "
f"carry the head-to-toe look woven into the action (for a "
f"refmod subject the label reference is enough - its "
f"definition carries the look)")
for rlabel, ranchor in refmod_anchors.items():
echo = _refmod_echo(ranchor, dd)
if echo:
raise ValueError(f"{where}: {rlabel} is defined by a verbatim refmod - the "
f"refmod text lives only in subject_definitions; reference "
f"{rlabel} by its label alone in the [Shot 1] body and "
f"never restate its identity, voice, or look (echoed "
f"{echo!r})")
if " is now " in dd.lower():
raise ValueError(f"{where}: change stated as bare outcome instead of shown progression")
if re.search(r"\bbare\b", dd, re.I):
@ -666,19 +700,14 @@ REF2VA_DOOR = {
"detailed_description:",
REF2VA_NURSE["prompt"][7],
"[Shot 1] Continue the same corridor walk without resetting the motion, the "
"trolley still rolling at her pace. <Subject 1>, the same night nurse from "
"her reference image with her dark brown hair still in its low bun, eases "
"the steel trolley to a stop beside the blue door, both hands relaxing on "
"the handle one after the other, its last wheel squeak dying on the "
"linoleum. Her pale green scrubs settle as her shoulders drop, the white "
"sneakers planting at hip width, the nude hands below the scrub cuffs "
"opening off the handle while her nude lower legs stay above the sneaker "
"collars. The camera holds its over-the-shoulder framing while her "
"shoulders settle and the paper cup's surface stills on the trolley top; "
"the fluorescent panels keep their even rhythm overhead, the corridor walls "
"stay in soft focus, and her scrub-top hem sways once and hangs. Her right "
"hand leaves the handle, opens, and closes on the door's cold push bar "
"while the clipped chart keeps swaying on its clip.",
"trolley still rolling at her pace. <Subject 1> eases the steel trolley to "
"a stop beside the blue door, both hands relaxing on the handle one after "
"the other, its last wheel squeak dying on the linoleum. The camera holds "
"its over-the-shoulder framing while her shoulders settle and the paper "
"cup's surface stills on the trolley top; the fluorescent panels keep "
"their even rhythm overhead and the corridor walls stay in soft focus. "
"Her right hand leaves the handle, opens, and closes on the door's cold "
"push bar while the clipped chart keeps swaying on its clip.",
"overall_soundscape:",
"the same low fluorescent hum continues, the trolley wheels fall silent, a "
"soft draught breathing under the far door.",
@ -789,6 +818,13 @@ def run_fragment_suite():
"scrub top and white sneakers.")
bad_binds = _ref2va_short()
bad_binds["prompt"][1] = "<Subject 1> bound to her subject reference image."
refmod_echo = json.loads(json.dumps(REF2VA_DOOR))
p = refmod_echo["prompt"]
i_dd = p.index("detailed_description:")
p[i_dd + 2] = p[i_dd + 2].replace(
"<Subject 1> eases the steel trolley",
"<Subject 1>, the same woman in her thirties with dark brown hair in a low "
"bun, eases the steel trolley")
r2_cases = [
("missing retention_analysis entry", no_ret, {}),
("summary directive not [reference generation]", wrong_summary, {}),
@ -798,6 +834,7 @@ def run_fragment_suite():
("head-to-toe look dump in subject_definitions", dump_defs, {}),
("clothing in a no-image subject definition", clothed_defs, {}),
("subject definition is none of the three forms", bad_binds, {}),
("refmod look restated in the [Shot 1] body", refmod_echo, {}),
]
for i, (label, obj, kwargs) in enumerate(r2_cases, 1):
try: