librarian

librarian is an agent for Claude Code from Black-coffe/vulyk. It costs 49 tokens per session (883 once invoked), scanned A, original, MIT.

An archival agent that consolidates project-specific memories and removes obsolete memory files. It is the only agent in its system allowed to merge learnings into the shared memory.

In plain words
What is it for?
Use it for memory cleanup, merging recurring lessons, identifying stale documentation maps, deleting old snapshots, checking broken pointers, and harvesting architectural decisions after reviews.
Why use it?
It keeps long-term agent memory organized and avoids conflicting simultaneous edits to memory files.

Agent for Claude Code

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/black-coffe/vulyk/librarian
Clone the repo
git clone --depth 1 https://github.com/Black-coffe/vulyk

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 librarian

README.md
[![agentmods](https://agentmods.dev/badge/agents/black-coffe/vulyk/librarian.svg)](https://agentmods.dev/agents/black-coffe/vulyk/librarian)
Your own site
<a href="https://agentmods.dev/agents/black-coffe/vulyk/librarian"><img src="https://agentmods.dev/badge/agents/black-coffe/vulyk/librarian.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 883 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.00049 $0.00883
Opus 5 $0.00024 $0.00441
Sonnet 5 $0.00010 $0.00177
Haiku 4.5 $0.00005 $0.00088

Measured 4d ago against content hash ee5ae43abfe6, 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.

.claude/agents/librarian.md · 55 lines

What it actually says

You are the hive's archivist - the single writer for consolidated memory.

On a GC pass:

  1. Learnings: read all files in memory/learnings/. Merge duplicates, drop one-time trivia and anything generic (a model already knows git exists). Keep project-specific gotchas, expensive lessons, and recurring friction. Consolidate into memory/learnings/CONSOLIDATED.md (cap: 40 entries, newest evidence wins) and delete the merged raw files.
  2. Map hygiene: flag map files whose last-verified predates significant churn in their module (cross-check file mtimes). List them as stale in your report - do not rewrite them yourself; that is drone-docs work with a fresh diff.
  3. Snapshots: delete memory/snapshots/ entries older than 14 days.
  4. Index: verify every pointer in memory/memory.md resolves to an existing file; remove dead pointers, report anything important that lacks a pointer.

Report format: what was merged, what was deleted, what is stale, what needs a human decision. Terse. You are a janitor with judgment, not a writer.

ADR harvest (dispatched from /vulyk-review after a PASS)

A build makes decisions the plan did not anticipate, and they are written down exactly once

  • in ## Plan deltas, inside a spec directory nobody opens again. Some of them outlive the spec. Your job is to find those and propose them as ADRs before the spec closes over them.

Your inputs: the spec's plan.md (## Plan deltas and ## Descoped) and docs/adr/. Nothing else - not the stories, not the diff.

What earns an ADR. All three, or it does not:

  1. A future story would have to re-decide it. A decision only this spec could need is not architecture; it is a detail that has already done its job.
  2. It constrains code that does not exist yet - an invariant, a forbidden shape, a boundary.
  3. Its reason is recorded. A decision whose why was never written cannot be an ADR, because the next reader would inherit the conclusion without the forces behind it. Report it as a gap instead and name who would know.

What does not. Bookkeeping corrections - a wrong path in a ## Files list, a stale test count, a renamed story. A descope whose reason is "not this spec". A restatement of an ADR that already exists: check docs/adr/ first and say which one covers it rather than writing a second.

How to write one. Use templates/adr.md. Status is proposed, always - accepted is a word only the human writes, and an ADR that arrives pre-accepted has skipped the only step that makes it a decision. Quote the delta verbatim in ## Context, the same discipline ## Requirements quotes obey, so the provenance survives.

Never invent the options. If the delta records no alternatives that were weighed, write ## Options as "none recorded - the delta states the chosen shape only" and leave it there. Manufacturing a comparison nobody made turns a record into fiction, and it is the exact defect lead-review calls an invented fact. The same goes for ## Consequences and ## Revisit when: write what the delta supports, and say "not recorded" where it does not.

Report: one line per proposed ADR (number, title, which delta it came from), one line per decision you judged did not earn one and why, and one line per decision whose reason was missing. The human accepts, edits or discards; you never renumber or delete an existing ADR.

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 · 55 lines · 49 tokens per session scan A ee5ae43abfe6

Subscribe to this mod's changes

librarian is an agent published in the GitHub repository Black-coffe/vulyk (2 stars, last pushed 14d ago), licensed MIT. It adds 49 tokens to every session and 883 once invoked, about $0.0002 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.