Skip to content

barrersoftware/hybrid-llm-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Hybrid LLM with GitHub Copilot

โš ๏ธ IMPORTANT: This is a client-side wrapper that routes queries to tools you install separately. It does NOT include, modify, or redistribute GitHub Copilot, Ollama, or any LLM models. You must have a valid GitHub Copilot subscription to use this tool. See ATTRIBUTION.md for full legal details.

A smart AI assistant for everyone - from solo entrepreneurs to developers - combining local LLMs with GitHub Copilot for faster, private, and cost-effective AI assistance.

License: MIT Platform



๐ŸŽฏ Who Is This For?

Perfect For:

  • ๐Ÿš€ Entrepreneurs & Small Business Owners - Need quick answers without paying per query
  • ๐Ÿ’ผ Freelancers - Managing multiple projects, need fast context switching
  • ๐Ÿ‘จโ€๐Ÿ’ป Developers - Building, debugging, learning new technologies
  • ๐Ÿ“š Students - Learning to code, need instant syntax help
  • ๐ŸŽจ Content Creators - Researching, fact-checking, getting ideas
  • ๐Ÿ”ง IT Professionals - Server management, troubleshooting, scripting

Why?

You're already paying for GitHub Copilot. This makes it faster for simple queries while keeping the quality high for complex ones, plus adds memory so it never forgets what you're working on.


โœจ What Is This?

A memory-aware hybrid AI system that intelligently routes queries between:

  1. Local Model (DeepSeek Coder) - Fast, free, private
  2. GitHub Copilot (Claude Sonnet 3.5) - Powerful, context-aware
  3. Memory Database (SQLite) - Remembers your work, prevents looping

Smart Routing

  • ๐Ÿ”น Simple queries โ†’ Local model (instant, < 1 second)
  • ๐Ÿ”ถ Complex queries โ†’ GitHub Copilot (2-5 seconds)
  • ๐Ÿง  Status queries โ†’ Memory database (milliseconds)
  • ๐Ÿ”„ Auto-fallback โ†’ If local fails, uses Copilot

โœจ Features

Core Features

  • โœ… Smart routing based on query complexity
  • โœ… Memory-aware - queries SQLite database for context
  • โœ… Cross-platform - Linux, macOS, Windows
  • โœ… Loop prevention - remembers recent work
  • โœ… Auto-fallback - always get good answers
  • โœ… Usage statistics - track routing patterns
  • โœ… Learning-ready - can fine-tune over time

Privacy & Cost

  • โœ… Private: Simple queries stay local (never sent anywhere)
  • โœ… Cost-effective: Uses GitHub Copilot you already pay for
  • โœ… No extra subscriptions: Just needs Copilot Pro/Business
  • โœ… Offline capable: Local model works without internet

๏ฟฝ๏ฟฝ Quick Start

Prerequisites

  • GitHub Copilot subscription (Pro or Business) - $10-19/month
  • GitHub CLI (gh) installed and authenticated
  • Ollama for local models (free, open source)

Installation

Linux / macOS

# Clone repository
git clone https://github.com/barrersoftware/hybrid-llm-copilot.git
cd hybrid-llm-copilot

# Run installer
chmod +x install.sh
./install.sh

Windows

# Clone repository
git clone https://github.com/barrersoftware/hybrid-llm-copilot.git
cd hybrid-llm-copilot

# Run installer
.\install.ps1

First Use

# Ask a simple question (local - instant)
ask "what is the grep flag for recursive search?"

# Ask about your current work (memory - instant)
ask "what am I currently working on?"

# Ask something complex (Copilot - high quality)
ask "create a business plan outline for a SaaS startup"

# View statistics
ai-stats

๐Ÿ’ก Real-World Use Cases

For Entrepreneurs

ask "create a pitch deck outline"
ask "what's my project status?"
ask "draft a customer email about shipping delays"

For Developers

ask "what's the git command to undo last commit?"
ask "is my build done?"
ask "debug this error: connection refused"

For Students

ask "explain Python loops"
ask "what homework did I just complete?"
ask "create a study schedule for 5 subjects"

For Content Creators

ask "research topics on sustainable tech"
ask "what articles have I written this week?"
ask "generate 10 YouTube video ideas about cooking"

๐Ÿ“Š How It Works

Query Flow

User Query
    โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Classify Query  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ†“         โ†“          โ†“         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚Memory  โ”‚ โ”‚Local โ”‚ โ”‚Copilot โ”‚ โ”‚ GitHub โ”‚
โ”‚Check   โ”‚ โ”‚Model โ”‚ โ”‚ CLI    โ”‚ โ”‚ API    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    โ†“         โ†“          โ†“         โ†“
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ†“
         Response

Routing Logic

Memory Database Queries (Instant):

  • "What am I working on?"
  • "Is my project done?"
  • "What did I just complete?"

Local Model (< 1 second):

  • Command syntax: "how to copy files?"
  • Simple lookups: "what is HTML?"
  • Basic questions: "list git commands"

GitHub Copilot (2-5 seconds):

  • Business tasks: "create invoice template"
  • Complex generation: "write marketing email"
  • Debugging: "why isn't this working?"

๐Ÿง  Memory System

What It Remembers

The system maintains a SQLite database with:

  • Active tasks - What you're currently working on
  • Recent completions - What was just done
  • Command history - Recent actions taken
  • Project state - Current status
  • Notes & reminders - Things to remember

Loop Prevention

Without Memory:

You: "What's the status of my project?"
AI: "I don't have that information..."
You: [5 minutes later] "What's the status?"
AI: "I don't have that information..." (frustrating!)

With Memory:

You: "What's the status of my project?"
AI: "Project XYZ: 75% complete, last updated 10 minutes ago"
You: [5 minutes later] "What's the status?"
AI: "Project XYZ: 78% complete, just deployed to staging"

๐Ÿ“– Usage Examples

Example 1: Quick Syntax Lookup

$ ask "how do I compress a folder?"
๐Ÿ”น [Local Model]
tar -czf archive.tar.gz folder_name/

Example 2: Business Task

$ ask "write a professional email declining a meeting"
๐Ÿ”ถ [GitHub Copilot]
[Full professional email template with warm tone]

Example 3: Status Query

$ ask "what projects am I working on?"
๐Ÿง  [Memory Database]
Active projects:
- Website redesign (80% complete)
- Client proposal (draft ready)
- Blog post (in review)

Example 4: Context-Aware Help

$ ask "how do I test this?"
๐Ÿ”ถ [Copilot with Memory Context]
[Context from memory: You're working on website redesign]
[Specific testing instructions for YOUR project]

๐Ÿ› ๏ธ Configuration

Local Model Options

Edit ~/.config/hybrid-llm/config (Linux/macOS) or %APPDATA%\hybrid-llm\config (Windows):

[local]
model=deepseek-coder:1.3b
# Other options: codellama:7b, qwen2.5-coder:3b

[routing]
simple_threshold=10  # Words to consider query "simple"
local_min_response=20  # Min chars before fallback

[memory]
database=~/.local/share/hybrid-llm/memory.db
update_interval=600  # 10 minutes

๐Ÿ“ˆ Statistics

Track your usage and savings:

$ ai-stats

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  Hybrid AI Statistics
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Total Queries: 142

Routing:
  Memory:  23 (16.2%)  - Instant from database
  Local:   67 (47.2%)  - Free local model
  Copilot: 52 (36.6%)  - GitHub Copilot

Time Saved:
  Local handled: 67 queries instantly
  Average time saved: ~2 seconds per query
  Total: ~2.2 minutes saved this week

Cost Efficiency:
  Using Copilot Pro: $10/month (unlimited)
  Without hybrid: Would need faster responses = frustration
  With hybrid: 63% queries instant = productivity boost
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ”ง Commands

Main Commands

ask "query"              # Smart routing
explain "command"        # Always use Copilot for detailed explanation
ai-stats                 # Show usage statistics
memory-query status      # Check current tasks
memory-query recent      # Recent activity

Memory Commands

hybrid-llm memory query           # Query current state
hybrid-llm memory add-task NAME   # Add active task
hybrid-llm memory complete NAME   # Mark task complete
hybrid-llm memory recent          # Recent activity

๐ŸŒ Platform Support

Platform Status Notes
Linux โœ… Full Bash scripts, systemd integration
macOS โœ… Full Bash scripts, launchd integration
Windows โœ… Full PowerShell scripts, Task Scheduler

๐Ÿค Contributing

Contributions welcome! Please see CONTRIBUTING.md


โš–๏ธ Legal & Attribution

Trademarks & Copyright

This project integrates with and references the following trademarked products and services:

  • GitHubยฎ and GitHub Copilotยฎ are registered trademarks of GitHub, Inc. (a subsidiary of Microsoft Corporation)
  • Microsoftยฎ is a registered trademark of Microsoft Corporation
  • Anthropic and Claudeโ„ข are trademarks of Anthropic, PBC
  • Ollamaโ„ข is a trademark of Ollama, Inc.
  • DeepSeek is a trademark of DeepSeek AI

Important Disclaimers

โš ๏ธ This project is NOT:

  • Affiliated with, endorsed by, or sponsored by GitHub, Microsoft, Anthropic, or any LLM provider
  • A modification or fork of GitHub Copilot
  • Sharing, redistributing, or reverse-engineering any proprietary systems
  • Circumventing any terms of service

โœ… This project IS:

  • An independent tool that uses GitHub Copilot via its official CLI
  • A client-side router that directs queries to appropriate services
  • Fully compliant with GitHub Copilot's Terms of Service
  • Using only official, documented APIs and CLI tools
  • Open source (MIT License) for the routing logic only

What This Tool Does

This tool acts as a smart wrapper around official tools:

  1. GitHub CLI (gh) - Official GitHub command-line tool
  2. Ollama - Open source local LLM runtime
  3. SQLite - Open source database

It does NOT:

  • โŒ Modify GitHub Copilot
  • โŒ Access GitHub's servers directly
  • โŒ Reverse engineer any APIs
  • โŒ Redistribute proprietary code
  • โŒ Bypass authentication or payment

It DOES:

  • โœ… Route queries to the appropriate tool (local or Copilot)
  • โœ… Use GitHub Copilot via official gh CLI commands
  • โœ… Maintain a local memory database (your data only)
  • โœ… Provide usage statistics

Requirements

To use this tool, you MUST:

Data & Privacy

  • Local model queries: Stay 100% on your computer (Ollama)
  • Copilot queries: Sent to GitHub/Microsoft/Anthropic per their terms
  • Memory database: Stored locally, never uploaded
  • No tracking: This tool collects no telemetry

License

This project's routing logic and scripts are licensed under the MIT License.

The underlying services have their own licenses:

  • GitHub Copilot: Proprietary (subscription required)
  • Ollama: MIT License
  • DeepSeek Coder: Proprietary (free to use via Ollama)
  • SQLite: Public Domain

๐Ÿ“„ MIT License

MIT License

Copyright (c) 2025 Barrer Software

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

๐Ÿ™ Acknowledgments

This project would not be possible without:

  • GitHub & Microsoft - For creating GitHub Copilot and providing official CLI access
  • Anthropic - For developing Claude (Sonnet 3.5), which powers GitHub Copilot
  • Ollama team - For making local LLMs accessible and easy to run
  • DeepSeek AI - For creating excellent open coding models
  • Open source community - For tools, libraries, and inspiration

Thank you for making AI accessible to everyone! ๐Ÿ™


๐Ÿ“ž Support


๐Ÿš€ Roadmap

  • Core routing system
  • Memory database integration
  • Linux support
  • macOS support
  • Windows support
  • Web UI dashboard
  • Weekly fine-tuning pipeline
  • VSCode extension
  • Response caching
  • Multi-model support
  • Business workflow templates

Built with โค๏ธ by Barrer Software

Making AI assistance faster, smarter, and more accessible to everyone.


Disclaimer: This is an independent open-source project. Not affiliated with GitHub, Microsoft, Anthropic, or any LLM provider.

About

Memory-aware hybrid AI system combining local LLMs with GitHub Copilot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published