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

# How do Klipy's pipelines, stages, and deal outcomes work?

> How pipeline stages, stage-move events, close outcomes, and AI-assisted deal creation work under the hood in Klipy's Deals pipeline.

This page explains the mechanism behind Deals. It covers the stage model, what fires on every move, how a close gets recorded, and where AI touches a deal.

## Stages, and the columns that aren't stages

A pipeline stores its own `stages` array. Each entry has an id, a name, a color, and an order index.

Every new organization gets one default pipeline with six starting stages: Approached, Meetings Scheduled, Proposal, Procurement, Blocked, and Approach Again. This default pipeline is flagged as a fallback. You can rename or replace its stages at any time.

A deal's `stage` field is a plain string — it isn't a link into that array. Three stage ids never appear in a pipeline's `stages[]`: `LEAD`, `CLOSED_WON`, and `CLOSED_LOST`. These are synthetic sentinels, resolved by name at read time. `LEAD` always displays as "Opportunities." The two closed ids fall back to "Closed Won" and "Closed Lost," unless the pipeline sets its own names for them.

Every pipeline board renders the same column set: Opportunities, then the pipeline's own stages in order, then the two closed columns. That's true even for a brand-new pipeline with no deals yet.

Column headers don't come from scanning every deal in a column. A trigger on the deals table maintains a running count and value sum per pipeline-and-stage pair, updated on every insert, delete, stage move, and value change. The board reads these totals directly, without loading any deals.

A pipeline can also set a default deal value. A deal created without its own value inherits that default automatically, tagged as a pipeline default rather than something you entered.

## What fires on every stage move

Dragging a card, editing the Stage field, and every automated write share the same underlying primitives. A stage move behaves the same no matter which surface triggers it.

Moving a deal always does three things:

1. **An internal event fires.** Klipy resolves the old and new stage names against the pipeline, then emits a `deal.stage_changed` event carrying both stage ids and both names. That event fans out to an outbound `deal.moved` webhook for any subscribed integration.
2. **An audit row is appended.** A `dealActivities` row records the before stage, the after stage, and a computed direction: forward, backward, or reopen. Reopen means the deal is leaving a closed stage back into an open one. This trail is append-only — nothing in it is ever edited or deleted, except by the deal's own cascade-delete.
3. **Analytics events fire.** A stage-change event always fires. A won or lost event also fires when the destination is a closed stage.

Moving a deal to a different pipeline uses a separate path that updates both `pipelineId` and `stage` in one write. That path deliberately skips the `deal.moved` webhook for a cross-pipeline move. The event model only supports a single pipeline per event, so an ambiguous transition can't be represented. The audit row and analytics events still fire; only the outbound webhook is skipped for this one case.

> [!WARNING]
>
> Klipy never moves a deal between stages on its own. Every stage change traces back to a person acting through the board, the API, an integration, or an approved AI action.

## Closing a deal

Closing a deal is really two writes: the stage move onto `CLOSED_WON` or `CLOSED_LOST`, and a close reason. One write path can do both atomically. It validates the target stage against the pipeline before touching anything, so an invalid stage rejects the whole operation, and a deal is never left half-closed.

The first move into `CLOSED_WON` also triggers a one-time record toward Klipy's win tracking. This is idempotent by design. A stamp on the deal itself marks it as already counted, so re-saving an already-won deal, or retrying the write, never double-counts it. The recorded value prefers the deal's own value, then the pipeline's default, then "missing" if neither exists. That distinction feeds the win totals Klipy keeps per organization.

Winning a deal has two more automatic effects:

* Every contact linked to the deal has their status advanced to customer.
* Any conversation still tracked against the deal gets offered for untracking, since the deal it was tracked for is now closed.

Both effects fire only on the transition into a closed stage — never on a later edit to a deal that's already closed.

A close reason is a separate write from the stage move. It's a bucket (Product & Features, Price & ROI, Adoption & Usage, Competitor, Technical, Business Change, or Other) plus an optional sub-reason and free-text detail. The first time a reason is recorded, Klipy stamps who recorded it and when. That stamp survives every later edit to the bucket or the detail. This is also how "Add close reason" backfills a reason onto a long-closed deal. The backfill only touches the reason fields — never the deal's actual close date.

## Deals, contacts, and companies

A deal needs at least one contact or one company to exist. Klipy rejects a bare deal with neither.

Contacts attach through a join record with an optional buying-committee role — Decision Maker, Champion, Economic Buyer, and nine others are all valid. The same record can also point to another contact on the deal as who this person reports to.

Linking a contact has a side effect on that contact's own lead status. It advances to qualified, or straight to customer if the deal it's joining is already won.

Adding or removing a contact is recorded in the deal's audit trail either way. Adding one also fires its own outbound webhook event; removing one is audit-only, with no webhook.

## Qualification frameworks live on the deal

A deal can carry a qualification snapshot: one sales framework — BANT, MEDDIC, MEDDPICC, or SPICED — with a status per criterion. Each criterion is confirmed, partial, or not yet assessed, and can optionally carry evidence and a confidence level.

This snapshot is seeded once, the first time any criterion is touched, from the organization's configured framework (or BANT if none is set). A later change to the org's framework never affects a deal that's already seeded — each deal keeps the framework it started with.

Two separate write paths share the exact same seeding, validation, and upsert logic. One is the field you edit directly on a deal; the other is the path an approved AI suggestion uses. A criterion can never end up in a different shape depending on which path touched it.

## AI-assisted deal creation and edits

Hey Klipy can create a deal, edit one, or move its stage. In normal use, every one of those actions is approval-gated — the turn pauses on an inline proposal and only proceeds once you approve it. A background delegation running in autonomous mode writes immediately instead. One running in suggestion mode routes the same action to an owner-approval queue instead of writing directly.

> [!WARNING]
>
> Klipy never creates or edits a deal without your approval in an interactive Hey Klipy conversation. A proposed deal or stage change always waits for your Approve before it's written.

When an AI-proposed change lands, it's stamped with its own origin rather than posing as a manual edit. A value the agent estimated is marked as an agent estimate; a stage the agent moved is marked as agent-sourced. Both distinctions carry through to Klipy's win tracking, so an AI-authored figure is never silently counted as if you'd typed it yourself.

One AI path creates a deal end-to-end: finishing a Follow-up conversation on an Opportunity. Approving that step creates the deal and links it back to the originating Opportunity. It also carries over any qualification evidence already gathered in that conversation, onto the new deal's own criteria. Retrying that same approval after it already succeeded returns the existing deal, instead of creating a second one.

## Limits worth knowing

| Behavior | Limit |
| - | - |
| Deal without a contact or company | Rejected — a deal needs at least one anchor to exist |
| Win recorded toward Klipy's win tracking | Exactly once per deal, on its first entry into Closed Won |
| Cross-pipeline stage move | Audit row and analytics events fire; the outbound stage-move webhook does not |
| Contact removed from a deal | Recorded in the audit trail only — no outbound webhook |
| Qualification framework on a deal | Fixed at first use; a later org-wide framework change doesn't apply retroactively |
| Close reason backfill | Updates the reason fields only — never the deal's recorded close date |

## What this does not do

Klipy never advances a deal's stage on a schedule or a guess — every move traces back to a person or an approved action. It never double-counts a win: the same deal can only be recorded once toward win tracking, no matter how many times it's re-saved. And it never lets an org-level framework change reshape a deal that already has its own qualification snapshot. That deal keeps the framework it was seeded with.

## Related guides

> [card] [Deals overview](https://klipy.ai/docs/product/deals/overview.md)
>
> See what's on a deal and what Klipy keeps in sync automatically as conversations happen.

> [card] [Manage a deal](https://klipy.ai/docs/product/deals/how-to.md)
>
> Create a deal, move it through stages, link people, and close it won or lost.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.