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

# Custom flows

> Write the user journeys TREX should test, step by step, with the checks that prove they work.

TREX picks the flows to test from each pull request. A custom flow is one you write yourself: a journey through your app, step by step, with the checks that prove it works. TREX runs it as written whenever a pull request touches it.

## Where to find them

Open **Memory →** [**TREX Flows**](https://app.greptile.com/-/custom-context/trex-flows). Each flow belongs to one repository; pick the repository at the top of the list, then select a flow. Its **Instructions** tab shows what TREX follows, and its **History** tab shows past runs.

![TREX Flows with a repository's flows and one flow's instructions open](https://mintcdn.com/greptile/uh7ZNTHIRsgxy_lm/images/trex-custom-flows.png?fit=max\&auto=format\&n=uh7ZNTHIRsgxy_lm\&q=85\&s=a2baf33cc37ba0f704c093f055377e20)

## Write a flow

Click **+** (**New flow**) next to the search box and fill in:

| Field | What to write |
| - | - |
| **Title** | A short name. Up to 120 characters. |
| **Description** | What the flow covers. TREX uses it, with the goal, to decide when the flow is relevant to a pull request. |
| **Goal** | What the user should end up with, e.g. "The new name is still shown after a reload." |
| **Starting point** | Optional. What must be true before the first step, e.g. "Signed in as an admin with two projects." TREX sets this up for you. |
| **Steps** | The actions to take, in order. 1 to 100 steps. |

Each step has an **Action** (what to do) and any number of **Checks** (what must be true afterwards). Each check fits on one line.

**Example**

* **Title**: Rename a project
* **Goal**: The new name is still shown after a reload.
* **Starting point**: Signed in with one project named "Alpha".
* **Steps**:
  1. Open the project's settings and change its name to "Beta". *Check*: the header shows "Beta".
  2. Reload the page. *Check*: the header still shows "Beta".

Edits apply to the next pull request TREX tests.

## How TREX uses a flow

* **It runs when it's relevant.** On each pull request, TREX scores every flow, its own and yours, against the change. A flow that doesn't match the change doesn't run, so a clear description and goal matter.
* **It runs as written.** TREX follows your steps and checks exactly. It only works out how to reach the starting point.
* **It reports back.** Tested custom flows link to their page from the [TREX comment](/docs/trex/results). If TREX can't reach the starting point, or a check looks wrong, the flow is listed under **Incomplete custom user flows** with an **Edit flow** link.

A flow's **History** tab shows its most recent run, with the recording, and up to 50 earlier runs.

## Who can change flows

* Anyone except viewers can create a flow.
* Only the flow's author, or someone who can manage TREX settings, can edit or delete it.
* Creating, editing, and deleting flows is recorded in the audit log.

Deleting a flow stops TREX from running it. Results from earlier pull requests stay.


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