Skip to content

~/projects/sourcebook

Sourcebook

The source of truth your agents can cite.

Knowledge platform / RAG

Sourcebook landing page with the headline “The source of truth your agents can cite.” beside a preview answer that flags a conflict between 180-day and 90-day secret rotation

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

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

Screenshots(10)

  • The Ask page of the Kestrel Cloud workspace with three suggested questions, an input box with an Agentic toggle and an empty applicable-rules panel

    Ask

  • Library table of 100 documents with type, department, owner, review date and access level columns and filters

    Library

  • Graph centred on the offboarding process, with the rules and the Offboard a Leaver runbook that apply to it, and the it-helpdesk team that owns it

    Graph

  • Retrieval Lab after running a question about deploying payments-api: pipeline A, the Pinecone Assistant, waits to be run, while pipelines B and C show their latency, tokens, read units, estimated cost and sources

    Retrieval Lab

  • Agent Access with a form to create a personal API key, an active key that expires in 7 days, and the Claude Code command for connecting over MCP

    Agent Access

  • Admin docs list showing each document's rule count and version, with an Upload markdown button

    Docs

  • Findings queue listing conflicts between documents, including a secret rotation conflict of 90 versus 180 days, each with Acknowledge and Resolve buttons

    Governance findings

  • Jobs page with queued, running, done and failed counts above a list of recent ingest and eval jobs

    Jobs

  • Evals page with a form to start a run for pipelines A to E and a chart of docs recall@8 over time

    Evals

  • Usage dashboard with each limited resource against its budget, marked within budget or degraded

    Usage

1 / 11