ComfyUI Node

Think Remover

Stripping <think> tags off reasoning-LLM output in ComfyUI, in one node

By lrzjason·Created 2 years ago·Updated 2 years ago· 5
Think Remover
    • cleared_content
    • think_content
    text

    The name is a lie, and that's the best thing about it. Think Remover doesn't call an LLM, needs no API key, and downloads no model. It's a string-splitter with a job: take text that came out of a reasoning model and cut out the <think>...</think> block, so what's left is the answer.

    That block is the new normal. Since DeepSeek-R1 made chain-of-thought visible in early 2025, the local reasoning models people run inside ComfyUI (Qwen thinking mode, R1 derivatives, the various 7B–32B distillations) wrap their internal reasoning in <think>...</think> and only then write their real answer. Run one of those through an LLM or vision node in ComfyUI and your downstream node gets the whole dump - reasoning included. If that text is going to a prompt encoder, a display, or an API, you usually want the reasoning gone, or at least separated. That's the niche this node exists to fill.

    How it works

    Read the code and it's ~20 lines of Python, no dependencies. It finds the first </think> in your text (case-insensitive) and splits there:

    • think_content gets everything from the start through the closing tag - i.e. the reasoning, tags included, whitespace trimmed.
    • cleared_content gets everything after the closing tag - the actual answer.

    Two outputs, one split. Wire cleared_content into your prompt encoder or whatever needs the clean text, and send think_content somewhere else if you want the reasoning logged separately. And if there's no </think> at all, both outputs return your input untouched, so feeding it ordinary text is harmless.

    Where people get burned: it only looks for </think>. It does not require the matching <think> opener, and it does not look for the reasoning start tag. A stray or unfinished </think> - say the model hit a token limit before closing the block - and the node will happily truncate everything after it, or (if it never appears) silently pass the full text through. It also splits on the first closing tag only; if your answer itself contained </think> the rest would be dropped. For most real output these edge cases are rare, but they're why this is a "nice to have" rather than magic.

    The one input that matters

    • text (STRING) - the raw model output. That's it. No optional inputs, no settings, no knobs.

    You feed it a string, you get cleared_content and think_content strings back. In ComfyUI 2026 terms it's a text-processing utility node in the same spirit as the WAS string tools - it sits between your LLM node and the next thing, doing nothing clever.

    Install

    The README is famously minimal (a description, a contact list, a sponsor link - no install section at all), but the pack is genuinely zero-dependency, so it doesn't need one. pyproject.toml lists no requirements; the torch/numpy/cv2 imports at the top of the source are unused leftovers that are already in every ComfyUI install anyway.

    Easiest path: ComfyUI Manager → "Install Custom Nodes" → search Comfyui-ThinkRemover → install, restart. Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lrzjason/Comfyui-ThinkRemover
    

    Then restart ComfyUI. It'll appear as Think Remover under the ThinkRemover category.

    Common issues

    • Nothing gets removed. The text didn't contain a </think> - either the model had thinking mode off, or the output was truncated before the closing tag. Check your raw output first; this node can't fix what the model never wrote.
    • Everything after a point vanished. A lone </think> in the middle of the text did the truncation. Look at the upstream LLM's raw string and confirm the tags are well-formed.
    • The reasoning tags are still in think_content. By design. If you want bare reasoning you'll strip the tags yourself; if you just want the clean answer, use cleared_content.

    It's a 0-impression new pack from a small author, so don't expect forum threads full of battle stories - for a 20-line pure-string node there aren't any. Treat it as a convenient way to keep reasoning output out of your conditioning text, and know exactly what it does before you trust it with a long answer.

    CategoryThinkRemover/ThinkRemover

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (2)

    NameTypeDescription
    cleared_contentSTRING
    think_contentSTRING