Remove Text Block🧸
Strip <think> reasoning tags out of LLM output
- Text
- Removed_text
- Troubleshooting
Reasoning models are great until they dump all their thinking into the output. If you've run a DeepSeek R1, a distilled R1, or any "thinking" model through Advanced Prompt Enhancer, you've seen it: the actual prompt you wanted is buried inside a wall of <think>...</think> chatter. Remove Text Block cuts that out. You tell it the opening and closing markers, and it deletes everything between them (and optionally the markers too), leaving just the text you care about.
It's a small, specific tool that becomes essential the moment you start using test-time-reasoning models to generate prompts.
How it works
You give it a block of Text, an Opening_tag, and a Closing_tag. The node finds the region bounded by those markers and removes it. For reasoning models that's <think> and </think>, but it's just string matching, so you can strip any bracketed section: XML-ish tags, custom delimiters, whatever your model emits. The clean text comes out one output and the removed chunk comes out another, so you can inspect what got cut if you're debugging.
The inputs that matter
- Text (optional): the block to clean, usually piped from an LLM node.
- Opening_tag and Closing_tag: the markers that bound the region to remove. For reasoning models,
<think>and</think>. - Open_tag_instance / Close_tag_instance (1 to 550): which occurrence to match, in case the markers appear more than once. Usually you leave these at 1.
- Remove_tags (boolean, default true): whether to delete the markers themselves along with the text between them, or keep the markers.
- Pass_Through_on_error (boolean, default true): if the node can't find the tags, this decides whether it passes the original text straight through (safe default) or errors. Leaving it on means a prompt without any think-block still flows through untouched, which is what you want in a pipeline that sometimes gets reasoning output and sometimes doesn't.
Outputs: Text (the cleaned result, wire this onward), Removed_text (what got cut), and Troubleshooting.
Why Pass_Through_on_error matters
This is the setting that keeps the node from being fragile. Say you build a workflow around a reasoning model, then swap in a normal model that doesn't emit <think> tags. With Pass_Through_on_error on, Remove Text Block just hands the text along unchanged instead of throwing an error and halting your queue. Leave it on unless you specifically want a hard failure when the markers are missing.
Installing it
Ships in Plush-for-ComfyUI. Install via ComfyUI Manager (search "Plush", install Plush-for-ComfyUI, restart), or manually: cd ComfyUI/custom_nodes && git clone https://github.com/glibsonoran/Plush-for-ComfyUI.git, then pip install -r requirements.txt, restart.
Common issues
The usual snag is a mismatch between the markers you typed and what the model actually emits. Some models use <think>, some use different casing or a slightly different tag, and some wrap reasoning in a format you didn't expect. If nothing gets removed, print the raw LLM output first and copy the exact opening and closing strings. If your prompt is coming out empty, you've probably got the tags reversed or matched a region that swallowed the whole thing. The Removed_text output is handy here: it shows you exactly what the node decided to cut.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| Opening_tag | STRING | Enter the character(s) that start the text block you want to remove | |
| Closing_tag | STRING | Enter the character(s) that end the text block you want to remove | |
| Open_tag_instance | INT | 11–550 | Enter which instance of the Opening_tag you want to use |
| Close_tag_instance | INT | 11–550 | Enter which instance of the Closing_tag you want to use |
| Remove_tags | BOOLEAN | true | — |
| Pass_Through_on_error | BOOLEAN | true | — |
| Textopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Text | STRING | — |
| Removed_text | STRING | — |
| Troubleshooting | STRING | — |