Beyond Single-Shot DSPy: Repo-Scale Reasoning That Compounds
I've been experimenting with DSPy beyond one-off prompt optimization. Traditional DSPy shines at optimizing prompts for isolated tasks, but what if your AI agent could learn from your entire codebase over multiple iterations?
Enter Compounding Engineering: a local-first DSPy agent that turns any Git repo into a persistent learning environment. It runs review → triage → plan → learn cycles, building a knowledge base from your code, issues, and past optimizations. No context window limits—improvements compound across sessions.
🚀 Core Innovation
- Repo as Memory: Indexes your full codebase (Python, JS, configs) into a local vector store. Agents reason over real project context, not toy examples.
- Compounding Cycles: Each run reviews changes, triages issues, plans fixes, executes via DSPy programs, and learns—storing successes/failures for next time.
- DSPy-Native: Leverages DSPy signatures, optimizers (BootstrapFewShot, etc.), and metrics. Plug in your LM (OpenAI, local models via Ollama).
- Local-First: Runs offline with FAISS/Chroma for storage. No cloud dependencies.
Here's the high-level flow:
git clone your-repo
ce init # Indexes repo, sets up DSPy LM
ce run # Full cycle: review → triage → plan → learn
ce optimize my_module.py # Targeted optimization
🎯 Why This Matters for AI Engineers
- Long-Horizon Planning: Handles repo-scale tasks like "refactor auth module for security" across files.
- Self-Improvement: Metrics track progress; failed plans become few-shot examples for retries.
- Open Source Ready: Built for your workflows—integrates Git, DSPy teleprompters, custom signatures.
🛠️ Quick Start
pip install dspy-compounding-engineering
git clone https://github.com/Strategic-Automation/dspy-compounding-engineering
cd dspy-compounding-engineering
ce init --lm openai/gpt-5.2 # Or your local LM
ce run
Full docs and examples in the README.
🤝 Get Involved
- ⭐ Star on GitHub if this sparks ideas!
- Open issues/PRs for features (Rust optimizer? Multi-repo?).
- Feedback welcome on agentic workflows, long-context reasoning, or DSPy extensions.
Built by Strategic Automation—automating engineering at scale. Let's compound!
Top comments (0)