Turn every miss into a card

How do you stop making the same mistake in every mock?

Most people practise until they feel tired, without tracking what went wrong. So tomorrow's session is the same as today's, and the same mistakes come back.

A ledger fixes that. Each miss gets one row: the topic, the cause, a question, and an answer. The cause matters most. 'Failed two sum' tells you nothing, while 'didn't test empty input' describes a habit you can change.

AI helps twice here. It can read your mock and name the cause, and it can turn a miss into a clean flashcard. Spaced review then brings the card back just as you're about to forget.

  • Cause: The habit behind the miss, in a few words: off by one, skipped clarifying, no test before moving on.
  • Spaced repetition: Reviewing at growing gaps, such as 1, 3 and 7 days. The revise page on this site does it for you.
  • Half-life: How long a miss takes to lose half its weight. Here, 7 days: old misses matter less unless they come back.

Steps:

  1. Log straight after each session. Two minutes, while you still remember.
  2. Name the cause, not the problem. Ask AI if you can't tell: 'What habit caused this?'
  3. Write one question per miss. One fact per card. Long cards don't get remembered.
  4. Start each day from the ledger. Practise your weakest topic first.
  5. Review the causes weekly. A repeated cause gets a rule, such as 'run it before I accept it'.

Spreadsheet first: A spreadsheet with four columns is enough. The code below shows what's worth calculating once you have rows: recent misses count more, and repeated causes stand out.

Prompt, Turn a miss into a card:

I got this wrong in practice:
[problem and what I did]
Reply with: 1) the habit that caused it, in under 6 words, 2) one flashcard question that tests the idea, not this exact problem, 3) an answer of at most 2 sentences. If you're unsure of a fact, say so.

Code, What the ledger tells you. Two views of the same rows: which topic is weak now, and which habit keeps coming back.

/** Recent misses count more: a miss loses half its weight every 7 days. */
export function weakestTopics(misses: Miss[], now: number, halfLifeDays = 7): [string, number][] {
  const weight = new Map<string, number>();
  for (const m of misses) {
    const ageDays = Math.max(0, now - m.at) / DAY;
    weight.set(m.topic, (weight.get(m.topic) ?? 0) + 0.5 ** (ageDays / halfLifeDays));
  }
  return [...weight].map(([t, w]): [string, number] => [t, Math.round(w * 100) / 100]).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
}

/** If the same cause keeps coming back, that habit is worth more than any single topic. */
export function repeatedCauses(misses: Miss[], atLeast = 2): [string, number][] {
  const counts = new Map<string, number>();
  for (const m of misses) counts.set(m.cause, (counts.get(m.cause) ?? 0) + 1);
  return [...counts].filter(([, n]) => n >= atLeast).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
}
  • 0.5 ** (ageDays / halfLifeDays): A miss loses half its weight every 7 days. A miss from today counts 1, and one from two weeks ago counts 0.25.
  • repeatedCauses: Counts causes without any decay, since a habit that keeps showing up matters however old the first case is.

Code, Exporting to flashcards. Anki imports tab-separated text, one card per line.

/** Tab-separated lines that Anki can import. Tabs and line breaks inside a field would break a row. */
export function toAnki(misses: Miss[]): string {
  const clean = (s: string) => s.replace(/[\t\r\n]+/g, " ").trim();
  return misses.map((m) => `${clean(m.question)}\t${clean(m.answer)}\t${clean(m.topic)}`).join("\n");
}
  • replace(/[\t\r\n]+/g, " "): A stray tab or line break inside a field would split the row and scramble the card.

  • Failure, Saving cards you never checked: Models make confident errors. Check each card before it goes in your deck.

  • Failure, Too many cards: A 300-card backlog gets abandoned. Add only what you actually missed.

Why log the cause separately from the topic?
Topics change every day, while habits repeat across topics. Fixing one habit improves every round.
Why make old misses count less?
If you stopped repeating a mistake, it's probably fixed. Recent misses show your weakness today.

Sources: