Lore book
Lore book — comfyui_LLM_party
- user_prompt
If you've spent time in AI roleplay chat tools, "lorebook" is a term you already know - it's the same concept SillyTavern and similar tools popularized, sometimes called world info: a set of keyword-triggered facts that get pulled into the conversation only when they're actually relevant, instead of stuffing your entire backstory into every single prompt. comfyui_LLM_party's version does exactly that, as a graph node.
The node's own default example spells out the idea directly - it ships pre-loaded with a sample entry defining the concept itself: "Lorebook (also known as World Info or Memory Books) is a tool for enhancing AI's understanding of world details." That's the mechanism in one sentence. You give it a body of keyword:definition pairs, one per line. When the user's prompt contains one of those keywords, this node appends the matching definition onto the prompt before it heads to the LLM. Mention a keyword that isn't in your book, and nothing gets added - the LLM never sees definitions it didn't need for that particular turn. This is genuinely a smarter approach than just cramming a giant reference doc into your system prompt on every single call: it keeps the context window lean and only pays the token cost for facts that are actually relevant to what's being asked right now.
Inputs that matter. user_prompt is the incoming message - a required multiline STRING, the text this node scans for keyword hits. book_txt is your lorebook itself - also multiline, formatted as keyword:definition on each line, the way the node's own default value demonstrates with entries for "lorebook" and "LLM party." Build this out with whatever facts, character details, or world info your agent needs to recall conditionally. There's only one output, user_prompt - the original message with any matched definitions appended - and it wires straight into your LLM node's user-prompt input, replacing the raw prompt you'd otherwise send directly.
Where this earns its place over just writing a longer system prompt: a lorebook scales. Twenty facts in a system prompt means twenty facts' worth of tokens on every single call, whether they're relevant or not. Twenty facts in a lorebook means you only pay for the ones the current message actually triggers - which matters a lot once your world info grows past a handful of entries, or once you're running enough calls that the extra tokens start showing up on a bill.
Installing it. Lore book ships with the full comfyui_LLM_party pack - no separate install. Get it through ComfyUI Manager (search "comfyui_LLM_party") or cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, then pip install -r requirements.txt from inside the project folder using your ComfyUI Python environment, and restart. It's pure text processing - no API key, no model file, no external service - so it's one of the lower-friction nodes in this pack to get running.
Troubleshooting. If definitions aren't getting injected when you expect them, the almost-always cause is a keyword mismatch - this is literal keyword matching, not semantic understanding, so check that the exact word or phrase in book_txt actually appears in user_prompt, including case and any punctuation attached to it. If you're seeing definitions injected when you didn't expect them, the reverse is true: a keyword you picked is more common than you meant it to be, and it's firing on unrelated mentions - pick a more specific keyword or phrase. Beyond that, if the whole pack fails to load rather than just this node behaving oddly, that's this project's large bundled requirements.txt hitting a conflict elsewhere, not anything specific to this node.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| user_prompt | STRING | 什么是lorebook? | — |
| book_txt | STRING | lorebook:Lorebook(也称为世界信息或Memory Books)是一种工具,用于增强AI对世界细节的理解。 LLM party:ComfyUI LLM Party 是一个基于 ComfyUI 的工具集,旨在帮助用户快速构建和集成大语言模型(LLM)工作流。 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| user_prompt | STRING | — |