19 KiB
Prompt Pool Routing Map
This document maps the roads that can lead to prompt text. It intentionally does not duplicate every prompt phrase in the JSON pools. The useful debugging target is usually: which node path selected which pool, which seed axis controlled it, and whether the final wording was still raw builder text or rewritten by a formatter.
Mental Model
There are three layers:
- Generation layer: selects category, subcategory, item/action, character descriptors, scene, expression, pose, composition, and camera directives.
- Pair/adapter layer: optionally builds a softcore/hardcore pair, applies continuity, POV handling, camera-aware scene text, and clothing state.
- Formatter layer: rewrites a metadata row into Krea2 prose, SDXL tags, or a naturalized caption.
When a result is wrong, first identify which layer owns the bad text:
- Raw builder prompt already wrong: edit
prompt_builder.pyor the relevantcategories/*.jsonpool/template. - Raw builder prompt acceptable, Krea2 output wrong: edit
krea_formatter.py. - Raw builder prompt acceptable, SDXL tags wrong: edit
sdxl_formatter.py. - Natural caption/training caption wrong: edit
caption_naturalizer.py. - UI/preview/loop behavior wrong: edit
__init__.py,loop_nodes.py, orweb/*.js.
High-Level Routes
flowchart TD
A[SxCP Prompt Builder] --> B[prompt_builder.build_prompt]
C[SxCP Prompt Builder From Configs] --> D[parse config nodes]
D --> B
E[SxCP Insta/OF Prompt Pair] --> F[prompt_builder.build_insta_of_pair]
F --> B
B --> R[metadata row + prompt + negative + caption]
F --> P[pair metadata: soft row + hard row]
R --> K[SxCP Krea2 Formatter]
R --> S[SxCP SDXL Formatter]
R --> N[SxCP Caption Naturalizer]
P --> K
P --> S
P --> N
The config nodes mostly emit JSON. The final builder nodes parse that JSON and call the same core generation functions.
Main Entry Points
| ComfyUI node | Python entry | What it owns |
|---|---|---|
SxCP Prompt Builder |
build_prompt |
Direct single prompt generation. Can use built-in categories or JSON categories. |
SxCP Prompt Builder From Configs |
build_prompt_from_configs -> build_prompt |
Same generator, but inputs come from category/cast/profile/filter helper nodes. |
SxCP Insta/OF Prompt Pair |
build_insta_of_pair |
Builds a softcore row and hardcore row with shared cast/continuity options. |
SxCP Krea2 Formatter |
format_krea2_prompt |
Converts metadata rows or pair metadata into Krea2-friendly prose. |
SxCP SDXL Formatter |
format_sdxl_prompt |
Converts metadata rows or pair metadata into SDXL/tag style prompts. |
SxCP Caption Naturalizer |
naturalize_caption |
Converts rows into more natural sentence captions. |
Seed Axes
Seed routing is centralized around SEED_AXIS_SALTS, SEED_AXIS_ALIASES, and
_axis_rng in prompt_builder.py.
| Axis | Controls |
|---|---|
category |
Main category selection when random/auto. |
subcategory |
Subcategory selection. |
content |
Clothing item, category item, generated outfit, many softcore outfit choices. |
person |
Character appearance when not fully manual. |
scene |
Location/scene choice. |
pose |
Generic pose choice, and for pose-content categories, the hardcore position/action item. |
role |
Role graph / action choreography for sexual pose categories. Falls back through pose aliases. |
expression |
Expression choice and expression intensity randomization. |
composition |
Composition/framing choice. |
SxCP Global Seed, SxCP Seed Control, and SxCP Seed Locker all feed
seed_config. Values below zero mean the row's main seed still drives that
axis. Fixed axis seeds allow changing only one road, for example changing
pose/role while keeping person, scene, and category stable.
Category Sources
There are two category systems.
| Source | Files/functions | Notes |
|---|---|---|
| Built-in legacy generator | generate_prompt_batches.py, _build_direct_builtin_row, _build_auto_weighted_row |
Handles legacy woman, man, couple, group_or_layout, auto_weighted, and auto_full. |
| JSON category library | categories/*.json, load_category_library, _build_custom_row |
Handles expandable categories such as casual clothes, erotic clothes, and hardcore sexual poses. |
JSON categories are the scalable system. Add new main categories or subcategories there unless the behavior needs Python logic.
JSON Category Road
flowchart TD
A[category/subcategory input] --> B[_find_subcategory]
B --> C[item from subcategory.items]
C --> D[_compose_item]
D --> E[item_templates + axes]
B --> F[_scene_pool]
B --> G[_expression_pool]
B --> H[_pose_pool]
B --> I[_composition_pool]
E --> J[role graph / item text / axis values]
F --> R[scene_text]
G --> R
H --> R
I --> R
J --> R[metadata row]
Important JSON keys:
categories: main category definitions.subcategories: selectable subcategories inside a category.items: item/action entries selected by the content or pose axis.item_templates: templates with axis placeholders.axes: values used to fillitem_templates.scene_pool/scene_poolsor directscenes: location road.expression_pool/expression_poolsor directexpressions: expression road.composition_pool/composition_poolsor directcompositions: framing road.poses: category-specific pose fallback.prompt_template/caption_template: final prompt assembly for that category.inherit_scenes,inherit_expressions,inherit_compositions: stop or allow inheritance from category/subcategory/item levels.pool_extensions: patch legacy pools from JSON.
Current category/pool files:
| File | Main ownership |
|---|---|
categories/default_categories.json |
Casual clothes, men/couple casual variants, normal JSON categories. |
categories/erotic_clothes.json |
Provocative/erotic clothing categories and their scene/expression/composition pools. |
categories/sexual_poses.json |
Hardcore sexual pose/action categories, role graphs, explicit scene/expression/composition pools. |
categories/location_pools.json |
Named scene pools and location pool extensions. |
categories/expression_composition_pools.json |
Named expression pools and composition pools. |
Pool Resolution
Scene / Location
Scene text is selected by _scene_pool.
Resolution order:
SxCP Location Pool/SxCP Location Themewithreplaceoverrides the category scene pool.- Category/subcategory/item direct
scenesand referenced scene pools are merged, unless inheritance is disabled. SxCP Location Poolwithaddappends its entries.- Fallback is legacy
g.SCENESorg.GROUP_SCENES.
Edit targets:
- Add reusable named locations:
categories/location_pools.json. - Add category-specific locations: the category JSON file.
- Add quick workflow-only locations:
SxCP Location Poolcustom locations. - Add themed location packs:
THEMATIC_LOCATION_PRESETSinprompt_builder.py.
Expression
Expression text is selected by _expression_pool, then filtered by
_expression_entries_for_intensity.
Resolution order:
- Category/subcategory/item direct
expressionsand named expression pools. - Inheritance can stop at item or subcategory level.
- Fallback is legacy
g.EXPRESSIONS. - Character slots can override intensity per softcore/hardcore phase.
- Expression can be disabled globally or per character slot.
Edit targets:
- General expression pools:
categories/expression_composition_pools.json. - Hardcore-specific expressions: usually
categories/sexual_poses.jsonor named hardcore expression pools. - Character-level expression settings: slot config and
_cast_expression_intensity_override. - Formatter expression wording:
krea_formatter.pyorcaption_naturalizer.py.
Pose / Action
Generic pose text is selected by _pose_pool. Hardcore sexual pose categories
are different: the sexual position/action is an item/template selected by the
content route, with content_seed_axis set to pose for pose-content
categories.
Edit targets:
- Normal pose pools: legacy
g.POSES,g.EVOCATIVE_POSES, or JSONposes. - Hardcore positions/actions:
categories/sexual_poses.json. - Position filtering UI:
build_hardcore_position_pool_json,build_hardcore_action_filter_json,_apply_hardcore_position_config_to_subcategory. - Krea2 action rewrite, POV position rewrite, cleanup:
krea_formatter.py.
Composition
Composition text is selected by _composition_pool.
Resolution order:
SxCP Composition Pool/SxCP Location Themewithreplaceoverrides the category composition pool.- Category/subcategory/item direct
compositionsand named composition pools are merged. SxCP Composition Poolwithaddappends entries.- Fallback is legacy
g.COMPOSITIONSorg.GROUP_COMPOSITIONS.
Edit targets:
- General composition pools:
categories/expression_composition_pools.json. - Category-specific composition pools: relevant category JSON.
- Workflow overrides:
SxCP Composition Pool. - Camera-aware composition replacements:
_coworking_composition_prompt.
Character Route
flowchart TD
A[Woman/Man/Character Slot chain] --> B[character_cast JSON]
C[Profile Load] --> D[character_profile JSON]
E[Manual Details / Hair / Body / Age / Eyes / Clothing nodes] --> A
B --> F[_parse_character_cast]
F --> G[_character_slot_label_map]
G --> H[_context_from_character_slot]
H --> R[cast descriptors + slot clothing + expression settings]
D --> I[_apply_character_profile_to_context]
I --> R
Important behavior:
- Slot chaining labels the closest slot to the final node as
Afor that gender, then upstream slots asB,C, and so on. character_castis for multi-character configured casts.character_profileis for reusable primary-character details.SxCP Character Manual Detailsand characteristic pool nodes can feed slots.SxCP Character Clothingcan feedsoftcore_outfitandhardcore_clothing.- A man slot can be marked as POV. POV men are omitted from visible cast descriptors, and camera wording is adapted to first-person view.
Edit targets:
- Appearance field generation:
_context_from_character_slot,_character_context_for_label,_cast_descriptor_entries. - Profile save/load:
SxCPCharacterProfileSave,SxCPCharacterProfileLoad, profile helpers inprompt_builder.py, andweb/profile_buttons.js. - Hair/body/ethnicity list behavior: characteristic config builders in
prompt_builder.py.
Insta/OF Pair Route
flowchart TD
O[SxCP Insta/OF Options] --> P[build_insta_of_pair]
C[character_cast] --> P
S[seed_config] --> P
L[location_config] --> P
M[composition_config] --> P
H[hardcore_position_config] --> P
P --> A[soft_row via build_prompt]
P --> B[hard_row via build_prompt]
A --> X[pair metadata]
B --> X
X --> K[Krea2/SDXL/Naturalizer]
Softcore row:
- Category comes from
INSTA_OF_SOFTCORE_SUBCATEGORY_BY_LEVEL. - Outfit comes from character slot
softcore_outfitif present, otherwiseINSTA_OF_SOFTCORE_OUTFITS. - Soft pose comes from
INSTA_OF_SOFTCORE_POSES. - Partner styling comes from
_insta_of_partner_stylingwhen softcore cast issame_as_hardcore.
Hardcore row:
- Category is always
Hardcore sexual poses. - Cast count comes from
SxCP Insta/OF Options. - Position/action can be constrained by
SxCP Hardcore Position PoolandSxCP Hardcore Action Filter. - Clothing comes from character slot hardcore clothing first, then fallback
hardcore_clothing_continuity. - Men receive default hardcore clothing if visible and not configured.
- POV labels alter action, camera, composition, and visible cast descriptors.
Continuity:
same_creator_same_roomreuses the softcore scene for hardcore.same_creator_new_scenelets hardcore use its own scene.- Shared cast descriptors are stored in pair metadata and consumed by formatters.
Hardcore Position Route
SxCP Hardcore Position Pool and SxCP Hardcore Action Filter both emit
hardcore_position_config.
flowchart TD
A[Hardcore Position Pool] --> C[hardcore_position_config]
B[Hardcore Action Filter] --> C
C --> D[_filter_hardcore_categories_for_position]
C --> E[_apply_hardcore_position_config_to_subcategory]
E --> F[item_templates / axes in sexual_poses.json]
F --> G[role_graph + item + axis_values]
G --> H[Krea2 action sentence and POV rewrite]
What each part owns:
sexual_poses.json: available positions, families, action templates, role graph templates, and action-specific pool references.prompt_builder.py: filters which templates/axes remain available.krea_formatter.py: rewrites the selected action into model-readable prose, including POV variants and cleanup.
If one action keeps recurring, inspect:
- The enabled position family/action flags.
weightvalues insexual_poses.json.- Whether the selected subcategory has only a small compatible set after filtering.
- Whether the formatter collapses several raw actions into the same final wording.
Camera And Scene Route
Camera config nodes:
SxCP Camera Control: direct camera settings.SxCP Camera Orbit Control: orbit-like camera settings.SxCP Qwen Camera Translator: converts qwen multi-angle info intocamera_config.
Camera handling:
- Camera nodes emit
camera_config. build_promptcalls_apply_camera_config._camera_directivecreates a plain camera sentence unless disabled/off._camera_scene_directive_for_contextcan add location-aware camera text.- POV rows suppress the normal camera directive and use first-person camera wording instead.
Current camera-aware scene adapter:
- Coworking/business-cafe/office scenes are detected by
_is_coworking_scene. - Location profile comes from
_coworking_location_profile. - Direction, distance, and elevation details come from
_coworking_direction_detail,_coworking_distance_detail, and_coworking_elevation_detail. - Composition cleanup for coworking outfit-check wording happens in
_coworking_composition_prompt.
Important POV rule:
- In POV rows, location anchors must stay behind, beside, or at the frame edges. The foreground belongs to the POV body/hands and visible partner/action.
Formatter Routes
Krea2
format_krea2_prompt chooses between three roads:
- Pair metadata:
_insta_pair_to_krea. - Normal metadata row:
_normal_row_to_krea. - Plain text fallback:
_fallback_text_to_krea.
Key Krea2 ownership:
- Cast descriptor naturalization:
_cast_prose,_natural_label_text. - Hardcore action sentence:
_hardcore_action_sentence. - POV hardcore sentence:
_pov_hardcore_pose_sentence,_pov_action_phrase. - Clothing state cleanup:
_natural_clothing_state. - Camera scene preservation:
_camera_scene_phrase.
SDXL
format_sdxl_prompt chooses between:
- Pair metadata:
_soft_tagsand_hard_tags. - Normal metadata row:
_row_core_tags. - Plain text fallback:
_fallback_text_to_sdxl.
Use this route for style triggers, weighted tag style, nude weighting, and Pony / SDXL quality/style presets.
Naturalizer
naturalize_caption chooses metadata-specific renderers such as
_configured_cast_from_row, _couple_from_row, and single/group renderers.
Use this route when the row metadata is correct but the sentence-style caption is too mechanical or unsuitable for training captions.
Utility / Workflow Nodes
These do not own prompt pool wording, but they affect execution and review:
| Node family | Files | Purpose |
|---|---|---|
| Loop nodes | loop_nodes.py, web/loop_slots.js |
While/for loop execution and carry values. |
| Index switch | loop_nodes.py, web/index_switch_slots.js |
Multi-input to selected output, and selected input to multi-output routing. |
| Accumulator | loop_nodes.py, web/accumulator_preview.js |
Stores generated values/images during workflow execution and previews/reorders/deletes them. |
| Persistent text preview | loop_nodes.py, web/preview_any_text.js |
Stores any value as text and keeps it after workflow reload. |
| SDXL bucket size | SxCPSDXLBucketSize in __init__.py |
Random/fixed SDXL bucket width and height selection. |
Editing Cheatsheet
| Symptom | First file/function to inspect |
|---|---|
| Wrong main category/subcategory frequency | Category node config, load_category_library, category JSON weights. |
| Wrong outfit/clothing item | Relevant category JSON, INSTA_OF_SOFTCORE_OUTFITS, SxCP Character Clothing. |
| Nude/clothing state confusing Krea2 | build_insta_of_pair clothing state helpers, then _natural_clothing_state. |
| Wrong location | categories/location_pools.json, category scene_pool, _scene_pool. |
| Location good but camera/location layout wrong | _camera_scene_directive_for_context, coworking adapter functions. |
| Repeated desk/anchor in POV foreground | Coworking direction/distance/elevation helpers. |
| Wrong expression intensity | Character slot expression settings, _expression_entries_for_intensity, expression pools. |
| Expression appears when disabled | _disable_row_expression, formatter expression extraction. |
| Same hardcore action repeats | Hardcore filter config, sexual_poses.json weights, _apply_hardcore_position_config_to_subcategory. |
| Raw hardcore prompt position is vague | sexual_poses.json item templates and role graph templates. |
| Krea2 hardcore prompt position is vague | _hardcore_action_sentence or _pov_hardcore_pose_sentence. |
| Man appears described in POV | POV labels, _cast_prose omit labels, _pov_action_phrase. |
| Camera prompt missing from Krea2 | Row camera_directive / camera_scene_directive, then Krea _camera_phrase. |
| Trigger missing in Krea2 fallback | format_krea2_prompt preserve-trigger fallback behavior. |
| SDXL tags too weak/wrong style | sdxl_formatter.py presets and _row_core_tags / _soft_tags / _hard_tags. |
| Saved profile does not match liked character | Profile save/load path and whether the saved input is row metadata or regenerated slot config. |
| Accumulator preview behavior wrong | loop_nodes.py accumulator methods and web/accumulator_preview.js. |
Safe Edit Workflow
Before changing prompt behavior:
- Capture one raw builder output and the formatter output.
- Check metadata JSON for
source,main_category,subcategory,content_seed_axis,scene_text,item,role_graph,source_role_graph,item_axis_values,composition,camera_scene_directive, andpov_character_labels. - Decide whether the bug is selection, raw wording, camera adaptation, or formatter rewrite.
- Edit the smallest owning pool/template/function.
- Re-run a small simulation with fixed person/scene/category seeds and only the target axis varied.
The repo may have unrelated dirty files during interactive prompt work. Always stage only the intended files for commits.