Overview#
The Daily Reflections feature provides users with daily prompts for self-reflection, tracks their responses over time, and generates insights about their learning and growth patterns.
Node Types#
ReflectionPrompt#
Represents a daily reflection question or prompt.
Labels: REFLECTION_PROMPT
Properties:
id(String, UUID) - Unique identifiercategory(String) - Category: "learning", "mindfulness", "gratitude", "growth", "practice"prompt_text(String) - The reflection question/promptdifficulty(String) - "beginner", "intermediate", "advanced"tags(String[]) - Related topics (e.g., ["meditation", "awareness"])created_at(DateTime) - When createdactive(Boolean) - Whether prompt is actively usedlanguage(String) - Language code (e.g., "en", "es")context_hint(String, optional) - Additional context for the prompt
Example:
CREATE (p:REFLECTION_PROMPT {
id: "prompt-001",
category: "learning",
prompt_text: "What was the most valuable insight you gained from your practice today?",
difficulty: "beginner",
tags: ["learning", "insight", "practice"],
created_at: datetime(),
active: true,
language: "en",
context_hint: "Reflect on today's meditation or learning session"
})
DailyReflection#
Represents a user's response to a daily prompt.
Labels: DAILY_REFLECTION
Properties:
id(String, UUID) - Unique identifieruser_id(String) - User identifierreflection_date(Date) - Date of reflection (YYYY-MM-DD)response_text(String) - User's written reflectionword_count(Integer) - Number of words in responsemood_rating(Integer, 1-5, optional) - User's mood at time of reflectionenergy_level(Integer, 1-5, optional) - User's energy levelsentiment_score(Float, -1 to 1, optional) - AI-analyzed sentimentcreated_at(DateTime) - When reflection was createdupdated_at(DateTime) - Last update timetime_spent_seconds(Integer) - Time spent writing reflectioncompleted(Boolean) - Whether reflection is completeprivacy(String) - "private", "friends", "public"
Example:
CREATE (r:DAILY_REFLECTION {
id: "refl-001",
user_id: "user-123",
reflection_date: date("2025-01-15"),
response_text: "Today I realized that mindful breathing helps me...",
word_count: 87,
mood_rating: 4,
energy_level: 3,
sentiment_score: 0.75,
created_at: datetime(),
updated_at: datetime(),
time_spent_seconds: 180,
completed: true,
privacy: "private"
})
ReflectionInsight#
AI-generated or user-identified insights from reflections.
Labels: REFLECTION_INSIGHT
Properties:
id(String, UUID) - Unique identifieruser_id(String) - User identifierinsight_type(String) - "pattern", "growth", "challenge", "achievement"insight_text(String) - The insight descriptionconfidence_score(Float, 0-1) - AI confidence in insightidentified_at(DateTime) - When insight was identifiedsource(String) - "ai_generated" or "user_identified"time_period(String) - Time range (e.g., "last_7_days", "last_30_days")supporting_reflection_ids(String[]) - IDs of reflections supporting this insight
Example:
CREATE (i:REFLECTION_INSIGHT {
id: "insight-001",
user_id: "user-123",
insight_type: "pattern",
insight_text: "You tend to have deeper insights when practicing in the morning",
confidence_score: 0.85,
identified_at: datetime(),
source: "ai_generated",
time_period: "last_30_days",
supporting_reflection_ids: ["refl-001", "refl-005", "refl-012"]
})
ReflectionStreak#
Tracks user's consistency in daily reflections.
Labels: REFLECTION_STREAK
Properties:
id(String, UUID) - Unique identifieruser_id(String) - User identifiercurrent_streak(Integer) - Current consecutive dayslongest_streak(Integer) - Longest streak ever achievedtotal_reflections(Integer) - Total number of reflectionsstreak_start_date(Date) - When current streak startedlast_reflection_date(Date) - Most recent reflection dateupdated_at(DateTime) - Last update time
Example:
CREATE (s:REFLECTION_STREAK {
id: "streak-001",
user_id: "user-123",
current_streak: 7,
longest_streak: 21,
total_reflections: 45,
streak_start_date: date("2025-01-08"),
last_reflection_date: date("2025-01-15"),
updated_at: datetime()
})
Relationships#
USER -[:COMPLETED]-> DAILY_REFLECTION#
Links user to their reflections.
Properties:
completed_at(DateTime) - When completed
DAILY_REFLECTION -[:RESPONDS_TO]-> REFLECTION_PROMPT#
Links reflection to its prompt.
Properties: None
DAILY_REFLECTION -[:REFERENCES]-> NOTE#
Links reflection to related notes (optional).
Properties:
relevance_score(Float, 0-1) - How relevant the note is
DAILY_REFLECTION -[:ATTACHED_TO]-> CONTENT#
Links reflection to content that inspired it (lecture, meditation, etc.).
Properties:
content_type(String) - Type of contenttimestamp(Integer, optional) - Specific moment in content
USER -[:HAS_INSIGHT]-> REFLECTION_INSIGHT#
Links user to their insights.
Properties:
acknowledged(Boolean) - Whether user has seen this insight
REFLECTION_INSIGHT -[:DERIVED_FROM]-> DAILY_REFLECTION#
Links insights to the reflections they're based on.
Properties:
weight(Float, 0-1) - How much this reflection contributed to the insight
USER -[:MAINTAINS_STREAK]-> REFLECTION_STREAK#
Links user to their streak.
Properties: None
REFLECTION_PROMPT -[:FOLLOWS]-> REFLECTION_PROMPT#
Creates a sequence of related prompts.
Properties:
sequence_number(Integer) - Order in sequencesequence_id(String) - ID of the sequence
Indexes and Constraints#
// Constraints
CREATE CONSTRAINT reflection_prompt_id IF NOT EXISTS FOR (p:REFLECTION_PROMPT) REQUIRE p.id IS UNIQUE;
CREATE CONSTRAINT daily_reflection_id IF NOT EXISTS FOR (r:DAILY_REFLECTION) REQUIRE r.id IS UNIQUE;
CREATE CONSTRAINT reflection_insight_id IF NOT EXISTS FOR (i:REFLECTION_INSIGHT) REQUIRE i.id IS UNIQUE;
CREATE CONSTRAINT reflection_streak_id IF NOT EXISTS FOR (s:REFLECTION_STREAK) REQUIRE s.id IS UNIQUE;
// Indexes for performance
CREATE INDEX reflection_by_user IF NOT EXISTS FOR (r:DAILY_REFLECTION) ON (r.user_id);
CREATE INDEX reflection_by_date IF NOT EXISTS FOR (r:DAILY_REFLECTION) ON (r.reflection_date);
CREATE INDEX reflection_by_user_date IF NOT EXISTS FOR (r:DAILY_REFLECTION) ON (r.user_id, r.reflection_date);
CREATE INDEX prompt_by_category IF NOT EXISTS FOR (p:REFLECTION_PROMPT) ON (p.category);
CREATE INDEX prompt_by_active IF NOT EXISTS FOR (p:REFLECTION_PROMPT) ON (p.active);
CREATE INDEX insight_by_user IF NOT EXISTS FOR (i:REFLECTION_INSIGHT) ON (i.user_id);
CREATE INDEX streak_by_user IF NOT EXISTS FOR (s:REFLECTION_STREAK) ON (s.user_id);
Data Model Diagram#
┌─────────┐ ┌──────────────────┐
│ USER │──[:COMPLETED]────────→ │ DAILY_REFLECTION │
└─────────┘ └──────────────────┘
│ │
│ │
│ ├─[:RESPONDS_TO]──→┌─────────────────────┐
│ │ │ REFLECTION_PROMPT │
│ │ └─────────────────────┘
│ │ │
│ ├─[:REFERENCES]─────→┌─────┐│
│ │ │NOTE ││
│ │ └─────┘│
│ │ │
│ ├─[:ATTACHED_TO]────→┌─────────┐
│ │ │CONTENT │
│ │ └─────────┘
│ │
├─[:HAS_INSIGHT]────→┌─────────────────────┐
│ │ REFLECTION_INSIGHT │←──[:DERIVED_FROM]──┘
│ └─────────────────────┘
│
└─[:MAINTAINS_STREAK]→┌─────────────────┐
│ REFLECTION_STREAK │
└─────────────────┘
Example Queries#
Get User's Recent Reflections#
MATCH (u:USER {id: $userId})-[:COMPLETED]->(r:DAILY_REFLECTION)
WHERE r.reflection_date >= date() - duration('P7D')
RETURN r
ORDER BY r.reflection_date DESC
Get Daily Prompt for User#
MATCH (p:REFLECTION_PROMPT {active: true})
WHERE p.language = $userLanguage
AND NOT EXISTS {
MATCH (:USER {id: $userId})-[:COMPLETED]->(r:DAILY_REFLECTION {reflection_date: date()})
-[:RESPONDS_TO]->(p)
}
WITH p
ORDER BY rand()
LIMIT 1
RETURN p
Calculate Reflection Streak#
MATCH (u:USER {id: $userId})-[:COMPLETED]->(r:DAILY_REFLECTION)
WITH r, r.reflection_date as refDate
ORDER BY refDate DESC
WITH collect(refDate) as dates
UNWIND range(0, size(dates)-1) as i
WITH dates[i] as current, dates[i+1] as previous
WHERE previous IS NOT NULL
AND duration.between(previous, current).days = 1
RETURN count(*) + 1 as currentStreak
Find Patterns in Reflections#
MATCH (u:USER {id: $userId})-[:COMPLETED]->(r:DAILY_REFLECTION)
WHERE r.reflection_date >= date() - duration('P30D')
AND r.sentiment_score IS NOT NULL
WITH avg(r.sentiment_score) as avgSentiment,
stdev(r.sentiment_score) as sentimentStdDev,
collect({date: r.reflection_date, mood: r.mood_rating, sentiment: r.sentiment_score}) as data
RETURN avgSentiment, sentimentStdDev, data
Get Insights for User#
MATCH (u:USER {id: $userId})-[:HAS_INSIGHT]->(i:REFLECTION_INSIGHT)
WHERE i.identified_at >= datetime() - duration('P30D')
OPTIONAL MATCH (i)-[:DERIVED_FROM]->(r:DAILY_REFLECTION)
RETURN i, collect(r) as supporting_reflections
ORDER BY i.confidence_score DESC, i.identified_at DESC
API Endpoints (to be implemented)#
Reflection Management#
POST /v1/reflections- Create daily reflectionGET /v1/reflections- List user's reflections (with filters)GET /v1/reflections/:id- Get single reflectionPUT /v1/reflections/:id- Update reflectionDELETE /v1/reflections/:id- Delete reflection
Prompts#
GET /v1/reflections/prompt/today- Get today's promptGET /v1/reflections/prompts- List available promptsPOST /v1/reflections/prompts- Create custom prompt (admin)
Insights & Analytics#
GET /v1/reflections/insights- Get user's insightsGET /v1/reflections/patterns- Get reflection patternsGET /v1/reflections/stats- Get reflection statistics
Streaks#
GET /v1/reflections/streak- Get current streakGET /v1/reflections/calendar- Get reflection calendar
Privacy Considerations#
- Default Privacy: All reflections are private by default
- User Control: Users can choose to share specific reflections
- AI Analysis: Users can opt-in/out of AI insight generation
- Data Retention: Reflections are kept indefinitely unless user deletes
- Export: Users can export all their reflections in JSON/PDF format
Integration Points#
- Notes Service: Link reflections to notes
- Content Service: Link reflections to content that inspired them
- Notification Service: Send daily reflection reminders
- AI Service: Generate insights from reflection patterns
- User Preferences: Store reflection preferences and settings