Nodes/ComfyUI-LukutarNodes/Annotation Segment Edit
ComfyUI Node

Annotation Segment Edit

Annotation Segment Edit explained

By Mistress-Lukutar·Created 7 days ago·Updated 2 days ago· 1
Annotation Segment Edit
  • annotations
  • annotations
labelface
modeprepend
text

Here's the workflow problem this node exists to solve: you have one annotated prompt from Prompt Annotate, and you want to feed several Detailer branches - the face gets detailed eyes, smirk, the hands get delicate fingers, maybe the same annotation drives two different models. If you copy the prompt per branch, you've reintroduced the sync problem the annotation system was built to kill.

Annotation Segment Edit is the fix: it takes ANNOTATIONS in and emits edited ANNOTATIONS out, so one shared Prompt Annotate can feed any number of branches, each with its own tweaks, and the edits chain freely. It's a pass-through filter, not a dead end - you edit, then hand the result to Annotation Segment or Annotations to Wildcard exactly as you would the original.

The five modes

The mode dropdown is the whole personality of the node. It applies to the label(s) in label, which accepts several comma-separated (face, body) and then applies every mode to all of them:

  • prepend - put the typed text before each label's text (face + detailed eyesdetailed eyes, blue eyes, smirk).
  • append - put it after (… → blue eyes, smirk, smile).
  • remove - delete the listed comma-separated tags from the labels' text, matched exactly after trimming (smirkblue eyes).
  • new - append a fresh span |labels: text| to the end of the prompt (e.g. hands, weapon + delicate fingers → a new |hands,weapon: delicate fingers| tag). Every listed label must not exist yet.
  • delete - remove the labels with their content entirely. The text field is unused here (the web UI grays it out).

Semantics that actually matter

The README spells these out, and they're the difference between "it works" and "why did the hair region vanish":

  • A label spread over several spans is edited at its first span (prepend) or last span (append); remove applies to all of them.
  • The special all label edits the unmarked common part in place - added text stays unmarked, no |all:| tag appears. Deleting all removes the common text but keeps the separators between surviving spans.
  • delete only strips a label from a multi-label span (|body,hair: red hair| minus hair|body: red hair|); a span left with no labels disappears with its text.
  • A span shared by several labels holds one text, so prepend/append/remove through any of its labels changes it for all of them.
  • Blank text makes the edit a no-op (except in delete), and removing tags that aren't present changes nothing - the annotation passes through untouched. That's deliberate: it means you can drive the node from widgets without guarding against empty values.

Inputs and output

annotations (ANNOTATIONS from Prompt Annotate), label (comma-separated; defaults face), mode (default prepend), text (multiline; the tags or new-span content). Output is the edited annotations, same type, ready to chain into the other annotation nodes.

Installation

Part of ComfyUI-LukutarNodes (MIT). ComfyUI Manager: Custom Nodes Manager → Install via git URLhttps://github.com/Mistress-Lukutar/ComfyUI-LukutarNodes, or:

cd <ComfyUI>/custom_nodes
git clone https://github.com/Mistress-Lukutar/ComfyUI-LukutarNodes

Restart ComfyUI. Only extra runtime dependency is opencv-python (>= 4.8); Manager installs requirements.txt, manual installs may need pip install opencv-python. No models, no keys. Category Lukutar/Prompt.

Failure modes worth knowing

  • Unknown labels, unknown modes, blank label lists all fail the node. Unknown labels list the available ones - that error message is your friend.
  • new fails on labels that already exist, which is the inverse trap: you meant to append to a region, but new demands a genuinely fresh one.
  • Since edits are deterministic per mode, chaining two edits is easy to reason about - but the order matters, because the second edit sees the first edit's output. Read your chain left to right and it behaves exactly as written.
  • As with the rest of the pack: it's young (v0.10.x, 2026), minimal community footprint, thorough README, clean tested code.
CategoryLukutar/Prompt

Inputs (4)

NameTypeDefaultDescription
annotationsANNOTATIONSAnnotations from Prompt Annotate (Lukutar)
labelSTRINGfaceLabel(s) to edit, comma-separated for several (e.g. 'face, body'); every mode applies to all of them. Unknown labels fail the node listing the available ones
modeCOMBOprependprepend/append: put the text before/after the labels' text; remove: delete the listed comma-separated tags from it; new: append a fresh span with these labels and the text; delete: remove the labels with their content entirely (text unused)
textSTRINGTags to add, the comma-separated tags to remove, or the new span's text; empty text makes the edit a no-op; unused in delete mode (matched exactly after trimming)

Outputs (1)

NameTypeDescription
annotationsANNOTATIONS