Files
nixos-core/AGENTS.md
T
kiskaadee c9b22af663 docs(agents): codify live task tracking in AGENTS.md and initialize todo.txt for Milestone P3
- Add Live Task Tracking rule to AGENTS.md mandating synchronized, comment-free todo.txt.
- Initialize todo.txt with 7 prioritized deliverables for Milestone P3.
2026-10-13 07:43:01 -05:00

6.2 KiB

Homelab Core — Agent Guidelines

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

1. Core / Sites Boundary

Core owns:

  • NixOS host configuration and system services
  • Shared platform and infrastructure services
  • Ingress, identity, security boundaries, and host-level policy
  • Orchestration and deployment mechanics

~/Sites owns:

  • 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.


Verification & Architectural Integrity

When a requested change conflicts with an invariant, stop and resolve the architectural conflict before implementing a workaround.

Before committing architectural or security-sensitive changes:

./scripts/test
nix flake check

Run additional validation appropriate to the change, such as:

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.

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.


Architectural & Engineering Knowledge Preservation

When engineering changes in Core yield durable architectural insights, security posture shifts, non-obvious root causes, or transferable operational heuristics, knowledge preservation is governed by the global skill documentation-router:

  • Architectural commitments are recorded in ADRs (03-records/decisions/).
  • Exploratory design inquiries and trade-offs are recorded in Discussions (02-discussions/).
  • Empirical incident RCAs are recorded in Debug Records (03-records/debug/).
  • Implementation roadmaps are recorded in Plans (01-plans/).
  • Routine maintenance, configuration adjustments, and self-explanatory fixes require no external documentation.
  • Preserve repository-local documentation (docs/, inline comments, commit rationale) as the primary source of truth for runtime behavior.

Live Task Tracking (todo.txt)

For multi-step engineering milestones and complex refactors:

  • Maintain a standard, comment-free todo.txt in the repository root formatted for tuxedo / todo.sh.
  • Prioritize deliverables using standard priorities ((A), (B), (C)), projects (+<component>), and contexts (@<area>).
  • Keep todo.txt synchronized with code reality: when a deliverable is implemented and verified, mark it completed (x YYYY-MM-DD ...) immediately. Never leave verified work marked as pending or untracked.