---
title: "mutate"
description: "Change persistent state"
canonical: "https://acs.synapti.ai/capabilities/mutate/"
last_updated: "2026-11-16T01:14:10Z"
---

# mutate

Change persistent state

Generated from [schemas/capability_ontology.yaml](https://github.com/synaptiai/agent-capability-standard/blob/main/schemas/capability_ontology.yaml), [skills/mutate/SKILL.md](https://github.com/synaptiai/agent-capability-standard/blob/main/skills/mutate/SKILL.md) at commit 18c38b74ac21. Ontology version 2.2.0.

Layer: [EXECUTE](https://acs.synapti.ai/layers/execute/index.md)

## Safety

| Property | Value |
| --- | --- |
| Risk | High |
| Changes state | Yes |
| Needs checkpoint | Yes |
| Needs approval | Yes |
| Overridable | No |
| Blocked from autonomy | In 7 of 7 profiles |

**Figure: Ordering rules for mutate in a workflow.** In a workflow, checkpoint must run before it (V102); constrain should run before it (W601); plan and constrain, where the workflow has them, must come first (V102); where the workflow has verify, mutate must come before it (V102); each use needs approval; and it never shares a parallel group with rollback (F504).

| Where | Capability | Rule | Enforcement | Diagnostic |
| --- | --- | --- | --- | --- |
| Before mutate | [`plan`](https://acs.synapti.ai/capabilities/plan/index.md) | `precedes` | MUST | V102 |
| Before mutate | [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md) | `requires` | MUST | V102 |
| Before mutate | [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md) | `precedes` | MUST | V102 |
| Before mutate | [`constrain`](https://acs.synapti.ai/capabilities/constrain/index.md) | `soft_requires` | SHOULD | W601 |
| Before mutate | [`constrain`](https://acs.synapti.ai/capabilities/constrain/index.md) | `precedes` | MUST | V102 |
| Approval | Each use needs approval | `requires_approval` |  |  |
| After mutate | [`verify`](https://acs.synapti.ai/capabilities/verify/index.md) | `precedes` | MUST | V102 |
| Never in the same parallel group | [`rollback`](https://acs.synapti.ai/capabilities/rollback/index.md) | `conflicts_with` | MUST | F504 |

## Relationships

**Figure: Relationships of mutate: 12 relationships with 8 capabilities.** mutate has 12 relationships with 8 capabilities: 5 with edges into it and 3 with edges out of it; its conflicts_with edge with rollback runs both ways.

| Capability | Row | Relationships |
| --- | --- | --- |
| [`plan`](https://acs.synapti.ai/capabilities/plan/index.md) | Edges into mutate | `enables` (into), `precedes` (into) |
| [`generate`](https://acs.synapti.ai/capabilities/generate/index.md) | Edges into mutate | `enables` (into) |
| [`verify`](https://acs.synapti.ai/capabilities/verify/index.md) | Edges out of mutate | `precedes` (out of) |
| [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md) | Edges into mutate | `requires` (into), `precedes` (into) |
| [`rollback`](https://acs.synapti.ai/capabilities/rollback/index.md) | Edges into mutate | `conflicts_with` (both ways), `specializes` (into) |
| [`constrain`](https://acs.synapti.ai/capabilities/constrain/index.md) | Edges into mutate | `soft_requires` (into), `precedes` (into) |
| [`audit`](https://acs.synapti.ai/capabilities/audit/index.md) | Edges out of mutate | `enables` (out of) |
| [`persist`](https://acs.synapti.ai/capabilities/persist/index.md) | Edges out of mutate | `enables` (out of) |

- `requires`: Must run after [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md)
- `soft_requires`: Recommended after [`constrain`](https://acs.synapti.ai/capabilities/constrain/index.md)
- `enables`: Unlocks [`audit`](https://acs.synapti.ai/capabilities/audit/index.md), [`persist`](https://acs.synapti.ai/capabilities/persist/index.md)
- `enables`: Unlocked by [`plan`](https://acs.synapti.ai/capabilities/plan/index.md), [`generate`](https://acs.synapti.ai/capabilities/generate/index.md)
- `precedes`: Comes before, when both are present [`verify`](https://acs.synapti.ai/capabilities/verify/index.md)
- `precedes`: Comes after, when both are present [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md), [`plan`](https://acs.synapti.ai/capabilities/plan/index.md), [`constrain`](https://acs.synapti.ai/capabilities/constrain/index.md)
- `conflicts_with`: May not share a parallel group with [`rollback`](https://acs.synapti.ai/capabilities/rollback/index.md)
- `specializes`: Specialized by [`rollback`](https://acs.synapti.ai/capabilities/rollback/index.md)

## Contract

**Figure: Contract of mutate: 3 inputs (2 required), 7 outputs.** mutate takes 3 inputs, 2 required (filled pin) and 1 optional (hollow pin), and returns 7 outputs. The tables below list every field.

### Inputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | string | Yes | What to modify |
| `operation` | object | Yes | Modification to apply |
| `checkpoint_id` | string | No | Recovery checkpoint |

### Outputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Yes |  |
| `previous_state` | any | No | State before mutation |
| `new_state` | any | No | State after mutation |
| `evidence_anchors` | array of Anchor (or deprecated string or object) | Yes | What the output is based on, as evidence anchors (Standard v1.2 §6.5). An empty list grounds nothing, and the output is then marked inferred (§3.1). |
| `confidence` | number | No | The producer's probability that the output's claim is correct, self-reported; given when the output is inferred (Standard v1.2 §3.1, §4.1.1) From 0 to 1 |
| `inference_method` | string | No | How the output was reached when it is not grounded in evidence; with confidence it marks the output inferred (Standard v1.2 §3.1, §4.1.1). A producer should use model_knowledge, deduction, induction, abduction, analogy, statistical, simulation, assumption or an x- vendor value; a grounding policy (§5.20) requires one of them. |
| `uncertainty` | Uncertainty | No | The uncertainty of the output's principal value; its confidence equals the output's confidence (Standard v1.2 §4.1.1) |

The skill returns 9 fields: 4 are in mutate's output contract (2 required) and 5 are the skill's own, outside the contract; it leaves out 3 contract fields (confidence, inference_method, uncertainty).

| Field of the skill's output | In the output contract |
| --- | --- |
| `success` | Yes, required |
| `target` | No, the skill's own |
| `operation` | No, the skill's own |
| `previous_state` | Yes, optional |
| `new_state` | Yes, optional |
| `diff` | No, the skill's own |
| `checkpoint_id` | No, the skill's own |
| `rollback_command` | No, the skill's own |
| `evidence_anchors` | Yes, required |
| `confidence` | Yes, but the skill leaves it out |
| `inference_method` | Yes, but the skill leaves it out |
| `uncertainty` | Yes, but the skill leaves it out |

## Used in workflows

**Figure: mutate in workflows.** 1 workflow uses mutate, in 1 step in all; its steps are the squares in an ink ring, and the key under the strips names the other squares.

- [`digital_twin_sync_loop`](https://acs.synapti.ai/workflows/digital-twin-sync-loop/index.md): step 16

## Claude Code skill

**Figure: What the mutate skill's tools can do, against the ontology.** The skill may use 4 tools: 1 only read, 1 run commands and 2 change files; the ontology marks mutate as changing state, and Bash, Edit and Write can make the change.

| What they can do | Tools |
| --- | --- |
| Only read | `Read` |
| Run commands, which can change state | `Bash` |
| Change files | `Edit`, `Write` |

**Figure: The field names each step of the mutate procedure uses.** 6 of the procedure's 6 steps use the name of an input or output field of the mutate skill as a word; 2 output fields of 9 are used by no step (rollback_command, evidence_anchors).

| Step | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. Verify checkpoint exists | `target`, `checkpoint_id` | `target`, `checkpoint_id` |
| 2. Capture previous state | `target` | `target`, `previous_state` |
| 3. Apply mutation | `operation` | `operation` |
| 4. Verify change |  | `new_state` |
| 5. Record mutation | `operation` | `operation`, `new_state`, `diff` |
| 6. Return result |  | `success` |

All 3 examples of the skill write out every one of its 9 output fields.

**Figure: The field names each verification check of the mutate skill uses.** 3 of the 5 checks use the name of an input or output field as a word; 6 output fields of 9 are named by no check (success, target, operation, diff, checkpoint_id and evidence_anchors).

| Check | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. Checkpoint exists and is valid |  |  |
| 2. Previous state captured before mutation |  | `previous_state` |
| 3. New state verified after mutation |  | `new_state` |
| 4. Diff accurately reflects change |  |  |
| 5. Rollback command is correct |  | `rollback_command` |

**Figure: The neighbours the skill lists for mutate, checked against the ontology and the catalogs.** The skill lists 6 capabilities as common neighbours of mutate; 6 of them have an edge with it in the ontology, and 1 runs next to it, in that order, in a catalog workflow (checkpoint most often, 1 time). Under each tile, an edge reads from its source to its target, with mutate's symbol in its place: "requires Mt" is a requires edge from the tile's capability to mutate, so the tile's capability must run before mutate; "Mt precedes" is a precedes edge from mutate to the tile's capability.

| Listed as | Capability | Ontology edge | Next to it in a workflow |
| --- | --- | --- | --- |
| commonly follows | [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md) | `requires`, `precedes` | 1 times |
| commonly follows | [`plan`](https://acs.synapti.ai/capabilities/plan/index.md) | `enables`, `precedes` | never |
| commonly follows | [`constrain`](https://acs.synapti.ai/capabilities/constrain/index.md) | `soft_requires`, `precedes` | never |
| commonly precedes | [`verify`](https://acs.synapti.ai/capabilities/verify/index.md) | `precedes` (into it) | never |
| commonly precedes | [`audit`](https://acs.synapti.ai/capabilities/audit/index.md) | `enables` (into it) | never |
| commonly precedes | [`rollback`](https://acs.synapti.ai/capabilities/rollback/index.md) | `conflicts_with` (into it), `conflicts_with`, `specializes` | never |

### Intent

Make controlled changes to persistent state with safety guarantees. This is the primary capability for modifications and REQUIRES a checkpoint for rollback capability.

**CRITICAL: This capability requires `checkpoint` to have been called first.**

**Success criteria:**
- State change applied correctly
- Previous state captured for rollback
- Change is verifiable
- Audit trail recorded

**Compatible schemas:**
- `schemas/output_schema.yaml`

### Inputs

| Parameter | Required | Type | Description |
|-----------|----------|------|-------------|
| `target` | Yes | string | What to modify (file path, resource identifier) |
| `operation` | Yes | object | The modification to apply |
| `checkpoint_id` | No | string | Checkpoint ID for rollback (from `checkpoint` capability) |

Inputs not listed here are outside the capability's contract: a workflow step that binds them gets W604 (STANDARD v1.1 §5.5).

### Procedure

1) **Verify checkpoint exists**: Ensure recovery is possible
   - Confirm checkpoint_id references valid checkpoint
   - Verify checkpoint covers the target
   - STOP if no valid checkpoint

2) **Capture previous state**: Record what will change
   - Read current state of target
   - Store for comparison and rollback
   - Document what specifically will change

3) **Apply mutation**: Make the change
   - Execute the specified operation
   - Use appropriate tool (Edit for files, Bash for commands)
   - Capture any errors during modification

4) **Verify change**: Confirm mutation succeeded
   - Read new state
   - Compare to expected result
   - Note any unexpected side effects

5) **Record mutation**: Document what changed
   - Store diff between previous and new state
   - Record timestamp and operation details
   - Link to checkpoint for audit trail

6) **Return result**: Provide complete mutation record
   - Include success/failure status
   - Provide before/after state
   - Reference checkpoint for rollback

### Output Contract

Return a structured object:

```yaml
success: boolean  # Whether mutation completed
target: string  # What was modified
operation: string  # What was done
previous_state:
  snapshot: any  # State before mutation
  captured_at: string  # When captured
new_state:
  snapshot: any  # State after mutation
  verified_at: string  # When verified
diff:
  type: string  # unified, structural, summary
  content: string  # The actual diff
checkpoint_id: string  # For rollback reference
rollback_command: string  # How to undo this change
evidence_anchors: [{ref: "file:line", kind: file}, {ref: "command:output", kind: tool}]
```

#### Field Definitions

| Field | Type | Description |
|-------|------|-------------|
| `success` | boolean | Whether mutation completed successfully |
| `target` | string | Resource that was modified |
| `operation` | string | Description of the change |
| `previous_state` | object | State before modification |
| `new_state` | object | State after modification |
| `diff` | object | Difference between states |
| `checkpoint_id` | string | Reference for rollback |
| `rollback_command` | string | How to undo the change |
| `evidence_anchors` | array of evidence anchors (§6.5) | References to the changed location and the command output |

### Examples

#### Example 1: File Modification

**Input:**
```yaml
target: "src/services/user_service.rb"
operation:
  type: "edit"
  description: "Add null check for user parameter"
  changes:
    - line: 42
      old: "user.email"
      new: "user&.email"
checkpoint_id: "chk-20240115-001"
```

**Output:**
```yaml
success: true
target: "src/services/user_service.rb"
operation: "Added safe navigation operator for null user handling"
previous_state:
  snapshot: "def get_email(user)\n  user.email\nend"
  captured_at: "2024-01-15T10:30:00Z"
new_state:
  snapshot: "def get_email(user)\n  user&.email\nend"
  verified_at: "2024-01-15T10:30:01Z"
diff:
  type: "unified"
  content: |
    @@ -42 +42 @@
    -  user.email
    +  user&.email
checkpoint_id: "chk-20240115-001"
rollback_command: "git checkout src/services/user_service.rb"
evidence_anchors:
  - {ref: "file:src/services/user_service.rb:42", kind: file}
```

#### Example 2: Database Mutation

**Input:**
```yaml
target: "users table"
operation:
  type: "sql"
  description: "Add status column with default value"
  sql: "ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active'"
checkpoint_id: "chk-20240115-002"
```

**Output:**
```yaml
success: true
target: "users table"
operation: "Added status column with default 'active'"
previous_state:
  snapshot:
    columns: ["id", "email", "created_at"]
  captured_at: "2024-01-15T11:00:00Z"
new_state:
  snapshot:
    columns: ["id", "email", "created_at", "status"]
  verified_at: "2024-01-15T11:00:05Z"
diff:
  type: "structural"
  content: "+ status VARCHAR(20) DEFAULT 'active'"
checkpoint_id: "chk-20240115-002"
rollback_command: "ALTER TABLE users DROP COLUMN status"
evidence_anchors:
  - {ref: "command:psql:schema_after", kind: tool}
```

#### Example 3: Mutation Failure

**Input:**
```yaml
target: "config/database.yml"
operation:
  type: "edit"
  description: "Update connection pool size"
checkpoint_id: "chk-20240115-003"
```

**Output:**
```yaml
success: false
target: "config/database.yml"
operation: "Update connection pool size (FAILED)"
previous_state:
  snapshot: "pool: 5"
  captured_at: "2024-01-15T12:00:00Z"
new_state:
  snapshot: null
  verified_at: null
diff:
  type: "none"
  content: "Mutation failed: file locked by another process"
checkpoint_id: "chk-20240115-003"
rollback_command: "N/A - mutation did not complete"
evidence_anchors:
  - {ref: "error:file_locked", kind: tool}
error:
  message: "File locked by another process"
  recoverable: true
  suggestion: "Retry after process releases lock"
```

### Verification

- [ ] Checkpoint exists and is valid
- [ ] Previous state captured before mutation
- [ ] New state verified after mutation
- [ ] Diff accurately reflects change
- [ ] Rollback command is correct

**Verification tools:** Read (to verify state changes)

### Safety Constraints

- `mutation`: true
- `requires_checkpoint`: true
- `requires_approval`: true
- `risk`: high

**Capability-specific rules:**
- NEVER mutate without valid checkpoint
- Always capture previous state before modification
- Verify change matches intended operation
- Provide working rollback mechanism
- Stop immediately on unexpected errors
- Do not chain multiple mutations without intermediate checkpoints

### Composition Patterns

**Commonly follows:**
- `checkpoint` - REQUIRED before any mutation
- `plan` - Mutations execute planned changes
- `constrain` - Check policy constraints before mutating

**Commonly precedes:**
- `verify` - Verify mutation results
- `audit` - Record mutation for audit trail
- `rollback` - Undo mutation if verification fails

**Anti-patterns:**
- NEVER mutate without checkpoint
- Never combine multiple risky mutations
- Avoid mutation in exploratory workflows

**Workflow references:**
- See `reference/workflow_catalog.yaml#debug_code_change` for mutation in bug fixes
- See `reference/workflow_catalog.yaml#digital_twin_sync_loop` for mutation in sync loops
