Sourcebook
The source of truth your agents can cite.
Knowledge platform / RAG
Overview
Companies have rules, but nobody can find the right one at the right moment, and the documents disagree. Coding agents don't know the rules at all and will deploy to production without the change ticket the policy requires. Sourcebook turns a company's policies, standards, runbooks and agent skills into precise, cited context. People use it through a chat UI, and AI agents through MCP and a REST API.
Documents are compiled once, when they are ingested. An LLM turns each one into atomic MUST, SHOULD and MAY rules, entities and graph edges, and governance checks flag conflicts, stale documents, dangling references and expired exceptions. At question time, a walk over the entity graph in Turso finds the rules that apply, even ones that share no words with the question, and hybrid search in Pinecone finds the passages. People get a streamed answer with citations. Agents get a context pack: typed rules, each cited to a document section with the reason it applies, plus skills and warnings.
The demo company is Kestrel Cloud, a fictional SaaS company of about 320 people. Its corpus is 100 synthetic markdown documents, with some problems planted on purpose so the governance features have something to catch: a conflict (secrets rotate every 90 days in one document and every 180 in another), a superseded document, a stale one, an expiring exception and a dangling reference.
It is a Bun monorepo: a TanStack Start web app that also runs the background worker, a stateless MCP server on Cloudflare Workers, and a package of shared schemas. It runs on Node.js and entirely on free tiers. Sourcebook comes in English and German. On the live site you can sign in with one click as a demo user or a demo admin and try everything, since the demo data resets every night.
- Type
- Knowledge platform and RAG
- Works with
- People, and agents over MCP or REST
- Languages
- English and German
- Status
- Live, demo resets nightly
Highlights
01
Compiled, not just chunked
Rules, a knowledge graph and governance findings are built once at ingest, so queries are cheap and explainable.
02
Graph-based retrieval in plain SQL
A recursive query on Turso follows relationships, such as payments-api being part of tier-1-services, which a rule applies to. Each rule keeps the path that made it apply.
03
Built for agents
A stateless MCP server on Cloudflare Workers returns context packs, and agents can rate them to improve future ranking.
04
Explainable and measured
Every answer writes a trace. A Retrieval Lab compares five pipelines side by side, and a custom eval runner scores them on a 41-question golden set, 33 in English and 8 in German.
Stack
- 01Frontend
- TypeScriptReactTanStack StartTanStack RouterTanStack QueryTanStack FormTanStack TableTanStack StoreTanStack ChartsTanStack MarkdownTailwind CSSshadcn/uiReUIBase UIParaglide JS@xyflow/reactShiki
- 02Backend & data
- Node.jsBunSQLiteTursoDrizzle ORMPineconeBetter AuthValibotCloudflare Email Sending
- 03AI & agents
- TanStack AIOpenRouterMCPPinecone Assistant
- 04Tooling & hosting
- RailwayCloudflare WorkersGitHub ActionsBlacksmithOxlint
Workflow
From a markdown document to a cited answer, with the heavy work done before anyone asks.
Ingest
- A background worker parses each markdown document
- It chunks the text by heading and indexes the chunks in Pinecone
- Every step is idempotent and keyed on the content hash, so reruns are safe
Compile
- An LLM turns each document into atomic MUST, SHOULD and MAY rules, entities and graph edges
- Governance checks flag conflicts, stale documents, dangling references and expired exceptions
- It happens once at ingest, so queries stay cheap and explainable
Retrieve
- An LLM router analyses the question
- A recursive SQL walk over the entity graph in Turso finds the rules that apply, even ones that share no words with the question
- Hybrid search in Pinecone, dense plus full-text fused with RRF, finds passages, followed by a budget-gated rerank
- Everything is filtered by the user's clearance
Answer
- People get a streamed answer with citation chips, an applicable-rules panel and a “why this answer” trace
- Agents get a context pack: typed rules, each cited to a document section with the reason it applies, plus skills and warnings
- They fetch it through 7 MCP tools or the REST API with a personal API key, and can rate it afterwards
The app
One knowledge base, used by people in a chat and by agents through tools.
Ask
- Streaming answers with citations
- Citation hover cards
- An applicable-rules panel
- A trace drawer that shows why the answer came out as it did
- An optional Agentic mode
Library & Graph
- Browse documents with version diffs and their extracted rules
- Explore the entity graph
Retrieval Lab
- Compares five pipelines side by side on the same question
- A is the managed Pinecone Assistant, B is vector only and C is hybrid plus rerank
- D is the full Sourcebook pipeline
- E is agentic: the LLM drives seven tools itself
Agent Access
- Personal API keys
- Copy-paste setup for Claude Code and Cursor
- A context-pack playground
MCP tools
- get_context_pack and search_knowledge
- get_document and get_rule
- list_skills and get_skill
- report_outcome
Admin
- Document editing and compile runs
- A governance findings queue
- A view of the job queue
- Evals and a usage dashboard










