-
Notifications
You must be signed in to change notification settings - Fork 8
Entry Matching and Behavior
Per-entry frontmatter fields and global settings that control when and how entries trigger. These features refine the basic keyword matching described in Pipeline. They give you fine-grained control over which entries activate under which conditions.
For the full frontmatter reference, see Writing Vault Entries.
When enabled, DLE supplements exact keyword matching with BM25-scored fuzzy search. This catches entries that are textually relevant to the conversation even when no exact keyword match occurs.
How it works:
- During index building, DLE constructs a BM25 index from every entry's title, keys, and content.
- During matching, the scan text (recent chat messages) is tokenized and scored against the index.
- Entries scoring above the minimum threshold (default 0.5) are added to the match set alongside keyword matches.
- Up to 20 fuzzy results are returned per generation, sorted by score.
BM25 (Best Matching 25) is a term-frequency / inverse-document-frequency algorithm. It scores documents higher when they share many terms with the query, weighted by how rare those terms are across the whole vault. Common words contribute little; distinctive terms contribute a lot.
What it catches that keywords miss:
- Entries where the conversation uses synonyms or related terms instead of exact keywords
- Entries with long, descriptive content that overlaps thematically with the chat
- Entries where you forgot to add a keyword that the chat is using
Setup: check "Enable Fuzzy Search" in Settings Reference.
Notes:
- Fuzzy matches appear in the pipeline inspector and Context Cartographer with the label
(fuzzy, score: N.N). - Fuzzy results respect cooldown, probability, warmup, and other per-entry behavior settings.
- The BM25 index is rebuilt every time the vault index refreshes.
- Works alongside keyword matching: it adds to the match set, never removes from it.
- In two-stage mode, fuzzy matches are included in the candidate manifest sent to the AI.
When enabled (off by default), entries with more keyword occurrences in the scan text are weighted higher during matching. This separates entries mentioned once in passing from entries whose keywords appear repeatedly in the recent conversation.
Use case: prioritize entries whose keywords dominate the recent conversation. If "magic" appears 5 times in the last 4 messages, a magic-related entry is weighted higher than one where "magic" appears once.
Notes:
- Experimental setting. Test with your vault to see if it helps or hurts selection quality.
- Only affects keyword matching, not AI search.
- Enable in Settings Reference under Show Advanced.
Per-entry cooldown: N in frontmatter. After an entry triggers, it's skipped for the next N generations before becoming eligible again.
Use case: prevent the same lore from re-injecting every single generation. Useful for flavor text or background entries that don't need constant repetition.
Example:
cooldown: 3 # After triggering, skip for 3 generationsNotes:
- Cooldown is tracked per-chat (resets on chat change or page refresh).
- Constants (
#lorebook-always) are exempt from cooldown.
Per-entry warmup: N in frontmatter. An entry's keywords must appear N or more times in the scan text before it triggers. The check runs every generation, not just the first time.
Use case: prevent entries from triggering on a single casual mention. Make sure a topic is being discussed in depth before injecting detailed lore.
Example:
warmup: 3 # Keyword must appear 3+ times in scan text each generationNotes:
- The warmup threshold is checked every generation. The keyword must meet the hit count each time, not just the first time.
- Count is based on occurrences in the scan text, not unique messages.
Global setting (not per-entry). Skips re-injecting an entry for N generations after it was last injected. Saves context by avoiding redundant lore repetition.
Setup: set "Re-injection Cooldown" in Settings Reference (0 = disabled).
Notes:
- Constants (
#lorebook-always) are exempt. - Tracked per-chat (resets on chat change).
- Distinct from per-entry cooldown: re-injection cooldown is a global post-selection filter; per-entry cooldown is checked during keyword matching.
Global setting that prevents the same entries from being injected in consecutive generations. When enabled, entries injected within the last N generations (configurable lookback depth) are skipped.
Setup:
- Check "Strip Duplicate Injections" in Settings Reference.
- Set the "Lookback Depth" (default 2: checks last 2 generations).
Notes:
- Constants (
#lorebook-always) are exempt and always inject. - Injection history is tracked per-chat in
chat_metadata.deeplore_injection_log. - The dedup key is
title|position|depth|role|contentHash, so the same entry at a different depth or role isn't considered a duplicate. - Distinct from re-injection cooldown: deduplication checks a sliding window of recent generations; re-injection cooldown counts generations since last injection.
Tracks how many generations have passed since each entry was last injected. Stale entries (not seen recently) get a boost in the AI manifest; frequently injected entries get a penalty. This rotates lore without manual intervention.
Setup:
- Enable "Entry Decay" in Settings Reference.
- Set the Boost Threshold (default 5): generations without injection before the freshness boost.
- Set the Penalty Threshold (default 2): consecutive injections before the frequency penalty.
Notes:
- Decay tracking is per-chat (resets on chat change or page refresh).
- Only affects the AI search manifest (adds decay hints for the AI to consider).
- Constants are exempt from decay penalties.
Entries can declare dependencies on other entries using requires and excludes frontmatter fields.
Every listed entry title must be in the matched set for this entry to activate.
requires:
- Eris
- Dark CouncilThis entry only injects when both "Eris" and "Dark Council" are also matched.
If any listed entry title is in the matched set, this entry is blocked.
excludes:
- Draft NotesThis entry is blocked if "Draft Notes" is matched.
Important
Constants, seeds, bootstraps, and pinned entries override all gating. They are never removed by requires/excludes rules. They do remain in the active set, so other entries' excludes rules still see them. If you exclude a constant, your entry will be blocked because the constant is always there. This is intentional: force-injected entries represent ground truth that the rest of your lore should respect.
Gating resolves iteratively. If Entry A requires Entry B, and Entry B is removed by its own gating rules, Entry A is also removed. This cascading repeats until no more entries are affected (max 10 passes).
See Writing Vault Entries for a complete template.
Per-entry refine_keys in frontmatter. Adds a secondary AND filter on top of primary keyword matching. When set, at least one refine key must also appear in the scan text for the entry to trigger.
Use case: reduce false positives for entries with common primary keywords. A character named "Rose" might have refine_keys requiring mention of their faction or role to avoid triggering on every use of the word "rose".
Example:
keys:
- Rose
- Rose Blackwood
refine_keys:
- guild
- spymaster
- intelligenceSee Writing Vault Entries for a complete template.
Per-entry cascade_links in frontmatter. When an entry matches, all entries listed in its cascade_links are pulled in without keyword matching. Cascade-linked entries respect cooldown and probability gates, but not warmup.
Use case: ensure related entries always travel together. Wikilink recursion requires keyword matches; cascade links bypass keyword matching.
Example:
cascade_links: ["Soulbrand Removal", "Ironveil Guild"]When this entry matches, "Soulbrand Removal" and "Ironveil Guild" are included.
See Writing Vault Entries for a complete template.
When enabled, automatically matches the active character's vault entry by name or keyword, even if the character isn't mentioned in recent chat messages.
Use case: keep the lore for your current roleplay character available without relying on their name appearing in the most recent messages.
Setup: check "Active Character Boost" in Settings Reference.
On a brand-new chat (below the New Chat Threshold, default 3 messages), two features help bootstrap the conversation.
- Entry content is sent to the AI as additional story context alongside the chat.
- Helps the AI understand your setting and make better entry selections from minimal context.
- Not injected into the writing AI's context. Only informs AI search.
- When seed mode is active, AI search is instructed to fill to maxEntries selections (more aggressive).
- Force-injected like constants when the chat is short.
- Once chat grows past the threshold, they revert to regular entries managed by normal selection.
- Good for writing instructions or foundational lore needed at the start.
An entry can have both tags: its content feeds the AI (seed) and it force-injects (bootstrap).
DeepLore Wiki
Getting started
Features
Reference
Help