librarian

librarian is a skill for Claude Code, Codex from ryanzhao1011/workframe. It costs 55 tokens per session (8,353 once invoked), scanned B, original, MIT.

A memory-maintenance role that reviews temporary notes and promotes well-supported facts into longer-term memory files. It also keeps shared knowledge concise and records what changed.

In plain words
What is it for?
Use it to classify notes, update role and shared memory, merge related facts, manage memory-size limits, and maintain an index and change log.
Why use it?
It prevents useful decisions from being lost in notes while limiting repeated or irrelevant information injected into every agent task. It helps resolve duplicate or conflicting memories using defined rules.

Skill for Claude CodeCodex

Part of the core plugin — 37 skills, 4 agents, 11 hooks shipped together

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 skills/ryanzhao1011/workframe/librarian
Any agent
npx skills add ryanzhao1011/workframe --skill librarian
Clone the repo
git clone --depth 1 https://github.com/ryanzhao1011/workframe

Made for: Claude Code, Codex.

Or install core, the plugin that ships this one along with the rest of its 37 skills, 4 agents, 11 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/skills/ryanzhao1011/workframe/librarian.svg)](https://agentmods.dev/skills/ryanzhao1011/workframe/librarian)
Your own site
<a href="https://agentmods.dev/skills/ryanzhao1011/workframe/librarian"><img src="https://agentmods.dev/badge/skills/ryanzhao1011/workframe/librarian.svg" alt="Measured on agentmods" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,353 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00055 $0.08353
Opus 5 $0.00028 $0.04176
Sonnet 5 $0.00011 $0.01671
Haiku 4.5 $0.00006 $0.00835

Measured 4d ago against content hash d78ab59b5e31, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

librarian scanned grade B with 1 finding 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

python "$(cat .claude/workframe-state/plugin-root.txt)/bin/workframe-recompute-skill-metrics"
plugins/core/skills/librarian/SKILL.md · 319 lines

How it starts

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

Librarian 记忆整理技能

6 步整理流程

第 1 步:读取状态(动态角色发现 + shared 特殊角色)

先处理 shared/(第 0 号"特殊角色")

Read .claude/agent-memory/shared/MEMORY.md(跨角色权威事实;不存在则跳过)
Read .claude/agent-memory/shared/notes.md(共享缓冲;不存在则跳过)

shared 层的整理规则与 role 层一致(D/U/R/A 评估、容量管理、快照保存),但写入条件更严:

  • 提升到 shared/MEMORY.md 必须满足"影响 ≥2 个角色" + D/U/R/A ≥2 项(主 Claude 不计入角色数,理由见 2b 三问第 3 问)
  • 单条压缩到 ≤200 字符。shared 是各 subagent 启动时全量注入的——每加一句,此后每次委派都要付一次 token;判据是「这句删掉,另一个域的人会不会做错事」,答否就删。展开论证留在 shared/notes.md 或权威文档,MEMORY 只留结论
  • shared 变更在整理日志中单列(与 role 层变更分开列,标明「本轮 shared 新增/修改 N 条」+ 逐条一行摘要),供用户事后复核。不逐条弹确认——已有「≥2 消费域 + D/U/R/A ≥2 + ≤200 字符」三道门槛,再加人工确认属于冗余打扰
  • 冲突以 shared/MEMORY.md 为权威,role MEMORY 中的同类条目降级为 notes

再动态发现项目中其他角色

用 Glob 扫描 .claude/agent-memory/*/  得到所有子目录,排除 shared
例如返回:[pm, dev, qa, prompt-eng](core 默认)
          [pm, dev, qa, prompt-eng, ceo, designer, ...](项目级扩展)

对发现的每个角色 <role>,读取其记忆文件:

.claude/agent-memory/<role>/MEMORY.md
.claude/agent-memory/<role>/notes.md

统计每个 MEMORY.md 的当前字符数(预算:role ≤8000 字符 / shared ≤4000 字符——字符才反映注入开销,行数可被单行超长钻空)。

为什么动态发现:core plugin 提供 4 通用角色(pm/dev/qa/prompt-eng),项目可手动在 .claude/agents/.claude/agent-memory/ 下新增项目级角色(如 ceo、designer、content-operator 等)。Librarian 必须覆盖所有角色,因此不能硬编码列表。

第 2 步:评估 notes.md + 决定落点

2a. D/U/R/A 准入评估

遍历每个角色的 notes.md 中的微反思条目,跳过下列两类已结案条目:

  • 标注 → 已提升至 X 的(本 SOP 自己提升过的)
  • 标注 → 已被 {日期} 纠正取代 的(correction-detection 第 3 步 supersede 时移进来的 历史留档)——它们是被推翻的旧口径,重新提升等于把用户纠正过的错误再送回高置信区
  • Durability:30 天后还重要?
  • Uniqueness:目标落点中尚未记录?
  • Retrievable:未来需要回忆?
  • Authority:来源可靠?

满足 ≥2 项 → 标记为"待提升"。

单人/小团队项目的判定口径:用户当面拍板的偏好,Authority 已满分,不要因为"是否对所有人普适"而压低评分——这类知识库只服务当前用户,普适性不是准入条件。历史上大量高价值偏好因这条误判滞留在 notes(实测某项目 181 行 notes 里全是可执行规则,却因自设"需多次验证"门槛从未提升)。

2b. 落点分层决策

MEMORY.md 不是唯一落点。按知识性质选:

落点 判据 加载时机 权限
项目 rules.claude/rules/local/*.md 跨场景稳定的纪律 / 口径,主 Claude 也需遵守 每次会话必载 L2 用户审批
CLAUDE.md 项目级协作规则、角色边界、目录约定 每次会话必载 L2 用户审批
项目 skill.claude/skills/<name>/ 场景触发且成套的操作方法——特定场景才需要、一到场景就要整套用(SOP / 口径集 / 模板 / 清单) 场景命中按需加载 L2 用户审批(core plugin skill 不直接改,走 self-iteration 提案)
<role>/MEMORY.md 角色特有的高置信事实 该 subagent 被调度时 L1 自主
shared/MEMORY.md 影响 ≥2 角色的权威事实 各 subagent 启动时 L1 自主(写入条件更严);agent / 主 Claude 不直写——它们写 shared/notes.md,由本 skill 评估提升(对比上一行:role MEMORY 满足 D/U/R/A ≥2 可由角色直写,两行的「L1 自主」含义不同)
auto-memory(CC 官方主 Claude 记忆目录) 主 Claude 层内容:用户偏好 / 协作习惯 / 项目状态指针——消费者是主 Claude 而非某个角色 主会话启动(官方注入,subagent 不注入) 主 Claude 自维护;librarian 不写——识别到此类条目时在结果中建议归 auto-memory
保留 notes 未定型 / 场景太具体 / 待验证 不加载
移出记忆体系 业务知识(竞品分析、方案论证、领域事实)→ 应进需求文档 / spec,不是记忆 L2

Read the full file on GitHub · 319 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 319 lines · 55 tokens per session scan B d78ab59b5e31

Subscribe to this mod's changes

librarian is a skill published in the GitHub repository ryanzhao1011/workframe (4 stars, last pushed 17d ago), licensed MIT. It adds 55 tokens to every session and 8,353 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

decision-ledger

Maintain an append-only decision ledger (DECISIONS.md). Use when the user confirms a decision, reverses or changes a past decision, asks what was decided and why, or at session start to load standing decisions.

svy04/ballast · 48 tokens

knowledge-base

Keep verified findings in memory/knowledge/ so the same research is never done twice. Use before researching any topic, when a finding passes the verify gate, or when about to answer from something learned in an earlier session.

svy04/ballast · 47 tokens

pin

Turn a correction or working preference the user just expressed into a permanent ballast rule. Use when the user corrects your behavior, says "don't do X" / "always do Y" / "I told you before", or asks you to remember how they want things done.

svy04/ballast · 57 tokens

brain-init

Scaffold a file-based memory system (index, decision ledger, open questions, session log, optional product truth file) so a project can serve as a durable second brain. Use when the user wants to set up memory, an external brain, or the ballast structure in a project.

svy04/ballast · 60 tokens

recall

Sweep everything the project already holds before answering — at the first message of a session, and again whenever the subject shifts to something the current thread was not about. Use before replying, not only before researching.

svy04/ballast · 44 tokens

project-model

When working in a codebase you've touched before, consult and update the persistent project model maintained by presence. The model lives at /.claude/presence/projects/ /model.md and contains terse notes about architecture, conventions, and verified facts. Use it BEFORE re-deriving things you've already learned, and…

sara-star-quant/presence · 86 tokens