Nodes/comfyui-lora-hook-trigger/LoRA Hook + Trigger Text
ComfyUI Node

LoRA Hook + Trigger Text

The LoRA hook node whose trigger text you'll actually want to automate

By akaugun·Created 9 months ago·Updated 9 months ago· 0
LoRA Hook + Trigger Text
  • prev_hooks
  • hook
  • trigger_text
lora_name
triggerNONE
strength_model1.00
strength_clip1.00

First, a confession from the class name: this node is called LoraTriggerWithExample, and there is no example anywhere in it. The "With Example" is aspirational. What it actually does is load a LoRA as a hook and auto-pull the LoRA's trigger text out of a sidecar .txt file. It's a small, honest utility from a single-author pack (akaugun/comfyui-lora-hook-trigger), and it's only worth reaching for if you're already living in ComfyUI's experimental hooks system. If you aren't, skip to the "when not to bother" bit at the end.

What it solves

Every LoRA that needs a trigger word has the same annoyance: you have to remember the word, type it into every prompt, and keep it straight when you've got twenty LoRAs installed. This node kills the remembering part by keeping each LoRA's trigger text in a folder next to the model file, then handing it to you as a plain text output. The hook part is the packaging: instead of a normal LoraLoader, it builds a LoRA HookGroup using ComfyUI's core CreateHookLora, which means the LoRA can be attached to specific conditioning or scheduled with keyframes rather than applied globally.

How it works

The convention is everything. Drop a folder next to your LoRA file named exactly like the file minus its extension, and put one .txt per trigger inside:

models/loras/my_lora.safetensors
models/loras/my_lora/trigger1.txt
models/loras/my_lora/style.txt

On startup the node registers a /lora_trigger_list endpoint. Its JavaScript takes over the node's UI: the trigger input is a plain string widget that gets hidden, replaced by a dropdown that fetches that endpoint whenever you change lora_name, and syncs your choice back into the hidden widget so the workflow still serializes cleanly. On run it builds the hook through CreateHookLora, chains it onto prev_hooks via CombineHooks if you supplied one, and reads the selected .txt with a UTF-8 / UTF-8-SIG / CP949 fallback (the Korean encoding hint that the author isn't the usual US-based pack dev).

The inputs that matter

  • lora_name - dropdown of everything in models/loras.
  • strength_model / strength_clip - the usual LoRA weights, default 1.0 each, range -20 to 20. Same dials as LoraLoader; if a LoRA overpowers the prompt, drop these toward 0.5-0.8.
  • prev_hooks - optional HOOKS input so you can stack another hook group onto this one.

Outputs: hook (HOOKS) wires into the conditioning side of the hooks arena - ConditioningSetProperties, SetHookKeyframes, ConditioningTimestepsRange, that family - and trigger_text (STRING) is the contents of the selected file, which you route into your prompt text (you'll need a text-concat node to splice it in; nothing auto-appends it).

Install

No dependencies, no model downloads - it's just one Python file and one JS file.

cd ComfyUI/custom_nodes
git clone https://github.com/akaugun/comfyui-lora-hook-trigger

Then restart ComfyUI and hard-refresh the browser (Ctrl+F5, or Cmd+Shift+R on macOS). Or use Manager → Install via URL and paste the repo URL. It's also published to the Comfy Registry, so a plain Manager search for comfyui-lora-hook-trigger should find it.

Where people get burned

  • Dropdown shows only NONE. Your folder name doesn't match the LoRA filename exactly (extension included in the filename is fine, but my_lora_v2 vs my_lora is not), or the .txt files are nested deeper than the folder's root. The scan is one level deep.
  • Hooks don't exist. CreateHookLora is EXPERIMENTAL = True in core ComfyUI, so you need a reasonably current build. The node's source wraps the call in try/except fallbacks to survive API churn, but it can't conjure the API out of an old install.
  • No dropdown after updating - that's the browser cache; the hard refresh is real.

When not to bother

Honestly? Most of the time. If you just want a LoRA loaded with its trigger word, a plain LoraLoader plus typing the word works fine, and rgthree's Power Lora Loader already reads trigger words off the file or CivitAI and shows them in its info dialog. This node's entire reason to exist is the HOOKS side - if your workflow doesn't use hook-driven conditioning, the trigger-text half is a feature you're paying for with extra plumbing. But if you're doing hook-based LoRA scheduling and hate hand-copying trigger words, this is the cleanest way to keep the two in lockstep.

Categoryadvanced/hooks

Inputs (5)

NameTypeDefaultDescription
lora_nameCOMBO1 options:
triggerSTRINGNONE
strength_modelFLOAT1.00-20–20
strength_clipFLOAT1.00-20–20
prev_hooksoptHOOKS

Outputs (2)

NameTypeDescription
hookHOOKS
trigger_textSTRING