Skip to content

Sovereign Dark Factory (local-dark-factory)

License: MIT Zero Cloud Tokens Hardware CI PyPI

A 100% sovereign, local-first autonomous AI Software Factory orchestrator designed to coordinate local coding agents in fast, disposable git worktrees, enforce authoritative deterministic verification gates, auto-repair syntax and test failures, preserve tamper-evident patches, and provide human-in-the-loop review.

"Make sure you own your AI. AI in the cloud is not aligned with you; it’s aligned with the company that owns it."


🌟 Core Pillars

flowchart TD
    A[Task Specification] --> B[Durable SQLite Engine]
    B --> C[Git Worktree Sandbox]
    C --> D[Local Inference Harness: Ollama / Prism CUDA]
    D --> E[Deterministic Verification Gates]
    E -- Failed --> F[AST Self-Healing Loop max N retries]
    F --> D
    E -- Passed --> G[Evidence Locker SHA256 Diff & Telemetry]
    G --> H[Human-in-the-Loop Review Gate]
    H -- Approve --> I[Target Branch Commit]
    H -- Reject --> J[Archived with Operator Notes]
  • :octicons-shield-lock-24: Zero Cloud Tokens Operates 100% locally on workstation hardware (NVIDIA RTX / Apple Silicon). Never makes external cloud API calls ($0.00 token cost).

  • :octicons-cpu-24: Disposable Sandboxes Eliminates heavyweight overhead by utilizing native git worktree isolation with directory sanitization and strict path-traversal prevention (repository-level isolation; process sandboxing is tracked in plan.md Β§10.5).

  • :octicons-check-circle-24: Authoritative Verification Gates Verification is deterministic (compiler, linters, test suites). The LLM cannot vote on whether its own code works.

  • :octicons-lock-24: Gate Anti-Tamper Protection Automatic baseline restoration prevents the model from weakening assertions, commenting out tests, or modifying test runners to fake a pass.

  • :octicons-database-24: Durable SQLite Journaling State transitions, audit logs, and human operator notes survive system crashes and reboots. Complete transactional state recovery.

  • :octicons-sync-24: AST Self-Healing Loop Feeds compiler diagnostics and test assertion failures back to the local model up to configurable retry limits with cumulative telemetry.


⚑ Quick Start

# Install local-dark-factory
pip install local-dark-factory

# Check local engines and GPU health
dark-factory doctor

# Run an autonomous task against a repository
dark-factory run \
  --repo /path/to/project \
  --task "Fix bug in calculation algorithm and ensure all pytest cases pass"

πŸ“– AI-Native SDLC Architecture

This project is built from the ground up according to Anthropic's AI-Native SDLC Playbook:

Specification Artifact Role in Factory
Intent (intent.md) Business rationale, sovereignty mandate, and hardware constraints.
Technical Spec (spec.md) Data contracts, architecture choices, and activity contracts.
Operating Manual (CLAUDE.md) Coding standards, safety rules, and test guidelines.
Agent Guidelines (AGENTS.md) Local inference skills routing and zero-cloud-token rule.
Governance Policy (REVIEW.md) Operator approval criteria and diff inspection.