---
title: "Workflow reference"
description: "Workflow v1 YAML fields, validation rules, schedule intervals, and the supported draft action."
---

> Documentation Index
> Fetch the complete documentation index at: https://hafi-go-hands-free-docs.free-hero-8440.chatgpt.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow reference

# Workflow YAML

Workflow v1 is validated by the CLI. It supports Gmail, Lark, or both as sources, asks Jev to classify new conversation state, and permits exactly one `save_reply_draft` action. Live provider integrations still need account verification.

## Example

```yaml
version: 1
id: reply-review
sources:
  - provider: gmail
account: personal
  - provider: lark
account: work
schedule:
  every_minutes: 5
filter:
  bot: jev
  question: "Does this new message need a personal reply from me?"
  match_at_or_above: 0.7
actions:
  - type: save_reply_draft
composer: codex
max_words: 120
```

## Fields and behavior

- `version` must be `1`; `id` names the workflow.
- Each `sources` entry selects `gmail` or `lark` and a local account alias created with `hafi connect`.
- `schedule.every_minutes` accepts `1`, `2`, `5`, `10`, `15`, `30`, or `60`.
- `filter.bot` is `jev`; the question and score threshold control which conversations reach the action.
- `actions` must contain exactly one `save_reply_draft` action. `max_words` bounds the suggested reply.
- Unknown fields and action types are rejected. The YAML cannot run arbitrary commands, scripts, or remote includes.

Jev evaluates new conversation state against `filter.question`. A score at or above `match_at_or_above` selects the action. The saved draft is a local result for review; the user sends any reply in the original app. The first workflow does not send messages or notifications.

## Validate and inspect

```sh
bun run dev workflow validate hafi.yaml
bun run dev workflow validate hafi.yaml --json
bun run dev schedule print --workflow hafi.yaml --platform cron
```

Validation checks workflow shape before a run. `schedule print` prints an entry for system cron; it does not install or activate the schedule. See [Getting started](/getting-started) for connection and run commands.

## Example file

The repository root includes `hafi.workflow.example.yaml`. Copy it into your project and remove the source you do not use. Account aliases must match connections on the machine where Hafi runs.

Source: https://hafi-go-hands-free-docs.free-hero-8440.chatgpt.site/workflow/index.mdx
