Skip to content

22shivam/recode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReCode πŸ€–

Demo (https://www.loom.com/share/101afd8bd1884b489f0b98f4d989ff5e)

When your code breaks, Claude rewrites itβ€”automatically

Powered by Convex πŸ”₯ | Voice-enabled with Omi 🎀

Project Summary

ReCode is an autonomous code repair system that showcases the power of Convex's real-time infrastructure and Omi's voice AI platform. Built on Convex's reactive database with vector search capabilities, it continuously monitors applications for errors and autonomously generates fixes using Claude Sonnet 4.5. The system leverages Convex's instant reactivity for real-time error detection and automatic hot-reload when fixes are applied, while Omi's voice interface enables hands-free approval of low-confidence fixes through natural language commands. The agent learns from past repairs using OpenAI embeddings stored in Convex's vector index, delivering instant cached fixes (<1s) for similar future errors. ReCode demonstrates how Convex eliminates complex backend infrastructure while Omi transforms developer workflows through voice control, turning traditional 5-10 second error-to-fix cycles into instant repairs with continuous learning.

Technical Description

ReCode is built on three core components that work together in a continuous observation-action loop:

1. Error Detection Layer (Powered by Convex)

A Next.js application with Convex backend functions that includes intentional bugs for demonstration. When errors occur (field name mismatches, type errors, validation failures), they're automatically logged to Convex's real-time database with full error context, stack traces, and function names. Convex's serverless functions provide automatic deployment and type-safety, while its reactive queries ensure errors appear instantly across all connected clients without polling.

2. Autonomous Agent (Powered by Convex Vector Search + Omi Voice AI)

A Node.js agent polls Convex every 3 seconds for unresolved errors. When detected, it leverages Convex's advanced capabilities and Omi's voice platform:

Convex Vector Search Intelligence:

  • Generates vector embedding of the error using OpenAI text-embedding-3-small (1536 dimensions)
  • Queries Convex's built-in vector index for semantically similar past fixes (cosine similarity)
  • Convex handles vector search nativelyβ€”no separate vector database needed!
  • If similarity >85%, applies cached fix instantly (~50-300ms) thanks to Convex's speed
  • Otherwise, reads broken code and sends to Claude Sonnet 4.5 via Anthropic API
  • Stores fix with embedding back in Convex's vector index for continuous learning

Omi Voice Integration:

  • For low-confidence fixes (<70%), sends notification to Omi wearable device
  • Omi processes voice commands in real-time: "approve the fix", "reject the fix", "what's the status"
  • Natural language understanding powered by Omi's AI platform
  • Hands-free workflowβ€”developers can approve fixes while coding, walking, or in meetings
  • Omi's webhook system enables instant bidirectional communication with the agent

3. Real-Time Synchronization (The Convex Advantage)

Convex's real-time infrastructure makes ReCode possible by eliminating traditional backend complexity:

Instant Reactivity:

  • Convex's reactive queries automatically push error/fix updates to all connected clients
  • No WebSockets to manage, no polling intervals, no state synchronization headaches
  • Dashboard updates in real-time without a single line of subscription code
  • Type-safe mutations and queries via Convex's automatic TypeScript generation

Serverless Deployment:

  • Functions automatically reload when files change (<1s hot reload)
  • No manual deployments, no container orchestration, no infrastructure management
  • Convex handles scaling automaticallyβ€”from development to production

Built-in Vector Search:

  • Convex's native vector index eliminates need for separate Pinecone/Weaviate setup
  • Millisecond query latency for semantic similarity search
  • Integrated with the same database holding errors and fixesβ€”one platform, zero data sync issues

Result: When a user triggers a bug in the application, the error flows through Convex's real-time database, gets fixed by Claude, and the corrected function deploys via Convex's hot reloadβ€”all in 5-10 seconds for first-time errors, or <1 second for cached repairs thanks to Convex's vector search. For low-confidence fixes, Omi's voice approval completes the loop with zero context switching.

Architecture

User Action β†’ Error in Convex Function β†’ Logged to Convex DB
    ↓
Agent Polls for Errors β†’ Vector Search for Similar Past Fixes
    ↓
    β”œβ”€ Similarity >85% β†’ Apply Cached Fix Instantly ⚑ (~300ms)
    β”‚
    └─ No Match β†’ Read Broken Code β†’ Send to Claude AI
                    ↓
                Claude Generates Fix β†’ Agent Validates & Writes
                    ↓
                Store Fix with Embedding for Future Reuse
    ↓
Convex Auto-Reloads Function (<1s)
    ↓
User Retries Action β†’ Success! ✨

Key Features

πŸ”₯ Powered by Convex

  • βœ… Real-Time Database - Convex's reactive queries push updates instantly without polling
  • βœ… Built-in Vector Search - Native vector index for semantic similarityβ€”no separate DB needed
  • βœ… Serverless Functions - Automatic deployment, hot reload, and type-safety out of the box
  • βœ… Zero Infrastructure - No WebSockets, no Redis, no separate vector DBβ€”just Convex
  • βœ… Type-Safe by Default - Convex generates TypeScript types automatically from schema

🎀 Voice-Enabled with Omi

  • βœ… Hands-Free Approval - Approve/reject fixes via voice while coding or in meetings
  • βœ… Natural Language Commands - "approve the fix", "what's the status", "reject the fix"
  • βœ… Proactive Notifications - Omi alerts you when low-confidence fixes need approval
  • βœ… Real-Time Processing - Omi processes voice as you speak, no wake words needed
  • βœ… Developer-First UX - No context switching, no screen touching, just natural conversation

πŸ€– AI-Powered Capabilities

  • βœ… Autonomous Error Resolution - Claude AI fixes bugs without human intervention
  • βœ… Vector Memory Learning - Learns from past fixes for instant future repairs
  • βœ… Instant Fix Reuse - <1s cached fixes (85%+ similarity threshold)
  • βœ… Confidence Scoring - Smart escalation to Omi for uncertain fixes

Why Convex + Omi?

πŸ”₯ Convex: The Perfect Backend for AI Agents

Traditional approaches to building ReCode would require:

  • Separate PostgreSQL database for errors/fixes
  • Redis for real-time updates or WebSocket server
  • Pinecone/Weaviate for vector search
  • Custom API endpoints for each operation
  • Manual TypeScript type definitions
  • Deployment orchestration (Docker, K8s, etc.)

With Convex, we get all of this in ONE platform:

  • βœ… Real-time database with reactive queries (replaces PostgreSQL + Redis/WebSockets)
  • βœ… Built-in vector search with native indexing (replaces Pinecone/Weaviate)
  • βœ… Auto-generated TypeScript types from schema (no manual typing)
  • βœ… Serverless functions with instant deployment (no infrastructure)
  • βœ… Hot reload during development (Ctrl+S and it's live)

Result: ReCode went from concept to working prototype in hours, not weeks. Convex eliminated 80% of backend boilerplate.

🎀 Omi: Transforming Developer Workflows with Voice

Traditional fix approval requires:

  • Context switching to review dashboard
  • Manual clicking through UI elements
  • Interrupting current flow to handle notifications

With Omi's voice platform:

  • βœ… Hands-free approval while coding, walking, or in meetings
  • βœ… Natural languageβ€”just say "approve the fix" or "reject it"
  • βœ… Real-time processingβ€”no wake words, instant response
  • βœ… Wearable form factorβ€”always accessible without phone/computer
  • βœ… Developer-first UXβ€”designed for technical workflows

Result: Low-confidence fixes go from "context-switching interruption" to "seamless voice approval" without breaking flow state.


Quick Start

Prerequisites

1. Set up Convex

cd frontend
npm install
npx convex dev --typecheck=disable

This will:

  • Open a browser to login/create Convex account
  • Generate your NEXT_PUBLIC_CONVEX_URL
  • Create .env.local automatically
  • Start watching your Convex functions

Note: We use --typecheck=disable because the demo includes intentional TypeScript errors that need to reach runtime.

2. Add your API keys

Edit frontend/.env.local and add:

ANTHROPIC_API_KEY=sk-ant-your-key-here
OPENAI_API_KEY=sk-your-key-here

Get your keys from:

3. Start the Next.js app

In a new terminal:

cd frontend
npm run dev

Open http://localhost:3000

4. Start the AI Agent

In a third terminal:

cd agent
npm install
npm run dev

You should see:

πŸ€– Self-Healing Agent Started!
πŸ“‘ Connected to Convex
πŸ‘οΈ  Monitoring for errors...

Testing the Self-Repair System

Demo Flow

  1. Open the app: http://localhost:3000
  2. Open the dashboard: http://localhost:3000/dashboard (in another tab)
  3. Trigger Bug #1: Try to perform an action β†’ ❌ Error!
  4. Watch the agent terminal:
    • πŸ”΄ Error detected in Convex function
    • πŸ€– Claude analyzing...
    • βœ… Fix applied!
  5. Try again: Perform the same action β†’ ✨ Success!
  6. Trigger Bug #2: Perform another action β†’ Same fix cycle
  7. Trigger Bug #3: Perform a third action β†’ Same fix cycle

All 3 bugs get fixed automatically!

What's Being Fixed

The demo includes 3 intentional bugs that demonstrate different error types:

Bug Issue Fix
#1 Argument name mismatch between frontend and backend Correct argument name in function definition
#2 Wrong field name used in database operation Update field name to match schema
#3 Another argument name mismatch Correct argument name in function definition

Reset for Another Demo πŸ”„

Full Reset (New Demo)

After the agent fixes all bugs, reset everything:

# From project root
node reset-bugs.js

This will:

  • βœ… Restore the 3 bugs to convex/tasks.ts
  • βœ… Clear all error and fix history from Convex
  • βœ… Ready for a fresh demo!

Reset Bugs Only (Test Vector Search) 🧠

To test the vector search learning capability:

# From project root
node reset-bugs-keep-history.js

This will:

  • βœ… Restore the 3 bugs to convex/tasks.ts
  • βœ… Keep all error and fix history in Convex
  • βœ… Ready to demonstrate instant fixes!

Expected behavior:

  • First run: Claude analyzes code (~6 seconds per fix)
  • Second run (after reset-bugs-keep-history): Instant fixes from cache (~300ms) ⚑

Then restart the agent:

cd agent
# Ctrl+C to stop, then:
npm run dev

Omi Voice Integration 🎀

Experience the future of developer workflowsβ€”hands-free code approval powered by Omi!

Control ReCode without touching your keyboard or phone. Omi's wearable AI device brings voice-first interaction to development workflows.

Why Voice Control Matters for Developers

Traditional fix approval breaks your flow:

  • ❌ Stop coding to review a dashboard
  • ❌ Context switch between editor and browser
  • ❌ Navigate UI elements with mouse/keyboard

With Omi, approvals happen naturally:

  • βœ… "Approve the fix" while continuing to code
  • βœ… "What's the status" while walking to a meeting
  • βœ… "Reject the fix" while reviewing the error in your mind
  • βœ… Zero context switching, zero screen time

Features

  • πŸ”” Proactive Notifications: Omi alerts you when low-confidence fixes need approval
  • πŸŽ™οΈ Natural Language Commands: Speak naturallyβ€”"approve the fix", "what's the status", "reject the fix"
  • ⚑ Real-Time Processing: Omi processes your voice as you speak, no wake words needed
  • 🌐 Always Available: Wearable form factor means approvals are always one sentence away

Quick Setup

  1. Install dependencies:
cd omi
npm install
  1. Create Omi app:

    • Go to h.omi.me/apps
    • Create new "Integration App"
    • Select "Real-time Transcript Processor" trigger
    • Save your APP_ID and APP_SECRET
  2. Configure environment:

    • Add to frontend/.env.local:
    OMI_UID=your_user_id_from_omi
    OMI_APP_ID=your_app_id
    OMI_APP_SECRET=your_app_secret
  3. Expose webhook with ngrok:

    ngrok http 3001
    • Copy HTTPS URL + /webhook to Omi app config
  4. Start Omi server:

cd omi
npm start
  1. Restart agent (to enable notifications):
cd agent
npm install  # Install axios if needed
npm run dev

Voice Commands

  • "approve the fix" β†’ Approves pending fix
  • "reject the fix" β†’ Rejects pending fix
  • "what's the status" β†’ System status
  • "list pending" β†’ Show pending approvals

See omi/README.md for detailed setup.


Project Structure

self-healing-tasks/
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ page.tsx              # Main application UI
β”‚   β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”‚   └── page.tsx          # Real-time agent dashboard
β”‚   β”‚   β”œβ”€β”€ layout.tsx            # Convex provider setup
β”‚   β”‚   └── ConvexClientProvider.tsx
β”‚   β”œβ”€β”€ convex/
β”‚   β”‚   β”œβ”€β”€ schema.ts             # Database schema (errors, fixes) + vector index
β”‚   β”‚   β”œβ”€β”€ tasks.ts              # Backend functions (with intentional bugs)
β”‚   β”‚   β”œβ”€β”€ tasks.buggy.ts        # Backup for resetting
β”‚   β”‚   β”œβ”€β”€ errors.ts             # Error logging functions
β”‚   β”‚   └── fixes.ts              # Fix history + vector search functions
β”‚   └── package.json
β”œβ”€β”€ agent/
β”‚   β”œβ”€β”€ index.js                  # AI agent (polls + fixes + vector search + Omi)
β”‚   β”œβ”€β”€ clear-history.js          # Reset helper
β”‚   └── package.json
β”œβ”€β”€ omi/                          # Voice integration (optional)
β”‚   β”œβ”€β”€ server.js                 # Webhook server for Omi device
β”‚   β”œβ”€β”€ notifications.js          # Send notifications to Omi
β”‚   β”œβ”€β”€ commands.js               # Parse voice commands
β”‚   β”œβ”€β”€ convex-client.js          # Convex integration
β”‚   └── README.md                 # Omi setup guide
β”œβ”€β”€ reset-bugs.js                 # Full reset (bugs + history)
β”œβ”€β”€ reset-bugs-keep-history.js    # Reset bugs only (for testing vector search)
└── DEMO_SCRIPT.md                # 2-minute pitch guide

Tech Stack

Core Infrastructure

  • πŸ”₯ Convex - The backbone of ReCode

    • Real-time reactive database with instant synchronization
    • Serverless functions with automatic TypeScript generation
    • Built-in vector search (no Pinecone/Weaviate needed!)
    • Hot reload and automatic deployment
    • Type-safe mutations, queries, and actions
    • Zero infrastructure management
  • 🎀 Omi - Voice AI platform for hands-free approvals

    • Real-time voice command processing
    • Natural language understanding
    • Webhook integration for bidirectional communication
    • Wearable device for always-available interaction
    • Developer-optimized UX

AI & Frontend

  • Claude Sonnet 4.5 - Code analysis and autonomous fixing (Anthropic API)
  • OpenAI text-embedding-3-small - Vector embeddings for semantic similarity
  • Next.js 15 - React framework with App Router
  • TypeScript - Type safety across the entire stack
  • Tailwind CSS - Styling

Architecture

  • Autonomous agent with OODA-loop pattern
  • Vector memory for continuous learning
  • Real-time reactivity powered by Convex
  • Voice-controlled approval flow via Omi

How It Works (Deep Dive)

1. Error Occurs

User performs an action β†’ Convex function fails due to argument name mismatch or incorrect field name.

2. Error Logged

Frontend catches the error and calls:

await logError({
  functionName: "function.name",
  errorMessage: "Argument validation error or runtime error",
  stackTrace: err.stack
});

3. Agent Detects

Agent polls api.errors.getUnresolved every 3 seconds, finds the new error.

4. Claude Analyzes

Agent reads the broken function file, sends to Claude:

ERROR: [Error message with context]
FUNCTION: [Function name]
CODE: [Broken function code]

Fix ONLY the bug, return clean TypeScript.

5. Fix Applied

Claude returns corrected code with proper argument names or field names. Agent:

  • Validates the fix (checks for imports)
  • Writes corrected code to the file
  • Logs fix to Convex
  • Marks error as resolved

6. Convex Reloads

Convex dev server detects file change, recompiles, redeploys function (< 1 second).

7. User Retries

User performs the same action again β†’ Success! βœ…


Future Enhancements

  • πŸ§ͺ Test Validation - Run tests before applying fixes
  • 🌐 Multi-Language Support - Extend beyond TypeScript
  • πŸ”„ Rollback System - Auto-revert if fix doesn't work
  • 🎯 Vapi Integration - Alternative voice interface option

Demo Script

See DEMO_SCRIPT.md for a detailed 2-minute presentation guide optimized for hackathon judges.


License

MIT


πŸ™ Acknowledgments

Built with ❀️ for hackathons

Special thanks to our amazing sponsors:

πŸ”₯ Convex

For providing the most developer-friendly backend platform we've ever used. Convex's real-time database, built-in vector search, and serverless functions made building ReCode an absolute joy. What would have taken weeks with traditional infrastructure took hours with Convex.

🎀 Omi

For pioneering voice-first developer tools. Omi's wearable AI platform and real-time voice processing transformed our fix approval workflow from tedious screen-based interactions to seamless voice commands. The future of developer UX is hands-free, and Omi is leading the way.

πŸ€– Anthropic

For Claude Sonnet 4.5, which powers ReCode's autonomous code analysis and repair capabilities.


Learn more:

  • πŸ”₯ Try Convex - Build reactive apps without the backend complexity
  • 🎀 Get Omi - Experience hands-free AI workflows
  • πŸ“š Read our demo script - 2-minute pitch for judges

About

ReCode eliminates downtime by giving your application the ability to fix itself.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published