ComfyUI > Nodes > comfyui-adaptiveprompts > Prompt Repack 📦

ComfyUI Node: Prompt Repack 📦

Class Name

PromptRepack

Category
adaptiveprompts/generation
Author
Alectriciti (Account age: 5005days)
Extension
comfyui-adaptiveprompts
Latest Updated
2025-11-05
Github Stars
0.05K

How to Install comfyui-adaptiveprompts

Install this extension via the ComfyUI Manager by searching for comfyui-adaptiveprompts
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter comfyui-adaptiveprompts in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Prompt Repack 📦 Description

Enhance text prompts with dynamic repacking for creative AI outputs using word and phrase replacement strategies.

Prompt Repack 📦:

The PromptRepack node is designed to enhance the flexibility and adaptability of text prompts by dynamically repacking them based on specified criteria. This node is particularly useful for AI artists who want to manipulate and refine text prompts to achieve more creative and varied outputs. By utilizing a combination of word and phrase replacement strategies, PromptRepack allows you to prioritize either individual words or longer phrases, depending on your artistic needs. It also supports various matching modes to control how replacements are identified and applied, offering a balance between precision and flexibility. The node can handle complex prompt structures, including those with wildcard patterns and blacklists, ensuring that unwanted terms are excluded from the final output. Overall, PromptRepack provides a powerful tool for customizing and optimizing text prompts, enabling more nuanced and controlled creative expression.

Prompt Repack 📦 Input Parameters:

string

This parameter represents the input text string that you want to repack. It is the primary content that will undergo transformation based on the node's settings. The string can be multiline, allowing for complex and detailed prompts. The default value is an empty string.

detection_mode

This parameter determines the priority of replacements within the text. It offers two options: prioritize_words, which focuses on replacing individual words, and prioritize_phrase, which targets longer, underscore-joined phrases first before addressing individual words. The default setting is prioritize_phrase, which is useful for maintaining the integrity of longer expressions.

matching_mode

This parameter controls how the node matches text for replacement. It includes three options: exact, which requires precise matches without case folding or space-to-underscore conversion; ignore_case, which matches text in a case-insensitive manner; and flexible, the default mode, which combines case insensitivity with space-to-underscore conversion for broader matching capabilities.

index_brackets

This boolean parameter specifies whether to expand bracketed combinations (e.g., {a|b}) into all indexed variants. If set to true, the node will consider all possible combinations for indexing; otherwise, lines with braces are skipped. The default value is false, which simplifies processing by ignoring bracketed variations.

chance

This parameter is a float that defines the probability of a replacement occurring. It ranges from 0.0 to 1.0, with a default value of 1.0, meaning replacements are always applied when possible. Adjusting this value allows for controlled randomness in the repacking process, which can lead to more varied outputs.

seed

This integer parameter sets the seed for the random number generator used in the repacking process. It ensures reproducibility of results by providing a consistent starting point for random operations. The default value is 0, and it can range up to 0xffffffffffffffff.

blacklist_file

This parameter specifies the file containing terms that should be excluded from the repacking process. It allows you to maintain a list of words or phrases that should not appear in the final output. The default file is blacklist.txt, and you can choose from other available blacklist files in the specified directory.

refresh_cache

This boolean parameter determines whether to reload the wildcards and blacklist caches. Setting it to true forces the node to refresh its internal data, ensuring that any changes to the blacklist or wildcard patterns are applied. The default value is false, which maintains the current cache state for efficiency.

Prompt Repack 📦 Output Parameters:

STRING

The output of the PromptRepack node is a transformed string that reflects the applied repacking rules. This string is the result of replacing words and phrases according to the specified detection and matching modes, while respecting the blacklist and chance settings. The output is designed to be a refined version of the input prompt, tailored to your creative requirements.

Prompt Repack 📦 Usage Tips:

  • To achieve more varied and creative outputs, experiment with the chance parameter by setting it to a value less than 1.0, introducing controlled randomness into the repacking process.
  • Use the detection_mode parameter to focus on either individual word replacements or longer phrases, depending on the complexity and style of your desired output.
  • Regularly update and manage your blacklist_file to ensure that unwanted terms are effectively excluded from your prompts, maintaining the quality and relevance of the output.

Prompt Repack 📦 Common Errors and Solutions:

Error: "FileNotFoundError: [Errno 2] No such file or directory: 'blacklist.txt'"

  • Explanation: This error occurs when the specified blacklist file cannot be found in the directory.
  • Solution: Ensure that the blacklist.txt file exists in the correct directory or update the blacklist_file parameter to point to an existing file.

Error: "ValueError: Invalid matching mode"

  • Explanation: This error indicates that an unsupported value was provided for the matching_mode parameter.
  • Solution: Verify that the matching_mode is set to one of the supported options: exact, ignore_case, or flexible.

Error: "TypeError: Seed must be an integer"

  • Explanation: This error occurs when a non-integer value is provided for the seed parameter.
  • Solution: Ensure that the seed parameter is set to a valid integer value within the specified range.

Prompt Repack 📦 Related Nodes

Go back to the extension to check out more related nodes.
comfyui-adaptiveprompts
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.