docs(agents): formalize core boundaries and gitops trust model
Core Architecture & Invariant CI / validate (push) Successful in 9m47s
Core Architecture & Invariant CI / validate (push) Successful in 9m47s
Rewrite AGENTS.md to establish strict architectural invariants and operational boundaries for the homelab control plane. - Define explicit ownership split between Core platform and ~/Sites workloads - Codify the GitOps trust model to enforce closed, authenticated execution - Mandate strict Docker socket isolation and declarative secret projection - Require invariant verification (scripts/test, nix flake check) prior to commits - Clarify boundaries between repository documentation and external Brain Vaults
This commit is contained in:
1 parent
18c1a3f247
commit
35f7d564cc
1 file changed
+153
-16
@@ -1,25 +1,162 @@
|
|||||||
# 🤖 Antigravity Workspace Guidelines: Homelab Core & Infrastructure
|
# Homelab Core — Agent Guidelines
|
||||||
|
|
||||||
This repository is the central control plane for the `roadtotech.me` homelab cluster. Follow these operational rules across all tasks.
|
This repository defines the host foundation and Core platform for the
|
||||||
|
`roadtotech.me` homelab.
|
||||||
|
|
||||||
|
It contains NixOS configuration, shared infrastructure services, orchestration
|
||||||
|
tools, security policy, and operational configuration.
|
||||||
|
|
||||||
|
Independent application workloads live in `~/Sites` and are integrated with
|
||||||
|
Core through their application manifests and Docker Compose configuration.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🏛️ Architectural Invariants
|
## Architectural Invariants
|
||||||
|
|
||||||
1. **Decentralized Manifests (`app.yaml`)**:
|
### 1. Core / Sites Boundary
|
||||||
- Never hardcode application environment variables, domains, or port maps inside `Core/scripts/appctl` or `Core/scripts/appctl_engine.py`.
|
|
||||||
- Every application in `~/Sites` is self-describing via its own `app.yaml`.
|
**Core owns:**
|
||||||
2. **Read-Only Socket Proxy**:
|
- NixOS host configuration and system services
|
||||||
- `socket-proxy` must remain restricted to read-only endpoints (`POST=0`, `DELETE=0`).
|
- Shared platform and infrastructure services
|
||||||
3. **Zero Hardcoded Secrets**:
|
- Ingress, identity, security boundaries, and host-level policy
|
||||||
- Never commit raw `.env` files, password strings, database files (`*.db`, `*.sqlite3`), or SSL certificates (`acme.json`, `*.key`).
|
- Orchestration and deployment mechanics
|
||||||
- All runtime secrets are managed declaratively in `nixos/secrets.yaml` via SOPS and rendered to `/run/secrets/` at boot.
|
|
||||||
4. **License Invariant**:
|
**`~/Sites` owns:**
|
||||||
- Preserve and maintain `The Unlicense` (public domain) across all Core and Sites repositories.
|
- Independently deployed application workloads
|
||||||
|
- Application-specific Docker Compose configuration
|
||||||
|
- Application-specific `app.yaml` metadata and workload intent
|
||||||
|
|
||||||
|
Do not move workload-specific configuration into Core merely because Core
|
||||||
|
consumes or manages the workload.
|
||||||
|
|
||||||
|
Do not move Core-owned platform services into `~/Sites`.
|
||||||
|
|
||||||
|
When ownership is unclear, consult current architecture documentation before
|
||||||
|
changing the boundary.
|
||||||
|
|
||||||
|
### 2. Workload Manifests
|
||||||
|
|
||||||
|
Every `~/Sites` workload is self-describing through its `app.yaml`.
|
||||||
|
|
||||||
|
Do not hardcode workload-specific domains, ports, environment variables,
|
||||||
|
containers, or deployment configuration inside `scripts/appctl`,
|
||||||
|
`scripts/appctl_engine.py`, or GitOps logic.
|
||||||
|
|
||||||
|
`app.yaml` describes workload identity, integration metadata, and deployment
|
||||||
|
intent. Core owns deployment mechanics.
|
||||||
|
|
||||||
|
Never introduce arbitrary command execution, host filesystem paths,
|
||||||
|
privileged operations, or Docker control capabilities into workload manifests.
|
||||||
|
|
||||||
|
### 3. GitOps Trust Boundary
|
||||||
|
|
||||||
|
GitOps must remain a constrained deployment mechanism.
|
||||||
|
|
||||||
|
- Webhook authentication is mandatory.
|
||||||
|
- Repository identity is resolved through trusted Core logic.
|
||||||
|
- Filesystem paths must never be selected directly by webhook payloads.
|
||||||
|
- Deployment execution must remain closed and explicitly allowlisted.
|
||||||
|
- Repository-controlled configuration must never become arbitrary shell input.
|
||||||
|
- Deployment serialization and superseding behavior must be preserved.
|
||||||
|
|
||||||
|
Do not weaken these constraints for convenience.
|
||||||
|
|
||||||
|
### 4. Docker Isolation
|
||||||
|
|
||||||
|
- `socket-proxy` is the only Core Compose service that may mount
|
||||||
|
`/var/run/docker.sock`.
|
||||||
|
- The socket proxy must expose only explicitly approved read-only Docker API capabilities; state-changing and command-execution endpoints must remain disabled.
|
||||||
|
- Do not add `privileged: true` without an explicit architectural decision.
|
||||||
|
- Workload containers must not gain direct access to the Docker socket.
|
||||||
|
|
||||||
|
### 5. Secrets & Persistent State
|
||||||
|
|
||||||
|
Never commit plaintext secrets, credentials, password hashes, private keys,
|
||||||
|
certificates, runtime databases, or other generated/persistent state.
|
||||||
|
|
||||||
|
Secrets are managed through SOPS and projected to runtime paths under
|
||||||
|
`/run/secrets/`.
|
||||||
|
|
||||||
|
Do not move secrets into application manifests or source code.
|
||||||
|
|
||||||
|
### 6. Declarative Configuration vs Runtime State
|
||||||
|
|
||||||
|
Git contains declarative configuration and reproducible definitions.
|
||||||
|
|
||||||
|
Persistent runtime state belongs in the appropriate state directories or
|
||||||
|
Docker volumes and must remain excluded from version control.
|
||||||
|
|
||||||
|
Do not convert runtime state into committed configuration merely to simplify
|
||||||
|
development or recovery.
|
||||||
|
|
||||||
|
### 7. Core Service Ownership
|
||||||
|
|
||||||
|
Core Compose is the execution boundary for Core-owned platform services.
|
||||||
|
Workload-specific services belong in `~/Sites` unless an explicit architectural
|
||||||
|
decision establishes them as Core-owned.
|
||||||
|
|
||||||
|
Do not introduce application-specific deployment policy into the Core stack.
|
||||||
|
|
||||||
|
Do not make Core orchestration depend on implementation details of a workload
|
||||||
|
when the workload's declared contract can be used instead.
|
||||||
|
|
||||||
|
### 8. License
|
||||||
|
|
||||||
|
Preserve The Unlicense across Core and related Sites repositories.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📚 Brain Vault & Continuous Learning
|
## Verification & Architectural Integrity
|
||||||
|
|
||||||
* **Knowledge Capture**: Whenever architectural designs, threat analyses, debugging insights, or `/learn` commands are executed, ensure a clear, structured markdown note is persisted to [`/home/kiskaadee/Brain/homelab/`](/home/kiskaadee/Brain/homelab) or [`/home/kiskaadee/Brain/learning/`](/home/kiskaadee/Brain/learning) and indexed in its corresponding `README.md`.
|
When a requested change conflicts with an invariant, stop and resolve the
|
||||||
* **Obsidian & Docs Viewer Compatibility**: All documentation must be clean GitHub-flavored markdown compatible with Obsidian and the live docs viewer at `https://docs.roadtotech.me`.
|
architectural conflict before implementing a workaround.
|
||||||
|
|
||||||
|
Before committing architectural or security-sensitive changes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/test
|
||||||
|
nix flake check
|
||||||
|
```
|
||||||
|
|
||||||
|
Run additional validation appropriate to the change, such as:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose config -q
|
||||||
|
```
|
||||||
|
|
||||||
|
Architectural invariants should be encoded as tests whenever practical.
|
||||||
|
|
||||||
|
Do not bypass failing invariant tests by weakening or removing the invariant
|
||||||
|
unless the architecture itself has intentionally changed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Use the repository's current architecture and operational documentation as the
|
||||||
|
source of truth for ownership, protocols, and system behavior.
|
||||||
|
|
||||||
|
Historical material under `docs/legacy/` is archival and must not be treated as
|
||||||
|
current system behavior.
|
||||||
|
|
||||||
|
Record significant architectural decisions in the appropriate ADR or Brain
|
||||||
|
documentation rather than expanding this file into an architecture manual.
|
||||||
|
|
||||||
|
All documentation must remain GitHub-flavored Markdown compatible with Obsidian
|
||||||
|
and the live documentation viewer.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Brain Vault
|
||||||
|
|
||||||
|
Capture significant:
|
||||||
|
|
||||||
|
- Architectural decisions
|
||||||
|
- Security/threat-model changes
|
||||||
|
- Debugging discoveries
|
||||||
|
- Implementation lessons
|
||||||
|
|
||||||
|
in the appropriate `/home/kiskaadee/Brain/homelab/` or
|
||||||
|
`/home/kiskaadee/Brain/learning/` location.
|
||||||
|
|
||||||
|
Do not duplicate entire repository documentation in the Brain Vault.
|
||||||
Reference in new issue
Block a user