Dark Gravity is a high-performance, long-term agentic system serving as the core intelligence for the CA/CD Autonomous Agent Factory. Rebuilt from the ground up in Rust, it orchestrates complex multi-agent workflows with zero-trust security and durable task execution.
🎬 Watch the 5-Minute Screencast Walkthrough (
docs/assets/screencast_dark_gravity_walkthrough.mp4) — Technical demonstration renderizada programáticamente a partir de un guión de ejecución (scripts/render_screencast.py) basado en trazas de auditoría. Demostrando outbound issue polling, Hatchet 6-phase DAG orchestration, gVisor container sandboxing (clamped up to 500m CPU / 512Mi RAM for worker compilation, ≤30MiB for micro-sandboxes), interactive PR directives (@darkgravity /status,@darkgravity /refine), y mandatory Human-in-the-Loop (HITL) merge blocking.
Watch the end-to-end autonomous mission execution, Zero-Trust verification loop, and gVisor sandbox memory clamping in action:
- 🎬 Dark Gravity V7 Autonomous Factory - Mission Walkthrough (Demostración renderizada a partir de un guión programático disponible en
docs/assets/screencast_dark_gravity_walkthrough.mp4).
Every architectural claim and runtime isolation guarantee in Dark Gravity is backed by reproducible, empirical evidence artifacts stored in the repository:
evidence/
├── 📄 verified_status.json # CI-generated test & clippy verification status
├── 📄 baseline.md # Phase 1 Live Cluster Workload & Architectural Baseline
├── 📄 reliability-tests.md # Two resilience scenarios: interrupted-mission recovery and broken-test safe shutdown
├── 📄 security-tests.md # Secret-redaction scenarios (2), code inspection, gVisor resource benchmark; not SAST/DAST or pen-testing
├── 📁 security/
│ ├── 📄 heldout_results.json # Independent held-out adversarial evaluation metrics
│ ├── 📄 corpus_results.json # Labeled diff scanner corpus evaluation metrics
│ └── 📄 threat-model.md # Dark Gravity V7.2 Threat Model & Zero-Trust Audit Matrix
├── 📁 followup/
│ └── 📄 verification_report.md # Empirical verification and audit report
├── 📁 benchmarks/
│ └── 📄 benchmark_summary.json # Double-blind evaluation protocol status (status: not_run)
└── 📁 missions/
└── 📁 mission-001/
├── 📄 checksums.txt # SHA-256 Digest Manifest for Mission Telemetry Bundles
├── 📄 report.json # Mission Execution Summary & Verification Metrics
└── 📄 timeline.md # Chronological Event Log of Mission Operations
- 📊 Cluster & Zero-Trust Baseline Verification (
evidence/baseline.md) — Detailed workload snapshot, KEDA parameters, CRD inventory, and zero-trust sign-off. - 🎯 Mission 001 Evidence Bundle (
evidence/missions/mission-001/) — Live mission execution report (report.json), event timeline (timeline.md), and SHA-256 checksums (checksums.txt). - 🛡️ Security Threat Model & Audits (
evidence/security/threat-model.md) — Comprehensive ZTA security audit, threat vectors, and mitigation matrices. - 🧪 Security Test Suite (
evidence/security-tests.md) & Reliability Test Suite (evidence/reliability-tests.md) — secret-redaction scenarios and a gVisor resource benchmark (security), and two resilience scenarios (reliability). These are not SAST/DAST, penetration tests or long-haul tests. - 🧩 Component Inventory Matrix (
evidence/architecture/component-inventory.md) — Hardware, software, and agentic module component mapping.
This project strictly adheres to LLMOps and Domain-Driven Design (DDD) standards, elevated to the production-grade Version 7 (V7) Architecture for autonomous operations.
- LLMOps Lifecycle: We follow a robust LLM application lifecycle, including automated prompt engineering, retrieval-augmented generation (RAG) evaluation, and model-in-the-loop security audits to ensure production-grade reliability and observability.
- DDD-based Structure: The codebase is architected using DDD principles to maintain a clear separation of concerns. This ensures that the core domain logic remains isolated from infrastructure details and external service adapters (like Jira or R2R), allowing the system to scale and evolve without regression.
The codebase is organized as a unified Rust workspace for maximum modularity and performance.
factory-core: Innermost domain layer. Manages domain entities (Mission,Task), aSecurityValidatortrait for agent output auditing, and unified error handling viaFactoryError.factory-application: Workflow orchestration layer. Leverages Rustant (Planner) and ZeroClaw (Executor) to process task workflows. Maintains durably checkpointed state viaStepCheckpoints using Hatchet's PostgreSQL backend.factory-mcp-server: Presentation layer. Axum-based Model Context Protocol server exposing tools over Server-Sent Events (SSE) transport with isolated gVisor execution interfaces.factory-infrastructure: Adapter layer. Concrete clients for Jira, R2R (RAG), MinIO/AWS S3, OpenZiti (Zero Trust overlay networks), and Kafka (viardkafkaclient).factory-cli: Interface entry point. Contains the Hatchet worker initializer and Kafka telemetry querying utilities.
Missions are orchestrated using a robust 6-phase DAG in Hatchet with database-backed StepCheckpoint recovery:
Ingestion → Plan (Rustant) → Code (ZeroClaw) → Validation (ZeroClaw) → Review (Rustant) → Delivery (GitOps).
To maintain absolute operational transparency, capabilities across Dark Gravity are strictly classified into four lifecycle status tiers:
- Designed: Specification, architecture contract, or policy defined in
specs/orwiki/. - Implemented: Source code written, compiled, and validated via local unit/integration tests.
- Deployed: Active workload running in target Kubernetes cluster namespaces (
orchestrators,agents,jules-remediator,ml-apps). - Verified: Production runtime behavior empirically validated via automated benchmarks, Calico/NetworkPolicy inspection, or zero-trust evidence logs.
| Component / Feature | Category | Status Tier | Source & Policy Reference | Operational Details & Evidence Link |
|---|---|---|---|---|
gVisor (runsc) Sandbox |
Infrastructure | Implemented | config/sandbox-gvisor-profile.yaml |
RuntimeClass=gvisor-sandbox configured for sandbox-exec pods. Evidence: baseline.md
|
| RAM Resource Clamping | Kernel Isolation | Implemented | crates/factory-core/src/security.rs |
Micro-sandbox workload capped at RuntimeClass fixed pod overhead = standard_test_run peaking at resource-profiling-512mi.json
|
| OpenZiti mTLS Overlay | Zero-Trust Network | Implemented | crates/factory-infrastructure/src/ziti.rs |
Sidecar configured for agent pods; memory bounded baseline.md
|
| Egress Deny-All NetworkPolicy | Security Policy | Designed | config/deny-all-egress-networkpolicy.yaml |
Egress restriction specification via Calico / Kubernetes NetworkPolicy rules. Evidence: security-tests.md
|
| Hatchet 6-Phase DAG Engine | Orchestration | Implemented | crates/factory-application/src/workflows/ |
Engine configured on port 8080/7077 with PostgreSQL checkpointing. Evidence: baseline.md
|
| LiteLLM Proxy & FinOps Headers | AI Inference | Implemented | config/litellm_proxy_config.yaml |
Configured in ml-apps NS; passes x-vtags-* virtual headers. Evidence: baseline.md
|
| CircuitBreakerGuard (Diff Hashing) | Application Logic | Implemented | crates/factory-application/src/workflows/circuit_breaker.rs |
Prevents infinite retry loops via diff normalization and A-B-A-B oscillation tracking. Evidence: reliability-tests.md
|
| Pipeline Error Classifier | Application Logic | Implemented | crates/factory-application/src/poller_service.rs |
Parses CI logs into 7 canonical error categories. Evidence: reliability-tests.md
|
| Vault JIT 5-Min Ephemeral Tokens | Security Adapter | Implemented | crates/factory-infrastructure/src/vault.rs |
Ephemeral repository tokens expire in 300s; zeroize on drop. Evidence: security-tests.md
|
| Ed25519 Verifiable Credentials | Non-Human Identity | Implemented | crates/factory-core/src/security/nhi.rs |
RFC 8785 JSON Canonicalization Scheme (JCS) and Ed25519 signatures with W3C camelCase structure. Evidence: threat-model.md
|
| FinOps 90% HardStop Cutoff | Governance Gate | Implemented | crates/factory-application/src/agents/finops.rs |
Daily spend evaluation with velocity anomaly suppression and Kafka event dispatch. Evidence: reliability-tests.md
|
| Multi-Region GPU Failover | Resiliency | Designed | wiki/architecture/infrastructure_adapters.md |
Multi-region cluster failover spec defined for high availability. Docs: wiki/architecture/
|
| Autonomous Direct Main Merges | Governance Policy | Designed |
AGENTS.md & wiki/security/hitl_governance.md
|
Prohibited by policy; strict Human-in-the-Loop (HITL) gate required. Docs: hitl_governance.md
|
Dark Gravity continuously polls and autonomously executes missions across configured repositories:
| Target Repository | Domain | Autonomous Workflow Focus |
|---|---|---|
lgcorzo/rust_CACD_autonomous_factory |
Autonomous Multi-Agent Engine | Self-evolution, DAG workflows & MCP servers |
lgcorzo/lince-rs |
Otimization process | Algorithmic optimization to control agents costs |
lgcorzo-lab/autonomous_factory |
Architecture & Knowledge Base | Spec-Kit SDD contracts, C4 diagrams, OSR audits |
lgcorzo/fastapi-autogen-team |
Agentic Access Layer | R2R/Confluent document services |
lgcorzo/mlops-python-package |
MLOps & ML Pipelines | Automated testing, DVC/Poetry dependency validation, CI/CD error remediation & HITL governance (mlops-python-package/README.md) |
- Rustant: Leverages R2rClient for semantic code search and context retrieval to inform specification design and planning.
- ZeroClaw: Compiles and executes code in secure gVisor (runsc) user-space sandboxes via a sandboxed executor driver.
- Zero Trust Mesh: Agent-to-agent communication is fully encrypted and bound to identity namespaces using OpenZiti mTLS 1.3 overlays.
- Telemetry: Reasoning logs are published to Kafka topics (
mission-input,agent-thought,mission-artifact) for real-time observability.
The Dark Gravity Autonomous CA/CD Software Factory (V7.2 / V7.3) is designed to facilitate auditing and end-to-end traceability, with alignment to frameworks such as the EU AI Act (Articles 12 & 14 human oversight), SOC 2 Type II, and ISO/IEC 25059 defined as the long-term roadmap objective (no formal certification is claimed).
(For detailed architectural specifications and design records, refer to the Dark Gravity Multi-Agent Architecture Knowledge Base).
In an autonomous software factory where AI agents autonomously synthesize, compile, and deliver production software, relying blindly on third-party commercial cloud services or unmaintained open-source dependencies poses existential operational risks:
- Mitigation of Upstream Licensing Closures: When foundational projects alter their licensing model, close public distributions, or abandon open-source governance (as occurred with MinIO), Dark Gravity prevents vendor lock-in and supply-chain disruption by maintaining semantic mirrors and sovereign forks under
@lgcorzo. - Autonomous Security Verification & Dependency Auditing: Third-party libraries are not trusted implicitly. Dark Gravity continuously scans, audits, and patches its sovereign dependency tree independently via automated
cargo auditand container vulnerability scanning rather than awaiting upstream commercial release cycles. - Air-Gapped Operational Continuity: The factory operates on private, sovereign Kubernetes infrastructure. Proprietary source code, AST surgical mutations, and causal corporate memory remain strictly within sovereign boundaries.
-
Zero Public Ingress Ports (Air-Gapped Outbound Polling): Dark Gravity does not expose public HTTP webhooks or third-party ingress tunnels. The native Rust
GitPlatformPollerdaemon (factory-cli poller) executes outbound polling loops every 30–60 seconds across GitHub and GitLab APIs. -
Non-Human Identity (NHI) & Cryptographic Proof-of-Lineage: Every agent action, commit, and Kafka event is cryptographically signed using JWS EdDSA over RFC 8785 JCS in
crates/factory-core/src/security/nhi.rsviaed25519-dalekv2. -
Ephemeral JIT Credentials & Forensic RAM Sanitization: Repository tokens are provisioned Just-In-Time by HashiCorp Vault with an unrenewable 5-minute (300s) TTL. All in-memory secrets implement
#[derive(Zeroize, ZeroizeOnDrop)], wiping memory with null bytes upon task completion (benchmarked viacargo bench --bench zeroize_benchmark). -
Kernel-Level Sandboxing (gVisor
runsc): Code synthesis and surgical edits run in ephemeral containers strictly clamped to$\text{RAM} \le 30\text{ MiB}$ and$\text{CPU} \le 250\text{m}$ for micro-sandboxes, and up to$512\text{ MiB}$ RAM /$500\text{m}$ CPU for worker compilation workloads. -
Hardware-Accelerated SIMD Primitives: Sovereign Go/Rust cryptographic and parsing libraries (
sha256-simd,simdjson-go,highwayhash,md5-simd,blake2b-simd) leverage AVX-512 and ARM64 vectorization, enabling high-throughput execution without exceeding hard memory ceilings. -
Sovereign S3 Storage Tier & Isolated Buckets: Artifacts are persisted in decoupled S3 storage (
factory-artifacts,factory-artifacts/compliance/,dg-factory-checkpoints,semantica-provenance,r2r-documents,mlflow) protected by strict whitelist validation against path traversal.
Dark Gravity includes native outbound polling daemons and event handlers that listen for issues, work items, and pull/merge request discussions across configured GitHub and GitLab repositories.
To trigger an autonomous mission, create an issue or work item in any integrated repository (such as lgcorzo/rust_CACD_autonomous_factory or lgcorzo/lince-rs):
- Authorized Authors: Only repository collaborators and maintainers with triage/write permissions are permitted to trigger missions. External submissions require explicit human labeling.
- Required Labels (at least one):
autonomous-missiondark-gravity
- Resource Limits Definition:
Include an explicit resource limit block within the issue description. The poller automatically parses these constraints using regex:
Resource limits: CPU: 500m, RAM: 512Mi, Timeout: 300s
- Autonomous Ingestion & Zero-Trust Identity:
- The poller extracts title, description, labels, and resource limits.
- Generates a cryptographic Ed25519-signed Verifiable Credential (VC) for Non-Human Identity (NHI) under
did:factory:dark-gravity-euskadi. - Publishes the mission specification to Kafka topic
mission-input. - Records the event in the
CursorStoreto ensure idempotent, single-execution processing across polling intervals.
Dark Gravity actively listens to comments on active GitHub Pull Requests (PRs) and GitLab Merge Requests (MRs). When a developer or architect tags the bot with a directive:
@darkgravity /<command> [optional prompt/instruction]
(Also accepts @dark-gravity)
| Directive | Description | Agent Action |
|---|---|---|
@darkgravity /status |
Queries real-time factory health and DAG state. | Generates a markdown system report with repository, PR target, DAG health, sandbox status, and FinOps budget state. |
@darkgravity /interact <prompt> |
Natural-language query or technical instruction. | Triggers Rustant (PO) to analyze the query with contextual knowledge and reply directly in the thread. |
@darkgravity /spec <prompt> |
Requests a specification review or modification. | Triggers Rustant (PO) to re-evaluate spec.md against provided requirements and stage revisions. |
@darkgravity /refine <instruction> |
Requests localized code edits or targeted bugfixes. | Triggers ZeroClaw (Dev) to apply surgical code mutations in the gVisor sandbox (≤30MiB RAM). |
@darkgravity /validate |
Requests full test and security verification. | Executes automated test suites and SAST security gates within the sandbox, reporting CVE and pass/fail status. |
@darkgravity /retry |
Forces a restart of the execution loop. | Restarts the Aethelgard verification loop and re-runs failed test suites. |
Security & Governance Note on Directives:
- Authorized Operators: Only repository collaborators and maintainers with write permissions may issue
@darkgravitydirectives.- Input Isolation: All user comments, issue descriptions, and CI error logs are treated as untrusted data and parsed strictly into structured event models.
- Self-Targeting Guard: When operating on
rust_CACD_autonomous_factoryitself, Dark Gravity is restricted from modifying.github/workflows/,CODEOWNERS,AGENTS.md, or security enforcement crates without explicit human sign-off.- Strict HITL Gate: Even with interactive directives, Dark Gravity cannot merge pull requests. All merges into
mainrequire manual human review and execution.
- Instant Acknowledgement: Upon receiving any valid directive, Dark Gravity immediately awards an
👀(eyes) emoji reaction to the user's note/comment to signal receipt before processing begins. - Contextual Thread Replies: Once execution finishes, Dark Gravity replies directly to the originating discussion thread with structured markdown reports.
- Bot Loop Suppression: Any notes authored by
DARK_GRAVITY_BOT_USERNAME(defaultdarkgravity-bot) are automatically ignored to prevent recursive comment loops.
Operators can verify GitLab/GitHub connectivity, token scopes, and project accessibility using the native CLI:
# Verify live GitLab communication and project permissions
cargo run --bin factory-cli -- gitlab-verify \
--gitlab-token "$GITLAB_API_TOKEN" \
--gitlab-projects "lgcorzo/lince-rs,lgcorzo/fastapi-autogen-team"
# Output machine-readable JSON scorecard
cargo run --bin factory-cli -- gitlab-verify --json- Autonomous agents create isolated feature branches, commit code, and open Pull Requests (GitHub) or Merge Requests (GitLab).
- Strict Manual Merge Requirement: Dark Gravity never automatically merges PRs or MRs into
mainor default production branches. - Once all automated CI/CD and CodeQL checks pass, the agent hands off the PR/MR link to the human developer for final manual review and merge.
Dark Gravity continuously monitors CI/CD pipelines across GitHub and GitLab repositories to autonomously triage, remediate, or escalate errors:
- Detection: The outbound poller queries GitHub Actions (
GET /repos/{repo}/actions/runs?status=failure) and GitLab CI (GET /projects/{id}/pipelines?status=failed), extracting run IDs, failing jobs/steps, and error logs (truncated safely to 10KB). - Classification: Errors are parsed using an ordered regex classification engine into 7 canonical categories:
LintViolation:cargo clippy,eslint, formatting warnings/errors.CodeCompilation: Rust compiler errors (error[E0308]), syntax or type errors.TestFailure: Unit, integration, or E2E assertion failures.InfrastructureBuild: Dockerfile build failures, apt-get, package installation failures.InfrastructureTransient: Network timeouts, rate limits, transient connection drops.SecurityAudit: Cargo audit / RUSTSEC advisory failures.Unknown: Unrecognized error patterns (always escalated to human review).
- Autonomous Mission Triggering: Remediable failures construct a remediation mission payload signed with Ed25519 Non-Human Identity (NHI) credentials and publish to the
mission-inputKafka topic. - Safety Guards & Governance:
- Self-Referential Safety Guard: Any failure originating from
lgcorzo/rust_CACD_autonomous_factoryis immediately escalated to a human engineer via a GitHub issue, strictly preventing recursion loops. - Concurrency Control: Remediations are throttled by
MAX_CONCURRENT_REMEDIATIONS(default: 3) via an async semaphore. - Recurring Failure Escalation: Error fingerprints (SHA-256 hash of category + file + rule/test) are tracked in
CursorStore. If the same error fingerprint recurs 3 times consecutively, it automatically escalates to human review. - Full Observability: Error classifications and remediation outcomes are emitted to Kafka topics
agent-thoughtandmission-artifact.
- Self-Referential Safety Guard: Any failure originating from
- Rust Toolchain (Stable 1.85+ / Edition 2024 compatible)
- Hatchet Server
- MCP Connection
-
Clone the repository:
git clone https://github.com/lgcorzo/rust_CACD_autonomous_factory cd rust_CACD_autonomous_factory -
Build the workspace:
cargo build --release
Ensure your .env file contains the live Kafka broker endpoint:
KAFKA_BROKERS=my-kafka-cluster-bootstrap.confluent.svc.cluster.local:9092Start the unified worker to begin processing autonomous missions:
# Provide your MCP gateway URL
cargo run -p factory-cli -- worker --mcp-url http://localhost:8100Graphify turns the repository into a navigable knowledge graph, enabling AI agents and developers to quickly understand the project architecture and file relationships. Code-Review-Graph works alongside Graphify to provide incremental, graph-based code reviews and semantic search capabilities.
Install the CLIs and register them as skills with your autonomous agent (e.g., Antigravity):
# Install tools
uv tool install graphifyy
uv tool install code-review-graph
# Register with Antigravity
graphify install
code-review-graph install -y --platform antigravityFor secure embeddings and semantic extraction, both tools route through OpenZiti to reach internal LiteLLM endpoints. Ensure your .env file is configured correctly:
# Graphify / Code Review Embeddings Config (LiteLLM / OpenAI Gateway)
OPENAI_BASE_URL=https://<your-litellm-or-openai-gateway>/v1
OPENAI_API_KEY=<insert-your-actual-api-key>
OPENAI_MODEL=internal-gpt4_v0.1
# Fallback for graphify extraction if not using LiteLLM:
# GEMINI_API_KEY=<insert-your-gemini-api-key>
# GOOGLE_API_KEY=<insert-your-google-api-key>
CRG_OPENAI_BASE_URL=https://<your-litellm-or-openai-gateway>/v1
CRG_OPENAI_API_KEY=<insert-your-actual-api-key>
CRG_OPENAI_MODEL=lite_embeddingKeep the graphs up-to-date and leverage semantic search during development:
- Update Graphify: Run after major code changes to rebuild the knowledge graph (AST extraction is fast and free).
graphify update . - Query the Knowledge Graph: Explore architecture or concepts.
graphify query "What does this project do?" - Update Code Review Graph: Incrementally index file changes.
code-review-graph update
- Enable Semantic Search: Download embedding models and index new nodes for search.
code-review-graph embed
- Code Review & Impact Analysis: Use semantic features to detect changes and their blast radius.
code-review-graph detect-changes
We enforce high source quality through automated CI pipelines.
- Check Style:
cargo fmt --all -- --check - Static Analysis:
cargo clippy --workspace -- -D warnings - Run Tests:
cargo test --workspace
The following automated checks are active in this repository to maintain high engineering standards:
- Linting: Enforces strict
rustfmtandclippy(warnings-as-errors) across the entire workspace. - Testing: Executes all unit and integration tests (excluding heavy smoke tests).
- Protoc Build: Automated Protocol Buffers compilation verification for all service definitions.
- Docker Build: Validates that a production-ready image can be built and pushed to Docker Hub upon merge to
main.
- Maintains bi-directional synchronization between the repo's
wiki/folder and the GitHub Project Wiki. - Ensures documentation remains consistent and discoverable.
- Production images are published under
lgcorzo/dark-gravity-factory. - Every release candidate is tagged with the specific
git SHAfor full auditability and rollback capability.
- Edition 2024 Readiness: The project uses modern Rust editions for safety and performance.
- Dependency Guard: Automated monitoring of critical libraries (Hatchet, OpenZiti, the AWS SDK).
For a deep-dive into the factory's mechanics, follow the documentation roadmap:
- Strategic Design — Bounded contexts, Onion Architecture layers, and Zero Trust ZTA patterns.
- Execution Flows & Lifecycle — Hatchet 6-phase DAG logic, step checkpointing, and real-time Kafka telemetry.
- Verification Triad — Strict testing strategy (logic, architecture, and security) with sandboxed execution.
- Infrastructure Adapters — Production connectors for Jira, R2R Graph RAG, and live rdkafka Kafka adapters.
- Production Operations — Operational scaling, Kubernetes, KEDA, OpenZiti overlays, and secure memory management.
Access the full Documentation Index for business context and mission history.
Dark Gravity - Engineering the Future of Autonomous Systems.