action.log
LiveLog an action event to the Cortex action ledger.
Description
Persists a consequential action to the action_ledger with co-committed audit row. Use after trust.check for coding.* and other governed action classes.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
action_class | string | yes | Action class, e.g. "coding.git_push", "coding.git_commit", "coding.shell_exec". |
counterparty | string | no | Counterparty slug, e.g. "repo:cortex-ai/main". Resolved to UUID via extension_counterparties. |
outcome | "completed" | "skipped" | "failed" | yes | Action outcome at time of logging. |
description | string | no | Human-readable description of the action taken. |
metadata | Record<string, unknown> | no | Optional structured metadata (commit SHA, file paths, exit_code, etc.). |
idempotency_key | string | no | Optional caller-supplied idempotency key. Generated automatically if omitted. |
autonomy_level | 1 | 2 | 3 | no | Autonomy level at time of action. Defaults to 1 if not supplied. |
Output shape
typescript
{
ok: boolean;
ledger_entry_id?: string;
error?: string;
message?: string;
}Example call
JSON-RPC tools/call request body (omit the JSON-RPC envelope when using an SDK; the SDK adds it for you):
jsontools/call params
{
"name": "action.log",
"arguments": {
"action_class": "coding.git_commit",
"counterparty": "repo:cortex-ai/main",
"outcome": "completed",
"description": "chore: verify dogfood",
"metadata": { "commit_sha": "abc123" }
}
}Example response
Tool results are always wrapped as content[0].text with a stringified JSON body. The shape below is what you get back from JSON.parse(result.content[0].text):
jsonparsed result body
{
"ok": true,
"ledger_entry_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}Errors this tool can return
| Code | Meaning |
|---|---|
invalid_arguments | Tool input failed Zod validation. |
unauthorized | Missing or invalid bearer token. |
write_failed | The tool could not persist the requested write (ledger, episode correction, etc.). |
See the full error catalog for resolution steps on each code, plus the standard transport-layer responses (401, 429).