Skip to content

Latest commit

 

History

History
84 lines (68 loc) · 4.78 KB

ops-agent.md

File metadata and controls

84 lines (68 loc) · 4.78 KB

Ops agent

Status: slice 1 (read-only) is implemented in configuration and proven live on 2026-11-12 (task 8c6ee58c answered a restart question; task d171cfb1 confirmed the private-namespace refusals). Its kagent and infrastructure parts are in the deployment repository; this spec covers how Mainloop reaches it.

The ops agent answers questions about the owner's home cluster and homelab: pods, logs, events, alerts, Argo CD applications and node health. It follows the infrastructure repository's ops-agent pattern (k8s/components/ops-agent/README.md): the model decides, and a tool server that holds the credentials says no. Its Session holds no credentials and reaches nothing but its MCP servers.

How main reaches it

No dedicated API or task kind exists. The ops agent is an operator provider profile, ops, in PROVIDER_PROFILES (see Provider profiles), with one role:

{
  "id": "ops",
  "display_name": "Ops (home cluster, read-only)",
  "native_provider": "claude",
  "configuration_revision": "ops-readonly-v1",
  "agents": { "supervisor": { "namespace": "kagent", "name": "ops" } }
}

Main hands over an ops request with delegate, mode: "coordination" and provider_profile_id: "ops" (see Task delegation). The task is an ordinary top-level coordination task:

  • Its attempt runs the kagent Agent ops as a supervisor at depth one, with a coordination MCP grant. It has no repository authority, and it reports through report like any supervisor.
  • The profile has no child, agent or main role. The ops agent therefore cannot delegate children, cannot run as a code task, and cannot become the main thread. Each of those resolves to "provider has no Agent" and is refused.
  • Its Sessions use the Agent SDK driver. The ops Agent is listed in MAINLOOP_LIVE_AGENTS, so the live view serves them like any other live session.

What it can do (slice 1)

The agent's tool server, ops-tools, is read-only. It reads Kubernetes objects except Secrets and ConfigMaps (never pod or workload specs), events, pod logs, VictoriaLogs and VictoriaMetrics queries, firing alerts, Argo CD application status and which resources are out of sync, and node health. It refuses logs and content-bearing metrics from the private namespaces, and it redacts secret-looking strings. It has no exec, port-forward, apply, sync or 1Password access. Kubernetes RBAC (a read-only ClusterRole without Secrets) is the boundary, and the server enforces the rest.

It also reads Omni and Talos (oldsj/infrastructure#1112, implemented in configuration, not yet proven live): the cluster as Omni sees it (omni_cluster), every machine with its stage and errors (omni_machines), node join progress (node_join_progress), a machine's Talos services (talos_services) and etcd status (etcd_status). Their credential is an Omni service account with role Reader, which Omni forwards to Talos as os:reader. The owner creates it as the 1Password item ops-tools-omni-read; until then those tools say so and the rest work. Only the tool server holds it. The server reads only the Omni types it lists and returns only the fields each tool picks, never join tokens, config patches or a machine's kernel command line.

The tool server authenticates the ops Agent's Sessions with a bearer that kagent's egress gateway injects from a Secret. The native agent sees only a placeholder. Mainloop names no credential for it: Mainloop's own MCP credential is the only Session credential it sends, as for any coordination task (see Credentials).

Permission mode: the ops Harness starts Sessions in Claude's auto mode (KAGENT_CLAUDE_PERMISSION_MODE=auto). An action the classifier holds surfaces as an approval request. The live view can still switch the mode for each Session.

Follow-up after the report

An ops request is a coordination task. Once the agent reports and the task completes, the owner (the task page's "Follow up" box) or main (follow_up) can send it another message: the task reopens on the same native session, with the earlier conversation intact (see tasks). A task whose kagent Session is gone is refused rather than given a fresh Session without the context; a retry starts the task again in a new session, with the last report in its brief.

Not yet built (slice 2, designed)

  • Writes (kubectl apply, Argo sync, Talos actions, 1Password reads) as tools bound with requireApproval. The harness pauses before each call, and the pause surfaces as an approval request on the task, the same human-in-the-loop path as other approval cards. The tool server holds the write credentials. Merges to the infrastructure repository stay human.
  • Home Assistant and OpenCozy go to main, not the ops agent, read-only: see home tools.