ComfyUI-Prompt-Weaver
Prompt management extension providing a prompt toggle grid, global archives, tag autocomplete, localization, and a desktop workflow bridge for ComfyUI.
Nodes (1)
ComfyUI Prompt Weaver
🌐 Documentation / 文档: English · 简体中文 README →
ComfyUI Prompt Weaver provides two features:
- A workflow-opening bridge between the Prompt Weaver desktop application and ComfyUI.
- A Prompt Card Grid node for quickly enabling, disabling, arranging, and combining prompt cards.
The plugin has no additional Python or JavaScript dependencies.
Recent updates
- Favorite categories can now supply a random card on each browser-initiated run. The live workflow keeps the category choice, while the submitted prompt and image-embedded workflow contain the same fixed draw.
- Workflow-local variables support
{name}completion and validated copy/paste between workflows. - Custom controls, dialogs, tooltips, and accessibility labels now follow ComfyUI's English or Simplified Chinese locale through the official locale resources; open interfaces update when the language changes.
- The card editor has a Clear action for its current prompt draft, with undo/redo support. The card title and editor settings are preserved.
- Danbooru autocomplete uses one selected SQLite dictionary, either a manually downloaded copy or an imported local copy. A configurable minimum post count (default 100, minimum 10) controls the active suggestion set and displays its size; dictionary updates remain manual.
- A sample workflow is available to inspect or download.
Installation and upgrades
Clone this repository into ComfyUI's custom_nodes directory:
git clone --branch master https://github.com/qjxmgs/ComfyUI-Prompt-Weaver.git
Alternatively, download the source archive and copy the complete ComfyUI-Prompt-Weaver directory into custom_nodes. Restart ComfyUI after installation, then press Ctrl+F5 in the browser to force a full refresh.
For a Git installation, update from inside the plugin directory:
git pull --ff-only origin master
The desktop application currently installs the plugin only when the target directory does not exist. It does not overwrite an older installation. Upgrade that installation manually and make sure the following files and directories are present if the node does not appear:
nodes.py,archive_store.py,prompt_card_library.py,tag_autocomplete.py,data/tag_sources.json, and__init__.pylocales/enandlocales/zhweb/prompt_toggle_grid.jsandweb/prompt_toggle_grid.cssweb/prompt_weaver_i18n.jsweb/prompt_grid_archives.js,web/prompt_grid_reorder.js, andweb/prompt_card_library.jsweb/prompt_editor_tokens.js,web/prompt_editor_window.js,web/prompt_assistant_tags.js, andweb/prompt_tag_autocomplete.js
The random favorite category button also requires web/assets/icons/ic_random.png; copy the complete web/assets directory when upgrading from an archive.
Sample workflow
View the sample workflow or download the JSON file. Open the downloaded file in ComfyUI to explore the Prompt Card Grid in a complete graph. The sample also uses other custom nodes and model files, which must be installed separately if they are not already available.
Local-only state changes
Prompt Weaver enables its workflow bridge and every server-side write only when ComfyUI is configured to listen exclusively on loopback addresses such as 127.0.0.1, ::1, or localhost. Starting ComfyUI with --listen, --listen 0.0.0.0, a LAN address, or any mixed local/non-local address keeps read-only queries available but makes archive, favorite-card, and tag-dictionary changes return HTTP 403.
Restart ComfyUI with a loopback-only listener to use those operations. Proxy and forwarding headers are intentionally not trusted to relax this boundary.
Language support
Prompt Weaver uses English source strings and ComfyUI's official locale resources. The node definition, settings, commands, and every custom JavaScript control load their English and Simplified Chinese text from locales/en and locales/zh through ComfyUI's /api/i18n resource. No private Chinese translation table is bundled in the JavaScript runtime.
Custom dialogs, tooltips, status messages, and accessibility labels follow Comfy.Locale and update when the language changes. If the official resource is unavailable or a key is missing, the original English source string remains visible. Traditional Chinese is not currently bundled and falls back to English rather than displaying Simplified Chinese.
Prompt text, Prompt Assistant tags, user-created archive names, card titles, and existing workflow data are never translated or rewritten. New cards use the canonical titles Card 01 through Card 04, and the built-in archive uses Default Archive. Historical stored names remain unchanged for compatibility.
Prompt Card Grid
Add Prompt Card Grid from the Prompt Weaver/Prompt node category. The node outputs a standard STRING, which can connect directly to CLIPTextEncode.text or any other string input.
The optional prefix_prompt string input can receive trigger words or any other prompt text. When connected, its value is placed before the enabled grid cards with an automatic , separator.
The combined result is deduplicated case-insensitively at top-level English/Chinese commas and line breaks, preserving the first spelling and keeping separators inside brackets, quotes, and escaped content intact.
Leaving the input disconnected or empty preserves the existing grid-only output.
Screenshots show the Simplified Chinese UI; interface text follows the language selected in ComfyUI.
Prompt Card Grid: arrange and enable prompt cards in a multi-column layout.
Each card contains:
- An enable switch.
- A title used only for identification; it is not included in the output. Random favorite mode temporarily shows the category name and makes the title read-only.
- A fixed single-line prompt field and a tag-editor button.
- Drag-to-reorder from any non-interactive blank area with live displacement animation. Blank areas use a grab cursor, and
Escrestores the original order while dragging. - Card color and deletion actions in the card context menu. Delete expands in place to a Confirm/Cancel row before removing any card; right-clicking a text field keeps the browser's native menu.
Grid controls
The toolbar can add cards, switch every card through one compact three-state master toggle, and select a fixed layout through the 1 column–6 columns selector without a separate label.
The toggle is on when every card is enabled, off when every card is disabled, and centered when the grid is mixed; activating a mixed toggle enables every card.
A new node starts with two columns and four enabled empty cards. Array/visual order is the final combination order; changing the column count never changes that order.
Card editor
The editor button next to a prompt splits its text at top-level English or Chinese commas and line breaks. Separators inside parentheses, square or curly brackets, quotes, and escaped content are preserved. The editor deduplicates tags case-insensitively while retaining the first spelling and original order.
Its + composer accepts multiple prompts using the same splitting rules and commits on Enter, blur, or Confirm. Existing inactive duplicates are re-enabled instead of added again. Clicking or painting across tags toggles their selection.
Retain Unselected is enabled by default per card: inactive tags remain in the group after Confirm without entering node output. Their red × floats over the upper-right corner without changing the tag width and removes the tag from the current draft; removal is saved only after Confirm.
Text Mode keeps the raw active prompt in its textarea and shows retained inactive tags in a dim strip below it. Turning retention off discards inactive tags only when Confirm is pressed.
Esc dismisses one active interaction layer at a time—autocomplete, a favorite menu, prompt composition, or an in-progress pointer gesture—then closes the editor and discards the whole draft only when no cancellable layer remains. The red title-bar close button still closes immediately.
Confirm writes only selected tags back with , separators. The footer Copy button copies only the active current draft without closing or saving the editor.
Card editor: edit prompt tags, selection states, and the card title.
Editor controls and shortcuts
The editor uses a two-level header: the primary title bar contains only the active-tag count and red close button, while the toolbar below contains the editable card-title field, its adjacent current-state bulk button, undo/redo controls, and the 12–30 px Font Size control.
The bulk button reports All Enabled, All Disabled, Partially Enabled, or disabled No Prompts. Activating All Enabled disables every tag; activating All Disabled or Partially Enabled enables every tag. The button stays visible but disabled in Text Mode, and each activation creates one history step.
The title draft is saved with the prompt only after Confirm, and favorite actions opened from the editor use the current title draft. Retain Unselected and Text Mode are kept in that order at the left of the footer; hovering either option describes the action represented by its current checked state.
Plain Tab and Shift+Tab are reserved throughout the editor for switching between Text Mode and tag mode; they never move focus or accept an autocomplete result.
Undo and redo keep up to 100 prompt-content steps for the current editor session only and are cleared on Confirm, Cancel, or close. Tag changes, additions, removals, autocomplete insertions, bulk changes, and committed text edits participate; title, mode, retention, font-size, and geometry changes do not.
Continuous typing becomes one step when the field loses focus or is committed. Use Ctrl/Cmd+Z to undo, Ctrl/Cmd+Shift+Z to redo, or Ctrl+Y on Windows/Linux; while a text field is still actively editing, its native browser history remains in control.
Status messages remain below the prompt content. Font size is remembered locally. The dialog has a 600 px minimum width, can be moved only by dragging the non-interactive primary title-bar area, and can be resized from its corner; its saved geometry is clamped back into the current viewport when reopened.
Clear, between the bulk-state button and Undo, removes all active and retained tags, pending additions, and Text Mode content from the current editor draft. It preserves the card title, current mode, and Retain Unselected setting.
A nonempty draft can be cleared in one undoable step; Redo clears it again. The button is disabled when there is nothing to clear or a favorite update is being submitted.
Clearing does not save immediately: close the editor to discard the change, or use Confirm to save an empty grid-card prompt. Favorite-library snapshots still require a nonempty prompt, so add content before using Update there.
Autocomplete
The card prompt field, the + composer, and Text Mode share dual-source autocomplete. Danbooru suggestions come from the selected local SQLite dictionary; Prompt Assistant suggestions come from every CSV exposed by an installed ComfyUI-Prompt-Assistant.
Both sources are enabled by default and appear in one rounded source group in ComfyUI settings. Use the drag handle to reorder their priority or toggle either source independently; the top source wins equal-quality matches.
Exact, prefix, substring, and ordered character-skip matches are ranked in that order before source priority is applied. Character-skip matching ignores spaces, underscores, and hyphens, then favors an earlier first hit, fewer skipped characters, and a shorter candidate. Danbooru ties use post count. Final insertion text is deduplicated across sources.
Matching starts after one Chinese character or two Latin characters. Character-skip matching starts after two Chinese characters or three Latin characters. The maximum suggestion count is configurable in ComfyUI settings from 1 to 100 and defaults to 30.
Both data sources use the same four-column layout: English prompt with Chinese description underneath, category, source, and usage count. Matching text is highlighted in red in both the English tag and Chinese description, including the individual characters selected by character-skip matching.
Missing Chinese descriptions display —, while Prompt Assistant keeps the count column empty because it has no reliable usage statistics. Selecting a Danbooru tag inserts its canonical English tag with underscores converted to spaces.
The popup opens above or below according to available space and has a distinct title bar plus an animated accent border. Drag the outer edge away from the input to resize its height; all three input surfaces share the saved 120–720 px preference, and double-clicking the grip restores the 320 px default.
Arrow keys move the highlight and Enter selects it. Tab can still select a highlighted result in the grid card field, but inside the editor it always switches editing modes. Esc closes the autocomplete layer first. IME composition is not intercepted. In the card and Text Mode fields only the fragment surrounding the caret is replaced, preserving separators, wrappers, quotes, escapes, and weight suffixes.
Tag autocomplete: inspect matching tags, translations, sources, and usage counts.
Danbooru dictionary
Danbooru now uses one SQLite dictionary at a time: the manually downloaded ffdkj tag.sqlite (MIT), or a validated local copy imported through Manage prompt translations…. Prompt Assistant remains an independent source with its own switch and priority. Old Danbooru CSV files are left on disk but are no longer queried; CSV aliases are no longer matched.
Choose the active dictionary in the manager. A local import copies the file into the current ComfyUI user's data directory; changing the original file requires re-importing. Manual GitHub updates refresh only the downloaded copy and never replace the imported file or silently switch the active source. Opening the manager, searching and changing the threshold never download anything.
On upgrade, an existing valid local SQLite is preferred, otherwise an existing downloaded SQLite is reused, without writing migration state during reads.
Minimum Danbooru post count defaults to 100, accepts integers of 10 or greater, and is independent of the maximum suggestion count. Both the ComfyUI autocomplete settings and dictionary manager show the same input, quick values (10 / 50 / 100 / 200 / 300 / 400 / 500 / 1000), eligible count and dictionary total. The settings card spans the full row without a duplicate external label.
Valid edits save after a 300 ms debounce; invalid edits keep the previous effective value. Counts exclude Prompt Assistant. Lower values load more tags and use more resources. The threshold only filters autocomplete: existing cards, favorites and manually entered low-frequency tags can still resolve their Chinese translations.
Downloads and imports use a 64 MiB cap, read-only SQLite validation, temporary files and atomic replacement. A local dictionary needs at least one valid row; the remote full dictionary requires at least 300,000 rows.
Errors preserve the previous valid data and selection. The downloaded Git blob and SHA-256, update time, active source and total count are visible in the manager. The expected table is tags(name TEXT PRIMARY KEY, category INTEGER, cn_name TEXT, post_count INTEGER); categories are 0/1/3/4/5, translations must be nonempty and counts at least 10.
Source choice is stored per ComfyUI user. Thresholds use PromptWeaver.Autocomplete.MinPostCount and are sent as min_post_count to status/search; exact resolution is unfiltered. The source-switch endpoint is POST /prompt-weaver/tag-autocomplete/source with downloaded or local.
All dictionary writes retain the local-only server-listen guard. Only threshold-qualified rows enter autocomplete memory (two candidate sets maximum); statistics reuse a frequency histogram, while translations query the full SQLite by primary key. Direct matches precede fuzzy scans, which run only if needed.
Workflow variables
Use the Variable Manager icon beside Favorite Cards to manage variables saved in the current grid node's config.variables. Each variable has one value; no shared library is loaded or written. Other grid nodes and workflows remain independent. Switching or restoring an archive retains this node's variables.
New Variable adds an editable row. Enter a name, then leave the row or press Ctrl+Enter in the value field to save. Edit names on Enter or blur, values on Ctrl+Enter or blur; Escape cancels the current input. Values may be empty and can be cleared with the internal × button. Drag or use the handle's arrow keys to reorder. Successful edits save to the node immediately and support canvas undo. Renaming also updates unescaped references in this node's cards and retained tokens. Deleting a referenced variable requires confirmation and leaves its references for repair.
Copy Variables copies all names and values in order as dedicated Prompt Weaver clipboard data. Open another workflow's manager and use Paste Variables: matching names get the pasted values; other existing variables are retained, and new names are appended. Pasting validates the whole list before changing anything and is one canvas undo step; it does not rewrite prompt references. The paste button is enabled only when the clipboard contains valid variable data. Clipboard access requires a secure browser context and permission; if reading is unavailable or denied, the button stays disabled. Unsaved field edits are included when copying, but paste replaces drafts only after it succeeds.
Variable value fields, including new rows, use the same Prompt autocomplete as the card editor: Danbooru and Prompt Assistant sources, source ordering, minimum post count and result limit all follow the existing settings. Select with the mouse or arrow keys and Enter; Escape dismisses suggestions before cancelling the field edit. A selection stays in the draft until normal blur or Ctrl+Enter saving.
Type { in the card editor's tag-add field or Text Mode to suggest this node's variables. Use the mouse or arrow keys and Enter to insert {color}. Tab switches modes; Escape dismisses suggestions first. Any tag containing variables previews its fully substituted text on the second line (for example, {color} shirt becomes red shirt) instead of requesting Danbooru translations. Undefined references remain visible with a warning and are not automatically created.
Execution expands references in enabled card prompts once, using only the submitted workflow variables. Variable values and prefix_prompt are not recursively expanded. Write \{color} for literal {color}. Missing enabled references stop the node; disabled cards are ignored. Favorites and global archives carry references, not variable definitions.
Names are case-sensitive NFC Unicode identifiers (letter or underscore first, then letters, digits or underscores). A node allows up to 100 variables, 64 characters per name and 10,000 characters per value. Older saved node variables remain available; former shared-library files are not read, changed or deleted.
Favorite Cards
Favorite cards form a user-level library shared by every Prompt Card Grid node, workflow, archive, and browser tab for the same ComfyUI user. Every favorite belongs to a secondary category under exactly one primary category. Both category levels can be created and renamed at runtime.
Empty categories can be deleted directly; deleting a branch that contains favorites first requires choosing another secondary category, and the backend migrates those cards and removes the branch in one atomic operation. Sibling category names are case-insensitively unique.
Switch a grid card to a favorite
Each grid card embeds a dropdown arrow at the right edge of its title field. It opens a read-only Primary Category → Secondary Category → Favorite Card cascade: pointing at a category opens its submenu when there is room; in narrow windows, click to advance without overlapping the random buttons. Choosing a favorite switches the current grid card to that saved prompt snapshot.
The open primary and secondary branch stays highlighted, and each favorite title shows its active output-prompt count.
Hovering or keyboard-focusing a favorite shows a subdued, translucent, wrapping two-part prompt tooltip: normalized English output first, followed by Chinese translations resolved through the enabled autocomplete sources and their configured priority. The Chinese line uses full-width Chinese commas between top-level tokens, while missing translations retain the corresponding English token.
Moving away from the favorite keeps the current three-level branch open but hides the tooltip once that card is neither hovered nor focused; hovering another favorite shows its tooltip, and an outside click or Esc closes the cascade.
A red × on the right arms deletion as !; clicking it again deletes the global favorite, while three seconds, another interaction, or Esc cancels confirmation.
Choosing a favorite updates the current grid card:
- Replaces the title, prompt, retained-token policy, token states, and
favorite_idtogether. - Preserves the grid card ID, enabled switch, color, and position.
Selecting the same favorite again reloads its latest saved prompt data without changing the card color.
After every favorite selection, a one-shot shine sweeps across the visible title and prompt text areas; reduced-motion environments use a brief static highlight instead.
The cascade automatically flips and clamps to the viewport and supports arrow keys, Home, End, Enter/Space, Esc, and outside-click dismissal.
Switch a grid card to a saved favorite through the category menu. This screenshot predates the random buttons described below.
Randomize a favorite category
- Open a grid card's favorite dropdown.
- Click the dice icon on a primary or secondary category row, immediately to the left of the expand arrow. Clicking the category name or arrow still opens its submenu.
- Queue the workflow from the ComfyUI browser. Each run draws a fresh favorite from the selected category.
A primary category includes every card in its secondary categories; a secondary category includes only its own cards. The card's title field shows the selected category name without changing the stored title. The lit random icon indicates the mode. The title, Prompt field, and editor are read-only, while the enabled switch remains usable.
Click the lit icon to exit random mode and restore the stored title, or choose one specific favorite to switch to a fixed card. Entering or changing random mode sweeps the title and Prompt from left to right; exiting sweeps back from right to left immediately. Reduced-motion environments use a brief static highlight.
On each browser-initiated run, Prompt Weaver refreshes the current user's favorite library and chooses each eligible card with equal probability. The live canvas and saved Workflow keep the category choice. The submitted API Prompt and that run's image-embedded Workflow contain the same fixed chosen card; reloading the image Workflow therefore produces an ordinary fixed card. Archives preserve the category choice, and later library changes affect only future browser runs.
If the category is empty, deleted, or cannot be loaded, that run uses the card's original Prompt (or skips the card if it is empty) and shows a non-blocking warning. API/background runs without the browser also use the original Prompt rather than accessing another user's favorite library.
Manage favorite cards
The editor footer Favorites action opens a three-column Primary Category → Secondary Category → My Favorites manager for the card currently being edited.
Hovering or clicking a secondary category immediately browses its favorites. Primary categories can be dragged vertically to persistent insertion positions. Secondary categories support the same sibling reordering and can be dropped onto another primary category to reclassify them; their favorite cards move with them unchanged.
Category context menus also expose Top, Up, Down, and Bottom commands, while secondary categories retain a Move to Category fallback for keyboard, touch, and narrow layouts.
The + in the My Favorites header saves the current draft as a new independent favorite in that category, including when the draft is already linked to another favorite.
Each favorite shows its active output-prompt count and the same bilingual tooltip and two-click red deletion control as the grid cascade. The favorite content area is display-only; only its rounded Overwrite button asks for confirmation before replacing that saved snapshot with the current editor draft and linking the draft to it.
Favorites can be dragged vertically to an insertion line to reorder them within the current secondary category. While dragging, hovering another secondary category previews its favorites in the third column, where the card can be inserted at an exact position; dropping directly on the category row still appends it.
The favorite context menu also provides Rename, Top, Up, Down, Bottom, and Move to Category commands. Rename replaces the whole favorite row with a title input plus Cancel and Confirm actions without changing the saved Prompt snapshot.
Empty prompts cannot be created or used to overwrite a favorite, and request failures remain in the manager without blocking editing, copying, or confirmation.
The Favorite Cards manager can be moved by dragging its title bar and resized in both directions from the lower-right handle. Its size and position are remembered in the current browser and clamped to the visible viewport when reopened. Rendering, category changes, library mutations, and list scrolling no longer recenter the window.
Status and validation messages appear inline immediately to the right of the Favorite Cards title, reveal from left to right, and retract in the opposite direction after three seconds instead of adding a separate row.
The three columns scroll independently with compact themed scrollbars; shrinking the manager below the three-column threshold switches to the existing drill-down view and expanding it restores all columns.
Favorite Cards: browse categories and save the current card to a favorite.
Import and storage
The Import action beside the Favorite Cards title opens a batch text importer shared by editor and toolbar management modes. Choose an existing secondary category, then paste alternating title and Prompt lines; blank lines are ignored.
Preview is optional and lists valid cards plus skipped reasons. Confirmation always reparses the latest text, appends valid cards in source order with existing defaults, skips invalid entries, and reports an unmatched final title without blocking the remaining import.
Favorite-library create, move, update, and remove operations take effect immediately. The current grid card content and favorite association are committed only by Confirm; cancelling the editor leaves the card configuration unchanged without rolling back global library operations. Favorites remain independent snapshots, so later card edits never overwrite them implicitly.
The library is stored at ComfyUI-Prompt-Weaver/prompt-card-library.json in the current ComfyUI user's data directory. It uses the archive service's locked, validated, temporary-file plus atomic-replacement strategy; a corrupt or failed read never overwrites the original file.
Limits are 100 primary categories, 500 secondary categories, 2,000 favorite cards, and a 20 MiB library file. Version 1 persists primary-category order, secondary-category order within each primary, and favorite order within each secondary without adding per-item order fields. Batch text import uses one locked validation pass, one atomic write, and one revision update for every accepted group.
Global archives
Select and manage archives
The archive selector loads and switches complete grid states. The adjacent Save, Restore, Archive Manager, and Favorite Cards Manager actions use compact icon buttons; hovering or focusing an icon immediately shows its English name below it.
Archive Manager creates, saves, renames, deletes, imports, and exports archives. The Favorite Cards Manager opens the same three-column category and favorite management interface used by the card editor, replacing the draft overwrite action with an Edit action that opens the shared card editor and updates the saved favorite snapshot.
Archive-manager selection uses these controls:
- A normal click selects one archive.
Ctrladds or removes individual selections.Shiftselects a range from the latest anchor.Ctrl+Shiftadds a range.
Manager selection changes only the target of the Save/Rename/Export/Delete actions; it does not load node content.
An archive contains node size, column count, card order, switches, titles, colors, active prompts, per-card retained-token state, and optional favorite associations, but not canvas position or links. Loading from the toolbar also restores the saved node size.
Archive Manager: inspect, select, and manage saved grid states.
Archive rules
The Save button next to the selector writes the current grid and node size back to the associated archive. It is enabled only while the state is dirty and does not ask for confirmation. Changes made while a save is in progress remain dirty if they were not part of the saved snapshot.
- The pinned Default Archive starts with two columns and four enabled empty cards. It can be updated, imported, and exported, but cannot be renamed or deleted and does not count toward the regular archive limit.
- Every node remembers its associated archive independently. Editing grid content or node size keeps that association and prefixes its name with
*, for example* Common; every option reserves the same marker width. Switching archives asks before discarding changes. - A legacy workflow without an archive association first tries an exact match using columns and the ordered switches, titles, colors, and prompts. If no match exists, it associates with
* Default Archive. Deleting an associated archive preserves node content and falls back in the same way. - ComfyUI stores the last globally selected archive per user, and a new node automatically loads it. Existing nodes do not change association when another node or browser tab switches archives.
- Archive names are trimmed, must contain 1–80 characters, and are unique without regard to case. Creating a duplicate name asks whether to overwrite the existing archive.
- The default archive is fixed at the top and cannot be dragged. Regular archives preserve insertion order; new or newly imported archives are appended. Drag handles persist a new order that is also used by the toolbar selector.
- One regular archive may be saved, renamed, exported, or deleted. Multiple archives may be exported or deleted together. The default archive may be part of an export selection, but any selection containing it disables deletion.
- Updating or renaming an archive keeps its list position. Import overwrite also preserves position; imported additions retain their order and are appended.
- Saving over an archive and deleting archives require confirmation.
- Nodes on the same page synchronize archive changes immediately. Other tabs use
BroadcastChannel, and focusing the selector also refreshes the list.
Storage and compatibility
Archives are stored under the current ComfyUI user's data directory at ComfyUI-Prompt-Weaver/prompt-grid-archives.json, so they can be shared across workflows and browser sessions while remaining isolated between ComfyUI users. Older files are upgraded with the default archive, a 600×420 default node size, and the global selection. Writes use a temporary file and atomic replacement; corrupt files return an error and are never silently replaced.
The limits are 100 regular archives, 500 cards per archive, and bounded snapshot, import, and total file sizes. One archive, the selected archives, or all archives can be exported in the same portable JSON format; batch export retains list order.
Batch deletion uses one confirmation and one atomic write, and an invalid target cancels the entire operation. Import preview shows archive and card counts and supports Skip, Overwrite Local Archives, or Automatically Rename for name conflicts. The server validates the whole batch before writing anything.
Archive snapshots are not written into the execution config. Workflow node properties store only the associated archive ID, leaving Queue Prompt, the Python node contract, and desktop C++ parsing unchanged.
ComfyUI must remain running while archive operations are used. Restart ComfyUI after upgrading because the plugin registers Python routes.
Combination rules
The node processes enabled cards in order:
- Trim surrounding whitespace from the prompt.
- Remove consecutive leading and trailing ASCII commas
,, then trim once more. - Skip the prompt if it is empty after cleanup.
- Join the remaining values with an ASCII comma and space:
,.
Internal commas, line breaks, and full-width commas remain unchanged. The result is an empty string when every card is disabled or empty.
Configuration and API workflows
The grid stores a versioned JSON string in its single config widget:
{
"version": 1,
"columns": 2,
"items": [
{
"id": "prompt-1",
"enabled": true,
"title": "Quality",
"prompt": "masterpiece, best quality"
}
]
}
In an API-format prompt, inputs.config must be a JSON-encoded string, not a nested object:
{
"1": {
"class_type": "PromptWeaverPromptToggleGrid",
"inputs": {
"config": "{\"version\":1,\"columns\":2,\"items\":[{\"id\":\"prompt-1\",\"enabled\":true,\"title\":\"Quality\",\"prompt\":\"masterpiece, best quality\"}]}"
}
}
}
A non-empty configuration with invalid JSON, an invalid root, invalid version/items/enabled/prompt/retain_unselected/prompt_tokens types, or an unsupported version prevents Python execution. The frontend additionally validates card IDs, titles, colors, optional favorite_id UUIDs, optional random_favorite_category references, and retained-token entries. A corrupt value is preserved and the node displays Reset to Default. An invalid column count affects layout only and is restored to two columns.
Persistence and compatibility
- Grid state is saved with the workflow and supports reopening, copy, and paste on the normal canvas.
promptalways contains only the active text used for node output. Optionalretain_unselectedandprompt_tokensfields preserve editor state in workflows and archives; inactive tokens are validated but never appended to Python output.- Optional
favorite_idlinks a workflow card to a user-library snapshot. It participates in workflow/archive persistence and dirty-state fingerprints but is ignored by Python execution; a missing library record never changes the saved prompt. - Optional
random_favorite_categorystores a category UUID and itsprimaryorsecondarylevel in the workflow and archives. Browser queueing replaces it in that run's submitted copies with one fixed favorite; Python execution uses the saved Prompt as a fallback when no browser performs the draw. - The desktop parser can recover the actual enabled prompts from either an API Prompt or UI-only Workflow embedded in image metadata.
- Images already indexed with an empty parse result are not automatically rescanned. Use Reparse this image in the desktop application to bypass the old metadata cache.
- Version 1 supports normal canvas nodes. Promoted subgraph parameters, App Mode, archive folders/tags/search, cloud sync, timed autosave, configurable separators, prefixes/suffixes, and card weights are outside the current compatibility contract.
Validated baseline: ComfyUI 0.31.1, frontend 1.48.7, Python 3.13.11.
Workflow-opening bridge
An open ComfyUI frontend registers through a heartbeat. When the desktop application sends /prompt-weaver/open-workflow, the plugin delivers the graph to the most recently active page. UI workflows use app.loadGraphData(), while prompt-only API graphs use ComfyUI's native app.loadApiJson(). It opens a new browser page only when no active frontend is available.
Development and testing
Runtime dependencies are limited to Python, aiohttp, and the frontend environment bundled with ComfyUI. The regression suite runs without installing additional Python or JavaScript packages:
python -m unittest discover -s tests -p "test_*.py" -v
node --test tests/*.mjs
Tests cover node configuration parsing, registration and routes, archive storage and ordering, the two-level prompt-card library, prompt-grid interaction, random-category selection and fixed queue snapshots, favorite insertion and deduplication, the prompt editor, dual-source autocomplete, dictionary validation and fallback, official locale resources, English UI fallback, and legacy data compatibility.
Optional real DOM variable tests: run python tests/workflow_variables_browser_server.py and open the regression page. It uses isolated workflow fixtures, not a running ComfyUI instance.
The same isolated server also hosts random favorite UI tests, including category-menu hit targets, queue snapshots, and the exit animation.
License
Released under the MIT License.





