AI Lab
FactLayer: a knowledge layer for AI agents
Models answer from a memory with a cutoff. Web search is slow, expensive in tokens and often wrong. FactLayer sits between the two: a shared, verified store of knowledge units that any model reads over one open protocol, in a fraction of the tokens.
The problem
Every agent repeats the same lookups: which version is current, what a package requires, what a company does today, what changed last week. A model answers from training data that may be a year old, or it searches the web and spends six hundred tokens reading three pages, with no record of what it found. Neither path verifies anything, and nothing is shared between calls.
What it is
A resolver that agents call as a tool. It exposes three operations over MCP:lookup for a question, get for a known subject and attribute, optionally at a past date, and check_claim to test a sentence against the store. Every answer is a block of knowledge units in the Knowledge Unit Protocol (KUP): one line per unit, with its as-of date, confidence, volatility, sources and previous values.
# kup/0.1 n:2 lvl:full sub:pypi:pandas q:pypi:pandas latest_version
fact|latest_version|3.1.0|t:2026-10-29 c:9 v:m vf:2026-10-22 id:958
>src|url|https://pypi.org/project/pandas/|t:2026-10-22
>prev|latest_version|3.0.6|vt:2026-10-22
fact|requires_python|3.11|t:2026-10-29 c:9 v:sAbout 18 tokens per unit. Ten unit types cover facts, stats, events, claims, advice, warnings, how-tos, definitions and relations.
How it works
- 01Understand
The question is mapped to a subject and the attributes it needs, with the caller’s context and model cutoff taken into account.
- 02Resolve from the store
A hit returns stored units at once. Each unit carries its as-of date, confidence, volatility and the sources behind it.
- 03Source routing on a miss
Primary sources come first: package registries, Wikidata, the official site. Web search is the last resort, not the first.
- 04Grounded extraction and verification
Every extracted value must appear in the source text. Claims are merged across independent sources; disagreements are kept as disputes, not averaged away.
- 05Learned freshness
Each unit is re-checked on an interval learned from how often it actually changed. Previous values stay as history, so an agent can see what changed since its cutoff.
Measured
Benchmark v2: 526 questions about Python and npm packages, in six classes (current version, release date, deprecation, license, Python support, Node engines) plus 22 hand-written advice questions. Four arms per model: memory only, raw web search (top three results), the layer, and the layer with registries disabled so every answer goes through search, extraction and verification. All models are small local ones running on a Mac; no API spend.
Structured questions (504)
| Model | Memory | Web search | Layer | Layer, GitHub truth | Tokens per answer, layer vs web |
|---|---|---|---|---|---|
| Qwen3.5-4B | 19.4% | 57.1% | 72.6% | 95.5% | 218 vs 730 |
| Gemma-4-E2B | 16.9% | 48.6% | 73.0% | 95.5% | 226 vs 755 |
Small model plus layer against a larger model alone
| Setup | Accuracy | GitHub truth | Prompt tokens | Median latency |
|---|---|---|---|---|
| Qwen3.5-2B alone | 20.4% | 3.5% | 80 | 0.63 s |
| Qwen3.5-2B + layer | 73.4% | 99.0% | 358 | 2.71 s |
| Qwen3.5-9B alone | 24.4% | 6.0% | 80 | 1.63 s |
Where memory was wrong and the layer was right
| Question | Memory | Layer | Truth |
|---|---|---|---|
| Latest released version of pydantic on PyPI? | 2.11.0 | 2.14.1 | 2.14.1 |
| Under which license is psycopg released? | BSD 2-Clause | LGPL-3.0-only | LGPL-3.0-only |
| Minimum Python version for pandas 3.0.6? | 3.10 | 3.11 | 3.11 |
Caveats, stated plainly
- 200 of the 504 questions have truth from GitHub releases, independent of the layer. The other 304 use registry metadata, which is also the layer’s primary source, so the registry path is an upper bound.
- The web-only path, where every answer goes through search and extraction, scored 38 to 39% against 49 to 57% for raw search. The 22 advice questions scored 23 to 36% against 50 to 59%. Both ran on a 4B local extraction model, and both are the next thing to fix before a second domain is opened.
- The showcase domain is software packages. Other domains are not yet claimed.
Why a protocol
The format is the boundary. KUP is small enough to fit in a tool description, carries provenance and time on every line, and costs about half the tokens of compact JSON. The protocol is open; publishers can sign their own units, and any resolver can speak it. The hosted resolver, its verification pipeline and its history are the service.
Status
- Working resolver with MCP over stdio and HTTP, bearer-token auth and rate limits.
- Store of 51,000 units across the showcase packages, refreshed on a learned schedule.
- Per-model error registry from the benchmark: 1,079 recorded wrong answers across four models.
- Next: the protocol spec and the benchmark as public repositories, a hosted extraction model for the web path, a self-hosted node for company knowledge.
Early access, partnerships and questions: hi@omerodabas.com