# Arete — Features and Capabilities

> Arete (Ἀρετή, pronounced ah-reh-TAY) is the ancient Greek concept of
> excellence, virtue, and the fullest expression of one's capabilities — the
> quality of living up to one's highest potential. The Arete domain is a
> comprehensive personal development and life mastery platform built on twelve
> TypeScript libraries and delivered through three applications — a Fastify REST
> API, a React web dashboard, and a React Native mobile app. It draws from the
> most rigorously validated frameworks in behavioral science and
> self-development: Stephen Covey's 7 Habits of Highly Effective People, James
> Clear's Atomic Habits, BJ Fogg's Tiny Habits methodology, OKR goal management
> as practiced at Google, WOOP mental contrasting (Gabriele Oettingen),
> Cognitive Behavioral Therapy (CBT) journaling techniques, Cal Newport's deep
> work principles, and Martin Seligman's PERMA model of flourishing. The domain
> spans habit formation and tracking, structured goal achievement, reflective
> journaling, time management systems, life vision and purpose work, wellness
> and life balance assessment, affirmations, gamification, and AI-powered
> personal coaching.

---

Arete owns personal development and life mastery as a domain. Adjacent domains
handle complementary but distinct concerns: Shakti owns physical discipline and
fitness, Tara/Meditation owns contemplative practice, and Iris/Psyche may
provide conversational coaching interfaces. Features that fall naturally into
those areas are not duplicated here.

The sections below describe each of the twelve libraries in depth. Each section
names its package, explains the real-world problem it solves, and describes
every module's capabilities — grounded in the behavioral science framework the
module implements.

---

## 1. Habit Formation and Tracking

**Package:** `@arete/habits`

Habit formation is the most foundational personal development problem: most
goals fail not because the goal is wrong but because the daily behaviors
supporting it are never reliably established. `@arete/habits` provides a
complete habit engine built on the three most empirically validated frameworks
for behavior change — Atomic Habits (James Clear), Tiny Habits (BJ Fogg), and
the classic habit-loop model (Charles Duhigg). Beyond basic tracking, it
implements the V1 humane-streak model with friction detection and recovery
support.

### 1.1 Core Habit Management

Every habit record stores: name, description, category, frequency, the
cue-routine-reward structure, an active flag, and tracking stats (current
streak, best streak, total completions). Full CRUD operations allow habits to be
created, updated, archived, and deleted without losing historical completion
data.

- **Frequency options** — `daily`, `weekly`, `specific_days`, `flexible`, or
  `x_per_week`. This covers everything from a daily morning run to a
  three-times-a-week workout.
- **Category organization** — A free-text category (for example `health`,
  `productivity`, `relationships`) groups habits so users can see which life
  areas are well-covered and which are neglected.
- **Completion tracking** — Record completions with date, optional exact
  timestamp, optional notes, and a quality rating (1–5), so users can
  distinguish perfunctory check-offs from truly satisfying practice. A
  completion may also be recorded as an intentional skip with a reason.
- **Habit archiving** — Archive completed or paused habits without losing
  historical data. An archived habit's completion history remains queryable for
  analytics.

### 1.2 Atomic Habits — Cue-Routine-Reward Loop

James Clear's _Atomic Habits_ (and earlier work by Charles Duhigg) describes all
habits as consisting of a **cue** (trigger), **routine** (the behavior), and
**reward** (the reinforcement). Making this structure explicit helps users
understand and deliberately design their habits.

- **Cue definition** — Specify the exact trigger: time of day, location,
  preceding action (habit stacking anchor), emotional state, or social context
  (other people present). Specific cues dramatically improve follow-through.
- **Routine specification** — Detail the exact behavior in micro-steps for
  maximum clarity ("Put on running shoes, plug in earphones, walk to the door").
  Vague routines fail; specific ones succeed.
- **Reward design** — Define the immediate reward that reinforces the behavior.
  The reward can be intrinsic (the feeling of accomplishment) or extrinsic (a
  favorite song during the run).
- **Loop visualization** — View the complete cue-routine-reward loop as a visual
  diagram, reinforcing conscious awareness of the habit structure.
- **Loop refinement** — Iterate on each element based on completion data and
  user reflection.

### 1.3 Four Laws of Behavior Change (James Clear)

James Clear's four laws of behavior change provide a practical framework for
making habits stick. Each law has a counterpart for breaking bad habits. The
table below summarizes each law alongside the specific tools that implement it.

| Law                | Tools                                                                                                                               |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| Make it obvious    | Implementation intentions ("I will [behavior] at [time] in [location]"), habit scorecards, environment design suggestions           |
| Make it attractive | Temptation bundling (pair a habit you need with one you want), motivation rituals, social norm leveraging                           |
| Make it easy       | Two-minute rule for habit entry points, habit shaping (progressively harder versions), friction reduction, environment optimization |
| Make it satisfying | Immediate reward tracking, never-miss-twice enforcement, accountability partner integration                                         |
| Breaking habits    | Invert the four laws: make it invisible, unattractive, difficult, and unsatisfying                                                  |

**Temptation bundling** pairs an enjoyable activity with a required habit (e.g.,
only listening to a favorite podcast while exercising) to make the habit more
immediately appealing. **The two-minute rule** means starting a new habit with a
scaled-down version that takes less than two minutes, exploiting the inertia of
beginning.

### 1.4 Habit Stacking (BJ Fogg's Tiny Habits)

Habit stacking links a new habit to an existing one using the formula: "After I
[current habit], I will [new habit]." This exploits existing neural pathways to
build new ones more reliably than using time or place alone as cues.

- **Stack creation** — Build the "After I... I will..." formula with
  auto-complete suggestions from the user's existing habits.
- **Multi-habit chains** — Build sequences of 3+ habits that flow together into
  a morning or evening routine.
- **Anchor habits** — Identify which existing habits are the most reliable
  "anchors" — the strongest candidates for habit stacking.
- **Stack visualization** — View daily habit stacks as connected sequences
  showing the full morning or evening routine.
- **Stack optimization** — Suggest reordering based on energy levels (put
  high-effort habits at high-energy times) and habit difficulty.

### 1.5 Celebration and Reinforcement

BJ Fogg's research shows that immediate positive emotion after completing a
behavior is crucial for habit formation. Celebration creates a felt sense of
success that the brain seeks to repeat.

- **Immediate celebration prompts** — After completing a habit, the app prompts
  a micro-celebration (a fist pump, a smile, a verbal "Yes!") performed
  immediately, not as a delayed check-off.
- **Celebration patterns** — Multiple celebration styles maintain novelty and
  emotional impact; using the same celebration every time loses its effect.
- **Reinforcement timing** — The system ensures celebrations happen within the
  critical window immediately after behavior completion, not minutes later.
- **Emotional anchoring** — Build positive emotional associations with target
  behaviors, making them intrinsically rewarding.

### 1.6 Streak System

The streak system is implemented partly in PostgreSQL (a trigger fires on every
`arete_habit_completions` INSERT and recalculates streaks atomically) and partly
in TypeScript for the humane-streak V1 model.

- **Automatic streak calculation** — A PostgreSQL trigger automatically
  recalculates streak length on each completion, including forgiveness-day
  logic, without requiring application-layer computation.
- **Current and longest streaks** — Display both the active streak and the
  all-time personal record, motivating both daily maintenance and long-term
  ambition.
- **Forgiveness days** — Configurable "free pass" days prevent streak loss for
  occasional misses due to illness or life events.
- **Streak freezes** — Manually freeze a streak before a planned absence
  (travel, hospital stay) to preserve progress without dishonesty.
- **Streak milestones** — Celebrate milestones at 7, 14, 21, 30, 66, 100, 180,
  and 365 days, each with a tailored message. The **21-day** and **66-day**
  markers are important: popular mythology says 21 days builds a habit, but
  research (Phillippa Lally, UCL) found the actual average is about 66 days.
- **Streak recovery** — Grace periods and recovery mechanics after breaks, so a
  broken streak doesn't feel like a permanent failure.

### 1.7 Identity-Based Habits

James Clear argues that the most powerful habit motivation comes from identity
rather than outcomes: instead of "I want to run a marathon" (outcome), the
driver is "I am a runner" (identity). Each habit completion is a vote for the
desired identity.

- **Identity statements** — Define target identity ("I am a person who reads
  every day") and link habits to it.
- **Evidence tracking** — Log evidence that supports the target identity through
  daily actions ("read 20 pages today → evidence for 'I am a reader'").
- **Identity reinforcement** — Surface identity statements during habit
  reminders to prime the identity before the behavior.
- **Identity evolution** — Track how self-identity narratives shift over time
  through accumulated evidence.

### 1.8 Keystone Habits

Keystone habits are habits that create positive **cascading effects** across
multiple life areas. Research by Charles Duhigg found that regular exercise, for
example, tends to improve diet, sleep, mood, and productivity simultaneously.

- **Keystone identification** — Tools to identify which habits produce the most
  positive downstream effects on other behaviors.
- **Cascade tracking** — Monitor downstream effects of keystone habits through
  correlation analysis in habit analytics.
- **Priority weighting** — Keystone habits receive higher priority weighting in
  daily planning and reminders.

### 1.9 Habit Analytics

- **Completion rates** — Daily, weekly, monthly, and all-time completion
  percentages per habit.
- **Trend analysis** — Identify improving, declining, and stable habit patterns
  over time, with alerts when a previously strong habit begins slipping.
- **Time-of-day insights** — Discover optimal execution times based on when
  completions actually happen versus when they are scheduled.
- **Correlation analysis** — Find relationships between habits (e.g., morning
  exercise correlates with evening journaling completion).
- **Predictive analytics** — Forecast habit maintenance probability based on
  historical patterns, enabling proactive intervention.

### 1.10 Reminders and Notifications

- **Scheduled reminders** — Time-based reminders for each habit at configured
  times.
- **Location-based triggers** — Reminders triggered by arriving at or leaving
  specific locations (e.g., "gym reminder" when arriving at the gym area).
- **Smart timing** — Adaptive reminder timing based on when the user actually
  completes habits, gradually shifting reminders toward the most effective
  times.
- **Gentle escalation** — Progressively more insistent reminders if habits are
  not completed as the day progresses.
- **Batch notifications** — Group habit reminders to reduce notification
  fatigue.

---

## 2. Goal Setting and Achievement

**Package:** `@arete/goals`

Goals without structure fail. `@arete/goals` addresses this by implementing five
distinct goal-setting frameworks rather than a single one-size-fits-all model. A
user planning their career uses OKRs; a user working on a health goal uses SMART
criteria; a user struggling with procrastination uses WOOP. The framework
diversity reflects how real users actually set and pursue goals.

### 2.1 Core Goal Management

Full CRUD with: title, description, start date, target date, progress percentage
(0–100), a time-horizon type (annual, quarterly, monthly, weekly, daily), and
status tracking — Not Started, In Progress, Completed, Abandoned, or Paused.

- **Goal hierarchy** — Parent-child goal trees allow top-level life goals to
  decompose into sub-goals and then into daily tasks and habits. A 5-year career
  vision becomes a 1-year project, which becomes quarterly milestones, which
  become weekly habits. Hierarchy is modelled both by a self-referential parent
  reference and by an explicit parent/child join table.
- **Time horizons** — Goals carry a horizon type so annual goals decompose into
  quarterly, monthly, weekly, and daily goals.

### 2.2 SMART Goals

SMART (Specific, Measurable, Achievable, Relevant, Time-bound) is the standard
framework for effective goal setting. The table below shows what each criterion
requires and what the system provides to help users meet it.

| Criterion     | Capability                                                                      |
| ------------- | ------------------------------------------------------------------------------- |
| Specific      | Guide users to define precisely what they want to achieve                       |
| Measurable    | Attach quantifiable metrics and target values (weight, income, pages/day)       |
| Achievable    | Evaluate whether the goal is realistic given current resources                  |
| Relevant      | Ensure alignment with broader life purpose and stated values                    |
| Time-bound    | Set specific target dates with milestone checkpoints                            |
| SMART scoring | Score each goal against all five criteria with specific improvement suggestions |

### 2.3 OKR (Objectives and Key Results)

OKRs are a management framework popularized by Google and Intel. An
**Objective** is an ambitious, qualitative direction; **Key Results** are 3–5
measurable outcomes that prove the objective is being achieved.

- **Objective definition** — Aspirational qualitative objectives for quarterly
  or annual periods.
- **Key result tracking** — Attach 3–5 measurable key results with progress
  percentages (0–100%) and a 0.0–1.0 achievement score.
- **Quarterly planning** — Structured quarterly OKR setting and review cycles
  with a 13th-week buffer between cycles for review and planning.
- **Scoring and grading** — Color-coded score: 0.0–0.3 (red, needs attention),
  0.4–0.6 (yellow, needs improvement), 0.7–1.0 (green, on track). OKR philosophy
  holds that a 0.7 is "good" — consistently scoring 1.0 means the objectives
  were not ambitious enough.

### 2.4 WOOP (Mental Contrasting)

WOOP (Wish, Outcome, Obstacle, Plan) was developed by psychologist Gabriele
Oettingen as an evidence-based technique that combines positive visualization
with realistic obstacle planning. Unlike pure positive thinking, WOOP's obstacle
identification and "if-then" planning significantly increase goal achievement
rates in research studies.

- **Wish** — Define a meaningful wish or goal in concrete terms.
- **Outcome** — Describe the best outcome of achieving the wish in vivid,
  sensory detail (visualization activates goal-relevant neural networks).
- **Obstacle** — Identify the primary **internal** obstacle — the psychological
  factor most likely to prevent achieving the wish (not external circumstances).
- **Plan (If-Then)** — Create an implementation intention: "If [obstacle
  occurs], then I will [specific action]." This pre-commitment dramatically
  reduces the cognitive load of responding to obstacles.

### 2.5 12 Week Year

The 12 Week Year framework (Brian Moran) treats each 12-week period as a full
year to create urgency and focus. Eliminating annual thinking prevents the "I
still have 8 months left" procrastination that afflicts January resolutions.

- **12-week planning cycles** — Focused sprint goals rather than annual
  timelines.
- **Weekly reviews and scoring** — Weekly execution scores (percentage of
  planned actions completed), with anything above 85% considered on track.
- **Lead and lag measures** — Track leading indicators (actions taken this week)
  alongside lagging indicators (results achieved) — leads predict future
  success; lags report past performance.
- **13th week review** — A dedicated buffer week between cycles for deep review
  and planning the next 12-week cycle.

### 2.6 Goal Progress Tracking

- **Progress milestones** — Define and celebrate intermediate milestones on the
  path to goal completion.
- **Progress visualization** — Visual progress bars, percentage completion, and
  timeline views.
- **Blockers and dependencies** — Track what is blocking goal progress and
  dependencies between goals.

### 2.7 Goal Analytics

- **Completion rates** — Overall goal completion rate and average time to
  completion.
- **Category performance** — Which life domains have the strongest and weakest
  goal achievement, revealing where to direct attention.
- **Abandoned goal analysis** — Review abandoned goals to identify patterns and
  improve future goal setting.
- **Goal-habit correlation** — Connect goal progress to underlying habit
  performance, showing which habits most strongly predict goal achievement.

---

## 3. Journaling and Reflection

**Package:** `@arete/journal`

Journaling as a practice spans several distinct psychological purposes: clearing
mental clutter, processing difficult emotions, cultivating gratitude,
challenging distorted thinking, and reviewing progress over time.
`@arete/journal` models these as nine distinct modules, each implementing a
recognized technique rather than offering a generic text editor.

### 3.1 Core Journal Entry Management

- **Rich-text entries** — Full entries with formatted text, headings, lists, and
  embedded content.
- **Tagging system** — Multiple tags per entry for cross-cutting categorization
  and retrieval.
- **Version history** — Maintain revision history for edited entries.
- **Full-text search** — PostgreSQL GIN-indexed full-text search across all
  content and titles for instant retrieval.
- **Date-based browsing** — Browse entries by date with calendar view.

### 3.2 Morning Pages (Julia Cameron)

Julia Cameron's _The Artist's Way_ prescribes three pages of stream-of-
consciousness morning writing as a practice for clearing mental clutter and
unblocking creativity. The content is not meant to be read or analyzed — it is a
cognitive "brain dump" that clears the way for creative and productive work.

- **750-word target** — Three pages of standard handwriting approximates 750
  words. Real-time word count with progress indicator toward the target.
- **Streak tracking** — Track consecutive days of morning pages practice.
- **No judgment design** — The UI deliberately avoids editing tools during
  writing to encourage free-flowing, uncensored expression.
- **Optional AI analysis** — After entry, optional analysis of recurring themes
  and patterns over time, surfaced as insights rather than real-time feedback.

### 3.3 Five-Minute Journal

The Five-Minute Journal (Intelligent Change) is a structured gratitude and
intention-setting practice designed to take under 5 minutes. Research by Robert
Emmons and others shows gratitude practice consistently improves wellbeing,
mood, and life satisfaction.

- **Morning template** — Three items you are grateful for, three intentions for
  the day, and a daily affirmation.
- **Evening template** — Three amazing things that happened today, and one way
  the day could have been better.
- **Paired entries** — Morning and evening entries are linked as a single day's
  practice, enabling day-level review.

### 3.4 Gratitude Journaling

- **Categorized gratitude** — Organize gratitude entries by category: people,
  experiences, possessions, nature, health, opportunities.
- **Gratitude trends** — Visualize which categories receive the most gratitude
  attention over time, identifying where appreciation is concentrated.
- **Gratitude reminders** — Scheduled prompts to capture gratitude moments
  throughout the day, not just at a single fixed time.
- **Gratitude streak** — Track consecutive days of gratitude practice.

### 3.5 CBT Thought Records

Cognitive Behavioral Therapy (CBT) thought records are a core CBT intervention
for identifying and reframing negative automatic thoughts — the immediate,
involuntary interpretations that follow triggering events.

- **Situation capture** — Record the triggering situation (what happened, where,
  when, with whom).
- **Automatic thoughts** — Identify and record the automatic negative thoughts
  that arose.
- **Cognitive distortion identification** — Classify distortions: all-or-
  nothing thinking, overgeneralization, catastrophizing, mind reading, fortune
  telling, personalization, emotional reasoning, should statements, labeling,
  and magnification/minimization.
- **Evidence examination** — List evidence for and against the automatic
  thought.
- **Alternative thinking** — Generate balanced alternative thoughts that account
  for both the supporting and contrary evidence.
- **Mood re-rating** — Rate mood before and after completing the thought record
  to track whether the exercise produced a shift.
- **Pattern recognition** — Identify the most frequently recurring cognitive
  distortions over time.

### 3.6 Worry Journal

Worry journaling is a technique for containing anxiety by designating specific
"worry time" rather than allowing worry to intrude throughout the day.

- **Scheduled worry time** — Dedicate a specific time window for worry
  processing; when worries arise outside this window, they are deferred to the
  journal.
- **Worry capture** — Record worries with category, severity rating, and
  controllability assessment.
- **Worry outcome tracking** — Follow up on past worries to see how many
  actually materialized — most worry is about events that never occur.
- **Worry pattern analysis** — Identify recurring worry themes and resolution
  rates over time.

### 3.7 Prompted Journaling

- **300+ curated prompts** — A built-in prompt set of 300+ prompts spanning six
  categories: self-discovery, goal clarification, relationships, career and
  purpose, fear and obstacles, and values clarification.
- **Daily prompt selection** — Automatic daily prompt with variety algorithms to
  avoid repetition.
- **Custom prompts** — Add personal prompts and mark favorites for inclusion in
  the rotation.

### 3.8 Reflection Cycles

Structured reflection at five timeframes helps users zoom in for daily review
and zoom out for longer-term course correction. Each cadence has its own
template focused on the questions most relevant to that time horizon.

| Cadence   | Focus                                                                    |
| --------- | ------------------------------------------------------------------------ |
| Daily     | End-of-day review: wins, lessons, tomorrow's priorities                  |
| Weekly    | Habit review, goal progress, key learnings, upcoming priorities          |
| Monthly   | Assessment of progress, adjustments, upcoming focus areas                |
| Quarterly | Deep quarterly review aligned with OKR cycles and goal assessment        |
| Annual    | Comprehensive year-in-review: accomplishments, lessons, next-year vision |

### 3.9 Journal Analytics

- **Sentiment tracking** — Track emotional sentiment (positive / negative /
  neutral) across journal entries over time.
- **Emotion detection** — Identify specific emotions (joy, sadness, anger, fear,
  surprise, anticipation, trust, disgust) expressed in writing.
- **Topic extraction** — Discover recurring themes and topics across entries
  using NLP-based topic modeling.
- **Writing consistency** — Track journaling frequency, word counts, and time-
  of-day writing patterns.

---

## 4. Time Management and Productivity

**Package:** `@arete/time`

Time management is the bridge between aspiration and execution. `@arete/time`
implements nine distinct modules across four validated frameworks: the
Eisenhower Matrix for task prioritization, GTD for capturing and organizing
commitments, time blocking and Big Rocks First for scheduling, and the Pomodoro
Technique and deep work sessions for focused execution.

### 4.1 Eisenhower Matrix

The **Eisenhower Matrix** (also called the Urgent/Important matrix or Covey's
Time Management Matrix) classifies all tasks into four quadrants based on
urgency and importance. The goal is to maximize time in Quadrant II (Not
Urgent/Important) — strategic planning, relationship building, skill
development.

| Quadrant                      | Description                     | Strategy  |
| ----------------------------- | ------------------------------- | --------- |
| Q1 (Urgent/Important)         | Crises, deadlines, emergencies  | Do first  |
| Q2 (Not Urgent/Important)     | Planning, prevention, growth    | Schedule  |
| Q3 (Urgent/Not Important)     | Interruptions, some meetings    | Delegate  |
| Q4 (Not Urgent/Not Important) | Time wasters, mindless browsing | Eliminate |

- **Task classification** — Classify tasks across the four quadrants with visual
  matrix display.
- **Quadrant analysis** — Show how much time is spent in each quadrant,
  revealing how much of your week is reactive (Q1/Q3) versus proactive (Q2).
- **Task migration** — Move tasks between quadrants as urgency and importance
  change.

### 4.2 GTD (Getting Things Done)

David Allen's **GTD** (Getting Things Done) methodology treats the mind as a
processor, not storage. Every open loop (uncaptured commitment or task) consumes
cognitive bandwidth. GTD externalizes all commitments to a trusted system.

- **Inbox capture** — Quick capture of thoughts, tasks, and commitments into a
  universal inbox at any moment.
- **Processing workflow** — Structured two-minute rule processing: Is it
  actionable? What is the next action? Can it be done in 2 minutes (do it now)?
  Or delegate/defer.
- **Context-based lists** — Organize actions by context: @home, @work,
  @computer, @phone, @errands.
- **Project tracking** — Multi-step outcomes as projects with explicit
  next-action identification.
- **Someday/Maybe list** — Parking lot for ideas not yet committed to.
- **Weekly review** — Three-phase GTD weekly review: get clear (inbox zero), get
  current (review all lists), get creative (new ideas).
- **Reference filing** — Non-actionable but useful information filed for future
  retrieval.

### 4.3 Big Rocks First

Stephen Covey's **"big rocks"** metaphor: if you fill a jar with pebbles and
sand first, the big rocks won't fit. But if you put the big rocks in first, the
smaller things fill in around them. Applied to time: schedule your most
important priorities (big rocks) before smaller tasks fill the calendar.

- **Big rock identification** — Identify the 3–5 most important priorities for
  the week before scheduling anything else.
- **Calendar blocking** — Block time for big rocks before smaller tasks can fill
  the schedule.
- **Pebbles and sand** — Fit smaller tasks around the big rocks rather than the
  reverse.
- **Weekly big rock planning** — Sunday or Monday planning session to select the
  week's big rocks.

### 4.4 Time Blocking

**Time blocking** (popularized by Cal Newport) is the practice of intentionally
scheduling every hour of the workday as named blocks, rather than working from a
reactive to-do list.

- **Block creation** — Named time blocks with start time, duration, and
  category.
- **Template schedules** — Create reusable daily and weekly time block templates
  for recurring schedules.
- **Ideal week design** — Design an "ideal week" schedule and compare actual
  time allocation against the ideal to identify drift.
- **Buffer time** — Built-in buffer blocks between sessions for transitions and
  overflow.
- **Color-coded categories** — Deep work, meetings, admin, personal, creative,
  health — visually distinguishable in the weekly view.

### 4.5 Pomodoro Technique

The **Pomodoro Technique** (Francesco Cirillo) uses a kitchen timer
(traditionally a tomato-shaped one — "pomodoro" is Italian for tomato) to
alternate focused 25-minute work intervals with short breaks, using time
pressure to overcome procrastination and mental fatigue.

- **25-minute focus sessions** — Standard Pomodoro work intervals with a timer.
- **Short breaks (5 min)** — Breaks between Pomodoros.
- **Long breaks (15–30 min)** — After every 4 Pomodoros.
- **Session logging** — Record what was accomplished during each Pomodoro.
- **Pomodoro statistics** — Daily, weekly, and monthly Pomodoro counts with
  category breakdowns.
- **Customizable durations** — Adjust work and break durations.

### 4.6 Deep Work Scheduling

Cal Newport's **deep work** concept refers to cognitively demanding,
distraction-free work performed in extended blocks. Shallow work (email,
meetings, social media) is cognitively undemanding and easily replicable. Deep
work produces disproportionate value and is becoming increasingly rare.

- **Deep work session scheduling** — Schedule distraction-free focused work
  sessions in advance.
- **Ritualization** — Define personal deep work rituals: location, start time,
  rules (no phone, specific duration), preparation steps.
- **Deep work hours tracking** — Cumulative daily, weekly, and monthly deep work
  hours.
- **Shutdown ritual** — End-of-day shutdown ritual to clearly separate work from
  rest and prevent evening rumination.

### 4.7 Daily Planning

- **MIT identification** — Select the 1–3 Most Important Tasks (MITs) for the
  day before beginning work.
- **1:4:5 ratio** — One critical task, four important tasks, five nice-to-do
  tasks per day.
- **Evening preview** — Preview tomorrow's schedule and top priorities the night
  before to reduce morning decision fatigue.
- **Daily theme days** — Assign themes to each day of the week ("Marketing
  Monday," "Finance Friday") for focused batching.

### 4.8 Time Audit

- **Time tracking** — Log how time is actually spent throughout the day.
- **Category analysis** — Break down actual time by category and compare to
  intended allocation.
- **Planning fallacy detection** — Identify systematic over- or under-estimation
  of task durations (the **planning fallacy** is a cognitive bias where people
  underestimate how long tasks take even when they have done them before).
- **Historical comparison** — Compare time allocation across weeks and months to
  identify trends.

---

## 5. Vision and Life Purpose

**Package:** `@arete/vision`

Without a clear sense of purpose and direction, all the habits and goals in the
world can be efficient but misaligned. `@arete/vision` provides tools for the
"beginning with the end in mind" layer of personal development — defining what
you actually want your life to be, then working backward to how you spend your
time.

### 5.1 Vision Boards

A **vision board** is a visual representation of desired future states,
activating the brain's reticular activating system (RAS) — the neural filter
that determines what your brain notices — toward goal-relevant stimuli.

- **Visual board builder** — Create digital vision boards with images, text
  overlays, and inspirational quotes.
- **Goal linking** — Connect vision board items to specific measurable goals for
  a path from aspiration to action.
- **Category boards** — Separate boards for different life areas (career,
  health, relationships, travel, home, creative).
- **Daily visualization** — Surface vision board content during morning routines
  and planning sessions.

### 5.2 Personal Mission Statement

Stephen Covey's **Habit 2 (Begin with the End in Mind)** centers on developing a
personal mission statement as the foundation for all goal setting and decision
making. The mission statement defines your values, roles, and intended legacy.

- **Guided builder** — Step-by-step process with reflective prompts: What do I
  want to be? What do I want to do? What legacy do I want to leave?
- **Values integration** — Ground the mission statement in identified core
  values.
- **Role consideration** — Incorporate all life roles (parent, professional,
  partner, community member, self).
- **Revision tracking** — Track how the mission statement evolves over time.
- **Regular review** — Scheduled prompts to revisit and refine the statement.

### 5.3 Values Clarification

- **Values identification** — Discover personal core values through structured
  exercises and card-sort methodologies (ranking 50+ value candidates).
- **Priority ranking** — Rank values by importance for resolving value
  conflicts.
- **Values alignment audit** — Assess how well daily actions align with stated
  core values.
- **Values-based decision making** — Use clarified values as a decision-making
  framework for difficult choices.

### 5.4 Ikigai

**Ikigai** (生き甲斐) is a Japanese concept meaning "reason for being." The
Western representation models it as the intersection of four circles: what you
love, what you are good at, what the world needs, and what you can be paid for.
True ikigai lies at the center of all four.

- **Four-circle exploration** — Structured exercises to populate each circle
  with specific, personal answers.
- **Intersection analysis** — Identify areas of overlap pointing toward life
  purpose.
- **Career alignment** — Connect ikigai insights to career planning and goal
  setting.

### 5.5 Golden Circle (Simon Sinek)

Simon Sinek's **Golden Circle** model holds that inspired individuals and
organizations communicate from the inside out: Why (purpose) → How (process) →
What (tangible outputs). Most people communicate only "What" — starting with
"Why" creates deeper motivation and authenticity.

- **Why articulation** — Define your core purpose: why you do what you do beyond
  making money or achieving outcomes.
- **How definition** — Describe your unique approach and values in action.
- **What specification** — Define tangible outputs and activities that express
  the Why.
- **Inside-out alignment** — Ensure decisions and goals flow from Why to How to
  What.

### 5.6 Legacy Planning

- **Legacy statement** — Define the long-term impact and legacy you want to
  leave behind.
- **Eulogy exercise** — Write your own eulogy as a visioning exercise (a key
  element of Covey's Habit 2 "Begin with the End in Mind").
- **Impact tracking** — Track contributions toward legacy goals over time.
- **Generational thinking** — Consider the multi-generational impact of current
  decisions.

---

## 6. Life Balance and Wellness

**Package:** `@arete/balance`

High performance in one area of life at the expense of others is not
sustainable. `@arete/balance` provides four complementary models for assessing
and improving overall life balance and wellbeing: the Wheel of Life (coaching
tradition), the Eight Dimensions of Wellness (SAMHSA), the PERMA model (positive
psychology), and the SWLS psychometric scale.

### 6.1 Wheel of Life

The **Wheel of Life** is a widely-used coaching tool that assesses current
satisfaction across the major dimensions of life. The visual "wheel" makes
imbalances immediately apparent — a wheel that isn't round doesn't roll
smoothly.

- **Dimension assessment** — Rate current satisfaction and a target rating (each
  1–10) across the wellness dimensions: physical, mental, emotional, spiritual,
  social, financial, career, family, fun/recreation, and personal growth. A
  `custom` dimension type lets users add their own named dimensions. Each
  dimension also carries reflection notes and action items.
- **Radar chart visualization** — Visual display showing balance and imbalance
  across all dimensions simultaneously.
- **Periodic re-assessment** — Scheduled re-assessment to track balance changes
  over months and years.
- **Trend analysis** — Track how each dimension improves or declines over time.
- **Imbalance alerts** — Notify when any dimension drops significantly below the
  others.

### 6.2 Eight Dimensions of Wellness

The Eight Wellness Dimensions model (SAMHSA) provides a more granular model than
the Wheel of Life: physical, mental/emotional, social, spiritual, financial,
environmental, occupational, and intellectual wellness. Each dimension ships
with descriptive indicators, improvement strategies, and assessment questions.

- **Per-dimension tracking** — Score each dimension on periodic assessments.
- **Per-dimension goals** — Set and track improvement goals for each dimension.
- **Holistic scoring** — Calculate an overall wellness score from all
  dimensions.
- **Dimension-specific recommendations** — Suggest habits and activities to
  strengthen weak dimensions.

### 6.3 PERMA Model (Positive Psychology)

Martin Seligman's **PERMA** model identifies five pillars of wellbeing:
**P**ositive emotions, **E**ngagement (flow), **R**elationships, **M**eaning,
and **A**chievement. Unlike hedonic wellbeing (feeling good), PERMA describes
eudaimonic wellbeing (flourishing).

- **Positive emotion tracking** — Track frequency and intensity of positive
  emotional experiences.
- **Engagement (flow) assessment** — Measure flow states and deep engagement in
  daily activities.
- **Relationship quality** — Assess the quality and depth of key relationships.
- **Meaning measurement** — Evaluate sense of purpose and meaning in daily
  activities.
- **Achievement tracking** — Record accomplishments and their contribution to
  wellbeing.
- **PERMA scoring** — Calculate an overall flourishing score from all five
  elements.

### 6.4 Mood Tracking

- **5-point mood scale** — Quick check-ins on a 1–5 scale, optionally multiple
  times per day.
- **Mood triggers** — Record what influenced mood (events, people, activities,
  thoughts).
- **Mood patterns** — Identify time-of-day, day-of-week, and seasonal mood
  patterns.
- **Mood-habit correlation** — Discover which habits correlate with better mood
  outcomes.
- **Mood visualization** — Calendar heat maps and trend lines over time.

### 6.5 Sleep Tracking

- **Sleep duration logging** — Record bedtime, wake time, and total sleep hours.
- **Sleep quality rating** — Rate subjective sleep quality each morning.
- **Sleep hygiene tracking** — Monitor sleep hygiene habits: screen time before
  bed, caffeine cutoff, exercise timing.
- **Sleep-mood correlation** — Connect sleep quality to next-day mood and
  productivity, revealing the behavioral cost of poor sleep.

### 6.6 Energy Management

- **Energy check-ins** — Log energy levels throughout the day (morning, midday,
  afternoon, evening).
- **Peak energy discovery** — Identify personal peak energy times for scheduling
  deep work and high-effort habits.
- **Energy-activity matching** — Recommend scheduling high-effort tasks during
  peak energy periods.
- **Energy drains and gains** — Track which activities drain or restore energy,
  informing scheduling decisions.

### 6.7 Satisfaction With Life Scale (SWLS)

The **SWLS** (Diener et al., 1985) is a validated 5-item psychometric scale
measuring global life satisfaction. Used in thousands of research studies, it
provides a standardized, comparable measurement of subjective wellbeing.

- **Standardized assessment** — Five Likert-scale items scored 1–7, giving a
  5–35 total score.
- **Periodic measurement** — Administer at regular intervals (monthly,
  quarterly) to track change over time.
- **Normative comparison** — Compare scores against published population norms
  (e.g., "your score is in the 70th percentile for adults").

---

## 7. Seven Habits Framework

**Package:** `@arete/seven-habits`

Complete implementation of all 7 Habits from Stephen Covey's _The 7 Habits of
Highly Effective People_, with dedicated interactive modules for each. While
Covey's principles inform other parts of Arete (especially `@arete/time` and
`@arete/vision`), `@arete/seven-habits` provides the full framework with
dedicated tools for practicing and tracking each habit directly.

### 7.1 Habit 1: Be Proactive

The first habit distinguishes between the **Circle of Influence** (things you
can control or influence) and the **Circle of Concern** (everything you worry
about). Proactive people focus their energy in the Circle of Influence, which
causes it to grow; reactive people focus on the Circle of Concern, which causes
it to shrink.

- **Circle mapping** — Classify concerns as within or outside the Circle of
  Influence.
- **Proactive language tools** — Shift from reactive ("I have to," "I can't") to
  proactive language ("I choose to," "I will").
- **Response gap training** — Build awareness of the gap between stimulus and
  response — Viktor Frankl's concept that between stimulus and response lies
  freedom.
- **Influence expansion tracking** — Monitor how the Circle of Influence grows
  through proactive focus.

### 7.2 Habit 2: Begin with the End in Mind

The mental/first creation before the physical/second creation. Before building a
house, you create a blueprint. Before a life, you create a personal mission
statement.

- **Personal constitution** — Draft a personal mission statement and life
  principles.
- **Role-based planning** — Define all life roles and create a vision for each
  role.
- **Visualization exercises** — Guided visualization of desired future outcomes.
- **Align daily to vision** — Connect daily tasks back to long-term vision and
  mission.

### 7.3 Habit 3: Put First Things First

The practical implementation of the Eisenhower Matrix as a time management
philosophy: schedule important, non-urgent activities before urgent-but-
unimportant ones fill the calendar.

- **Time management matrix** — Covey's 4-quadrant Urgent/Important matrix.
- **Weekly planning around roles** — Plan the week around roles and goals rather
  than reactive daily task lists.
- **Delegation tracking** — Track delegated tasks with follow-up reminders.
- **Quadrant II focus tools** — Deliberately increase time in Q2 (Not
  Urgent/Important) activities.

### 7.4 Habit 4: Think Win-Win

Win-Win is a paradigm of human interaction that seeks mutual benefit —
agreements and solutions that are mutually beneficial and mutually satisfying.
Covey identifies six interaction paradigms: Win-Win, Win-Lose, Lose-Win,
Lose-Lose, Win (only), and Win-Win or No Deal.

- **Win-win scenario analysis** — Framework for analyzing interactions to find
  mutually beneficial outcomes.
- **Abundance mentality tracking** — Build awareness of abundance vs. scarcity
  thinking. Scarcity thinking is zero-sum ("if you win, I lose"); abundance
  thinking recognizes enough success for everyone.
- **Win-win agreement templates** — Structured agreements capturing: desired
  results, guidelines, resources, accountability, and consequences.
- **Relationship dynamics monitoring** — Track whether key relationships are
  trending Win-Win or Win-Lose.

### 7.5 Habit 5: Seek First to Understand, Then to Be Understood

Most people listen with the intent to reply, not to understand. **Empathic
listening** means listening to understand the other person's frame of reference
— their words, feelings, and meaning.

- **Empathic listening exercises** — Structured practice for listening to
  understand rather than to reply.
- **Listening journal** — Record insights and breakthroughs from empathic
  listening conversations.
- **Communication self-assessment** — Self-assess listening habits and
  communication effectiveness.

### 7.6 Habit 6: Synergize

Synergy is when the whole is greater than the sum of its parts (1 + 1 = 3 or
more). Creative cooperation values differences and transcends compromise to find
the **third alternative** — a solution neither party had envisioned alone.

- **Synergy journaling** — Record instances of creative cooperation that
  produced better-than-individual outcomes.
- **Third alternative thinking** — Framework for finding solutions that
  transcend either/or compromise by asking "Is there a solution better than what
  either of us has proposed?"
- **Collaboration tracking** — Compare collaborative project outcomes versus
  solo efforts.

### 7.7 Habit 7: Sharpen the Saw

Renewal in four dimensions — like a saw that cuts ineffectively when dull, a
person who neglects renewal becomes progressively less effective. The four
dimensions must all be maintained or they atrophy.

| Dimension        | Examples                                                 |
| ---------------- | -------------------------------------------------------- |
| Physical         | Exercise, nutrition, sleep, stress management            |
| Mental           | Reading, learning, journaling, strategic planning        |
| Social/Emotional | Relationships, service, empathy, emotional intelligence  |
| Spiritual        | Values clarification, meditation, time in nature, prayer |

- **Four-dimension renewal tracking** — Log renewal activities in each
  dimension.
- **Renewal scheduling** — Schedule activities in all four dimensions weekly.
- **Balance monitoring** — Alert when any dimension is neglected.
- **Continuous improvement metrics** — Track personal growth in each dimension
  over time.

### 7.8 Emotional Bank Account

Covey's **Emotional Bank Account** metaphor describes the trust built in a
relationship. Deposits (acts of kindness, keeping commitments, understanding)
increase trust; withdrawals (criticism, betrayal, disrespect) decrease it. The
balance determines how resilient the relationship is to mistakes.

- **Deposit tracking** — Log positive contributions: understanding someone,
  keeping commitments, showing kindness, apologizing sincerely.
- **Withdrawal awareness** — Recognize and record actions that damaged
  relationship trust.
- **Relationship balance visualization** — Running balance visualization showing
  each relationship's trust level.
- **Relationship-specific accounts** — Separate emotional bank accounts for key
  relationships.
- **Deposit suggestions** — Suggest relationship-strengthening actions based on
  each relationship's history.

---

## 8. Affirmations

**Package:** `@arete/affirmations`

Affirmations are a lightweight but consistent practice that primes positive
self-belief and maintains motivational momentum between deeper sessions. Unlike
the other libraries, `@arete/affirmations` is intentionally narrow in scope: it
provides a large curated library, rule-based personalized generation (no
external AI APIs), scheduling, and practice analytics.

### 8.1 Affirmation Library

- **500+ curated affirmations** — A built-in `AFFIRMATION_LIBRARY` of 500+
  pre-written affirmations across 12 categories: confidence, abundance, health,
  relationships, success, gratitude, self-love, mindfulness, courage,
  creativity, purpose, and resilience.
- **Favorites** — Save favorite affirmations for quick access.
- **Custom affirmations** — Create and store personal affirmations.

### 8.2 Affirmation Scheduling

- **Daily affirmation delivery** — Scheduled affirmation display at configured
  times (typically morning and evening).
- **Widget support** — Affirmation data structured for home screen widget
  display, so the first thing seen in the morning is the day's affirmation.
- **Rotation algorithms** — Varied selection to prevent the affirmations from
  becoming stale and losing their emotional impact.
- **Reminder integration** — Integrate affirmations into existing habit reminder
  workflows.

### 8.3 AI-Generated Affirmations

Rule-based generation using templates and keyword substitution — no external AI
APIs.

- **Personalized generation** — Generate affirmations tailored to the user's
  goals, values, and active challenges.
- **Suggestion engine** — Combine curated library matches with freshly generated
  affirmations, weighted by the user's preferred categories.
- **Affirmation refinement** — Adjust a generated affirmation along one of four
  axes: stronger, gentler, shorter, or more specific.
- **Template fill** — Produce affirmations from named templates by substituting
  fill values.

### 8.4 Affirmation Analytics

- **Practice tracking** — Track daily affirmation practice consistency.
- **Impact correlation** — Correlate affirmation practice with mood and goal
  progress over time.
- **Engagement metrics** — Monitor which affirmations resonate most based on
  re-selection and favoriting frequency.

---

## 9. Gamification

**Package:** `@arete/gamification`

Gamification provides motivational infrastructure that spans all other feature
areas — points, badges, and levels aggregate habit completions, goal milestones,
journal entries, and time blocks. Because it touches all feature areas,
`@arete/gamification` is architecturally at the layer above the feature
libraries, even though it still peers only on `@arete/core`.

### 9.1 Points, Currency, and Experience

- **XP (experience points)** — Earned for completing habits, reaching goal
  milestones, writing journal entries, and completing challenges.
- **Coins** — Virtual currency earned through consistent daily practice.
- **Gems** — Premium currency for special achievements and milestone unlocks.
- **Multipliers** — XP multipliers for streaks and consecutive-day bonuses
  create escalating rewards for sustained effort.
- **Consistency bonuses** — Extra points for maintaining habits over extended
  periods incentivize long-term consistency over short bursts.

### 9.2 Badges and Achievements

- **50+ badges** — Diverse achievement badges covering habits, goals,
  journaling, and time management.
- **Tiered badges** — Bronze, silver, gold, and platinum tiers within each badge
  for progressive achievement.
- **Seasonal badges** — Limited-time badges tied to seasons or special events,
  creating urgency and novelty.
- **Badge display** — Showcase earned badges on profile with unlock dates.
- **Unlock notifications** — Celebratory notifications when new badges are
  earned.

### 9.3 Leveling System

- **20 levels** — Progressive leveling from Level 1 to Level 20.
- **XP curve** — Increasing XP requirements per level for sustained motivation
  (the early levels are achievable quickly; later levels require extended
  commitment).
- **Feature unlocks** — New features and capabilities unlocked at specific
  levels.
- **Level titles** — Named level titles reflecting the personal growth journey
  (Beginner → Practitioner → Expert → Master → Champion).

### 9.4 Leaderboards

- **Global leaderboard** — Compare progress against all platform users.
- **Friend leaderboard** — View rankings among connected friends and
  accountability partners.
- **Privacy controls** — Full opt-in/opt-out with granular visibility settings.

### 9.5 Accountability Partnerships

- **Partner matching** — Connect with accountability partners for mutual
  support.
- **Check-in sharing** — Share habit and goal progress with accountability
  partners.
- **Encouragement system** — Send and receive encouragement messages.
- **Partnership analytics** — Track partnership effectiveness and engagement.

### 9.6 Commitment Contracts

**Commitment contracts** (popularized by Beeminder and StickK) harness loss
aversion — the psychological principle that losing something feels twice as bad
as gaining the equivalent feels good — to increase follow-through.

- **Contract creation** — Create contracts with specific goals, deadlines, and
  stakes.
- **Financial stakes** — Optional financial stakes donated to a cause (or
  "anti-charity" — an organization the user dislikes) upon failure.
- **Referee assignment** — Designate a referee to verify contract completion.

### 9.7 Community Challenges

- **Platform-wide challenges** — Join challenges like 30-day meditation, daily
  journaling for a month, or reading 12 books in 12 months.
- **Challenge templates** — Pre-built templates for common personal development
  goals.
- **Progress tracking** — Track individual progress within challenges against
  other participants.
- **Challenge rewards** — Special rewards and badges for challenge completion.

### 9.8 Custom Rewards System

- **Reward definitions** — Define personal rewards ("Buy that book after 30-day
  streak," "Spa day after quarterly OKR completion").
- **Reward redemption tracking** — Track reward availability and redemption
  history.
- **Reward scheduling** — Tie rewards to specific milestone achievements.

---

## 10. AI Coaching

**Package:** `@arete/ai-coach`

The AI coach is the intelligence layer that aggregates data from all other
feature areas and translates it into coherent, personalized guidance. It is the
only library that synthesizes habit patterns, goal progress, journal sentiment,
energy data, and time use together — a perspective that no single feature
library can have on its own.

### 10.1 Conversational Coaching

- **CBT-based coaching** — Cognitive behavioral therapy-informed coaching
  conversations for identifying and reframing negative thought patterns.
- **Goal coaching** — Guided conversations for goal clarification, obstacle
  identification, and action planning using the WOOP methodology.
- **Habit coaching** — Coaching dialogues for habit design, troubleshooting, and
  optimization using Atomic Habits frameworks.
- **Reflection coaching** — Guided reflective conversations drawing on journal
  entries and progress data.
- **Motivation coaching** — Motivational conversations tailored to current
  challenges and emotional state.
- **Multi-mode support** — Switch between coaching modes within a single
  conversation.
- **Context-awareness** — Responses draw on the user's habit history, goal
  progress, recent journal entries, and mood data for personalized relevance.

### 10.2 Personalized Recommendations

- **Habit recommendations** — Suggest new habits based on goals, existing
  habits, and identified gaps.
- **Goal recommendations** — Recommend goals aligned with stated values and
  vision.
- **Content recommendations** — Suggest exercises and resources relevant to
  current focus areas.
- **Timing recommendations** — Suggest optimal times for activities based on
  historical energy and mood data.

### 10.3 NLP Journal Analytics

- **Sentiment analysis** — Analyze journal entry sentiment with confidence
  scores.
- **Emotion detection** — Identify specific emotions in writing using the
  Plutchik wheel of emotions (joy, sadness, anger, fear, surprise, anticipation,
  trust, disgust) as the classification framework.
- **Topic modeling** — Extract key topics and themes from journal entries over
  time using NLP.
- **Insight generation** — Generate human-readable insights from analysis ("Your
  writing has been increasingly optimistic this month").

### 10.4 Pattern Recognition

- **Habit patterns** — Detect slipping habits before they fail through trend
  analysis.
- **Mood-habit correlations** — Discover which habits correlate with better mood
  outcomes.
- **Energy patterns** — Map personal energy rhythms for better scheduling.
- **Cross-domain insights** — Surface connections between habits, mood, sleep,
  energy, and goal progress.

### 10.5 Smart Notifications

- **Optimal timing** — Send notifications at times most likely to result in
  action based on the user's behavioral patterns.
- **Personalized messages** — Tailor notification content to individual
  motivational style and current context.
- **Fatigue prevention** — Reduce notification frequency when engagement is
  high; increase when habits are slipping.
- **Context-aware triggers** — Trigger notifications based on detected patterns
  (e.g., nudge journaling when a sustained mood drop is detected).

---

## 11. Data Foundation

**Package:** `@arete/core`

`@arete/core` is the shared foundation that every other Arete library peers
against. It owns the canonical database schema, validation schemas, seed data,
and all database automation. Understanding this library is prerequisite to
understanding any of the feature libraries.

The PostgreSQL schema, seed data, aggregation functions, and the streak trigger
all live inside `@arete/core` (`src/db-schema.ts`, `src/db-seed.ts`). A
`libs/arete/database/` directory exists but contains only a supplementary
`prisma/schema.prisma` and a generated SQL file; it is not an Nx library and is
not the authoritative schema.

### 11.1 Database Architecture

- **61 PostgreSQL tables** — `ALL_ARETE_TABLES` enumerates 61 tables under the
  `arete_` prefix: 48 legacy tables plus 13 contract-backed `arete_v1_*` tables.
- **~40 enum types** — Strongly-typed status and category fields using
  PostgreSQL native enums (`ALL_ARETE_ENUMS` lists 39; `coachMessageRoleEnum` is
  a 40th defined inline).
- **JSONB flexibility** — JSON columns for flexible data: habit cue/routine/
  reward, habit stack sequences, Wheel of Life dimensions, weekly-plan big
  rocks, and the structured payloads on the V1 contract tables.
- **Comprehensive indexing** — Indexes on frequently queried columns (user_id,
  created_at, status, category, date).
- **Full-text search** — Two GIN full-text search indexes on journal entry
  content and title for instant text retrieval.

### 11.2 Automated Data Processing

- **Streak trigger** — A PostgreSQL trigger function automatically recalculates
  streak counts when habit completions are inserted, including forgiveness-day
  logic, without requiring application-layer computation.
- **Aggregation functions** — Database-level functions for: total completions,
  average mood, average energy, goal completion rate, total XP, habit completion
  rate, journal statistics, Wheel of Life trends, and deep work hours.

### 11.3 Validation (56 Zod Schemas)

- **56 Zod schemas** — `@arete/core/schemas.ts` exports 56 schema constants for
  runtime validation of the legacy domain model. The newer V1 contract schemas
  live in `@oshun/contracts/arete`, which `@arete/core` depends on.
- **Type inference** — TypeScript types automatically inferred from Zod schemas
  for end-to-end type safety without duplication.
- **Seed data** — `db-seed.ts` ships 23 default journal prompts, 17 badge
  definitions, and 10 level definitions.

### 11.4 Library Summary

The table below provides a one-line reference for each of the twelve libraries
and the generated API client.

| Library      | Package               | Primary Capabilities                                                                                |
| ------------ | --------------------- | --------------------------------------------------------------------------------------------------- |
| Core         | `@arete/core`         | Domain types, 56 Zod schemas, 61-table Drizzle schema, aggregation functions, streak trigger, seeds |
| Habits       | `@arete/habits`       | Habit engine, Atomic Habits, habit stacking, streaks, recovery/friction/interventions               |
| Goals        | `@arete/goals`        | SMART goals, OKRs, WOOP, 12 Week Year, goal hierarchy                                               |
| Journal      | `@arete/journal`      | Rich text, morning pages, CBT, gratitude, worry, NLP analytics                                      |
| Time         | `@arete/time`         | Eisenhower Matrix, GTD, big rocks, time blocking, Pomodoro                                          |
| Vision       | `@arete/vision`       | Vision boards, mission statement, ikigai, Golden Circle                                             |
| Balance      | `@arete/balance`      | Wheel of Life, PERMA, mood, sleep, energy tracking                                                  |
| Seven Habits | `@arete/seven-habits` | All 7 Covey habits with dedicated modules                                                           |
| Affirmations | `@arete/affirmations` | 500+ affirmations, rule-based generation, scheduling, analytics                                     |
| Gamification | `@arete/gamification` | XP/coins/gems, 50+ badges, levels, leaderboards, challenges                                         |
| AI Coach     | `@arete/ai-coach`     | CBT coaching, pattern recognition, NLP analytics, smart nudges, weekly review                       |
| API Client   | `@arete/api-client`   | Generated HTTP client typed against `@oshun/contracts/arete`                                        |

---

## 12. Delivery Applications

The libraries above are delivered to users through three applications. Each
application targets a different surface area (server, browser, mobile) and
consumes the libraries appropriate to its role.

### 12.1 REST API (`apps/arete/api`)

A Fastify REST API exposing the domain over HTTP. It owns persistence
(PostgreSQL via Drizzle), JWT authentication, Redis, rate limiting,
transactional email (nodemailer), and Swagger documentation. Routes are
versioned under `/v1` and grouped by domain — users, habits, goals, journal,
vision, time, balance, gamification, coach, and dashboard — plus unversioned
health probes. The habit routes additionally expose the V1 friction-analysis and
intervention-dispatch endpoints. (See `specifications.md` §6 for the full
endpoint list.)

### 12.2 Web Dashboard (`apps/arete/web`)

A React + Vite single-page dashboard. It uses React Router for navigation,
TanStack Query for server state, Zustand for client state, Tailwind for styling,
and Recharts for data visualization. It ships pages for the dashboard, habits,
goals, journal, time, vision, wellness, coach, analytics, profile, settings, and
authentication, backed by a component library of UI, form, table, layout, and
chart components.

### 12.3 Mobile App (`apps/arete/mobile`)

A React Native 0.73 application for iOS and Android. It uses React Navigation,
TanStack Query, and Zustand. It ships screens for the home dashboard, habits,
goals, journal, time, vision, balance, coaching, gamification, and settings;
native integrations include push notifications, biometric login, home-screen
widgets, offline sync, and Siri Shortcuts / Google Assistant actions.
