DEV Community

AMAN KUMAR MAURYA
AMAN KUMAR MAURYA

Posted on

I Built an AI Tutor That Actually Remembers Me — Using Cognee

 The problem that broke me

I'm a Data Science student at IIT Madras. Every week I'm juggling multiple courses — Software Engineering, AI, Software Testing — plus hackathons, assignments, and research. My study sessions are fragmented. I pick up a topic, drop it, come back to it three days later, completely confused again.

I tried every AI chat tool to help. They were all useless in the same way.

Ask ChatGPT about gradient descent today, and it's great. Come back next week and say "remember when I was confused about this?" — it doesn't. It can't. Every session is a blank slate. You end up re-explaining your own confusion to the AI every time. You become the memory system for a tool that's supposed to help you learn.

That's AI amnesia. And it makes AI tutors fundamentally broken.

What Cognee actually is (and why it changes everything)

I'd come across Cognee before — an open-source AI memory platform that builds a knowledge graph from your data instead of just chunking it into a vector store. But I hadn't deeply understood why that matters until I started building.

The difference is this:

With normal RAG (what every AI chatbot uses), your notes get turned into floating vector embeddings. Ask a question, retrieve the most similar chunks, send them to an LLM. It works. But it treats your knowledge as a bag of disconnected facts.

With Cognee, the same notes become a graph — concepts as nodes, relationships as edges. "Backpropagation" connects to "gradient descent" connects to "chain rule" connects to "neural network training". When you ask a question, the search doesn't just find the closest text — it reasons over the graph, following relationships to give you answers that understand how concepts connect.

That structural difference is what makes persistent, evolving memory actually possible.

What I built: MemoryTutor

GitHub: github.com/23f2001033/MemoryTutor
Live demo: memorytutor-8xubbwgxarbmzutwjeger2.streamlit.app

MemoryTutor is an AI study tutor with two layers of memory:

Layer 1 — Course knowledge graph
You upload your notes (PDF or text). Cognee ingests them with cognee.add(), then cognee.cognify() extracts entities and relationships, building a knowledge graph stored on disk. Ask a question and cognee.search(SearchType.GRAPH_COMPLETION) reasons over that graph — not just nearest-neighbour lookup.

Layer 2 — Your personal learning profile
Every question you ask, MemoryTutor extracts the topic (via a quick Gemini call). If you ask a follow-up, click "Still confused", or phrase it with confusion signals ("I don't get it", "can you explain again"), the topic gets flagged as a WeakArea. Nail it and click "Got it" — it becomes a MasteredTopic. Both states are saved to user_memory.json and mirrored into the Cognee graph as short memory statements.

What this enables:

Close the app. Come back tomorrow. MemoryTutor greets you:

"Last session you struggled with gradient descent and chain rule — want to revisit them before we move on?"

It actually knows you. It remembers. The tutor genuinely gets smarter about you the more you use it.

The architecture

Streamlit UI (app.py)

├── engine.py → cognee.add / cognify / search (async, persistent event loop)
├── tracker.py → WeakArea / MasteredTopic → user_memory.json + graph mirror
└── viz.py → networkx + matplotlib concept graph (colored by struggle level)

Cognee (LiteLLM + Gemini)
knowledge graph stored in .cognee_system/ and .data_storage/

The knowledge graph visualization was a deliberate design choice: you can literally see which concepts you know (green), which you're struggling with (red), and how they connect. It makes the invisible visible.

The hard parts

  1. Async in Streamlit is painful

Cognee's API is fully async. Streamlit's script model is synchronous and re-runs top-to-bottom on every interaction. Bridging them required a persistent background event loop that stays alive across script reruns — not a simple asyncio.run() call.

  1. Cognee's default storage location

By default Cognee stores its databases inside its own package directory. That means every pip install -r requirements.txt would wipe your entire knowledge graph. I overrode the storage paths in config.py to point to the project root — a small fix with a big impact for persistence.

  1. Graph noise

Cognee's raw graph includes internal bookkeeping nodes (chunk nodes, summary nodes, document nodes) that aren't meaningful concepts. The viz layer filters these out by node type so only real course concepts appear in the visualization.

  1. Free Gemini tier limits

gemini-1.5-flash and text-embedding-004 were retired after I started building. The app now defaults to gemini/gemini-flash-lite-latest and gemini/gemini-embedding-001 — both current, both free-tier friendly.

What I learned about AI memory

Building this changed how I think about what's missing in most AI tools.

We obsess over context windows — how much the model can hold in mind at once. But the real gap is persistence — what it retains between conversations. A tutor that can hold 200,000 tokens in context but forgets you the moment you close the tab is a very smart, very forgetful professor.

Cognee's graph model is the right approach here because it doesn't just store — it structures. And structured storage lets you do things raw retrieval can't: traverse relationships, reason over connections, surface context the user didn't know to ask for.

The future of AI tools isn't bigger context windows. It's better memory architecture.

Try it

Live demo: memorytutor-8xubbwgxarbmzutwjeger2.streamlit.app
GitHub: github.com/23f2001033/MemoryTutor
Upload any course notes PDF and start asking questions. Come back the next day and see what it remembers.

Built in one day for The Hangover Hackathon by WeMakeDevs × Cognee.

Aman Kumar Maurya — IIT Madras BS Data Science student
 The problem that broke me

I'm a Data Science student at IIT Madras. Every week I'm juggling multiple courses — Software Engineering, AI, Software Testing — plus hackathons, assignments, and research. My study sessions are fragmented. I pick up a topic, drop it, come back to it three days later, completely confused again.

I tried every AI chat tool to help. They were all useless in the same way.

Ask ChatGPT about gradient descent today, and it's great. Come back next week and say "remember when I was confused about this?" — it doesn't. It can't. Every session is a blank slate. You end up re-explaining your own confusion to the AI every time. You become the memory system for a tool that's supposed to help you learn.

That's AI amnesia. And it makes AI tutors fundamentally broken.

What Cognee actually is (and why it changes everything)

I'd come across Cognee before — an open-source AI memory platform that builds a knowledge graph from your data instead of just chunking it into a vector store. But I hadn't deeply understood why that matters until I started building.

The difference is this:

With normal RAG (what every AI chatbot uses), your notes get turned into floating vector embeddings. Ask a question, retrieve the most similar chunks, send them to an LLM. It works. But it treats your knowledge as a bag of disconnected facts.

With Cognee, the same notes become a graph — concepts as nodes, relationships as edges. "Backpropagation" connects to "gradient descent" connects to "chain rule" connects to "neural network training". When you ask a question, the search doesn't just find the closest text — it reasons over the graph, following relationships to give you answers that understand how concepts connect.

That structural difference is what makes persistent, evolving memory actually possible.

What I built: MemoryTutor

GitHub: github.com/23f2001033/MemoryTutor
Live demo: memorytutor-8xubbwgxarbmzutwjeger2.streamlit.app

MemoryTutor is an AI study tutor with two layers of memory:

Layer 1 — Course knowledge graph
You upload your notes (PDF or text). Cognee ingests them with cognee.add(), then cognee.cognify() extracts entities and relationships, building a knowledge graph stored on disk. Ask a question and cognee.search(SearchType.GRAPH_COMPLETION) reasons over that graph — not just nearest-neighbour lookup.

Layer 2 — Your personal learning profile
Every question you ask, MemoryTutor extracts the topic (via a quick Gemini call). If you ask a follow-up, click "Still confused", or phrase it with confusion signals ("I don't get it", "can you explain again"), the topic gets flagged as a WeakArea. Nail it and click "Got it" — it becomes a MasteredTopic. Both states are saved to user_memory.json and mirrored into the Cognee graph as short memory statements.

What this enables:

Close the app. Come back tomorrow. MemoryTutor greets you:

"Last session you struggled with gradient descent and chain rule — want to revisit them before we move on?"

It actually knows you. It remembers. The tutor genuinely gets smarter about you the more you use it.

The architecture

Streamlit UI (app.py)

├── engine.py → cognee.add / cognify / search (async, persistent event loop)
├── tracker.py → WeakArea / MasteredTopic → user_memory.json + graph mirror
└── viz.py → networkx + matplotlib concept graph (colored by struggle level)

Cognee (LiteLLM + Gemini)
knowledge graph stored in .cognee_system/ and .data_storage/

The knowledge graph visualization was a deliberate design choice: you can literally see which concepts you know (green), which you're struggling with (red), and how they connect. It makes the invisible visible.

The hard parts

  1. Async in Streamlit is painful

Cognee's API is fully async. Streamlit's script model is synchronous and re-runs top-to-bottom on every interaction. Bridging them required a persistent background event loop that stays alive across script reruns — not a simple asyncio.run() call.

  1. Cognee's default storage location

By default Cognee stores its databases inside its own package directory. That means every pip install -r requirements.txt would wipe your entire knowledge graph. I overrode the storage paths in config.py to point to the project root — a small fix with a big impact for persistence.

  1. Graph noise

Cognee's raw graph includes internal bookkeeping nodes (chunk nodes, summary nodes, document nodes) that aren't meaningful concepts. The viz layer filters these out by node type so only real course concepts appear in the visualization.

  1. Free Gemini tier limits

gemini-1.5-flash and text-embedding-004 were retired after I started building. The app now defaults to gemini/gemini-flash-lite-latest and gemini/gemini-embedding-001 — both current, both free-tier friendly.

What I learned about AI memory

Building this changed how I think about what's missing in most AI tools.

We obsess over context windows — how much the model can hold in mind at once. But the real gap is persistence — what it retains between conversations. A tutor that can hold 200,000 tokens in context but forgets you the moment you close the tab is a very smart, very forgetful professor.

Cognee's graph model is the right approach here because it doesn't just store — it structures. And structured storage lets you do things raw retrieval can't: traverse relationships, reason over connections, surface context the user didn't know to ask for.

The future of AI tools isn't bigger context windows. It's better memory architecture.

Try it

Live demo: memorytutor-8xubbwgxarbmzutwjeger2.streamlit.app
GitHub: github.com/23f2001033/MemoryTutor
Upload any course notes PDF and start asking questions. Come back the next day and see what it remembers.

Built in one day for The Hangover Hackathon by WeMakeDevs × Cognee.

Aman Kumar Maurya — IIT Madras BS Data Science student

Top comments (0)