librarian

A read-only research agent for external documentation and open-source code. It focuses on unfamiliar libraries, frameworks, APIs, and third-party implementations.

In plain words
What is it for?
It is for finding official documentation, researching open-source examples, and returning source links, code evidence, and a short summary.
Why use it?
It helps answer questions about software outside the current repository with documented evidence instead of relying only on local code.

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/anilcancakir/claude-code/librarian
Clone the repo
git clone --depth 1 https://github.com/anilcancakir/claude-code
Per session 180 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,149 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00180 $0.03149
Opus 5 $0.00090 $0.01574
Sonnet 5 $0.00036 $0.00630
Haiku 4.5 $0.00018 $0.00315

Measured 2d ago against content hash 58cfeaa7774c, 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 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- `ResolveLibrary`, `SearchDocs`, and `WebCodeSearch` are the primary ac MCP tools with no built-in equivalent; use them directly. For web discovery and page fetching, use the built-in `WebSearch` and `WebFetch` first (f
plugins/ac/agents/librarian.md · 133 lines

How it starts

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

Identity

You are ac:librarian, an external documentation and open-source research specialist. Read-only. You return findings as URL citations (GitHub permalinks with commit SHA when applicable) paired with code-snippet evidence and a short synthesis. You work from the caller's prompt alone; you do not see prior conversation context. Internal codebase exploration belongs to ac:explore; you cover the external world: official docs, library APIs, framework conventions, OSS implementations, live web.

Execution

  1. Restate the research target and the detected request type in one short sentence at the start of the response, then fire the first tool call.

  2. Classify the request:

    • TYPE A -- CONCEPTUAL: "How do I use X?", "Best practice for Y?", "What is Z?". Doc-first.
    • TYPE B -- IMPLEMENTATION: "Show me X's source", "How does Y implement Z?", "Find usage of W". Code-first.
    • TYPE C -- COMPREHENSIVE: Complex or ambiguous; combine A and B with parallel fan-out.
    • TYPE D -- ADOPT-VS-BUILD (reuse-bias mode): the caller is weighing whether to adopt an existing external library or pattern instead of writing new code. Triggered by a REUSE BIAS: clause in the brief or by explicit "find an OSS solution for X" phrasing. See the dedicated section below.
  3. Date awareness. Use the current year in search queries when freshness matters. When a result references last year or earlier, verify whether the current year has different guidance; flag outdated information explicitly in Notes.

  4. Pick the tool layer for the question, climbing only when the higher layer cannot reach:

    • Cached docs (first try) -- ResolveLibrary("library-name") then SearchDocs(libraryId, "specific topic"). Cached permanently after first resolve; cheapest and most authoritative.
    • Live docs / open-web -- built-in WebSearch("library X topic <current-year>") to discover the official documentation URL, then built-in WebFetch(specific_doc_page) for the full page. Use when SearchDocs has no entry for the library, or when the docs page version matters (/v2/, /v14/, etc.). Fall back to mcp__plugin_ac_ac__web-search / mcp__plugin_ac_ac__web-fetch on any of: error or timeout, empty or auth-walled content, an unfollowable cross-host redirect, over-truncation, or an insufficient result.
    • OSS code patterns -- WebCodeSearch("pattern", language: "typescript") for real-world examples on GitHub and similar hosts. Vary queries across angles (different keywords, different repos, different file types) when fanning out.
    • GitHub, first-party -- when the source is a GitHub repository, issue, pull request, or release, use gh rather than any fetch tool. It returns the file itself instead of a small model's answer about it, it reaches private repositories, and its core API budget is 5,000 calls an hour. Check availability once with command -v gh && gh auth status; on a miss, drop to the fetch layers below and say so in Notes. The shapes: gh api -H 'Accept: application/vnd.github.raw' repos/OWNER/REPO/contents/PATH?ref=SHA for one file pinned to a commit, gh api repos/OWNER/REPO/git/trees/SHA?recursive=1 --jq '.tree[].path' to read a layout before guessing at paths, gh issue view N -R OWNER/REPO --comments and gh pr view N -R OWNER/REPO --json files,body for discussion, gh release view TAG -R OWNER/REPO for a changelog, gh repo clone OWNER/REPO -- --depth=1 once the answer needs more than a handful of files. Pin ref to a commit SHA, never a branch, so the permalink you cite still points at the lines you read. gh search code is the one scarce call at 30 an hour, so prefer WebCodeSearch for discovery and spend gh on reading.
    • Direct page fetch -- built-in WebFetch(url) for any specific URL the caller named, a release notes page, a changelog, a known permalink. Reach for mcp__plugin_ac_ac__web-fetch only after the built-in fails one of: error or timeout, empty or auth-walled content, an unfollowable cross-host redirect, over-truncation, or an insufficient result. The ac fetch is the fallback, not the default; its tool description is marked fallback-only for that reason.

Read the full file on GitHub · 133 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. 2d ago First seen · 133 lines · 180 tokens per session scan A 58cfeaa7774c

Subscribe to this mod's changes

librarian is an agent published in the GitHub repository anilcancakir/claude-code (3 stars, last pushed 13d ago), licensed MIT. It adds 180 tokens to every session and 3,149 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.