The Workspace Guardrails project provides user-owned infrastructure for building and governing digital workspace environments.
A digital workspace is a sandboxed environment where automation, AI models and hosted services run under policy. It is deployed on hardware you control and uses established open-source software.
Teams choose it when code, AI traffic, and service data must stay under their own control.
/opt.| Repository | Role |
|---|---|
WORKSPACE-VM |
Umbrella: bootstrap catalog, clone manifest, auditable sandboxed environments for agents, 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 |
AI policy gateway: per-tenant virtual keys, rate and spend limits, PII redaction, usage and cost in ClickHouse, Grafana dashboards |
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 ["Services"]
gateway["WORKSPACE-GATEWAY AI policy gateway + Grafana"]
end
operator --> bootstrap
bootstrap --> clones
clones --> ci
ci --> guard
gateway -.-> ci
Each path belongs to a 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 |
/opt is forbidden territory. All mutations there are prohibited,
and generated runtime paths are left as published. 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 for policy edits. Root
ownership of .git/ metadata and config/ is the normal state of the
workspace.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 does several things: 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 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 is not used to construct the candidate, and candidate-path metadata marks the deployment as failed; the fix is a corrected redeploy. A hook-installation failure leaves the artifact untouched; correct the failure and rerun the same flow.
When the deployed artifact 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 left in place, 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 parts of an agent machine that an agent could turn
against the workspace. 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 --append-makefile --yes"
It generates the CI integration files, including .pre-commit-config.yaml,
which declares hooks, stages, and file gates. If <path>/ci-profile.yaml
does not exist it is generated from templates/ci-profile.template.yaml
(the project name is substituted; trim the hook list to your stack
afterwards). An existing Makefile is never overwritten: --append-makefile
adds any missing contract targets (with the variable preamble they need)
while leaving hand-written recipes untouched. The engine reads
.pre-commit-config.yaml 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:
strict. Full enforcement; the default for first-party code.poc. Safety subset: 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
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.
The gates run in three stages:
| Stage | What runs | Why it belongs there |
|---|---|---|
| pre-commit | Format, lint, secrets, banned patterns, inline code, trusted-code service-killing 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 | Reads the message file |
| pre-push | Full test suite, each repository's own coverage gate, 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 # pre-push gate
Commit with git commit and 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. Selective staging, stash, reset, and
--amend are unavailable; history is forward-only and uncommitted changes are
included in the next commit. When a gate fails, fix the source and commit again.
The gates read their rules from configuration files, so a policy change is a config change with no code edit:
config/banned_words.yaml, with per-project narrowing in the versioned
exemption file.config/coverage_thresholds.yaml; the coverage gate runs that file at
pre-push, measuring enabled suites and passing disabled suites on test
outcome alone. Thresholds can only rise. Module-size limits are structural.Any config/<stem>.yaml file can be redirected at runtime without copying the
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. The matching model is specified in
REQ-BANNED-PATTERN-MATCHING.md
and
REQ-DEPENDENCY-VALIDATION.md.
Every model call passes through WORKSPACE-GATEWAY, an APISIX relay that
applies policy before a request reaches a provider:
Usage and cost land in ClickHouse on a billing-grade schema with tiered
retention, and the provisioned Grafana dashboards chart spend, health, and
per-model performance. Overview in
WORKSPACE-GATEWAY/README.md.
Agents and services run inside sandboxes. make vm provisions a runtime from a
YAML settings file, with lifecycle state kept under .vms/:
network.mode: none when no
network mode is supplied.NoNewPrivileges, and resource limits.Architecture and network modes are in
SPEC-VM-HYPERVISOR.md.
~/.gitconfig, ~/.ssh/*, and declared config
globs in fleet accounts, so an agent cannot open them for write..env, *.pem, and credentials.json
are blocked from commits.Policy lives in config/shared_locked_paths.yaml and
config/git_ssh_allowlist.yaml. Overview in
WORKSPACE-GUARD/README.md.
/var/log/workspace-guard/ and reported on /dev/tty, with reversibly
encoded detail.make drift-check.ci_integrity verifies that /opt/workspace-ci
matches its expected content, so an agent-modified deployment is detected
even when ownership still looks correct.Sources:
WORKSPACE-GUARD/README.md,
SPEC-AUDIT.md,
and src/ci_integrity.rs.
docs/README.mdWORKSPACE-CI/README.mdWORKSPACE-VM/README.mdRUNBOOK-HOOKS.mdThe wiki catalogues come from these same policy sources: /git-hooks,
/anti-patterns, /hook-configs, /sandbox-configs, /tools-scripts,
/static-analysis, and /llm-gateway.