Skip to content

swcstudio/aicompanion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

""" Autonogrammer AI Companion System

Full-stack autonomous programming with RPQE architecture.

License: AGPL-3.0 Python 3.11+ Rust 1.70+ Elixir 1.15+

Overview

Autonogrammer is a production-ready AI companion system for autonomous software development, leveraging Recursively Photonic Quantum Engineering (RPQE) principles to achieve quantum-inspired performance on classical infrastructure.

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                  Autonogrammer Full Stack                │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐           │
│  │  Rust    │  │ Python   │  │ Elixir   │           │
│  │  Core    │  │ DSpy     │  │ Phoenix  │           │
│  └──────────┘  └──────────┘  └──────────┘           │
│       │             │              │                      │
│       └─────────────┼──────────────┘                      │
│                     │                                     │
│              ┌─────▼──────┐                             │
│              │ Nomad       │                             │
│              │ Scheduler   │                             │
│              └─────────────┘                             │
│                     │                                     │
│              ┌─────▼──────┐                             │
│              │ HashiCorp   │                             │
│              │ Services    │                             │
│              └─────────────┘                             │
└─────────────────────────────────────────────────────────────────┘

Features

  • RPQE Architecture: Photonic Coherence, Superposition, Entanglement, Neural Feedback, Gate Recursion
  • Multi-Agent Orchestration: CodeGenerator, TestEngineer, ReviewAgent, DebugAgent
  • AutoQC Compliance: 10 best practices enforced automatically
  • Full-Stack: Rust backend, Python agents, Elixir orchestration
  • Enterprise-Ready: Multi-planetary compliance, security, observability

Quick Start

Prerequisites

  • Docker & Docker Compose
  • Python 3.11+
  • Rust 1.70+
  • Elixir 1.15+
  • Nomad/Consul/Vault (optional)

Docker Deployment

# Clone repository
git clone https://github.com/swcstudio/aicompanion.git
cd aicompanion

# Start all services
docker-compose up -d

# Check services status
docker-compose ps

# View logs
docker-compose logs -f phoenix-app

Development Setup

# Python agents
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Rust backend
cd rust_backend_core
cargo build --release

# Elixir/Phoenix
cd phoenix_app
mix deps.get
mix phx.server

Deep Specifications

Spec Description
AUTONOGRAMMER_BLUEPRINT.md Complete system blueprint
CODE_QUALITY_BEST_PRACTICES.md AutoQC framework
RUST_BACKEND_CORE.md Rust backend details
PYTHON_DSPY_UVX.md Python/DSpy agents
PHOENIX_ORCHESTRATION.md Phoenix orchestration
HASHICORP_NOMAD_CLUSTER.md HashiCorp integration

AutoQC Standards

The system enforces 10 programming best practices:

  1. Descriptive Naming Convention
  2. Magic Number Elimination
  3. Boundary Input Validation
  4. Intent-Based Documentation
  5. Graceful Edge Case Handling
  6. Dead Code Elimination
  7. Early Return Pattern
  8. Function Decomposition
  9. Conventional Commit Messages
  10. Critical Path Testing

See CODE_QUALITY_BEST_PRACTICES.md for details.

Algebraic Pythagorean Framework

The system uses advanced mathematical algorithms for optimal test generation based on rigorous algebraic foundations.

Mathematical Foundations

The framework implements 7 mathematical domains:

  1. Number Theory

    • Perfect square detection: is_perfect_square(n)
    • Greatest Common Divisor (GCD): Euclidean algorithm
    • Least Common Multiple (LCM): a * b / gcd(a, b)
    • Fibonacci sequence generation: Dynamic test allocation
    • Fibonacci membership check: 5*n² ± 4 perfect square test
    • Coprimality testing: Independent test set generation
  2. Euclidean Geometry

    • 2D distance: √((x2-x1)² + (y2-y1)²)
    • N-dimensional distance: Multi-dimensional vector space analysis
    • Dot products: Vector similarity and alignment
    • Vector magnitudes: Test suite complexity measurement
    • Cosine similarity: Test coverage independence
  3. Trigonometry

    • Law of Cosines: cos(θ) = (a² + b² - c²) / 2ab
    • Entanglement angles: Component coupling analysis
    • Orthogonality checks: Test independence via Law of Sines
    • Heron's formula: Coverage area calculation √(s(s-a)(s-b)(s-c))
    • Test completeness: Trigonometric phase analysis
  4. Linear Algebra

    • Gram-Schmidt orthogonalization: Independent test space generation
    • Vector projections: Subspace-based test planning
    • Hyperrectangle volumes: Multi-dimensional test coverage measurement
  5. Complex Analysis

    • Euler's identity verification: e^(iπ) + 1 = 0
    • Complex phase cycles: Test execution frequency analysis
    • Harmonic convergence: Fibonacci sequence properties
  6. Harmonic Analysis

    • Harmonic means: Test count optimization
    • Convergence analysis: Mathematical stability verification
  7. Optimization Theory

    • Primitive Pythagorean triples: Euclid's formula a = m²-n², b = 2mn
    • Geometric minimization: Optimal test count calculation

API Endpoints

/api/v1/math/perfect_triples?count=N

Returns primitive Pythagorean triples using Euclid's formula.

curl "http://localhost:4000/api/v1/math/perfect_triples?count=5"

Response:

{
  "count": 5,
  "triples": [
    {"a": 3, "b": 4, "c": 5, "perfect": true},
    {"a": 5, "b": 12, "c": 13, "perfect": true},
    {"a": 8, "b": 15, "c": 17, "perfect": true}
  ],
  "algorithm": "euclid_formula",
  "description": "Primitive Pythagorean triples where a² + b² = c²"
}

/api/v1/math/fibonacci_sequence?count=N

Returns Fibonacci sequence for natural test allocation.

curl "http://localhost:4000/api/v1/math/fibonacci_sequence?count=10"

Response:

{
  "count": 10,
  "sequence": [1, 1, 2, 3, 5, 8, 13, 21, 34, 55],
  "algorithm": "fibonacci",
  "harmonic_mean": 0.85,
  "description": "Fibonacci-based test allocation strategy"
}

/api/v1/math/euclidean_distance

Calculate n-dimensional Euclidean distance between test vectors.

curl -X POST "http://localhost:4000/api/v1/math/euclidean_distance" \
  -H "Content-Type: application/json" \
  -d '{"vector_a": [1.0, 2.0, 3.0], "vector_b": [4.0, 5.0, 6.0]}'

Response:

{
  "distance": 5.196,
  "dimensions": 3,
  "algorithm": "euclidean_nd",
  "vector_a": [1.0, 2.0, 3.0],
  "vector_b": [4.0, 5.0, 6.0]
}

/api/v1/math/orthogonality_check

Check test coverage independence using Law of Sines.

curl "http://localhost:4000/api/v1/math/orthogonality_check?unit_ratio=0.6&integration_ratio=0.3&e2e_ratio=0.1"

Response:

{
  "orthogonality_score": 0.15,
  "unit_ratio": 0.6,
  "integration_ratio": 0.3,
  "e2e_ratio": 0.1,
  "algorithm": "law_of_sines",
  "interpretation": "Test coverage is highly orthogonal (independent)"
}

/api/v1/math/entanglement_angle

Calculate coupling angle between components using Law of Cosines.

curl "http://localhost:4000/api/v1/math/entanglement_angle?dep_a=5.0&dep_b=3.0&coupling=0.9"

Response:

{
  "angle": 1.231,
  "cosine": 0.9,
  "algorithm": "law_of_cosines",
  "interpretation": "Moderate coupling (some entanglement)"
}

/api/v1/math/coverage_area

Calculate coverage area using Heron's formula.

curl "http://localhost:4000/api/v1/math/coverage_area?current=3&expected=5&additional=5"

Response:

{
  "area": 7.0,
  "semi_perimeter": 4.33,
  "algorithm": "herons_formula",
  "current_tests": 3,
  "expected_tests": 5,
  "additional_tests": 5
}

Algebraic Annotations

Generated test code includes mathematical comments that explain the derivation:

# Auto-generated test for example.py
#
# Test count: 13
# #alg:triple (3,4,5) = Perfect Pythagorean triple
# #alg:fibonacci 13 = Optimal test count
#
import pytest
from example import *

def test_example(code_sample: str):
    """Test generated code with algebraic derivation"""
    # Test implementation
    result = calculate_result(code_sample)
    assert result is not None, "Implementation should pass"

def calculate_result(code_sample: str) -> Optional[str]:
    """Calculate expected result with algebraic comments"""
    # Parse test to extract algebraic formula
    # Return expected result based on mathematical derivation
    #alg:fornameofpythagora c = √(a² + b²) = √(9² + 12²) = 15 tests
    pass

Annotation Formats:

  • #alg:fornameofpythagora c = √(a² + b²) - Basic Pythagorean formula
  • #alg:triple (a,b,c) - When perfect Pythagorean triple detected
  • #alg:fibonacci N - Fibonacci number used for test count
  • #alg:entanglement θ = X.XXX rad - Component coupling angle
  • #alg:orthogonal sin(φ) = X.XXX - Orthogonality metric
  • #alg:euclicean_distance d = X.XXX - N-dimensional distance calculation

Contributing

This project is licensed under AGPL-3.0. All contributions must be compatible with this license.

License

Copyright (C) 2006-2024 SWCStudio

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0)

SPDX-License-Identifier: AGPL-3.0

Citation

If you use Autonogrammer in your research, please cite:

@software{autonogrammer2024,
  author       = {{SWCStudio Development Team}},
  title        = {{Autonogrammer: AI Companion Systems with RPQE Architecture}},
  year         = {2024},
  version      = {2.1.0},
  url          = {https://github.com/swcstudio/aicompanion},
  license      = {AGPL-3.0}
}

Contact

Acknowledgments

  • DSpy framework team
  • HashiCorp for Nomad/Consul/Vault
  • The Rust, Python, and Elixir communities
  • All contributors to open-source quantum-inspired computing research

About

This is one of our blueprints for programming different characters using the aicompanion specification

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published