An autonomous AI-powered Telegram bot that manages your GitHub repositories. Fix bugs, create features, make code changes, refactor code, and manage your entire codebaseβall from your phone without needing a computer.
- π Bug Fixes - Analyze and fix production issues automatically
- β¨ Feature Creation - Build new functionality from natural language descriptions
- π§ Code Changes - Refactor, optimize, or update code on demand
- ποΈ Repository Management - Handle configs, docs, tests, and scripts
- π€ AI-Powered Analysis - Works with Anthropic Claude, OpenRouter (400+ models), or Groq
- πΏ GitHub Integration - Creates branches and pull requests automatically
- π¬ Telegram Interface - Manage your code from anywhere using just your phone
- β Review Before Apply - You approve all changes before they're committed
- π Context-Aware - Analyzes your repository structure and relevant files
- π System Prompts - Configurable behavior guidelines (open source friendly)
- SYSTEM_PROMPT.md - System behavior guidelines (easily customizable)
- INTEGRATION_GUIDE.md - How the system prompt integrates with code
- SYSTEM_PROMPT_IMPLEMENTATION.py - Code implementation examples
- PROJECT_OVERVIEW.md - Complete technical overview
- QUICKSTART.md - 5-minute setup guide
- USAGE_EXAMPLES.md - Real-world usage examples
- TROUBLESHOOTING.md - Common issues & solutions
- DEPLOYMENT.md - Railway and Vercel deployment guide
- Python 3.8+ installed
- Telegram Account
- That's it! Everything else is added in Telegram
- Open Telegram and search for @BotFather
- Send
/newbotcommand - Follow the prompts to name your bot
- Save the bot token (looks like
123456789:ABCdefGHIjklMNOpqrsTUVwxyz)
# Clone or download the files
cd reopfiy
# Install dependencies
pip install -r requirements.txt
# Create environment file with ONLY the Telegram token
echo "TELEGRAM_BOT_TOKEN=YOUR_BOT_TOKEN_HERE" > .envReplace YOUR_BOT_TOKEN_HERE with your actual bot token from BotFather.
python repofiy_bot.pyYou should see: π Reopfiy Bot started!
- Open Telegram and find your bot
- Send
/startto see the welcome message - Get your GitHub personal access token:
- Go to GitHub Settings β Developer Settings β Personal Access Tokens β Tokens (classic)
- Click "Generate new token (classic)"
- Name it "Reopfiy"
- Select
reposcope (full control) - Generate and copy the token
- Send in Telegram:
/settoken ghp_xxxxxxxxxxxxxxxxxxxx
Bot confirms: β GitHub token saved!
Send in Telegram:
/setai
Choose one:
- π OpenRouter - 400+ models (Claude, Llama, Mistral, etc.)
- π§ Anthropic - Claude 3.5 Sonnet (highest quality)
- β‘ Groq - Mixtral 8x7b (fastest & free tier)
Bot shows a link to get an API key. Click it and copy the key from:
- Anthropic: https://console.anthropic.com/
- OpenRouter: https://openrouter.ai/keys
- Groq: https://console.groq.com/keys
Send your API key to the bot:
sk-ant-xxxxxxxxxxxxx
(or sk-or-... for OpenRouter or gsk-... for Groq)
Bot confirms: β AI key saved!
Send in Telegram:
/setrepo owner/repo
Example: /setrepo johndoe/my-website
You're ready to go! π
Open Telegram and search for your bot (the username you chose with BotFather). Send /start
/setai
Choose from the bot's menu:
- π OpenRouter (400+ models: Claude, Llama, Mistral)
- π§ Anthropic (Claude 3.5 Sonnet)
- β‘ Groq (Mixtral 8x7b - fast & free)
When prompted, send your API key from the chosen provider.
/settoken ghp_xxxxxxxxxxxxxxxxxxxxx
Get your token from: GitHub Settings β Developer Settings β Personal Access Tokens β Generate new token (classic)
/setrepo username/repository-name
Example: /setrepo johndoe/my-web-app
Fix a Bug:
/fix Users can't login - getting 401 error on auth endpoint
Create a Feature:
/feature Add dark mode toggle to settings
Make Code Changes:
/change Refactor auth service to use async/await
Create New Files:
/create New API endpoint for user profile
Or just describe naturally:
Users are complaining about slow login - let's optimize the auth
The bot will:
- π Analyze your repository code
- π€ Use AI to understand your request
- π‘ Propose specific changes
- π Show you the changes with a diff
You'll get buttons to:
- β Apply - Creates a branch and pull request
- π Revise - Ask for changes to the proposal
- β Cancel - Cancel the operation
The bot creates a PR in your GitHub repository. Review it like any other PR:
- Check the code changes
- Run tests
- Merge when satisfied
You're away from your computer and production is down:
/fix Payment processing failing with 500 error
You want to add functionality without opening an IDE:
/feature Add email verification to signup flow
Improve existing code on the fly:
/change Optimize database queries in user service
You're in a meeting and need a quick fix:
/fix Button on homepage has wrong color - should be #FF5733 not #FF0000
You're in class and found a bug in your assignment:
/fix My sorting algorithm fails on arrays with duplicates
/start- Show welcome message and help/setai- Choose AI provider (Anthropic, OpenRouter, Groq)/settoken <token>- Add or update GitHub token/setrepo <owner/repo>- Set the repository to work with/view- Browse repository files/analyze- Show repository structure/fix <description>- Fix a bug/feature <description>- Create new feature/change <description>- Make code changes/create <description>- Create new file/component/status- Check current operation status/cancel- Cancel current operation
βββββββββββββββ
β Telegram β
β User β
ββββββββ¬βββββββ
β Describes request
βΌ
βββββββββββββββββββββββ
β Reopfiy Bot β
β (Python, Async) β
ββββββββ¬βββββββββββββββ
β
ββββββββββββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β GitHub β β AI Provider β β System β
β API β β (Anthropic, β β Prompt β
βββββββββββββββ β OpenRouter, β β (SYSTEM_ β
β β Groq) β β PROMPT.md) β
β ββββββββββββββββ ββββββββββββββββ
β β β
βΌ βΌ βΌ
Create PR Analyze & Propose Guide Behavior
- User sends request via Telegram
- Bot reads SYSTEM_PROMPT.md for behavior guidelines
- Bot fetches relevant code from GitHub
- AI Provider (Claude/Llama/Mixtral) analyzes code + system prompt
- User reviews proposed changes
- Bot creates branch, commits, and opens PR on GitHub
Unlike closed-source solutions, Reopfiy's behavior is defined in SYSTEM_PROMPT.md - a human-readable file you can see, edit, and customize:
Benefits:
- β Transparency - See exactly how the bot behaves
- β Customizable - Modify for your team's needs
- β Extensible - Add new request types easily
- β Open Source Friendly - Fork and modify as needed
To customize:
- Edit SYSTEM_PROMPT.md
- Bot automatically uses updated behavior
- No code changes needed
To integrate in your code:
Your .env file only needs:
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyzThat's it! GitHub and AI provider keys are added in Telegram via commands.
All providers are set up in Telegram with /setai. When you choose a provider, send your API key:
Anthropic Claude (Best Quality)
- Model: Claude 3.5 Sonnet
- Best for high-quality, accurate fixes
- ~$0.03 per fix
- Get API Key
- Command:
/setaiβ Choose Anthropic β Paste key
OpenRouter (Most Flexible)
- 400+ models available (Claude, Llama, Mistral, etc.)
- Choose different models per request
- Auto-selects best model
- Get API Key
- Command:
/setaiβ Choose OpenRouter β Paste key
Groq (Fastest & Free)
- Model: Mixtral 8x7b
- Fastest inference
- Free tier available
- Get API Key
- Command:
/setaiβ Choose Groq β Paste key
For production deployment, see DEPLOYMENT.md for detailed guides on:
- Railway - Recommended for continuous bots (auto-deploys from GitHub)
- Vercel - For serverless/API endpoints
- Docker - Self-hosted deployment
- Systemd - Process management on Linux
Quick systemd example:
sudo nano /etc/systemd/system/reopfiy.service[Unit]
Description=Reopfiy Telegram Bot
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/path/to/reopfiy
ExecStart=/usr/bin/python3 repofiy_bot.py
Restart=always
EnvironmentFile=/path/to/.env
[Install]
WantedBy=multi-user.targetThen start:
sudo systemctl enable reopfiy
sudo systemctl start reopfiyLogging:
journalctl -u reopfiy -f # systemd logs
tail -f bot.log # or check bot.logYou can customize the bot:
- Change AI Model - Edit ANTHROPIC_API_KEY, GROQ_API_KEY, or OPENROUTER_API_KEY
- Modify System Prompt - Edit SYSTEM_PROMPT.md to change bot behavior
- Adjust Code Context - Change how many files are analyzed in
get_code_context() - Modify PR Format - Edit the PR template in
apply_fix() - Add Testing - Integrate with CI/CD to run tests before creating PR
- Never commit
.envfile - It contains secrets - Use minimal GitHub permissions - Only grant
reposcope - Rotate tokens regularly - Change your API keys every 90 days
- Review all PRs - Always review before merging bot-generated PRs
- Limit bot access - Only use with repositories you control
- Monitor bot activity - Check created PRs regularly
- Check if the bot is running:
ps aux | grep repofiy_bot.py - Check logs for errors:
tail -f bot.log - Verify your Telegram token is correct
- Verify your GitHub token has
repopermissions - Check the repository name format:
owner/repo - Ensure the repository exists and you have access
- Anthropic: Check your API key is valid, verify you have credits
- OpenRouter: Check rate limiting, verify API key
- Groq: Check free tier limits, verify key validity
- Run
/setaito reconfigure
- Ensure your GitHub token has write access to the repository
- Check that the repository isn't archived
- Verify branch protection rules aren't blocking the bot
- Provide more specific request description
- Mention relevant file names or components
- Describe what you expect vs what's happening
- Use
/changeto refine instead of/cancel
- Analyzes limited number of files (performance)
- No automatic testing before PR creation
- Single repository per user session
- No support for monorepos or complex project structures
- π Multi-repository support per user
- π§ͺ Automatic test execution before PR
- π Advanced code search and analysis
- π Fix success rate tracking
- π¨ Web dashboard for monitoring
- π Proactive bug detection from logs
- π¬ Discord support
Want to improve Reopfiy? Here's how:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Contribution areas:
- Better file relevance detection
- Multi-repository support
- Automatic testing integration
- Discord/Slack support
- Web dashboard
- Documentation improvements
MIT License - feel free to use, modify, and distribute for any purpose!
Having issues?
- Check the troubleshooting section above
- Review the logs for error messages:
tail -f bot.log - Open an issue on GitHub (if this becomes a public repo)
- Read TROUBLESHOOTING.md for detailed guides
Want to understand how this works?
- Telegram Bot API
- GitHub REST API
- Anthropic Claude API
- OpenRouter API Docs
- Groq API Docs
- Python async/await
Built with:
- python-telegram-bot - Telegram integration
- PyGithub - GitHub API
- Anthropic Python SDK - Claude AI
- OpenRouter API - Multi-model AI
- Groq API - Fast AI inference
Made with β€οΈ for developers who need to fix code from anywhere
Transform your GitHub workflow - manage your entire codebase from your phone