H3 Prompt 硬审计
The H3 Prompt Auditor That Fails Loudly Before H3 Does
- audited_prompt
- audit_report
The word "hard" in the node's name is doing real work. H3_PromptAudit doesn't warn, it doesn't suggest, it doesn't pass a prompt through with a yellow flag attached. If anything in the prompt violates H3's contract, it raises and the node goes red with a list of every problem it found.
That's the point. A broken H3 prompt doesn't fail in a way you can see - it renders. You get a 15-second clip where the second shot never happened, or a hallucinated <Audio 3> that quietly maps onto the wrong input, with no error to point at. The audit is the cheap gate between your LLM and a 33B video render.
What it checks
Two required inputs: context_json (the same locked object from the workbench) and compiled_prompt (from H3_ContextCompiler). It re-derives what the prompt must contain from the draft inside that context, then compares. Grounded, in roughly the order it runs:
- Structure and order. Base modes must be exactly
integrated_multimodal_description,overall_soundscape,non_diegetic_music. Ref2VA must be the six sectionssubject_definitions,summary,retention_analysis,detailed_description,overall_soundscape,non_diegetic_music- in that order, with the prompt starting atsubject_definitions:and nothing in front of it. T2VA must start atintegrated_multimodal_description:and must not carry a keyframe alignment instruction. - The alignment instruction, verbatim. I2VA's
<Picture 1>-at-0.00-seconds line, FL2VA's two-end alignment with the real effective duration, L2VA's end anchor. Approximations are rejected. - Reference numbering. Every
<Picture N>,<Video N>and<Audio N>in the prompt must be one the draft actually declares, in the presentation-order mapping the workbench computed. Undeclared references and missing required ones are both errors. - Subject labels (Ref2VA).
<Subject N>definitions must start at 1, be contiguous, be defined exactly once each, and anything referenced must exist. Base modes must not contain<Subject N>at all. - Task type and audio retention (Ref2VA). The bracketed task type in
summary:and the retention line for each soundtrack and audio reference must match the roles in your asset list. - Shot labels and cut points.
[Shot 1]must exist and every later shot must appear as[Shot N] At 00:MM.SSS,with the timestamp the draft implies. - Locked dialogue, exactly. Each line must appear as
<d>[Language] 原文</d>the same number of times as in the draft. No extra<d>blocks. No rewording, no punctuation drift, no translating. - Speaker IDs. Each speaker keeps the stable
Snumber the cast order gives them, and unknown speaker IDs are an error. - Locked on-screen text. Director-locked visible text must appear in double quotes exactly as written. And outside
<d>blocks, double quotes are reserved for that text - so a stray quoted phrase from the LLM is an error. - English body. Strip the dialogue and the quoted visible text, and the rest must contain no CJK characters.
- Ref2VA extras. No
dialogue_plan:section (it doesn't exist in the six-section structure), anddetailed_description:needs an English style opener before[Shot 1].
Deterministic regexes, no LLM, no randomness. Same input, same verdict, every time.
Inputs and outputs
context_json- wire it from the workbench, same output the compiler used.compiled_prompt- wire it from the compiler.audited_prompt- the prompt, passed through untouched. It only ever gets emitted if the audit passed, so this is what you wire to your H3 generation node. It's a gate, not a fixer.audit_report- a single confirmation line naming the mode and what passed.
Install
Manager search for H3 Context Compiler, or:
cd ComfyUI/custom_nodes
git clone https://github.com/wanski24hours-cmyk/h3-prompt-compiler.git
Restart the server and search H3 Context Compiler. No pip dependencies, no downloads - the node is pure text work.
Where people get burned
Read the error, don't fight it. The failure message concatenates every problem it found, and each line names the token: the missing [Shot 2] At 00:06.000,, the <d> block that appears twice when it should appear once, the undeclared <Audio 3>. Fix it at the source - the director draft or the LLM response - and recompile. Hand-patching compiled_prompt is a trap: the audit fails on your edit, and bypassing it throws away the only check on your numbering.
A stale context gives a confusing error. The audit validates against the draft inside context_json. Change the draft text after compiling and the dialogue and shot checks will disagree with a prompt that is perfectly correct for the old draft. Re-run workbench → compiler → audit as a chain, and don't mix outputs from two runs.
Both downstream nodes reject a non-h3-context-2 context. If you wired a hand-written JSON string or reused an old one, you'll get two red nodes complaining similarly (context_json 不是 h3-context-2。). That's one problem, not two.
It can't tell you the prompt is good. It verifies the contract: structure, numbering, timing, dialogue integrity, language. It has no opinion on whether the English is any good or whether your shot actually describes what you wanted. The semantic half is where a small local model is fine - a prompt enhancer removes the blank-page problem; it isn't a writer. If the output reads flat, that's your draft, not the audit's problem.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| context_json | STRING | {} | — |
| compiled_prompt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| audited_prompt | STRING | — |
| audit_report | STRING | — |