ComfyUI > Nodes > comfyui-adaptiveprompts > Prompt Cleanup 🧹

ComfyUI Node: Prompt Cleanup 🧹

Class Name

PromptCleanup

Category
adaptiveprompts/processing
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 Cleanup 🧹 Description

Streamline prompt strings by removing unnecessary elements for concise, effective AI-generated art prompts.

Prompt Cleanup 🧹:

The PromptCleanup node is designed to streamline and refine prompt strings by removing unnecessary or redundant elements, ensuring that the prompts are concise and effective. This node is particularly beneficial for AI artists who want to enhance the clarity and impact of their prompts without manually editing them. By automating the cleanup process, PromptCleanup helps maintain a high standard of prompt quality, which can lead to more accurate and aesthetically pleasing AI-generated art. The node's primary goal is to optimize prompt strings for better performance and results in AI art generation.

Prompt Cleanup 🧹 Input Parameters:

string

This parameter represents the input prompt string that you want to clean up. It is a multiline string, allowing you to input complex prompts with multiple lines. The default value is an empty string, and it serves as the primary input for the cleanup process.

detection_mode

This parameter determines the strategy for detecting elements within the prompt that need to be cleaned up. You can choose between "prioritize_words" and "prioritize_phrase," with the default being "prioritize_phrase." This choice affects how the node identifies and processes parts of the prompt for cleanup.

matching_mode

This parameter specifies the method used to match elements within the prompt. Options include "exact," "ignore_case," and "flexible," with "flexible" as the default. This setting influences the node's ability to recognize and clean up elements based on different matching criteria.

index_brackets

A boolean parameter that, when set to true, expands combinations within curly braces (e.g., {a|b}) into all indexed variants. If false, lines with braces are skipped from indexing. The default value is false, and this parameter helps manage complex prompt structures.

chance

This parameter is a float that determines the probability of each cleanup action being applied. It ranges from 0.0 to 1.0, with a default value of 1.0, allowing you to control the likelihood of cleanup actions being executed.

seed

An integer parameter used to initialize the random number generator for probabilistic cleanup actions. It ranges from 0 to 0xffffffffffffffff, with a default value of 0, ensuring consistent results across different runs if desired.

blacklist_file

This parameter specifies the file containing a list of elements to be excluded from the prompt. The default file is "blacklist.txt," and it helps prevent certain words or phrases from being included in the final prompt.

refresh_cache

A boolean parameter that, when set to true, reloads the wildcards and blacklist caches. The default value is false, and this option is useful for ensuring that the latest changes to these files are applied during the cleanup process.

Prompt Cleanup 🧹 Output Parameters:

cleaned_string

The output parameter cleaned_string provides the refined version of the input prompt string after the cleanup process. It reflects the removal of unnecessary elements and the application of the specified cleanup strategies, resulting in a more concise and effective prompt.

Prompt Cleanup 🧹 Usage Tips:

  • Experiment with different detection_mode and matching_mode settings to find the best combination for your specific prompt structure and desired outcome.
  • Use the index_brackets parameter to manage complex prompt structures with curly braces, ensuring that all possible combinations are considered if needed.
  • Adjust the chance parameter to control the aggressiveness of the cleanup process, especially if you want to retain some variability in the prompt.

Prompt Cleanup 🧹 Common Errors and Solutions:

"Invalid detection_mode value"

  • Explanation: The value provided for detection_mode is not one of the accepted options.
  • Solution: Ensure that the detection_mode is set to either "prioritize_words" or "prioritize_phrase."

"Invalid matching_mode value"

  • Explanation: The value provided for matching_mode is not one of the accepted options.
  • Solution: Ensure that the matching_mode is set to "exact," "ignore_case," or "flexible."

"Blacklist file not found"

  • Explanation: The specified blacklist file does not exist in the expected location.
  • Solution: Verify the file path and ensure that the blacklist file is correctly named and located in the specified directory.

Prompt Cleanup 🧹 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.