How wsyxiuba/comfyui-taglibrary works
ComfyUI-TagLibrary is a custom node and companion UI for building reproducible, structured image prompts. Users configure tags and constraints in the node panel, then generate manually or automatically; the runtime assembles selected tags, an optional English NL tail, and a recommended negative block for downstream ComfyUI text encoding. The graph preserves the documented editor, profiles, conflict rules, presets, batch exploration, reroll, and prompt absorption. Source excerpts show selected route and engine ownership; some subsystem wiring is documented in the README rather than sampled directly.
Main entry points: library.py Tag library · engine.py Constraint sampler · runtime_snapshot.py Runtime snapshot · nodes.py Tag Library node
Components 22
Node UI
- Node panel
web/taglibrary.js - Tag picker
web/taglib-picker.js - Axis overview
web/taglib-pipeline.js - Library manager
web/manager.js - UI state/API
web/taglib-common.js
API services
- Draw and profiles API
api/v13_routes.py - Explore API
api/v18_routes.py - Library CRUD API
api/library_routes.py - Tag editing API
api/tag_edit_routes.py - Conflict rules API
api/conflicts_routes.py
Prompt runtime
- Tag Library node
nodes.py - Constraint sampler
engine.py - Runtime snapshot
runtime_snapshot.py - Tag derivation
derive.py - NL tail compiler
nl.py - Slot policies
slotpolicy.py - Conflict evaluator
tagconflicts.py
Library data
- Pose profiles
profiles.py - Group rules
grouprules.py - Tag library
library.py
Other components
- Workflow user
- ComfyUI workflow
Connections 35
- Workflow user → Node panel: configures
- Node panel → Tag picker: opens
- Tag picker → UI state/API: reads state
- Axis overview → Tag editing API: loads overview
- Tag editing API → Tag library: reads tags
- Library manager → Library CRUD API: edits library
- Library CRUD API → Tag library: reads/writes
- Tag picker → Draw and profiles API: requests draw
- Draw and profiles API → Constraint sampler: runs draw
- Draw and profiles API → Runtime snapshot: gets snapshot
- Draw and profiles API → Pose profiles: reads/writes
- Draw and profiles API → Group rules: saves rules
- Tag picker → Explore API: requests explore
- Explore API → Constraint sampler: runs sampling
- Explore API → Runtime snapshot: gets snapshot
- Explore API → Tag library: reads merged data
- Explore API → ComfyUI workflow: returns prompt candidates
- Tag Library node → Tag library: loads library
- Tag Library node → Runtime snapshot: gets snapshot
- Tag Library node → Constraint sampler: runs generation
- Constraint sampler → Slot policies: checks slots
- Constraint sampler → Pose profiles: attaches pose bundles
- Constraint sampler → Conflict evaluator: checks conflicts
- Tag Library node → NL tail compiler: adds optional tail
- Tag Library node → ComfyUI workflow: outputs prompt
- ComfyUI workflow → Workflow user: displays/queues
- Conflict rules API → Conflict evaluator: validates rules
- Conflict rules API → Tag library: reads library
- Tag editing API → Tag derivation: previews tags
- Tag editing API → Tag library: reads/writes tags
- Tag editing API → Pose profiles: updates profiles
- Runtime snapshot → Tag library: indexes data
- Runtime snapshot → Group rules: loads groups
- Runtime snapshot → Pose profiles: loads profiles
- Constraint sampler → Tag library: uses tag pools