> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mortemlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analysis — LLM-powered autopsy for every trace

> After a trace completes, Mortem queues it for LLM-powered analysis. Learn what the autopsy tells you, when it appears, and how to request a fresh diagnosis.

When a trace completes, Mortem automatically queues it for LLM-powered analysis. The analysis worker reads the full event chronology — every LLM call, tool output, and Solana transaction — and produces a structured autopsy that identifies what the agent decided, what context it relied on, which two or three moments most influenced the outcome, and what you should change before the next run. You don't need to configure anything; analysis runs automatically on every completed trace.

## Where analysis appears

The autopsy appears in the **Dossier** panel on the trace detail page at `/app/traces/[id]`. Scroll down past the trace metrics to find the **Autopsy** section. If the analysis is not yet available, the section reads "Autopsy is queued once the trace completes."

<Note>
  Analysis is asynchronous. It typically appears a few minutes after a trace completes, depending on the trace size and the current analysis queue. Refresh the trace detail page to check for an updated result.
</Note>

## What the autopsy contains

A completed autopsy includes the following fields:

| Field                 | What it answers                                                                                         |
| --------------------- | ------------------------------------------------------------------------------------------------------- |
| **Summary**           | A one-sentence description of what the agent decided and what outcome it produced                       |
| **What agent saw**    | The market data, tool outputs, and context the model had access to                                      |
| **What agent missed** | Information that was absent, stale, or misweighted at the critical decision point                       |
| **Suggested fix**     | A concrete change to make in your strategy code before the next run                                     |
| **Failure type**      | A classification of the root cause (e.g., `market_condition`, `missing_information`, `bad_instruction`) |
| **Confidence**        | The analysis worker's confidence in its diagnosis, expressed as a percentage                            |
| **Counterfactuals**   | Two or three "what if" questions that probe whether the outcome was avoidable                           |

Each counterfactual shows a verdict — `avoidable`, `unavoidable`, or `unclear` — along with the reasoning and the evidence the worker used to reach that conclusion.

## Failure type classifications

| Type                  | Meaning                                                              |
| --------------------- | -------------------------------------------------------------------- |
| `none`                | The trace completed without a detected failure                       |
| `market_condition`    | Market state changed between context capture and execution           |
| `model_limit`         | The LLM reached its context or output limit                          |
| `missing_information` | A required data point was absent from the agent's context            |
| `bad_instruction`     | The prompt or system instruction produced an incorrect decision path |
| `guardrail_gap`       | A missing validation or safety check allowed an undesirable action   |

## Rerunning analysis

If you want a fresh diagnosis — for example after updating your agent's strategy or if the first result looks incorrect — click **Rerun analysis** on the trace detail page. This re-queues the trace for the analysis worker, which will produce a new autopsy and replace the existing one.

<Tip>
  Rerun analysis after you make a code change to confirm the worker reaches a different conclusion on a previously failing trace. This is a fast way to validate that a fix addresses the root cause the autopsy identified.
</Tip>

## Analysis availability

Analysis only runs on completed traces. A trace must have status `completed` or `errored` before it enters the analysis queue — traces still marked `running` are not eligible.

<Warning>
  If analysis never appears on a completed trace after several minutes, use the **Rerun analysis** button on the trace detail page to re-queue it. If the problem persists, confirm the trace status shows `completed` or `errored` — traces still in `running` status are not eligible for analysis.
</Warning>

## Analysis provider

Mortem's analysis worker uses an LLM to generate each autopsy. You do not need to configure the provider from the dashboard — analysis runs automatically on every completed trace. When Ollama is used as the provider, the dashboard shows "usage tracked by Ollama" in the cost field instead of a USD estimate.

## Related pages

<CardGroup cols={2}>
  <Card title="Traces" icon="list" href="/dashboard/traces">
    Open a trace to read its autopsy in the dossier panel.
  </Card>

  <Card title="Sharing" icon="share" href="/dashboard/sharing">
    Share a trace and its analysis with teammates via a public link.
  </Card>
</CardGroup>
