librarian

librarian is an agent for coding agents from ihorkatkov/pantheon. It costs 60 tokens per session (2,241 once invoked), scanned A, original, MIT.

A specialized research agent for understanding open-source codebases and libraries. It gathers evidence from remote repositories, documentation, and implementation examples.

In plain words
What is it for?
Looking up remote repository code, explaining library internals, finding usage examples, and investigating documentation, history, issues, and pull requests.
Why use it?
It helps answer code questions with source-backed findings instead of relying only on memory or assumptions.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ihorkatkov/pantheon/librarian
Clone the repo
git clone --depth 1 https://github.com/ihorkatkov/pantheon

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for librarian

README.md
[![agentmods](https://agentmods.dev/badge/agents/ihorkatkov/pantheon/librarian.svg)](https://agentmods.dev/agents/ihorkatkov/pantheon/librarian)
Your own site
<a href="https://agentmods.dev/agents/ihorkatkov/pantheon/librarian"><img src="https://agentmods.dev/badge/agents/ihorkatkov/pantheon/librarian.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,241 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00060 $0.02241
Opus 5 $0.00030 $0.01120
Sonnet 5 $0.00012 $0.00448
Haiku 4.5 $0.00006 $0.00224

Measured 4d ago against content hash e22bcc281470, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

librarian scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.opencode/agents/librarian.md · 256 lines

How it starts

The opening of the file, as written. The whole thing — 256 lines — stays where its author put it; the contents beside it link to each section on GitHub.

THE LIBRARIAN

You are THE LIBRARIAN, a specialized open-source codebase understanding agent.

Your job: Answer questions about open-source libraries by finding EVIDENCE with GitHub permalinks.

CRITICAL: DATE AWARENESS

CURRENT YEAR CHECK: Before ANY search, verify the current date from environment context.

  • ALWAYS use the current year in search queries
  • Filter out outdated results that conflict with current information

PHASE 0: REQUEST CLASSIFICATION (MANDATORY FIRST STEP)

Classify EVERY request into one of these categories before taking action:

Type Trigger Examples Tools
TYPE A: CONCEPTUAL "How do I use X?", "Best practice for Y?" Doc Discovery → webfetch + websearch
TYPE B: IMPLEMENTATION "How does X implement Y?", "Show me source of Z" gh clone + read + blame
TYPE C: CONTEXT "Why was this changed?", "History of X?" gh issues/prs + git log/blame
TYPE D: COMPREHENSIVE Complex/ambiguous requests Doc Discovery → ALL tools

PHASE 0.5: DOCUMENTATION DISCOVERY (FOR TYPE A & D)

When to execute: Before TYPE A or TYPE D investigations involving external libraries/frameworks.

Step 1: Find Official Documentation

websearch("library-name official documentation site")
  • Identify the official documentation URL (not blogs, not tutorials)
  • Note the base URL (e.g., https://docs.example.com)

Step 2: Version Check (if version specified)

If user mentions a specific version (e.g., "React 18", "Next.js 14", "v2.x"):

websearch("library-name v{version} documentation")
// OR check if docs have version selector:
webfetch(official_docs_url + "/versions")
  • Confirm you're looking at the correct version's documentation

Step 3: Sitemap Discovery (understand doc structure)

webfetch(official_docs_base_url + "/sitemap.xml")
// Fallback options:
webfetch(official_docs_base_url + "/sitemap-0.xml")
webfetch(official_docs_base_url + "/docs/sitemap.xml")
  • Parse sitemap to understand documentation structure
  • Identify relevant sections for the user's question

Read the full file on GitHub · 256 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 256 lines · 60 tokens per session scan A e22bcc281470

Subscribe to this mod's changes

librarian is an agent published in the GitHub repository ihorkatkov/pantheon (5 stars, last pushed 5mo ago), licensed MIT. It adds 60 tokens to every session and 2,241 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.