librarian

librarian is an agent for Claude Code from braininahat/brains-in-a-hat. It costs 602 tokens per session (3,814 once invoked), scanned A, original, MIT.

A librarian agent for a shared vault of knowledge across related code repositories. It stores selected learnings, important decisions, wiki concepts, and session journals while keeping repository-specific notes elsewhere.

In plain words
What is it for?
Use it to record cross-repository lessons, maintain decision records, organize concepts, and retrieve shared project memory.
Why use it?
It keeps shared knowledge curated and prevents local facts or personal preferences from being copied into a common archive unnecessarily.

Agent for Claude Code

Written for Claude Code: PostToolUse hook event. Also seen: model in frontmatter; reads .claude/ paths.

Part of the brains-in-a-hat plugin — 1 skill, 5 agents, 9 hooks shipped together

Good fit Use it to record cross-repository lessons, maintain decision records, organize concepts, and retrieve shared project memory.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/braininahat/brains-in-a-hat/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/braininahat/brains-in-a-hat

Made for: Claude Code.

Or install brains-in-a-hat, the plugin that ships this one along with the rest of its 1 skill, 5 agents, 9 hooks.

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/braininahat/brains-in-a-hat/librarian/github.svg)](https://agentmods.dev/agents/braininahat/brains-in-a-hat/librarian)
Your own site
<a href="https://agentmods.dev/agents/braininahat/brains-in-a-hat/librarian"><img src="https://agentmods.dev/badge/agents/braininahat/brains-in-a-hat/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 librarian

Your own site · 80×15
<a href="https://agentmods.dev/agents/braininahat/brains-in-a-hat/librarian"><img src="https://agentmods.dev/badge/agents/braininahat/brains-in-a-hat/librarian.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 602 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,814 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.00602 $0.03814
Opus 5 $0.00301 $0.01907
Sonnet 5 $0.00120 $0.00763
Haiku 4.5 $0.00060 $0.00381

Measured 10d ago against content hash da1beefef89b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 10d 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.

brains-in-a-hat/agents/librarian.md · 229 lines

How it starts

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

You are Dewey, the Librarian. You maintain the user's cross-repo, vault-scoped memory: shared learnings across a project constellation, decisions worth an ADR, wiki concepts, and the session journal. Your job is curation, not accumulation — the vault must stay useful, not become an archive nobody reads.

Scope boundary — read this first

Per-repo learnings and user preferences live in the harness project memory (~/.claude/projects/<slug>/memory/), written directly by team-lead — not by you, not in the vault. If the transcript slice you're given contains something that reads like a repo-local correction or a personal preference ("in this repo, always X", "I prefer Y"), ignore it unless it's explicitly cross-repo (applies to more than one repo in a projectGroup) or rises to the level of a decision worth an ADR. Never duplicate a repo-local fact into the vault "just in case" — that duplication is exactly the archive-not-memory failure mode this split exists to prevent.

You only exist when a vault is configured. If you were never spawned this session, there's no vault — team-lead handles memory entirely through harness project memory and tells the user cross-repo/decision/journal features are off.

What the vault is

A graph-database-without-a-database-server: flat markdown files at $BRAINS_VAULT_DIR (default ~/.hatbrains), each with YAML frontmatter. Edges between notes are [[wikilinks]] and shared frontmatter values. Discovery is via Obsidian Dataview at read time.

Layout (flat, no subdirs):

  • <projectGroup>--shared--learnings.md — cross-repo learnings for a constellation (bulleted body)
  • <projectGroup>--session-log.md — chronological work entries
  • <descriptor>--decision.md — one file per decision (ADR-like)
  • <concept>.md — wiki entries (no suffix; type: wiki in frontmatter)
  • research-cache--<subtype>--<shorthash>.md — cached external research (auto-written by capture-research hook; curated by you)
  • index.md — top-level dashboard (Dataview queries)

Read the full file on GitHub · 229 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. 10d ago First seen · 229 lines · 602 tokens per session scan A da1beefef89b

Subscribe to this mod's changes

librarian is an agent published in the GitHub repository braininahat/brains-in-a-hat (4 stars, last pushed 2mo ago), licensed MIT. It adds 602 tokens to every session and 3,814 once invoked, about $0.0030 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.

Related

Other agents, from other repositories

context-finder

Read-only, memory- and index-aware codebase search. Use for any investigation — "where is X", "how does Y work", "what calls Z", "is W still used", "where is V configured", "does this event/pattern get emitted anywhere" — BEFORE reaching for grep. Consults the knowledge graph, code index, and prior session memory…

futuregerald/futuregerald-claude-plugin · 111 tokens

wiki-ingest

Use this agent when ingesting URLs, files, or pasted text into the vault during automated maintenance cycles. Typical triggers include dev-loop IDLE DISCOVERY ingestion, batch source processing, or converting raw captures to typed-knowledge pages. See "When to invoke" in the agent body for worked scenarios.

karlorz/llm-wiki · 64 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

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

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens