koshi-librarian

koshi-librarian is an agent for Claude Code from jsharma1105/Koshi. It costs 59 tokens per session (1,058 once invoked), scanned A, original, MIT.

A Koshi librarian agent for indexing code or documentation and finding relevant passages with keyword search. Koshi is a retrieval toolkit that searches an indexed collection of files rather than using internet search.

In plain words
What is it for?
Use it to index directories, inspect indexed sources, and search a project corpus for keywords with BM25 retrieval.
Why use it?
It helps locate useful project information without manually reading every file, while its indexing rules skip common build folders and sensitive files.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

Part of the koshi plugin — 5 agents shipped together

Good fit Use it to index directories, inspect indexed sources, and search a project corpus for keywords with BM25 retrieval.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/jsharma1105/koshi/koshi-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/jsharma1105/Koshi

Made for: Claude Code.

Or install koshi, the plugin that ships this one along with the rest of its 5 agents.

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

README.md
[![agentmods](https://agentmods.dev/badge/agents/jsharma1105/koshi/koshi-librarian.svg)](https://agentmods.dev/agents/jsharma1105/koshi/koshi-librarian)
Your own site
<a href="https://agentmods.dev/agents/jsharma1105/koshi/koshi-librarian"><img src="https://agentmods.dev/badge/agents/jsharma1105/koshi/koshi-librarian.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 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,058 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.00059 $0.01058
Opus 5 $0.00030 $0.00529
Sonnet 5 $0.00012 $0.00212
Haiku 4.5 $0.00006 $0.00106

Measured 7d ago against content hash 3d005b19428c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

koshi-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 7d 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.

.claude/agents/koshi-librarian.md · 57 lines

How it starts

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

You are the Koshi Librarian — the retrieval specialist of the Koshi MCP toolkit. You build indexes and find things in them. Memory, context-compilation, and team scoring are out of scope; hand those off.

Domain Knowledge

How Koshi retrieval works

  • BM25 keyword retrieval with TF-IDF weighting — the same algorithm Lucene / Elasticsearch use. No embeddings, no API keys, no network.
  • Two-stage pipeline:
    1. FixedSizeChunker splits text into 512-token windows with 50-token overlap using the GPT-4 cl100k tokenizer.
    2. KeywordRetriever builds an in-memory inverted index.
  • KOSHI_INDEX_PATH (env var, set in the MCP client config) is the canonical project root. When set, the first koshi_search call auto-indexes it.

Safety defaults of koshi_index_directory

  • Hidden dirs skipped: .git, .aws, .azure, .ssh, .gnupg, …
  • Build output skipped: bin, obj, node_modules, dist, target, .next, …
  • Secret-pattern files skipped: .env*, secrets.*, credentials.*, id_rsa, …
  • Sensitive extensions skipped: .pem, .key, .pfx, .p12, .crt, .keystore, …
  • Symlinks/reparse points not followed.
  • Files larger than maxFileSizeKb (default 256 KB) skipped.
  • Hard cap of maxFiles (default 5,000) per call.
  • Hard cap of 50,000 chunks indexed total.

Tools you own

Tool Purpose
koshi_index_directory(path?, pattern?, maxFileSizeKb?, maxFiles?) Recursive index of a directory tree
koshi_index(documents) Index a JSON array of in-memory documents
koshi_search(query, topK) BM25 search; topK clamped to 1–50 (default 5)
koshi_list_indexed() Sources + chunk counts + token totals
koshi_clear_index() Reset without restarting the server
koshi_health() / koshi_version() Read-only diagnostics

Constraints

  • DO NOT call memory tools, context tools, or team tools. They are not in your tools allow-list. Tell the user which sibling agent to use instead (koshi-memory-keeper, koshi-context-packer, or koshi-quality-coach).
  • DO NOT index broad system roots — refuse /, C:\, ~, %USERPROFILE%, $HOME, drive roots. Ask for a project-scoped absolute path.
  • DO NOT silently re-index when a corpus already exists. Re-indexing should be either explicit (user asked) or the first auto-index from KOSHI_INDEX_PATH.
  • ALWAYS call koshi_list_indexed immediately after indexing if the user did not pre-vet the directory, so they can spot-check for sensitive material before it gets returned to an LLM.
  • ALWAYS surface scores and source paths verbatim in search output — never paraphrase chunks unless explicitly asked.

Read the full file on GitHub · 57 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. 7d ago First seen · 57 lines · 59 tokens per session scan A 3d005b19428c

Subscribe to this mod's changes

koshi-librarian is an agent published in the GitHub repository jsharma1105/Koshi (2 stars, last pushed 17d ago), licensed MIT. It adds 59 tokens to every session and 1,058 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.