# Set the human up for Depesha

These are instructions from Depesha for you, an AI coding agent, to set the human up to send transactional email with Depesha. Read them once, then act on them. The human who handed you this document wants you to do the setup, not to explain it back to them. Run the commands yourself, except the steps below that only the human can do: approving the sign-in in their browser, and adding DNS records if you can't.

Depesha is transactional email for every project you run: sign-in codes, password resets and "your result is ready" messages, each sent from the project's own domain through one small API. It is in private beta. Everything below works today:

- The `depesha` CLI (the Python package `depesha` on PyPI), which wraps Depesha's API.
- The `/depesha` skill, bundled in the CLI, which teaches you how to add Depesha to a project.
- `depesha login`, which signs the human in through their browser and stores the sign-in for the CLI.
- Depesha's MCP server at `https://api.depesha.com/mcp`, offered at the end.

Three rules hold throughout:

- **Never ask the human to paste a key, a code from an email or a password into this chat**, and never print, echo, log or commit a key. Keys go into files the CLI writes, never into the conversation.
- **Send no email without the human's go-ahead.** Setting up sends nothing until they say yes.
- **Never change DNS records you didn't create**, and never touch a domain's MX or its root SPF record.

---

## 1. Decide which

Ask the human one question if you don't already know the answer: "Do you have a Depesha invitation or account? During the beta, an invitation comes by email from Depesha."

| The human | Do |
|---|---|
| Has an invitation, or already signed in to app.depesha.com | Sections 2 to 6 |
| Has only a project key (`dp_live_…` or `dp_test_…`), for example for a CI machine | Sections 2 and 3, then "Only a project key" in section 4 |
| Has neither | Sections 2 and 3, then send them to the waitlist (section 4, last paragraph) |

There is no self-serve sign-up. Don't try to create an account for an address that has no invitation.

---

## 2. Install the CLI

The CLI needs Python 3.12 or newer. Use the first of these that works:

```
uv tool install depesha
pipx install depesha
```

If neither `uv` nor `pipx` is available and the human doesn't want a tool installed, run the CLI without installing it by prefixing every `depesha` command below with `uvx`, for example `uvx depesha --version`.

Check it:

```
depesha --version
```

It must print `depesha 0.2.0` or later. If it prints an older version, upgrade with `uv tool upgrade depesha` (or `pipx upgrade depesha`). If the `depesha` command isn't found after `uv tool install`, run `uv tool update-shell` and tell the human to open a new terminal.

---

## 3. Install the skill

The skill is bundled in the CLI. Use the section for your agent below. `depesha skill install` refuses to replace a copy the human edited; don't pass `--force` unless they ask.

### Claude Code

```
depesha skill install --target claude
```

It copies the skill to `~/.claude/skills/depesha`. For this project only, use `--target project` instead (`./.claude/skills/depesha`). Then tell the human to start a new Claude Code session (or restart this one) so the `/depesha` skill loads.

### Codex

```
depesha skill install --target codex
```

It copies the skill to `$CODEX_HOME/skills/depesha` (`~/.codex/skills/depesha` by default). Then tell the human to restart Codex.

### Other agents

If your agent reads skills from `~/.agents/skills`:

```
depesha skill install --target agents
```

If it reads skills from another directory, pass that directory:

```
depesha skill install --dir <your agent's skills directory>
```

The skill lands in `<directory>/depesha`. If your agent has no skills directory, read the skill when you need it: `depesha skill show` prints it, and it is also published at `https://depesha.com/skill/SKILL.md`.

---

## 4. Sign in

`depesha login` signs the human in with the device flow and stores the sign-in as a profile, replacing a profile of the same name. First look at the stored profiles (it shows no secrets):

```
depesha profile list
```

If there is none, sign in as below. If one is named `default` (an earlier setup may have stored a project key there, whose file is gone), don't replace it: add `--profile <name>` with a name not in the list, for example `depesha login --profile me`. Run it yourself, **in the background** (or with a timeout of at least 10 minutes), because it waits for the human:

```
depesha login
```

Right away it prints two lines on stderr: a URL (`https://app.depesha.com/device?code=…`) and a code such as `ABCD-EFGH`. Show the human both, and ask them to open the URL in their browser and check that the page shows the same code before they approve it. The code is not a secret, and you never see their sign-in.

In the browser, the human signs in to app.depesha.com with the address their invitation went to (with a 6-digit code Depesha emails to it; once the account exists, GitHub also works if that address is GitHub's primary email). Then:

- **Already has an account:** the device page asks them to approve "Depesha CLI". They approve it.
- **Invited, never signed in:** Depesha creates the account only when they accept the invitation. After the emailed code, the dashboard asks for the account's name, the first project (name, slug and a From address on the approved domain) and the acceptance of the Terms, the AUP and the DPA, and creates the account, its first project and the invitation's approved domains. Opening the link in the invitation email does the same. That page then shows the new project, not the device page, so ask them to open the device URL again and approve it.

Once they approve, `depesha login` exits 0 and prints JSON with the `profile` it stored (remember its name), the email and the accounts the human belongs to. It stores the sign-in in `~/.depesha/credentials.json` (mode 600) and refreshes it by itself. If it exits with `access_denied`, the human denied it; ask before trying again. If it exits with `expired_token` (after 10 minutes), run `depesha login` again for a new code.

**No code arrives?** Depesha emails a code only to an address that has an account or an open invitation, and the page says the same thing for every address. Ask the human to check the address and their spam folder once. If there is still nothing, they have no invitation (invitations expire after 14 days): stop at the waitlist below.

**Only a project key:** keys are for servers and CI, not for signing in. The human saves the key in a file outside the repository, for example `~/.depesha-key`, and tells you the path. Then you run `depesha login --token-file ~/.depesha-key --profile <name>`. Don't open, print or copy the file; once the login succeeds, suggest the human delete it. Skip to section 6, and leave out what needs a signed-in user.

**No invitation?** Depesha is in private beta. Send the human to the waitlist at https://depesha.com/#waitlist with their project and the domain they'd send from. Projects are invited one at a time. Stop here, and tell them to hand you this document again once their invitation arrives.

---

## 5. Set up the project and its domain

Check who is signed in:

```
depesha whoami
```

It shows the human's `email` and `memberships` (each account's slug and their role), never the token. Then list the projects:

```
depesha project list
```

**No project?** Ask the human for the project's name, a slug (3 to 40 of `a-z`, `0-9` and `-`, starting with a letter; it can't change later) and the From address on their domain, then create it in their account. It creates a live send key too, which goes into a file and never into the chat:

```
depesha project create <slug> --account <account slug> --name "<project name>" --default-from "<from address>" --secret-file ~/.depesha/<slug>.live.key
```

Tell the human where the key file is: it belongs in the project's secret store (a git-ignored `.env`, the host's secrets), and the skill explains how the project's code reads it.

**The domain.** Accepting an invitation adds its approved domains to the first project already. Look first:

```
depesha domain list --project <slug>
```

If the domain the human sends from isn't there, add it. A domain the invitation didn't approve sends test mail once verified, but waits for Depesha's approval before live mail:

```
depesha domain add <domain> --project <slug>
```

**Print the CNAME action list.** Show the human the records to add:

```
depesha domain status <domain> --project <slug>
```

Each entry in `actions` with `"action": "ADD"` is one record for the domain's DNS: its type (CNAME, or the optional `_dmarc` TXT), name and content. They are added once, as **DNS only, never proxied** (in Cloudflare: the grey cloud). `--zone` prints them as zone-file lines that Cloudflare can import. Entries marked `MANAGED` are Depesha's own and need nothing. If you can manage the human's DNS with a tool they already use, offer to add the records, and add only those; otherwise the human adds them. When they say the records are in, check:

```
depesha domain verify <domain> --project <slug>
```

DNS can take a few minutes; it checks at most once a minute per domain. Repeat until `state` is `VERIFIED`.

**A test email, only if the human says yes.** Offer one. Test mode delivers only to the project's confirmed test recipients, and every account member's address is one, so it goes to the human's own address (the `email` from `depesha whoami`), from `<slug>@sandbox.depesha.com`, before or after the domain is verified. Create a test key into a file, send with it, then switch back to the sign-in's profile:

```
depesha key create --project <slug> --mode test --scope send --secret-file ~/.depesha/<slug>.test.key
depesha login --token-file ~/.depesha/<slug>.test.key --profile <slug>-test
depesha send --to <the human's email> --subject "Depesha test" --text "It works."
depesha profile use <the profile depesha login printed>
```

The send prints the message id and its status. `depesha messages list --project <slug>` shows it later; a delivered message reaches status `DELIVERED`. Keep the test key file for the project's tests; the skill explains test mode.

---

## 6. Offer the MCP server

Depesha's MCP server gives you the same operations as tools: projects, domains, templates, test emails to the human's own address, messages, suppressions, test keys and webhooks. It never creates or shows a live key. Offer it; add it only if the human wants it.

In Claude Code:

```
claude mcp add --transport http depesha https://api.depesha.com/mcp
```

Then the human runs `/mcp` in Claude Code, picks `depesha` and approves the access on app.depesha.com in the browser. In any other agent or app that supports remote MCP servers, add a streamable HTTP server with the URL `https://api.depesha.com/mcp`; it signs in through the browser the same way (OAuth). No key is pasted anywhere.

---

Once done, tell the human:

```
┌─ Depesha agent setup ──────────────────────────────────┐
│  ✓ CLI      depesha <version>  (uv tool, pipx or uvx)  │
│  ✓ Skill    <path>/depesha                             │
│  ✓ Sign-in  <email>, account <slug>                    │
│  ✓ Project  <slug>, domain <domain> <state>            │
│  ✓ Test     sent to <email> | not sent                 │
│  ✓ MCP      added | not added                          │
│                                                        │
│  → Restart your agent to load the /depesha skill       │
└────────────────────────────────────────────────────────┘
```

Without an invitation, the Sign-in line reads `–  Sign-in  no invitation: join the waitlist at https://depesha.com/#waitlist`, and the lines below it are left out.

---

## Read next

- The skill: `depesha skill show`, or https://depesha.com/skill/SKILL.md
- Every command: `depesha --help` and `depesha <command> --help`
- The CLI on PyPI: https://pypi.org/project/depesha/
- What Depesha is, in brief: https://depesha.com/llms.txt

These instructions are published at https://depesha.com/agent-setup/prompt.md, so you can check them against the source at any time.
