Production-grade deterministic coding agent with real architecture
Project description
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%.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file goatcode-1.1.0.tar.gz.
File metadata
- Download URL: goatcode-1.1.0.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56db7163d394beced121bf6b943b31c2c40af2e452e1f2cc5bd04eca77c04dd8
|
|
| MD5 |
0dfa4dd93c54595d0120f347bdc5af25
|
|
| BLAKE2b-256 |
38ed7daf9776a79ed9779679b1c9f4ada19f5ef33cc79cbcee126e2bdd76e97c
|
File details
Details for the file goatcode-1.1.0-py3-none-any.whl.
File metadata
- Download URL: goatcode-1.1.0-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd851b91f08f7dc0181938612216c5cf2e66d64f9e44495977f473fc3672e570
|
|
| MD5 |
776871c256aee9215e73d25556349fff
|
|
| BLAKE2b-256 |
fb6c52b8fef01f0a177d7ca00550cee6fcc31252a767ac90a0f993199de7c42e
|