0xBUFF / retention

Practice scheduling

Understand interval transitions, early reviews, misses and support.

The practice projection uses surviving practice and credited observations in effective-time order. A concept has a zero-based stage index once it passes an observation. The policy determines the next due time.

Transitions

ObservationEffect
First passEnter stage 0 and schedule the first interval from the observation.
Early passIncrement advisory successes and clear misses and forced support; keep the existing stage and due time.
Pass at or after due timeAdvance to the next interval, or enter review_ready and use maintenanceDays at the final stage.
Miss before the final stage, or restart at the final stageClear the stage, enter learning and schedule retryDays.
Miss at the final stage with support or keepRetain stage and state, schedule retryDays; support forces a support recommendation.
Not observedUpdate lastSeenAtMs; keep the due time and counters. An unobserved concept enters learning without an observed outcome.

A miss increments consecutive misses. Support is recommended when the authored miss threshold is reached or support has been forced. A later pass clears consecutive misses and forced support. Retention does not invent a missed observation when a due date passes.

Recommendation kinds

KindCondition in priority order
supportSupport is needed.
transferSchedule state is review_ready.
delayed_retrievalStage is the last interval.
ordinaryAll other cases.

The practice readiness field is unknown if no pass or fail has been observed, review_ready in that schedule state, and developing otherwise. It is independent of candidate readiness.

Early and due reviews

With intervals of 1, 3 and 7 days, a pass on day zero sets the first review for day one. Another pass before day one keeps that due time. A pass on day one moves the schedule to stage one and sets the next due time to day four.

// retention-docs: runnable
import { rebuildReview } from "@0xbuff/retention";

const day = 86_400_000;
const policy = {
  schemaVersion: 1,
  algorithmVersion: "1",
  policyId: "deck",
  policyVersion: "v1",
  scheduling: {
    intervalsDays: [1, 3, 7],
    retryDays: 1,
    maintenanceDays: 30,
    supportAfterMisses: 2,
    longProbeAction: "restart",
    dateArithmetic: "elapsed_milliseconds",
  },
};
const event = {
  schemaVersion: 1,
  kind: "practice_observation",
  scopeId: "deck",
  conceptId: "binary-search",
  eventId: "review-1",
  sequence: 0,
  atMs: 0,
  sessionId: "session-1",
  outcome: "pass",
};
function value(result) {
  if (!result.ok) throw new Error(JSON.stringify(result.errors));
  return result.value;
}

const early = { ...event, eventId: "early", sequence: 1, atMs: day / 2 };
const onDue = { ...event, eventId: "due", sequence: 2, atMs: day };
const history = [event, early];
const before = value(rebuildReview(policy, "deck", history, day));
const after = value(rebuildReview(policy, "deck", [...history, onDue], day));
console.log(before.concepts[0].dueAtMs, after.concepts[0].dueAtMs);

Expected output:

86400000 345600000

Use due ranking to select concepts that need review. Use policies to configure the time arithmetic.

On this page