Skip to main content

Streaks

Track daily engagement with automatic streak counting, break detection, and longest-streak records.

Recording Activity

Record Streak Activity
  • First call creates the streak record
  • Same-day calls are no-ops (safe to call multiple times)
  • Consecutive-day calls extend the streak
  • Missed days reset the streak to 1 (longest is preserved)

Querying Streaks

Streak Queries

PrismStreakSnapshot

Resetting Streaks

Reset Streak

Streak Events

The manager emits events when streaks change:
Streak Events

Badges

A tiered badge system with automatic unlock evaluation based on challenge completion, points, or streaks.

The PrismBadge Protocol

Protocol

Badge Tiers

Five tiers from lowest to highest — Comparable for sorting:
Tiers

Unlock Conditions

Conditions

Defining Badges

Badge Enum

Registration

Register Badges

Auto-Evaluation

Evaluate all badges and auto-unlock those whose conditions are met:
Evaluate
Call evaluateBadges after significant events — challenge completions, point changes, or streak milestones. Badges with .custom conditions are never auto-unlocked.

Manual Unlock

Manual Unlock

Querying Badges

Badge Queries

PrismBadgeSnapshot

Badge Events

Badge Events