# Send files between AI agents and people

Coding agents run where your downloads folder can't reach: sandboxes, containers, CI runners, remote machines. **freedrop** gives an agent one command to hand you a file — you open a link on any device — and one to take a file you picked in your browser. Nothing is uploaded anywhere: the bytes go straight between the two ends, end-to-end encrypted.

## Tell your agent about it

Paste this into the instructions your agent reads (`AGENTS.md`, `CLAUDE.md`, a system prompt):

```text
To send me files, run `npx -y freedrop --json --timeout 10m <files>` in the
background and give me the `link` from its first output line. To get files
from me, ask me for the link https://freedrop.dev/ shows me, then run
`npx -y freedrop --json -y -o <dir> '<link>'`.
Details: https://freedrop.dev/llms.txt
```

Any agent that can run shell commands can use it: Claude Code, Codex CLI, Gemini CLI, Cursor, Aider and the like. It needs Node.js 22 or newer on the agent's side; nothing on yours but a browser.

## What happens

1. **Agent → you.** The agent starts the sender in the background. Its first stdout line is a `ready` event carrying the `link`; the agent passes it on, you open it on your phone or laptop and save the files. The sender exits 0 once every byte is verified on your side.
2. **You → agent.** You open [freedrop.dev](https://freedrop.dev/), pick the files and paste the link the page shows into the chat. The agent runs the receiver; every verified file produces a `saved` event with its absolute path. Keep the page open until it says done.

## Why it behaves well in an agent's shell

- **No terminal, no prompts.** Without a TTY the CLI prints plain lines — no QR code, no progress bar redrawn in place — and a receiver without `-y` exits at once instead of waiting for an answer nobody can give.
- **Output that parses.** With `--json`, stdout carries one JSON event per line and nothing else; human text moves to stderr.
- **Exit codes that say what to do next.** A lost connection (8) means re-run the same command to resume; a failed connection (4) means retry with a TURN relay; a timeout (7) means nobody came.
- **Bounded waits.** `--timeout` counts only time with no transfer under way, so a slow transfer is never cut short.
- **The link or the code.** A receiver takes the browser link as readily as the bare code, with or without `https://`.

## Reference

The same reference served at [/llms.txt](https://freedrop.dev/llms.txt), the guide written for agents themselves.

## Send a file to a person

```bash
npx -y freedrop --json --timeout 10m report.pdf data.csv
```

Run it in the background. The first stdout line is the `ready` event:
give the person its `link` (they open it in any browser, on any device —
no install) or, if they have a terminal, `npx freedrop <code>`. The
process exits 0 once the receiver has verified every byte. Without
`--timeout` the sender waits for a receiver indefinitely; `--timeout`
counts only time with no transfer under way. Arguments must be regular
files — `tar` a directory first.

## Receive a file from a person

Ask them to open https://freedrop.dev/, pick the files, and send you the
link (or the `npx freedrop <code>` line) it shows. Then:

```bash
npx -y freedrop --json -y -o <dir> '<link or code>'
```

`-y` is required without a terminal (exit 2 otherwise). Each verified
file produces a `saved` event with its absolute `path`; a name already
taken in `<dir>` lands as `name(1).ext`. Keep the person's page open
until the transfer finishes.

## Events (`--json`)

- `ready` (send): `code`, `link`, `files` [{name, size}], `total`
- `incoming` (receive): `files`, `total`, `resumed` (bytes already on disk)
- `progress`: `bytes`, `total` — at most every 10 s, and at 100 %
- `saved` (receive): `name`, `path`, `size`
- `status`: `message` — human-readable, wording may change
- `done`: `total`, `seconds` — then exit 0
- `error`: `error`, `code` (= exit status), `message` — then exit. A
  `connect` error adds `nat` {`here`, `peer`}: each end's {`type`,
  `ipv6`} or null, `type` one of `open`, `cone`, `symmetric`, `blocked`
  (no STUN server answered), `unknown`. `symmetric` on both ends, or
  `blocked` on either, means only a TURN relay will connect them

## Exit statuses

- 0 done, every file verified
- 1 `failed` — anything else; read the message
- 2 `usage` — bad arguments, or a receiver without `-y` and no terminal
- 3 `broker` — no rendezvous broker reachable (network, or `--broker`)
- 4 `connect` — peers met but WebRTC could not connect: retry with
  `--turn cloudflare` (needs CF_TURN_KEY_ID, CF_TURN_API_TOKEN) or
  `--turn turn:host:3478 --turn-auth user:pass` on the sending side
- 5 `verify` — a file failed verification or changed while sending; a
  re-run transfers it fresh
- 6 `declined` — the receiver said no
- 7 `timeout` — `--timeout` passed, or a receiver found no sender (wrong
  code, or the sender is gone)
- 8 `lost` — connection lost mid-transfer; re-run the same command to
  resume
- 130 / 143 `interrupted` — SIGINT / SIGTERM; re-run to resume

Interrupted and lost transfers print the exact command that resumes
them: the receiver re-runs `freedrop -y -o <dir> <code>`, the sender
`freedrop --code <code> <files>`.
