Files
CatoandClaude Fable 5.2 070d317c88 Exercises: reviews in another form; situations ask the word that matters (#382)
* Owner check: why the owner pages do not open, for the person asking

The owner was named on the server and still got 404 on the numbers, with nothing to tell a missing sign-in from an unconfirmed address from a different address. /api/owner/check answers that about the caller only, and never says who the owner is.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Exercises: a review comes back in another form

Simulated over twelve daily sittings, a learner who got everything right met 52 different questions in 96: half of every sitting was the identical question on its review day. What is due is the subject, so where the scope has a never-answered question about the same subject in a different form, that one takes the review's seat (Plan.reviewOf) and its answer moves the card that was due (recordAnswer, siblings), so a subject keeps one schedule. New questions also prefer subjects not met yet. After: 83 different questions in 96; with half the answers wrong, 48 subjects instead of 30.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Situations: ask the word that matters, near-miss options, claims last

Reported from a phone on 2026-11-28 as useless: a heard line asked as a whole is read off its German cognates, with wrong options that are unrelated lines, or as a claim that is the German read back. Now the line is asked through its least German-looking pack word, in its sentence, with the pack's own four meanings (WordAsk; once per run; no cognates), else as three meanings whose wrong ones are near misses (negation out, day moved, number changed; German word tables with the packs), and as a claim only when neither is possible. Recorded against the line's own item, as pickOf is. Also: pagesFor for chat wayfinding, and no second printing of the German after a true claim.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Situations: a right answer moves on by itself, as in a sitting

Reported from a phone: the situation run waited for «Wiiter» after a right answer while a sitting moved on by itself. The pulse and the beat lived inside Verdict; they are now useAnswered, used by both. Touching the answer holds it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 03:45:02 +01:00

102 lines
4.4 KiB
TypeScript

import { remember, type History } from "./history.ts";
import { scheduleAnswer, type Memory } from "./memory.ts";
import { observe, type LearnerModel } from "./model.ts";
import type { Outcome } from "./resume.ts";
import type { PracticeItem } from "./types.ts";
/**
* One answer, and everything it is written into.
*
* This was written out twice, in the practice sitting and in the warm-up, with
* different rules, and a third time in the test with only the last line. Three
* components each deciding what an answer means is how a learner ends up with
* a streak that counts on one screen and not on another. The rules are here
* now, once, and each screen says which kind of answer it has.
*
* WHAT AN ANSWER TOUCHES
*
* history which questions were seen recently, so the next sitting can
* avoid them
* model what this learner gets right and wrong, by area
* memory when each question is due again
* streak that practice happened today (`practised`; the caller records it)
*
* THE RULES, AND WHICH ONE WON WHERE THE SCREENS DISAGREED
*
* 1. A TAUGHT answer (a sitting, the warm-up) goes into the history every
* time, as it happens: a sitting abandoned half way still counts as asked.
*
* 2. The model and the memory hear the FIRST answer to a question only. A
* question requeued because it was missed is being relearned; getting it
* right a minute after seeing the answer is not the clean retrieval either
* mechanism is built on. This was the sitting's rule. The warm-up had none
* because it never repeats a line, so the sitting's rule holds for both.
*
* 3. The day counts from the first answer, not from the last. The sitting
* recorded the streak on every first answer; the warm-up only after its
* eighth line, so seven answered lines and a closed tab was a day without
* practice. THE SITTING'S RULE WON: history and model already treat a
* half-finished run as practice done, and the streak now agrees with them.
*
* 4. A MEASURED answer (the test) counts for the day and touches nothing
* else. Deliberately kept: the test draws the same questions every run and
* gives no feedback until its end. Feeding the model would let the same
* twenty answers be counted again on every re-sit, scheduling them in the
* memory would mark as "learned" a question nobody has explained yet, and
* putting them in the history would take them out of the sitting's pool of
* new questions without their ever having been taught.
*/
export type Ledger = { history: History; model: LearnerModel; memory: Memory };
export type Answer = {
item: PracticeItem;
outcome: Outcome;
/** False for a question that came back in the same sitting because it was missed. */
first: boolean;
/**
* `taught`: answered with feedback, in a sitting or the warm-up.
* `measured`: answered in a test, which reports only at its end.
*/
kind: "taught" | "measured";
};
/** What to write. A field left out is a record this answer does not change. */
export type Recorded = Partial<Ledger> & {
/** Practice happened today: touch the streak. */
practised: boolean;
};
export function recordAnswer(
ledger: Ledger,
answer: Answer,
now: Date,
/** Other questions about the same subject as this one (`siblingsOf`); none by default. */
siblings: readonly Pick<PracticeItem, "id" | "kind">[] = [],
): Recorded {
const { item, outcome, first, kind } = answer;
if (kind === "measured") return { practised: first };
const history = remember(ledger.history, [item.id]);
if (!first) return { history, practised: false };
/**
* THE STAND-IN. A review is asked in another form (`planSession`): the
* question answered may have no card of its own while a sibling's card is
* due. Then the answer belongs to that card — the one that has waited
* longest — and this question gets none, so one subject keeps one schedule
* instead of growing a new card for every form it was asked in.
*/
const at = now.getTime();
const due =
ledger.memory[item.id] === undefined
? siblings
.filter((s) => s.id !== item.id && ledger.memory[s.id] !== undefined && ledger.memory[s.id]!.due <= at)
.sort((a, b) => ledger.memory[a.id]!.due - ledger.memory[b.id]!.due)[0]
: undefined;
return {
history,
model: observe(ledger.model, item, outcome),
memory: scheduleAnswer(ledger.memory, due ?? item, outcome, now),
practised: true,
};
}