# Threadline v1.2.0 - Table of Contents

An audit trail library for Phoenix that records every row change in PostgreSQL, so you can follow what happened.

## Guides

- Overview
  - [README](readme.md)
  - [Phoenix reference application](phoenix-reference-application.md)

- Integrations
  - [Threadline ↔ Sigra integration](sigra.md)
  - [Threadline ↔ phx.gen.auth integration](phx-gen-auth.md)

- Evaluate
  - [How Threadline works](how-threadline-works.md)
  - [Code walkthrough](code-walkthrough.md)
  - [Threadline domain reference](domain-reference.md)
  - [Evaluating Threadline](evaluating-threadline.md)

- Adopt
  - [Integration Contracts](integration-contracts.md)
  - [Upgrade Path](upgrade-path.md)
  - [Redaction scope and rollout](redaction.md)
  - [Threadline 1.x stability policy](stability.md)
  - [Supported PostgreSQL table shapes](supported-tables.md)
  - [Upgrading to 0.11.0](upgrading-to-0-11.md)
  - [Upgrading to 1.0.0](upgrading-to-1-0.md)
  - [Brownfield continuity with Threadline capture](brownfield-continuity.md)
  - [Production checklist (Threadline)](production-checklist.md)
  - [Getting started with Threadline in a Phoenix SaaS app](getting-started-saas.md)
  - [Local Docker DX](local-docker-dx.md)
  - [Configuration and command reference](configuration-and-commands.md)

- Operate
  - [Performance](performance.md)
  - [operator-surface](operator-surface.md)
  - [Threadline Incident Playbook](incident-playbook.md)
  - [Adoption evidence playbook](adoption-evidence-playbook.md)
  - [Audit table indexing cookbook](audit-indexing.md)
  - [Telemetry](telemetry.md)

- Contribute
  - [Adoption pilot backlog](adoption-pilot-backlog.md)
  - [Contributing to Threadline](contributing.md)
  - [Operator surface design system](operator-surface-design-system.md)
  - [Changelog](changelog.md)

## Modules

- Core API
  - [Threadline](Threadline.md): Threadline is an open-source audit trail library for Elixir and Phoenix apps.
PostgreSQL triggers record inserts, updates and deletes on registered tables,
linked to the actor and execution context supplied by your app. Threadline Admin
is the optional LiveView interface for finding a record and following its changes.
  - [Threadline.Audit](Threadline.Audit.md): Threadline.Audit runs a domain write inside one database transaction and
optionally links the write to a semantic action.
  - [Threadline.ChangeDiff](Threadline.ChangeDiff.md): Threadline.ChangeDiff projects one captured row change into deterministic, JSON-friendly maps.
  - [Threadline.Continuity](Threadline.Continuity.md): `Threadline.Continuity` documents the post-install capture boundary that
starts each table's audit history at its first trigger-fired mutation.
  - [Threadline.Evidence](Threadline.Evidence.md): Threadline evidence records snapshot a subject's status and details at a point in time.
  - [Threadline.Export](Threadline.Export.md): Exports captured row changes as bounded CSV or JSON data and lazy streams.
  - [Threadline.Health](Threadline.Health.md): Reports capture health and trigger coverage for Threadline installations.
  - [Threadline.Job](Threadline.Job.md): Carries serialized actor references and stable context keys through background-job argument maps.
  - [Threadline.NotFoundError](Threadline.NotFoundError.md): `Threadline.NotFoundError` is raised by the `!` sibling of a single-subject
lookup when the subject does not exist or is not visible under the caller's
scope.
  - [Threadline.Plug](Threadline.Plug.md): Plug that extracts `AuditContext` from a `Plug.Conn` and stores it in
`conn.assigns[:audit_context]`.
  - [Threadline.Retention](Threadline.Retention.md): `Threadline.Retention` batches expiry of `AuditChange` rows and optionally
removes empty `AuditTransaction` rows.
  - [Threadline.Telemetry](Threadline.Telemetry.md): `Threadline.Telemetry` defines Threadline's emitted event contract and lets
hosts record accurate transaction table counts.

- Data Types
  - [Threadline.Capture.AuditChange](Threadline.Capture.AuditChange.md): An `AuditChange` is one row mutation in one audited table.
  - [Threadline.Capture.AuditTransaction](Threadline.Capture.AuditTransaction.md): An `AuditTransaction` groups row changes from one database transaction; it is not a request or an action.
  - [Threadline.Evidence.Proof](Threadline.Evidence.Proof.md): A proof document summarizes evidence snapshots and the claims they support.
  - [Threadline.Evidence.Subject](Threadline.Evidence.Subject.md): The closed set of subject names accepted by Threadline evidence records.
  - [Threadline.Governance.EvidenceRecord](Threadline.Governance.EvidenceRecord.md): An EvidenceRecord is an append-only snapshot of a Threadline subject at a point in time.
  - [Threadline.Health.Finding](Threadline.Health.Finding.md): A health finding reports a detected capture issue with one host table and an actionable fix.
  - [Threadline.Investigation.IncidentBundle](Threadline.Investigation.IncidentBundle.md): An IncidentBundle groups one captured transaction with its linked action and change diffs.

  - [Threadline.Investigation.IncidentChange](Threadline.Investigation.IncidentChange.md): An incident change pairs a linked audit change with its JSON diff for
investigation review.

  - [Threadline.Investigation.LinkedChange](Threadline.Investigation.LinkedChange.md): A LinkedChange connects one captured row mutation to its transaction and optional action.

  - [Threadline.Investigation.LinkedTransaction](Threadline.Investigation.LinkedTransaction.md): A linked transaction groups its audit changes and optional action into one
investigation slice.

  - [Threadline.Page](Threadline.Page.md): `Threadline.Page` represents one page of a Threadline paged read.
  - [Threadline.Semantics.ActorRef](Threadline.Semantics.ActorRef.md): An actor reference identifies who performed an audited operation, including when the actor is not a user.
  - [Threadline.Semantics.AuditAction](Threadline.Semantics.AuditAction.md): An `AuditAction` is an application-level event that records who did what and why.
  - [Threadline.Semantics.AuditContext](Threadline.Semantics.AuditContext.md): An `AuditContext` carries request or job details into a semantic audit action.

- Configuration &amp; Extension Points
  - [Threadline.Export.Orchestrator](Threadline.Export.Orchestrator.md): Runs asynchronous export jobs by streaming captured rows to temporary files and storage.

  - [Threadline.ExportQueue](Threadline.ExportQueue.md): Enqueues Threadline export jobs for asynchronous processing.
  - [Threadline.ExportQueue.Oban](Threadline.ExportQueue.Oban.md): Enqueues Threadline exports in Oban.
  - [Threadline.ExportQueue.TaskAdapter](Threadline.ExportQueue.TaskAdapter.md): Runs export jobs in supervised, in-process tasks.
  - [Threadline.Health.Policy](Threadline.Health.Policy.md): Validates `:expected_uncovered_tables` and `:audit_anyway` configuration
for `Threadline.Health.trigger_coverage/1`'s third bucket.
  - [Threadline.Retention.Policy](Threadline.Retention.Policy.md): Validates **`config :threadline, :retention`** before purge runs.
  - [Threadline.Storage](Threadline.Storage.md): Stores and retrieves export files and other persistent artifacts.
  - [Threadline.Storage.Local](Threadline.Storage.Local.md): Stores Threadline exports on the local filesystem.
  - [Threadline.Storage.S3](Threadline.Storage.S3.md): Stores Threadline exports in S3-compatible object storage.
  - [Threadline.StorageSchema](Threadline.StorageSchema.md): Resolves storage schema names and builds validated SQL references to Threadline-owned tables.
  - [Threadline.Verify.CoveragePolicy](Threadline.Verify.CoveragePolicy.md): Compares health coverage entries with the host's expected audited tables.

- Integrations
  - [Threadline.Integrations.Sigra](Threadline.Integrations.Sigra.md): The Sigra integration derives Threadline audit context from optional Sigra request state.

- Operator Surface
  - [Threadline.OperatorSurface](Threadline.OperatorSurface.md): Namespace for the Threadline operator surface — the opt-in mountable
LiveView surface that turns Threadline's investigation contracts into
one-click answers for documented support questions.
  - [Threadline.OperatorSurface.Auth](Threadline.OperatorSurface.Auth.md): Uses host authorization callbacks to admit or halt Threadline operator LiveView mounts.

  - [Threadline.OperatorSurface.Router](Threadline.OperatorSurface.Router.md): Mounts Threadline's operator interface in a Phoenix router with host-owned
authorization and query scoping.

## Mix Tasks

- Mix Tasks
  - [mix threadline.continuity](Mix.Tasks.Threadline.Continuity.md): Brownfield capture cutover helper — honest T0 semantics (see `guides/brownfield-continuity.md`).
  - [mix threadline.evidence.show](Mix.Tasks.Threadline.Evidence.Show.md): Shows Threadline-owned evidence proof output through one canonical viewer task.
  - [mix threadline.export](Mix.Tasks.Threadline.Export.md): Loads application config, starts the configured Ecto repo, and writes an export file
using `Threadline.Export` — **no** ad-hoc `Ecto.Query` in this task (parity with
`mix threadline.retention.purge`).
  - [mix threadline.gen.row_history_index](Mix.Tasks.Threadline.Gen.RowHistoryIndex.md): Generates an Ecto migration that adds `audit_changes_row_history_idx` to an
existing Threadline install.
  - [mix threadline.gen.triggers](Mix.Tasks.Threadline.Gen.Triggers.md): Generates an Ecto migration that installs Threadline audit triggers on the
specified tables.
  - [mix threadline.health.coverage](Mix.Tasks.Threadline.Health.Coverage.md): Shows trigger coverage as reported by `Threadline.Health.trigger_coverage/1`,
with a three-section table (default) or JSON output (`--json`).
  - [mix threadline.incident](Mix.Tasks.Threadline.Incident.md): Loads application config, starts the configured Ecto repo, and fetches
the incident bundle for a given transaction ID.
  - [mix threadline.install](Mix.Tasks.Threadline.Install.md): Generates an Ecto migration file for the Threadline audit schema.
  - [mix threadline.policy.show](Mix.Tasks.Threadline.Policy.Show.md): Shows configured versus deployed redaction policy drift for Threadline capture
triggers through the same report shape used by the operator surface.
  - [mix threadline.retention.purge](Mix.Tasks.Threadline.Retention.Purge.md): Delegates to `Threadline.Retention.purge/1` after loading application config and
starting the configured Ecto repo (same resolution pattern as `mix threadline.verify_coverage`).
  - [mix threadline.verify_coverage](Mix.Tasks.Threadline.VerifyCoverage.md): Verifies that tables listed in application config have Threadline audit
triggers installed, using the same catalog queries as `Threadline.Health.trigger_coverage/1`.

