ConfigHub · Durable config for coding agents
Docs / docs/agents-that-run-for-weeks.md Source on GitHub →

Agents that run for weeks: who acted, who agreed, and how to stop them

This page is for teams that let AI agents change infrastructure configuration unattended, for days or weeks, several at once. Over that time, a team needs to know which agent made each change, who agreed to it, and how to stop an agent at once. This page says what ConfigHub and the Claude plugin already do about each problem, what may still be needed, and what is left to other tools.

To try stopping an agent, finding its change and putting it back, follow the walkthrough an agent did something wrong. To give each party a key of its own, made by its holder, follow a key each.

The problems:

The words on this page, such as hub, base and change order, are explained in the glossary.

What works now

Who acted: give the agent a key of its own

The problem. An agent working under your sign-in can do anything you can, including approve its own change. Its changes look like yours.

What you do. Give the agent a service account and key of its own:

cub agent require-approval COMPONENT --variant live --agent bot

With that key, the agent may change the base, ask for a change with a change order, and read the copy that runs. It cannot approve, promote, or write the copy that runs. Its changes are recorded as revisions made by it, not by you. A session that the agent signs in with its key lasts up to 24 hours.

The command also writes the Claude Code settings that start the agent's sessions on that key, with your own sign-in kept out of their reach. Start each agent session with:

env -u CUB_CONFIG -u CUB_CONTEXT claude --settings ~/.confighub-agent-bot/claude-settings.json

A CUB_CONFIG or CUB_CONTEXT set in your shell would win over the file's, which is why env -u removes them. If one does reach the agent, the sandbox still refuses it your configuration, and the agent can't use your sign-in. In the app's own folder, the Claude plugin gives a new session the agent's settings even when your shell sets CUB_CONFIG.

On a shared hub on confighub.com, the same steps with cub alone are in approvals.

Who agreed: require approval of the exact change

The problem. Nobody approved this particular change.

What you do. The same require-approval command makes the copy that runs change only when a person you named approves the exact revision. The approval covers the revisions it was given. The agent's next change waits for an approval of its own.

For example, an agent proposes a sale banner for the api:

Use a person's approval for the copy that runs in production. For weeks of unattended work, a person approving each change would not scale anywhere else. Elsewhere, the agent's rights on each Space are the control: it may edit the base, and may only read the copy that runs.

A record the agent cannot change

The problem. The agent can delete the record of what it did.

The Claude plugin keeps the record:

What you do. Deny the agent writes to the record. The settings that require-approval --agent writes include this. For the Claude plugin alone, see keeping the record out of the agent's reach.

Told plainly to delete its record, an agent will delete the repository's copy and commit the deletion. With the record denied to the agent's writes, the same request fails with "Operation not permitted". The Claude plugin's hooks aren't sandboxed, so recording goes on.

The record is also signed, each entry as it is written. If anyone changes an entry afterwards, the change shows when the record is checked. On a cluster, each entry can be signed with the agent's own SPIFFE identity, so the record names the agent rather than the node it ran on. When the identity is withdrawn, the agent's later changes are recorded unsigned, and the check fails (signing with the agent's own identity). With a hub, a digest of the latest signature, a short fingerprint of it, is kept there as an attestation, which no one can change; comparing the record with it is done by hand today. You can check the signatures with Sigstore's cosign (signed records).

Stopping an agent

The problem. Deleting an agent's service account refuses its key, but leaves its rights in place. A session it already has open keeps working.

What you do. Take the agent's rights away first. Its open session is then refused at its next request ("space api-base not found").

The stop is manual. A person runs it, for one agent at a time, or for the whole hub.

Tracing: why a value is what it is

The problem. Traces say what ran, not why a value is what it is.

What you do. Set CUB_MINI_OTEL=1, and set CUB_MINI_OTEL_ENDPOINT to your OpenTelemetry collector's OTLP/HTTP address. The Claude plugin then sends each value changed, each command that changed something, and each reason, as log events. They carry the same session.id as the events Claude Code sends when its own telemetry is on.

The agent's request is sent only with OTEL_LOG_USER_PROMPTS=1, the same setting Claude Code uses for prompts. A credential's values are never sent.

Each turn's model use, its model, calls and tokens, is sent too, as confighub.model_use, and kept in the record (model use).

Both kinds of event arrive under one session.id. For example, first comes confighub.value_changed with replicas 2 → 4, then confighub.reason, "Friday flash sale expected to quadruple api traffic".

Limiting what an agent can reach

The problem. The gate covers only what deploys from the hub, that is, Argo CD or Flux pulling approved versions over OCI (GitOps over OCI). An agent that also holds cluster credentials can go around it.

What you do. Give agents no cluster credentials, or a Kubernetes ServiceAccount that cannot write what the hub deploys. Where clusters still deploy from Git, branch protection on that repository is the gate.

What may still be needed

None of these is built. Each is here because a team running many agents for weeks may need it.

What ConfigHub does not need to do

These matter for agents that run for weeks, but they are not configuration's job. Other tools do them, and ConfigHub works beside those tools.

More in what we do not claim.