Turn the map's safety stance into a concrete, per-tool model: the exact command classification (free / approve-then-run / never) for Ansible, Flux/kubectl/Helm, and OpenTofu; what "explicit approval" looks like in a session and in an autonomous team run; the secrets rule (Ansible Vault, Sealed Secrets, kubeconfigs, tofu state); and which enforcement layers we adopt (hooks, wrappers, RBAC, instructions) given the hooks research. Likely ADR-worthy.
apm 0.28.0 deploys .apm/hooks/ to Claude, Copilot, Codex, Gemini, Cursor (not OpenCode); it renames events but does not translate tool matchers. Codex/Gemini hooks deploy only if .codex//.gemini/ already exist; Cursor output is unverified.
A pre-tool hook can read the command and deny everywhere (exit 2 + stderr). A real ask works only in Claude Code and Copilot CLI — Codex treats ask as allow, Copilot cloud agent as deny, Gemini undocumented. So "approve-then-run" cannot rely on hook ask across providers.
Every provider documents hooks as a guardrail, not a security boundary. Suggested layering: skill instructions → one portable matcher-less guard hook → documented (not shipped) host settings → credential boundary (read-only view kubeconfig, apply credentials the agent never holds, unreadable vault password, branch protection) → infra-repo pre-commit/CI. PATH wrapper scripts rejected as trivially bypassed.
GitOps for everything: Flux, Ansible and OpenTofu all apply by merge (controller/CI). The PR review approval is the apply gate; the agent holds no apply credentials. Agent-run ansible-playbook/tofu apply now exists only as an odd job.
Gates are human-set Gitea state (Status/Ready for Agent on spec/tickets, PR review approval). Decide how "agents never set gate signals" is enforced — the agent's token currently has write:issue and can add labels.
Odd jobs: the human instructs the operator directly (or via the lead); that instruction is the approval, no ticket. Decide what the approve-then-run tier means for them, and how such runs leave a durable trace (the user declined a ticket per run; governance requires a reviewable log).
Rollback: automatic only via mechanisms built into the repo (Helm remediation, CI rollback steps); the agent never reverts unilaterally — revert PR or explicit approval.
Conflict to resolve
The map's stance allows ansible-playbook --check freely but forbids reading vault password files. A check run that loads vaulted vars likely needs the vault password (unverified against Ansible docs — verify first). Decide: gated check path, treat vault-touching check runs as approve-then-run, or relax the read rule with a scoped credential. (With GitOps, a check run could also move to CI on the PR.)
Part of #166
## Question
Turn the map's safety stance into a concrete, per-tool model: the exact command classification (free / approve-then-run / never) for Ansible, Flux/kubectl/Helm, and OpenTofu; what "explicit approval" looks like in a session and in an autonomous team run; the secrets rule (Ansible Vault, Sealed Secrets, kubeconfigs, tofu state); and which enforcement layers we adopt (hooks, wrappers, RBAC, instructions) given the hooks research. Likely ADR-worthy.
## Inputs (from #168)
- apm 0.28.0 deploys `.apm/hooks/` to Claude, Copilot, Codex, Gemini, Cursor (not OpenCode); it renames events but does not translate tool matchers. Codex/Gemini hooks deploy only if `.codex/`/`.gemini/` already exist; Cursor output is unverified.
- A pre-tool hook can read the command and **deny** everywhere (exit 2 + stderr). A real **ask** works only in Claude Code and Copilot CLI — Codex treats ask as allow, Copilot cloud agent as deny, Gemini undocumented. So "approve-then-run" cannot rely on hook *ask* across providers.
- Every provider documents hooks as a guardrail, not a security boundary. Suggested layering: skill instructions → one portable matcher-less guard hook → documented (not shipped) host settings → **credential boundary** (read-only `view` kubeconfig, apply credentials the agent never holds, unreadable vault password, branch protection) → infra-repo pre-commit/CI. PATH wrapper scripts rejected as trivially bypassed.
## Inputs (from #170)
- **GitOps for everything**: Flux, Ansible and OpenTofu all apply *by merge* (controller/CI). The PR review approval is the apply gate; the agent holds no apply credentials. Agent-run `ansible-playbook`/`tofu apply` now exists only as an **odd job**.
- **Gates are human-set Gitea state** (`Status/Ready for Agent` on spec/tickets, PR review approval). Decide how "agents never set gate signals" is enforced — the agent's token currently has `write:issue` and can add labels.
- **Odd jobs**: the human instructs the operator directly (or via the lead); that instruction is the approval, no ticket. Decide what the approve-then-run tier means for them, and how such runs leave a **durable trace** (the user declined a ticket per run; governance requires a reviewable log).
- **Rollback**: automatic only via mechanisms built into the repo (Helm remediation, CI rollback steps); the agent never reverts unilaterally — revert PR or explicit approval.
## Conflict to resolve
The map's stance allows `ansible-playbook --check` freely but forbids reading vault password files. A check run that loads vaulted vars likely needs the vault password (unverified against Ansible docs — verify first). Decide: gated check path, treat vault-touching check runs as approve-then-run, or relax the read rule with a scoped credential. (With GitOps, a check run could also move to CI on the PR.)
Claude
added this to the Map: Infra and agent-team packages milestone 2026-11-12 18:05:46 +00:00
Additional inputs (adversarial review of the team design, 2026-11-13)
Cited in the review; claims marked unverified where noted.
Gates are self-satisfiable.write:issue covers labels; write:repository likely allows approving PR reviews (Gitea scope table). Injection via issue text is demonstrated (Invariant Labs, GitHub MCP, 2025-05). Proposed: branch protection "restrict approvals to allowlisted users" excluding the bot + dismiss stale approvals + bot off merge whitelist; driver verifies gate-label actor against a human allowlist (timeline API shape unverified); requester ≠ approver.
Odd jobs break the credential boundary (agent would hold SSH/vault creds while reading untrusted input — "lethal trifecta") and leave no trace. Proposed: odd jobs run as a human-dispatched CI/AWX job; agent drafts command + limit; driver auto-logs the run. Revisits the #170 "no ticket" decision — the record is automatic, not human-written.
Headless sessions execute repo-controlled config (.claude/settings.json hooks, .mcp.json run under claude -p without trust prompt; --bare disables all hooks). Proposed: Gitea protected file patterns for agent config, AGENTS.md, CI and tests; driver launches from pinned config, never the PR branch's.
Infra plan artefact and GitOps fit. Make tofu plan / ansible --check --diff a required CI status + PR comment the human approves; apply the saved plan, fail if stale (Atlantis model; Gitea support unverified). Ansible check mode is incomplete and Ansible has no reconciling controller — add scheduled drift checks. Flux Helm remediation is off by default (retries: 0) — policy-check every HelmRelease. Decide apply-before-merge vs merge-then-apply.
## Additional inputs (adversarial review of the team design, 2026-11-13)
Cited in the review; claims marked unverified where noted.
1. **Gates are self-satisfiable.** `write:issue` covers labels; `write:repository` likely allows approving PR reviews (Gitea scope table). Injection via issue text is demonstrated (Invariant Labs, GitHub MCP, 2025-05). Proposed: branch protection "restrict approvals to allowlisted users" excluding the bot + dismiss stale approvals + bot off merge whitelist; driver verifies gate-label actor against a human allowlist (timeline API shape unverified); requester ≠ approver.
2. **Odd jobs break the credential boundary** (agent would hold SSH/vault creds while reading untrusted input — "lethal trifecta") and leave no trace. Proposed: odd jobs run as a human-dispatched CI/AWX job; agent drafts command + limit; driver auto-logs the run. Revisits the #170 "no ticket" decision — the record is automatic, not human-written.
3. **Headless sessions execute repo-controlled config** (`.claude/settings.json` hooks, `.mcp.json` run under `claude -p` without trust prompt; `--bare` disables all hooks). Proposed: Gitea protected file patterns for agent config, AGENTS.md, CI and tests; driver launches from pinned config, never the PR branch's.
4. **Infra plan artefact and GitOps fit.** Make `tofu plan` / `ansible --check --diff` a required CI status + PR comment the human approves; apply the saved plan, fail if stale (Atlantis model; Gitea support unverified). Ansible check mode is incomplete and Ansible has no reconciling controller — add scheduled drift checks. Flux Helm remediation is off by default (`retries: 0`) — policy-check every HelmRelease. Decide apply-before-merge vs merge-then-apply.
Tests read-only to implementer must be enforced, not prompted (ImpossibleBench: agents edit tests to pass; read-only stops edits but not special-casing). Decide the mechanism (hook, protected path, CI check that test files are unchanged since test-author's commit).
Pre-commit is a gate the agent must never bypass (--no-verify) — decide enforcement (server-side CI re-run is the backstop).
CI on branch push now runs before any PR exists — decide what credentials that CI holds (e.g. tofu plan needs state read access; --check may need vault — ties to the vault conflict above).
v1 is step mode only (human launches each stage); run mode via Gitea Actions later will need a runner holding agent credentials — scope with the credential boundary.
## Inputs from the revised #170 resolution
- **Tests read-only to `implementer`** must be *enforced*, not prompted (ImpossibleBench: agents edit tests to pass; read-only stops edits but not special-casing). Decide the mechanism (hook, protected path, CI check that test files are unchanged since `test-author`'s commit).
- **Pre-commit is a gate the agent must never bypass** (`--no-verify`) — decide enforcement (server-side CI re-run is the backstop).
- **CI on branch push** now runs before any PR exists — decide what credentials that CI holds (e.g. `tofu plan` needs state read access; `--check` may need vault — ties to the vault conflict above).
- v1 is step mode only (human launches each stage); run mode via Gitea Actions later will need a runner holding agent credentials — scope with the credential boundary.
Inputs from the Package boundaries and names resolution (#171)
No MCP server in v1 — owner's standing rule is CLI over MCP. Cluster access for agents is therefore only the kubectl / flux CLI under whatever kubeconfig the session holds; there is no MCP process to scope.
apm's trust gate would not have covered one anyway (verified on apm 0.28.0, local-path experiment): the root executables: allow: block does not gate MCP servers, and a self-defined server from a direct dependency is written to .mcp.json with no approval step. Relevant if MCP is ever revisited.
Name collisions never error in apm: a consumer's own same-named agent silently wins over a package's (warning only). Agents are prefixed delivery- to avoid this, but a gate that relies on "the reviewer that ran was ours" cannot assume it from the name alone.
Packages in scope for the per-tool command classification:ansible, gitops (Flux + Sealed Secrets), k8s; tofu reserved.
## Inputs from the Package boundaries and names resolution (#171)
- **No MCP server in v1** — owner's standing rule is CLI over MCP. Cluster access for agents is therefore only the `kubectl` / `flux` CLI under whatever kubeconfig the session holds; there is no MCP process to scope.
- **apm's trust gate would not have covered one anyway** (verified on apm 0.28.0, local-path experiment): the root `executables: allow:` block does not gate MCP servers, and a self-defined server from a direct dependency is written to `.mcp.json` with no approval step. Relevant if MCP is ever revisited.
- **Name collisions never error in apm**: a consumer's own same-named agent silently wins over a package's (warning only). Agents are prefixed `delivery-` to avoid this, but a gate that relies on "the reviewer that ran was ours" cannot assume it from the name alone.
- **Packages in scope for the per-tool command classification:** `ansible`, `gitops` (Flux + Sealed Secrets), `k8s`; `tofu` reserved.
Defame1297
was assigned by Claude2026-11-22 12:21:04 +00:00
Recorded as ADR-0032, Credentials, not hooks, are the agent safety boundary (docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md, merged in #185). The ADR holds the detail; in short:
Five tiers, assigned per command by each package skill: Read and Propose are free; Apply-by-merge is every infra change; Odd job is run by the agent in a HITL session the human started with the apply credentials, the hook asking before each command; Never is direct cluster mutation, helm changes, tofu destroy/state edits, --no-verify/SKIP=, decryption, and reading secret material.
Secrets: no Vault or Sealed Secrets decryption, no reading of vault password files, keys, .tfstate or Secrets. Stage sessions use a view kubeconfig plus a read-only SealedSecret role.
Vault conflict: stage sessions run only what works with a placeholder password (--syntax-check, ansible-lint, inventory reads). A real --check --diff runs in CI, which holds the password. Verified: whole-file vaults decrypt at load time, inline !vault values only when used, and /root/ansible CI already uses a placeholder for syntax and lint.
Apply gate: the dry run is a required PR status check and a PR comment, and the apply happens after merge. Applying before merge was rejected because Gitea doesn't support it.
Gates against the bot:
agents act as a dedicated bot user;
only approvals from an allowlist of humans count, stale approvals are dismissed, and the bot is not on the merge allowlist;
protected file patterns cover agent config, AGENTS.md, CI and tests;
stage leads check the issue timeline and start only if a user on the human allowlist set the gate label.
Verified: Gitea refuses self-approval (422), and a write:repository token can otherwise approve PRs.
Tests: the implementer never edits the test author's tests and hands disputed tests back. A CI check enforces that test paths are unchanged since the test author's commit, and the reviewer also checks it. A hook on test paths was rejected because a hook cannot tell the two roles apart on both runtimes.
Enforcement layers: skill instructions, then one guard hook shipped by delivery (deny the Never tier; ask for odd jobs where the runtime supports ask, deny them elsewhere), then host settings that are documented but not shipped, then the credential boundary, which is the real control, then pre-commit and CI as the backstop. There are no wrapper scripts.
Accepted risks (owner decision):
Odd jobs leave no durable record beyond the session. This departs from the governance logging rule.
An odd-job session holds apply credentials.
Deferred: launching headless sessions from pinned config moves to run mode; saved-plan staleness for tofu moves to OpenTofu specifics.
## Resolution
Recorded as ADR-0032, *Credentials, not hooks, are the agent safety boundary* (`docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md`, merged in #185). The ADR holds the detail; in short:
- **Five tiers**, assigned per command by each package skill: Read and Propose are free; Apply-by-merge is every infra change; Odd job is run by the agent in a HITL session the human started with the apply credentials, the hook asking before each command; Never is direct cluster mutation, `helm` changes, `tofu destroy`/state edits, `--no-verify`/`SKIP=`, decryption, and reading secret material.
- **Secrets:** no Vault or Sealed Secrets decryption, no reading of vault password files, keys, `.tfstate` or Secrets. Stage sessions use a `view` kubeconfig plus a read-only SealedSecret role.
- **Vault conflict:** stage sessions run only what works with a placeholder password (`--syntax-check`, `ansible-lint`, inventory reads). A real `--check --diff` runs in CI, which holds the password. Verified: whole-file vaults decrypt at load time, inline `!vault` values only when used, and `/root/ansible` CI already uses a placeholder for syntax and lint.
- **Apply gate:** the dry run is a required PR status check and a PR comment, and the apply happens after merge. Applying before merge was rejected because Gitea doesn't support it.
- **Gates against the bot:**
- agents act as a dedicated bot user;
- only approvals from an allowlist of humans count, stale approvals are dismissed, and the bot is not on the merge allowlist;
- protected file patterns cover agent config, AGENTS.md, CI and tests;
- stage leads check the issue timeline and start only if a user on the human allowlist set the gate label.
Verified: Gitea refuses self-approval (422), and a `write:repository` token can otherwise approve PRs.
- **Tests:** the implementer never edits the test author's tests and hands disputed tests back. A CI check enforces that test paths are unchanged since the test author's commit, and the reviewer also checks it. A hook on test paths was rejected because a hook cannot tell the two roles apart on both runtimes.
- **Enforcement layers:** skill instructions, then one guard hook shipped by `delivery` (deny the Never tier; ask for odd jobs where the runtime supports ask, deny them elsewhere), then host settings that are documented but not shipped, then the credential boundary, which is the real control, then pre-commit and CI as the backstop. There are no wrapper scripts.
- **Accepted risks (owner decision):**
- Odd jobs leave no durable record beyond the session. This departs from the governance logging rule.
- An odd-job session holds apply credentials.
- **Deferred:** launching headless sessions from pinned config moves to run mode; saved-plan staleness for tofu moves to OpenTofu specifics.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #166
Question
Turn the map's safety stance into a concrete, per-tool model: the exact command classification (free / approve-then-run / never) for Ansible, Flux/kubectl/Helm, and OpenTofu; what "explicit approval" looks like in a session and in an autonomous team run; the secrets rule (Ansible Vault, Sealed Secrets, kubeconfigs, tofu state); and which enforcement layers we adopt (hooks, wrappers, RBAC, instructions) given the hooks research. Likely ADR-worthy.
Inputs (from #168)
.apm/hooks/to Claude, Copilot, Codex, Gemini, Cursor (not OpenCode); it renames events but does not translate tool matchers. Codex/Gemini hooks deploy only if.codex//.gemini/already exist; Cursor output is unverified.viewkubeconfig, apply credentials the agent never holds, unreadable vault password, branch protection) → infra-repo pre-commit/CI. PATH wrapper scripts rejected as trivially bypassed.Inputs (from #170)
ansible-playbook/tofu applynow exists only as an odd job.Status/Ready for Agenton spec/tickets, PR review approval). Decide how "agents never set gate signals" is enforced — the agent's token currently haswrite:issueand can add labels.Conflict to resolve
The map's stance allows
ansible-playbook --checkfreely but forbids reading vault password files. A check run that loads vaulted vars likely needs the vault password (unverified against Ansible docs — verify first). Decide: gated check path, treat vault-touching check runs as approve-then-run, or relax the read rule with a scoped credential. (With GitOps, a check run could also move to CI on the PR.)Additional inputs (adversarial review of the team design, 2026-11-13)
Cited in the review; claims marked unverified where noted.
write:issuecovers labels;write:repositorylikely allows approving PR reviews (Gitea scope table). Injection via issue text is demonstrated (Invariant Labs, GitHub MCP, 2025-05). Proposed: branch protection "restrict approvals to allowlisted users" excluding the bot + dismiss stale approvals + bot off merge whitelist; driver verifies gate-label actor against a human allowlist (timeline API shape unverified); requester ≠ approver..claude/settings.jsonhooks,.mcp.jsonrun underclaude -pwithout trust prompt;--baredisables all hooks). Proposed: Gitea protected file patterns for agent config, AGENTS.md, CI and tests; driver launches from pinned config, never the PR branch's.tofu plan/ansible --check --diffa required CI status + PR comment the human approves; apply the saved plan, fail if stale (Atlantis model; Gitea support unverified). Ansible check mode is incomplete and Ansible has no reconciling controller — add scheduled drift checks. Flux Helm remediation is off by default (retries: 0) — policy-check every HelmRelease. Decide apply-before-merge vs merge-then-apply.Inputs from the revised #170 resolution
implementermust be enforced, not prompted (ImpossibleBench: agents edit tests to pass; read-only stops edits but not special-casing). Decide the mechanism (hook, protected path, CI check that test files are unchanged sincetest-author's commit).--no-verify) — decide enforcement (server-side CI re-run is the backstop).tofu planneeds state read access;--checkmay need vault — ties to the vault conflict above).Inputs from the Package boundaries and names resolution (#171)
kubectl/fluxCLI under whatever kubeconfig the session holds; there is no MCP process to scope.executables: allow:block does not gate MCP servers, and a self-defined server from a direct dependency is written to.mcp.jsonwith no approval step. Relevant if MCP is ever revisited.delivery-to avoid this, but a gate that relies on "the reviewer that ran was ours" cannot assume it from the name alone.ansible,gitops(Flux + Sealed Secrets),k8s;tofureserved.Resolution
Recorded as ADR-0032, Credentials, not hooks, are the agent safety boundary (
docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md, merged in #185). The ADR holds the detail; in short:Five tiers, assigned per command by each package skill: Read and Propose are free; Apply-by-merge is every infra change; Odd job is run by the agent in a HITL session the human started with the apply credentials, the hook asking before each command; Never is direct cluster mutation,
helmchanges,tofu destroy/state edits,--no-verify/SKIP=, decryption, and reading secret material.Secrets: no Vault or Sealed Secrets decryption, no reading of vault password files, keys,
.tfstateor Secrets. Stage sessions use aviewkubeconfig plus a read-only SealedSecret role.Vault conflict: stage sessions run only what works with a placeholder password (
--syntax-check,ansible-lint, inventory reads). A real--check --diffruns in CI, which holds the password. Verified: whole-file vaults decrypt at load time, inline!vaultvalues only when used, and/root/ansibleCI already uses a placeholder for syntax and lint.Apply gate: the dry run is a required PR status check and a PR comment, and the apply happens after merge. Applying before merge was rejected because Gitea doesn't support it.
Gates against the bot:
Verified: Gitea refuses self-approval (422), and a
write:repositorytoken can otherwise approve PRs.Tests: the implementer never edits the test author's tests and hands disputed tests back. A CI check enforces that test paths are unchanged since the test author's commit, and the reviewer also checks it. A hook on test paths was rejected because a hook cannot tell the two roles apart on both runtimes.
Enforcement layers: skill instructions, then one guard hook shipped by
delivery(deny the Never tier; ask for odd jobs where the runtime supports ask, deny them elsewhere), then host settings that are documented but not shipped, then the credential boundary, which is the real control, then pre-commit and CI as the backstop. There are no wrapper scripts.Accepted risks (owner decision):
Deferred: launching headless sessions from pinned config moves to run mode; saved-plan staleness for tofu moves to OpenTofu specifics.