Prompt: mirror content that already exists on IPFS
Have an agent keep content that already lives on IPFS alive on the ird
gateway: given a CID, estimate size and cost, pin it (ird fetches it from
the network), hand you a gateway URL, optionally serve it unbranded at
your own hostname, verify the bytes actually arrived, and unpin it when
it has served its purpose.
Needs: ird access (MCP server or the ird CLI, logged in — ird ipfs get and ird ipfs url are CLI-only); the CID must still be reachable on the public IPFS network; for the custom hostname, a zone hosted on ird DNS
Costs: hourly per MB pinned plus per MB served through the gateway (credits_prices → recurring.ipfs-pin-hourly, per_mb_hour and per_mb_served); the pin request itself bills ipfs.writes
Group: hosting
Paste everything below the line into a fresh conversation. Fill in the
FILL IN block first.
Task
Pin CID on ird so it stays available even if the original host
disappears, verify the copy, and give me the URLs. Nothing is pinned
before I confirm the size estimate and the monthly cost.
FILL IN
CID: bafybeigdyr… # the content to mirror (a file or a folder root)
NAME: mirror:project-docs # pin name, so it is easy to find later
SIZE_CAP: 500 # MB — stop and ask if the estimate or the fetched size is above this
HOST: mirror.example.ro # serve it at https://HOST/ipfs/CID too (blank = gateway URL only)
KEEP_UNTIL: 2026-12-31 # when to unpin (or "keep")
Non-negotiable rules
- Estimate, then confirm. ird only knows the size once the content
is fetched (
ird ipfs pin --help). Before pinning, estimate it from
outside (step A), compute per_mb_hour × MB × 730, show it, and wait
for a yes. Over SIZE_CAP: ask.
- Pin once.
ipfs_pin blocks until pinned and can take a while on
large content. Never call it twice for the same CID on a timeout —
check ipfs_pins(search=CID) first; a second pin may be a second bill.
- Unreachable content is a failed pin, not a retry loop. The
schema says the content must be reachable on the network. A pin in
state
failed (see last_error) gets reported to me; one retry at
most, on my say.
- Verify before you call it mirrored. Bytes through the ird
gateway, not the original host, must match what I expected.
- Unpin only by my confirmation. Unpinning stops serving and
billing; if HOST is attached, detach the pin from it
first.
Steps
A. Estimate. Read credits_prices → recurring.ipfs-pin-hourly.
Size, best effort, from outside ird: curl -sI
https://ipfs.io/ipfs/CID (Content-Length, single files only) or
ipfs dag stat CID with a local kubo (folders too). If neither
answers, say so and defer the SIZE_CAP check to the pin's size_bytes.
Show: estimated MB, monthly cost, credits_balance.
B. Wait for my yes.
C. Pin. ipfs_pin(cid=CID, name=NAME) (CLI: ird ipfs pin CID
--name NAME). It returns the pin with its size_bytes, state and
gateway_url. If the tool times out, do not repeat it —
ipfs_pins(search=CID) (CLI: ird ipfs pins --search CID) shows the
pin in queued, pinning, pinned or failed; poll at most once a
minute. Once pinned, recompute the cost from the real size_bytes;
above SIZE_CAP, stop and ask whether to keep it or unpin.
D. Gateway URL. The pin's gateway_url (CLI: ird ipfs url CID).
Fetch it once to confirm it answers.
E. Custom hostname (if HOST). HOST's zone must be in
dns_list_zones. ipfs_domain_add(domain=HOST, pins=[CID]) (CLI:
ird ipfs domains add HOST --pin CID) — the A record is written
automatically and only the attached pins are served; every other
/ipfs path on HOST 404s. HOST must not keep an AAAA record pointing
elsewhere (the gateway is IPv4-only; a stale AAAA blocks the
certificate) — check dns_get_zone. Later pins go on with
ipfs_domain_pins_update(domain=HOST, add=[…]) (CLI: ird ipfs
domains pins HOST --add …); it is a delta, never a full-list replace.
Wait for ipfs_domains to show HOST active, then fetch
https://HOST/ipfs/CID.
F. Verify the bytes. With the CLI: ird ipfs get CID -o ./check
(a folder unpacks into a directory), then sha256sum against a copy
you already have, or at least the byte count against size_bytes and
a known path inside a folder. Delete ./check afterwards. Without a
shell: ipfs_pins shows state=pinned with a non-zero size_bytes
and the gateway URL fetches — and say that is all that was checked.
G. Cost recap. ipfs_usage (CLI: ird ipfs usage) → bytes pinned,
bytes served this period, hourly and monthly cost.
H. Takedown (on KEEP_UNTIL, or when I say). If HOST serves the pin:
ipfs_domain_pins_update(domain=HOST, remove=[CID]), and
ipfs_domain_delete(domain=HOST) (CLI: ird ipfs domains rm HOST) if
nothing else is attached. Then ipfs_unpin(pin=CID) (CLI: ird ipfs
pin rm CID). ipfs_pins(search=CID) must no longer list it as
pinned; billing for it stops.
Deliverable
CID, pin id and name, size_bytes and the monthly cost from the real
size, the gateway URL, https://HOST/ipfs/CID if attached, what the
verification compared and its result, and the exact takedown commands
with the KEEP_UNTIL date.