Habit formation engine — spaced repetition, lock-in tracking & retention curves #81

Closed
opened 2026-06-09 02:08:36 +00:00 by Mark · 1 comment
Owner

Summary

Add a habit formation engine to Kin that uses spaced repetition cadences, habit lock-in tracking, and retention/decay curves to help users build consistent relationship-maintenance patterns and see when relationships are cooling off.

This is a cross-cutting feature that enhances existing Kin surfaces (goals, overdue alerts, Priority Today, dashboards) with scientifically-informed timing rather than flat intervals.


P1: Spaced repetition cadence engine

Replace flat intervals with expanding-interval scheduling, similar to Anki/SM-2.

  • Implement a cadence calculator: given { ideal_interval, history_of_on_time_actions }, produce the next nudge delay
    • Base formula: next_interval = prev_interval * factor where factor depends on on-time consistency (e.g., 2.0 for perfect, 1.5 for good, 0.5 for missed)
    • Floor: minimum interval (e.g., 2 days for important relationships)
    • Ceiling: maximum interval (e.g., 30 days — habit is considered locked in)
  • On a successful on-time interaction (logged within the scheduled window), stretch the interval by the factor
  • On a missed/skipped interaction, compress the interval back toward the floor
  • Store per-person cadence state: { current_interval, last_action_date, consistency_score, next_nudge_date }
  • Expose getNextNudgeDate(personId) and recordAction(personId) in the store
  • Integrate with existing Goal cadence: each goal can opt into spaced repetition instead of flat cadence

P2: Habit lock-in tracking

Show how cemented a behavior pattern is, not just streak length.

  • Calculate lock-in score per relationship: trailing window (e.g., last 8 weeks) of adherence percentage
    • 90%+ adherence over 6+ weeks = "Locked In" (habit is self-sustaining)
    • 70-89% = "Building" (consistent but not yet automatic)
    • Below 70% = "Fragile" (easily broken)
  • Locked In habits auto-graduate off the dashboard to reduce visual noise
  • A miss drops the score and can downgrade Locked In to Building
  • Show lock-in badge on PersonDetail and in People list view
  • Dashboard card: "Habit Health" showing locked-in count, building count, fragile count

P3: Retention/decay curves

Flag relationships that are atrophying, regardless of explicit goals.

  • Calculate a decay curve per relationship: ideal contact frequency falls off with a half-life (e.g., 2 weeks without contact = relationship warmth halves)
  • Flag "cooling off" relationships on dashboard when contact gap exceeds 1.5x the person's typical cadence
  • Small indicator on PersonCard: "3 weeks since last contact — this relationship is cooling"
  • Priority Today surface: add a "Reconnection" section for cooling-off relationships
  • Track trend: "You contacted Alex 4x this month vs 2x last month (up)" — directional awareness

P4: Calendar-spanning visualization

Let users see their relationship cadence mapped across time.

  • Add a "Cadence Calendar" view (similar to GitHub contribution grid): each person is a row, each column is a day/week, colored by interaction (green = contacted, grey = overdue, red = at risk)
  • Toggle to show goals overlaid: did you hit your cadence target this week?
  • Heat map: which relationships get the most attention, which are neglected

P5: Integration with existing Kin surfaces

Wire the engine into the app's existing UI.

  • Priority Today: show spaced-repetition nudges ("Call Sarah — interval stretches to 10 days if you do")
  • Interaction log: after logging, show next expected window ("Next check-in: ~7 days")
  • Weekly digest: "You maintained contact with 6/10 key relationships this week — 3 habits locked in"
  • Notification: spaced-repetition nudge when next window opens

Tech notes

  • @neuroflux/spaced-repetition npm package exists and implements SM-2 — worth evaluating
  • The engine is stateless per-person (just interval + history) — easy to persist in existing IndexedDB
  • Lock-in scoring is pure computation over interaction timestamps — no new data needed
  • Cadence data lives alongside the existing person data in the Dexie store
  • All computation is on-device, same offline-first philosophy
## Summary Add a habit formation engine to Kin that uses spaced repetition cadences, habit lock-in tracking, and retention/decay curves to help users build consistent relationship-maintenance patterns and see when relationships are cooling off. This is a cross-cutting feature that enhances existing Kin surfaces (goals, overdue alerts, Priority Today, dashboards) with scientifically-informed timing rather than flat intervals. --- ### P1: Spaced repetition cadence engine Replace flat intervals with expanding-interval scheduling, similar to Anki/SM-2. - [ ] Implement a cadence calculator: given `{ ideal_interval, history_of_on_time_actions }`, produce the next nudge delay - Base formula: `next_interval = prev_interval * factor` where `factor` depends on on-time consistency (e.g., 2.0 for perfect, 1.5 for good, 0.5 for missed) - Floor: minimum interval (e.g., 2 days for important relationships) - Ceiling: maximum interval (e.g., 30 days — habit is considered locked in) - [ ] On a successful on-time interaction (logged within the scheduled window), stretch the interval by the factor - [ ] On a missed/skipped interaction, compress the interval back toward the floor - [ ] Store per-person cadence state: `{ current_interval, last_action_date, consistency_score, next_nudge_date }` - [ ] Expose `getNextNudgeDate(personId)` and `recordAction(personId)` in the store - [ ] Integrate with existing Goal cadence: each goal can opt into spaced repetition instead of flat cadence ### P2: Habit lock-in tracking Show how cemented a behavior pattern is, not just streak length. - [ ] Calculate lock-in score per relationship: trailing window (e.g., last 8 weeks) of adherence percentage - 90%+ adherence over 6+ weeks = "Locked In" (habit is self-sustaining) - 70-89% = "Building" (consistent but not yet automatic) - Below 70% = "Fragile" (easily broken) - [ ] Locked In habits auto-graduate off the dashboard to reduce visual noise - [ ] A miss drops the score and can downgrade Locked In to Building - [ ] Show lock-in badge on PersonDetail and in People list view - [ ] Dashboard card: "Habit Health" showing locked-in count, building count, fragile count ### P3: Retention/decay curves Flag relationships that are atrophying, regardless of explicit goals. - [ ] Calculate a decay curve per relationship: ideal contact frequency falls off with a half-life (e.g., 2 weeks without contact = relationship warmth halves) - [ ] Flag "cooling off" relationships on dashboard when contact gap exceeds 1.5x the person's typical cadence - [ ] Small indicator on PersonCard: "3 weeks since last contact — this relationship is cooling" - [ ] Priority Today surface: add a "Reconnection" section for cooling-off relationships - [ ] Track trend: "You contacted Alex 4x this month vs 2x last month (up)" — directional awareness ### P4: Calendar-spanning visualization Let users see their relationship cadence mapped across time. - [ ] Add a "Cadence Calendar" view (similar to GitHub contribution grid): each person is a row, each column is a day/week, colored by interaction (green = contacted, grey = overdue, red = at risk) - [ ] Toggle to show goals overlaid: did you hit your cadence target this week? - [ ] Heat map: which relationships get the most attention, which are neglected ### P5: Integration with existing Kin surfaces Wire the engine into the app's existing UI. - [ ] Priority Today: show spaced-repetition nudges ("Call Sarah — interval stretches to 10 days if you do") - [ ] Interaction log: after logging, show next expected window ("Next check-in: ~7 days") - [ ] Weekly digest: "You maintained contact with 6/10 key relationships this week — 3 habits locked in" - [ ] Notification: spaced-repetition nudge when next window opens ## Tech notes - `@neuroflux/spaced-repetition` npm package exists and implements SM-2 — worth evaluating - The engine is stateless per-person (just interval + history) — easy to persist in existing IndexedDB - Lock-in scoring is pure computation over interaction timestamps — no new data needed - Cadence data lives alongside the existing person data in the Dexie store - All computation is on-device, same offline-first philosophy
Author
Owner

This issue has been decomposed into the following sub-issues:

# Title Phase Scope
#94 Habit formation engine — spaced repetition, lock-in tracking Replace flat intervals with expanding-interval scheduling, similar to Anki/SM-2.
#95 Habit formation engine — spaced repetition, lock-in tracking Show how cemented a behavior pattern is, not just streak length. - [ ] Calculat
#96 Habit formation engine — spaced repetition, lock-in tracking Flag relationships that are atrophying, regardless of explicit goals. - [ ] Cal
#97 Habit formation engine — spaced repetition, lock-in tracking Let users see their relationship cadence mapped across time. - [ ] Add a "Caden
#98 Habit formation engine — spaced repetition, lock-in tracking Wire the engine into the app's existing UI. - [ ] Priority Today: show spaced-r

Each sub-issue has been labeled with needs-triage and will be evaluated by the triage pipeline before queue routing.

This issue has been decomposed into the following sub-issues: | # | Title | Phase Scope | |---|-------|-------------| | #94 | Habit formation engine — spaced repetition, lock-in tracking | Replace flat intervals with expanding-interval scheduling, similar to Anki/SM-2. | | #95 | Habit formation engine — spaced repetition, lock-in tracking | Show how cemented a behavior pattern is, not just streak length. - [ ] Calculat | | #96 | Habit formation engine — spaced repetition, lock-in tracking | Flag relationships that are atrophying, regardless of explicit goals. - [ ] Cal | | #97 | Habit formation engine — spaced repetition, lock-in tracking | Let users see their relationship cadence mapped across time. - [ ] Add a "Caden | | #98 | Habit formation engine — spaced repetition, lock-in tracking | Wire the engine into the app's existing UI. - [ ] Priority Today: show spaced-r | Each sub-issue has been labeled with `needs-triage` and will be evaluated by the triage pipeline before queue routing.
Mark closed this issue 2026-06-09 06:15:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_kin_app_sync#81
No description provided.