context-librarian

context-librarian is an agent for coding agents 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

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/arpitnath/claude-capsule-kit/context-librarian
Clone the repo
git clone --depth 1 https://github.com/arpitnath/claude-capsule-kit

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.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.svg" alt="Measured on agentmods" 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. 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.00072 $0.01595
Opus 5 $0.00036 $0.00797
Sonnet 5 $0.00014 $0.00319
Haiku 4.5 $0.00007 $0.00160

Measured 5d ago against content hash 33ceae46c1eb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 5d 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. 5d 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 (90 stars, last pushed 3mo ago), licensed MIT. It adds 72 tokens to every session and 1,595 once invoked, about $0.0004 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-30.

Related

Other agents, from other repositories

code-reviewer

Critical code review agent for deep analysis using Opus model. Use proactively after code changes for comprehensive review. Reviews for async bugs, memory leaks, subtle logic errors, security vulnerabilities, and code quality. Returns comprehensive review with actionable recommendations.

changoo89/claude-pilot · 51 tokens

codebase-mapper

Use proactively when a task needs local repository structure, entry points, ownership, data flow, or change-surface mapping before a decision. Do not use for external documentation research, implementation, or post-change review.

zebbern/claude-code-guide · 47 tokens

merge-resolver

Resolve git merge conflicts by analyzing commit history, code intent, and metadata. Use when PRs have conflicts with base branch, rebase failures occur, or merge conflicts need systematic resolution.

rjmurillo/ai-agents · 41 tokens

issue-feature-review

Review GitHub feature requests with constructive skepticism. Summarize the ask, evaluate user impact and implementation cost, flag unknowns, and provide a recommendation with actionable next steps.

rjmurillo/ai-agents · 39 tokens

comment-analyzer

Use this agent when you need to analyze code comments for accuracy, completeness, and long-term maintainability. Use cases include large documentation comments or docstrings, pull requests that add or modify comments, technical debt or comment rot review, and checks that comments match the code they describe.

rjmurillo/ai-agents · 60 tokens

overview

Understanding Hivekeep's persistent AI agents.

MarlBurroW/hivekeep · 8 tokens