FP Folded Prompts
Your prompt is a wall of tags — turn it into a folder tree you can actually edit
- text
The default ComfyUI prompt box is one long wall of text. If you've ever stared at a 200-tag monster line trying to remember which block controls the hair and which one you disabled last week, you already know why FP Folded Prompts exists: it turns your prompt into a collapsible folder tree. Folders group tags, each line can be enabled or disabled with a click, and - the part that separates it from a glorified text editor - it emits a clean, finished prompt string on the other end.
This is a pure quality-of-life node, same family as rgthree's graph-organizing pack or the "prompt library" nodes people ask about in r/comfyui. It generates nothing itself; it makes a workflow you actually live in less miserable. For large projects - storing previous prompts, reusing a style-tag block across generations, keeping lines you keep swapping - that's genuinely handy.
What it actually does
Open the node and you get a folder tree. There are two ways in:
- Tree Mode - click your way around. Expand/collapse folders, toggle lines on and off, assign a line to a regional area, and set per-line weights (the V2.0 addition) like
(tag:1.2)right in the tree. - Edit Mode - write the whole structure as plain text with
[Folder]syntax:
[Folder]
string1 some text or tags, bla, bla, bla
string2 some text or tags, bla, bla, bla
[Folder/Subfolder]
string1 some text or tags, bla, bla, bla
Any line starting with // is a comment - it shows up disabled in the tree and never reaches the output.
Under the hood it's mostly JavaScript. The tree lives in the node and gets serialized into an internal input called pf_json; when the graph runs, the node walks that tree, skips disabled lines, and joins the enabled ones into one string. Because that state is stored in the workflow JSON, it survives save, share, and reload even if every cache file vanishes.
The inputs that matter
The info schema is small, and honestly only one field is yours to touch:
- text - the raw prompt lines. In Tree Mode this is managed by the JS; in Edit Mode it's where you type. Either way it's the source of the tree.
- before_text - optional, and the one worth knowing: whatever you put here gets prepended to the output. Handy for a base quality tag that stays put while the tree provides the variation.
pf_jsonandpf_node_id- both marked internal, managed by JS. Leave them alone; wiring something in there is how you break the tree.
The single output is a STRING named text - wire it into a CLIP Text Encode like any other prompt. The author also pairs it with his FP Text Clean And Split and CLIPEncodeMultiple (in ComfyUI Utils Extra) so each region below gets its own encode; a plain encoder works fine too.
Regional Prompting built in
You can assign any line to one of five regions using tags: <AR1>text...</>, <AR2>..., up to <AR5>. The closing tag is always just </> - no matching names to keep in sync, which is the whole point. The node wraps assigned lines in those tags on the way out, and a downstream parser (his Text Clean And Split node, or the CLIPEncodeMultiple encoder) splits them apart. It's the author's own convention, not a ComfyUI standard, so it only pays off if you use his companion nodes with it.
Installing it
No model downloads, no Python dependencies - there's no requirements.txt at all. Just the node code plus a big chunk of JS. Two ways:
- ComfyUI Manager → search "Folded prompts" → Install → restart ComfyUI.
- Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/akawana/ComfyUI-Folded-Prompts.git
Restart and it's there under AK/Folded Prompts.
Where people get burned
The node needs a recent ComfyUI: it's built on the newer comfy_api.latest extension API, so if you're on an old install it simply won't load. And because the whole UI is JS, a stale browser tab can show a node that renders as a sad empty box - hard-refresh before you blame the pack. Don't touch pf_json or pf_node_id; they're sync channels for the frontend. One genuine annoyance the author acknowledges: editing anything re-triggers the CLIP encode, even if you only changed text inside a region. He recommends his CLIP Text Encode Cached node from Utils Extra to dodge the wasted re-encode. And that JSON snapshot the README mentions, saved as a cache file on disk? It's a convenience copy - the workflow holds the truth, so deleting it is safe.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| pf_jsonopt | STRING | Internal: tree JSON. Managed by JS. | |
| pf_node_idopt | STRING | Internal: node id. Managed by JS. | |
| before_textopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |