June 17, 2026

The Librarian Agent — A Knowledge Base That Stays Coherent

How Datarim's Librarian agent keeps the datarim/ directory organized, cross-referenced, and free of contradictions — without ever changing the meaning of a document.

Every project accumulates documents faster than it organizes them. A PRD from three months ago references a task that was renamed. Two reflection files describe the same lesson in different terms. An index page still lists a file that no longer exists. None of these break the build, so they stay. Over time the knowledge base becomes the kind of place where you know the answer is in there somewhere, but finding it takes longer than just re-deriving it.

The Librarian agent exists to prevent that drift. It runs at /dr-dream and its entire scope is the datarim/ directory — not source code, not configs, only the project's institutional knowledge.

Three modes of work

Ingest handles new and misplaced files: moving them to the correct directory, fixing naming inconsistencies, and adding missing metadata. Lint is a health check — it scans for orphaned documents that nothing links to, broken cross-references, stale content, and naming inconsistencies. Consolidation goes further: merging duplicates, extracting recurring patterns, building or updating the index, and adding bidirectional links so that if document A references B, B also references A.

Every action the Librarian takes gets appended to datarim/history/activity-log.md, so the maintenance history is always auditable.

What it will not do

The Librarian flags contradictions — conflicting claims across documents — but does not resolve them. Resolving a contradiction requires a judgment call about which document is authoritative, and that is a human decision. The agent marks the conflict with a callout and stops. Similarly, files are never deleted silently: removals are proposed, not executed, until the operator approves.

A practical example

After a run of several tasks, the Librarian might report: two reflection files that discuss the same deployment lesson under different headings (merge candidate); one PRD that references a plan document by a filename that was later renamed (broken link); and four tasks in the index marked active that were archived two weeks ago (stale entries). The report proposes fixes; nothing changes until the operator says go.

Where it fits

The Librarian runs on a Sonnet-class model. Organizational work is structured and repetitive — it does not require the heavier reasoning reserved for architecture or security decisions. The agent is light enough to run at the end of a sprint as a routine maintenance pass, not just when something is visibly broken.

See the full capability list on the Librarian reference card, or read what Datarim is for the bigger picture.