lexical-recall-guard
Skill1 starsChanged 13 months agoApache-2.0View on GitHub
PROACTIVELY detect when user requests require high lexical recall precision (exact quotes, specific chapter titles, verbatim text, exhaustive lists) and warn that LLM limitations may cause hallucinations. Check if source material is available in context before warning. Provide alternative mitigation strategies (WebSearch, requesting sources, reading files).
In this repository23 other files it gives its agents.
- app-runnerSkill
- delegateSkill
- env-managerSkill
- narrative-inventorySkill
- narrative-keywordsSkill
- narrative-mapsSkill
- obsidian-apiSkill
- obsidianSkill
- project-indexerSkill
- skill-api-conversionSkill
- skill-creatorSkill
- skill-distillSkill
- slipbox-integrationSkill
- story-structure-22-step-apiSkill
- story-structure-22-step-distilledSkill
- story-structure-22-stepSkill
- story-structure-7-stepsSkill
- story-structure-crime-distilledSkill
- story-structure-crimeSkill
- story-structure-myth-distilledSkill
- story-structure-mythSkill
- symbol-webSkill
- webapp-testingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 12 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 74
Keyword detection: Check for trigger phrases from references/trigger-patterns.md
- Distinctive: line 75
Context clues: Look for words like "exact," "verbatim," "specific," "all," "list every"
- Distinctive: line 91
No files uploaded or read
- Distinctive: line 100
When source is unavailable and lexical precision is required, provide a clear warning:
- Distinctive: line 125
Use WebSearch to find the actual source
- Distinctive: line 126
Ask user to provide/upload the source document
- Distinctive: line 131
Ask user to share the document
- Distinctive: line 153
Use Read tool to access exact text
- Distinctive: line 210
Context-aware: Don't warn if source material is available
- Distinctive: line 211
Actionable: Always provide concrete mitigation strategies
- Distinctive: line 269
Offer solutions: Never just warn—always provide actionable alternatives
- Distinctive: line 270
Check thoroughly: Always verify source availability before warning
- Distinctive: line 272
Acknowledge uncertainty: If proceeding despite limitations, mark information as uncertain
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lexical Recall Guard
Purpose
This skill addresses a fundamental limitation of LLMs: the tendency to hallucinate when tasks depend heavily on precise lexical recall rather than semantic understanding. LLMs excel at semantic reasoning but struggle with verbatim recall because they reconstruct plausible text from patterns rather than retrieving exact information from a database.
Core function: Proactively detect user requests that require high lexical precision and either warn about hallucination risk or provide mitigation strategies before responding.
When to Invoke This Skill
AUTOMATICALLY and PROACTIVELY invoke when detecting these patterns:
High-Risk Lexical Recall Indicators
Exact/verbatim content requests:
- "exact quote from..."
- "verbatim text of..."
- "word-for-word..."
- "quote exactly..."
- "what does [source] say exactly..."
- "the precise wording of..."
Structural/organizational requests:
- "list all chapter titles in..."
- "what chapters are in..."
- "table of contents for..."
- "section headings in..."
- "all episodes of [series]..."
Exhaustive enumeration:
- "list all 50..."
- "name every..."
- "all [items] in [category]..."
- "complete list of..."
- "enumerate all..."
Specific attributions:
- "what does [author] say in chapter [X]..."
- "the opening lines of [work]..."
- "the lyrics to [song]..."
- "[Person]'s exact words about..."
DO NOT Trigger (Semantic/Conceptual Questions)
General understanding:
- "what themes appear in..."
- "explain the main argument..."
- "summarize..."
- "what is the significance of..."
Reasoning and analysis:
- "why did [person] do..."
- "how does [concept] work..."
- "compare [X] and [Y]..."
- "what are the implications of..."
Approximations accepted:
- "around how many..."
- "roughly what does..."
- "generally speaking..."
- "the gist of..."
Core Detection Process
Step 1: Analyze the User Request
Parse the user message for lexical recall indicators:
- Keyword detection: Check for trigger phrases from references/trigger-patterns.md
- Context clues: Look for words like "exact," "verbatim," "specific," "all," "list every"
- Source specificity: Requests about specific chapters, verses, lines, sections
- Enumeration language: "List all," "name every," "complete list"
Step 2: Check Source Availability
CRITICAL: Before warning, verify whether source material is available in context.
Source material IS available when:
- User has uploaded files containing the source
- User has pasted relevant text in the conversation
- Files have been read using the Read tool that contain the source
- Source is in project directory and accessible
Source material is NOT available when:
- Request references external works not in context
- No files uploaded or read
- Asking about general knowledge sources
If source IS available: Proceed with high confidence using lexical recall from the available material. No warning needed.
If source is NOT available: Proceed to warning and mitigation.
Step 3: Provide Contextual Warning
When source is unavailable and lexical precision is required, provide a clear warning:
Warning structure (use template from assets/warning-template.md):
⚠️ Lexical Recall Limitation Detected
Your request requires high precision for [exact quotes/chapter titles/verbatim text/etc.],
but I cannot reliably provide this without access to the source material.
**Why:** LLMs reconstruct text from patterns rather than retrieving exact information.
This means I may generate plausible-sounding but incorrect details when precise lexical
accuracy is required.
**Risk:** [Specific risk for this request type]
**Recommended alternatives:**
[Provide 2-3 specific mitigation strategies from references/mitigation-strategies.md]Step 4: Offer Mitigation Strategies
Based on the request type, suggest appropriate alternatives from references/mitigation-strategies.md:
For quote/text requests:
- Use WebSearch to find the actual source
- Ask user to provide/upload the source document
- Offer to analyze if user shares the text
For structural info (chapters, sections):
- WebSearch for table of contents
- Ask user to share the document
- Provide general structural knowledge with uncertainty caveat
For exhaustive lists:
- WebSearch for authoritative lists
- Provide partial list with explicit uncertainty
- Suggest verification from primary sources
For attributions:
- WebSearch for verified quotes
- Offer paraphrased meaning with uncertainty
- Request source material from user
Step 5: Proceed with Appropriate Confidence
If warning was given:
- Offer to proceed with best effort if user acknowledges limitations
- Clearly mark any provided information as uncertain
- Emphasize verification is needed
If source was available:
- Proceed with high confidence
- Use Read tool to access exact text
- Quote directly from available material
Integration Patterns
Pattern 1: Proactive Detection (Preferred)
Like env-manager, trigger automatically without waiting for failure:
User: "What's the exact quote from chapter 5 of To Kill a Mockingbird?"
[Lexical-recall-guard triggers]
→ Analyze: "exact quote" + "chapter 5" = high lexical precision needed
→ Check context: No source file available
→ Warn: Cannot provide reliable exact quotes without source
→ Suggest: WebSearch, ask user to share relevant passagePattern 2: Source-Available Bypass
User: "What's the exact quote from page 23?"
[User has uploaded the PDF]
[Lexical-recall-guard triggers]
→ Analyze: "exact quote" = high lexical precision needed
→ Check context: PDF available in context
→ Bypass warning: Proceed with Read tool to get exact text
→ Respond: [Exact quote from page 23]Pattern 3: Semantic Request Bypass
User: "What are the main themes in To Kill a Mockingbird?"
[Lexical-recall-guard evaluates]
→ Analyze: "main themes" = semantic understanding, not lexical precision
→ No trigger: This is within LLM capabilities
→ Proceed normally: Answer based on semantic knowledgeBundled Resources
references/trigger-patterns.md
Comprehensive list of phrases and patterns indicating lexical recall requests, with examples of edge cases and context-dependent triggers.
references/mitigation-strategies.md
Detailed alternative approaches organized by request type: quotes, structural info, lists, attributions, technical specs.
assets/warning-template.md
Template for consistent, clear warning messages that explain the limitation, specific risk, and actionable alternatives.
Key Principles
- Proactive over reactive: Detect and warn BEFORE hallucinating
- Context-aware: Don't warn if source material is available
- Actionable: Always provide concrete mitigation strategies
- Honest: Clearly explain the LLM limitation
- Helpful: Still offer to proceed with appropriate caveats if user wants
What This Skill Does NOT Do
- Block all responses about books, documents, or historical texts
- Prevent semantic discussion and analysis
- Replace WebSearch or file reading capabilities
- Guarantee 100% accuracy even when source is available (reading errors can occur)
- Apply to mathematical proofs or logical reasoning (different type of precision)
Examples
Example 1: Quote Request Without Source
User: "What's the exact opening line of Pride and Prejudice?"
Skill triggers:
- Detected: "exact opening line" = high lexical precision
- Source check: No text available
- Action: Warn + suggest WebSearch or acknowledge uncertainty
- Outcome: User gets honest assessment before potential hallucination
Example 2: Quote Request With Source
User: "What's the exact quote on page 5?" [PDF uploaded]
Skill triggers:
- Detected: "exact quote" = high lexical precision
- Source check: PDF available in context
- Action: Use Read tool, extract exact text
- Outcome: Accurate quote provided without warning
Example 3: Semantic Question (No Trigger)
User: "What are the major themes in Pride and Prejudice?"
Skill evaluates:
- Detected: "themes" = semantic understanding
- Assessment: Within LLM capabilities
- Action: No trigger, proceed normally
- Outcome: Thoughtful thematic analysis provided
Example 4: Chapter Listing
User: "List all the chapter titles in On Writing Well"
Skill triggers:
- Detected: "list all chapter titles" = structural/enumeration request
- Source check: No book available
- Action: Warn + suggest WebSearch or partial list with uncertainty
- Outcome: User understands limitations, can choose to verify elsewhere
Best Practices
- Trigger early: Detect patterns in initial request before generating response
- Be specific: Tailor warning to the exact type of lexical precision needed
- Offer solutions: Never just warn—always provide actionable alternatives
- Check thoroughly: Always verify source availability before warning
- Stay helpful: Make it easy for user to get accurate information through alternatives
- Acknowledge uncertainty: If proceeding despite limitations, mark information as uncertain
This skill implements proactive hallucination prevention by detecting when user requests exceed LLM lexical recall capabilities and providing transparent warnings with actionable mitigation strategies.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

