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

# Product assortment optimization

> Identify top-performing and underperforming SKUs to guide buying decisions and markdown strategy

Carrying the wrong products costs you twice — underperformers occupy shelf space and tie up capital, while gaps in your assortment send customers to competitors. Most merchandising teams rely on gut feel and stale quarterly reports to make buying decisions. By the time the data is compiled, the season has shifted.

Wayak connects your POS and returns data, defines performance metrics in the semantic layer, and deploys an agent that ranks every product by contribution margin, flags underperformers, and recommends actions — keep, markdown, discontinue, or investigate. Your buyers get a live, data-backed view of what is working.

***

## What you need

<CardGroup cols={2}>
  <Card title="Data sources" icon="database">
    * **POS database** — Transaction line items with SKU, quantity, revenue, cost of goods sold, and date
    * **Returns database** — Return records with SKU, quantity returned, return reason, and date
    * **Inventory management system** — Current stock on hand, days since last sale, and receiving dates
  </Card>

  <Card title="Knowledge spaces" icon="book-open">
    * **Merchandising guidelines** — Category assortment rules, minimum margin thresholds, and seasonal planning calendars
    * **Markdown policies** — Rules for when to markdown, clearance timing, and minimum margin floors
  </Card>
</CardGroup>

**Semantic layer:** Define these in your ontology before setting up the agent.

| Component | Name                 | Definition                                                                                            |
| --------- | -------------------- | ----------------------------------------------------------------------------------------------------- |
| Object    | `SKU`                | Maps to the POS item master. Represents a product with its full sales, returns, and inventory history |
| Metric    | `ContributionMargin` | Revenue minus cost of goods sold minus returns value, per SKU over the period                         |
| Metric    | `ReturnRate`         | Units returned divided by units sold, expressed as a percentage                                       |
| Dimension | `PerformanceTier`    | Categorization: top 10% (best seller), middle 80% (core), bottom 10% (underperformer)                 |
| Dimension | `Category`           | Product categorization: apparel, electronics, home goods, grocery, seasonal                           |

<Tip>
  See [building a semantic layer](/quickstart/build-semantic-layer) for a step-by-step guide.
</Tip>

***

## Agent setup

<Steps>
  <Step title="Create the agent">
    Go to **Agent Space** → **New agent**.

    | Field    | Value                                                                           |
    | -------- | ------------------------------------------------------------------------------- |
    | **Name** | Merchandising Assistant                                                         |
    | **Role** | Product performance analyst                                                     |
    | **Goal** | Identify top-performing and underperforming products to optimize the assortment |
  </Step>

  <Step title="Set the description">
    > You analyze product performance across channels. Compare sales, margins, and return rates by category, brand, and SKU. Present findings as ranked lists with clear metrics. When recommending assortment changes, back them with data: what to keep, what to drop, and what to test. Use a neutral, analytical tone. Never recommend discontinuing a product without showing the supporting data.
  </Step>

  <Step title="Scope data access">
    Grant access to:

    * POS database (transactions, line items)
    * Returns database (return records)
    * Inventory management system (stock levels)
    * Merchandising guidelines knowledge space
    * Markdown policies knowledge space
    * `SKU` object, `ContributionMargin` and `ReturnRate` metrics, `PerformanceTier` and `Category` dimensions
  </Step>

  <Step title="Add skills">
    <AccordionGroup>
      <Accordion title="Rank product performance">
        **Trigger:** User asks about product performance or weekly review

        1. Pull sales, cost, and return data for the requested category or time period from the POS and returns databases.
        2. Calculate contribution margin for each SKU: revenue minus COGS minus returns value.
        3. Rank SKUs by contribution margin in descending order.
        4. Assign performance tiers: top 10% as best sellers, bottom 10% as underperformers, middle 80% as core.
        5. For underperformers, enrich with: units sold, return rate, days since last sale, current stock on hand, and carrying cost.
        6. Recommend an action for each underperformer: keep (if seasonal uptick expected), markdown (if stock is high), discontinue (if return rate is high and sales are declining), or investigate (if data is inconclusive).
      </Accordion>

      <Accordion title="Category gap analysis">
        **Trigger:** User asks about assortment gaps or buying planning

        1. Pull the full SKU list for the requested category with sales velocity and margin data.
        2. Identify price point gaps: ranges where competitors have products but you do not (based on merchandising guidelines).
        3. Identify feature gaps: attributes present in top sellers but missing from underperformers.
        4. Calculate the revenue opportunity for each gap based on the average performance of adjacent SKUs.
        5. Present a prioritized list of gaps with estimated revenue opportunity and recommended product attributes.
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

***

## Automation

### Playbook: Weekly product performance digest

<Steps>
  <Step title="Set the trigger">
    Schedule: **Every Monday at 7:00 AM**.
  </Step>

  <Step title="Build the workflow">
    1. **Query** the POS database for sales and return data from the previous 7 days across all categories.
    2. **Loop** through each product category:
       * Calculate contribution margin and return rate for every SKU.
       * Rank and assign performance tiers.
       * Identify any SKU that moved between tiers compared to the prior week.
    3. **Condition:** If any SKU in the bottom 10% has more than 30 days of stock on hand, flag it for markdown review.
    4. **Aggregate** into a category-by-category summary with movement highlights (new best sellers, new underperformers).
  </Step>

  <Step title="Configure delivery">
    Send an email to the merchandising and buying teams with the subject line: "Weekly product performance — \[date]". Highlight tier changes at the top. Include the full ranked list per category as an attachment.
  </Step>

  <Step title="Test and activate">
    Click **Run now** to test with live data, then toggle to **Active**.
  </Step>
</Steps>

***

## What's next

<CardGroup cols={2}>
  <Card title="Price elasticity monitoring" icon="arrow-right" href="/use-cases/retail/price-elasticity-monitoring">
    Understand how price changes affect demand so your assortment and pricing strategies work together.
  </Card>

  <Card title="All retail use cases" icon="list" href="/use-cases/retail">
    See the full list.
  </Card>
</CardGroup>
