Skip to content

[ 00 / How I run AI agents ]

The rules my AI agents work under, and what enforces them

Zero AI AttributionKernel flockEphemeral WorktreesStream Redactor

A language model makes mistakes nobody can predict, so the prompt is not what keeps an agent in line. The rules are: each agent works in its own Git worktree, secrets are scrubbed from its output before anything is saved, a second model reviews every pull request, and nothing an agent writes merges until I have read it.

Read foundational technical note→fail-closed-agent-harnesses

The proof

Whose problem
Mine. My AI coding agents forget everything between sessions, and they make mistakes nobody can predict.
The constraint
A rule with no mechanical guard gets broken, so each rule is a lock, a filter, a limit or a review, never a prompt.
Measured result
The Hive figure is published only with the method behind it, and that write-up is not out yet.
Where to verify
The rules, quoted from their files

[ 01 / Autonomous Agent Execution Plane ]

Task dispatch, knowledge retrieval via FastMCP, sandboxed worktree execution, and adversarial review.

Autonomous agent execution within bounded platform harness An architecture diagram generated by Archify. Human Operator · task intent & triage · Architecture component · supervision Human Operator task intent & triage supervision dotf CLI (Go) · pools.deny & semaphores · Control & Knowledge Plane · kernel flock dotf CLI (Go) pools.deny & semaphores kernel flock Knowledge Vault · 1,660+ markdown nodes · Control & Knowledge Plane · frontmatter SSOT Knowledge Vault 1,660+ markdown nodes frontmatter SSOT Iris Engine · Go motor & NATS bus · Architecture component · agent factory Iris Engine Go motor & NATS bus agent factory Safety Brakes · loop breaker & HITL token · Architecture component · dynamic guard Safety Brakes loop breaker & HITL token dynamic guard Hive FastMCP · AST chunker & SQLite FTS5 · Architecture component · hybrid RAG Hive FastMCP AST chunker & SQLite FTS5 hybrid RAG Ephemeral Worktrees · zero-copy git isolation · Architecture component · sandboxed edits Ephemeral Worktrees zero-copy git isolation sandboxed edits Reviewer Pool · cross-model diff audit · Quality & Verification Gate · anti-sycophancy Reviewer Pool cross-model diff audit anti-sycophancy CI Eval Gate · golden dataset & merge · Quality & Verification Gate · regression block CI Eval Gate golden dataset & merge regression block dispatch memlink permit indexes inspect vault_ask provisions PR diff audit pass Control & Knowledge Plane Quality & Verification Gate Legend Frontend Backend Database Cloud Security Message bus External
Every agent operation runs within an isolated Git worktree. Destructive actions trigger a synchronous HITL gate. PRs are audited by an independent model family before reaching human review.

Rendered at build from src/diagrams/harness.architecture.json

[ 02 / Four rules, each with a mechanism behind it ]

None of them relies on the model behaving well: each one is a lock, a filter, a limit or a review.

Isolation

OS Concurrency & Worktree Sandboxing

Ephemeral git worktrees sharing the .git/objects pool. Kernel POSIX flock semaphores prevent race conditions and branch collisions across concurrent autonomous agents.

  • ›Shared object pool isolation
  • ›Kernel-level flock semaphores
  • ›Monotonic deadline timeouts
Security

In-Stream Secret Redaction & JIT Injection

Real-time stream writer scrubbing process stdout/stderr before transcript persistence. Zero plaintext secrets on disk: Age/SOPS decryption piped strictly in-memory.

  • ›In-memory redactWriter stream filter
  • ›Age / SOPS asymmetric encryption
  • ›Immediate HALT on credential leak
Safety

Safety Brakes & Atomic PR Cap

Dynamic AST loop circuit breaker halting recursive tool invocations. Synchronous cryptographic HITL gate for destructive actions and hard ~300 executable LOC cap.

  • ›Dynamic tool loop circuit breaker
  • ›Synchronous HITL approval gate
  • ›~300 executable LOC PR budget
Verification

Cross-Model Adversarial Audit & Zero Auto-Merge

Independent model family auditing pull request diffs for anti-sycophancy. Strict prohibition of auto-merge: every production change merges under human review.

  • ›Cross-model independent diff review
  • ›Strict zero auto-merge doctrine
  • ›CI regression & mutation suites

[ 03 / Autonomous Fleet & Automations ]

The agents in production, the protocols they use, the event routers and the telemetry sinks running across the cluster. Most endpoints operate within the mesh boundary — what you see here is the live inventory and execution contracts.

13 entries · 5 you can open from here

Agents

  • Curator Agent

    Neural Hive · Memory & ADR Synthesis

    Private repo
  • SRE Triage Agent

    Reactive LogQL & Anomaly Classifier

    Publicopen ↗
  • GitOps Delivery Agent

    Automated Release Attestation & Promotion

    Mesh only

Protocols

  • Spec-Driven Dev

    Formal RFCs, Threat Models & Archive Gates

    Private repo
  • Review gates

    dotf pr triage-queue & mutation testing

    Publicopen ↗
  • No silent debt

    In-Flight Lessons & Real-Time ADR Recording

    Publicopen ↗
  • Zero Plaintext Secrets

    Age / SOPS Cryption & In-Memory Injection

    Publicopen ↗

Workflows

  • SRE Incident Auto-Triage

    Alertmanager Webhook -> Log Slicing -> Slack

    Mesh only
  • Secret Expiry & R2 Backup

    Proactive Backup & Credential Rotator

    Mesh only
  • Spoke Reconciliation

    K8s Spoke Topology Drift Healing

    Mesh only

Telemetry

  • Loki Telemetry API

    LogQL Cluster Telemetry & Tracebacks

    Mesh only
  • Health & SLO Monitor

    Live Multi-Burn-Rate SLO Engine

    Mesh only
  • Codebase Activity

    L0 Infrastructure Codebase

    Publicopen ↗

Migrated from mlorentedev/kubelab · 6cd9ab0

[ 04 / The rules, quoted from their files ]

Four excerpts, each quoted word for word from a public file and linked to the commit it was taken from.

Doctrinedotfiles/AGENTS.md

The rules every agent session loads

The operating rules the dotfiles harness compiles into every agent's instructions: no AI attribution, no auto-merge, and every environment change written as code and verified idempotent.

dotfiles/AGENTS.mdmarkdown
- **No AI attribution** in git history or GitHub messages (commits, PRs, issues).
- No `Co-Authored-By` trailers referencing AI agents.
- No bot-style emojis or "Generated with" footers.
- All artifacts must appear human-authored.
[…]
- **Auto-merge is forbidden in every repository.** Never run `gh pr merge --auto`, never enable "Auto-merge" in the GitHub UI, and keep the repo setting `allow_auto_merge=false`. Auto-merge lands a PR the instant CI goes green — bypassing the human review gate in §1.
[…]
- **Zero manual operations:** Never perform ad-hoc manual changes on remote systems, servers, or cloud environments.
- **Strict IaC & Idempotence:** Every configuration or environment change MUST be codified as reproducible IaC (Ansible, Terraform, K8s manifests, dotfiles) and verified idempotent (`changed=0` on re-run).
Verificationkubelab/harness/reviewer-pool.json

Which models may sign an adversarial review

An ordered allow-list of reviewer models. None of them is an Anthropic model, because Claude writes nearly every change: the reviewer must not be the implementer.

kubelab/harness/reviewer-pool.jsonjson
    "Standing rule: an adversarial review never runs on an Anthropic model. The",
    "reviewer must not be the implementer, and Claude implements nearly every",
    "change in this repo — BUG-074 was reviewed twice by claude-opus-5 before",
    "anyone noticed, which is the incident this file exists to prevent.",
[…]
  "pool": [
    {
      "id": "nan/deepseek-v4-flash",
      "runner": "pi",
      "provider": "nan",
      "model": "deepseek-v4-flash",
      "role": "primary",
[…]
    {
      "id": "agy/gemini-3.1-pro-high",
      "runner": "agy",
      "model": "gemini-3.1-pro-high",
      "role": "fallback",
Governancekubelab/harness/review-attestation.json

Did a review actually happen?

The gate that decides whether a pull request was reviewed. It never asks who reviewed it, and it tells a reviewer's "I could not review" notice apart from a review.

kubelab/harness/review-attestation.jsonjson
    "The gate asks ONE question: did a review actually happen? It never asks who",
    "performed it or how good it was. A human review attests exactly as well as a",
    "bot's.",
[…]
    {
      "login": "coderabbitai",
      "declined_markers": [
        "rate limited by coderabbit.ai"
      ],
      "review_markers": [
        "No actionable comments were generated in the recent review"
      ],
Architecturekubelab/docs/adr/adr-053-platform-product-repos.md

Code in one repo, deployment in another (ADR-053)

Each product repo builds an immutable sha-tagged image and fires a repository_dispatch to kubelab, which promotes it. Polling the registry was considered and rejected.

kubelab/docs/adr/adr-053-platform-product-repos.mdmarkdown
# ADR-053: Platform↔Product Repository Structure & Deployment Topology
[…]
2. **Image promotion is push, event-driven — never polling.**
   - Each product's CI publishes an immutable `sha-<short>` image, then fires a **`repository_dispatch`** to kubelab, whose workflow runs `toolkit deployment promote` (ADR-046).
   - **Rejected — registry polling** (Argo CD Image Updater *or* an n8n registry poller). It reintroduces exactly what ADR-046 descoped (#692): a pull loop and non-git-honest state; for n8n it would also put a non-critical service on the delivery path (n8n down → no deploys). We control the image producers, so push is strictly better than pull.
IN-DEPTH TECHNICAL NOTE

Fail-Closed Harnesses for Autonomous Coding Agents

What breaks when LLMs touch real infrastructure, and the Unix boundaries required to contain them: worktree isolation, kernel flock, and mechanical triage queues.

Read technical note→