| README.md | ||
System Architecture: GitOps-Managed AI Cluster
This cluster provides isolated, GitOps-deployed AI sessions across two machines: the trusted Vault host, which runs four MicroVMs, and Halo, a restricted inference processor.
Legend:
- blue is the human client
- green is trusted infrastructure
- orange is the limited-trust non-sensitive workload; yellow is the restricted inference processor
- red is an untrusted or external resource
- grey is deployment tooling
Solid arrows are data or network paths and dotted arrows mark denied paths.
1. System overview
The cluster has the following members:
| Member | Where it runs |
|---|---|
| User client | Laptop or smartphone, outside the cluster. Reaches Vault over Tailscale HTTPS |
| Vault | Trusted on-prem host, runs the gateway, firewall, and Nix store |
opencode-sensitive |
Vault MicroVM. Local AI and KB, no internet |
opencode-non-sensitive |
Vault MicroVM. Requesty only |
forgejo |
Vault MicroVM .Private repositories and Actions |
deployment |
Vault MicroVM. Actions runner and deploy-rs |
| Halo | Strix Halo machine. llama.cpp inference |
| Requesty | Cloud model API |
The diagram below shows how they connect.
flowchart LR
user["User client (laptop or smartphone)<br/>browser"]
subgraph tailnet["Tailscale tailnet"]
vault["Vault<br/>trusted host + gateway"]
end
subgraph vaultvms["Vault MicroVMs"]
sensitive["opencode-sensitive<br/>local AI + KB<br/>no internet"]
nonsensitive["opencode-non-sensitive<br/>Requesty<br/>no KB"]
forgejo["forgejo<br/>Git + Actions control"]
deployment["deployment<br/>Actions runner + deploy-rs"]
end
halo["Halo<br/>llama.cpp inference"]
internet["Internet<br/>Requesty, Nix caches"]
user -->|"HTTPS 443 / 8443 / 9443"| vault
vault -->|"proxy to :4096"| sensitive
vault -->|"proxy to :4096"| nonsensitive
vault -->|"proxy to :3000"| forgejo
sensitive -->|"inference :8080"| halo
sensitive -->|"internal HTTPS :3000"| forgejo
nonsensitive -->|"internal HTTPS :3000"| forgejo
deployment -->|"internal HTTPS :3000"| forgejo
deployment -->|"copy and activate"| vault
deployment -->|"copy and activate"| halo
nonsensitive -->|"Requesty"| internet
deployment -->|"Nix inputs and caches"| internet
sensitive -. "all internet egress denied" .-> internet
classDef client fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a;
classDef trusted fill:#dcfce7,stroke:#15803d,color:#14532d;
classDef limited fill:#ffedd5,stroke:#c2410c,color:#7c2d12;
classDef restricted fill:#fef3c7,stroke:#b45309,color:#78350f;
classDef external fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d;
classDef deploy fill:#e5e7eb,stroke:#4b5563,color:#111827;
class user client;
class vault,sensitive,forgejo trusted;
class nonsensitive limited;
class halo restricted;
class internet external;
class deployment deploy;
2. Hosts and responsibilities
flowchart TB
subgraph vaulthost["Vault"]
direction LR
firewall["Host firewall<br/>routed guest links<br/>Tailscale HTTPS gateways"]
secrets["sops-nix<br/>runtime credential source"]
store["Host Nix store<br/>never shared into guests"]
s["opencode-sensitive<br/>OpenCode, KB, broker<br/>sensitive sessions"]
n["opencode-non-sensitive<br/>OpenCode only<br/>Requesty sessions"]
f["forgejo<br/>private repositories<br/>Actions coordination"]
d["deployment<br/>repository-scoped runner<br/>Nix builder + deploy-rs"]
end
h["Halo<br/>llama.cpp"]
s -->|"inference"| h
d -->|"SSH deploy"| vaulthost
d -->|"SSH deploy"| h
classDef trusted fill:#dcfce7,stroke:#15803d,color:#14532d;
classDef limited fill:#ffedd5,stroke:#c2410c,color:#7c2d12;
classDef restricted fill:#fef3c7,stroke:#b45309,color:#78350f;
classDef deploy fill:#e5e7eb,stroke:#4b5563,color:#111827;
class vaulthost,s,f,secrets,store,firewall trusted;
class n limited;
class d deploy;
class h restricted;
| Component | Trust and purpose |
|---|---|
| Vault host | Trusted infrastructure. Runs QEMU/KVM, per-VM volumes, firewall/NAT, Tailscale HTTPS gateways, and sops-nix. |
opencode-sensitive |
Trusted data plane. Local AI only, KB and broker inside the VM, sensitive sessions and sensitive working repositories. Has no internet route. |
opencode-non-sensitive |
Limited-trust workload. Requesty only, non-sensitive sessions and repositories. Cannot reach the KB, Halo inference, the sensitive VM, the deployment VM, Vault host management, or sensitive repositories. |
forgejo |
Trusted source of truth. Private Git repositories, repository ACLs, and Actions coordination. Needs no general outbound internet. |
deployment |
Trusted control plane. Runs the repository-scoped Actions runner and deploy-rs, builds all closures, and holds deployment credentials. |
| Halo | Restricted sensitive-data processor. Runs llama.cpp only, accepts inference requests only from the sensitive VM, and keeps no prompts or responses in logs. |
Trust boundary limitations
- A compromise of Vault host root defeats guest isolation and can read all VM stores and volumes.
- A compromise of the trusted deployment workflow or its credentials can control both hosts.
- A Forgejo site administrator can read the repositories and change repository permissions.
- Authorized users can copy data between systems outside these controls.
3. Separate OpenCode planes
A plane is a VM boundary and deployment property.
| Property | Sensitive plane | Non-sensitive plane |
|---|---|---|
| OpenCode server | opencode-sensitive |
opencode-non-sensitive |
| Model source | Local llama.cpp on Halo only |
Requesty only |
| Knowledge base | Inside the sensitive VM and broker | No access |
| Session and inference logs | Private to the sensitive VM | Cannot read sensitive logs. Keeps only its own non-sensitive logs |
| Internet | Denied entirely | Allowed for Requesty and normal tools |
| Forgejo identity | Sensitive repositories only | Non-sensitive repositories only |
sequenceDiagram
participant C as User client
participant V as Vault gateway
participant S as opencode-sensitive
participant K as Local KB / broker
participant H as Halo llama.cpp
C->>V: HTTPS + Tailscale identity
V->>S: authenticated proxy request
S->>K: retrieve permitted context
S->>H: inference request
H-->>S: local model response
S-->>V: session render
V-->>C: HTTPS response
Note over S,H: No internet route exists in the sensitive VM
4. Network policy
Network isolation is enforced by Vault’s host firewall and routed per-guest links. Guest links do not share a general-purpose layer-2 bridge, so the untrusted non-sensitive VM cannot ARP-spoof another guest.
flowchart LR
clients["Tailscale clients"]
sens["sensitive VM"]
nonsens["non-sensitive VM"]
forgejo["forgejo VM"]
deploy["deployment VM"]
halo["Halo llama.cpp"]
net["Internet"]
clients -->|"HTTPS 443 / 8443 / 9443"| vaultgw["Vault gateway"]
vaultgw -->|"proxy"| sens
vaultgw -->|"proxy"| nonsens
vaultgw -->|"proxy"| forgejo
sens -->|"inference :8080"| halo
sens -->|"HTTPS :3000"| forgejo
nonsens -->|"HTTPS :3000"| forgejo
deploy -->|"HTTPS :3000"| forgejo
deploy -->|"HTTPS, DNS"| net
nonsens -->|"HTTPS, DNS, NTP"| net
deploy -->|"SSH deploy"| halo
deploy -->|"SSH deploy"| vaultgw
forgejo -. "general internet denied" .-> net
classDef client fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a;
classDef trusted fill:#dcfce7,stroke:#15803d,color:#14532d;
classDef limited fill:#ffedd5,stroke:#c2410c,color:#7c2d12;
classDef restricted fill:#fef3c7,stroke:#b45309,color:#78350f;
classDef deploy fill:#e5e7eb,stroke:#4b5563,color:#111827;
classDef external fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d;
class clients client;
class vaultgw,sens,forgejo trusted;
class nonsens limited;
class deploy deploy;
class halo restricted;
class net external;
Allowed destinations are explicit, target-scoped policy entries. There are no wildcard roles or services. Sensitive DNS and NTP are denied. It uses static local names and host-managed time.
| Internal service | Port | Purpose |
|---|---|---|
| OpenCode | 4096 | Per-VM web server behind the Vault proxy |
| Forgejo | 3000 | Cluster-internal HTTPS |
| Halo inference | 8080 | llama.cpp API |
| Deployment SSH | 22 | deploy-rs target access (plus human access) |
| Client-facing Vault endpoints | 443 / 8443 / 9443 | Sensitive OpenCode / non-sensitive OpenCode / Forgejo |
Clients never connect directly to guest service ports. Addresses are deployment inputs and are not part of the symbolic security policy.
Denied crossings
| Source | Denied destinations |
|---|---|
opencode-sensitive |
All internet egress, including public DNS and NTP |
opencode-non-sensitive |
KB and broker, Halo inference, the sensitive VM, the deployment VM, Vault host management, sensitive repositories |
forgejo |
General outbound internet |
| Halo | All outbound traffic. No inbound except inference from opencode-sensitive and deploy-rs SSH from deployment |
5. Storage isolation
Each VM gets its own immutable system store image containing only that VM’s closure. The host, which sees every store image and volume, remains inside the trusted boundary (§2).
flowchart TB
hoststore["Vault host Nix store<br/>trusted"]
img1["sensitive store image"]
img2["non-sensitive store image"]
img3["forgejo store image"]
img4["deployment store image"]
vol1["sensitive sessions + KB"]
vol2["non-sensitive sessions"]
vol3["Forgejo repositories + DB"]
vol4["runner state + deployment credentials"]
scratch["volatile build overlay<br/>tmpfs; discarded on restart"]
hoststore -->|"contains image"| img1
hoststore -->|"contains image"| img2
hoststore -->|"contains image"| img3
hoststore -->|"contains image"| img4
img1 --- vol1
img2 --- vol2
img3 --- vol3
img4 --- vol4
img4 --- scratch
classDef trusted fill:#dcfce7,stroke:#15803d,color:#14532d;
classDef limited fill:#ffedd5,stroke:#c2410c,color:#7c2d12;
classDef deploy fill:#e5e7eb,stroke:#4b5563,color:#111827;
class hoststore,img1,vol1,img3,vol3 trusted;
class img2,vol2 limited;
class img4,vol4,scratch deploy;
The deployment VM’s build store is deliberately volatile.
It may build inside the current boot, but its writable overlay and Nix database are discarded on restart.
deploy-rs copies all required outputs to the targets before a restart.
Halo keeps model files on a dedicated volume outside the Nix store.
No swap, tmpfs /tmp.
6. Repositories and identities
Forgejo is one shared application with disjoint repository sets.
| Repository class | Human admin | Deployment identity | Sensitive OpenCode | Non-sensitive OpenCode |
|---|---|---|---|---|
infrastructure |
Owner | Read + run workflows | No access | No access |
sensitive/* |
Owner | No access | Read/write | No access |
non-sensitive/* |
Owner | No access | No access | Read/write |
All repositories are private. Registration and anonymous viewing are disabled.
Any repository readable by non-sensitive OpenCode is non-sensitive by definition. Sensitive OpenCode must never have write access to a repository readable by non-sensitive OpenCode.
Repositories are never reclassified in place. Moving work between sensitivity classes requires a new repository and fresh human review. Only the human administrator creates organizations and repositories.
7. Secrets
Vault uses sops-nix with age keys to decrypt secrets at runtime.
It delivers each secret to the owning VM through microvm.credentialFiles:
sops-nix on Vault -> root-readable 0400 runtime file
-> QEMU fw_cfg: io.systemd.credential
-> guest systemd credential
-> owning service via ImportCredential
There is no host-directory share and no plaintext secret in the Nix store. QEMU must run as an account allowed to read the runtime file. Guest root can read the credential delivered to that guest. The design does not protect against compromise of the owning guest. Each guest receives only its own credentials: non-sensitive never receives sensitive, KB, or deployment credentials, and the deployment VM never receives KB or session credentials.
8. Deployment pipeline
Forgejo hosts the source of truth.
The Actions runner is repository-scoped to infrastructure and runs only for a verified push to the protected deployment branch.
Pull-request workflows must not reach the deployment runner.
The MicroVMs are not separate deploy-rs nodes. Their closures are part of Vault’s system closure and are installed during Vault activation.
sequenceDiagram
actor Human
participant F as Forgejo
participant D as deployment VM
participant H as Halo
participant V as Vault
Human->>F: push to protected deployment branch
F->>D: schedule infrastructure workflow
D->>D: nix flake check
D->>D: build Vault, all four VM closures, and Halo
D->>D: isolation tests and closure/content scans
D->>H: deploy-rs copy + activate
H-->>D: confirmation
D->>V: deploy-rs copy + activate Vault host generation (includes VM closures)
V-->>D: confirmation
D->>V: verify generation and host health over SSH
D-->>F: deployment result
Human->>V: post-deploy web checks through the client gateway
The runner uses remoteBuild = false:
it builds on the deployment VM, then copies closures to Halo first and Vault second.
Ordinary switch failures use deploy-rs activation confirmation and auto-rollback.
Magic rollback covers a host that boots but fails activation.
Control-plane updates
Vault activation can restart networking, SSH, Forgejo, or the deployment VM itself.
The deployment and forgejo guests therefore set restartIfChanged = false.
Routine application changes to the two OpenCode VMs may activate directly. Changes to the deployment runner, Forgejo, Vault networking/SSH, the kernel, or the host require a staged maintenance procedure:
- Apply and confirm the Vault generation while keeping the control-plane VMs running.
- Run health checks.
- Restart the control-plane VM or reboot the host as a separately approved step.
- Run post-restart health checks.
If the control plane is unreachable, use laptop SSH.