Wiki race: Jev walks Wikipedia link by link
1. What Jev decides
From the links on the current Wikipedia page, which one leads to the target article in the fewest hops. One choice question per hop. The link titles are the option names; the descriptions are empty strings, so Jev reads only the titles. The state is two fields: the current page title and the target title. No browser, no DOM: the Wikipedia API returns the links as text.
2. The questions
The questions and limits, from the top of wiki.mjs. This is the block a reviewer must read; the rest of the file is plumbing.
// ---- Review these. Everything else is plumbing. ----
const QUESTION = {
type: "choice",
instructions: "Which linked article is most likely to lead to the target article in the fewest hops?",
// criteria: one option per link title, empty description. Jev reads the title. Filled per hop.
};
const MAX_HOPS = 12;
const MAX_OPTIONS = 255; // gateway refuses 256
const SKIP = /^(List of |Lists of |Index of |Outline of |Timeline of |\d{1,4}( BC)?$)|\(disambiguation\)|identifier$/;
3. What the page shows
A form with a start and a target. Below it, the chain of page titles left to right, then one card per hop with the top five candidates as probability bars, Jev's pick in orange, the Wikipedia fetch time and the Jev time for that hop, and the running cost. The page polls /state every 300 ms.
4. Run it
node --env-file=.env wiki/wiki.mjs Coffee Napoleon # command line
node --env-file=.env wiki/wiki.mjs # http://localhost:3001
node --env-file=.env wiki/wiki.mjs --check # 5 races, pass if 3 reach the target in 12 hops
5. The check, verbatim
run 1: reached in 4 hops, 4.6 s, $0.00038 Coffee → Frederick II of Prussia → French Revolution → Bonaparte at the Council of Five Hundred at Saint-Cloud → Napoleon Bonaparte
run 2: reached in 7 hops, 3.3 s, $0.00064 Coffee → Gustav III of Sweden's coffee experiment → History of coffee → Gabriel de Clieu → Saint-Domingue → Haitian Revolution → French Revolutionary and Napoleonic Wars → Napoleon Bonaparte
run 3: reached in 5 hops, 4.8 s, $0.00048 Coffee → Gustav III of Sweden's coffee experiment → Gustav III → French Revolution → Bonaparte at the Council of Five Hundred at Saint-Cloud → Napoleon Bonaparte
run 4: reached in 7 hops, 5.7 s, $0.00064 Coffee → Gustav III of Sweden's coffee experiment → History of coffee → Gabriel de Clieu → Saint-Domingue → Haitian Revolution → French Revolutionary and Napoleonic Wars → Napoleon Bonaparte
run 5: reached in 4 hops, 2.3 s, $0.00038 Coffee → Frederick II of Prussia → French Revolution → Bonaparte at the Council of Five Hundred at Saint-Cloud → Napoleon Bonaparte
5/5 reached the target
One hop, printed by the command-line mode, shows the split between the two network calls:
Coffee → Frederick II of Prussia (p 0.36, 255 links, wiki 177 ms, jev 354 ms)
Frederick the Great → French Revolution (p 0.59, 255 links, wiki 245 ms, jev 2523 ms)
French Revolution → Bonaparte at the Council of Five Hundred at Saint-Cloud (p 0.36, 255 links, wiki 162 ms, jev 541 ms)
Bonaparte at the Council of Five Hundred at Saint-Cloud → Napoleon Bonaparte (p 0.98, 26 links, wiki 145 ms, jev 262 ms)
reached Napoleon in 4 hops, 4.9 s, $0.00038A second pair, Cheese to Moon, took 9 hops: Legend, Myth, Greek mythology, Apollo, Apollo program, Moon landing, Apollo 11, Exploration of the Moon, Moon.
6. Findings
- Step zero passed: a choice question with empty-string descriptions returns 200. With 255 fake titles plus "Napoleon Bonaparte" and the target "Napoleon", Jev picked the right one at p 0.97 in 337 ms. A 256th option is refused with "TypeSafe Choice questions support at most 255 options".
- Redirects matter. Jev picks "Napoleon Bonaparte", which is a redirect to "Napoleon". The code resolves the target once with
action=query&redirects=1and compares the canonical title after each fetch, so the race ends on the redirect. - The Wikipedia API refuses requests without a User-Agent header. The code sends one that names this repo.
- The options are the first 255 links in article order after a filter drops "List of", years, and disambiguation pages. Lead-section links come first, which is where the useful ones are. No race looped; the visited set was never needed in 7 runs.
- The Jev time per hop ranged from 262 to 2,523 ms with 255 options. The Wikipedia fetch was 145 to 245 ms. Jev is the slower half of every hop from this machine.
- Not built: the race lane against a chat model asked the same question through
generateText, which the assessment listed as the way to show the latency gap on one screen.
7. Cost and latency
One hop with 255 options is about 2,000 input tokens, $0.00008 to $0.0001. A race is $0.0004 to $0.0006.