Vybe Tutor

AI can generate explanations, but assessment and progression should stay deterministic, validated, and local.

Vybe Tutor is a VS Code extension that helps students learn from AI-assisted coding. A student selects code, Gemini generates an explanation and quiz, and the extension grades answers locally while adjusting difficulty, XP, levels, and streaks.

The architecture separates probabilistic generation from deterministic learning state. Zod contracts validate AI and message payloads, while pure TypeScript functions own grading, adaptation, and gamification.

VS Code extension demoZod-validated AI outputslocal adaptive engine

This project appears under Projects on my resume.

Demo loop: selected code becomes an explanation, quiz, feedback, and progress update.

Learning loop

  1. 01select code
  2. 02Gemini response
  3. 03Zod validation
  4. 04local grading
  5. 05adaptive feedback

The model can write JSON, but the extension still has to prove it.

Contracts around AI output

Tutor responses, quiz questions, doc references, and host/webview messages are all validated with strict Zod schemas. Gemini output is parsed as JSON, then accepted only if it matches the TutorResponse contract.

  • The Gemini request asks for application/json output.
  • Invalid JSON and schema mismatch fail before rendering.
  • The same contract family validates messages crossing the webview boundary.

The learner's progress should not depend on another AI call.

Local deterministic adaptation

The adaptive engine uses pure functions to grade answers, update mastery, choose next difficulty, and decide whether to show hints. Incorrect answers lower difficulty and enter recovery; stable correct answers can step difficulty up.

  • Grading is a case-insensitive selected-vs-correct comparison.
  • Mastery is clamped between 0 and 1.
  • A rolling recent-answer window controls difficulty increases.

Official docs improve explanations, but failure should not break tutoring.

Documentation enrichment as a side channel

The doc enricher maps model-identified concepts to Python documentation topics, fetches unique topics in parallel, and attaches quotes as references. If docs fail, the tutor response still renders.

  • Concepts are deduplicated by documentation topic.
  • Promise.allSettled keeps one failed fetch from failing the whole enrichment step.
  • Doc enrichment is best-effort and caught separately from the main Gemini response.

AI generation is boxed in by local contracts

The learning loop separates Gemini output from deterministic grading, state updates, and adaptive feedback.

selected codeGeminiZodlocal gradeadapt

Short excerpts that show the design choices.

Snippets are trimmed for readability and paired with the source file they came from.

KiroHacks/src/ai/geminiService.ts

Validated Gemini response

ts
const parsedJson = JSON.parse(rawText);
const validated = TutorResponseSchema.parse(parsedJson);

return handleGuardrails(validated);

The extension treats Gemini as an untrusted generator. The response must parse and satisfy the schema before it enters the UI.

KiroHacks/src/services/adaptiveEngine.ts

Adaptive recovery logic

ts
if (!isCorrect) {
  return {
    ...state,
    currentDifficulty: clampDifficulty(d - 1),
    recoveryState: "recovering",
    needsReview: true,
  };
}

Progression is deterministic and local: a missed question lowers difficulty and marks the concept for review without asking AI to decide.

What this project proves.

Vybe Tutor shows the kind of AI engineering I want to demonstrate: use the model where it is strong, but put contracts, deterministic state, and user trust around it.

Contact