Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
# Topic search
./librarian.sh "What is debt?""topic""finance" 5
# Book search
./librarian.sh "hexagram 23""book""I Ching of the Cosmic Way.epub" 5
Wrapper Exit Codes
The wrapper returns structured status via exit codes:
0: Success (JSON results on stdout)
1: ERROR_NO_METADATA (🤚 stop: tell user to run librarian index)
2: ERROR_BROKEN (🤚 stop: system issue, report to Nicholas)
3: ERROR_NO_RESULTS (🤚 stop: query returned 0 results)
Handle Each Error
Exit 1 (NO_METADATA):
🤚 Your library isn't indexed yet.
Run this first:
librarian index
(This scans your books/ folder and creates search indexes)
Exit 2 (BROKEN):
🤚 Something's broken in the research engine.
I tried to search but got a system error. Nicholas needs to debug this.
(Check: Python dependencies, research.py syntax, FAISS indexes)
Exit 3 (NO_RESULTS):
🤚 No results found for "[QUERY]"
Try:
- Broader terms (e.g., "debt" instead of "sovereign debt crisis")
- Different scope (search topic instead of single book?)
- Check spelling
Node 4: 🎤 Format Output
When wrapper returns success (exit 0), format the JSON results for the user.
JSON Structure
{"results":[{"text":"Full chunk text...","book_title":"Debt: The First 5000 Years","similarity":0.89,"filename":"Debt - The First 5000 Years.epub","location":"p.45, ¶3","page":45,"paragraph":3,"filetype":"pdf"}],"metadata":{"query":"What is debt?","topic":"finance","returned":5}}
Formatting Rules
1. Synthesize answer (don't just list chunks)
Read all results
Extract key points
Write coherent paragraph(s)
2. Cite sources with emojis
📕 = book citation
Use location (page/paragraph) when available
Format: 📕 [Book Title, p.45, ¶3]
3. Show similarity scores (optional, if useful)
⭐⭐⭐⭐⭐ (0.9-1.0) = Highly relevant
⭐⭐⭐⭐ (0.8-0.89) = Very relevant
⭐⭐⭐ (0.7-0.79) = Relevant
4. Keep original query context
If user asked about debt, frame answer around debt
Don't drift to tangential topics
Example Output
User: "What does Graeber say about the origins of money?"
Librarian:
Graeber argues that money did NOT originate from barter (the myth Adam Smith popularized). Instead, credit and debt systems came first — people kept track of obligations long before coins existed. 📕 [Debt: The First 5000 Years, p.21, ¶2]
He traces debt back to ancient Mesopotamia (~3500 BCE), where temple administrators recorded loans in cuneiform tablets. Money as we know it (coins) only appeared around 600 BCE in Lydia. 📕 [Debt, p.40, ¶5]
Key insight: Debt is older than money. Markets emerged from moral obligations, not rational barter. 📕 [Debt, p.89, ¶1]
Sources:
📕 Debt: The First 5000 Years (David Graeber) - 3 passages
Similarity: ⭐⭐⭐⭐⭐
Hard Stops (🤚 Honest Failures)
NEVER invent answers. If system fails, STOP and tell user exactly what's wrong.
When to Stop
Metadata missing → Tell user to run librarian index
Low confidence (<75%) → Ask clarifying question
System broken → Report error, don't guess
No results → Say "no results", suggest alternatives
Why Hard Stops Matter
From VISION.md: "Honest incompetence > false competence"
A broken skill that TELLS you it's broken is more trustworthy than one that invents plausible-sounding nonsense.