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

# Consequence Links: connecting AI to dollars

> A consequence link connects a decision record to the financial event it caused, recording the correlation strength, attribution method, and link type.

A consequence link is the edge between a decision and the financial event that decision caused. Links carry four fields that make the attribution actionable: which pair they connect, how strong the attribution is, how the attribution was established, and what kind of financial impact it represents. Without links, a revenue event is just revenue. With a link pointing at a decision, that revenue is attributable to an agent with a provenance trail you can show to a skeptic — or an auditor.

The ledger records both automatic links created by the attribution engine and manual links created by a human confirming a suggestion on the dashboard. The `attribution_method` field records which — so you always know whether a number came from a machine score or a human judgment.

## Shape

```json theme={null}
{
  "id": "lnk_...",
  "org_id": "o_...",
  "decision_id": "d5e7a3b0-...",
  "financial_event_id": "fev_abc",
  "correlation_strength": 0.91,
  "attribution_method": "ml_inferred",
  "link_type": "revenue",
  "notes": "attribution engine: score=0.91",
  "created_at": "2026-04-16T12:40:00.000000Z",
  "deleted_at": null
}
```

## Creating a link from code

<CodeGroup>
  ```python Python theme={null}
  # ``decision_id`` is a UUID string — use whichever variable your
  # caller exposes (``receipt["decision_id"]`` from ``log_decision``
  # in non-batched mode, or a stored id from a prior write).
  pq.link_outcome(
      "d5e7a3b0-0000-0000-0000-000000000001",
      "fev_abc",
      correlation_strength=1.0,
      link_type="revenue",
      notes="direct cause — pricing API response produced this charge",
  )
  ```

  ```typescript TypeScript theme={null}
  await pq.linkOutcome(
    'd5e7a3b0-0000-0000-0000-000000000001',
    'fev_abc',
    {
      correlationStrength: 1.0,
      linkType: 'revenue',
      notes: 'direct cause — pricing API response produced this charge',
    },
  );
  ```
</CodeGroup>

<Tip>
  When you create a link via the SDK with a known `decision_id` and `financial_event_id`, set `correlation_strength: 1.0` and let the `attribution_method` default to `direct`. Reserve lower correlation values for cases where you know the relationship is partial.
</Tip>

## Attribution methods

| Method         | Who creates it              | How the engine decides                            |
| -------------- | --------------------------- | ------------------------------------------------- |
| `manual`       | Human via the dashboard     | Reviewed and confirmed by a person                |
| `direct`       | SDK, passing a known id     | Explicit caller-supplied link                     |
| `temporal`     | Correlation worker          | Time proximity and metadata overlap               |
| `ml_inferred`  | Attribution engine (auto)   | Composite score at or above auto-link threshold   |
| `ml_suggested` | Attribution engine (review) | Score in the suggested band — awaits confirmation |

The engine's scoring combines temporal decay, Jaccard metadata overlap, a Bayesian agent-pattern prior, and amount plausibility. Links with a score in the `ml_suggested` band appear in the dashboard review queue rather than being applied automatically.

### Confirming or rejecting ML-suggested links

When the attribution engine surfaces a suggested link, you confirm or reject it from the **Links** tab in the dashboard. Confirming promotes the `attribution_method` to `manual` and makes the link active. Rejecting soft-deletes the link — it is excluded from P\&L queries but remains in forensic exports so an external reviewer can see the prior suggestion was retracted.

<Note>
  Soft-deleted links are never hard-deleted. The audit trail is always intact, even after a rejection.
</Note>

## Link types

<CardGroup cols={2}>
  <Card title="revenue" icon="circle-dollar-sign">
    The decision drove positive revenue — a successful upsell, a completed checkout.
  </Card>

  <Card title="cost" icon="arrow-down-circle">
    The decision drove a cost you would not otherwise have incurred — extra API calls, ops labour.
  </Card>

  <Card title="liability" icon="triangle-alert">
    The decision created legal or compliance exposure — an erroneous claim denial, a regulated miscommunication.
  </Card>

  <Card title="neutral" icon="minus-circle">
    Attribution matters for the audit trail but the dollar sign is zero — for example, a canceled transaction.
  </Card>
</CardGroup>

<Warning>
  The sign of a link's contribution to the P\&L comes from the linked event's `amount` field, not from the `link_type`. The type is metadata for filtering and reporting, not an arithmetic override. A `revenue` link to a negative-amount event will subtract from the revenue total.
</Warning>

`LIABILITY` and `NEUTRAL` link types are excluded from the revenue and cost sums in the AI P\&L — liability flows into the exposure column only, and neutral links are audit metadata with no P\&L effect.
