# Sortiri — Agent instructions

## Conversation flow (start here)

When a human sends you the Sortiri setup prompt:

1. **Read** [agent.txt](https://sortiri.ai/agent.txt) and [onboarding-draft.schema.json](https://sortiri.ai/onboarding-draft.schema.json)
2. **Ask the human** each intake question in chat — goal, meals/workouts/weigh-ins, gender, DOB, height, weight, activity, notifications, and **email address** (see **Intake questions** in agent.txt). Do not guess biometrics or email.
3. **Compute macros** from their answers (formulas in agent.txt)
4. **POST** `{CONVEX_SITE_URL}/onboarding/draft` with the `answers` object and top-level `email` when the human provided one
5. **Return** the `claimUrl` and handoff message — the human verifies email with OTP; you cannot do that step

Signup happens on the claim page, not during your interview. Your job is collect answers → create draft → hand off the link.

## When to use what

- **Prefer the headless API** (`POST {CONVEX_URL}/onboarding/draft`) after interviewing the human. Fastest path; see [agent.txt](https://sortiri.ai/agent.txt) and [agents.json](https://sortiri.ai/agents.json).
- **Use browser automation** ([/setup?mode=agent&step=goal](https://sortiri.ai/setup?mode=agent&step=goal)) only when the API is unavailable. `/setup?mode=agent` without `step` is the human prompt handoff panel, not the wizard. Each wizard step uses `section[data-setup-step][data-setup-ready="true"]` and stable `button[name][data-value]` selectors. Deep-link with `?step=meals` when prior steps are already complete.
- **Never automate the claim step.** The human must open the claim URL and complete email OTP verification. Agents cannot bypass OTP or create accounts without human claim.

## Handoff message

After creating a draft, send the account owner:

> Your Sortiri fitness plan is ready. Open this link to verify your email and save it to your account: {claimUrl}
>
> It takes about 30 seconds. After that, download Sortiri on your iPhone and sign in with the same email.

Replace `{claimUrl}` with the URL returned from the API or shown on the setup completion screen.

## Escalation

- **Support:** [support@fystash.ai](mailto:support@fystash.ai) · [sortiri.ai/support](https://sortiri.ai/support)
- **Full spec:** [sortiri.ai/agent.txt](https://sortiri.ai/agent.txt)
