Momentum AI: The Post-Purchase Precision Engine
Inspiration
The idea for Momentum AI came from what we call the “Post-Purchase Paradox.”
A customer buys a laptop, and within minutes receives a generic “10% off” email for the exact same product. Most brands either:
- re-engage customers far too early, creating spam,
- or wait too long and lose customer intent entirely.
We wanted to build a system that treats timing as a variable, not a constant.
The core inspiration was the concept of Optimal Re-engagement Windows — identifying the Golden Window where:
- customer intent,
- product utility,
- and purchase readiness
all intersect.
What it does
Momentum AI is a post-purchase timing and personalization engine designed to convert one-time buyers into repeat customers.
The platform operates in three stages:
1. Predictive Timing
A Machine Learning model powered by Random Forest Regression analyzes:
- product category,
- customer segment,
- order value,
- and behavioral patterns
to determine the optimal delay before re-engagement.
The predicted wait period is:
$$ \hat{y} = \sum_{i=1}^{n} Tree_i(X) $$
Where:
- (X) represents the encoded feature vector,
- and each decision tree contributes to the final prediction.
The goal is to determine the ideal:
$$ d_{wait} $$
before sending the next upsell or retention message.
2. Generative Personalization
Once the timing is determined, a local Large Language Model running through Ollama generates:
- hyper-personalized follow-up messages,
- contextual upsell recommendations,
- and customer-specific engagement copy.
This ensures every interaction feels intentional rather than automated.
3. Customer Intelligence Dashboard
Momentum AI also provides a premium analytics dashboard featuring:
- Customer Personas,
- Purchase Timelines,
- Re-engagement Predictions,
- and behavioral insights.
This allows brands to understand not only what the AI predicts, but why it predicts it.
How we built it
We built Momentum AI using a high-performance local-first Private AI architecture.
The Brain — Predictive AI Layer
Built using:
- Python
- FastAPI
- scikit-learn
The system uses a RandomForestRegressor trained on synthetic e-commerce behavior data.
Feature vectors include:
- encoded customer segments,
- product categories,
- purchase values,
- and transaction metadata.
The Voice — Generative AI Layer
For inference, we used:
- Ollama
- running the lfm2.5-thinking model locally.
This architecture guarantees:
- zero external API dependency,
- complete data privacy,
- and enterprise-safe deployment.
The Face — Frontend Experience
The frontend was intentionally built as a:
- Zero-Framework Single Page Application
using:
- Vanilla HTML,
- CSS,
- and JavaScript.
We relied heavily on:
- CSS Grid,
- Flexbox,
- transitions,
- and Chart.js
to create a premium SaaS-style interface without React or Tailwind overhead.
The Data Layer
We used:
- SQLite
- with 500+ synthetic customer purchase records
to simulate realistic e-commerce usage patterns and model training conditions.
Challenges we ran into
1. The Latency Gap
Running a local “thinking model” introduces noticeable inference latency.
We solved this by:
- implementing asynchronous background tasks in FastAPI,
- and designing UI “thinking states” using animated typing indicators.
This preserved perceived responsiveness while maintaining local inference quality.
2. Categorical Complexity
Human customer types such as:
- VIP,
- Returning,
- New Customer
cannot be treated as ordinal numeric values.
To solve this, we implemented One-Hot Encoding:
$$ x_{segment} \in { [1,0,0], [0,1,0], [0,0,1] } $$
This prevented the model from incorrectly assuming hierarchical relationships between customer classes.
3. CSS-Only UI Engineering
Creating:
- slide-in customer intelligence panels,
- animated phone mockups,
- and reactive dashboard components
using only Vanilla CSS required extremely precise:
- positioning,
- transition timing,
- and state management logic.
Achieving a premium modern UI without frontend frameworks was significantly harder than expected.
Accomplishments that we're proud of
Zero External Dependencies
The entire application runs:
- without API keys,
- without cloud inference,
- and without third-party AI services.
This makes Momentum AI:
- fully private,
- enterprise-ready,
- and deployable in restricted environments.
Dual-AI Architecture
We successfully combined:
- Predictive AI (scikit-learn)
- and Generative AI (Ollama)
inside a single seamless workflow.
This created a unified intelligence pipeline rather than isolated AI features.
Premium UX Without Frameworks
We achieved:
- a modern SaaS aesthetic,
- reactive interactions,
- and smooth transitions
using only:
- Vanilla JavaScript,
- native CSS,
- and browser APIs.
No React. No Tailwind. No build tools.
What we learned
The biggest lesson was:
Timing matters more than discount size.
A:
- 5% discount at the correct moment
outperforms:
- a 50% discount delivered at the wrong time.
We also learned that:
- Local AI has matured enough for interactive SaaS applications,
- provided the user experience is engineered around model thinking time and asynchronous execution.
What's next for Momentum AI: The Post-Purchase Precision Engine
Our next goal is transforming Momentum AI into an:
Autonomous Growth Agent
The roadmap includes:
Self-Optimizing Reinforcement Loops
We plan to integrate:
- Reinforcement Learning
- with live conversion feedback
so the system continuously improves its timing predictions based on:
- successful upsells,
- customer engagement,
- and conversion outcomes.
Multi-Channel Execution
Future versions will support automated engagement across:
- WhatsApp,
- Email,
- SMS,
- and push notifications.
The system will automatically trigger communication when the:
- “Golden Window” opens.
Enterprise Expansion
Additional future capabilities include:
- real-time customer lifetime value prediction,
- churn forecasting,
- campaign ROI attribution,
- and AI-driven retention automation.
The long-term vision is a fully autonomous post-purchase intelligence platform that continuously optimizes customer retention without manual intervention.
Built With
- chart.js
- fastapi
- httpx
- ollama
- python
- scikit-learn
- sqlalchemy
- sqlite
- uvicorn
Log in or sign up for Devpost to join the conversation.