Skip to content

Latest commit

 

History

History
275 lines (207 loc) · 8.52 KB

File metadata and controls

275 lines (207 loc) · 8.52 KB

🧠 Kodnex — AI Coding Practice Mentor

Built for the Hindsight AI Agents Hackathon (PS3) Powered by Google ADK + Gemini 2.5 Flash + Hindsight Memory


What is Kodnex?

Kodnex is an AI-powered coding practice platform that remembers your mistakes across sessions and adapts to your weaknesses. Unlike static problem sets, Kodnex uses three specialized AI agents — a Bug Predictor, a Code Generator, and a Code Explainer — all backed by Hindsight long-term memory that tracks your patterns over time.

The more you practice, the smarter Kodnex gets about your specific blind spots.


Demo

link - https://youtu.be/fxnSuQnz0hg?si=qxI1YgFfF5VyWjdz

Screen Description
Practice Library Browse 8000+ real Codeforces problems with live filtering
Problem Editor Monaco-style code editor with language switching
Bug Predictor Agent AI reviews your code and flags errors with severity
Code Generator Agent Generates optimal solution with complexity analysis
Code Explainer Agent Explains approach, logic, and patterns step by step
Submit Feedback Detailed post-submission analysis with memory timeline
Community Forum with posts, comments, likes, and topic filtering
Academy Structured learning paths with progress tracking
Dashboard Memory card showing your weak areas and patterns
History Session-by-session breakdown with accuracy rings
Progress Analytics with topic mastery and error velocity

Tech Stack

Frontend

  • Next.js 14 — App Router, TypeScript
  • Inline styles — No Tailwind dependency issues
  • JetBrains Mono — Monospace aesthetic throughout

Backend

  • FastAPI — REST API with async endpoints
  • Google ADK — Agent orchestration framework
  • Gemini 2.5 Flash — Powers all three AI agents
  • Hindsight — Long-term memory via retain() and recall()
  • Codeforces API — 8000+ live coding problems

Agent Architecture

root_agent (ParallelAgent)
├── memory_agent     → Hindsight recall() — checks past mistakes
└── main_agent       → Routes to correct specialist
    ├── code_reviewer_agent   → Bug Predictor
    ├── code_writer_agent     → Code Generator  
    └── code_explainer_agent  → Code Explainer

Project Structure

AI Coding Practice Mentor/
├── backend/
│   └── coding_agent/
│       ├── agent.py           ← ADK agents (reviewer, writer, explainer)
│       ├── hindsight_api.py   ← store_memory() and recall_memory()
│       ├── main.py            ← FastAPI server with all endpoints
│       ├── runner.py          ← ADK session runner
│       ├── requirements.txt
│       └── .env               ← API keys (never commit this)
│
└── kodnex/                    ← Next.js frontend
    └── src/
        ├── app/
        │   ├── api/
        │   │   ├── agent/
        │   │   │   ├── bug/route.ts       ← Proxy → /agent/bug
        │   │   │   ├── generate/route.ts  ← Proxy → /agent/generate
        │   │   │   └── explain/route.ts   ← Proxy → /agent/explain
        │   │   └── memory/
        │   │       └── store/route.ts     ← Proxy → /memory/store
        │   ├── academy/page.tsx
        │   ├── auth/page.tsx
        │   ├── community/page.tsx
        │   ├── dashboard/page.tsx
        │   ├── history/page.tsx
        │   ├── notifications/page.tsx
        │   ├── practice/page.tsx
        │   ├── progress/page.tsx
        │   └── settings/page.tsx
        └── screens/
            ├── 00-landing.tsx
            ├── 01-auth.tsx
            ├── 02-dashboard.tsx
            ├── 03-settings.tsx
            ├── 04-notifications.tsx
            ├── 05-progress.tsx
            ├── 06-history.tsx
            ├── 07-practice.tsx    ← Main practice screen with 3 agents
            ├── 08-community.tsx
            └── 09-academy.tsx

Getting Started

Prerequisites


1. Clone the repo

git clone https://github.com/LakshuCodes/AI-Coding-Practice-Mentor
cd AI-Coding-Practice-Mentor

2. Set up the backend

cd backend/coding_agent

# Install dependencies
pip install google-adk fastapi uvicorn python-dotenv hindsight-client

Create your .env file:

# backend/coding_agent/.env
GOOGLE_API_KEY=AIzaSy...your_key_here...
HINDSIGHT_BASE_URL=https://...
HINDSIGHT_API_KEY=...
HINDSIGHT_BANK_ID=...

Start the backend:

uvicorn main:app --reload --port 8000

Verify it's running:

http://127.0.0.1:8000/health
→ {"status":"ok","google_api_key_set":true,"hindsight_set":true}

3. Set up the frontend

cd kodnex

# Install dependencies
npm install

# Start dev server
npm run dev

Open http://localhost:3000


4. Run both together

You need two terminals open simultaneously:

Terminal Command
Terminal 1 — Backend cd backend/coding_agent && uvicorn main:app --reload --port 8000
Terminal 2 — Frontend cd kodnex && npm run dev

API Endpoints

Method Endpoint Description
GET /health Health check + API key status
POST /agent/bug Bug Predictor Agent
POST /agent/generate Code Generator Agent
POST /agent/explain Code Explainer Agent
POST /memory/store Store mistake to Hindsight
GET /memory/{user_id} Recall memories for user

Request body (all agent endpoints)

{
  "code": "your code here",
  "language": "C++17",
  "problem_title": "Two Sum",
  "problem_description": "Find two numbers that add to target",
  "user_id": "user_001"
}

Interactive API docs: http://127.0.0.1:8000/docs


How the Memory Works

Every time you submit a solution, Kodnex calls store_memory() to save your mistake pattern to Hindsight:

store_memory("User made 'off-by-one error' on 'Binary Search' in C++17 session 7")

On your next session, the memory_agent runs recall_memory() in parallel with the main agent. If you're making the same mistake again, the Bug Predictor will specifically flag it:

"This is your 4th time making this exact mistake — Hindsight has escalated its priority."


Pages

Route Screen
/ Landing page
/auth Sign in / Sign up
/dashboard Memory card + stats + recent activity
/practice Problem library + code editor + 3 AI agents
/history Session history with accuracy rings
/progress Analytics + topic mastery + error velocity
/community Forum with posts, comments, filtering
/academy Course library with progress tracking
/notifications System alerts and achievements
/settings Profile + language preferences + memory wipe

Environment Variables

Backend (backend/coding_agent/.env)

Variable Description Where to get
GOOGLE_API_KEY Gemini API key aistudio.google.com
HINDSIGHT_BASE_URL Hindsight API base URL hindsight.vectorize.io
HINDSIGHT_API_KEY Hindsight API key Hindsight dashboard
HINDSIGHT_BANK_ID Memory bank ID Hindsight dashboard

Hackathon Context

Event: Hindsight AI Agents Hackathon — Problem Statement 3

Core idea: Most coding practice tools give you problems and solutions. Kodnex gives you a mentor that remembers — it tracks what you struggle with across sessions and specifically targets those weaknesses.

Hindsight integration:

  • retain() — called after every submission to store mistake patterns
  • recall() — called before every agent response to check past patterns
  • The memory_agent runs in parallel with the main agent using ADK's ParallelAgent

Links: