# Wake — Self-Hosted GitLab CI Optimizer & Dynamic Pipeline Planner

> Cut self-hosted GitLab CI monorepo pipelines by 7x with deterministic Python, Node/TypeScript, Rust, Go, and Nix dynamic child pipelines plus a zero-egress sandboxed CI agent on your own runners and internal LiteLLM. Built by [Strange Metal, Inc.](https://strangemetal.org).

- Website: https://wakeci.dev/
- Full reference: https://wakeci.dev/llms-full.txt
- Contact & 15-minute X-Ray audit: chris@wakeci.dev

## Why Wake Exists

Coding agents (Claude Code, Cursor, Devin, Codex) multiply pull request and merge request volume by 5-10x, turning 20-40 minute static GitLab CI pipelines into the primary bottleneck in software engineering. Cloud GitHub Actions runners cannot legally touch defense, robotics, aerospace, automotive, or regulated enterprise repositories.

Wake ships as a single self-hosted Docker container (`ghcr.io/strange-metal/wake:latest`) that runs 100% inside your existing GitLab Runner network and connects only to your internal LLM gateway (LiteLLM, vLLM, or private Anthropic Claude endpoint). Zero source code, logs, or telemetry leave your VPC.

## Architecture & CLI Commands

### 1. `wake xray` — Zero-Instrumentation GitLab Pipeline Profiler
Parses GitLab Runner trace section timestamps (`prepare_executor`, `get_sources`, `restore_cache`, `step_script`, `save_cache`), JUnit XML test timings, downstream child-pipeline bridges, `!reference` YAML tags, and Nix build logs. Solves the true critical path, detects late linters, missing DAG dependencies, weak cache keys, and low Nix binary-cache hit rates (`WAKE-010`), and exports a single self-contained, air-gap-safe HTML flamegraph.

```bash
docker run --rm -v "$PWD:/out" -e GITLAB_TOKEN \
  ghcr.io/strange-metal/wake:latest \
  wake xray --gitlab-url https://git.your-vpc.internal \
  --project group/monorepo --html /out/xray.html
```

### 2. `wake plan` — Deterministic Dynamic Child Pipelines
Scans Python (`pyproject.toml`), TypeScript/Node (`package.json`), Rust (`Cargo.toml`), Go (`go.mod`), and Nix (`flake.nix`, `callPackage`, `path:` inputs) dependency graphs. Generates a native GitLab `trigger:include:artifact` child pipeline per push: linters promote to parallel stage 0, unaffected backend/Nix jobs are skipped deterministically, and a single non-spammy MR comment records what ran. Full suites stay mandatory on default branches, release tags, and root lockfile edits.

```bash
wake plan \
  --ci-file .wake-pipeline.yml \
  --post-comment \
  --out wake-generated-ci.yml
```

### 3. `wake agent` — Sandboxed Autonomous CI Engineer
Runs a multi-turn tool-calling loop against your internal LiteLLM gateway or direct Claude API inside an isolated git sandbox copy of the repo. Measures a real baseline, fixes slow test fixtures or cache bugs, re-runs the verification suite, enforces a hard mechanical anti-cheating soundness gate (zero deleted or skipped tests, zero passed-test-count drops), and opens a merge request with verified proof.

```bash
wake agent \
  --llm-base-url http://litellm.internal/v1 \
  --verify-cmd "pytest packages/api/tests" \
  --open-mr
```

## Measured Benchmarks (Self-Hosted GitLab CE, `concurrent = 4`)

| Run | Jobs Run | Wall-Clock | Runner Compute | Measured Outcome |
|---|---:|---:|---:|---|
| Baseline cold pipeline (static YAML) | 9 / 9 | 2m 59s | 4m 32s | Failed at minute 2:49 on code formatting |
| Baseline warm cache (static YAML) | 9 / 9 | 1m 23s | 2m 40s | Every UI change rebuilt backend and Nix jobs |
| Wake fast-fail stage promotion | 1 / 9 | 21s | 21s | **4.0x faster failure feedback** |
| Wake dynamic child pipeline (UI MR) | 3 / 9 | 30s | 38.3s | **7.1x less compute, 6 jobs skipped** |
| Wake autonomous agent (8 turns, MR !3) | 6 / 6 tests | 19.66s → 0.15s | Isolated sandbox | **127.7x faster test suite** |

## Live Demo Artifacts & Engineering Guides

- [Live Monorepo X-Ray Flamegraph](https://wakeci.dev/demo/xray-baseline.html)
- [Wild Validation: gitlab-org/cli X-Ray](https://wakeci.dev/demo/xray-gitlab-cli.html)
- [Guide: Deterministic GitLab Dynamic Child Pipelines for Polyglot Monorepos](https://wakeci.dev/guides/gitlab-dynamic-child-pipelines.md)
- [Guide: Optimizing Nix Flakes & Binary Caches on Self-Hosted GitLab Runners](https://wakeci.dev/guides/nix-gitlab-ci-optimization.md)

## Technical FAQ

**How does Wake speed up self-hosted GitLab CI monorepo pipelines without code leaving our VPC?**
Wake runs as a single self-hosted container (`ghcr.io/strange-metal/wake:latest`) inside your existing GitLab Runners, computing your workspace dependency graph deterministically to emit native GitLab `trigger:include:artifact` child pipelines with zero external egress.

**How is Wake different from GitLab `rules:changes` or probabilistic ML test selection?**
Static `rules:changes` globs miss transitive dependencies and probabilistic ML skipping risks silent regressions. Wake computes exact transitive reverse dependencies from real package and Nix manifests on MRs and enforces the full suite on default branches and tags.

**How does Wake support Nix flakes and binary caches on self-hosted GitLab Runners?**
Wake traces root/sub-directory `flake.nix`, `path:` inputs, `default.nix`, and `callPackage` references, and parses Nix build logs alongside GitLab Runner trace sections to calculate binary-cache hit rates (`WAKE-010`).

**Can Wake use our internal LiteLLM or vLLM gateway?**
Yes. `wake agent` connects to any OpenAI-compatible internal gateway (`--llm-base-url`) or private Anthropic Claude endpoint directly from your runner.

**How does Wake stop an autonomous agent from cheating by skipping or deleting tests?**
Before opening any MR, Wake re-runs the verification command independently, inspects the AST, and blocks any patch that deletes tests, adds skips/xfails, or reduces the passed test count.

---

Operated by [Strange Metal, Inc.](https://strangemetal.org) (Delaware, USA) · [Privacy Policy](https://wakeci.dev/privacy) · [Legal Notice & Terms](https://wakeci.dev/legal)
