Factoid
Factoid turns documents into short facts, each pinned to the exact passage it came from. Your agents search those facts instead of re-reading the documents on every question.
- Python 3.13+
- MIT license
- v0.1.34
- updated yesterday
uv tool install factoid
- 92% accuracyThat’s the share of questions facts got right on a 512-token budget, against 57% for chunks. The test asked 200 questions about news transcripts.examples/mediasum
- 12.89× lower costThat’s how much less it cost to read facts than raw documents in our paper’s test. Facts were also right in 30 of 30 trials over revised and deleted documents, against 1 of 30.arXiv 2609.29661
- CitedEvery fact carries its exact source quote or table cell, speaker, and timestamp. Factoid’s code attaches them, not a model.README, Design
What is a fact?
Example fact
text: >Samir Patel said that Kestrel Health's finance teamonly approved 30 analyst seats for the initial rolloutin the morning of October 14, 2026 budget check, not 45.class: CustomerFacttraits: [Pricing]status: currentquotes:- text: >Finance only approved 30 analyst seats for theinitial rollout in this morning's budget check, not 45.speaker: Samir Patelat: "05:24"entities:- { name: Samir Patel, kind: Person, role: speaker }- { name: Kestrel Health, kind: Company, role: about }valid_from: 2026-10-14expires: never
Anatomy of a fact
- text
- One short, self-contained sentence stating a single claim, with no pronouns or filler.
- class
- The kind of fact: here
CustomerFact, and you can define your own Python classes. - traits
- Optional domain labels you define for the model to apply: here
Pricing. - status
- Whether the fact still stands (
current) or was superseded, ended, corrected, contradicted, or retracted. - quotes
- Exact source passages attached by Factoid’s code, with speaker and timestamp: here Samir Patel at 05:24.
- entities
- Linked people, companies, or things, with their kinds and roles: here Samir Patel and Kestrel Health.
- valid_from
- When the fact became true or happened, resolved against the document’s date for as-of search.
- expires
- How the fact ages in search:
never(history),estimated(until changed), orat_deadline(settled by a date).
How a fact is identified
1Source content goes inSource content goes in
2Factoid pulls out facts. Here are 3 examples.Factoid pulls out facts
3 example facts from this call
- Elena Ortiz said that Kestrel Health planned 45 analyst seats for the initial rollout of the new analytics platform.02:05
- Maya Lin said that Northstar Data's Enterprise tier pricing is $96,000 a year for 45 seats and includes SAML SSO and full audit logs.02:51
- Samir Patel said that Kestrel Health's finance team only approved 30 analyst seats for the initial rollout in the morning of October 14, 2026 budget check, not 45.05:24
3Facts are available to your agentsFacts are available to your agents
How many seats is Kestrel starting with?
30. Finance approved 30 analyst seats for the initial rollout, not the 45 Elena planned.
From Samir Patel’s fact at 05:24
When facts beat chunks
Classic RAG wastes token budgets on surrounding filler text that doesn’t answer the question. Compiled facts strip out the noise. They resolve speakers and pronouns into single, self-contained claims that cut query costs without sacrificing accuracy.
Large token budgets mask this bloat: on MediaSum broadcast transcripts, facts and raw chunks tie at 8,192 tokens. Tighten the budget, and chunk accuracy collapses. At 512 tokens, facts still hit 92% accuracy, while chunks drop to 57%.
Research papers
Factoid is built on Endgame’s applied research and production deployments, alongside three core papers on compiling facts at ingest. Together, they demonstrate how ingest-time compilation outperforms standard RAG on accuracy, revision tracking, and cost.
- RAG Deserves an Index: Why Ingest-Time Compilation Beats Query-Time InterpretationOn 500 interview transcripts, facts compiled once at ingest answered 85.2% correctly from about 2.2k tokens. Raw chunks managed 72.5% from 16.3k.arXiv 2608.20845
- Ingest-Time Fact Compilation for Cost-Efficient and Reliable Question Answering over Revised CorporaSettling revisions, deletions, and effective dates once, at ingest, got 30 of 30 trials right, at 12.89 times lower read cost. Reading raw documents got 1 of 30.arXiv 2609.29661
- Cost Scales with Change, Not Corpus Size: Incrementally Maintaining an Evolving Semantic SubstrateUpdating only what changed ran 33.7 times cheaper than a full rebuild and gave the same result.arXiv 2608.16621
Define your own traits
Use traits to tell Factoid which domain-specific facts to find and tag.
Traits are standard Python classes. Just write a one-line docstring to define what the model should look for. You can also set confidence thresholds or add hooks to react to changes. Here, we alert the deal team whenever a newer document changes a liability cap.
# facts.pyfrom factoid import Fact, FactTraitclass ConsentRequired(FactTrait):"""A named party must approve an action before it happens."""class LiabilityCap(FactTrait):"""A limit on how much a party can owe."""threshold = 0.8@classmethoddef after_supersede(cls, fact, older):notify(fact.deal_team, f"Liability cap changed: {older.text} -> {fact.text}")class SourceFact(Fact):"""What a contract, a client, or the other side says."""traits = [ConsentRequired, LiabilityCap]
Other projects
CerebroCerebro is a knowledge system for agents that you run yourself. It builds a wiki from your sources, cites every claim, and keeps itself up to date, so your agents give more accurate, consistent answers.
BlowfishBlowfish is a self-hosted search engine that stores everything in your own S3-compatible bucket. It speaks the turbopuffer API, so you can switch from turbopuffer by changing the base URL and API key, not your code.
SalesWorldsSalesWorlds is a free, synthetic sales dataset for testing AI that answers sales questions. Any company can use it commercially under CC BY 4.0 to test a product and publish results.
SkimmerCommand-line tool · Go · MITA command-line filter that saves coding agents tokens. Give it a web page, files, or a list and a goal, and it keeps only the parts that help, so the model reads less and isn’t distracted by the rest. In its own example, a 71k-character page comes down to 7.6k.GitHub
UnderstudyProxy server · Rust · MITUnderstudy is a drop-in, CPU-only proxy that slashes API bills for high-volume data pipelines. It shadows your primary model, trains tiny local models on repetitive questions, and takes over once they match quality. It also continuously audits for drift and falls back to the main model if accuracy slips.GitHub











