/librarian
Orchestrate high-level knowledge workflows using Librarian MCP tools.
Prerequisites
Librarian MCP server must be configured and running. Verify by checking that library_stats responds. If it fails, tell the user to run librarian-mcp --setup /path/to/vault and restart Codex.
Commands
/librarian ingest [path] Ingest a solution doc into the vault
/librarian import <file> Convert local document (PDF, DOCX, image) to vault markdown
/librarian from gmail <query> Import Gmail threads matching a search into the vault
/librarian from web <url> Import any web page into the vault as markdown
/librarian from twitter <url> Import an X/Twitter thread into the vault
/librarian from calendar [query] Import calendar events/meeting notes into the vault
/librarian from Codex [session] Extract learnings from a Codex session into the vault
/librarian search <query> Deep search vault for prior art
/librarian connect [path] Find and apply missing wikilinks
/librarian daily [text] Append a learning to today's daily note
/librarian graph [note] Explore vault structure or a note's neighborhood
/librarian analyze Full vault analysis: god nodes, communities, viz, report
/librarian daydream [focus] Discover non-obvious connections across vault notes
/librarian status Vault health overview
If no command is given, show the usage summary above.
ingest
Purpose: Import a docs/solutions/ file (or any local markdown) into the vault, gaining auto-wikilinks and knowledge graph integration. This is the bridge between per-project documentation (like ce:compound output) and the persistent vault.
Behavior
Locate the source file:
- If
[path] is provided, use it directly
- If no path, scan
docs/solutions/ for the most recently modified .md file
- If
docs/solutions/ doesn't exist or is empty, tell the user and stop
Read the source file using the Read tool (local filesystem)
Determine vault destination:
- Parse the source file's YAML frontmatter for
category (or infer from parent directory name)
- Map to vault path:
Solutions/<category>/<filename>.md
- Categories map directly:
build-errors/ -> Solutions/build-errors/, etc.
Write to vault using library_write with the file content
library_write auto-links mentions of existing vault notes as [[wikilinks]]
- Report what links were auto-added
Run library_suggest_links on the newly written file
- Report any additional link suggestions found
- If suggestions exist, ask user if they want to apply them (re-write with links)
Report:
Ingested: docs/solutions/build-errors/vite-hmr-timeout.md
-> Solutions/build-errors/vite-hmr-timeout.md
Auto-linked: [[Vite]], [[HMR]], [[SvelteKit]]
Suggestions: 2 additional links available
The solution is now searchable and connected to your knowledge graph.
Batch mode
If the user says /librarian ingest all or /librarian ingest docs/solutions/:
- Find all
.md files in docs/solutions/ recursively
- Ingest each one, reporting progress
- Summarize: total ingested, total links added, any failures
import
Purpose: Convert any non-markdown document into markdown and store it in the vault. Uses Microsoft's MarkItDown for conversion, then auto-wikilinks the content.
Supported formats
PDF, DOCX, XLSX, PPTX, images (OCR), audio (transcription), HTML, CSV, JSON, XML, ZIP — anything MarkItDown supports.
Prerequisites
MarkItDown must be installed: pip install markitdown
If the user hasn't installed it, tell them and stop. Don't try to work around it.
Behavior
Determine source and destination:
<file> is the local filesystem path to the document
- If the user provides a vault destination path, use it
- Otherwise, infer from the file:
Imports/<filename-stem>.md
Call library_import with:
source_path: the local file path
library_path: the vault destination
title: filename stem or user-provided title
Report:
Imported: quarterly-report.pdf
-> Imports/quarterly-report.md (12,847 bytes, 2,103 words)
Auto-linked: [[Q1 Revenue]], [[Product Roadmap]]
Batch mode
If the user provides a directory path:
- List all non-markdown files in the directory
- Confirm with the user before proceeding
- Import each file, reporting progress
- Summarize: total imported, total words, failures
from
Purpose: Import content from external connectors (Gmail, web, Twitter/X, Google Calendar) into the vault. Each connector extracts content, converts it to a structured markdown note with frontmatter, writes it via library_write for auto-wikilinks, and integrates it into the knowledge graph.
All from subcommands follow the same output pattern:
- YAML frontmatter with
source, imported, type, and tags
- Structured markdown body
- Key takeaways or summary section
- Written via
library_write for auto-wikilinks
from gmail
Purpose: Import Gmail threads into the vault as structured notes. Useful for preserving important email conversations, research threads, or decisions.
Connector: Codex.ai Gmail MCP (search_threads, get_thread)
Behavior:
Search for threads:
- Call
search_threads with the user's query (same syntax as Gmail search bar)
- Examples:
"from:editor@publisher.com", "subject:manuscript feedback", "has:attachment newer_than:7d"
- Display results (subject, from, date, snippet) and let user pick which to import
- If only one result, proceed directly
Extract full thread:
- Call
get_thread with messageFormat: "FULL_CONTENT" for each selected thread
- Extract: participants, dates, subject, full message bodies
Build the vault note:
---
title: "<subject line>"
participants: ["sender@email.com", "recipient@email.com"]
source: gmail
thread_id: "<thread_id>"
imported: YYYY-MM-DD
type: email
tags:
- source/gmail
- <topic tags inferred from content>
---
# <subject line>
**Participants:** sender, recipient | **Date range:** YYYY-MM-DD to YYYY-MM-DD
---
## Message 1 — From: sender@email.com (YYYY-MM-DD HH:MM)
<message body>
## Message 2 — From: recipient@email.com (YYYY-MM-DD HH:MM)
<message body>
---
## Key points
<3-5 bullet point summary of the thread's decisions, action items, or key information>
Vault path: Emails/<YYYY>/<slugified-subject>.md
Write via library_write, report auto-linked notes.
Report:
Imported: "Re: Manuscript feedback round 2" (5 messages)
-> Emails/2026/manuscript-feedback-round-2.md
Auto-linked: [[Publishing]], [[Draft Review]]
Key points: 3 action items extracted
from web
Purpose: Import any web page into the vault as clean markdown. Uses Exa or Tavily for extraction.
Connectors: Exa (web_fetch_exa) preferred, Tavily (tavily_extract) as fallback.
Behavior:
Extract the page:
- Try
web_fetch_exa with the URL first (returns clean markdown)
- If Exa fails or returns insufficient content, fall back to
tavily_extract with extract_depth: "advanced"
- If both fail, tell the user and stop
Build the vault note:
---
title: "<page title>"
url: "<source URL>"
author: "<author if detectable>"
imported: YYYY-MM-DD
type: article
tags:
- source/web
- <topic tags inferred from content>
---
# <page title>
**Source:** [<domain>](url) | **Imported:** YYYY-MM-DD
---
<cleaned markdown content>
---
## Key takeaways
<3-5 bullet point summary>
Vault path: Web/<YYYY>/<slugified-title>.md
Write via library_write, report auto-linked notes.
Batch mode: If given multiple URLs, process each sequentially.
from twitter
Purpose: Import an X/Twitter thread into the vault.
Connector: bird CLI via Bash (from agent-reach tooling).
Behavior:
Extract the thread:
- Run:
bird thread <url> via Bash
- If URL is a single tweet (not a thread), run:
bird read <url>
- If
bird fails, fall back: try tavily_extract on the URL, or ask user to paste text
Parse the output:
- Extract: author handle, date, individual tweets
- Identify the thread topic from the first tweet
Build the vault note:
---
title: "<thread topic summary>"
author: "@handle"
source: "<original URL>"
imported: YYYY-MM-DD
type: thread
tags:
- source/twitter
- <topic tags inferred from content>
---
# <thread topic summary>
**Author:** [@handle](<profile url>) | **Date:** YYYY-MM-DD | **[Original thread](url)**
---
<thread content, preserving tweet boundaries with --- separators>
---
## Key takeaways
<3-5 bullet point summary of the thread's main points>
Vault path: Threads/<YYYY>/<slugified-topic>.md
Write via library_write, report auto-linked notes.
Batch mode: If given multiple URLs, process each sequentially.
from calendar
Purpose: Import calendar events into the vault, useful for meeting notes, event context, or archiving.
Connector: Codex.ai Google Calendar MCP (gcal_list_events, gcal_get_event)
Behavior:
Find events:
- If
[query] is provided, use it as a search term via gcal_list_events with q parameter
- If no query, list today's events via
gcal_list_events with timeMin/timeMax set to today
- Display results and let user pick which to import
Get full event details:
- Call
gcal_get_event for each selected event
- Extract: title, date/time, attendees, description, location, attachments
Build the vault note:
---
title: "<event summary>"
date: YYYY-MM-DD
attendees: ["person1@email.com", "person2@email.com"]
source: google-calendar
event_id: "<event_id>"
imported: YYYY-MM-DD
type: meeting
tags:
- source/calendar
- <topic tags inferred from content>
---
# <event summary>
**Date:** YYYY-MM-DD HH:MM - HH:MM | **Location:** <location>
**Attendees:** person1, person2
---
## Event description
<description from the calendar event>
---
## Notes
<placeholder for user to fill in meeting notes>
Vault path: Meetings/<YYYY>/<YYYY-MM-DD>-<slugified-title>.md
Write via library_write, report auto-linked notes.
Batch mode: If importing a date range, ask user: /librarian from calendar --week imports all events from the current week.
from Codex
Purpose: Extract key learnings, decisions, and solutions from a Codex session transcript and archive them in the vault. Closes the knowledge loop — your conversations become searchable vault knowledge.
Data source: Local JSONL files at ~/.Codex/projects/<project>/<session-id>.jsonl
Behavior:
Find the session:
- If
[session] is a UUID, use it directly
- If
[session] is a project name or path fragment, find matching project directory under ~/.Codex/projects/
- If no argument, list the 10 most recent sessions across all projects with date, size, project, and first user message as topic hint. Let the user pick.
- To list sessions: use Bash to scan
~/.Codex/projects/*/ for .jsonl files, sort by mtime descending
Parse the JSONL transcript:
- Read the file using the Read tool (it's local plaintext)
- Each line is a JSON object with a
type field: user, assistant, system, file-history-snapshot, permission-mode, attachment
- Focus on
user and assistant messages:
user messages have message.content (string or array of {type: "text", text: "..."} blocks)
assistant messages have message.content as array of blocks: thinking, text, tool_use
- Extract only
text blocks from assistant messages (skip thinking and tool_use)
- Skip
system, file-history-snapshot, permission-mode, and attachment types
Synthesize the session into a vault note:
- Read through the conversation and extract:
- Topic: What was the session about? (infer from first user message and overall flow)
- Decisions made: Architecture choices, approach selections, trade-offs resolved
- Problems solved: Bugs fixed, issues resolved, with root causes
- Key artifacts: Files created/modified, commands established
- Open items: Things deferred, noted for future, or left incomplete
- Be selective — not every message is worth archiving. Focus on knowledge that compounds.
Build the vault note:
---
title: "<session topic summary>"
project: "<project path>"
session_id: "<uuid>"
date: YYYY-MM-DD
source: Codex
imported: YYYY-MM-DD
type: session
tags:
- source/Codex
- <project tag>
- <topic tags inferred from content>
---
# <session topic summary>
**Project:** <project path> | **Date:** YYYY-MM-DD | **Messages:** N
---
## Decisions
- <decision 1 — what was chosen and why>
- <decision 2>
## Solutions
### <problem 1 title>
**Problem:** <what was wrong>
**Root cause:** <why>
**Fix:** <what was done>
## Artifacts
- Created: `path/to/file.md`
- Modified: `src/main.rs` — added skill installation to --setup
## Open items
- <anything deferred or left for future sessions>
Vault path: Sessions/<YYYY>/<YYYY-MM-DD>-<slugified-topic>.md
Write via library_write, report auto-linked notes.
Report:
Imported session: "Librarian skill + MCP connector integration"
-> Sessions/2026/2026-04-11-librarian-skill-mcp-connectors.md
Auto-linked: [[librarian-mcp]], [[ce-compound]], [[Obsidian]]
Extracted: 4 decisions, 2 solutions, 1 open item
Tips for from Codex
- Current session: You can import the current session — just use the session ID from the JSONL filename. The transcript is written incrementally, so it includes everything up to now.
- Pairs with session-close: Run
/session-close to update project memory, then /librarian from Codex to archive the knowledge in the vault.
- Large sessions: For sessions with 100+ messages, focus extraction on the second half where solutions typically land. Skip early exploration/dead-ends unless they contain useful "what didn't work" context.
- Privacy: Session transcripts may contain API keys, passwords, or sensitive data that was read by tools. The synthesis step should never copy raw credentials — only extract the conceptual knowledge.
search
Purpose: Deep search across the vault for prior art on a topic. More than a raw search -- synthesizes results into actionable context.
Behavior
Call library_search with the query (limit: 10)
For the top 3-5 results, call library_read to get full content
Synthesize a brief summary:
- What the vault knows about this topic
- Which notes are most relevant (with paths)
- Key insights or solutions found
- Related tags discovered
Call library_traverse from the most relevant result (depth: 1) to find connected notes the search might have missed
Report:
Vault knowledge on "<query>":
Direct matches (N files):
- Solutions/build-errors/vite-hmr-timeout.md — HMR fix for Tauri apps
- Research/Deep Dives/vite-internals.md — Vite architecture notes
Key insights:
- [synthesized takeaways from the matched content]
Connected notes (via graph):
- [[SvelteKit]] (1 hop from vite-hmr-timeout)
Tags: #build, #vite, #frontend
connect
Purpose: Find unlinked mentions across the vault and optionally apply them. Strengthens the knowledge graph.
Behavior
If [path] is provided:
- Run
library_suggest_links on that specific file
- Show suggestions
- Ask user to confirm before applying
If no path (vault-wide scan):
- Call
library_stats to get orphan notes
- For each orphan (up to 10), run
library_suggest_links
- Report which orphans could be connected and how
- Ask user before applying any changes
Applying links:
- Read the file via
library_read
- Write it back via
library_write (which auto-links on write)
- Report the links that were added
daily
Purpose: Append a learning, note, or reflection to today's daily note.
Behavior
If [text] is provided:
- Call
library_daily with append: <text>
- Done
If no text:
- Summarize the current conversation's key outcomes (what was solved, what was learned, what decisions were made)
- Format as a bullet list under a
## Learnings section
- Call
library_daily with the formatted summary
- Show what was appended
Always report the daily note path (e.g., Journal/2026/2026-04-11.md)
graph
Purpose: Explore vault structure or a specific note's neighborhood in the knowledge graph.
Behavior
If [note] is provided:
Call library_traverse with start: <note>, depth: 2
Call library_links on the note for backlinks/outgoing detail
Render a text-based neighborhood map:
Topic Neighborhood: "Vite"
[[SvelteKit]] ---> [[Vite]] <--- [[HMR]]
|
v
[[Tauri Build]]
Backlinks (3): SvelteKit, HMR, Frontend Tooling
Outgoing (2): Tauri Build, ESBuild
2 hops: 8 notes reachable
If no note (vault-wide):
- Call
library_stats for overview
- Call
library_graph_analysis for structure
- Report: file count, word count, connected components, hub notes, bridge notes, orphan count
- Highlight the top 5 hub notes (most connected)
- Flag orphans that might need linking
analyze
Purpose: Run full vault intelligence analysis — community detection, structural importance ranking (god nodes), cross-community bridge detection, and interactive visualization. Generates two artifacts in the vault root.
Behavior
Call library_report (no params, uses default output path)
- Runs the full pipeline: graph build → community detection → betweenness centrality → PageRank → surprising connections
- Writes
GRAPH_REPORT.md to vault root
- Report includes: god nodes table, community breakdown, surprising cross-topic connections, suggested questions
Call library_visualize (no params, uses default output path)
- Generates self-contained interactive HTML with force-directed graph layout
- Nodes colored by community, sized by structural importance
- Click to inspect, search to filter
- Writes
GRAPH_VIZ.html to vault root
Report:
Vault analysis complete.
Report: GRAPH_REPORT.md
- 847 notes, 2,341 links, 12 communities, 43 orphans
- God nodes: [[Codex]], [[Obsidian]], [[Knowledge Management]]
- 8 surprising cross-community connections found
Visualization: GRAPH_VIZ.html
- Open in browser to explore the interactive graph
Next steps:
- /librarian connect — link orphan notes into the graph
- /librarian from Codex — archive this session's learnings
What the report contains
| Section |
Content |
| God Nodes |
Top 10 structurally important notes ranked by composite score (degree + betweenness centrality + PageRank) |
| Communities |
Topic clusters with member lists, detected by modularity optimization |
| Surprising Connections |
High-betweenness edges that bridge different communities — the cross-topic links |
| Suggested Questions |
5 questions the graph is uniquely positioned to answer |
daydream
Purpose: Discover non-obvious connections between vault notes using multi-agent combinatorial exploration. Inspired by Gwern's LLM Daydreaming essay and glebis's Daydream skill — implements the brain's "default mode network" for your vault.
How it works
The command pairs random notes and asks parallel sub-agents to find surprising connections, then filters with critics. Only genuinely novel, coherent, and useful insights survive.
Behavior
Sample notes from the vault:
- Call
library_list to get all note paths
- Call
library_read on a random sample of 50 notes
- Weight toward recent notes (by date frontmatter or filename)
- If
[focus] provided: use library_search to find focus-relevant notes, pair them with random notes from outside that cluster
Generate random pairs:
- Create 50 unique note pairs from the sample
- Check
Daydreams/history.json (via library_read) for already-processed pairs
- Skip duplicates, proceed with remaining pairs
Synthesize connections (parallel sub-agents):
- Launch 10 parallel sub-agents (Sonnet model), each processing 5 pairs
- Each agent reads both notes and explores:
- Abstract analogies between concepts
- Similar problems or solutions in different domains
- Potential combinations or hybrid ideas
- Revealing contradictions or tensions
- Each agent returns structured results: title, connection description, source notes, reasoning
Critique and filter (parallel sub-agents):
- Launch 10 parallel critic sub-agents (Haiku model)
- Each critic scores connections on three dimensions (1-10 each):
- Novelty: Is this surprising and non-obvious?
- Coherence: Is the reasoning logical and well-grounded?
- Usefulness: Could this lead to new work, insights, or decisions?
- Accept only connections with average score >= 7.0
Write accepted insights to vault:
- For each accepted insight, call
library_write to create Daydreams/<YYYYMMDD>-<slug>.md
- Frontmatter includes: title, source_notes (paths), scores (novelty/coherence/usefulness), date, tags (daydream, source topics)
- Body includes: the connection description, reasoning, and source note excerpts
library_write auto-wikilinks the insight into the knowledge graph
Update history:
- Read or create
Daydreams/history.json via library_read/library_write
- Add all processed pairs (accepted or rejected) to prevent re-processing
- Track: pair hashes, dates, accept/reject status
Report:
Daydream complete.
Processed: 42 pairs (8 skipped as duplicates)
Accepted: 7 insights (17% acceptance rate)
Insights written:
- Daydreams/20260411-authentication-as-trust-boundary.md
"Authentication patterns in the auth module mirror trust boundary
concepts from the game theory notes — both define threshold functions."
- Daydreams/20260411-vite-hmr-and-neural-plasticity.md
...
Run /librarian analyze to see how these integrate into the knowledge graph.
Cost
Approximately $0.40-0.50 per run (50 pairs) using Sonnet for synthesis and Haiku for critique.
Tips
- Run weekly or after adding substantial new content to the vault
- Use
[focus] to explore connections around a specific topic: /librarian daydream authentication
- Daydream insights compound — they become seeds for future runs, creating a discovery flywheel
- Run
/librarian analyze after daydream to see how insights integrate into the graph
status
Purpose: Quick vault health check.
Behavior
Call library_stats
Report in compact format:
Vault: The Labyrinth
Files: 1,247 | Words: 389,102 | Links: 3,891 | Tags: 156
Orphans: 23 (run /librarian connect to fix)
Solutions: 45 ingested
Last daily: 2026-04-11
Tool Reference
This skill orchestrates these Librarian MCP tools:
| Tool |
Used by |
library_search |
search, daydream (focus mode) |
library_read |
search, ingest, connect, daydream |
library_write |
ingest, from *, connect, daydream |
library_list |
ingest (scan docs/solutions/), import (batch), daydream |
library_links |
graph |
library_tags |
search |
library_metadata |
ingest (read frontmatter) |
library_daily |
daily |
library_stats |
status, graph |
library_suggest_links |
ingest, connect |
library_traverse |
search, graph |
library_shortest_path |
graph (on request) |
library_graph_analysis |
graph (vault-wide) |
library_cluster |
analyze, graph |
library_visualize |
analyze |
library_report |
analyze |
library_import |
import (MarkItDown conversion) |
Codex.ai MCP connectors
| Connector |
Tools used |
Used by |
| Gmail |
search_threads, get_thread |
from gmail |
| Exa |
web_fetch_exa |
from web |
| Tavily |
tavily_extract |
from web (fallback), from twitter (fallback) |
| Google Calendar |
gcal_list_events, gcal_get_event |
from calendar |
Local data sources
| Source |
Location |
Used by |
| Codex sessions |
~/.Codex/projects/<project>/<session>.jsonl |
from Codex |
External CLI tools
| Tool |
Used by |
Install |
markitdown |
import |
pip install markitdown |
bird |
from twitter |
Via agent-reach / bird CLI |
Integration with ce:compound
The primary integration pattern:
/ce:compound # Documents a solution in docs/solutions/
/librarian ingest # Imports latest solution into vault (auto-wikilinked)
This bridges project-scoped documentation into the persistent, cross-project knowledge graph. The next time you /librarian search for a similar problem, the solution surfaces with full graph context.
1---2name: skogai-librarian3description: Orchestrate vault knowledge workflows using the Librarian MCP server. Ingest solutions, search prior art, explore the knowledge graph, log daily learnings.4---56# /librarian78Orchestrate high-level knowledge workflows using Librarian MCP tools.910## Prerequisites1112Librarian MCP server must be configured and running. Verify by checking that `library_stats` responds. If it fails, tell the user to run `librarian-mcp --setup /path/to/vault` and restart Codex.1314## Commands1516```17/librarian ingest [path] Ingest a solution doc into the vault18/librarian import <file> Convert local document (PDF, DOCX, image) to vault markdown19/librarian from gmail <query> Import Gmail threads matching a search into the vault20/librarian from web <url> Import any web page into the vault as markdown21/librarian from twitter <url> Import an X/Twitter thread into the vault22/librarian from calendar [query] Import calendar events/meeting notes into the vault23/librarian from Codex [session] Extract learnings from a Codex session into the vault24/librarian search <query> Deep search vault for prior art25/librarian connect [path] Find and apply missing wikilinks26/librarian daily [text] Append a learning to today's daily note27/librarian graph [note] Explore vault structure or a note's neighborhood28/librarian analyze Full vault analysis: god nodes, communities, viz, report29/librarian daydream [focus] Discover non-obvious connections across vault notes30/librarian status Vault health overview31```3233If no command is given, show the usage summary above.3435---3637## ingest3839**Purpose:** Import a `docs/solutions/` file (or any local markdown) into the vault, gaining auto-wikilinks and knowledge graph integration. This is the bridge between per-project documentation (like ce:compound output) and the persistent vault.4041### Behavior42431. **Locate the source file:**44 - If `[path]` is provided, use it directly45 - If no path, scan `docs/solutions/` for the most recently modified `.md` file46 - If `docs/solutions/` doesn't exist or is empty, tell the user and stop47482. **Read the source file** using the Read tool (local filesystem)49503. **Determine vault destination:**51 - Parse the source file's YAML frontmatter for `category` (or infer from parent directory name)52 - Map to vault path: `Solutions/<category>/<filename>.md`53 - Categories map directly: `build-errors/` -> `Solutions/build-errors/`, etc.54554. **Write to vault** using `library_write` with the file content56 - `library_write` auto-links mentions of existing vault notes as `[[wikilinks]]`57 - Report what links were auto-added58595. **Run `library_suggest_links`** on the newly written file60 - Report any additional link suggestions found61 - If suggestions exist, ask user if they want to apply them (re-write with links)62636. **Report:**6465 ```66 Ingested: docs/solutions/build-errors/vite-hmr-timeout.md67 -> Solutions/build-errors/vite-hmr-timeout.md6869 Auto-linked: [[Vite]], [[HMR]], [[SvelteKit]]70 Suggestions: 2 additional links available7172 The solution is now searchable and connected to your knowledge graph.73 ```7475### Batch mode7677If the user says `/librarian ingest all` or `/librarian ingest docs/solutions/`:7879- Find all `.md` files in `docs/solutions/` recursively80- Ingest each one, reporting progress81- Summarize: total ingested, total links added, any failures8283---8485## import8687**Purpose:** Convert any non-markdown document into markdown and store it in the vault. Uses Microsoft's MarkItDown for conversion, then auto-wikilinks the content.8889### Supported formats9091PDF, DOCX, XLSX, PPTX, images (OCR), audio (transcription), HTML, CSV, JSON, XML, ZIP — anything MarkItDown supports.9293### Prerequisites9495MarkItDown must be installed: `pip install markitdown`9697If the user hasn't installed it, tell them and stop. Don't try to work around it.9899### Behavior1001011. **Determine source and destination:**102 - `<file>` is the local filesystem path to the document103 - If the user provides a vault destination path, use it104 - Otherwise, infer from the file: `Imports/<filename-stem>.md`1051062. **Call `library_import`** with:107 - `source_path`: the local file path108 - `library_path`: the vault destination109 - `title`: filename stem or user-provided title1101113. **Report:**112113 ```114 Imported: quarterly-report.pdf115 -> Imports/quarterly-report.md (12,847 bytes, 2,103 words)116117 Auto-linked: [[Q1 Revenue]], [[Product Roadmap]]118 ```119120### Batch mode121122If the user provides a directory path:123124- List all non-markdown files in the directory125- Confirm with the user before proceeding126- Import each file, reporting progress127- Summarize: total imported, total words, failures128129---130131## from132133**Purpose:** Import content from external connectors (Gmail, web, Twitter/X, Google Calendar) into the vault. Each connector extracts content, converts it to a structured markdown note with frontmatter, writes it via `library_write` for auto-wikilinks, and integrates it into the knowledge graph.134135All `from` subcommands follow the same output pattern:136137- YAML frontmatter with `source`, `imported`, `type`, and `tags`138- Structured markdown body139- Key takeaways or summary section140- Written via `library_write` for auto-wikilinks141142### from gmail143144**Purpose:** Import Gmail threads into the vault as structured notes. Useful for preserving important email conversations, research threads, or decisions.145146**Connector:** Codex.ai Gmail MCP (`search_threads`, `get_thread`)147148**Behavior:**1491501. **Search for threads:**151 - Call `search_threads` with the user's query (same syntax as Gmail search bar)152 - Examples: `"from:editor@publisher.com"`, `"subject:manuscript feedback"`, `"has:attachment newer_than:7d"`153 - Display results (subject, from, date, snippet) and let user pick which to import154 - If only one result, proceed directly1551562. **Extract full thread:**157 - Call `get_thread` with `messageFormat: "FULL_CONTENT"` for each selected thread158 - Extract: participants, dates, subject, full message bodies1591603. **Build the vault note:**161162 ```markdown163 ---164 title: "<subject line>"165 participants: ["sender@email.com", "recipient@email.com"]166 source: gmail167 thread_id: "<thread_id>"168 imported: YYYY-MM-DD169 type: email170 tags:171 - source/gmail172 - <topic tags inferred from content>173 ---174175 # <subject line>176177 **Participants:** sender, recipient | **Date range:** YYYY-MM-DD to YYYY-MM-DD178179 ---180181 ## Message 1 — From: sender@email.com (YYYY-MM-DD HH:MM)182183 <message body>184185 ## Message 2 — From: recipient@email.com (YYYY-MM-DD HH:MM)186187 <message body>188189 ---190191 ## Key points192193 <3-5 bullet point summary of the thread's decisions, action items, or key information>194 ```1951964. **Vault path:** `Emails/<YYYY>/<slugified-subject>.md`1971985. **Write via `library_write`**, report auto-linked notes.1992006. **Report:**201202 ```203 Imported: "Re: Manuscript feedback round 2" (5 messages)204 -> Emails/2026/manuscript-feedback-round-2.md205206 Auto-linked: [[Publishing]], [[Draft Review]]207 Key points: 3 action items extracted208 ```209210### from web211212**Purpose:** Import any web page into the vault as clean markdown. Uses Exa or Tavily for extraction.213214**Connectors:** Exa (`web_fetch_exa`) preferred, Tavily (`tavily_extract`) as fallback.215216**Behavior:**2172181. **Extract the page:**219 - Try `web_fetch_exa` with the URL first (returns clean markdown)220 - If Exa fails or returns insufficient content, fall back to `tavily_extract` with `extract_depth: "advanced"`221 - If both fail, tell the user and stop2222232. **Build the vault note:**224225 ```markdown226 ---227 title: "<page title>"228 url: "<source URL>"229 author: "<author if detectable>"230 imported: YYYY-MM-DD231 type: article232 tags:233 - source/web234 - <topic tags inferred from content>235 ---236237 # <page title>238239 **Source:** [<domain>](url) | **Imported:** YYYY-MM-DD240241 ---242243 <cleaned markdown content>244245 ---246247 ## Key takeaways248249 <3-5 bullet point summary>250 ```2512523. **Vault path:** `Web/<YYYY>/<slugified-title>.md`2532544. **Write via `library_write`**, report auto-linked notes.2552565. **Batch mode:** If given multiple URLs, process each sequentially.257258### from twitter259260**Purpose:** Import an X/Twitter thread into the vault.261262**Connector:** `bird` CLI via Bash (from agent-reach tooling).263264**Behavior:**2652661. **Extract the thread:**267 - Run: `bird thread <url>` via Bash268 - If URL is a single tweet (not a thread), run: `bird read <url>`269 - If `bird` fails, fall back: try `tavily_extract` on the URL, or ask user to paste text2702712. **Parse the output:**272 - Extract: author handle, date, individual tweets273 - Identify the thread topic from the first tweet2742753. **Build the vault note:**276277 ```markdown278 ---279 title: "<thread topic summary>"280 author: "@handle"281 source: "<original URL>"282 imported: YYYY-MM-DD283 type: thread284 tags:285 - source/twitter286 - <topic tags inferred from content>287 ---288289 # <thread topic summary>290291 **Author:** [@handle](<profile url>) | **Date:** YYYY-MM-DD | **[Original thread](url)**292293 ---294295 <thread content, preserving tweet boundaries with --- separators>296297 ---298299 ## Key takeaways300301 <3-5 bullet point summary of the thread's main points>302 ```3033044. **Vault path:** `Threads/<YYYY>/<slugified-topic>.md`3053065. **Write via `library_write`**, report auto-linked notes.3073086. **Batch mode:** If given multiple URLs, process each sequentially.309310### from calendar311312**Purpose:** Import calendar events into the vault, useful for meeting notes, event context, or archiving.313314**Connector:** Codex.ai Google Calendar MCP (`gcal_list_events`, `gcal_get_event`)315316**Behavior:**3173181. **Find events:**319 - If `[query]` is provided, use it as a search term via `gcal_list_events` with `q` parameter320 - If no query, list today's events via `gcal_list_events` with `timeMin`/`timeMax` set to today321 - Display results and let user pick which to import3223232. **Get full event details:**324 - Call `gcal_get_event` for each selected event325 - Extract: title, date/time, attendees, description, location, attachments3263273. **Build the vault note:**328329 ```markdown330 ---331 title: "<event summary>"332 date: YYYY-MM-DD333 attendees: ["person1@email.com", "person2@email.com"]334 source: google-calendar335 event_id: "<event_id>"336 imported: YYYY-MM-DD337 type: meeting338 tags:339 - source/calendar340 - <topic tags inferred from content>341 ---342343 # <event summary>344345 **Date:** YYYY-MM-DD HH:MM - HH:MM | **Location:** <location>346 **Attendees:** person1, person2347348 ---349350 ## Event description351352 <description from the calendar event>353354 ---355356 ## Notes357358 <placeholder for user to fill in meeting notes>359 ```3603614. **Vault path:** `Meetings/<YYYY>/<YYYY-MM-DD>-<slugified-title>.md`3623635. **Write via `library_write`**, report auto-linked notes.3643656. **Batch mode:** If importing a date range, ask user: `/librarian from calendar --week` imports all events from the current week.366367### from Codex368369**Purpose:** Extract key learnings, decisions, and solutions from a Codex session transcript and archive them in the vault. Closes the knowledge loop — your conversations become searchable vault knowledge.370371**Data source:** Local JSONL files at `~/.Codex/projects/<project>/<session-id>.jsonl`372373**Behavior:**3743751. **Find the session:**376 - If `[session]` is a UUID, use it directly377 - If `[session]` is a project name or path fragment, find matching project directory under `~/.Codex/projects/`378 - If no argument, list the 10 most recent sessions across all projects with date, size, project, and first user message as topic hint. Let the user pick.379 - To list sessions: use Bash to scan `~/.Codex/projects/*/` for `.jsonl` files, sort by mtime descending3803812. **Parse the JSONL transcript:**382 - Read the file using the Read tool (it's local plaintext)383 - Each line is a JSON object with a `type` field: `user`, `assistant`, `system`, `file-history-snapshot`, `permission-mode`, `attachment`384 - Focus on `user` and `assistant` messages:385 - `user` messages have `message.content` (string or array of `{type: "text", text: "..."}` blocks)386 - `assistant` messages have `message.content` as array of blocks: `thinking`, `text`, `tool_use`387 - Extract only `text` blocks from assistant messages (skip `thinking` and `tool_use`)388 - Skip `system`, `file-history-snapshot`, `permission-mode`, and `attachment` types3893903. **Synthesize the session into a vault note:**391 - Read through the conversation and extract:392 - **Topic:** What was the session about? (infer from first user message and overall flow)393 - **Decisions made:** Architecture choices, approach selections, trade-offs resolved394 - **Problems solved:** Bugs fixed, issues resolved, with root causes395 - **Key artifacts:** Files created/modified, commands established396 - **Open items:** Things deferred, noted for future, or left incomplete397 - Be selective — not every message is worth archiving. Focus on knowledge that compounds.3983994. **Build the vault note:**400401 ```markdown402 ---403 title: "<session topic summary>"404 project: "<project path>"405 session_id: "<uuid>"406 date: YYYY-MM-DD407 source: Codex408 imported: YYYY-MM-DD409 type: session410 tags:411 - source/Codex412 - <project tag>413 - <topic tags inferred from content>414 ---415416 # <session topic summary>417418 **Project:** <project path> | **Date:** YYYY-MM-DD | **Messages:** N419420 ---421422 ## Decisions423424 - <decision 1 — what was chosen and why>425 - <decision 2>426427 ## Solutions428429 ### <problem 1 title>430431 **Problem:** <what was wrong>432 **Root cause:** <why>433 **Fix:** <what was done>434435 ## Artifacts436437 - Created: `path/to/file.md`438 - Modified: `src/main.rs` — added skill installation to --setup439440 ## Open items441442 - <anything deferred or left for future sessions>443 ```4444455. **Vault path:** `Sessions/<YYYY>/<YYYY-MM-DD>-<slugified-topic>.md`4464476. **Write via `library_write`**, report auto-linked notes.4484497. **Report:**450451 ```452 Imported session: "Librarian skill + MCP connector integration"453 -> Sessions/2026/2026-04-11-librarian-skill-mcp-connectors.md454455 Auto-linked: [[librarian-mcp]], [[ce-compound]], [[Obsidian]]456 Extracted: 4 decisions, 2 solutions, 1 open item457 ```458459### Tips for from Codex460461- **Current session:** You can import the current session — just use the session ID from the JSONL filename. The transcript is written incrementally, so it includes everything up to now.462- **Pairs with session-close:** Run `/session-close` to update project memory, then `/librarian from Codex` to archive the knowledge in the vault.463- **Large sessions:** For sessions with 100+ messages, focus extraction on the second half where solutions typically land. Skip early exploration/dead-ends unless they contain useful "what didn't work" context.464- **Privacy:** Session transcripts may contain API keys, passwords, or sensitive data that was read by tools. The synthesis step should never copy raw credentials — only extract the conceptual knowledge.465466---467468## search469470**Purpose:** Deep search across the vault for prior art on a topic. More than a raw search -- synthesizes results into actionable context.471472### Behavior4734741. **Call `library_search`** with the query (limit: 10)4754762. **For the top 3-5 results**, call `library_read` to get full content4774783. **Synthesize** a brief summary:479 - What the vault knows about this topic480 - Which notes are most relevant (with paths)481 - Key insights or solutions found482 - Related tags discovered4834844. **Call `library_traverse`** from the most relevant result (depth: 1) to find connected notes the search might have missed4854865. **Report:**487488 ```489 Vault knowledge on "<query>":490491 Direct matches (N files):492 - Solutions/build-errors/vite-hmr-timeout.md — HMR fix for Tauri apps493 - Research/Deep Dives/vite-internals.md — Vite architecture notes494495 Key insights:496 - [synthesized takeaways from the matched content]497498 Connected notes (via graph):499 - [[SvelteKit]] (1 hop from vite-hmr-timeout)500501 Tags: #build, #vite, #frontend502 ```503504---505506## connect507508**Purpose:** Find unlinked mentions across the vault and optionally apply them. Strengthens the knowledge graph.509510### Behavior5115121. **If `[path]` is provided:**513 - Run `library_suggest_links` on that specific file514 - Show suggestions515 - Ask user to confirm before applying5165172. **If no path (vault-wide scan):**518 - Call `library_stats` to get orphan notes519 - For each orphan (up to 10), run `library_suggest_links`520 - Report which orphans could be connected and how521 - Ask user before applying any changes5225233. **Applying links:**524 - Read the file via `library_read`525 - Write it back via `library_write` (which auto-links on write)526 - Report the links that were added527528---529530## daily531532**Purpose:** Append a learning, note, or reflection to today's daily note.533534### Behavior5355361. **If `[text]` is provided:**537 - Call `library_daily` with `append: <text>`538 - Done5395402. **If no text:**541 - Summarize the current conversation's key outcomes (what was solved, what was learned, what decisions were made)542 - Format as a bullet list under a `## Learnings` section543 - Call `library_daily` with the formatted summary544 - Show what was appended5455463. **Always report** the daily note path (e.g., `Journal/2026/2026-04-11.md`)547548---549550## graph551552**Purpose:** Explore vault structure or a specific note's neighborhood in the knowledge graph.553554### Behavior5555561. **If `[note]` is provided:**557 - Call `library_traverse` with `start: <note>`, `depth: 2`558 - Call `library_links` on the note for backlinks/outgoing detail559 - Render a text-based neighborhood map:560561 ```562 Topic Neighborhood: "Vite"563564 [[SvelteKit]] ---> [[Vite]] <--- [[HMR]]565 |566 v567 [[Tauri Build]]568569 Backlinks (3): SvelteKit, HMR, Frontend Tooling570 Outgoing (2): Tauri Build, ESBuild571 2 hops: 8 notes reachable572 ```5735742. **If no note (vault-wide):**575 - Call `library_stats` for overview576 - Call `library_graph_analysis` for structure577 - Report: file count, word count, connected components, hub notes, bridge notes, orphan count578 - Highlight the top 5 hub notes (most connected)579 - Flag orphans that might need linking580581---582583## analyze584585**Purpose:** Run full vault intelligence analysis — community detection, structural importance ranking (god nodes), cross-community bridge detection, and interactive visualization. Generates two artifacts in the vault root.586587### Behavior5885891. **Call `library_report`** (no params, uses default output path)590 - Runs the full pipeline: graph build → community detection → betweenness centrality → PageRank → surprising connections591 - Writes `GRAPH_REPORT.md` to vault root592 - Report includes: god nodes table, community breakdown, surprising cross-topic connections, suggested questions5935942. **Call `library_visualize`** (no params, uses default output path)595 - Generates self-contained interactive HTML with force-directed graph layout596 - Nodes colored by community, sized by structural importance597 - Click to inspect, search to filter598 - Writes `GRAPH_VIZ.html` to vault root5996003. **Report:**601602 ```603 Vault analysis complete.604605 Report: GRAPH_REPORT.md606 - 847 notes, 2,341 links, 12 communities, 43 orphans607 - God nodes: [[Codex]], [[Obsidian]], [[Knowledge Management]]608 - 8 surprising cross-community connections found609610 Visualization: GRAPH_VIZ.html611 - Open in browser to explore the interactive graph612613 Next steps:614 - /librarian connect — link orphan notes into the graph615 - /librarian from Codex — archive this session's learnings616 ```617618### What the report contains619620| Section | Content |621| -------------------------- | ---------------------------------------------------------------------------------------------------------- |622| **God Nodes** | Top 10 structurally important notes ranked by composite score (degree + betweenness centrality + PageRank) |623| **Communities** | Topic clusters with member lists, detected by modularity optimization |624| **Surprising Connections** | High-betweenness edges that bridge different communities — the cross-topic links |625| **Suggested Questions** | 5 questions the graph is uniquely positioned to answer |626627---628629## daydream630631**Purpose:** Discover non-obvious connections between vault notes using multi-agent combinatorial exploration. Inspired by Gwern's LLM Daydreaming essay and glebis's Daydream skill — implements the brain's "default mode network" for your vault.632633### How it works634635The command pairs random notes and asks parallel sub-agents to find surprising connections, then filters with critics. Only genuinely novel, coherent, and useful insights survive.636637### Behavior6386391. **Sample notes from the vault:**640 - Call `library_list` to get all note paths641 - Call `library_read` on a random sample of 50 notes642 - Weight toward recent notes (by date frontmatter or filename)643 - If `[focus]` provided: use `library_search` to find focus-relevant notes, pair them with random notes from outside that cluster6446452. **Generate random pairs:**646 - Create 50 unique note pairs from the sample647 - Check `Daydreams/history.json` (via `library_read`) for already-processed pairs648 - Skip duplicates, proceed with remaining pairs6496503. **Synthesize connections (parallel sub-agents):**651 - Launch 10 parallel sub-agents (Sonnet model), each processing 5 pairs652 - Each agent reads both notes and explores:653 - Abstract analogies between concepts654 - Similar problems or solutions in different domains655 - Potential combinations or hybrid ideas656 - Revealing contradictions or tensions657 - Each agent returns structured results: title, connection description, source notes, reasoning6586594. **Critique and filter (parallel sub-agents):**660 - Launch 10 parallel critic sub-agents (Haiku model)661 - Each critic scores connections on three dimensions (1-10 each):662 - **Novelty:** Is this surprising and non-obvious?663 - **Coherence:** Is the reasoning logical and well-grounded?664 - **Usefulness:** Could this lead to new work, insights, or decisions?665 - Accept only connections with average score >= 7.06666675. **Write accepted insights to vault:**668 - For each accepted insight, call `library_write` to create `Daydreams/<YYYYMMDD>-<slug>.md`669 - Frontmatter includes: title, source_notes (paths), scores (novelty/coherence/usefulness), date, tags (daydream, source topics)670 - Body includes: the connection description, reasoning, and source note excerpts671 - `library_write` auto-wikilinks the insight into the knowledge graph6726736. **Update history:**674 - Read or create `Daydreams/history.json` via `library_read`/`library_write`675 - Add all processed pairs (accepted or rejected) to prevent re-processing676 - Track: pair hashes, dates, accept/reject status6776787. **Report:**679680 ```681 Daydream complete.682683 Processed: 42 pairs (8 skipped as duplicates)684 Accepted: 7 insights (17% acceptance rate)685686 Insights written:687 - Daydreams/20260411-authentication-as-trust-boundary.md688 "Authentication patterns in the auth module mirror trust boundary689 concepts from the game theory notes — both define threshold functions."690 - Daydreams/20260411-vite-hmr-and-neural-plasticity.md691 ...692693 Run /librarian analyze to see how these integrate into the knowledge graph.694 ```695696### Cost697698Approximately $0.40-0.50 per run (50 pairs) using Sonnet for synthesis and Haiku for critique.699700### Tips701702- Run weekly or after adding substantial new content to the vault703- Use `[focus]` to explore connections around a specific topic: `/librarian daydream authentication`704- Daydream insights compound — they become seeds for future runs, creating a discovery flywheel705- Run `/librarian analyze` after daydream to see how insights integrate into the graph706707---708709## status710711**Purpose:** Quick vault health check.712713### Behavior7147151. Call `library_stats`7162. Report in compact format:717718 ```719 Vault: The Labyrinth720 Files: 1,247 | Words: 389,102 | Links: 3,891 | Tags: 156721 Orphans: 23 (run /librarian connect to fix)722 Solutions: 45 ingested723 Last daily: 2026-04-11724 ```725726---727728## Tool Reference729730This skill orchestrates these Librarian MCP tools:731732| Tool | Used by |733| ------------------------ | ------------------------------------------------------- |734| `library_search` | search, daydream (focus mode) |735| `library_read` | search, ingest, connect, daydream |736| `library_write` | ingest, from \*, connect, daydream |737| `library_list` | ingest (scan docs/solutions/), import (batch), daydream |738| `library_links` | graph |739| `library_tags` | search |740| `library_metadata` | ingest (read frontmatter) |741| `library_daily` | daily |742| `library_stats` | status, graph |743| `library_suggest_links` | ingest, connect |744| `library_traverse` | search, graph |745| `library_shortest_path` | graph (on request) |746| `library_graph_analysis` | graph (vault-wide) |747| `library_cluster` | analyze, graph |748| `library_visualize` | analyze |749| `library_report` | analyze |750| `library_import` | import (MarkItDown conversion) |751752### Codex.ai MCP connectors753754| Connector | Tools used | Used by |755| --------------- | ------------------------------------ | -------------------------------------------- |756| Gmail | `search_threads`, `get_thread` | from gmail |757| Exa | `web_fetch_exa` | from web |758| Tavily | `tavily_extract` | from web (fallback), from twitter (fallback) |759| Google Calendar | `gcal_list_events`, `gcal_get_event` | from calendar |760761### Local data sources762763| Source | Location | Used by |764| -------------------- | ---------------------------------------------- | ----------- |765| Codex sessions | `~/.Codex/projects/<project>/<session>.jsonl` | from Codex |766767### External CLI tools768769| Tool | Used by | Install |770| ------------ | ------------ | -------------------------- |771| `markitdown` | import | `pip install markitdown` |772| `bird` | from twitter | Via agent-reach / bird CLI |773774## Integration with ce:compound775776The primary integration pattern:777778```779/ce:compound # Documents a solution in docs/solutions/780/librarian ingest # Imports latest solution into vault (auto-wikilinked)781```782783This bridges project-scoped documentation into the persistent, cross-project knowledge graph. The next time you `/librarian search` for a similar problem, the solution surfaces with full graph context.