When a cloud session produces a report or export outside the repository, save it before the session ends. Give your user an expiring download link.
aFile gives the session another way out: one link to the file. The cloud machine encrypts the file before it uploads, and the link carries the key after #, so aFile never sees it. You open the link on your own computer and download the file there.
Let the environment reach aFile
Each cloud environment has its own network settings. A new one starts at Limited, with Allow package managers checked, so npm works and most other domains don’t. Add aFile’s API:
- At claude.ai/code, open the environment selector under the message box.
- Find your environment under Cloud, hover its row and click the settings icon.
- Leave Network access on Limited, and add one line to Allowed domains:
api.afile.shInstall the CLI when a session starts
In the same dialog, add a Setup script. It runs before Claude Code starts, each time a new session begins:
npm i -g @afile/cliThe cloud machines run Node.js 22. aFile’s CLI asks for Node.js 24, so npm prints a warning about it. The commands in this post work on 22: I ran them on Node.js 22.23.
Give the session the aFile skill
A cloud session gets your repository, not your home folder, so a skill in ~/.claude/skills doesn’t reach it. A skill in the project does. On your own computer, in the repository:
afile add -a claude-code --project
git add .claude/skills/afile
git commit -m "Add the aFile skill"Push it, and new sessions on that repository know how to use aFile. Without the skill, you can name the commands in your message instead.
Ask for the file
Send me coverage.html as a link. One download.
Claude saves the file, then shares it:
afile save coverage.html --expires 1d
afile share coverage.html --onceOutput
Saved. coverage.html 59 KiB · 40002740-fcce-4c5c-bb4c-4d98038c7d87 It is deleted 3 Dec 21:53. Share it: afile share 40002740-fcce-4c5c-bb4c-4d98038c7d87 Shared coverage.html. https://api.afile.sh/s/75ed2199-0265-4c34-b09c-ec344ffea9e8#B0JKB0591RPSeGg7ZiK9h0Smut9FaYBBJsy-tsvDhNE Open until 3 Dec 21:53, for 1 download. Anyone with the whole link can download it. Close it: afile close 75ed2199-0265-4c34-b09c-ec344ffea9e8
The first save connects the session to aFile as a new agent, with no account, and makes its key on the cloud machine. Open the whole link on your computer. The page decrypts the file in your browser, and you download it.
When the session ends
- The link keeps working until it closes: after the one download, or a day if you don’t say. The copy behind it is encrypted under the link’s own key, so it doesn’t need the cloud machine.
- The session’s own storage goes quiet. Its key was made on the cloud machine, so once the machine is gone, nobody can read what the session saved, aFile included. That’s why the save above has
--expires 1d: the item deletes itself, and nothing unreadable is left behind.
Questions people ask
Why not commit the file to a branch?
That works, and for files that belong with the code it’s the right place. A report or an export usually doesn’t: on a branch, it’s in the repository, where everyone with access to it can see it.
Can aFile read the file?
No. The CLI encrypts it on the cloud machine, and the link’s key exists only after the #, which browsers don’t send to the server. How that works is in Share links that keep the key after #.
How big can the file be?
Up to 25 MiB. Ask Claude to zip a folder first and share the zip. The rest of the limits are in Limits.
Can every session use the same storage?
Not without moving the agent’s token and key into the environment. Its environment variables can be read by anyone who uses the environment, so I’d let each session be its own agent, and keep what matters through links.
Does this work in Claude Code on my computer too?
Yes, without the network step. See How to share a file from Claude Code.