Skip to main content

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:

  1. ๐Ÿ” File Indexing Engine - AST-based semantic code search with vector embeddings
  2. ๐Ÿง  Context Injection - Automatic relevance-based retrieval with token budget management
  3. ๐Ÿ”„ Testโ†’Fixโ†’Retry Loop - Iterative validation with automatic error recovery
  4. ๐Ÿ“Š Diff-Based Patching - AST-aware minimal surgical edits (no full rewrites)
  5. ๐Ÿ’ฐ Token Budget Manager - Dynamic context window optimization
  6. ๐Ÿ—„๏ธ 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:

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goatcode-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goatcode-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file goatcode-1.0.0.tar.gz.

File metadata

  • Download URL: goatcode-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for goatcode-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8da782d5992d6f999b0624970166daec92cf0dc54ae5e0d00a412e9dfd6b989a
MD5 a46132b9feaa0896ce274ae2eb038986
BLAKE2b-256 40e17c2abaae3d42066f599ed475717a3baf0428f8c5fca307d2a970cfffc29e

See more details on using hashes here.

File details

Details for the file goatcode-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: goatcode-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for goatcode-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f7552eb32b249b81a076cedd3077539ed365e6f4ab76636e434592d9c4b0592
MD5 f16f24df09211d953a93001b2db5cdfe
BLAKE2b-256 0546f2df8eaa0fa945927bea4d0c5be010db75a0c6e3da4525ec3d3af32766db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page