SAGACORE: DreamForge × MythicGrid
How a to-do list became a living legend
Inspiration
Every productivity app I've ever used has the same problem: the moment the novelty wears off, the habit dies.
I've tried Notion, Todoist, plain paper lists. They all work for about two weeks. Then the dopamine runs out and the streak breaks and the app becomes one more icon I scroll past.
The apps that kept me engaged weren't productivity tools — they were games. Dark Souls. Stardew Valley. Any RPG where progress feels earned, where the world visibly changes because of what you did, where there's always something locked that you're one step away from unlocking.
So the question became: what if a productivity tool was built with the same psychological architecture as an RPG?
Not just badges and streaks. Not just a points counter. A system where your real-world goal becomes a quest, where completing it generates a chapter in a living story, where your world literally evolves based on what you accomplish.
That's SAGACORE.
What I Built
SAGACORE is an AI-powered gamified productivity platform with a genuine agentic core. When you type an ambition — "master graph traversal algorithms", "complete a 5K sunrise run", "build a RAG pipeline" — you're not talking to a chatbot. You're commissioning an autonomous agent.
The agent:
- Reads your current player state from MongoDB (level, XP, active quests)
- Reasons about where you are in your journey
- Forges a 3-quest sequential campaign — Wisdom → Creation → Discipline — each quest locked until the previous is complete
- Writes all three quests directly to the database via Gemini Function Calling
- When you complete a quest, narrates your achievement as a lore chapter in your personal Evolving Codex
The world itself adapts. Switch to Cyberpunk mode and your quest to "fix the memory leak" becomes "Neutralize the Grid Parasite terrorizing Neo-Chiba's memory buffers." The same goal, reframed through a lens that makes it feel like something worth doing.
How I Built It
The Agentic Core
The hardest architectural decision was the difference between structured generation and genuine tool use.
The easy path: prompt Gemini, get JSON back, parse it in Next.js, save to MongoDB. That's a standard AI app. The agent doesn't act — it generates text that the code acts on.
The path I took: define MongoDB operations as Gemini Function Calling tools, and let the model decide when to invoke them. The difference in the agentic loop:
Standard App:
Prompt → JSON text → app parses → app saves
SAGACORE Agent:
Prompt → agent reads DB (tool call)
→ agent reasons about state
→ agent writes Quest 1 (tool call)
→ agent writes Quest 2 with dependency (tool call)
→ agent writes Quest 3 with dependency (tool call)
→ agent returns summary
This runs as a ReAct loop — Reasoning + Acting — with a maximum of 5 iterations. Gemini receives tool results back into context and continues reasoning until the task is complete or the loop limit is hit.
The Quest Dependency System
One insight that emerged during building: quests without stakes don't matter. If you can complete Quest 3 before Quest 1, the campaign is just a list with extra steps.
So I added dependsOnQuestId to the Quest schema. The agent assigns these dependencies during generation. The UI locks downstream quests with a visual indicator showing what needs to be completed first. This enforces a genuine progression arc — the same mechanic that makes RPG questlines compelling.
The Dual-Layer Task System
Every quest has tasks formatted as:
"Study BFS/DFS implementations | Traverse the sandboxed loops"
The left side is the real-world action. The right side is the fantasy lore subtitle. This keeps the app grounded — you always know what you actually have to do — while maintaining the immersive layer that makes completion feel meaningful.
The Memory Architecture
Persistence is two-layered:
- localStorage (namespaced per Firebase UID) for instant hydration on load — zero flash of empty state
- MongoDB Atlas as the source of truth — synced in the background after local render
On first load, the UI appears instantly from cache. MongoDB sync runs silently and updates the UI if the database state differs. This pattern eliminates the 1–2 second loading state that breaks immersion.
The MythicGrid Narrative Engine
Quest completion triggers a background async call to Gemini that generates a unique lore chapter. The chapter is themed to your active world (Fantasy / Cyberpunk / Steampunk), references your specific quest title, and accumulates into a personal Codex over time.
This was technically optional. I built it because it answers the question every productivity app struggles with: why does it feel good to mark something done? The answer is that completion needs to mean something beyond a checkmark. A paragraph of generated fantasy narration describing your achievement as a legendary event — however small — provides that meaning.
Challenges
Knowing When the Agent Is Actually Acting
Debugging agentic loops is disorienting because failures are silent. If Gemini decides not to call a tool, you get a text response instead of a quest saved to the database, with no error thrown. Building confidence that the loop was actually executing tool calls — not just generating tool-flavored text — required extensive logging and careful inspection of the functionCall response parts.
The Completion Verification Problem
The hardest product question: how do you know if the user actually did the thing?
The honest answer is: you don't. Neither does any other productivity app. What SAGACORE does instead is make completion feel consequential enough that the incentive to check the box honestly outweighs the incentive to cheat. The XP system, the lore narration, the locked quests downstream — these create real stakes.
The technical solution is on the roadmap: GitHub commit webhooks for code quests, LeetCode solve detection for algorithm quests. The architecture supports it — quests are structured MongoDB documents with category fields that map directly to external verification APIs.
The $\text{XP}$ Progression Mathematics
Balancing the XP system required thinking about the reward curve carefully. Too flat and leveling feels meaningless. Too steep and new users never see progress.
The current model: each level requires $1000$ XP, quest rewards scale with difficulty:
$$XP_{quest} = \begin{cases} 60\text{–}80 & \text{Common} \ 100\text{–}130 & \text{Rare} \ 150\text{–}180 & \text{Epic} \ 200\text{–}250 & \text{Legendary} \end{cases}$$
At average difficulty (Rare), a user completing $\sim 10$ quests per level feels steady progression without grind. The level-up cadence is tuned to feel rewarding without feeling trivial.
What I Learned
Agents are defined by their loops, not their outputs. A model that generates a quest title is a generator. A model that reads state, reasons, writes to a database, receives confirmation, and continues — that's an agent. The distinction is the feedback cycle, not the sophistication of the output.
Immersion is load-bearing. The fantasy vocabulary, the lore chapters, the world themes — these aren't decoration. They're the mechanism by which real work feels worth doing. Strip them out and you have a slightly worse Todoist. Keep them and you have something people want to open.
Fallbacks are features. Every AI call in SAGACORE has a local fallback — keyword-matching quest generation, template-based lore chapters, hardcoded task lists. These aren't embarrassing backups. They're what makes the app work when Gemini is slow or rate-limited. For a demo, a fallback that fires gracefully is better than a spinner that never resolves.
Built With
next.js typescript tailwind-css framer-motion gemini google-cloud mongodb mongoose firebase vercel
SAGACORE — Every dream has a world waiting for you.
Built With
- cinzel-font
- firebase-authentication
- framer-motion
- gemini-api
- google-cloud
- lucide-react
- mongodb-atlas
- mongoose
- next.js
- react
- tailwind-css
- typescript
- vercel
Log in or sign up for Devpost to join the conversation.