Nodes/ComfyUI_Eclipse/Danbooru Corpus Maintenance
ComfyUI Node

Danbooru Corpus Maintenance

Refresh your Danbooru corpus from the live site and prep the LLM categorization pass

By r-vage·Created 10 months ago·Updated about 23 hours ago· 32
Danbooru Corpus Maintenance
    • categorization_system_prompt
    • categorization_prompt
    • review_system_prompt
    • batch_token
    • report
    actionsrefresh_ratings,prepare_ai,resume
    ratingsgeneral,sensitive,questionable,explicit
    post_start_page1
    post_stop_page-1
    target_per_rating100000
    score_range_modeautomatic
    custom_score_min0
    custom_score_max5000
    minimum_tag_post_count100
    tag_start_page1
    tag_stop_page-1
    maximum_tag_pages_per_queue100
    ai_batch_size100
    maximum_ai_batches1
    excluded_post_tags

    If Danbooru Prompt Forge is the front of Eclipse's Danbooru workflow, this is the maintenance bay behind it. Corpus Maintenance does two jobs: it pulls new posts from the live Danbooru API to keep the rating corpora fresh, and it prepares the two-pass LLM categorization batches that assign general tags to categories - or exports a provider-neutral manual work package instead. It's the node you queue periodically, not the one you wire into every generation.

    Understand the context first. Prompt Forge reads offline taglist files; those files ship pre-built (four rating corpora, 100k posts each, plus a ~132k-tag categorized index, extracted at first startup). Maintenance is how you grow and curate that corpus yourself. That part needs a Danbooru account and API key, set under Eclipse → General → Danbooru Maintenance. No credentials are needed if you're happy with the shipped corpus or want to drop in your own lists from rainlizard/ComfyUI-Raffle - the node only requires them for online scraping.

    How it works

    The core is a resumable scraper with checkpoints. It walks /posts.json pages in score bands - the default automatic mode samples the 1024–5000 band first, then halves downward (512–1024, 256–512, …) until it finds unseen posts. Every response is committed before the next request, deduplicated by post ID, and appended to the matching rating file, up to target_per_rating (capped at 100,000). Then it enriches from the /tags.json catalog, publishes authoritative artist/character/copyright/meta tags directly, and funnels only uncategorized general tags into an ordered backlog for LLM categorization. A global 3,000-request safety cap per run keeps you from hammering the API.

    The actions chip bar selects the phases: refresh_ratings, optional catalog-only refresh_catalog, mutually exclusive prepare_ai or manual_categorization, and resume. On an imported corpus you can run catalog enrichment alone by turning off refresh_ratings.

    Inputs worth knowing

    • actions / ratings - the combo-chip bars at the top. Everything on this node runs from those.
    • target_per_rating - how many unique posts to retain per rating. Existing larger corpora are never truncated.
    • score_range_mode - automatic (adaptive bands) or custom (one fixed custom_score_min/custom_score_max range).
    • excluded_post_tags - deny any newly returned post containing an exact listed tag. Whole-tag matching only: excluding rape does not exclude grape.
    • ai_batch_size / maximum_ai_batches - tags per SmartLLM request (default 100) and how many batches to prepare per queue.

    The AI categorization path

    When prepare_ai is selected, the node emits the four outputs that drive a two-pass LLM pipeline: categorization_system_prompt and categorization_prompt feed Smart LM Loader #1, whose output feeds Loader #2's user_prompt; review_system_prompt feeds Loader #2's system_prompt; and batch_token goes to Danbooru Category Apply. That requires the separate ComfyUI SmartLLM pack. The author's tested recipe: a Qwen 3.x instruct model in the 8B/9B class or larger (Qwen 3.8 27B is the strongest tested; Qwen 3.5 9B is the smallest that's exact-preserving), greedy decoding (do_sample=false, num_beams=1), text-only, no Multi-Task. The pack docs name specific models that failed this job - Ministral 3, abliterated Gemma 3 4B, Qwen 2.5 VL 3B - so trial anything else at ai_batch_size 50 or lower first.

    No local LLM, no SmartLLM? Pick manual_categorization instead and the node writes a complete, provider-neutral export under prompts/tag_lists/manual_categorization/export-<hash>/ - prompts, rules, numbered inputs - that a remote chat model or agent can process. Eclipse only prepares that package; consuming the results is on you.

    Install and gotchas

    Same pack as Prompt Forge: ComfyUI Manager → search "Eclipse", or git clone https://github.com/r-vage/ComfyUI_Eclipse custom_nodes/ComfyUI_Eclipse and restart. The maintenance half additionally wants ComfyUI SmartLLM installed.

    Real-world traps:

    • Resume is your friend. Checkpoints are per-rating, per-score-band, saved after every response. Turning resume off rewinds to page 1, and rewinding only works when the complete checkpoint prefix exists. A network failure that kills a run never loses earlier committed pages.
    • Credentials go in Eclipse's private config.json, never into workflow JSON or manifests. Clearing the login or API key removes the stored value.
    • Batch manifests expire after seven days. Prepared AI batches older than that get rejected by Category Apply; just re-queue to prepare fresh ones.
    • Batch files get two-generation backups under prompts/tag_lists/.backups/ - if a commit hiccups, your corpus isn't silently corrupted.
    • For a true fresh start, delete the whole prompts/tag_lists/ directory; Maintenance restores the contracts and empty rating files, and collection restarts from zero.

    It's a fiddly node with a lot of knobs, but once it's running it's genuinely set-and-forget: it commits as it goes, respects the API, and picks up where it left off.

    Category🌒 Eclipse/ Danbooru

    Inputs (15)

    NameTypeDefaultDescription
    actionsSTRINGrefresh_ratings,prepare_ai,resumeMaintenance phases selected by Eclipse's combined maintenance and rating combo-chip bar.
    ratingsSTRINGgeneral,sensitive,questionable,explicitRating corpora selected by Eclipse's combined maintenance and rating combo-chip bar.
    post_start_pageINT11–1000000000First logical request for every selected rating. Resume uses each rating's saved score band and request checkpoint; disable resume to rewind only when the preceding checkpoint exists.
    post_stop_pageINT-1-1–1000000000Last logical post page to scan for each rating, inclusive. Use -1 to continue until the rating target, score range end, or the post-phase request window reserved ahead of catalog enrichment.
    target_per_ratingINT1000001–100000Maximum number of unique posts retained for each selected rating. Existing larger imported corpora are not truncated.
    score_range_modeCOMBOautomaticAutomatic samples scores 1024 through 5000 first, then halves downward whenever a sample finds no unseen posts. Custom samples one fixed inclusive range. Each request uses the selected rating pool with the fewest retained posts.
    custom_score_minINT0-1000000000–5000Inclusive minimum Danbooru post score used in custom mode.
    custom_score_maxINT5000-1000000000–5000Inclusive maximum Danbooru post score used in custom mode.
    minimum_tag_post_countINT1000–1000000000Before SmartLLM, inspect catalog tags with more posts than this value and keep only tags present in the rating pools.
    tag_start_pageINT11–1000First catalog-enrichment page. Resume restores the saved page; disabling it permits a checkpointed rewind.
    tag_stop_pageINT-1-1–1000Inclusive catalog stop page, or -1 for exhaustion.
    maximum_tag_pages_per_queueINT1001–1000Catalog-page request budget reserved after post collection and before SmartLLM preparation.
    ai_batch_sizeINT1001–500General tags placed in each SmartLLM request or numbered manual-categorization input file.
    maximum_ai_batchesINT11–32Maximum mapped SmartLLM batches prepared per queue. Ignored and hidden for manual categorization exports.
    excluded_post_tagsSTRINGDeny newly returned posts containing any exact tag listed here, separated by commas or new lines. Adjacent separators, blank entries, and duplicate entries are ignored; at most 1000 tags of 255 characters each are allowed.

    Outputs (5)

    NameTypeDescription
    categorization_system_promptSTRINGConnect to Smart LM Loader #1 system_prompt.
    categorization_promptSTRINGConnect to Smart LM Loader #1 user_prompt.
    review_system_promptSTRINGConnect to Smart LM Loader #2 system_prompt.
    batch_tokenSTRINGConnect to Danbooru Category Apply batch_token.
    reportSTRINGRefresh and pending-work report.