get_maintenance_review returns a packet
of maintenance pressure across goals, merged lineage, confidence outliers, heartbeat
repetition, memory counts, shared-file bridge status, and helper-model posture. The
packet is explicitly read_only: true,
mutation_allowed: false — no provider, worker, or
webhook calls, and nothing is changed.
Product 22 · SDK / CLI / MCP · Wave 2
Agent Maintenance Protocol
Long-lived agents need a checkup — with a human signature. Agent Maintenance Protocol gives an agent a disciplined way to tidy its own state: it surfaces maintenance pressure read-only, builds an executable preview, and then mutates state only after a matching typed approval. Review, approve, execute — strictly separated, never collapsed.
Self-maintenance is exactly the authority you don't want unsupervised.
An agent that runs for weeks accumulates cruft: duplicate or stale goals, repeated heartbeat motifs, memory tables that have outgrown their usefulness, handoff files that were never registered. Left unattended, this drift quietly degrades the agent. But the obvious fix — letting the agent clean up after itself — is dangerous, because self-maintenance is exactly the kind of broad, mutating authority you do not want an agent to exercise unsupervised.
The failure mode is a maintenance pass that reviews and edits in one motion: the agent decides something looks stale and deletes it in the same breath, with no checkpoint where a human could see the proposed change before it happened. A helper model proposing housekeeping is useful; a helper model that can directly mutate goals and memory is a liability.
Agent Maintenance Protocol enforces the separation that makes self-maintenance safe. A
read-only review phase can look at everything and change nothing. A preview phase turns
proposals into concrete, fingerprinted actions and a matching approval template. Execution
mutates state only when a caller supplies a typed approval whose
approval_token,
preview_id, and
action ids all match the preview. The
phases cannot be short-circuited.
Review → Approve → Execute
preview_maintenance_execution normalizes
proposed actions into executable previews, computes a
preview_id, and emits the exact
MAINTENANCE_EXECUTION_APPROVAL block a human must
return. Helper output is never executed directly — between review and execute sits a
real human gate: a person reads the preview and signs the typed approval, or nothing
proceeds.
execute_approved_maintenance mutates
state only if the approval is approved=true, the
approval_token matches, the
preview_id matches the current preview, and every
approved action id is known and executable. It then writes a
change_log receipt. Any mismatch is
blocked with a named reason.
Four phases, one human gate
The model below is derived directly from the originating agent's maintenance lane and its review/execution services. Each phase is individually inspectable, and the phases cannot be collapsed: review and preview never mutate, and execution rejects on any approval mismatch.
| Phase | What runs | Mutation | Gate |
|---|---|---|---|
| review | Surface maintenance pressure across goals, heartbeat, memory, shared files, helper posture. | None — read_only: true, mutation_allowed: false. |
n/a (no side effects). |
| preview | Normalize actions into executable previews, list blockers, compute preview_id, emit approval template. |
None — read_only: true. |
Actions must be a supported type (goal_merge) and pass per-action checks. |
| approve | A human returns a typed MAINTENANCE_EXECUTION_APPROVAL block. |
None. | approved=true and correct approval_token and matching preview_id and known approved_action_ids. |
| execute | Apply approved actions, then write a change_log receipt. |
Yes — scoped to approved action ids only. | Preview must be executable (no blockers); unknown ids are rejected. |
| Field | Requirement |
|---|---|
| approved | Must be true; anything else blocks with a reason. |
| approval_token | Must match the token the preview emitted — approval token missing or incorrect otherwise. |
| preview_id | Must match the current preview — approval preview_id does not match current preview otherwise. |
| approved_action_ids | Every id must be known and executable — approved_action_ids contains unknown action ids otherwise. |
Separation guarantees (grounded in source): review and preview never mutate; execution
rejects with a named reason on any mismatch (including preview has blockers);
and a change_log receipt is written on every successful execution.
goal_merge,
and an agent-specific approval token. Generalizing the action catalog (broader
maintenance actions beyond goal_merge)
and the approval identity (who may sign, and how their identity is verified) is
proposed, not yet built.
MCP tools
The MCP tools below ship in the published package (v0.1.1). They were extracted from the originating agent's maintenance routes and services.
GET /review → build_maintenance_review)preview_id, and the required typed approval block — without mutating state. (POST /execution/preview → build_maintenance_execution_preview)MAINTENANCE_EXECUTION_APPROVAL block a human must sign for a given preview. (emitted by the preview; parse_maintenance_execution_approval consumes it)POST /execution/execute → execute_approved_maintenance)Install
Agent Maintenance Protocol is a CertaWorks Wave 2 product — built, tested, and published on npm. The commands below install the package — an SDK, a CLI, and an MCP server, consistent with the rest of the suite — so you can see exactly what it exposes.
Running it, or want to help shape what comes next? Use the feedback form below.
The package @certaworks/agent-maintenance-protocol
is live on npm. Install it globally, or point your MCP client at it with the config below
(its MCP server command is agent-maintenance-mcp).
npm install -g @certaworks/agent-maintenance-protocol
{
"mcpServers": {
"agent-maintenance-protocol": {
"command": "npx",
"args": ["-y", "-p", "@certaworks/agent-maintenance-protocol", "agent-maintenance-mcp"]
}
}
}
What Agent Maintenance Protocol does and does not do
- Surface maintenance pressure in a strictly read-only review
-
Turn proposals into concrete, fingerprinted, previewable actions with a
preview_id - Require a typed approval whose token, preview id, and action ids all match
-
Execute only the approved action ids and write a
change_logreceipt - Keep each phase separable and individually inspectable
- Run fully local as a CLI / MCP server / SDK
- Execute maintenance without explicit human approval
- Mutate anything during review or preview
- Execute helper-model output directly, or proceed on a missing, malformed, or mismatched approval
-
Run unsupported action types — the slice supports
goal_mergeonly (broader actions proposed) - Call providers, start workers, or dispatch webhooks during maintenance
- Replace human judgment about what maintenance is correct
Related Products
Using Agent Maintenance Protocol? Tell us how it goes
Agent Maintenance Protocol is part of CertaWorks Wave 2 — a second set of built tools productized from a working cognitive agent. It's on npm now. Tell us what you're running it against, what broke, or what you'd want next — we read every note.