> For the complete documentation index, see [llms.txt](https://docs.visdom.virtuslab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.visdom.virtuslab.com/visdom-tracing/ai-tracing-in-the-platform.md).

# AI Tracing in the platform

What AI Tracing records, why the record holds up, and where it lands.

AI Tracing is the platform's flight recorder: the component that makes AI activity fully auditable.

![Session analytics: what an agent did, with the model, the tools and the cost attached](https://2686717926-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2dUajTQaSdFnN24ip7Qo%2Fuploads%2FD0zKedDCWLKlvlKqui6C%2Fsession-analytics.png?alt=media)

**Recording.** Every agent session, prompt, model call (model and version), tool invocation, edited file and resulting commit is captured through PreToolUse and PostToolUse hooks in the agent harness, with **secrets removed before anything is written**.

## Why the record holds up

**Immutability.** Events are hashed (SHA-256), chained, and **signed with the organisation's Ed25519 key**; the log is append-only, so changing a single byte breaks the chain. Verification is possible offline with the public key, without trusting the running system. An auditor can take a segment of the chain and verify it independently.

{% hint style="info" %}
**Ed25519** is a signature scheme with small keys and fast verification. Each event carries the hash of the one before it, so the chain can be checked offline with the public key alone.
{% endhint %}

**Attribution.** Tree-sitter analysis overlays line-by-line attribution onto Git history: which line was produced with which model, under which prompt. This is the data an organisation needs to answer how much of its codebase is AI-written, and to satisfy internal policy on generated code.

**Policies.** Rules are defined as YAML in a repository, the same mechanism as other quality rules: model allowlists, forbidden paths (for example blocking edits to critical modules), required tools, limits on the share of AI code in a pull request, and **token budgets per session, team or flow**. They are enforced in the execution loop, blocking with a stated reason, and every block is logged into the same chain. The CLI side of that gate is described in the pre-push check page of the user guide.

## What the ledger is used for

**Cost.** A cost ledger with per-model pricing, token consumption trends (daily and weekly, per model, team and repository), cost attributed to session, author, pull request and flow, cache share, model distribution against the allowlist, quotas with a blocking action (a cost gate can refuse to start a flow once a budget is exceeded) and overrun alerts. LLM call metadata (model, token counts, status, duration) is recorded per call.

![Cost analytics: spend per model, team and repository, against the quotas set for them](https://2686717926-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2dUajTQaSdFnN24ip7Qo%2Fuploads%2Foshm3gzjDLAT7k0gBUL0%2Fcost-analytics.png?alt=media)

## Where it lands

**SIEM export.** A dedicated exporter (a separate, push-only container) sends signed events to your SIEM as Syslog, structured JSON, Splunk HEC or Elastic Bulk. Every event carries `chain_seq`, `prev_sha256`, `sha256` and `signature_ed25519`, so tampering can be detected on the SIEM side as well. Retention inside the platform is configurable and independent of retention in the SIEM.

## Where this sits in Visdom

Context Fabric decides what an agent knows, the Orchestrator decides what it may run, and AI Tracing is the only place that can answer, months later and to somebody who was not there: which model, which prompt, which files, by whom, under which policy.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.visdom.virtuslab.com/visdom-tracing/ai-tracing-in-the-platform.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
