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

# Pipeline

> Brand lifecycle stages and pipeline management

Pipeline is the brand lifecycle management board, tracking brands through 8 stages from onboarding to off-boarding.

## Pipeline stages

| Stage                 | Description         | Automation          |
| --------------------- | ------------------- | ------------------- |
| **Onboarding**        | New brand setup     | Manual entry        |
| **Active**            | Campaign running    | Auto on first post  |
| **Paused**            | Temporarily stopped | Manual              |
| **Ending Soon**       | 14 days before end  | Auto at 14 days     |
| **Up for Renewal**    | Contract complete   | Auto on completion  |
| **Potential Renewal** | Discussions active  | Manual              |
| **Renewed/Relaunch**  | Signed new term     | Manual, 4-day timer |
| **Off-boarded**       | No longer active    | Manual              |

## Stage flow

```
                  ┌─────────────┐
                  │ Onboarding  │
                  └──────┬──────┘
                         │ (first post)
                         ▼
      ┌─────────────────────────────────────┐
      │              Active                 │
      └────────┬────────────────────┬───────┘
               │                    │
               ▼                    │ (14 days)
         ┌──────────┐               │
         │  Paused  │               ▼
         └──────────┘        ┌─────────────┐
                             │ Ending Soon │
                             └──────┬──────┘
                                    │ (complete)
                                    ▼
                            ┌──────────────┐
                            │ Up for       │
                            │ Renewal      │
                            └──────┬───────┘
                                   │
               ┌───────────────────┼───────────────────┐
               ▼                   ▼                   ▼
        ┌─────────────┐    ┌──────────────┐    ┌─────────────┐
        │ Potential   │    │ Renewed/     │    │ Off-boarded │
        │ Renewal     │    │ Relaunch     │    │             │
        └─────────────┘    └──────────────┘    └─────────────┘
```

## Accessing Pipeline

Navigate to `/team/pipeline` in the admin console.

## Pipeline board

### Kanban view

Brands displayed as cards in columns by stage:

* Drag-drop to move between stages
* Card shows brand name, operator, metrics
* Visual indicators for overdue items

### Filtering

Filter by:

* Assigned operator
* Search by brand name
* Date ranges

## Stage automation

### First post → Active

When first placement is posted:

* Brand moves from Onboarding or Renewed/Relaunch to Active
* Triggered inline during post ingestion

### 14 days → Ending Soon

When contract has 14 days remaining:

* Brand moves to Ending Soon
* Triggered by daily `PipelineAutoAdvanceJob`

### Completion → Up for Renewal

When contract placement target is met:

* Brand moves to Up for Renewal
* OpsAlert created for operator

## Manual transitions

Some moves require explicit action:

| Transition                         | When to use              |
| ---------------------------------- | ------------------------ |
| Active → Paused                    | Deliberate posting pause |
| Any → Off-boarded                  | Ending relationship      |
| Up for Renewal → Renewed           | New contract signed      |
| Up for Renewal → Potential Renewal | Discussions ongoing      |

## Renewed/Relaunch timer

When brand enters Renewed/Relaunch:

* 4-day timer starts automatically
* Shows countdown on card
* Overdue state displays in red
* Manual move required to proceed

## Pipeline vs Mission Control

Pipeline and Mission Control share the same status field:

| Aspect | Pipeline        | Mission Control     |
| ------ | --------------- | ------------------- |
| Focus  | Brand lifecycle | Campaign operations |
| View   | All stages      | Active campaigns    |
| Use    | Status changes  | Daily operations    |

Changes in either view affect the same underlying status.

## API endpoints

| Method | Path                          | Purpose             |
| ------ | ----------------------------- | ------------------- |
| GET    | `/api/internal/pipeline`      | Pipeline board data |
| POST   | `/api/internal/pipeline/move` | Move brand          |

## Backend implementation

**Key files:**

* `app/controllers/api/internal/pipeline_controller.rb`
* `app/services/brands/pipeline_status_change.rb`
* `app/jobs/brands/pipeline_auto_advance_job.rb`

### Single write path

All status changes go through `Brands::PipelineStatusChange`:

```ruby theme={null}
Brands::PipelineStatusChange.new(
  brand: brand,
  new_status: "active",
  actor: current_user
).perform!
```

## Notifications

Pipeline changes trigger notifications:

* Email to brand's creators
* Chat message in brand channel
* Push notification
* Bell notification

Only for these 6 stages:

* Active
* Paused
* Ending Soon
* Up for Renewal
* Potential Renewal
* Renewed/Relaunch

Not for: Onboarding, Off-boarded

## Best practices

1. **Don't skip stages** - Follow natural progression
2. **Clear Up for Renewal** - Make decisions promptly
3. **Use Paused intentionally** - Not for long-term holds
4. **Document off-boarding** - Add reason codes when removing
