The catalogue
Kar's pattern libraries answer a job with a verified pattern before any AI model is asked. Until now the router asked every pattern in the library, one by one, for every message: fine for a small library, too slow at tens of thousands. The catalogue gives every pattern an address and files it under one of its own words, so for each message only the patterns that could fire are asked. The library's own law still decides every match, so the answer cannot change. It is checked against the old way on every held-out message, and you can re-run that check in this tab.
Try it
Type a message a bank customer might send. The router reads it through the catalogue and, beside it, the old way (every pattern asked). They must agree.
Start here
- Press Route it. You see the message's words, the few patterns the catalogue looked up, the one that fired first (the team the message goes to) and any others that also fired (a conflict). The old way's answer is shown beside it.
- Read "asked". That is how many patterns were asked about this message. The old way asks every pattern in the library.
- Read Measured. On every message the libraries never learned from, at every library size, the catalogue and the old way are compared message by message.
- Press Re-run it here (below) to download the public data and repeat the whole check in your browser. Then pick the largest library in Try it and route your own message through tens of thousands of patterns.
How it works
Traced from a real run
Computed when the page loads: the example message above, through the real routing library, step by step.
- Running…
Why it can never give a different answer
Every pattern is filed under exactly one of its own words. A pattern fires only when all of its words are in the message, so whenever it fires, its filing word is in the message, and looking up the message's words finds it. The catalogue can find patterns that do not fire: "card + arrive", filed under "arrive", is found for "my parcel will arrive late", but "card" is missing. Such a pattern costs one check and nothing else, because the catalogue hands every one to the library's law, which decides with the same fires() the old way uses. The patterns that fire are put back in library order. So the first one, the conflicts and the answer are the old way's, exactly. The tests and the measurement check this rather than assume it.
The address
Every pattern gets an address like a library book's: <library>.<class>.<words>. The library number (contracts 100, receipts 200, routing 300, triage 400, Kar's own estate map 000), the label's place in that library's fixed list of labels (three digits: for routing, the 77 teams), and the pattern's words in alphabetical order. The law refuses a duplicate pattern, so an address names one pattern. It never depends on where a pattern sits in the library, so as the library grows night by night, no existing pattern's address changes.
| Address | Pattern | Team | Filed under | Shadowed by |
|---|
The layers
The idea of cross-reference layers between items comes from Gary W. Floyd's NEXUS, whose graph linker links every item across nine layers. A WHEN/THEN pattern has five features to link on, so the catalogue has five layers:
- 1 · Words
- Each pattern linked to its words, and filed under one of them. This is the layer that finds patterns.
- 2 · Class
- Patterns that send messages to the same team (the address's middle number).
- 3 · Shadow
- Pattern A shadows a later pattern B when A's words are a subset of B's: whenever B fires, A fires too and comes first, so B can never be the answer. A shadowed pattern of the same team is dead weight; of another team, it can only ever be a conflict.
- 4 · Fired together
- Two patterns of different teams that fired first and second on the same training message: the conflicts the router has already met.
- 5 · Provenance
- Patterns kept on the same night by the same recipe.
Gary's other four layers (vectors, a knowledge graph, time, and an ethics layer) have nothing to link on in a two-word rule, so they are not built.
Measured
The claims were sealed before the code (CLAIMS.md, seal 5). Data: Banking77 (PolyAI, CC BY 4.0). Libraries were grown only from the training messages; the test messages are the jobs. The real routing library is the one the nightly loop keeps (library 3 on the main page: every pattern in it passed the loop's held-out and final-exam gates, and its record is data/route/state.json). The grown libraries are every one- and two-word pattern the training messages contain, each sending to the team it most often goes with: not verified patterns, but the shape of a big library, because finding patterns does not depend on whether they are good.
| Patterns | Asked per message (median · 95th · largest) | Share of the library asked | Messages that differ | ms per message: old way | ms: catalogue | ms to build the catalogue |
|---|
On the real library
Conflicts already met (K5)
Re-run it here
This downloads Banking77's two files from PolyAI's repository at the pinned commit (about 1.1 MB, straight from GitHub to your browser), refuses them unless their SHA-256 fingerprints are the pinned ones, grows the same libraries, and repeats the comparison on every test message at every size. Nothing is sent anywhere. Timings are your machine's. It takes a few minutes, most of them spent timing the old way on the largest library, which is the point: that is what the catalogue saves.
Blueprint
| Part | What it does | Mutation gate |
|---|
A mutation gate changes the code on purpose (flips a comparison, swaps && for ||) and reruns the tests; a change the tests do not notice means a line nobody really checked. Every count above re-runs on GitHub on every push, and CI also re-derives every committed night of every library byte for byte with the router reading through the catalogue.
For your business
A pattern library is how an automation stops paying for AI on work it has already learnt: each verified pattern answers its kind of job instantly, for nothing, with a reason, before any model is asked. The more patterns it holds, the more jobs it takes off the model. The catalogue is what lets the library keep growing without the router slowing down, so the free share (the share of jobs answered by a pattern, at no model cost, instead of by a model) can keep rising.
Routing cost stays flat as the library grows from dozens to tens of thousands of patterns, and the answers are provably the same as before, so it drops in with no re-validation of the library.
Every job the library answers is a model call not paid for. A router that stays fast keeps that share growing. The cost case below turns the measured speed into server time at your volume.
Messages are routed in a fraction of a millisecond each, so routing never becomes the queue, and every routing decision names the pattern and its address.
No model decides a route; the catalogue is a few hundred lines of plain code; the shadow layer shows which patterns can never answer (the address table above names each one and the pattern that shadows it), so a reviewer can remove dead weight and audit a library before it is trusted.
Cost case
Server time saved by routing through the catalogue instead of asking every pattern, at the largest measured library, using this page's measured times. Your volume and your server cost are the inputs.
Measured times are single-core times on the machine named under Measured; yours will differ, and Re-run it here measures your own. The saving is routing time only: what a pattern saves by answering instead of a model is far larger, and depends on your model and its price.
Security, compliance and data protection
- Where does a message go?
- Nowhere. Routing runs in the page or on your own server; no model or outside service sees the message. This page's policy lets it connect only to its own site and to GitHub's file server, and only to fetch the public Banking77 files when you press Re-run.
- Can the catalogue change an answer?
- No. It only chooses which patterns the law asks; the law's own function decides each one, and the results are put back in the library's own order. This is tested on random libraries and measured on every held-out message at every size.
- When is the catalogue built?
- From the library in memory, whenever a router starts work on a library: the nightly check builds one for its measuring run. Building it is a single pass over the patterns; the time it takes at each size is the last column of the table in Measured.
- What if the library changes and the catalogue is stale?
- The router checks that the catalogue was built for exactly the library in hand (the same list, the same length); if not, it asks every pattern, the old way, so a stale catalogue costs speed, never correctness.
- Supply chain?
- No packages: the catalogue is one plain JavaScript file in this repository, mutation-gated on every push.
Risks, answered straight
- The grown libraries are not real patterns.
- True, and said so above. They measure finding, not answering. The real library is small today (its size is in Measured), and its answers are checked the same way.
- For a small library it saves nothing.
- True. With a few dozen patterns both ways take hundredths of a millisecond, and in Try it the old way can even come out a little faster. The catalogue pays as the library grows: see how the two columns of times part in Measured.
- Is the money the point?
- Not at modest volumes: the cost case below is small until messages run into the millions a day. The point is that routing time stops growing with the library, so the library can grow without the router becoming the queue, and each message waits a fraction of a millisecond, not tens of milliseconds.
- Messages with many common words ask more patterns.
- Yes: the 95th percentile and the largest count are shown next to the median for that reason.
- Timings depend on the machine.
- The table names the machine and takes the median of several runs; Re-run it here gives yours. The count of patterns asked does not depend on the machine.
The explainer
The problem. A pattern library answers jobs with small verified rules: "a message with card and arrive goes to the card-arrival team". The router asks each rule in turn whether it fires. Each rule is cheap to ask, but the number of rules is the point of a library: the library is meant to grow every night. A router that asks every rule slows down in step with the library, and at tens of thousands of rules the router, not the model, becomes the cost.
The idea. A library's catalogue lets you find a book without walking every shelf. Gary W. Floyd's NEXUS routes every item by a Dewey-style address and links items across cross-reference layers. Here, every pattern gets an address from its library, its label and its words, and is filed under the one of its words that is rarest in the training messages. A message's words are looked up, and only the patterns filed under them are asked.
Why the answer cannot change. A pattern fires only if all its words are in the message, so its filing word is in the message, so it is found. Everything found is decided by the library's own law, and put back in library order. The catalogue never adds an answer the law would not give, and never misses one.
How it was checked. The claims were committed before the code. On every held-out message, at every library size up to every pattern the training messages contain, the catalogue and the old way were compared message by message: the list of patterns that fire (position for position), the law's answer and the router's whole result (team, pattern, conflicts, right or wrong), each compared for exact equality. The code that does it is tools/catalogue-measure.mjs; GitHub's runner repeats it on every push and refuses any count that comes out different. The nightly loop's own records were re-derived byte for byte with the router reading through the catalogue. The kernel and every kernel it touches passed a mutation gate with nothing waved through.
Words on this page
- Pattern
- A rule of the form WHEN word [AND word] THEN team, kept only after it beat a cheap baseline on messages it never saw.
- Fires
- A pattern fires on a message when every one of its words is in the message.
- The old way (the linear scan)
- Asking every pattern, in library order, whether it fires.
- Filing word
- The one word of a pattern it is filed under: the one that occurs in the fewest training messages.
- Asked
- How many patterns the router asked about one message.
- Conflict
- A message on which patterns of two different teams fire. The first in library order wins; the other is named.
- Shadowed
- A pattern that can never be the first to fire, because an earlier pattern with a subset of its words always fires with it.
- Held-out
- Messages kept away from the library while it grew, used only to check it.
- Mutation gate
- A check on the tests: the code is changed on purpose, and the tests must notice every change.
FAQ
Does the catalogue make the library more accurate?
No. It makes it faster and changes nothing it answers. Accuracy is the night's job: the gates that decide which patterns are kept.
Why file each pattern under only one word?
Filing under every word would find each pattern several times and make the lists longer. One word is enough to never miss a pattern, and the rarest word keeps the lists shortest for real messages.
Why is the largest library not a round hundred thousand?
Because the training messages do not contain that many different one- and two-word patterns. The largest library is all of them; its size is in the table. The seal said so before the measurement.
Is this used by the nightly loop?
Yes. The routing check that the nightly loop runs on its measuring messages, and the contract library's measuring step, both read through the catalogue now. Every committed night was re-derived byte for byte after the change.