Storacha Upload
Upload, manage, and retrieve files on IPFS via Storacha decentralized storage.
AGENT EXECUTION NOTE: All storacha CLI commands in this skill are non-interactive when arguments are provided. You MUST execute them directly — never tell the user to "run this command manually" or say "I can't run this". The only user interaction needed is: (1) asking for their email for login, and (2) telling them to click the verification email link. Everything else you handle silently.
PUBLIC DATA WARNING: All files uploaded to Storacha/IPFS are publicly accessible. Anyone with the CID can retrieve them. Never upload unencrypted sensitive data.
PERMANENT DATA WARNING: Removing a file only deletes it from your listing. Other IPFS nodes may retain copies indefinitely. Treat every upload as permanent.
Understanding User Intent
Users will send casual, natural language messages. Match their intent to the correct action:
| User says something like... | Action |
|---|
| "upload this image/photo/file", "save this to IPFS", "put this on storacha", "store this pic" | Upload — save the attached/referenced file, then upload with INLINECODE1 |
| "how much space do I have", "storage left?", "am I running out of space", "check my usage" |
Usage — run
storacha usage report and show human-readable stats |
| "create a space", "make a new space", "new storage space" |
Create Space — ask for a name (or suggest one), run
storacha space create "Name" --no-recovery |
| "login to storacha", "set up storacha", "connect my storacha", "authenticate" |
Login — start the authentication flow (Step 2a) |
| "show my uploads", "what have I uploaded", "list my files", "my IPFS files" |
List — run
storacha ls and present results |
| "delete this", "remove this upload", "remove CID" |
Remove — run
storacha rm CID with appropriate warnings |
| "get me the link", "share this file", "IPFS link for this", "download link" |
Retrieve — construct and share both gateway URLs |
| "switch space", "use my other space", "change space" |
Switch Space — run
storacha space ls, then
storacha space use |
| "check storacha", "storacha status", "is storacha working" |
Health Check — run full diagnostic (Steps 1-5) |
Rules for handling user messages:
- 1. Always check authentication first. Before any operation, silently run
storacha whoami. If not authenticated, start the login flow and tell the user what's happening. - Handle file attachments. If the user sends a file/image/document with a message like "upload this", save the attachment to a temp location first, then run
storacha up on it. After upload, share the gateway URL back. - Be proactive with results. After uploading, always share the gateway link. After checking usage, always convert bytes to human-readable. After listing uploads, format them neatly.
- Don't dump raw CLI output. Parse command output and respond in friendly, conversational language. The user doesn't want to see raw terminal text.
- Auto-recover from errors. If a command fails because there's no active space, silently fix it (create or select a space) and retry. Only ask the user if you truly need their input (like their email for login).
Prerequisites
Run this before anything else:
CODEBLOCK0
If storacha is not found, install it:
CODEBLOCK1
Requires Node.js v18+. Verify with node -v. If missing or outdated, direct the user to nodejs.org.
First-Time Setup & Authentication
Complete these steps in order before any upload operation.
Step 1 — Check CLI Installation
CODEBLOCK2
Expected output:
CODEBLOCK3
If missing, install:
CODEBLOCK4
Then re-run the check. If install fails, verify Node.js v18+ is available.
Step 2 — Check Authentication
CODEBLOCK5
If output contains did:key: → authenticated. Proceed to Step 3.
If error or no DID → not logged in. Go to Step 2a.
Step 2a — Login Flow
This is a conversation with the user. The user may be chatting from Telegram, WhatsApp, Discord, or any other platform. Guide them through each step and wait for their response before moving on.
Step A — Ask for email:
If the user hasn't provided their email yet, ask:
"To use Storacha, I need to log you in. What's your email address? If you don't have a Storacha account yet, you can sign up for free at https://console.storacha.network and then give me your email."
If the user already provided their email (e.g. "login to storacha, my email is user@example.com"), skip asking and go straight to Step B.
DO NOT proceed until you have the user's email address.
Step B — Run login:
IMPORTANT: The storacha login command is NOT interactive when you pass the email as an argument. You MUST run it directly. Do NOT tell the user to run it manually. Do NOT say you can't run it. YOU run it.
CODEBLOCK6
Replace user@example.com with the actual email the user gave you. This command:
- - Takes the email as a command-line argument (no prompts, no interactive input needed)
- Sends a verification email automatically
- Blocks (waits) until the user clicks the link in their email
- Returns
Agent was authorized by did:mailto:... on success
Right after running the command, message the user:
"I've started the login process. A verification link has been sent to user@example.com. Please check your inbox (and spam folder) and click the link. I'm waiting for confirmation."
DO NOT run any other commands while waiting. The CLI will automatically detect when the user clicks the link.
Step C — Handle new accounts:
If this is the user's first time, they may need to select a plan after clicking the verification link. Inform them:
"Since this is your first login, you may be asked to pick a plan on the page that opens. Here are your options:"
| Plan | Price | Storage | Egress | Overage |
|---|
| Mild (Free) | $0/month | 5 GB | 5 GB | $0.15/GB |
| Medium |
$10/month | 100 GB | 100 GB | $0.05/GB |
| Extra Spicy | $100/month | 2 TB | 2 TB | $0.03/GB |
"The free Mild plan gives you 5 GB which is enough to get started."
Step D — Confirm success:
After the CLI returns successfully, verify by running:
CODEBLOCK7
If it returns a did:key: value, tell the user:
"You're all set! Successfully logged in to Storacha."
If it fails, ask the user to try clicking the verification link again or check if they used the correct email.
Step 3 — Check Spaces
CODEBLOCK8
Expected output:
CODEBLOCK9
The * marks the active space.
- - If spaces exist with
* marker → active space is set. Proceed to Step 4. - If no spaces exist → automatically create one:
storacha space create "MyFiles" --no-recovery
Then tell the user:
> "I've created a storage space called 'MyFiles' for you. This is where your uploads will be stored."
Space names are permanent and cannot be changed.
- - If spaces exist but none is active → pick the first one and activate it:
storacha space use "SpaceName"
Then tell the user:
> "I've set 'SpaceName' as your active storage space."
Handle all of this silently without asking the user to run commands. The user is chatting — they expect you to do the work and just confirm what happened.
Step 4 — Verify Provider Registration
CODEBLOCK12
Expected output includes:
CODEBLOCK13
If no provider is listed, the space is not registered. Direct the user to https://console.storacha.network to register the space, or create a new space.
Step 5 — Check Storage Usage
CODEBLOCK14
Expected output format:
CODEBLOCK15
Parse the Size value and convert to human-readable format:
- - < 1024 → bytes
- < 1,048,576 → KB
- < 1,073,741,824 → MB
- >= 1,073,741,824 → GB
Present a status dashboard to the user:
CODEBLOCK16
If storage is above 80% of plan limit, warn the user and suggest upgrading or removing old uploads.
If the usage report returns a permission error, inform the user but note that uploads may still work.
Core Operations
Upload a File
When a user asks to upload something (file, image, photo, document, video, etc.):
- 1. If the user attached a file — save it to a temp location (e.g.
/tmp/upload/filename.ext) - If the user referenced a file path — use that path directly
- Silently verify auth and active space — run
storacha whoami and storacha space ls. Fix any issues without bothering the user. - Upload:
CODEBLOCK17
- 5. Parse the output and respond conversationally:
"Done! Your file is uploaded to IPFS. Here's your link:
https://storacha.link/ipfs/bafy...
Anyone with this link can access the file."
Always provide both gateway URL styles:
- - Path style: INLINECODE23
- Subdomain style: INLINECODE24
If uploading an image/photo, also mention:
"You can share this link directly — it works in any browser."
Upload a Directory
CODEBLOCK18
- - Dotfiles (hidden files) are excluded by default. Use
--hidden to include them. - Use
--no-wrap to upload without wrapping in a directory (loses filename in URL).
For directory uploads, files are accessible at:
CODEBLOCK19
List Uploads
CODEBLOCK20
Displays all uploads in the current space with their CIDs.
Remove an Upload
CODEBLOCK21
To also remove underlying data shards:
CODEBLOCK22
Warn the user: removal only deletes from your listing. The data may persist on other IPFS nodes indefinitely.
Retrieve / Open a File
Open in browser:
CODEBLOCK23
Download programmatically:
CODEBLOCK24
Subdomain style:
curl -o output.txt "https://CID.ipfs.storacha.link"
Space Management
Create a space:
storacha space create "ProjectName" --no-recovery
IMPORTANT: Always use
--no-recovery flag. Without it, the CLI prompts interactively for a recovery key which will hang in non-interactive environments. Space names are permanent and cannot be changed after creation.
List all spaces:
storacha space ls
The active space is marked with
*.
Switch active space:
storacha space use "SpaceName"
Or by DID:
CODEBLOCK29
View space details:
storacha space info
Shows the space DID and registered providers.
Sharing & Delegation
Create a UCAN delegation for another agent:
CODEBLOCK31
Full admin delegation:
CODEBLOCK32
List active delegations:
storacha delegation ls
Error Handling
- 1. "command not found: storacha" → Install CLI: INLINECODE29
- "no proofs available for resource" → Re-login with
storacha login EMAIL or switch spaces with INLINECODE31 - "Not registered with provider" → Run
storacha space info to check providers. Re-register at https://console.storacha.network or create a new space. - Upload hangs or times out → Check internet connection. Retry the upload. For large files, ensure stable connectivity.
- "usage/report" permission error → This is informational only. Uploads should still work. Proceed with the operation.
- "no spaces" or empty space list → Create a space: INLINECODE33
- Storage limit errors → Upgrade plan at https://console.storacha.network or remove old uploads: INLINECODE34
Quick Reference
| Action | Command |
|---|
| Install CLI | INLINECODE35 |
| Login |
storacha login user@email.com |
| Check identity |
storacha whoami |
| Create space |
storacha space create "Name" --no-recovery (always use --no-recovery) |
| List spaces |
storacha space ls |
| Switch space |
storacha space use "Name" |
| Space details |
storacha space info |
| Upload file |
storacha up /path/to/file |
| Upload directory |
storacha up /path/to/dir/ |
| Upload without wrap |
storacha up /path --no-wrap |
| Upload with dotfiles |
storacha up /path --hidden |
| List uploads |
storacha ls |
| Remove upload |
storacha rm CID |
| Remove with shards |
storacha rm CID --shards |
| Open in browser |
storacha open CID |
| Check usage |
storacha usage report |
| Create delegation |
storacha delegation create DID --can store/add --output file.ucan |
| List delegations |
storacha delegation ls |
Important Notes
- - Authentication is email-based using DIDs and UCAN. There are no API keys or tokens.
- Spaces are storage namespaces identified by
did:key. Each space tracks its own uploads independently. - Content-addressing means every file gets a unique CID based on its contents. Identical files produce identical CIDs.
- Filecoin backup provides cryptographic proof of storage on the Filecoin network.
- Two gateway URL styles are available:
- Path:
https://storacha.link/ipfs/CID
- Subdomain:
https://CID.ipfs.storacha.link
- - The current CLI binary is
storacha. It was previously called w3 during the web3.storage era.
Storacha 上传
通过 Storacha 去中心化存储,在 IPFS 上上传、管理和检索文件。
智能体执行说明: 本技能中所有 storacha CLI 命令在提供参数时均为非交互式。您必须直接执行它们——切勿告诉用户请手动运行此命令或说我无法运行它。唯一需要用户交互的是:(1) 询问他们的邮箱以进行登录,(2) 告知他们点击验证邮件链接。其他所有操作均由您静默处理。
公共数据警告: 所有上传到 Storacha/IPFS 的文件均可公开访问。任何拥有 CID 的人都可以检索它们。切勿上传未加密的敏感数据。
永久数据警告: 删除文件仅会将其从您的列表中移除。其他 IPFS 节点可能无限期保留副本。请将每次上传视为永久性操作。
理解用户意图
用户会发送随意、自然语言的消息。将他们的意图匹配到正确的操作:
| 用户说类似... | 操作 |
|---|
| 上传这张图片/照片/文件、保存到 IPFS、放到 storacha 上、存储这张图片 | 上传 — 保存附件/引用的文件,然后使用 storacha up 上传 |
| 我还有多少空间、剩余存储?、我是不是快没空间了、检查我的使用量 |
用量 — 运行 storacha usage report 并显示人类可读的统计数据 |
| 创建一个空间、新建一个空间、新的存储空间 |
创建空间 — 询问名称(或建议一个),运行 storacha space create 名称 --no-recovery |
| 登录 storacha、设置 storacha、连接我的 storacha、身份验证 |
登录 — 启动身份验证流程(步骤 2a) |
| 显示我的上传、我上传了什么、列出我的文件、我的 IPFS 文件 |
列出 — 运行 storacha ls 并展示结果 |
| 删除这个、移除这个上传、移除 CID |
移除 — 运行 storacha rm CID 并附带适当的警告 |
| 给我链接、分享这个文件、这个的 IPFS 链接、下载链接 |
检索 — 构建并分享两个网关 URL |
| 切换空间、使用我的另一个空间、更换空间 |
切换空间 — 运行 storacha space ls,然后运行 storacha space use |
| 检查 storacha、storacha 状态、storacha 是否正常工作 |
健康检查 — 运行完整诊断(步骤 1-5) |
处理用户消息的规则:
- 1. 始终先检查身份验证。 在任何操作之前,静默运行 storacha whoami。如果未通过身份验证,启动登录流程并告知用户正在发生什么。
- 处理文件附件。 如果用户发送了文件/图片/文档并附带了类似上传这个的消息,先将附件保存到临时位置,然后对其运行 storacha up。上传后,返回网关链接。
- 主动提供结果。 上传后,始终分享网关链接。检查用量后,始终将字节转换为人类可读格式。列出上传后,整洁地格式化它们。
- 不要直接转储原始 CLI 输出。 解析命令输出并以友好、对话式的语言回应。用户不想看到原始的终端文本。
- 自动从错误中恢复。 如果命令因没有活动空间而失败,静默修复(创建或选择一个空间)并重试。仅在确实需要用户输入时才询问他们(例如登录时的邮箱)。
前提条件
在执行任何其他操作之前运行:
bash
which storacha && storacha --version
如果未找到 storacha,安装它:
bash
npm install -g @storacha/cli
需要 Node.js v18+。使用 node -v 验证。如果缺失或版本过旧,引导用户访问 nodejs.org。
首次设置与身份验证
在任何上传操作之前,按顺序完成以下步骤。
步骤 1 — 检查 CLI 安装
bash
which storacha && storacha --version
预期输出:
/usr/local/bin/storacha
x.y.z
如果缺失,安装:
bash
npm install -g @storacha/cli
然后重新运行检查。如果安装失败,验证 Node.js v18+ 是否可用。
步骤 2 — 检查身份验证
bash
storacha whoami
如果输出包含 did:key: → 已通过身份验证。继续执行步骤 3。
如果出现错误或没有 DID → 未登录。转到步骤 2a。
步骤 2a — 登录流程
这是与用户的对话。用户可能通过 Telegram、WhatsApp、Discord 或任何其他平台聊天。引导他们完成每个步骤,并在继续之前等待他们的回应。
步骤 A — 询问邮箱:
如果用户尚未提供邮箱,请询问:
要使用 Storacha,我需要登录您的账号。请问您的邮箱地址是什么?如果您还没有 Storacha 账户,可以在 https://console.storacha.network 免费注册,然后告诉我您的邮箱。
如果用户已经提供了邮箱(例如登录 storacha,我的邮箱是 user@example.com),跳过询问直接进入步骤 B。
在获得用户的邮箱地址之前,请勿继续。
步骤 B — 运行登录:
重要提示:当您将邮箱作为参数传递时,storacha login 命令是非交互式的。您必须直接运行它。不要告诉用户手动运行它。不要说您无法运行它。由您来运行它。
bash
storacha login user@example.com
将 user@example.com 替换为用户给您的实际邮箱。此命令:
- - 将邮箱作为命令行参数(无需提示,无需交互输入)
- 自动发送验证邮件
- 阻塞(等待)直到用户点击邮件中的链接
- 成功时返回 Agent was authorized by did:mailto:...
运行命令后,立即给用户发送消息:
我已启动登录流程。验证链接已发送至 user@example.com。请检查您的收件箱(以及垃圾邮件文件夹)并点击链接。我正在等待确认。
等待期间不要运行任何其他命令。 CLI 会在用户点击链接时自动检测到。
步骤 C — 处理新账户:
如果这是用户首次使用,他们可能需要在点击验证链接后选择一个套餐。告知他们:
由于这是您首次登录,您可能会在打开的页面上被要求选择一个套餐。以下是您的选项:
| 套餐 | 价格 | 存储空间 | 出站流量 | 超额费用 |
|---|
| Mild(免费) | $0/月 | 5 GB | 5 GB | $0.15/GB |
| Medium |
$10/月 | 100 GB | 100 GB | $0.05/GB |
| Extra Spicy | $100/月 | 2 TB | 2 TB | $0.03/GB |
免费的 Mild 套餐提供 5 GB 空间,足以开始使用。
步骤 D — 确认成功:
CLI 成功返回后,通过运行以下命令验证:
bash
storacha whoami
如果返回 did:key: 值,告知用户:
一切就绪!已成功登录 Storacha。
如果失败,请用户再次尝试点击验证链接,或检查他们是否使用了正确的邮箱。
步骤 3 — 检查空间
bash
storacha space ls
预期输出:
- * did:key:z6Mk... SpaceName
did:key:z6Mk... AnotherSpace
- - 如果存在带有 * 标记的空间 → 活动空间已设置。继续执行步骤 4。
- 如果不存在空间 → 自动创建一个:
bash
storacha space create MyFiles --no-recovery
然后告知用户:
> 我已为您创建了一个名为MyFiles的存储空间。您的上传内容将存储在此处。
空间名称是永久性的,创建后无法更改。
- - 如果存在空间但没有活动空间 → 选择第一个并激活它:
bash
storacha space use SpaceName
然后告知用户:
> 我已将SpaceName设置为您的活动存储空间。
静默处理所有这些操作,无需要求用户运行命令。用户正在聊天——他们期望您完成工作并仅确认发生了什么。
步骤 4 — 验证提供商注册
bash
storacha space info
预期输出包括:
Providers: did:web:web3.storage
如果没有列出提供商,则空间未注册。引导用户访问 https://console.storacha.network 注册空间,或创建一个新空间。
步骤 5 — 检查存储使用量
bash