# The Spectrum — Kalei Phase 2

## Scientific Foundation

The Spectrum is where multiple research pillars converge into a single intelligence layer.

**Expectation Effects (Stetler 2014, Pardo-Cabello et al. 2022):** The Turn Impact component ("Before & After") is a deliberate evidence engine. Stetler demonstrated that consistent adherence to a process reinforces positive expectations, which in turn improve outcomes — a documented feedback loop. By showing users concrete proof that reframing measurably shifts their subsequent emotional state, the Spectrum accelerates this cycle. The transparency doesn't weaken the effect; it strengthens it.

**Habit Formation (Wood & Neal 2007, Wood et al. 2021):** Rhythm Detection and streak mechanics implement Wood's finding that ~43% of daily behavior is habitual and that context stability predicts habit formation. The Spectrum tracks context patterns (time-of-day rhythms, weekly cycles) to help users understand and leverage their own behavioral patterns.

**Selective Attention (Yantis 2008, Stevens & Bavelier 2012):** Fragment Pattern tracking ("Your Glass") operates the Mirror's attentional principle at a longitudinal scale. Instead of highlighting individual distortions in real-time, it reveals macro-patterns: which cognitive biases dominate, how they shift over time, and which respond most to reframing. This is attentional self-knowledge — seeing your own perceptual filters from the outside.

**Self-Efficacy (Bandura 1977):** The Growth Trajectory ("The Long View") directly implements Bandura's most potent self-efficacy source: mastery experiences. By tracking fragment density decline, self-correction rate, and reframe adoption, the Spectrum provides concrete evidence of growing capability — "You are getting better at this" backed by data, not platitudes.

---

## Emotional Intelligence, Not Mood Tracking

Every wellness app asks you to rate your mood on a scale. Tap a smiley face. Drag a slider. It's self-reported, inaccurate, and most people stop doing it after two weeks because it feels like homework.

Kalei doesn't need to ask how you feel. **It already knows.**

By Phase 2, users have weeks or months of Mirror sessions, Turns, and Lens activity. Every word they've written, every fragment detected, every pattern revealed, every reframe they saved or dismissed — it's all data. Rich, personal, longitudinal emotional data that the user generated naturally while using features they already love.

The Spectrum turns that data into **self-knowledge**.

---

## Why "The Spectrum"

Light enters a prism and exits as a spectrum — the full range of colors that were always present but invisible to the naked eye. The Spectrum takes the raw light of your daily Kalei usage and separates it into its component colors so you can see what's really going on inside.

It also completes the optical metaphor system:

| Feature | Optical element | What it does |
|---------|----------------|--------------|
| The Mirror | Mirror | Reflects your thoughts back to you |
| The Kaleidoscope | Kaleidoscope | Rearranges fragments into patterns |
| The Lens | Lens | Focuses your vision on what's ahead |
| The Spectrum | Prism | Reveals the full range of what you're feeling |

---

## What The Spectrum Shows

### 1. The Emotional Landscape

A visual representation of your emotional state over time — not from self-reporting, but from **AI analysis of your Mirror sessions, Turns, and Lens check-ins.**

**How it works:**

Every Mirror message and Turn input is analyzed for emotional signatures across multiple dimensions:

- **Valence:** Positive ↔ Negative
- **Arousal:** Calm ↔ Activated
- **Certainty:** Confident ↔ Uncertain
- **Agency:** In control ↔ Helpless
- **Social orientation:** Connected ↔ Isolated
- **Temporal focus:** Past-dwelling ↔ Present ↔ Future-focused

These dimensions are plotted over time as a **flowing gradient visualization** — not a line chart, but a river of color that shifts and blends. Warm colors for activated states, cool for calm, dark for negative, bright for positive. The result looks like light passing through a prism: your emotional spectrum, laid out across days and weeks.

**The user sees:**
- The overall color/tone of their week at a glance
- Shifts and transitions (Tuesday was dark and activated → Wednesday calmed down after a Turn)
- Long-term trends (past month trending brighter, or a slow slide they hadn't noticed)

**What they don't see:** Numbers, scores, or ratings. The Spectrum is visual and intuitive, not clinical. You look at it and *feel* whether things are moving in the right direction.

### 2. Fragment Patterns — "Your Glass"

A breakdown of which cognitive distortion types appear most frequently in the user's writing.

**Visualization:** A faceted gem or crystal with different faces representing different distortion types. The larger the face, the more frequently that pattern appears. The gem evolves over time as patterns shift.

**Insights delivered in plain language:**

> "This month, **should statements** made up 34% of your fragments — up from 22% last month. You're putting more pressure on yourself than usual."

> "**Mind reading** dropped significantly since you started Turning those fragments. You assumed others' thoughts 8 times in January, only twice in February."

> "Your top 3 fragment types this month: catastrophizing, discounting positives, and black-and-white thinking."

**Why this matters:** Most people have 2-3 dominant cognitive distortions they don't know about. Seeing them named and tracked over time is genuinely transformative — it's the kind of insight you'd normally get after months of therapy.

### 3. Turn Impact — "Before & After"

Tracks the measurable effect of reframing on subsequent emotional state.

**How it works:**

The AI compares the emotional tone of Mirror sessions **before and after** a Turn:
- User writes in Mirror (frustrated, catastrophizing)
- User takes a fragment to the Kaleidoscope
- User writes in Mirror again later that day or the next day
- The Spectrum measures the shift

**What the user sees:**

> "After Turning a fragment, your next Mirror session is 62% more likely to show increased agency and reduced catastrophizing."

> "Your most impactful Turn this month was on Feb 3 — the shift in your writing afterward was significant."

> "Turns on work-related fragments have the strongest positive effect for you. Relationship fragments take 2-3 Turns before the shift shows up."

This is the **evidence engine** for Kalei's core thesis: that changing the angle actually changes how you feel. Users can see the proof in their own data.

**Science note:** This directly implements Stetler's (2014) adherence-expectation model. When users see measurable shifts in their own emotional data after Turns, it reinforces the expectation that reframing works — which increases future engagement and actual benefit. Pardo-Cabello et al. (2022) confirmed that the quality of the therapeutic relationship (or in Kalei's case, the app-user relationship) is the strongest predictor of whether expectation effects materialize. The Spectrum builds that trust through evidence.

### 4. Rhythm Detection — "Your Cycles"

Identifies recurring emotional patterns tied to time.

**Weekly rhythms:**
> "Your Mirror sessions on Mondays contain 3x more should statements than any other day."
> "Fridays tend to be your most positive writing days."

**Monthly rhythms:**
> "The last week of each month shows elevated anxiety patterns — possibly tied to deadlines or financial cycles."

**Event correlation (Lens integration):**
> "When you check in with your Lens goals in the morning, your afternoon Mirror sessions show 40% fewer negative fragments."

**Contextual patterns:**
> "After writing about [work] topics, catastrophizing spikes. After writing about [relationships], personalization is more common."

The user starts to see their emotional life as a **landscape with terrain** rather than random weather. Some hills are always there. Some valleys are seasonal. That awareness alone is a superpower.

**Science note:** Rhythm Detection operationalizes Wood et al.'s (2021) finding that habits are triggered by context cues. By revealing temporal patterns ("Mondays are heavy on should-statements"), the Spectrum helps users anticipate and prepare for predictable emotional terrain — turning reactive coping into proactive awareness.

### 5. Growth Trajectory — "The Long View"

The headline metric: **how is this person's relationship with their own thinking changing over time?**

**Tracked indicators:**
- Fragment density: How many distortions per 100 words in Mirror sessions (trending down = growth)
- Self-correction rate: How often the user identifies their own fragments before Kalei highlights them (measured by editing/deleting mid-message)
- Reframe adoption: How often saved patterns from Turns echo in subsequent Mirror writing (user naturally using new perspectives)
- Distortion diversity: Whether the user is getting stuck on one pattern or successfully addressing multiple types
- Turn-to-insight ratio: How many Turns result in a saved keepsake vs. dismissed patterns

**Visualization:** A single, evolving kaleidoscope pattern that represents your overall growth. The more you use Kalei, the more complex, colorful, and beautiful the pattern becomes. At month 1, it might be simple and muted. At month 6, it's intricate and vivid.

This becomes the **centerpiece of the Spectrum dashboard** — your personal growth, visualized as a living kaleidoscope pattern.

**Science note:** Every tracked indicator maps to Bandura's (1977) self-efficacy sources. Fragment density decline and self-correction rate are mastery experiences (the strongest efficacy source). Reframe adoption shows vicarious learning internalized. The evolving pattern visualization provides a visceral, non-numerical representation of growing capability — "I am getting better at this" made visible.

**Milestone moments:**

> "Your fragment density has dropped 30% since you started. You're catching your own patterns now."

> "This week, you naturally reframed a catastrophizing thought in your Mirror session without needing a Turn. That's new."

> "You've explored all 10 fragment types. You're seeing the full spectrum."

---

## The Spectrum Dashboard — Layout

### Top Section: The River
Your emotional landscape as a flowing color gradient. Swipe horizontally to scroll through time. Tap any point to see the Mirror session or Turn from that day.

### Middle Section: Your Glass
The faceted gem visualization showing fragment type distribution. Toggle between "This week," "This month," "All time." Tap any facet for the distortion deep-dive.

### Bottom Section: Insights Feed
A scrollable feed of AI-generated insights, refreshed weekly. Each insight is a card with:
- A one-line observation
- Supporting data (subtle, not overwhelming)
- An action suggestion when relevant

### Floating Element: Your Pattern
Your evolving kaleidoscope pattern, accessible from the top corner. Tap to expand full-screen. Shareable as a "growth snapshot."

---

## When Insights Are Delivered

The Spectrum doesn't bombard users with data. Insights surface at natural moments:

### Weekly Reflection (Push Notification)
Every Sunday evening (or user-configured day):
> "Your Spectrum updated. See what this week's light revealed. 🔮"

Opens to a **Weekly Spectrum Summary:**
- Dominant emotional color this week
- Top fragment type
- Most impactful Turn
- One insight
- The week's addition to your evolving pattern

### Monthly Deep Dive
First of each month:
> "January's Spectrum is ready. See how your light shifted."

A richer summary with month-over-month comparisons, rhythm detection insights, and growth trajectory updates.

### In-Context Nudges
Subtle, non-intrusive insights surfaced within other features:
- In the Mirror: "You've used the phrase 'I should' 4 times this session. That's a pattern worth noticing."
- After a Turn: "This is the 3rd time you've Turned a work-related fragment this week. The Spectrum can show you more about this pattern."
- In the Lens: "Your Lens focus on [career growth] aligns with the fragments you've been processing. You're working on the right things."

---

## Monetization

The Spectrum is a **Kalei Prism exclusive feature**. It's the single strongest reason to upgrade in Phase 2.

**Free tier gets:**
- A simplified weekly emotional summary (1 insight, no visualizations)
- Fragment type counts (basic numbers only)
- A teaser of what the full Spectrum shows: "Upgrade to see your full Spectrum"

**Prism tier gets:**
- Full Spectrum dashboard with all 5 sections
- Weekly and monthly deep dives
- Growth trajectory and evolving pattern
- Rhythm detection
- Turn impact analysis
- Export and sharing of Spectrum snapshots

**Upgrade CTA:**
> "You've written 47 Mirror sessions and completed 23 Turns. There's a story in that data. See your full Spectrum."

This is a natural paywall because the Spectrum **requires usage history to be valuable.** By the time a user has enough data for the Spectrum to be meaningful, they've already experienced Kalei's value through the free tier and are primed to convert.

---

## Privacy Architecture

The Spectrum analyzes deeply personal data. Trust is non-negotiable.

### Principles

1. **All analysis happens on aggregated patterns, never exposed raw content.** The Spectrum shows "your catastrophizing increased this week" — it never shows "you wrote 'my life is falling apart' on Tuesday"
2. **No Spectrum data leaves the user's account.** Not for model training, not for anonymized research, not for anything
3. **Users control the window.** They can exclude any Mirror session or Turn from Spectrum analysis. They can set the Spectrum to only analyze the last 30/60/90 days
4. **Full deletion.** "Reset my Spectrum" erases all analyzed data and starts fresh
5. **Transparency.** A "How this works" section explains exactly what the AI analyzes and what it doesn't

### Data Processing

Spectrum analysis runs as a **background job**, not in real-time:
- After each Mirror session ends, emotional dimensions are computed and stored as numerical vectors — not raw text
- Fragment types are already captured during Mirror sessions
- Weekly aggregation job runs to compute trends, rhythms, and insights
- The Spectrum dashboard reads from aggregated data only

```sql
-- Emotional analysis per Mirror session
CREATE TABLE spectrum_session_analysis (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID REFERENCES users(id),
  session_id UUID REFERENCES mirror_sessions(id),
  session_date DATE NOT NULL,
  valence FLOAT,          -- -1 (negative) to 1 (positive)
  arousal FLOAT,          -- -1 (calm) to 1 (activated)
  certainty FLOAT,        -- -1 (uncertain) to 1 (confident)
  agency FLOAT,           -- -1 (helpless) to 1 (in control)
  social_orientation FLOAT, -- -1 (isolated) to 1 (connected)
  temporal_focus FLOAT,   -- -1 (past) to 0 (present) to 1 (future)
  fragment_count INTEGER,
  word_count INTEGER,
  dominant_distortion VARCHAR(50),
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Emotional analysis per Turn
CREATE TABLE spectrum_turn_analysis (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID REFERENCES users(id),
  turn_id UUID REFERENCES turns(id),
  turn_date DATE NOT NULL,
  pre_valence FLOAT,      -- emotional state of input
  post_valence FLOAT,     -- emotional state after reframe engagement
  distortion_type VARCHAR(50),
  reframe_saved BOOLEAN,
  topic_cluster VARCHAR(100),
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Weekly aggregated insights
CREATE TABLE spectrum_weekly (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID REFERENCES users(id),
  week_start DATE NOT NULL,
  avg_valence FLOAT,
  avg_arousal FLOAT,
  avg_agency FLOAT,
  total_fragments INTEGER,
  total_turns INTEGER,
  total_mirror_sessions INTEGER,
  dominant_distortion VARCHAR(50),
  distortion_distribution JSONB,  -- {"catastrophizing": 5, "mind_reading": 3, ...}
  fragment_density FLOAT,         -- fragments per 100 words
  turn_impact_score FLOAT,        -- measured shift after turns
  insight_text TEXT,               -- AI-generated weekly insight
  created_at TIMESTAMPTZ DEFAULT NOW(),
  UNIQUE(user_id, week_start)
);

-- Monthly deep dive
CREATE TABLE spectrum_monthly (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID REFERENCES users(id),
  month_start DATE NOT NULL,
  growth_score FLOAT,             -- composite improvement metric
  rhythm_insights JSONB,          -- detected patterns tied to time
  month_over_month_delta JSONB,   -- comparison with previous month
  top_fragment_types JSONB,       -- ranked list
  most_impactful_turn UUID,       -- references turn with biggest shift
  pattern_complexity_score FLOAT, -- drives evolving visual pattern
  narrative_summary TEXT,         -- AI-generated monthly narrative
  created_at TIMESTAMPTZ DEFAULT NOW(),
  UNIQUE(user_id, month_start)
);
```

---

## Notification Copy — Spectrum Voice

The Spectrum speaks with slightly more authority than other Kalei features — it has data behind it. But still warm, still poetic.

### Weekly

- "Your Spectrum shifted this week. Come see the colors."
- "7 days of fragments and patterns. Here's what the light reveals."
- "This week had a rhythm. The Spectrum caught it."

### Monthly

- "A month of Turns. Your Spectrum has a story to tell."
- "January's light, separated into its colors. Your monthly Spectrum is ready."

### Milestone Insights

- "First month of Spectrum data. Your baseline is set — now watch it evolve."
- "Your fragment density dropped below 5 per 100 words for the first time. You're catching yourself."
- "3 consecutive weeks of increasing agency in your writing. Something shifted."
- "You haven't catastrophized in 12 days. That's your longest streak."

### Growth Pattern Evolution

- "Your pattern grew a new layer this month. Tap to see it."
- "Remember your first pattern? Compare it to today's. Look how far you've come."

---

## The Spectrum as Retention Engine

The Spectrum solves the biggest problem in wellness apps: **the drop-off after the initial novelty fades.**

**Week 1-2:** Users are engaged with the Mirror and Kaleidoscope. Everything is new.

**Week 3-4:** Novelty fades. This is where most wellness apps lose people.

**With the Spectrum (Phase 2 timing — launched when early users hit this exact window):**

- "Your first Spectrum is ready" re-engages users with a new reason to open the app
- The evolving pattern creates **collection psychology** — users want to see it grow
- Weekly insights create a **recurring appointment** with the app
- Growth trajectory shows **concrete progress** — "this is working" evidence
- Fragment tracking creates **self-competition** — users try to beat their own patterns
- Monthly deep dives become **anticipated events** — not notifications to dismiss

The Spectrum turns Kalei from a tool you use when you feel bad into a **dashboard you check because you're curious about yourself.** That's the difference between reactive usage (declining) and proactive usage (compounding).

**Science note:** This retention mechanic is grounded in both habit formation and expectation effects. Wood et al. (2021) showed that shifting behavior from goal-directed (conscious, effortful) to habitual (automatic, context-triggered) is what sustains long-term change. Stetler (2014) showed that consistent engagement reinforces positive expectations. The Spectrum provides the evidence that keeps both loops spinning.

---

## Phase 2 Launch Sequence

### Pre-Launch (2 weeks before)

Notification to existing users:
> "You've completed [X] Turns and [Y] Mirror sessions. Something new is coming that turns all of that into self-knowledge. Stay tuned."

### Launch Day

> "The Spectrum is here. Every Turn you've taken, every fragment you've noticed — it all means something. See your full emotional landscape for the first time."

Open to a dramatic reveal of their personal Spectrum for the first time — the river visualization populating with their historical data, the gem forming its facets, the evolving pattern appearing.

This should be a **wow moment.** The user's own emotional history, visualized beautifully for the first time. Data they generated without thinking about it, now reflecting back as genuine self-knowledge.

### Post-Launch (ongoing)

Weekly and monthly cadence takes over. The Spectrum becomes a background engine that surfaces insights at the right moments and gives users a reason to maintain their Mirror and Turn habits.

---

## Updated Feature Map — Full Kalei Ecosystem

```
PHASE 1                              PHASE 2
─────────────────────────────────    ──────────────────────

THE MIRROR (Awareness)          ──→  feeds data to ──→  THE SPECTRUM
  Write freely                                          (Intelligence)
  AI highlights fragments                                See your patterns
  Inline reframes                                        Track growth
                                                         Discover rhythms
THE KALEIDOSCOPE (Perspective)  ──→  feeds data to ──→   Measure impact
  Structured reframing                                   Evolving visual
  Fragment → Patterns
  Save keepsakes

THE LENS (Direction)            ──→  informed by  ──→
  Goal setting
  Daily affirmations
  Vision tracking

         ◇                                ◇
    Kalei Free                       Kalei Prism
   3 Turns/day                    Unlimited everything
   2 Mirror/week                  + Full Spectrum
   Basic Lens                     + Weekly/monthly insights
                                  + Growth trajectory
                                  + Fragment analytics
```

---

*White light looks simple. The Spectrum shows you everything it's made of.*
