Glupe
Use LLMs in your codebase without letting them rewrite your codebase.
LLMs are powerful, but unconstrained generation is dangerous. Glupe is a CLI tool that acts as a strict constraint layer (or firewall) for AI code generation. You write the load-bearing architecture; the AI is only allowed to fill in the explicit blanks.
π¬ Glupe in Action
| Refine | Build | Fix Errors (auto-retry) |
|---|---|---|
![]() |
![]() |
![]() |
π§ The problem
Using LLMs for code today looks like this:
- paste prompt β get code β paste into project
- or let an agent rewrite entire files
This creates real issues:
- β no boundaries (AI can change anything)
- β hard to review (what actually changed?)
- β not reproducible
- β easy to break working code
β What Glupe does
Glupe adds explicit boundaries around AI-generated code.
int add(int a, int b) {
$${
// implement addition
}$$
}
- AI can only write inside
$$ { ... } $$ - Everything else is guaranteed unchanged
- You control structure, AI fills implementation
β‘ TL;DR
- You write the structure
- AI fills small, isolated regions
- Your codebase stays stable
π§ The workflow
1. Write normal code + intent
#include <vector>
void process_data(std::vector<int>& data) {
$${
// 1. Remove negative numbers
// 2. Sort descending
// 3. Remove duplicates
}$$
}
2. Run Glupe
glupe main.cpp -fill -local
Glupe will:
- extract the container
- send only that part to the LLM
- inject the result back into the file
π€ Why not just prompt?
You can β and for small tasks, you probably should.
Glupe is useful when:
- you care about not touching the rest of the file
- you want repeatable structure
- you want reviewable diffs
- youβre integrating AI into a real codebase
βοΈ What this is (and isnβt)
βοΈ This is
- a constraint layer for LLM code generation
- a way to keep AI edits local and predictable
- a tool for gradual adoption of AI in real projects
β This is NOT
- not a new programming language
- not a replacement for compilers
- not deterministic (LLMs are still LLMs)
- not magic β bad prompts still produce bad code
β‘ Installation
Recommended: Pre-compiled Binaries
Download the standalone executable for your OS directly from the Releases page.
Alternative: Quick Install Scripts
Note: Piping scripts directly to your shell carries inherent security risks. We recommend using the pre-compiled binaries above, but provide these scripts for convenience. You can review
install.ps1andinstall.shin the repository.
Windows
- Press
Win + R, typecmd, and press Enter. - In the command prompt, type
powershelland press Enter. - Run:
irm https://raw.githubusercontent.com/alonsovm44/glupe/master/install.ps1 | iex
Linux/macOS
curl -fsSL https://raw.githubusercontent.com/alonsovm44/glupe/master/install.sh | bash
π Quick Start
glupe --init
glupe hello.glp -o hello.exe -cpp -local
./hello.exe
βοΈ How it works
Glupe is a thin layer between your code and an LLM:
- scans your file
- finds
$$ { ... } $$blocks - sends only those blocks to the model
- injects generated code
- optionally compiles + retries on failure
π Determinism & Caching
A major issue with AI code generation is non-determinism: regenerating an app might introduce completely new bugs.
Glupe solves this via caching. Once a $$ block { ... } $$ block successfully compiles and passes your tests, its hash is locked in a .glupe.lock file.
Re-running the CLI will not regenerate that block unless you explicitly change the prompt inside the container. It behaves like incremental compilation: once a block works, it stays frozen safely.
π₯ Features
Scoped AI generation
Only touch what you explicitly allow.
Multi-file output
EXPORT: "mylib.h"
$$ myfunc { define a function that returns square }$$
EXPORT: END
Auto-fix compile errors
[Pass 1] Missing include
[Pass 2] Type error
[Pass 3] BUILD SUCCESSFUL
One-step run
glupe app.glp -o app.exe -cpp -local -run
π€ Who this is for
- developers experimenting with LLM-assisted coding
- people who donβt want AI rewriting entire files
- teams that want controlled integration of AI
β οΈ Tradeoffs
- LLM output is still non-deterministic
- requires writing inside containers
- adds an extra step vs raw prompting
This is intentional:
Glupe trades speed for control and safety
βοΈ Configuration
Local model
glupe config model-local qwen2.5-coder:latest
Cloud model
glupe config api-key "YOUR_KEY"
glupe config model-cloud gemini-1.5-flash
π§° Utility Commands
fix
glupe fix project.c "fix segfault" -local
explain
glupe explain main.cpp -cloud english
diff
glupe diff v1.py v2.py -cloud
sos
glupe sos english -local "KeyError in pandas"
π Vision
LLMs are useful, but unsafe by default.
Glupeβs goal is simple:
make LLM-assisted programming controllable enough to use in real systems
π White Paper
https://github.com/alonsovm44/glupe/blob/master/.DOCUMENTATION/paper.md
π§© Syntax Highlight Extension
https://github.com/alonsovm44/glupe-tutorial
π₯ Contributors
- Alonso Velazquez (Mexico)
- Krzysztof Dudek (Poland)
π License
MIT License


