GOATCODE - Production-Grade Coding Agent
A deterministic, tool-augmented, autonomous coding agent that beats prompt-only solutions through real architecture.
🎯 The 80% That Matters
Unlike other AI coding assistants that rely on prompts alone, GOATCODE implements:
- 🔍 File Indexing Engine - AST-based semantic code search with vector embeddings
- 🧠 Context Injection - Automatic relevance-based retrieval with token budget management
- 🔄 Test→Fix→Retry Loop - Iterative validation with automatic error recovery
- 📊 Diff-Based Patching - AST-aware minimal surgical edits (no full rewrites)
- 💰 Token Budget Manager - Dynamic context window optimization
- 🗄️ Memory System - Resolution pattern storage and retrieval
Prompt = 20%. Architecture = 80%
🚀 Quick Start
Prerequisites
- Python 3.9+
- For local models: Ollama
- For SaaS: API key (OpenAI, Anthropic)
Installation
# Clone repository
git clone https://github.com/yourusername/goatcode.git
cd goatcode
# Install dependencies
pip install -r requirements.txt
# If using Ollama, pull a model
ollama pull llama2
ollama pull codellama
Usage
Interactive Mode (Recommended)
# With local Ollama
python -m goatcode --provider ollama --model llama2
# With OpenAI
python -m goatcode --provider openai --model gpt-4 --api-key $OPENAI_API_KEY
# With Anthropic
python -m goatcode --provider anthropic --model claude-3-opus
Batch Mode
python -m goatcode --provider ollama \
-p "Create a Python function to parse JSON with error handling" \
-o result.json
Example Session
🐐 GOATCODE - Production-Grade Coding Agent
Interactive Mode - Type your coding requests
Commands: /help, /exit, /status, /models
------------------------------------------------------------
📝 > Create a REST API endpoint for user authentication with JWT
🚀 Starting execution...
============================================================
Status: SUCCESS
============================================================
📊 Analysis Summary:
Creating a secure REST API endpoint for user authentication
using JWT tokens. Will include login, registration, and
protected route middleware.
📋 Implementation Plan:
1. Create auth module with JWT utilities
2. Implement login endpoint with password hashing
3. Implement registration endpoint with validation
4. Create authentication middleware
5. Add comprehensive error handling
📝 Files Modified:
[CREATE] src/auth/jwt_utils.py
[CREATE] src/auth/endpoints.py
[CREATE] src/auth/middleware.py
[UPDATE] requirements.txt
✅ Validation Report:
✓ All validations passed
✓ Type checking clean
✓ Tests passing (12/12)
🎯 Confidence Score: 95%
============================================================
🏗️ Architecture
goatcode/
├── core/
│ └── agent.py # Main orchestrator
├── llm/
│ └── interface.py # Multi-provider LLM support
├── tools/
│ └── registry.py # Tool system
├── context/
│ └── manager.py # Context pruning & injection
├── memory/
│ └── system.py # Pattern storage & retrieval
├── validation/
│ └── engine.py # Test→Fix→Retry loop
└── cli/
└── main.py # CLI entry point
Execution Pipeline
User Request
↓
1. Intent Analysis (What to build?)
↓
2. Project Context (File structure, dependencies)
↓
3. Risk Analysis (Security, edge cases)
↓
4. Memory Lookup (Similar past solutions)
↓
5. Implementation Plan (Files, functions, steps)
↓
6. Code Generation (Complete, correct code)
↓
7. Validation Loop (Test → Fix → Retry)
↓
8. Diff Patching (Minimal surgical changes)
↓
Success / Report
🛠️ Available Tools
- read_file - Read file contents
- write_file - Write or overwrite files
- list_directory - List project structure
- search_project - Text-based code search
- semantic_search - Vector-based code search
- run_tests - Execute test suites
- run_linter - Code linting
- run_typecheck - Type checking
- git_diff - Show git changes
- memory_lookup - Search past solutions
- memory_store - Store resolution patterns
🤖 Supported LLM Providers
Local (Free)
- Ollama - Run models locally
- llama2, codellama, mistral, mixtral
- No API costs, complete privacy
SaaS (API Key Required)
- OpenAI - GPT-4, GPT-3.5-turbo
- Anthropic - Claude 3 (Opus, Sonnet, Haiku)
- Google - Gemini Pro (coming soon)
Multi-Provider with Fallback
from goatcode.llm.interface import create_multi_provider_router
router = create_multi_provider_router([
{'provider': 'ollama', 'model': 'llama2'},
{'provider': 'openai', 'model': 'gpt-3.5-turbo'}
])
📊 Performance Comparison
| Feature | GOATCODE | Cursor | Copilot | ChatGPT |
|---|---|---|---|---|
| File Indexing | ✅ | ❌ | ❌ | ❌ |
| Context Injection | ✅ | ⚠️ | ❌ | ❌ |
| Test→Fix Loop | ✅ | ❌ | ❌ | ❌ |
| Diff Patching | ✅ | ❌ | ❌ | ❌ |
| Memory System | ✅ | ❌ | ❌ | ❌ |
| Token Budget | ✅ | ❌ | ❌ | ❌ |
| Local Models | ✅ | ❌ | ❌ | ❌ |
🎯 Why This Wins
vs. Cursor/Copilot
- ❌ They hide the architecture → ✅ GOATCODE shows the engineering
- ❌ Prompt-only solutions → ✅ Real tool orchestration
- ❌ No verification loop → ✅ Test→Fix→Retry cycle
- ❌ No context management → ✅ Smart context injection
- ❌ Cloud-only → ✅ Local Ollama support
vs. ChatGPT
- ❌ No project context → ✅ Full project analysis
- ❌ No file operations → ✅ Complete tool system
- ❌ No validation → ✅ Automated testing
- ❌ No memory → ✅ Pattern learning
🔒 Security Features
- ✅ No hardcoded secrets
- ✅ No unsafe eval/exec
- ✅ Input validation
- ✅ Least-privilege design
- ✅ Automatic dependency checking
🧪 Development
# Install dev dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Run linter
flake8 goatcode/
# Type checking
mypy goatcode/
📈 Roadmap
- Core agent architecture
- Multi-provider LLM support
- Tool system
- FAISS vector search
- AST-aware diff patching
- Web interface
- VSCode extension
- CI/CD integration
- Team collaboration features
🤝 Contributing
This is a production-grade reference implementation. Contributions welcome:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
📝 License
MIT License - See LICENSE file
🙏 Acknowledgments
- Inspired by the need for deterministic, verifiable AI coding
- Built on top of excellent open-source tools
- Community-driven development
Built with Python 🐍 | Powered by Determinism ⚡ | Designed for Production 🚀
Prompt is 20%. This is the 80%.
Metadata
Release files for goatcode 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| goatcode-1.1.2.tar.gz | 44.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| goatcode-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 84.5 kB
Release files / goatcode-1.1.2.tar.gz
| Download URL | goatcode-1.1.2.tar.gz |
|---|---|
| Size | 44.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
132777c1e31fca181d42188dd9924b2d9e602bc32ef05fe0ac3cb56dab6aec96
|
|
BLAKE2b-256 checksum How to use checksums |
82fe68ed5bd741ddce23d701e13ce1b1885bada4590108e582f05b2377cbda45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / goatcode-1.1.2-py3-none-any.whl
| Download URL | goatcode-1.1.2-py3-none-any.whl |
|---|---|
| Size | 40.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc512ca269a06690dbf64a2754119b86fd4666e45d4bedac56c475a8ccdced9e
|
|
BLAKE2b-256 checksum How to use checksums |
860286ac2b2bea6d5ff7480a5095f50bdf880907ba615c36e6a14f97c1d67f8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Security for goatcode 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.