Skip to content

Audit

Audit tools provide access to the change log and support rolling back individual changes or entire agent sessions. Every database mutation is automatically logged by a Postgres trigger, recording the before/after state, user ID, agent ID, and session ID.

get_change_log

View change history for a record, by agent, or by session.

Parameters

ParameterTypeRequiredDescription
record_idstring (UUID)NoFilter by specific record
table_namestringNoFilter by table name (e.g. "outlet", "opportunity")
agent_idstringNoFilter by agent identifier
agent_sessionstringNoFilter by agent session ID
limitnumberNoMax results (default: 50)

Example

json
{
  "name": "get_change_log",
  "arguments": {
    "record_id": "550e8400-e29b-41d4-a716-446655440000",
    "limit": 10
  }
}

Response Shape

Each entry in the change log contains:

json
{
  "id": 42,
  "table_name": "opportunity",
  "record_id": "550e8400-...",
  "action": "update",
  "old_values": { "stage": "pitched", "..." : "..." },
  "new_values": { "stage": "responded", "..." : "..." },
  "user_id": "...",
  "agent_id": "claude-cowork",
  "agent_session": "session-abc-123",
  "created_at": "2026-04-07T14:30:00Z"
}

rollback_change

Revert a specific change by its change_log ID.

  • For inserts: the created record is archived (soft-deleted).
  • For updates/archives/restores: the old field values are restored.

Parameters

ParameterTypeRequiredDescription
change_log_idnumberYesID of the change_log entry to revert

Example

json
{
  "name": "rollback_change",
  "arguments": {
    "change_log_id": 42
  }
}

rollback_session

Revert all changes from an agent session in reverse chronological order. This is useful for undoing an entire batch of work made by an agent in a single session.

Parameters

ParameterTypeRequiredDescription
agent_sessionstringYesAgent session ID to revert

Example

json
{
  "name": "rollback_session",
  "arguments": {
    "agent_session": "session-abc-123"
  }
}

Response Shape

Rolled back 5 changes:
Reverted update on opportunity 550e8400-...
Reverted update on contact 660e8400-...
Archived outlet 770e8400-...
Reverted update on campaign 880e8400-...
Reverted update on opportunity 990e8400-...