# ContextOS-Second Brain for Developer  :   The Hangover Part AI Hackathon 

*   The Monday Morning Problem It's 9 AM on Monday. You open your laptop, and your brain is blank. Last Friday, you were deep in the zone — half-configured Redis, a JWT bug mid-debug, three architecture decisions, and a hackathon deadline breathing down your neck.
    
*   ChatGPT doesn't remember any of it. Your team's Notion is outdated. Your code comments are useless. We've all been there. So when WeMakeDevs and Cognee announced The Hangover Part AI Hackathon, I knew exactly what to build: ContextOS — a Developer Second Brain that never forgets.
    
*   What is ContextOS?
    
*   ContextOS is a Streamlit-powered web app that uses Cognee's hybrid graph+vector memory to store and retrieve everything a developer works on. It ingests code files, notes, bugs, and architecture decisions, then lets you ask questions in natural language and get answers grounded in your actual work context. The core loop is simple:
    
    1.  Feed Your Brain — Upload files, write notes, log bugs
        
    2.  Ask Your Brain — Natural language queries over graph+vector memory
        
    3.  Context Resume — One-click restore of your last session
        
    4.  Export Context — Copy to Claude, Cursor, or any AI tool The Tech Stack
        
    
    *   Cognee 1.2.2 — The memory engine (graph + vector)
        
    *   Streamlit — UI framework
        
    *   Groq + llama-3.1-8b-instant — LLM inference (free tier)
        
    *   FastEmbed — Local embeddings (no API key needed)
        
    *   LanceDB — Vector database
        
    *   NetworkX — Knowledge graph
        
    *   Deployed on Streamlit Community Cloud Solo Development with AI Teammates I built this project solo, but I wasn't alone. Three AI models played distinct roles throughout the journey:
        
    *   Claude — Handled architecture decisions. When I was torn between different Cognee configurations and LLM providers, Claude reasoned through the tradeoffs and helped me pick the right path. Its ability to hold nuanced conversations about software architecture was invaluable.
        
    *   Gemini — Served as my research assistant for documentation and pricing. When I needed up-to-date information about Groq's rate limits, model availability, and token pricing, Gemini's web-search capabilities delivered fast answers. OpeCode — The coding workhorse. It wrote most of the code — the brain.py Cognee adapter, the Streamlit UI, ingestion helpers, unit tests, and CI/CD workflow. We pair-programmed through every bug together. Hetu — Editor who polished the final presentation, demo video, and written content.
        
    *   The Journey: Building ContextOS :
        
    *   Phase 1: The Idea The hackathon required using Cognee for the Open Source track. Cognee provides four core operations — remember(), recall(), improve(), and forget() — wrapped around a graph+vector knowledge store. The challenge was wiring these into a usable developer tool that works on Streamlit Community Cloud's free tier with only a Groq API key.
        
    *   Phase 2: The Event Loop Saga The hardest bug without question was Cognee's async internals conflicting with Streamlit's event loop. Cognee is async-native, and Streamlit runs on its own event loop. When Cognee's module-level asyncio.Lock objects were created on one event loop but accessed from another (after Streamlit hot-reloads), I got: RuntimeError: Task <...> got Future <...> attached to a different loop I tried everything:
        
    *   Running Cognee on a dedicated background thread ❌
        
    *   Creating a separate event loop ❌
        
    *   Reinitializing Cognee on every call ❌
        
    *   Disabling Cognee telemetry (which had its own locks) ✅ (helped but didn't fully fix) The final fix: Clear and recreate Cognee's module-level locks — \_dataset\_locks, \_dataset\_locks\_guard, and update\_status\_lock — inside the run\_async() adapter on every call: def run\_async(coro): loop = asyncio.get\_event\_loop() import cognee.modules.pipelines.operations.pipeline as \_p \_p.\_dataset\_locks = {} \_p.\_dataset\_locks\_guard = asyncio.Lock() \_p.update\_status\_lock = asyncio.Lock() return loop.run\_until\_complete( asyncio.wait\_for(coro, timeout=120) ) Sometimes the most elegant fix is the one that addresses the root cause directly. Phase 3: Rate Limit Reality The second major blocker was Groq's free tier: 100,000 tokens per day for llama-3.3-70b-versatile. Each Cognee ingestion calls the LLM multiple times — document classification, chunk extraction, graph extraction, summarization. Four files could exhaust the entire daily quota. The fix was switching to llama-3.1-8b-instant — a smaller model (8B vs 70B) with significantly higher free-tier limits. It's faster, has more available quota, and for a hackathon demo, works perfectly. Phase 4: CI/CD Hurdle Even the GitHub Actions workflow had a YAML syntax error (a poorly formatted multi-line python -c string). One quick fix to use a YAML literal block | and the tests were passing again. Key Features Three tabs in the UI:
        
    
    1.  Chat & Recall — Ask your brain questions, get answers from the knowledge graph
        
    2.  Context Resume — One click restores your last session with suggested next actions
        
    3.  Knowledge Explorer — Visual entity relationship maps powered by the underlying graph Smart ingestion — The sidebar lets you upload files, write notes, log bugs, and record architecture decisions. Each type is tagged and stored differently in the graph. Self-improvement — After every 5 ingests, ContextOS automatically runs Cognee's improve() to refine the knowledge graph, which means the system gets smarter the more you use it. UI polish — Memory type breakdown counters, toast notifications, recent memories feed, balloon animations on context resume, and helpful empty states with actionable guidance. What I Learned
        
    4.  Async + Streamlit is tricky but fixable with the right adapter pattern
        
    5.  Cognee's graph+vector hybrid is surprisingly powerful for contextual recall
        
    6.  Rate limits are real — choose your model wisely on free tiers
        
    7.  Three AIs are better than one — Claude for architecture, Gemini for research, OpeCode for coding, and a human editor for polish
        
    8.  Hackathons force simplicity — the best solutions are often the most direct ones Try It Yourself The app is live and ready to use. Clone the repo, add your Groq API key, and run streamlit run app.py — or just visit the live demo, upload a sample file, and ask your first question. Your brain forgets. ContextOS doesn't. Links:
        
    
    *   GitHub Repo: https://github.com/rudrakhairnar16-bit/ContextOS
        
    *   Live App: https://contextos-developer-second-brain.streamlit.app
        
    *   LinkedIn: https://www.linkedin.com/in/rudra-khaire-2657a5381
        
    *   Built solo for The Hangover Part AI Hackathon by WeMakeDevs x Cognee. Developed with Claude, Gemini, and OpeCode. YouTube video edited by Hetu. Made by Rudra Keyur Khaire. @wemakedevs @cognee
        

🐙 GitHub Repo: [https://github.com/rudrakhairnar16-bit/ContextOS](https://github.com/rudrakhairnar16-bit/ContextOS)

🎥 Demo Video: [https://youtu.be/KXRg5jHmO4M](https://youtu.be/KXRg5jHmO4M)

💼 LinkedIn: [https://www.linkedin.com/in/rudra-khaire-2657a5381](https://www.linkedin.com/in/rudra-khaire-2657a5381)

🌐 Live App: https://contextos-developer-second-brain.streamlit.app
