Inspiration
Dream Sage began as a working beta for AI-assisted analysis of individual dreams and connected symbols. While building and testing those features, I noticed an important limitation: interpreting one experience at a time cannot reveal the larger patterns that develop across a person’s dream history.
Recurring emotions, symbols, relationships, conflicts, and changes over time often become visible only when multiple records are examined together. For OpenAI Build Week, I decided to extend Dream Sage from individual interpretation into longitudinal pattern discovery.
What I built
During Build Week, I added two connected operations to the existing Dream Sage platform: Deep Pattern and Deep Insight.
Deep Pattern
Deep Pattern allows users to select a group of completed dream or symbol analyses from their personal history.
An embedding model represents the selected records as semantic vectors. Dream Sage then performs deterministic analysis over those vectors to calculate similarities, construct a relationship graph, identify clusters and outliers, and aggregate recurring themes and emotional signals.
The resulting report is organized into six sections:
- Overview
- Clusters
- Themes
- Emotions
- Timeline
- Evidence
Deep Pattern is intentionally embedding-based. It does not ask a generative model to invent a statistical report. The displayed relationships are calculated from the selected records and supported by traceable evidence.
Deep Insight
A completed Deep Pattern report can then be sent directly into Deep Insight.
Deep Insight uses the saved pattern report and its underlying evidence to create a structured interpretation across:
- Overview
- Psychology
- Recurring symbols
- Development over time
- Personal reflection
This separation gives the two operations distinct responsibilities: Deep Pattern discovers measurable semantic relationships, while Deep Insight interprets their possible meaning.
How I built it
I used Codex with the GPT-5.6 Sol model as an engineering collaborator throughout Build Week.
Dream Sage already contained authentication, individual dream and symbol analysis, personal history, crystal billing, AI-provider routing, safety controls, rate limits, telemetry, error monitoring, and a production user interface. The challenge was therefore not to create an isolated prototype, but to integrate two new operations into an existing full-stack system without disrupting its established behavior.
Codex helped me inspect the architecture, trace dependencies across the repository, compare implementation approaches, generate focused code changes, diagnose compilation and integration failures, and review the complete flow across the frontend, backend, database, billing, AI runtime, and monitoring layers.
I directed the development process, defined the product behavior, selected the architecture, reviewed each proposed change, tested the results, and made the final technical and design decisions.
The new implementation includes:
- Backend validation of selected history records and ownership
- Selection tiers and database-controlled crystal prices
- Embedding-provider routing, batching, fallback, and caching
- Cosine-similarity graph construction and deterministic clustering
- Pattern and Insight history persistence
- Structured result contracts and validation
- AI response fallback and limited schema repair
- Idempotency and crystal reservation
- Usage, token, cost, and failure telemetry
- Integration with the existing Dream Sage interface and administration system
Challenges
The largest challenge was safely connecting a new multi-record workflow to a system originally designed around individual user-facing operations.
The browser could not be trusted to determine ownership, selection size, price, or the content used for analysis. The backend therefore reloads the selected records, verifies that they belong to the authenticated user, derives the canonical selection tier, and applies the active database price.
Billing also had to remain safe during provider or persistence failures. Crystals are reserved before execution but committed only after a valid result has been saved. Failed operations release the reservation instead of charging the user without delivering a result.
Another challenge was keeping statistical discovery separate from generative interpretation. Combining both stages in a single AI prompt would have made the result less explainable. Dividing the workflow into Deep Pattern and Deep Insight created a clearer, more testable, and more evidence-grounded system.
What I learned
I learned that embeddings become much more valuable when they are treated as part of a complete product workflow rather than as isolated vectors. Their usefulness depends on source validation, compatible caching, deterministic processing, explainable evidence, persistence, and a clear interface for exploring the result.
I also learned how effective Codex can be when used as an iterative engineering collaborator on an established codebase. It was especially valuable for following dependencies across many layers while I retained control over the product direction and every final decision.
What’s next
The next stage is to improve pattern visualization, allow users to compare reports from different periods, and explore privacy-preserving ways to track how recurring themes change over longer personal timelines.
With Deep Pattern and Deep Insight, Dream Sage evolved from interpreting isolated dreams into discovering connections across an entire personal dream history.
Built With
- artificialintelligence
- cloudflare
- codex
- embeddings
- github
- gpt-5.6
- intelligence
- next.js
- node.js
- openai
- paypal
- postgresql
- react
- restapi
- supabase
- typescript
- vercel
Log in or sign up for Devpost to join the conversation.