# The decision trace

> One audit trail for both kinds of actor, carrying model id, prompt hash, token counts, cost, latency and attempts - on the workflow path as well as the interactive one

Source: https://aipril.dev/docs/harness/traces

## One trail

Every workflow-driven connector call, every agent decision and every interactive chat tool call is
persisted to the platform's audit trail. The interactive loop records at one shared point after
dispatch, not per branch.

The trail carries people and AI employees under their own names, so an actor question is answerable
without first establishing which kind of actor it was.

## What a record carries

Beyond the call and its result:

| Field | Purpose |
|---|---|
| Model id | Which model answered |
| Prompt hash | 16-char content digest of the assembled system prompt |
| Prompt / completion tokens | Consumption |
| Cost | In the credit engine's unit |
| Latency | Wall time |
| Attempts | Distinguishes a first-attempt success from a retried one |

The prompt hash is what makes the rest comparable: two calls that behaved differently can be checked
for whether they were given identical instructions.

## Both execution paths

The trace is recorded on the interactive path and on the workflow path - an agent invoked as a step
inside a durable orchestration, including across its schema-retry loop, and on the digital-employee
bridge.

A test pins coverage, asserting the trace reaches the persisted record and mocking the storage layer
instead of the recording function, so it exercises the real wiring.

## Denials

A tool call refused by the [gate](https://aipril.dev/docs/harness/invocation.md) is written with a `denied` status and a
reason code separating a guardrail block from a refused approval - not as an error string on a
generic row. "How often does the approval gate fire" is a query, not an estimate.

## Redaction

Arguments and output pass through a redaction pipeline before persistence, so the record of an action
is not itself a store of personal data.

A separate pre-dispatch rule blocks a call that would send personal data outward to a third-party
channel before it runs. Recording internally and transmitting externally are handled as two
mechanisms with two verdicts.

## Two signals

Alongside the persisted trail there is a console-level decision trace: a lower-fidelity signal for
debugging non-deterministic agent behaviour without querying the database. The persisted trail is the
record; the console signal is a development aid.

## Access

The trail is per organisation like the rest of this block, and reading it is an ordinary platform
permission. See [Built for a multi-tenant platform](https://aipril.dev/docs/harness/built-for-a-platform.md).
