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

# Workflow files

> Author ECP (Execution Control Protocol) workflows as Fluent TypeScript that compiles to a portable JSON graph.

# Workflow files

A workflow file is Fluent TypeScript (`*.ecp.ts`) that compiles to a portable JSON manifest. Bindings compile separately into a requirements document. The graph never contains secrets or host config.

## Shape

```ts theme={null}
import { workflow, step, ref } from "@executioncontrolprotocol/core"
import jsonataExtension from "@executioncontrolprotocol/plugin-jsonata"
import { extension } from "@executioncontrolprotocol/core"

export default workflow("reshape-payload")
  .with([extension(jsonataExtension)])
  .run([
    step("@executioncontrolprotocol/jsonata.transform", "Reshape")
      .with({
        expression: "{ name: payload.user.name }",
        payload: { user: { name: "Ada" } },
      })
      .as("reshape"),
    step("@executioncontrolprotocol/test.echo", "Echo result")
      .with({ value: ref("reshape") })
      .as("echo"),
  ])
```

* `workflow(id)` starts the builder.
* `.with([...])` binds extensions and policies for this file.
* `.run([...])` lists steps in order (and fan-out via the graph helpers).
* `.as("id")` names a step for `ref()` and `--to` / `--from`.
* `.requires(range, pkg?)` pins a plugin version on a binding.

## Inference

If you omit `.with()` for a first-party capability the CLI can resolve, compile infers a requirements row from `step("id")`. Explicit `.with()` still wins for config and version pins. Built-ins such as `@executioncontrolprotocol/test` and `registry-control` do not need an npm package row.

## Compile split

| Artifact | Schema | Contains |
| - | - | - |
| Manifest | `@executioncontrolprotocol.workflow` | Graph, steps, schemas |
| Requirements | `@executioncontrolprotocol.requirements` | Extension/policy ids, package names, placeholder config |

`ecp install brief.ecp.ts` reads requirements and installs missing plugins.

## Run from the CLI

```bash theme={null}
ecp validate brief.ecp.ts --json
ecp run brief.ecp.ts --json
```

`--env` is optional. See [Environments](https://executioncontrolprotocol.io/guides/environments.md).

## Next steps

* [The agent loop](https://executioncontrolprotocol.io/guides/agent-loop.md)
* [Fluent API](https://executioncontrolprotocol.io/guides/fluent-api.md)
* [Files and media](https://executioncontrolprotocol.io/guides/files-and-media.md)
* [Schemas](https://executioncontrolprotocol.io/reference/schemas.md)


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