Skip to content

lgui30/VoiceCode

Repository files navigation

VoiceCode

Say "add a calculator function" in Discord. Get a reviewed PR in 60 seconds.

You:      "Add a calculator with add, subtract, multiply, divide"
VoiceCode: Creates PR #9 with calculator.py → CodeRabbit reviews → Ready to merge

Discord bot executing task

GitHub PR with CodeRabbit review


What Just Happened?

  1. You spoke into Discord
  2. AI understood your intent and wrote production code
  3. Code ran in an isolated Daytona sandbox
  4. A real PR was created on GitHub
  5. CodeRabbit reviewed it and found 2 issues
  6. AI fixed the issues automatically
  7. PR approved and ready to merge

Total time: 47 seconds.


The Problem

Every developer has been in this meeting:

"Can someone add a simple validation function?" "I'll create a ticket." "It's just 20 lines of code..." "Fine, I'll do it after standup."

Three days later, the ticket is still in the backlog.

VoiceCode eliminates the gap between "someone should build this" and "it's deployed."


How It Works

┌─────────────────────────────────────────────────────────────────────┐
│                         VOICECODE PIPELINE                          │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   Discord          Coding Agent         GitHub          Review      │
│   ┌─────┐          ┌─────────┐         ┌──────┐        ┌────────┐  │
│   │ Voice│  ───►   │ Daytona │  ───►   │  PR  │  ───►  │CodeRab-│  │
│   │ /Text│         │ Sandbox │         │      │        │  bit   │  │
│   └─────┘          └─────────┘         └──────┘        └────────┘  │
│      │                  │                  │               │        │
│      │                  │                  │               │        │
│      ▼                  ▼                  ▼               ▼        │
│   "add a            Writes code        Creates PR      Finds 2     │
│   calculator"       in isolation       with changes    issues      │
│                                                            │        │
│                          ┌─────────────────────────────────┘        │
│                          │                                          │
│                          ▼                                          │
│                    Agent fixes issues                               │
│                    automatically until                              │
│                    review passes                                    │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

The Secret Sauce: Sandboxed Execution

Most AI coding tools generate code and hope it works. VoiceCode actually runs the code:

async with Sandbox(config) as sandbox:
    # AI writes code
    await sandbox.write_file("calculator.py", generated_code)

    # Actually execute it to verify it works
    result = await sandbox.run("python calculator.py")

    # Only create PR if code actually runs
    if result.success:
        create_pull_request()

The code runs in a Daytona sandbox—an isolated container that:

  • Has no access to your production environment
  • Can be destroyed instantly if something goes wrong
  • Lets AI experiment freely without risk

Quick Start

Prerequisites

# Required API keys
DISCORD_TOKEN=your_discord_bot_token
GITHUB_TOKEN=your_github_pat
DAYTONA_API_KEY=your_daytona_key
NOVITA_API_KEY=your_novita_key      # or OPENAI_API_KEY

# Optional (for voice)
ELEVENLABS_API_KEY=your_elevenlabs_key

Run

git clone https://github.com/lil-Zlang/VoiceCode.git
cd Daytona
pip install -r requirements.txt
python -m src.voice_bot

Use

  1. Invite the bot to your Discord server
  2. Join a voice channel
  3. Type /join to connect the bot
  4. Say or type: !voicecode add a hello world function
  5. Watch the magic happen

Architecture Deep Dive

Three Autonomous Agents

Agent Responsibility Tech
Discord Bot Voice/text capture, user interaction discord.py, ElevenLabs STT/TTS
Coding Agent Understand task, write code, fix issues DeepSeek/GPT-4, tool-use loop
Orchestrator Coordinate flow, manage state, handle retries async Python, state machine

The Coding Agent Loop

while iterations < MAX_ITERATIONS:
    # 1. Ask LLM what to do next
    response = llm.chat(messages, tools=AVAILABLE_TOOLS)

    # 2. Execute tool calls
    for tool_call in response.tool_calls:
        if tool_call.name == "write_file":
            await sandbox.write_file(tool_call.args)
        elif tool_call.name == "run_command":
            await sandbox.run(tool_call.args)
        elif tool_call.name == "read_file":
            content = await sandbox.read_file(tool_call.args)

    # 3. Check if done
    if response.finish_reason == "stop":
        break

Available Tools

The agent can:

  • read_file - Read any file in the repo
  • write_file - Create or modify files
  • run_command - Execute shell commands
  • list_files - Explore directory structure
  • search_code - Find relevant code patterns

Review Loop

When CodeRabbit finds issues:

PR Created → CodeRabbit Reviews → Issues Found?
                                      │
                    ┌─────────────────┴─────────────────┐
                    │ Yes                               │ No
                    ▼                                   ▼
            Agent reads feedback              PR Approved
            Agent fixes issues                Ready to merge
            Push new commit
            Loop back to review

Real Examples

Example 1: Calculator

Input: "add a calculator function with add subtract multiply divide"

Output: PR #9

# calculator.py (generated)
def add(a, b):
    """Add two numbers."""
    return a + b

def subtract(a, b):
    """Subtract b from a."""
    return a - b

def multiply(a, b):
    """Multiply two numbers."""
    return a * b

def divide(a, b):
    """Divide a by b with zero-division handling."""
    if b == 0:
        raise ValueError("Cannot divide by zero")
    return a / b

Example 2: Complex JS

Input: "create a PR and adding a more complex js version for it"

Output: PR #10 - 237 lines of JavaScript


Why This Matters

For Developers

  • Stop context-switching for small tasks
  • Keep focus on complex problems
  • Let AI handle boilerplate

For Teams

  • Meeting action items become PRs instantly
  • No more "I'll create a ticket for that"
  • Junior devs can contribute faster

For Startups

  • Ship features during the meeting that requested them
  • Reduce time-to-PR from days to seconds
  • AI handles code, humans handle decisions

Roadmap

  • Discord voice/text integration
  • Sandboxed code execution (Daytona)
  • Automated PR creation
  • CodeRabbit review integration
  • Auto-fix review feedback
  • Slack integration
  • VS Code extension
  • Multi-file refactoring
  • Test generation
  • Deploy preview environments

Tech Stack

Component Technology
Voice Bot Python, discord.py, discord-ext-voice-recv
Speech-to-Text ElevenLabs
Text-to-Speech ElevenLabs
LLM DeepSeek v3.1 via Novita AI (or OpenAI)
Sandbox Daytona SDK
Version Control PyGithub
Code Review CodeRabbit
Orchestration asyncio, custom state machine

FAQ

Q: Is the generated code any good?

A: It's reviewed by CodeRabbit before you see it. If there are issues, the agent fixes them automatically. You only see PRs that pass review.

Q: What if the AI writes something dangerous?

A: Code runs in isolated Daytona containers with no access to your production environment. The sandbox is destroyed after each task.

Q: Can it modify existing code?

A: Yes. The agent can read your entire repo, understand the codebase, and make targeted modifications while respecting existing patterns.

Q: How much does it cost?

A: The LLM calls cost ~$0.01-0.10 per task depending on complexity. Daytona has a free tier. CodeRabbit has a free tier for open source.

Q: Why Discord?

A: Teams already use Discord for communication. VoiceCode meets developers where they are. Slack integration is on the roadmap.


Contributing

PRs welcome! Areas we need help:

  1. Slack integration - Port the Discord bot to Slack
  2. Better prompts - Improve code generation quality
  3. More tools - Add capabilities like test generation
  4. Documentation - Tutorials, examples, guides

License

MIT


Acknowledgments

Built with:


Stop writing tickets. Start shipping code.

Star this repo if you think meetings should produce PRs, not tickets.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •