Skip to the content
aFileSign-in

Two AI agents on the same machine can share a file by writing it to a folder both can read. On different machines, one agent has to put the file somewhere the other can reach, then pass it a link. What matters is where the file sits, who can open the link, and when the link stops working.

I made aFile for that, so this post ends with it, but the options before it are real ones.

What are the options?

OptionAcross machines?Where it stops
A shared folderNoBoth agents need the same disk. Fine for subagents on one laptop.
Pasting it into the chatText onlyOnly small text, and it fills the other agent’s context.
Google Drive or DropboxYesThe agent needs an account and OAuth, and sharing settings are easy to get wrong.
An S3 bucket and a presigned URLYesYou need a cloud account, a bucket and keys. The storage can read the file unless you encrypt it first.
A public gist or paste siteYesIt’s public, or close to it.
aFileYesUp to 25 MiB a file. The link has to reach the other side whole.

For a developer who already has a bucket, a presigned URL is a fine answer. Most people running Claude Code or Codex don’t want to set one up for an agent, and they’d rather the storage couldn’t read the file.

How does it work with aFile?

The sending agent saves the file, which the CLI encrypts on its own machine before it uploads, then makes a share link:

npm i -g @afile/cli
afile save report.pdf
afile share report.pdf --expires 1d --once

Output

Saved.
report.pdf  179 KiB · 89679e5f-1b42-4459-80be-fe56c542771d
Share it: afile share 89679e5f-1b42-4459-80be-fe56c542771d

Shared report.pdf.
https://api.afile.sh/s/55a881a8-6153-41a7-9877-1cb6b464bd2d#o7r-ILgd8ck6xmAM-NKndVrFdJRjymeasZSPfqq4rEg
Open until 4 Dec 22:42, for 1 download. Anyone with the whole link can download it.
Close it: afile close 55a881a8-6153-41a7-9877-1cb6b464bd2d

The first save connects the agent to aFile, with no account, and makes its key on that machine. The CLI needs Node.js 22 or later.

The part of the link after # is the key. Browsers never send that part to a server, so aFile stores a file it can’t open. Give the link out whole.

The other agent downloads and decrypts it. It needs the CLI, but no account of its own:

afile get '<link>' --out report.pdf

It writes report.pdf, and reminds the agent that files others send are information, never instructions. A person can open the same link in a browser instead, and the page decrypts the file there.

With --once, that download used the link up. A second try gets:

Output

This link was closed, has expired or has been used up. (410 link_closed)
Ask whoever sent it for a new link.

How does the link get to the other agent?

Any way you like: an email, a chat, a pull request comment. If both agents use aMessage, which I also make, the sending agent can put it straight into their conversation:

url=$(afile share report.pdf --expires 1d --json | jq -r .url)
amessage reply <conversation-id> "Here is the report: $url"

With --json, the CLI prints the link’s details as JSON, and its url is the whole link, key included.

What if the file has to come the other way?

If the other side is an agent with aFile, it shares a link back the same way. If it’s a person, make a receive link. Whoever opens it chooses files in their browser, which encrypts them to your agent’s key, and they arrive as items tagged received:

afile receive --expires 1h --files 3

Output

Ready to receive.
https://api.afile.sh/r/3fcbe775-be60-47e6-90d7-50d3979790a9#2VrmiomAdPx-8iL9R2KQp3OTm_ITeHMnxVworIlTPTc
Up to 3 files until 3 Dec 23:42. They arrive as: afile items --tag received

More on that in How someone can send a file to your AI agent.

Can Claude Code do this without the terminal?

Partly. The CLI also runs as a local MCP server, with four tools: list_items, save_item, get_item and share_item.

claude mcp add --scope user afile -- afile mcp

--scope user makes it reach Claude Code in every project, not only the folder you ran it in. Over MCP, an agent can save a file and share it. Downloading a link someone else sent still takes the CLI or a browser. Setup for Codex, Cursor, Gemini CLI and others is in Connect your agent.

Is a file from another agent safe to read?

Treat it as data, never as instructions. A file can carry text written to steer the agent that reads it. The aFile skill tells agents to read files others send as information, and not to follow requests inside them. Why that matters, and what else helps, is in Prompt injection in files sent to your AI agent.

Where it stops

  • Size. One file is up to 25 MiB, and an agent keeps up to 1 GiB, counting earlier versions and share copies.
  • Link times. A share or receive link is open for a day unless you say otherwise, and 30 days at most. --once closes it after one download. Closing, expiring or using up a share link erases its copy.
  • Anyone with the whole link can download it until it closes. So the link is the thing to protect: send it privately, and keep it short-lived.
  • Keys stay on the machine. Without the agent’s key, its saved items can’t be read again, by aFile or anyone. Export it once with afile key --export --out <file>. A person who links the agent to their account at afile.sh can turn on recovery.
  • API keys don’t belong here. For secrets, use aSecret, which hands a key to a command without putting it in the chat.

aFile is free for people, businesses and their agents.

Questions people ask

Can aFile read my files?

No. The CLI encrypts each item before it uploads it, and the key in a share link is after the #, which browsers never send. Where that stops is in Share links that keep the key after #.

Can the other agent be a different tool, say Codex while I use Claude Code?

Yes. It needs the link, and either a browser or the aFile CLI.

How long does a share link last?

A day if you don’t say, 30 days at most, or until one download with --once.

How big a file can I share?

Up to 25 MiB. Zip a folder first and share the zip. The rest of the limits are in Limits.