# K2 — full reference > One spaced-repetition engine, many drills. This is the long form of https://k2kanji.com/llms.txt. K2 is a family of free browser drill apps built on one unusual spaced-repetition engine. Instead of scheduling review dates, every item carries a probability `p`: answer correctly and `p` halves, answer wrong and it doubles. Items are drawn by Monte Carlo rejection sampling, so a session self-organizes around whatever the learner is currently getting wrong, and the pool expands on its own once it cools. The algorithm is written up in full at https://k2kanji.com/paper. ## The K2 algorithm Each item carries a selection probability p that halves when you get it right and doubles when you get it wrong; items are drawn by Monte Carlo rejection sampling, so the pool self-organizes around what you are currently getting wrong. **How it differs from interval schedulers.** Interval-based systems (SM-2, Anki, FSRS) schedule a future date per card. K2 stores no dates and no queue: p IS the schedule. Selection is a rejection sample over the live pool, so difficulty tracks the learner continuously instead of at review boundaries, and the pool reheats itself by expanding when it cools. **The thermal analogy.** p behaves like temperature. A correct answer cools an item, an incorrect answer heats it. Competence kappa moves by ln(2) per answer, so p = P_INIT * 2^(-kappa). When the whole active pool cools below the expansion threshold, fresh items are injected — the reheating step in simulated annealing — keeping the learner near a flow boundary. ### Update rule - Correct: p / 2, floored at P_MIN - Incorrect: p * 2, capped at P_MAX - Hinted correct: p * PARTIAL_COOL_FACTOR (sqrt(1/2) ~= 0.707), a deliberately weaker reward for answering with the reading/pinyin crutch visible. It does NOT increment the earned-correct counters, so it never counts toward mastery-gated unlocks or achievements. - The divide-by-2 / multiply-by-2 symmetry is load-bearing; the hinted case is the one intentional exception. ### Selection Pick a uniformly random item from the active pool, roll r in [0,1), accept if r < p, else retry. Over a session an item is therefore drawn in proportion to its p relative to the pool. A capped retry loop falls back to the highest-p item so a fully-cooled pool still serves a card, and the same item is not served twice in a row when the pool has more than one member. ### Pool expansion Expansion is judged on the ACTIVE FRONTIER only: items with p >= MASTERY_THRESHOLD (0.1). When that frontier's average p falls below EXPANSION_THRESHOLD (0.15), or the frontier empties, a batch of 5-10 new items enters the pool at p = P_INIT. Mastered items are excluded from that average on purpose: counting them would drag it below the threshold and expand on every answer. ### Mastery An item is treated as mastered below p = 0.1. Pools start at 10 items; p is clamped to [0.001, 1] and new items start at 0.5. ### Constants (live values from the engine) - `P_INIT` = 0.5 - `MASTERY_THRESHOLD` = 0.1 - `EXPANSION_THRESHOLD` = 0.15 - `INITIAL_POOL_SIZE` = 10 - `EXPANSION_BATCH_MIN` = 5 - `EXPANSION_BATCH_MAX` = 10 - `P_MIN` = 0.001 - `P_MAX` = 1 - `HISTORY_INTERVAL` = 10 - `PARTIAL_COOL_FACTOR` = 0.7071 ### Implementations - `app/components/k2Engine.ts`: kanji, hanzi, hangul and the Latin-family script decks - `app/components/vocabularyEngine.ts`: compound words, unlock-gated on component mastery - `app/cube/cubeEngine.ts`: Rubik's cube algorithm drilling ### Porting K2 To port K2: store one float per item per dimension, apply the update rule above, select by rejection sampling, and expand on the frontier average. There is no date arithmetic, no queue, and no per-item scheduling state beyond p and its counters. ## Decks Each deck below is also served by the MCP server; the link is the page where a learner drills it. Rubik's cube last-layer algorithm sets (OLL, PLL, two-look subsets, ZBLL) are studied at https://k2kanji.com/cube and served by `get_cube_algorithms`; every algorithm is machine-verified to solve its case by a cube simulator in CI. ### Japanese Kanji (Kyouiku) - Language: Japanese - Study it: https://k2kanji.com/ - MCP deck id: `japanese-kanji` - Upstream source: KanjiAPI.dev; KANJIDIC2 (EDRDG, CC BY-SA 4.0) All 1,006 Kyouiku kanji taught in Japanese elementary grades 1-6. Each entry carries stroke count, on/kun readings, English meanings, and JLPT level. `category` is the school grade, which is also the learning order. ### Japanese Vocabulary (Jukugo) - Language: Japanese - Study it: https://k2kanji.com/ - MCP deck id: `japanese-vocabulary` Compound words built from the kanji deck, with hiragana readings. `extra.components` lists the constituent kanji — in the app a compound unlocks only once its components are mastered (p < 0.1). ### Chinese (HSK) - Language: Chinese (Mandarin) - Study it: https://k2kanji.com/chinese - MCP deck id: `chinese` HSK-graded hanzi and words. `reading` is pinyin with tone marks; `category` is the HSK band plus part-of-speech grouping. ### Korean Hangul - Language: Korean - Study it: https://k2kanji.com/hangul - MCP deck id: `hangul` Hangul jamo and syllable building blocks. `reading` is the romanization with the sound value; `category` separates basic/compound consonants and vowels. ### Spanish Vocabulary - Language: Spanish - Study it: https://k2kanji.com/spanish - MCP deck id: `spanish` Thematic Spanish vocabulary with part of speech and difficulty banding. ### French Vocabulary - Language: French - Study it: https://k2kanji.com/french - MCP deck id: `french` - Upstream source: Wikimedia Commons (pronunciation audio) French vocabulary with gender/article info in `reading`, plus IPA and a pronunciation audio URL in `extra` where available. ### Latin Vocabulary - Language: Latin - Study it: https://k2kanji.com/latin - MCP deck id: `latin` Classical Latin vocabulary. `reading` holds the genitive or principal parts; `extra` carries declension/conjugation, gender, and English derivatives. ### Medical Latin & Anatomy - Language: Latin (medical) - Study it: https://k2kanji.com/medica - MCP deck id: `medica` Anatomical and medical Latin grouped by body system, with declension info and the English clinical derivatives each root produces. ## Frequently asked questions ### What is K2? K2 is a spaced-repetition engine and the family of browser drill apps built on it, written by Erik Bethke in 1995 and formalized in 2026. Instead of scheduling reviews on a calendar, K2 gives every item a selection probability and chooses what to show you next by Monte Carlo rejection sampling. The same engine drives every K2 app: Japanese kanji, Chinese, Korean, Spanish, French, classical and medical Latin, Rubik's Cube algorithms, music theory, world geography and more. ### How does the K2 algorithm work? Every item in K2 carries a probability p, starting at 0.5. To choose what to ask next, K2 picks an item at random from the active pool, rolls a random number, and quizzes that item only if the roll comes in under its probability — otherwise it throws the item back and tries again. Answer correctly and p is halved; answer wrong and p is doubled. That is the entire update rule. There are no timestamps, no intervals, and no per-item scheduling state beyond p itself, which is why the whole engine is about fifty lines of code. ### Does K2 use spaced repetition? Yes, but K2 arrives at it from the opposite direction to most systems. Conventional spaced repetition is a scheduling system: it decides when each card is due. K2 is a selection system: it decides what to show you right now, given your current state. The spacing emerges from the probabilities rather than from a calendar — after three correct answers an item sits at p = 0.0625 and is rejected about 94% of the time it comes up. It is still in the pool and can resurface the moment you start missing it, but it costs you almost nothing. Because nothing is ever scheduled, K2 has no concept of an overdue item and no backlog to fall behind on. ### How is K2 different from Anki? Anki schedules each card for a future review date, by default with an algorithm from the SuperMemo SM-2 family (FSRS is an opt-in alternative), and reviews you do not get to pile up as an overdue backlog. K2 stores one number per item and selects by rejection sampling, so nothing is ever due, nothing is overdue, and there is no backlog. K2 also expands its own pool: when the material you are working on has cooled, it adds a batch of new items on its own, instead of asking you to decide when to add more. The difference is philosophical as much as technical — Anki decides when you should review something, K2 decides what is worth your attention this second. [Read the full K2 vs Anki comparison.](https://k2kanji.com/vs/anki) ### Why does K2 give me new material before I have finished the old? That is K2 deliberately reheating the pool. K2 watches the items you are actively working on, and when their average probability has dropped far enough — meaning you have largely got them — it introduces a batch of new items at p = 0.5. This is automatic curriculum progression: you never decide when to move on, and K2 keeps you near the boundary where the work is hard enough to hold your attention but not so hard that it stops being possible. Struggle, and K2 stops expanding and lets you consolidate what you have. ### Is K2 free? Yes. Every K2 drill runs in your browser at no cost and with no account, and your progress is saved on your own device. Signing in with Bike4Mind is optional: it syncs your progress across devices, and the AI-generated reading and dialogue features then run on your own Bike4Mind credits. There is no paywall on the drills themselves. ## Comparisons - [K2 vs Anki](https://k2kanji.com/vs/anki): Scheduled review dates and an overdue backlog, against rejection sampling with no due dates and a pool that grows on its own. - [K2 vs WaniKani](https://k2kanji.com/vs/wanikani): A fixed level-by-level kanji curriculum with mnemonics, against an adaptive pool that expands when the current kanji have cooled. ## For AI agents K2 is a family of drill apps built on one unusual spaced-repetition engine: a thermal / rejection-sampling model where each item has a probability that halves on success and doubles on failure. This server exposes the curated study decks AND the engine, so an agent can look up material or run the scheduling math on its own items. - MCP endpoint (streamable HTTP, JSON-RPC 2.0, no auth): https://k2kanji.com/api/mcp - Install (Claude Code): `claude mcp add --transport http k2kanji https://k2kanji.com/api/mcp` - Install (claude.ai): Settings -> Connectors -> Add custom connector -> https://k2kanji.com/api/mcp - Manifest: https://k2kanji.com/.well-known/mcp.json - Terms and endpoint list: https://k2kanji.com/agents.txt ### Tools - `list_decks`: The deck catalog: eight curated decks across Japanese, Chinese, Korean, Spanish, French, Latin and medical Latin, with entry counts and field meanings. - `search_deck`: Search one deck by term, reading, meaning, or category, with difficulty/grade filters and paging. - `get_entry`: One entry in full, by deck and exact term — every field the deck carries. - `get_cube_algorithms`: Rubik's cube last-layer algorithm sets (OLL 57, PLL 21, two-look subsets, ZBLL) with alternates and finger-trick notes. - `explain_k2_algorithm`: The engine described: update rule, rejection sampling, pool expansion, live constants, and porting notes. - `simulate_k2_session`: The engine executed: replay answers through the real code and get p-trajectories, mastery, expansions, and the next-selection distribution. - `get_site_info`: This map, plus the apps, the scope boundary, and every machine-readable surface. ### Prompts - `study_plan`: Turn a deck plus a time budget into a concrete, K2-shaped study plan. - `explain_term`: Deep-dive one term using deck data: components, readings, derivatives, related entries. - `drill_me`: Run a live drill where the agent is the quiz UI and K2 (via simulate) is the scheduler. - `port_k2`: Port the K2 engine into the caller's own project, correctly. ### Resources - `k2kanji://decks`: The deck catalog as JSON — one read instead of walking list_decks. - `k2kanji://k2-algorithm`: The full algorithm specification as JSON, constants included. - `https://k2kanji.com/llms.txt`: Curated overview of the apps and this server. ### Scope Read-only reference data plus the K2 algorithm itself. Learner progress is private (authenticated, per-user) and is not reachable through this server; neither are the AI generation endpoints, which are metered per account. ### Attribution K2 (k2kanji.com) CURATES these decks and authors the K2 spaced-repetition engine; it is not the author of every datum. Credit K2 and name the specific deck or set - and where a result carries an `upstream` field (kanji data from KanjiAPI.dev and KANJIDIC2 (EDRDG, CC BY-SA 4.0), cube algorithms from JPerm / SpeedCubeDB, French audio from Wikimedia Commons), carry that credit too. Do not collapse upstream authorship into K2: .well-known/mcp.json asks redistributors to preserve those credits. ## Contact - Website: https://k2kanji.com - Creator: Erik Bethke - Issues: https://github.com/MillionOnMars/k2kanji/issues