| name | agent-fs |
| description | Use when the user wants to store, retrieve, search, or manage files in agent-fs — an agent-first filesystem backed by S3. Triggers on: "save this to agent-fs", "find that file", "store this document", "search agent-fs", "list my files", "show version history", "revert file", "set up agent-fs", "get a signed url", "share this file", "manage members", "invite user", "list members", "remove member", "update role", file persistence for agents, shared agent filesystem, or any mention of the agent-fs CLI. Also use when the user needs to manage drives, manage org/drive members, generate presigned URLs, check recent activity, or use semantic search across stored files. Also use when the user wants to mount or unmount agent-fs as a Linux FUSE filesystem ("mount agent-fs", "fuse mount", "fuse", "remote mount", "sandbox mount", "expose drives as files", "use cat/grep/mv on my agent-fs files", "umount the drive", "mount a remote drive", "mount from sprite", "mount from e2b", "mount from hetzner"). If the user mentions agent-fs in any context, always consult this skill. |
agent-fs CLI
agent-fs is an agent-first filesystem backed by S3 with full versioning, full-text search (FTS5), and semantic search. It provides a CLI that outputs JSON, making it ideal for agent workflows. Files are organized in drives within orgs.
Quick Start
agent-fs onboard -y
agent-fs daemon start
echo "hello world" | agent-fs write docs/readme.txt -m "initial version"
agent-fs cat docs/readme.txt
For custom S3 (AWS, R2, etc.), use flags: agent-fs onboard --s3-endpoint <url> --s3-bucket <name> --s3-access-key <key> --s3-secret-key <key>.
Essential Patterns
-
All output is JSON — always parse CLI output as JSON (except daemon status and auth register which print human-readable text).
-
Auto-detection — the CLI automatically detects whether the daemon is running. If it is, commands go via HTTP; otherwise, they use embedded mode directly. No user action needed.
-
Stdin piping for content — write and append accept content via stdin or --content:
echo "content here" | agent-fs write path/to/file.txt
agent-fs write path/to/file.txt --content "short text"
-
Paths — forward-slash separated, no leading slash required. Example: docs/notes/meeting.md
-
Version messages — optional but recommended for auditability:
agent-fs write docs/spec.md --content "..." -m "added API section"
-
Optimistic concurrency — use --expected-version on write to prevent conflicts:
agent-fs write config.json --content '{}' --expected-version 3
Command Quick Reference
File Operations
| Command | Usage | Description |
|---|
write | agent-fs write <path> [--content <text>] [-m <msg>] [--expected-version <n>] | Write content (stdin or --content) |
cat | agent-fs cat <path> [--offset <n>] [--limit <n>] | Read file content |
edit | agent-fs edit <path> --old <text> --new <text> [-m <msg>] | Find-and-replace in file |
append | agent-fs append <path> [--content <text>] [-m <msg>] | Append to file (stdin or --content) |
tail | agent-fs tail <path> [--lines <n>] | Last N lines (default: 20) |
ls | agent-fs ls [path] | List directory contents (defaults to /) |
stat | agent-fs stat <path> | Show file metadata (size, version, timestamps) |
tree | agent-fs tree [path] [--depth <n>] | Recursive directory listing |
glob | agent-fs glob <pattern> [path] | Find files by pattern (*.md, **/*.md) |
rm | agent-fs rm <path> | Delete a file |
mv | agent-fs mv <from> <to> [-m <msg>] | Move or rename a file |
cp | agent-fs cp <from> <to> | Copy a file |
signed-url | agent-fs signed-url <path> [--expires-in <seconds>] | Generate a presigned URL for direct download (default: 24h, max: 7 days) |
Versioning
| Command | Usage | Description |
|---|
log | agent-fs log <path> [--limit <n>] | Show version history |
diff | agent-fs diff <path> --v1 <n> --v2 <n> | Diff between versions |
revert | agent-fs revert <path> --version <n> | Revert to a previous version |
Search & Discovery
| Command | Usage | Description |
|---|
grep | agent-fs grep <pattern> <path> | Regex search in file content |
fts | agent-fs fts <pattern> [path] | Full-text search (FTS5) across all files |
search | agent-fs search <query> [--limit <n>] | Hybrid search (semantic + keyword, best for general queries) |
vec-search | agent-fs vec-search <query> [--limit <n>] | Vector-only semantic search using embeddings |
recent | agent-fs recent [path] [--since <duration>] [--limit <n>] | Recent activity (e.g., --since 24h) |
reindex | agent-fs reindex [path] | Re-index files with failed/missing embeddings |
When to use which:
grep — you know the exact pattern and path (regex)
fts — keyword search across all files (fast, FTS5-based)
search — general-purpose search combining keywords and meaning (recommended default)
vec-search — pure semantic search when you want conceptual matches only
Comments
| Command | Usage | Description |
|---|
comment add | agent-fs comment add <path> --body <text> [--line-start <n>] [--line-end <n>] | Add a comment to a file |
comment reply | agent-fs comment reply <comment-id> --body <text> | Reply to a comment |
comment list | agent-fs comment list [path] | List comments (with inline replies) |
comment get | agent-fs comment get <id> | Get a comment with its replies |
comment update | agent-fs comment update <id> --body <text> | Update a comment (author only) |
comment delete | agent-fs comment delete <id> | Soft-delete a comment (author only) |
comment resolve | agent-fs comment resolve <id> | Resolve a comment |
Setup & Auth
| Command | Usage | Description |
|---|
onboard | agent-fs onboard [--local] [-y] [--embeddings <provider>] | Set up agent-fs (S3 + database + user) |
init | agent-fs init [--local] [-y] | Alias for onboard |
auth register | agent-fs auth register <email> | Register a new user |
auth whoami | agent-fs auth whoami | Show current user info |
Member Management
| Command | Usage | Description |
|---|
member list | agent-fs member list | List org members (use --drive <id> for drive members) |
member invite | agent-fs member invite <email> --role <role> | Invite user to org (viewer/editor/admin) |
member update-role | agent-fs member update-role <email> --role <role> | Update org role (use --drive <id> for drive role) |
member remove | agent-fs member remove <email> | Remove from org (use --drive <id> for drive only) |
The --drive flag is a global option — place it before the subcommand: agent-fs --drive <id> member list.
Drive Management
| Command | Usage | Description |
|---|
drive list | agent-fs drive list | List drives in current org |
drive create | agent-fs drive create <name> | Create a new drive |
drive current | agent-fs drive current | Show current drive context |
drive invite | agent-fs drive invite <email> --role <role> | Invite user (viewer/editor/admin) |
Config & Daemon
| Command | Usage | Description |
|---|
config get | agent-fs config get <key> | Get config value (dot notation: s3.bucket) |
config set | agent-fs config set <key> <value> | Set config value |
config list | agent-fs config list | Show all configuration |
config validate | agent-fs config validate | Check S3, database, auth, embeddings health |
daemon start | agent-fs daemon start | Start the background daemon |
daemon stop | agent-fs daemon stop | Stop the daemon |
daemon status | agent-fs daemon status | Check if daemon is running |
FUSE Mount (Linux only)
Expose all org drives as a Linux FUSE filesystem so agents can use plain shell verbs (cat, grep, mv, rm) against agent-fs content. Requires /dev/fuse and SYS_ADMIN cap; not available on macOS or in gVisor-based sandboxes.
Two topologies are supported:
- Local mode (default): helper talks to a local daemon over a Unix socket. Daemon must be running and have an S3 backend configured.
- Remote mode (
--remote): helper talks directly to a remote agent-fs HTTP API. No local daemon required — ideal for sandboxes (sprite, E2B, Hetzner VMs, GitHub Actions runners) that can reach a hosted agent-fs but can't run the full daemon stack.
| Command | Usage | Description |
|---|
mount | agent-fs mount <path> [--allow-other] [--foreground] | Mount drives at <path> via local daemon (e.g. /mnt/agent-fs/<drive>/). |
mount --remote | agent-fs mount <path> --remote [--api-url <url>] [--api-key <key>] | Mount against a remote agent-fs HTTP API. Reads apiUrl/apiKey from ~/.agent-fs/config.json or AGENT_FS_API_URL/AGENT_FS_API_KEY env if flags omitted. Prefer env over --api-key (the latter exposes the key in ps). |
umount | agent-fs umount <path> | Unmount the FUSE mountpoint. |
mount status | agent-fs mount status | Show whether a mount is active and where. |
Common Workflows
Store and retrieve a document
cat <<'EOF' | agent-fs write reports/q1-summary.md -m "Q1 summary draft"
Revenue grew 15% quarter over quarter.
EOF
agent-fs cat reports/q1-summary.md
agent-fs stat reports/q1-summary.md
Search across files
agent-fs grep "revenue|growth" reports/
agent-fs fts "quarterly revenue"
agent-fs search "financial performance metrics" --limit 5
agent-fs vec-search "financial performance metrics" --limit 5
Review and revert changes
agent-fs log docs/spec.md --limit 10
agent-fs diff docs/spec.md --v1 2 --v2 5
agent-fs revert docs/spec.md --version 2
Comments and collaboration
agent-fs comment add docs/spec.md --body "Needs more detail on auth"
agent-fs comment reply <comment-id> --body "Added in v3"
agent-fs comment list docs/spec.md
agent-fs comment resolve <comment-id>
Set up a new drive and invite users
agent-fs drive create "team-docs"
agent-fs drive invite alice@company.com --role editor
agent-fs drive current
Manage members
agent-fs member list
agent-fs --drive <driveId> member list
agent-fs member invite alice@company.com --role editor
agent-fs member update-role alice@company.com --role admin
agent-fs member remove alice@company.com
agent-fs --drive <driveId> member remove alice@company.com
Check recent activity
agent-fs recent --since 1h
agent-fs recent docs/ --since 24h --limit 20
Generate a shareable download link
agent-fs signed-url docs/report.pdf
agent-fs signed-url docs/report.pdf --expires-in 3600
agent-fs signed-url docs/report.pdf --json
The presigned URL requires no authentication — anyone with the link can download the file until it expires. Signed URLs serve the correct Content-Type header based on file extension (e.g., application/pdf for .pdf, image/png for .png), so browsers render them natively.
MIME types on upload: write, edit, append, and revert automatically detect and set the correct Content-Type on S3 objects based on file extension. The content type is also stored in the database and visible in stat output via the contentType field.
App URL in responses
When AGENT_FS_APP_URL is set (e.g., https://live.agent-fs.dev), file-related ops automatically include an appUrl field pointing to the file in the live web app:
AGENT_FS_APP_URL=https://live.agent-fs.dev agent-fs stat docs/report.pdf --json
This applies to any op that returns a path or to field (write, stat, edit, append, rm, cp, mv, signed-url, etc.).
Validate your setup
agent-fs config validate
Mount a remote drive from a sandbox
Use --remote when the agent is running in a Linux sandbox (sprite, E2B, Hetzner VM, GitHub Actions runner, etc.) that can reach a hosted agent-fs HTTP API but cannot run the full daemon + S3 stack locally.
sudo apt-get install -y fuse3
sudo chmod 666 /dev/fuse
sudo ln -sf /proc/mounts /etc/mtab
echo user_allow_other | sudo tee -a /etc/fuse.conf
export AGENT_FS_API_URL=https://agent-fs.example.com
export AGENT_FS_API_KEY=<key>
mkdir -p ~/mnt
agent-fs mount ~/mnt --remote
ls ~/mnt
cat ~/mnt/current/docs/spec.md
echo "edit from sandbox $(date)" > ~/mnt/current/notes.txt
fusermount3 -u ~/mnt
See docs/mounting/ for per-environment guides (sprite, E2B, Hetzner).