An assembly-like agentic programming language that integrates traditional assembly concepts with modern AI capabilities through local LLM integration via Ollama.
- Phase 1: Core Infrastructure β COMPLETED
- Phase 2: LLM Integration β COMPLETED
- Phase 3: CLI/UX Development π§ IN PROGRESS
- Phase 4: Advanced Features π PLANNED
Latest Updates (2025-06-20):
- β Fixed test lockup issues in RuntimeAdapter tests
- β Resolved linting and formatting issues
- β Enhanced development workflow with reliable test suite
- β Improved async event loop handling with proper timeouts
- Assembly-like syntax with modern programming constructs
- Local LLM integration via Ollama for AI-powered operations
- Self-evolving code through error-driven evolution engine
- Comprehensive instruction set including arithmetic, control flow, and I/O
- Advanced opcodes: LLMGEN for code generation, EVOLVE for self-improvement
- Built with Python 3.13 (free-threading/no-GIL and JIT compiler support)
- Production-ready async architecture with thread-safe LLM operations
- Comprehensive testing with property-based testing via Hypothesis
- High-performance tooling (Ruff 30x faster than Black, Pyright 3-5x faster than mypy, uv 10-100x faster than pip)
- Python 3.13+ (with free-threading/no-GIL and JIT support)
- Ollama (for local LLM integration)
- uv (recommended) or pip for package management
# Clone the repository
git clone https://github.com/tinymachines/sovereign.git
cd sovereign
# Create and activate virtual environment with Python 3.13
uv venv .venv --python 3.13
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install development dependencies
uv pip install -e ".[dev]"
# Start Ollama service (in another terminal)
ollama serve
# Pull a model for LLM features
ollama pull codellama:7b; examples/simple.sov
PUSH #10
PUSH #32
ADD
DUP
HALT; Generate code using AI
LLMGEN "Create a bubble sort implementation"
STORE "bubble_sort_code"
HALT; Fix buggy code automatically
PUSH "PUSH #10\nPUSH #0\nDIV" ; Division by zero
EVOLVE "Division by zero error"
STORE "fixed_code"
HALT# Automated setup script
./scripts/dev-setup.sh
# Manual setup alternative
source .venv/bin/activate
uv pip install -e ".[dev]"# Run all tests with convenience script
./scripts/run-tests.sh
# Run all tests with nox
nox -s tests
# Run specific test file
pytest tests/unit/test_config.py
# Run with coverage
nox -s coverage# Run all examples
./scripts/run-examples.sh
# Run specific example
./scripts/run-examples.sh hello
sovereign run examples/hello.sov# Format code
ruff format src/ tests/
# Lint code
ruff check src/ tests/
# Type checking
pyright src/# Serve documentation locally
mkdocs serveproject-sovereign/
βββ src/project_sovereign/
β βββ core/ # Language implementation
β β βββ lexer.py # Tokenization
β β βββ parser.py # Lark-based parser
β β βββ ast_.py # Abstract syntax tree
β β βββ interpreter.py # Stack-based VM
β β βββ instructions.py # Opcode implementations
β βββ compiler/ # Compilation components
β β βββ codegen.py # Code generation
β β βββ optimizer.py # AST optimization
β βββ agents/ # AI/LLM integration
β β βββ ollama_client.py # Async Ollama client
β β βββ model_manager.py # Model selection
β β βββ evolution.py # Self-improvement engine
β β βββ runtime_adapter.py # Sync-async bridge
β βββ cli/ # Command-line interface
βββ tests/ # Comprehensive test suite
βββ docs/ # Documentation
βββ examples/ # Example programs
- Parser: Lark parser generator for balance of power and performance
- LLM Backend: Ollama for local, private AI capabilities
- Async Architecture: aiohttp with thread-safe sync-async bridge
- Testing: pytest + Hypothesis for property-based testing
- Type Safety: Full Python 3.13 type annotations with Pyright
- Code Quality: Ruff for ultra-fast linting and formatting
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β VM Opcodes β β Runtime Adapter β β Ollama Client β
β (LLMGEN/EVOLVE)βββββΆβ (Sync-Async) βββββΆβ (Async HTTP) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Error Pattern Recognition: ML-inspired pattern matching
- Sandboxed Execution: Safe testing with resource limits
- Learning System: Tracks fix success rates over time
- Model Selection: Chooses optimal model for each task
Test lockups or hanging: Fixed as of 2025-06-20. If you encounter test timeouts:
# Should complete quickly now
pytest tests/unit/test_llm_integration.py::TestRuntimeAdapter::test_initialize -vEnvironment variable configuration: Tests now respect OLLAMA_MODEL environment variable:
export OLLAMA_MODEL=codellama:7b # or your preferred model
pytest tests/Import/formatting issues: Use the development scripts:
./scripts/quality-check.sh # Runs formatting, linting, and type checkingKnown issues and their resolutions are documented in docs/bugs/.
- Phase 1 Status - Core infrastructure
- Phase 2 Status - LLM integration
- Development Plans - Detailed phase documentation
- Language Reference - Syntax and opcodes
- Bug Reports - Known issues and fixes
We welcome contributions! Please see our contributing guidelines and check the development documentation.
MIT License - see LICENSE file for details.
- Powered by Ollama for local LLM capabilities
- Built with modern Python tooling ecosystem
- Inspired by assembly languages and AI-driven development