This is the entry point for bringing up the sovereign workspace stack on a machine you control and for enrolling repositories into it.
The stack is a federated repository system: an umbrella repository orchestrates several independent clones, a sealed enforcement engine gates every commit and push, and compiled guards sit at the syscall boundary so the gates cannot be bypassed. It does far more than install a CI project and some hooks. Read this once end to end, then use the sections as a map.
Three properties define the design:
/opt. The running artifact is never an editing target, and a bad
deployment is corrected by redeploying reviewed source, never by editing the
artifact in place.The umbrella repository is WORKSPACE-VM. It owns the bootstrap catalog, the
Makefile entrypoints, the clone manifest, the agent VM and network tooling, the
local inference stack, and the benchmark suite. The other repositories under
projects/ are independent clones with their own release cadence.
| Repository | Role |
|---|---|
WORKSPACE-VM |
Umbrella: bootstrap catalog, clone manifest, agent VMs, host VPN, local inference, benchmarks |
WORKSPACE-CI |
Sealed enforcement engine at /opt/workspace-ci: native git hooks, quality gates, policy engine, scaffold-ci, documentation wiki |
WORKSPACE-GUARD |
Compiled guards: git, shell, binary lock, home lock, audit and inventory |
WORKSPACE-GATEWAY |
Multi-tenant LLM gateway: APISIX routes, OpenBao secrets, ClickHouse usage, Grafana |
WORKSPACE-DATAOPS |
Sovereign data services: PostgreSQL, Keycloak, Vaultwarden |
WORKSPACE-PORTAL, WORKSPACE-RP, WORKSPACE-STREAMS, WORKSPACE-BROWSER |
Opt-in federation projects |
The authoritative list is the clone manifest
workspace/config/workspace-clones.yaml.
Read the umbrella overview at
WORKSPACE-VM/README.md.
flowchart TB
operator(["Operator"])
subgraph umbrella ["WORKSPACE-VM umbrella"]
bootstrap["Bootstrap catalog + Makefile entrypoints"]
clones[("projects/ independent clones")]
end
subgraph enforcement ["Enforcement"]
ci["WORKSPACE-CI sealed at /opt/workspace-ci"]
guard["WORKSPACE-GUARD at the syscall boundary"]
end
subgraph services ["Sovereign services"]
gateway["WORKSPACE-GATEWAY LLM proxy + Grafana"]
dataops["WORKSPACE-DATAOPS Postgres + identity"]
end
operator --> bootstrap
bootstrap --> clones
clones --> ci
ci --> guard
gateway -.-> ci
dataops -.-> gateway
Each path belongs to exactly one trust domain. The control column names who may write there.
| Path | Role | Control |
|---|---|---|
projects/WORKSPACE-CI |
CI source tree | Agent |
origin/main |
Source authority | Upstream |
/opt/workspace-ci |
Sealed artifact | Root |
/opt/.workspace-ci.candidate |
Deployment candidate | Root |
config/ policy files |
Root-owned policy data | Root, via the yaml editor |
Two rules follow from the table:
/opt is forbidden territory. All mutations there are prohibited,
and generated runtime paths are never rewritten. A failed or absent install is
remedied by rerunning make deploy-ci from reviewed source.yaml-set, yaml-add, yaml-remove, yaml-unset,
yaml-remove-comment, and yaml-delete verbs instead of rewriting files.
Root ownership of .git/ metadata and config/ is the designed state, not
damage.Bring-up is staged so that an agent-owned clone can be prepared before any privileged installation:
make ensure-repos # clone every repository in the manifest (non-root)
make install # interactive bootstrap TUI, or:
make install-ci # unattended bootstrap with fixed defaults
sudo make init # privileged bootstrap: packages, deploy-ci, guard, hooks, log limits
make init performs several operations in one pass: it installs system packages
from the catalog, publishes the sealed CI artifact with deploy-ci, installs the
git guard, root-owns hooks and exemption files in every consumer repository, and
enforces syslog ceilings. It fails loudly if the CI checkout is missing, so run
make ensure-repos first.
Optional operator maintenance:
sudo make guard-up # idempotent fleet bring-up (provision + guard install)
sudo make guard-refresh # refresh guard code after a pull
make guard-check # read-only health check
Component selection lives in
workspace/config/bootstrap-components.yaml.
Bootstrap binaries install into a platform-aware boot directory (.boot-linux/
or .boot-macos/) that the hooks and CLI extensions resolve by absolute path.
make deploy-ci is the only deployment contract. Run as root, it:
origin/main into /opt/.workspace-ci.candidate;/opt/workspace-ci on the same
filesystem and seals it;The current artifact never participates in candidate construction, and candidate-path metadata is treated as a deployment failure rather than something to repair. A hook-installation failure leaves the artifact untouched; correct the failure and rerun the same flow.
When the deployed artifact itself gates every commit, recover by deploying a prior sanctioned generation, then land the fix through the restored gates and redeploy the tip:
sudo make deploy-ci REV=<commit> # a committed ancestor of origin/main
The working checkout is never moved, and revisions that do not resolve to an
ancestor are refused. The full procedure and rollback decision record are in
RUNBOOK-HOOKS.md.
WORKSPACE-GUARD wraps the most abusable surfaces of an agent machine. It is
organized into five deployed programs:
| Program | Surface | Install target |
|---|---|---|
| I - Git Guard | Replaces /usr/bin/git, enforces forward-only history, delegates quality checks to the CI hooks |
sudo make reconcile-guard-host-exec |
| II-A - Binary lock | Contains SUID and file-capability binaries behind policy wrappers | make install-lock |
| II-B - Sandbox | Hardened systemd unit template (launcher on the roadmap) | make install-sandbox |
| II-C / II-D - Audit and inventory | GTFOBins and konstruktoid baselines, drift checks, auditd and AIDE rules | make install-auditd, make sync-gtfobins |
| III - Home lock | Root-locks identity files and declared config globs in fleet accounts | make install-home-lock |
| Shell guard | Scans every -c string and untrusted script body, executes untrusted scripts from a sealed memfd |
sudo make install-shell-guard |
Build and install the git guard through the CI wrappers:
sudo make build-guard
sudo make install-guard-host-exec
make check-guard-host-exec # read-only, runs as the agent
The guard's public description and install table are in
WORKSPACE-GUARD/README.md.
Policy YAML under the guard config root is edited with the sudo-gated
workspace-yaml-edit binary; block and sanitize reports can be rerouted to a
working-directory audit sink for agent sessions.
scaffold-ci is the profile-driven bootstrapper that enrolls a repository:
make scaffold-ci CONSUMER=<path> ARGS="--force-precommit --yes"
It generates the CI integration files, including .pre-commit-config.yaml,
which declares hooks, stages, and file gates. The engine reads that file and
generates native .git/hooks/* scripts from it; there is no framework runtime
and no remote hook environment to clone. Requirements are in
REQ-SCAFFOLD-CI.md.
Enforcement is tiered per project, resolved through project_enforcement.yaml:
| Tier | Behavior |
|---|---|
strict |
Full enforcement; the default for first-party code |
poc |
Safety subset only: secrets, sensitive files, banned words, commit hygiene |
vendored |
No hooks installed, for frozen or mirrored trees |
Any config/<stem>.yaml can be redirected at runtime without copying the whole
tree. CI_CONFIG_DIR, the CI_CONFIG_OVERRIDES manifest, and per-file
CI_CONFIG_PATH_{STEM} variables resolve the same way across the bash hooks,
the Python checkers, and the wiki.
Three non-redundant stages run at different moments:
| Stage | What runs | Why it belongs there |
|---|---|---|
| pre-commit | Format, lint, secrets, banned patterns, swallowed-error scan, dependency validation, file and module size, coverage no-devolution | Fast, content-focused gates before a commit is recorded |
| commit-msg | Message format compliance and agent-attribution blocking | Checks only the message file |
| pre-push | Full test suite and coverage thresholds, web and JS quality, co-authored history scan, advisory dead-code report | Expensive gates that run when code leaves the machine |
Mirror the push gate locally before pushing:
make check # lint + type-check + test
make check-push # single-pass pre-push gate
The commit flow is exactly one command: git commit with the message supplied
through -F. If nothing was staged, the pre-commit gate stages everything and
fails with instructions, and re-running the same command succeeds. There is no
selective staging, no stash, no reset, and no --amend; history is
forward-only and a dirty tree rides the next commit as-is. A failing gate is
never fought: fix the source and commit again.
The rules the gates enforce are data, not code:
config/banned_words.yaml, with per-project narrowing in the versioned
exemption file.Add a pattern or tune a threshold in config; no code change is required. The
model and its guarantees are specified in
REQ-BANNED-PATTERN-MATCHING.md.
A working workspace usually adds several of these:
WORKSPACE-GATEWAY relays shared model traffic through
APISIX with per-tenant keys, spend limits, and redaction, and records usage
and cost in ClickHouse and Grafana. Start it with make gw-start and deploy
it on boot with make -C ../WORKSPACE-GATEWAY gateway-deploy. Overview:
WORKSPACE-GATEWAY/README.md.make llama-setup detects hardware, builds one stack
profile (llamafile or llama.cpp), bundles weights, deploys a systemd service,
and runs diagnostics. Benchmarks under benchmarks/ exercise the running
stack.make vm CONFIG=... provisions an isolated sandbox; rootless
Podman is the default and QEMU adds a full kernel boundary for authoritative
guard tests. Lifecycle state persists under .vms/.make vpn-install and make vpn-start join a remote workspace
network with a boot-directory OpenVPN client.WORKSPACE-DATAOPS provides PostgreSQL,
Keycloak, and Vaultwarden for the federation.make mount-ws-backup / make unmount-ws-backup), capacity limits are
raised with sudo make enforce-multi-server-limits, and a persistent
diagnostics sampler records pressure and file-descriptor evidence across
power cycles.workspace-oc wrapper shards the agent database per
repository and supports per-run context overrides.make guard-check, make wiki-prod-status,
make diagnostics-status, and the systemd user units for the gateway, wiki,
and tunnel.sudo make deploy-ci REV=<commit>.sudo make guard-refresh after pulling guard code, then
make guard-check.fstab by hand.make wiki-prod-build, deploy on boot with
make wiki-prod-deploy, and route public traffic with
make wiki-tunnel-deploy. Certificate renewal is a systemd timer.docs/README.mdWORKSPACE-CI/README.mdWORKSPACE-VM/README.mdRUNBOOK-HOOKS.mdIn the wiki itself, the catalogues below are generated from the same policy
sources described here: /git-hooks, /anti-patterns, /hook-configs,
/sandbox-configs, /tools-scripts, /static-analysis, and /llm-gateway.