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

# Workflows & phases

> Phase types in team.yml — standard, gate, team, and map — plus depends_on and concurrency.

A **team** is a list of **phases**. The daemon builds a dependency DAG from `depends_on` and runs ready phases (in parallel when independent).

For agent catalogs and connector fields, see [Agents](/agents) and [Concepts](/concepts).

***

## Phase types

| `type` | What the daemon does |
| - | - |
| `standard` | Invoke the phase’s agent with upstream (+ that agent’s inputs) |
| `gate` | Run optional `commands`, then ask a gate-capable agent for **PASS / ROUTE / ESCALATE** |
| `team` | Run **one** nested catalog team once (`args` → child inputs) |
| `map` | Run **one** nested catalog team **N times** over a list (`over` or `over_file`) |

```yaml theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
phases:
  - name: fetch
    type: standard
    agent: jira
    action: get_issue_tree

  - name: design
    type: team
    team: '@acme/design-lld'
    depends_on: [fetch]
    args:
      ticket_dir: .

  - name: implement
    type: map
    team: '{{item.team}}'
    depends_on: [design]
    over_file: lld.json
    over_field: implement
    key: '{{item.slug}}'
    concurrency: 1
    args:
      slug: '{{item.slug}}'
      stack: '{{item.stack}}'
```

***

## `type: team`

Call a catalog sub-team **once**. Use when the nested playbook is fixed (identify, design, review).

| Field | Required | Meaning |
| - | :-: | - |
| `team` | yes | Catalog ref (`@scope/slug`) |
| `args` | no | Explicit inputs for the child (parent inputs do **not** leak) |
| `depends_on` | no | Predecessor phase names |

***

## `type: map`

Fan out the **same** sub-team shape over a **runtime list**. Each iteration is a named invocation (`phase:key`) with its own `args` and optional per-item `team`.

| Field | Required | Meaning |
| - | :-: | - |
| `team` | yes | Catalog ref, or a template such as `{{item.team}}` (resolved **per iteration**) |
| `over` | one of\* | Expression that resolves to a JSON array (e.g. `{{inputs.repos}}`) |
| `over_file` | one of\* | Workspace-relative JSON file (e.g. `lld.json`) |
| `over_field` | no | Property on the `over_file` object (e.g. `implement`) |
| `key` | no | Iteration name template (default: array index). Must be unique. |
| `concurrency` | no | Max parallel iterations (default: unbounded). Use `1` for shared-workspace sequential work. |
| `args` | no | Per-iteration args; may reference `{{item}}` / `{{item.field}}` |

\* Exactly one of `over` or `over_file`.

Empty lists succeed with zero iterations (skip).

### When to use map vs team

| Need | Use |
| - | - |
| One nested team, once | `type: team` |
| Unknown N rows at runtime (repos, tickets, jobs) | `type: map` |
| Different child team per row | `type: map` + `team: '{{item.team}}'` |

Do **not** invent a middleman “dispatch” team that loops in shell — map is that loop.

***

## Gates (brief)

Gates run optional shell `commands`, then produce a verdict:

| Verdict | Effect |
| - | - |
| **PASS** | Continue |
| **ROUTE** | Re-run a named phase, then re-evaluate |
| **ESCALATE** | Stop for a human |

`agent: hug` makes the verdict a human review in Hub.

***

## Building teams

Author phases in `team.yml`, install/publish to the catalog, assemble into a workspace, then `cliq run`. Nested `type: team` / `type: map` children must already be installable (`@scope/slug` in the catalog).


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