Nodes/ComfyUI-BFSNodes/Edit Anything Prompt Fixer (BFS)
ComfyUI Node

Edit Anything Prompt Fixer (BFS)

The one-line fix for VLM-written Edit Anything prompts (it never touches an image)

By alisson-anjos·Created 6 months ago·Updated 8 days ago· 110
Edit Anything Prompt Fixer (BFS)
    • prompt
    prompt
    has_referencefalse

    The name makes it sound like it fixes anything, but it's far more specific than that - and honestly more useful for it. Edit Anything Prompt Fixer is a text-only node that rewrites a vision-language-model's edit instruction into the exact sentence format an LTX-Video 2.3 "Edit Anything" LoRA was trained on. No image goes in, no image comes out, no GPU is touched. It's a regex grammar checker with a UI, and it exists because the thing feeding your prompt keeps making the same two mistakes.

    Here's the situation it exists for. Edit Anything LoRAs (video_to_video_ref_adaln style) turn LTX into a video editor: you attach a reference image showing what you want, hand over a prompt like edit_anything: Add a red jacket. Remove the old one., and it does a v2v edit. To make that convenient, people script a VLM to write those prompts for them - a vision model looks at the frame and the reference and produces the instruction. And here's the rub the KB calls out repeatedly about VLM tool nodes: they're fluent but not disciplined. Give one a rigid training format and it will politely drift off it. This node is the correction layer.

    How it works

    Under the hood it's a handful of regex rules over a fixed prompt grammar. The training format is a edit_anything: trigger followed by sentences, plus one special marker: The object to add is shown in the reference image. That marker is only valid directly after an Add ... sentence. Two deterministic fixes follow:

    • No reference attached - the marker must not exist at all, and Add X. Remove Y. should actually be a single Replace Y with X. (a no-reference edit is a replace, not an add-and-remove). The VLM tends to emit the reference form anyway, so the node strips the marker and recombines the pair, even trimming redundant location clauses like "standing" or "parked".
    • Reference attached - if the marker shows up after a Replace X with Y. sentence instead of an Add ..., it rewrites that into Add X. Remove Y. and moves the marker into place.

    It keeps your edit_anything: prefix intact and prints what it changed to the console ([BFSNodes] prompt corrigido: ...), so you can watch it work.

    Inputs and outputs

    Only two inputs, and both matter:

    • prompt (STRING, multiline, forceInput) - the raw text from your VLM or text node. It's a forced input, so you'll be wiring it rather than typing into it, which is exactly the intended flow.
    • has_reference (BOOLEAN, default false) - the author's tooltip is in Portuguese, and it translates to the key point: "turn on when a reference image is attached - this is the same boolean that decides whether to attach the image." Keep it synced with whatever actually controls the reference in your graph, or the fixer will apply the wrong rule.

    The single output is also prompt - the corrected string. Wire it into your positive text encode on the Edit Anything conditioning path.

    Installing it

    It ships inside ComfyUI-BFSNodes, the alisson-anjos pack. Easiest via ComfyUI Manager (search "BFSNodes"), or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alisson-anjos/ComfyUI-BFSNodes.git
    cd ComfyUI-BFSNodes
    pip install -r requirements.txt
    

    Then restart ComfyUI. One thing worth knowing: the pack's requirements are heavy (insightface, onnxruntime, librosa, opencv) because the rest of the pack does face swaps and video composition. This node doesn't need any of them - it's pure stdlib re. If it's the only node you want, the install drags in a lot of packages for one regex pass, but ComfyUI won't import the heavy modules until you use them, so it's more of a disk-space annoyance than a startup problem.

    Where people get burned

    The classic failure isn't the node - it's forgetting the boolean. If has_reference says false while your graph is actually attaching a reference, the fixer will strip the marker and collapse your Add/Remove into a Replace, and the LoRA never sees the reference conditioning it was promised. And the reverse: the reference is on, so it recombines prompts that were already correct - harmless, but noise. When the output video ignores the reference entirely, that's the pack's broader tuning question (the README's role_strength and adaln_scale knobs), not this node's job. Start with the boolean right and the debug print will tell you the rest.

    CategoryBFS/EditAnything

    Inputs (2)

    NameTypeDefaultDescription
    promptSTRING
    has_referenceBOOLEANfalseLigue quando uma imagem de referencia for anexada. Este e o mesmo booleano que decide anexar a imagem.

    Outputs (1)

    NameTypeDescription
    promptSTRING