Aegis
Aegis is a reference implementation for using LLMs on messy enterprise data. Its core is a semantic layer that tells a model what a cryptic schema means, measured as a text-to-SQL benchmark over a deliberately hostile, synthetic AS/400-era schema: on 120 held-out questions it lifted Sonnet 5 from 34% to 89% correct, and Haiku 4.5 with the layer beat the strongest model tested without it. A second theme, from November 2026, answers questions that need a company's documents as well as its tables: routed between search and extraction, it answered 94% of 117 held-out questions correctly, where the best search alone managed 74%. Routing sensitive workloads to local models is a third, unfinished one. Martin wrote it alone, August to November 2026.
Architecture
- A generator builds the synthetic database in DuckDB; a scale test used Odoo 18's 643-table schema.
- The layer is YAML (code meanings, encodings, metric definitions, join paths) sent to the model with each question.
- An eval harness runs frozen question sets, reports intervals over question families, labels each wrong answer's cause, and gates layer edits like CI.
- Connectors (SQL Server, Postgres, Snowflake, Databricks) measure questions on a real database without and with the layer.
- A container next to the data serves the layer and guarded, audited queries to assistants over MCP, and pulls signed layers from a FastAPI/React control plane over one outbound connection.
Documents
Some questions need documents as well as tables: which customers' contracts carry a late-delivery penalty, what a customer's payment terms are since an amendment, how much revenue came from customers whose agreement has ended. Search over documents fails silently, the way the schema traps did: a top-k search can't count "every contract that…", a superseded clause looks exactly like a current one, and a chunk forgets which customer it belongs to. So questions are routed by their shape. Lookups go to search. Counts, lists, version questions and anything joined to the ERP data go to extraction: every document is read once, offline, into tables with a verbatim quote per row, and SQL counts exhaustively. The ERP's own customer and item master is the catalogue documents are linked to.
- The corpus is 627 synthetic documents for the benchmark's fictional supplier: contracts, amendments, restricted annexes, complaint emails and tickets, and a handbook in three versions, 203 of them in Swedish and 28 PDFs. Each starts as a fact sheet drawn from the database's own rows; a model writes the prose and a check in code confirms every value is in the text. Traps are planted on purpose: negations, negotiated clauses that override the standard one, replaced agreements, customers sharing names, and instructions to the model hidden in emails.
- CUAD, 510 real commercial contracts with clause labels from lawyers, checks extraction and search on documents nobody on the project wrote.
- Chunks are clauses, sections or email messages, each with a context line written by Haiku 5.5 saying which document, customer and section it belongs to; fixed windows are the comparison.
- Entity linking is code, not a model: stated customer and order numbers first, then names, and where customers share a name, the one that received the item mentioned.
- Embeddings come from bge-m3, multilingual and run locally, so the corpus never leaves the machine. Vectors and BM25 live in DuckDB, the engine of the rest; no vector database. Retrieval is compared dense, BM25, hybrid with a Haiku rerank, and hybrid with filters, and every search is limited to the caller's access before ranking.
- Passages reach the model through the same MCP server as the SQL path. An answer must cite a passage and quote the words it rests on, and the quote is checked against that passage in code, not by an LLM judge.
- 153 questions in 50 families, gold answers computed by SQL on the truth database, were frozen with 13 predictions registered before any test run. Six configurations answer them through the assistant's own tool loop: no documents, dense search, hybrid search with reranking, hybrid with filters, routed, and an oracle handed every document in scope.
Results, Haiku 5.5 on 117 held-out questions, three repeats each: routed 94% correct, the best search-only configuration 74%, no documents 14%. On count and list questions routing scored 92% and search 5–16%, below even the oracle handed every document in scope (63%). On questions joining documents to database data, routing scored 84%, search 18–31% and the oracle 47%. Where search is the right tool (a clause someone asks about, the version in force, Swedish-only evidence, the reason behind a complaint) every search configuration scored 87–100%. A stronger model doesn't make search count: Sonnet 5 with search scored 16% on counts, often declining rather than guessing, and 84% with routing. Routing was also the cheapest, about $1.02 per 1,000 answers against $5.68–6.14 for search. No restricted value leaked in any configuration, none of 81 instructions planted in documents was followed, and nothing was written to the database. Citations are the weak spot: 70% of the routed answers' citations quote words found in the cited passage, and most of the rest cite without quoting.
Before any answer model: context lines lifted clause recall@5 from 29% to 80% on the 67 held-out questions a search can answer; on Swedish-only questions hybrid retrieval found 83% against 30% for BM25; every document was linked to a customer and none wrongly. On CUAD, extraction scored a macro F1 of 0.83 over 10 clause types, and asked which of 100 contracts contain a clause, top-10 search found 17% of them and extraction 91%. The PDF parser made no difference to finding clauses, only to how often quotes matched the text verbatim (94% against 87%).
The registered decision rule did not pass. It needed two predictions: the routing one held by a wide margin, but the other said every configuration without routing would score 35% or less on documents-plus-data questions, and the oracle scored 47%. 7 of 13 predictions held. Among the failures: filters added no accuracy on lookups, where search was already at 96%, and a date filter that left a superseded clause in the top 5 for 53% of version questions (the prediction said 10% or less) didn't mislead the model, which answered 98% of them right. Three grading rules were fixed after the test answers were seen; every verdict is the same under the rules frozen before the runs except one about declines. The model calls for the whole study cost about $30. Next, the same ingest is to propose semantic-layer entries from documents, with citations.
Decisions
- A read-only database login is the boundary, beyond the harness's own single-SELECT guard, because the login makes a mistake harmless.
- Offline runs use the Message Batches API instead of direct calls, at half the price.
- Reference answers are verified on the live database before any model runs, because a wrong reference answer makes a right model look wrong.
- Questions over documents are routed by their shape instead of tuning search harder, because ranking can't count or apply validity, however good the reranker.
- Extracted rows land in the same tables as the truth, so one gold query runs on both and separates a wrong extraction from a wrong answer.
- Gold answers stay real-world truth even where the documents can't support them; those are labelled unreachable, not dropped.
Stack
Python, DuckDB, Pydantic, sqlglot, Anthropic SDK, Ollama, bge-m3, SQLAlchemy, MCP, FastAPI, React/TypeScript, Streamlit, Docker.
Evidence
- Martin built a semantic layer that tells a model what a cryptic legacy schema means. On 120 held-out text-to-SQL questions it lifted Sonnet 5 from 34% to 89% correct, and it added 36 to 68 points on every model and schema tested. (measured; reproducible by him. Limits: 120 held-out questions on one synthetic legacy schema; measured in his own harness, not independently)
- He routed questions over documents between search and extraction: with Haiku 5.5 that answered 94% of 117 held-out questions correctly, against 74% for the best search alone, and 92% of count and list questions, against 5–16%. (measured; reproducible by him. Limits: the registered decision rule did not pass: an oracle handed every document scored 47% on documents-plus-data questions, above the predicted 35%; a synthetic corpus of 627 documents, written by a model from fact sheets designed alongside the questions; three grading rules fixed after the test answers were seen; one verdict differs under the frozen rules; 70% of routed answers' citations quote the cited passage; most others cite without quoting)
- On a schema he did not design, Odoo 18 with 643 tables, the layer and 160 questions were frozen before any model call; the layer then moved Haiku 5.5 from 19% to 78% correct on 120 held-out questions. (measured; reproducible by him. Limits: one ERP schema (Odoo 18) seeded with synthetic trading; his own harness)
- With the layer, the cheapest model tested matched the strongest: Haiku 5.5 scored 92% on held-out questions, level with Opus 5.5 at a 29th of its cost per correct answer. Without the layer it scored 30%. (measured; reproducible by him. Limits: the same synthetic schema; costs at list prices when measured)
- His ablation showed where the value lies: removing exceptions and encodings cost 39 to 41 points and metric definitions 18 to 23, while documented join paths cost nothing measurable. The knowledge nobody writes down carries the result. (measured; reproducible by him. Limits: one schema family, ablated in his own harness)
- He ran it as an experiment, not a demo: questions frozen before measuring, predictions registered before the first call, intervals over question families, and the four predictions that failed published beside the ones that held. (self-reported; his own records)
- He made the evaluation a CI gate for the layer, since an edit to it changes business meaning: an edit that redefined net revenue was blocked when five questions went from 9/9 right to 0/9, while a harmless rewording passed. (measured; his own records. Limits: one edit blocked and one passed: a demonstration, not a rate)
- For questions that need documents as well as tables, he routes by the question's shape: lookups go to search, while counts, lists and version questions go to extraction into tables with a quote per row, since ranking cannot count or apply validity. (self-reported; his own records. Limits: the registered decision rule did not pass: one of its two predictions failed)
- On CUAD's real contracts, asked which of 100 contain a given clause, top-10 search found 17% of them and his extraction 91%, at about 83% precision. (measured; reproducible by him. Limits: retrieval and extraction only, no answer model; CUAD is not linked to ERP data)
- He checked that answers are right for the right reason: re-grading about 4,600 correct answers against three databases generated from other seeds changed 45 of them. (measured; reproducible by him. Limits: the neighbour databases come from the same generator)
- He built the controls around it: per-role databases, a scope guard that catches misleading answers, a hash-chained audit log, and an MCP server that gives assistants the layer with guarded, audited queries. (self-reported; his own records)
- He showed that a stronger model does not make search count: Sonnet 5 with search answered 16% of count questions, often declining rather than guessing, and 84% with routing. (measured; reproducible by him. Limits: three configurations only for Sonnet 5)
- Across every configuration no restricted value leaked, none of 81 instructions planted inside documents was followed, and nothing was written to the database. (measured; reproducible by him. Limits: instructions he planted himself, in a synthetic corpus)
- A context line per chunk, saying which document, customer and section it belongs to, lifted clause recall@5 from 29% to 80% on his frozen document questions. (measured; reproducible by him. Limits: a synthetic corpus of 627 documents, written by a model from fact sheets designed alongside the questions)
- He recorded a failed prediction: filtering by date in force did not remove superseded clauses, which stayed in the top 5 for 53% of version questions, because an amended contract is in force while its old clause is not. (measured; reproducible by him. Limits: the stale clause did not mislead the model: it answered 98% of version questions right; clause-level supersession is not handled yet)
- Records
- 2,219, Aug 2026 – Nov 2026
- Languages
- python 28%, data 26%, docs 22%
- Frameworks
- MCP 118, Anthropic SDK 106, Pydantic 50, pandas 38, pytest 23, FastAPI 21
- Kinds of change
- docs 41%, LLM & evals 15%, tests 9%
Kronspar
Kronspar (Kronspår) is an analysis pipeline over Swedish open procurement data. It points to where competition looks weaker than expected or where spend has no visible procurement behind it, framed as prompts for review, never findings of wrongdoing. Martin wrote it alone, in October 2026.
Architecture
- A
kronspar CLI ingests and caches open data: Upphandlingsmyndigheten statistics, TED eForms notices, Bolagsverket company data, Kolada peer groups, state framework agreements from avropa.se, and supplier ledgers from municipalities that publish them, some discovered automatically on Sveriges dataportal. - Build runs SQL models in DuckDB. The competition layer flags, for example, a high single-bid rate against the national rate for the same year and CPV division, repeat winners and newly registered winners. The spend layer links each supplier's yearly spend to a procurement or framework agreement, triages large unmatched spend, and lists suppliers worth sampling per committee or department.
- Outputs: a Streamlit dashboard, Swedish follow-up reports (HTML and PDF) and sampling CSVs.
- Personal identity numbers are pseudonymised at load, and names of natural persons are dropped.
Decisions
- The dashboard reads a snapshot that each build publishes, not the working database, so ingest and build can run while it is open.
- Reports are written to read well if published: points are phrased as questions, never conclusions.
- Adda framework links count as weaker than state framework links, because the municipality's connection cannot be verified in open data.
Stack
Python 3.13, DuckDB/SQL, httpx, lxml, Streamlit, Altair, uv, pytest.
Evidence
- Checked against published audits of municipal purchasing, 11 of the 15 suppliers on Kronspår's sampling list had drawn an auditor's remark. He reports it as in-sample: two rules were tuned on the same audits, and with the earlier rules 7 of 9 had. (measured; his own records. Limits: in-sample: two rules were tuned on the same audits; 15 suppliers, from a few published audits)
- He built a pipeline that joins Sweden's open procurement statistics, EU tender notices, the company registry and municipal supplier ledgers in DuckDB, finding published ledgers on the national data portal and mapping each file's columns from its header. (self-reported; his own records)
- Every signal compares a buyer with the national rate for the same year and CPV division, or with similar municipalities, and is framed as a prompt for review, never a finding of wrongdoing. (self-reported; his own records)
- He classifies each supplier's yearly spend by how it can be explained (the buyer's own procurement, a state framework it is connected to, other legal regimes) and counts framework matches that can't be verified as weaker. (self-reported; his own records)
- Records
- 315, Oct 2026 – Oct 2026
- Languages
- python 46%, sql 30%, docs 16%
- Frameworks
- pandas 35, pytest 6
- Kinds of change
- schema & SQL 30%, docs 16%, tests 4%
kamb.nu
kamb.nu is a model of Martin made of the records of his own work: one point per changed block of code in his commits, extracted on his machine as metadata only. Every view is a query over those records, and one command language is shared by the console, the links, the suggested questions, a language model and an MCP server. Martin wrote all of it, from October 2026.
Architecture
- An extractor reads his repositories locally and keeps only metadata: time, project alias, language, lines added and removed, kind of work, and which frameworks the changed file imported. The records are stored as columnar typed arrays.
- A GPU spring simulation moves every record toward a target computed in shared GLSL, so each point keeps its identity through every view: rings of years, projects, languages, years, a CV and an architecture.
- A command language defined in zod drives a pure reducer; the console, links, the model and MCP all emit the same commands, and the state is the link.
- The model answers in the third person from a cached corpus and one query tool over the records. Each step is validated before it reaches the browser, and each number is checked against the queries that answer ran.
- A Cloudflare Worker serves the site, the model endpoint, the MCP server and live presence. Commits arrive live from post-commit hooks, and a nightly job re-extracts the records, commits them and deploys.
Decisions
- Metadata only: commit messages, file paths and code never leave his machine, and client work is aliased.
- One command language for visitors, links and the model, so the model can do nothing a visitor couldn't type.
- Numbers come from queries, never from the model's memory, and the published evals check it.
- Results and decisions come from evidence Martin wrote, each marked with who stands behind it, beside the records of the work behind it.
Stack
TypeScript, three.js (WebGL2, GPGPU), zod, Vite, Cloudflare Workers and Durable Objects, the Claude API, MCP, Node's test runner.
Evidence
- Every number the model states about the records has to come from a query it ran in that answer; the worker checks each one against those results, and the published evals count how many held. (measured; anyone can check. Limits: the check matches the named row's value, not the meaning of the sentence)
- One command language, defined in zod, is shared by the console, links, suggested questions, the model and an MCP server, so the model can do nothing a visitor couldn't type. (self-reported; anyone can check)
- With a cached corpus and one query tool, Haiku 5.5 is within a case or so of Sonnet 5.5 on the published evals, at about a twentieth of the cost per question. (measured; anyone can check. Limits: 52 cases, one run per model, graded by rules)
- Records are extracted on his machine as metadata only; framework use is read from the changed file's imports and then dropped, and commit messages, paths and code never leave it. (self-reported; anyone can check)
- Each point is a real record and keeps its identity through every view, because one GPU simulation moves every record toward targets computed in shared GLSL. (self-reported; anyone can check)
- Records
- 1,096, Oct 2026 – Nov 2026
- Languages
- typescript 78%, docs 7%, json 7%
- Frameworks
- three.js 265, zod 106, Anthropic SDK 37, React 1, Redux 1
- Kinds of change
- frontend 55%, schema & SQL 13%, tests 9%