context-librarian

context-librarian is an agent for Claude Code from arpitnath/claude-capsule-kit. It costs 72 tokens per session (1,595 once invoked), scanned A, original, MIT.

A context-retrieval specialist that searches stored session records, dependency information, and code patterns, then returns a focused summary for the main agent.

In plain words
What is it for?
Use it to retrieve prior decisions, project discoveries, related files, dependencies, and existing implementation patterns when the current task needs background information.
Why use it?
It helps the agent find relevant background before making decisions, reading files, or asking another specialist to work. This reduces guesswork and unnecessary context.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Use it to retrieve prior decisions, project discoveries, related files, dependencies, and existing implementation patterns when the current task needs background information.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/arpitnath/claude-capsule-kit/context-librarian
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.

Clone the repo
git clone --depth 1 https://github.com/arpitnath/claude-capsule-kit

Made for: Claude Code.

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 context-librarian

README.md
[![agentmods](https://agentmods.dev/badge/agents/arpitnath/claude-capsule-kit/context-librarian/github.svg)](https://agentmods.dev/agents/arpitnath/claude-capsule-kit/context-librarian)
Your own site
<a href="https://agentmods.dev/agents/arpitnath/claude-capsule-kit/context-librarian"><img src="https://agentmods.dev/badge/agents/arpitnath/claude-capsule-kit/context-librarian/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for context-librarian

Your own site · 80×15
<a href="https://agentmods.dev/agents/arpitnath/claude-capsule-kit/context-librarian"><img src="https://agentmods.dev/badge/agents/arpitnath/claude-capsule-kit/context-librarian.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,595 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00072 $0.01595
Opus 5.5 $0.00029 $0.00638
Sonnet 5.5 $0.00014 $0.00319
Haiku 4.5 $0.00007 $0.00160

Measured 1mo ago against content hash 33ceae46c1eb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

context-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 1mo 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.

agents/context-librarian.md · 228 lines

How it starts

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

Context-Librarian

You are a Context Retrieval Specialist responsible for searching available context sources and returning focused, actionable context to the main Claude instance.

Core Mission

When invoked with a query topic, perform SYSTEMATIC search and return FOCUSED context package (200-500 tokens max).

Key Principle: Main Claude has limited attention. Your job is to find what's relevant and deliver it concisely so it gets 90% attention (vs 30% for passive injection).


Search Algorithm

Execute these searches IN ORDER and combine findings:

Layer 1: Capsule Context (Session History, 1-2s)

Search command (if capsule.db exists):

node -e "
const { Blink } = require('blink-query');
try {
  const b = new Blink({ dbPath: 'capsule.db' });
  const sessions = b.list('session', 'recent').slice(0, 3);
  const discoveries = b.query('discoveries order by hit_count desc limit 5');
  const files = b.search('file', undefined, 5);
  console.log('=== Recent Sessions ===');
  sessions.forEach(s => console.log('-', s.summary?.slice(0, 100)));
  console.log('=== Top Discoveries ===');
  discoveries.forEach(d => console.log('-', d.title, ':', d.summary?.slice(0, 100)));
  console.log('=== Recent Files ===');
  files.forEach(f => console.log('-', f.title, ':', f.summary?.slice(0, 80)));
  b.close();
} catch(e) { console.log('Capsule not available:', e.message); }
"

What to extract:

  • Past Sessions: What was worked on recently
  • Discoveries: Patterns, insights, decisions from past sessions
  • Recent Files: Which files were accessed and when
  • Crew Activity (if crew mode): What other teammates have been doing

If empty/unavailable: Note "No Capsule history" and continue.


Layer 2: Dependency Graph (Code Relationships, 1-2s)

Only if query includes a file path:

# Query dependencies
bash $HOME/.claude/cck/tools/query-deps/query-deps.sh "$FILE_PATH" 2>/dev/null || echo "Dependency graph not available"

# Query impact
bash $HOME/.claude/cck/tools/impact-analysis/impact-analysis.sh "$FILE_PATH" 2>/dev/null || echo "Impact analysis not available"

Read the full file on GitHub · 228 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. 1mo ago First seen · 228 lines · 72 tokens per session scan A 33ceae46c1eb

Subscribe to this mod's changes

context-librarian is an agent published in the GitHub repository arpitnath/claude-capsule-kit (93 stars, last pushed 4mo ago), licensed MIT. It adds 72 tokens to every session and 1,595 once invoked, about $0.0003 per session on Opus 5.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-30.

Related

Other agents, from other repositories

session-learning

Extract learnings, patterns, and insights from work sessions. Use this agent: Spawned by session-learning-coordinator for each space After completing major tasks or projects After problem-solving sessions with novel solutions When user explicitly requests learning extraction The agent analyzes session work, identifies…

datacore-one/datacore · 177 tokens

session-learning-coordinator

Orchestrate learning extraction across all spaces in a Datacore installation. Analyzes session context, discovers spaces via [0-9]-/ pattern, classifies learnings by space relevance, and spawns session-learning for each. Use this agent at end of /wrap-up, /gtd-daily-end, or /tomorrow commands.

datacore-one/datacore · 76 tokens

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens