Guide

Connect a whole directory tree as a tarball

Connect a multi-file archive into the core and have your agent unpack it via `sh`. A worked example with the exact path-canonicalisation rules.

5/18/2026 · connect0 · 3 min

Connect an entire directory tree into the core in one shot — pack it, and your agent unpacks it on the other side.

You have a directory tree to share. Don't upload each file — pack it.

The flow

tar -czf project.tar.gz ./project/
wc -c < project.tar.gz   # → e.g. 4194304

Ask the agent for a link:

> Make me an upload link for project.tar.gz — 4,194,304 bytes, application/x-gzip.

The agent calls:

upload.create_link {
  "account_slug": "acme",
  "project_slug": "demo",
  "target_path": "archives/project.tar.gz",
  "content_type": "application/x-gzip",
  "content_length": 4194304
}

You PUT:

curl --upload-file ./project.tar.gz \
     -H 'content-type: application/x-gzip' \
     '<upload_url>'

Then ask the agent to unpack:

> Unpack archives/project.tar.gz into /workspace/project and list the top-level entries.

Agent runs:

sh "mkdir -p /workspace/project && tar -xzf /workspace/archives/project.tar.gz -C /workspace/project --strip-components=1 && ls /workspace/project"

Path canonicalisation — what survives

The target_path you pass to upload.create_link has strict rules:

  • Relative (no leading /).
  • No .. segments anywhere.
  • No segment starts with . (so no .git, no .env).
  • Characters in [A-Za-z0-9._-/] only.
  • ≤ 256 chars.

The contents of the tarball aren't subject to those rules — once it's on disk, tar extracts whatever's inside. If your archive contains .env files or files with spaces, they'll appear under /workspace/... after extraction. The upload key (archives/project.tar.gz) is the only thing canonicalised.

Cleanup

The archive itself sticks around in /workspace/archives/ until you delete it:

sh "rm /workspace/archives/project.tar.gz"

R2 storage is cheap but the file is part of your project's /workspace/ budget. Worth removing for very large archives.

When --strip-components is the right call

tar -czf project.tar.gz ./project/ creates entries like project/file.txt. Without --strip-components=1, extracting under /workspace/project gives you /workspace/project/project/file.txt — one too many levels. Strip-components matches up with the canonical "I made the archive from inside the dir" workflow.

Next steps

Where this fits

This is the Connect everything pillar of connect0 — the core that connects everything your company runs on. Packing a tree into one archive connects a whole codebase or dataset into the core in a single transfer, ready for your agent to unpack and work through. Start building → · All guides →