diskd CLI
diskd is a Rust command-line client for diskd platform and Drive APIs. It gives humans,
shell scripts, and coding agents a Unix-style interface for listing, reading,
searching, uploading, syncing, and querying Drive files through the public
apis-service gateway. Output is human text by default and machine-readable
JSON with --json.
Command Shape
diskd [GLOBAL FLAGS] <command> [ARGS] [FLAGS]
Global flags MUST be placed before the subcommand. diskd --json ls docs
works; diskd ls docs --json does not.
| Global flag |
Purpose |
--json |
Print machine-readable JSON where supported. |
-q, --quiet |
Reduce progress/status messages on stderr; skips the startup update check. |
--base-url <url> |
Override the gateway base URL for one command. |
-p, --project <id> |
Override the current project for one command. |
-w, --workspace <id> |
Reserved compatibility flag; workspace scope comes from the token, not this flag. |
--config <path> |
Use a custom config file instead of $DISKD_HOME/config.yaml. |
Install
# Latest release (detects platform, verifies .sha256, installs `diskd`)
curl -fsSL https://raw.githubusercontent.com/diskd-ai/diskd-cli/main/install.sh | sh
# Pin a version
curl -fsSL https://raw.githubusercontent.com/diskd-ai/diskd-cli/main/install.sh | DISKD_VERSION=v0.2.0 sh
# Custom directory
curl -fsSL https://raw.githubusercontent.com/diskd-ai/diskd-cli/main/install.sh | DISKD_INSTALL_DIR="$HOME/bin" sh
Update an installed binary with diskd update (--force to reinstall the
latest even when versions match). Human-facing commands print a yellow stderr
update notice when a newer release exists; the check is skipped for --json,
--quiet, and diskd mcp serve, and disabled by DISKD_NO_UPDATE_CHECK=1.
Quick Start: auth -> context -> files
# 1. Authenticate (browser login stores only the bearer token under $DISKD_HOME/credentials)
diskd login # use --dev for https://app.upgraide.dev/oauth-apps
diskd login --token "$APIS_ACCESS_TOKEN" # non-interactive token login
# 2. Verify identity (decodes workspace/subject from the token; never prints it)
diskd --json whoami
# 3. Pick a project as the current path context
diskd --json project list # list accessible projects
diskd set-context 01PROJECTID # select project path/session scope
diskd get-context # show current context
diskd set-context --root # clear project, use workspace root
# 4. Work with files under that context
diskd mkdir docs
diskd upload ./report.pdf --dest docs --force
diskd ls docs
diskd --json download docs/report.pdf ./report.pdf
diskd --json grep "payment terms" docs
diskd --json vsearch "contract renewal clauses" docs/report.pdf --top 5
# 5. Read sessions in the selected project
diskd --json session list
diskd --json session read 01SESSIONID --limit 20
diskd --json session messages 01SESSIONID --limit 20
Command Surface at a Glance
| Command |
Purpose |
ls [path] |
List a Drive path as <DIR>/<FILE>, size, indexing status, and copyable name with display metadata. Flags: --recursive, --long, --show-hidden, --show-system. |
tree [path] |
Render a Drive tree with bounded traversal when depth is set. Flags: -L/--depth/--deep <n>, -a/--all, -d/--dirs-only, -f/--full-path, -s/--size, --show-system. |
glob <pattern> |
Glob match. Flags: --path <dir>, --show-hidden, --show-system. |
grep <query> [paths...] |
Exact/BM25 content search. Flags: --limit, --offset. Paths default to the context root. |
vsearch <query> [paths...] |
Semantic search. Flags: --limit (alias --top), --offset. |
cat <path> |
Stream raw file bytes to stdout. Flag: --version <n>. |
download <path> <destination> |
Stream to an atomic local file. Flags: --version <n>, --force. |
read <path> |
Structured indexed document parts. Flags: --limit/--offset aliases for --parts-limit/--parts-offset. |
stat <path> |
Path metadata. |
biquery <question> [paths...] |
Natural-language query over indexed CSV/TSV/XLS/XLSX/mailbox spreadsheets; the backend converts the question to SQL and runs it. |
database <subcommand> (db) |
Generic Drive DB lifecycle. Subcommands: create, insert, query, commit, rollback, metadata, drop, set-status, resolve-by-inode, resolve-with-settings. |
telegram-db <subcommand> |
Telegram Drive DB lifecycle. Subcommands: create, insert, query, commit, metadata, drop. |
project <subcommand> |
Platform project lifecycle: list, get, create, update, delete. |
session <subcommand> |
Project-scoped Drive Session operations: list, read, messages, save, append, remove, rollback, delete. |
upload <local...> |
Upload file(s)/folder(s). Flags: --dest <dir>, --recursive, --force. |
mkdir <path> |
Create a folder. |
rm <path> |
Delete. Flag: --recursive. |
mv <src> <dst> |
Rename/move. |
cp <src> <dst> |
Copy (download then upload). Flag: --force. |
sync <folder> |
One-way local -> Drive. Flags: --dest, --once, --interval-seconds <n> (default 2). |
login |
Store a token or exchange client credentials. Flags: --token, --credentials-file. |
logout |
Delete stored credentials. |
whoami |
Decode token identity metadata. |
set-context |
Select project context. Flags: --list, --root (alias --clear). |
get-context |
Print current context. |
version |
Print CLI version. |
update |
Self-update from GitHub releases. Flag: --force. |
mcp serve |
Run the embedded MCP stdio server. |
Full flag-by-flag detail and the exact Drive API method each command calls are
in references/commands.md.
Path Rules
Paths are resolved relative to the current context. The CLI rejects . and
.. segments before any network call.
# No project context (workspace root)
docs/a.txt -> /docs/a.txt
# Project 01PROJECT selected
docs/a.txt -> /Projects/01PROJECT/docs/a.txt
The selected project is local CLI context only; it is never sent as a public
Drive API field. See references/auth-and-config.md.
Key Behaviors to Know
--json before the command for scripting; pipe into jq:
diskd --json set-context --list | jq -r '.[].name'.
vsearch reliability: a specific file path is more reliable than a
directory path, because the backend may not expand directory inodes for
vector search. If a directory vsearch fails with a "directory without file id"
style error, retry against a file or use grep.
grep flags --ignore-case / --files-with-matches are parsed but
rejected -- the current Drive grep contract has no matching fields. Do not
rely on them.
cat writes bytes to stdout, so redirection and pipes work as expected.
- Read sessions by domain ID with
session list, session read, and
session messages; never construct .sessions paths or pass inodes.
- Session and project mutations are state-changing. Run
save, append,
remove, rollback, and delete only when authorized. Destructive delete
commands require --yes.
download is atomic and refuses to replace a local destination unless
--force is explicitly supplied.
biquery takes a plain-language question, not SQL. The Drive backend
reads the spreadsheet schema and uses an LLM to generate and run the SQL,
returning a result table, e.g.
diskd --json biquery "total amount grouped by name" data/table.csv. Point it
at indexed spreadsheet files (.csv, .tsv, .xls, .xlsx, .mailbox); a
directory path is expanded to the spreadsheet files inside.
database query is the generic SQL path. It calls drive/db/query.
Use --db-type telegram/webarchive/session when needed to disambiguate
typed DB names. database also exposes commit, rollback, metadata, drop,
status, and inode resolution methods.
telegram-db query is the SQL path. It calls drive/telegram/query
against a named Telegram SQLite DB. Use --parameters '[...]' for positional
SQL parameters. telegram-db insert requires a JSON array through --rows or
--rows-file.
upload preserves paths relative to each provided local directory and
computes SHA-256 per file (start -> PUT bytes -> commit).
References
- Full command reference (every flag + Drive method): references/commands.md
- Auth, config, env vars, path context: references/auth-and-config.md
- MCP stdio server (config, tool names, JSON-RPC smoke tests): references/mcp.md
- End-to-end workflows (CSV/BI, CI, sync, agent integration, troubleshooting): references/workflows.md
1---2name: diskd-cli3description: diskd CLI (`diskd`) usage for platform Projects, project-scoped Drive Sessions, and Drive files through the public apis-service gateway. Use when managing projects (`project`), listing or reading sessions (`session list/read/messages`), applying authorized session mutations, listing, reading, downloading, searching, uploading, syncing, copying, moving, or deleting Drive files; running exact/BM25 search (`grep`), semantic search (`vsearch`), natural-language spreadsheet questions (`biquery`), Drive DB operations, auth/context, self-update, JSON output, or the embedded MCP server. Triggers on mentions of diskd, diskd CLI, project/session CLI access, `diskd project/session/download`, Drive commands, or adding diskd as an MCP server to an agent.4---56# diskd CLI78`diskd` is a Rust command-line client for diskd platform and Drive APIs. It gives humans,9shell scripts, and coding agents a Unix-style interface for listing, reading,10searching, uploading, syncing, and querying Drive files through the public11`apis-service` gateway. Output is human text by default and machine-readable12JSON with `--json`.1314## Command Shape1516```sh17diskd [GLOBAL FLAGS] <command> [ARGS] [FLAGS]18```1920Global flags MUST be placed **before** the subcommand. `diskd --json ls docs`21works; `diskd ls docs --json` does not.2223| Global flag | Purpose |24| --- | --- |25| `--json` | Print machine-readable JSON where supported. |26| `-q`, `--quiet` | Reduce progress/status messages on stderr; skips the startup update check. |27| `--base-url <url>` | Override the gateway base URL for one command. |28| `-p`, `--project <id>` | Override the current project for one command. |29| `-w`, `--workspace <id>` | Reserved compatibility flag; workspace scope comes from the token, not this flag. |30| `--config <path>` | Use a custom config file instead of `$DISKD_HOME/config.yaml`. |3132## Install3334```sh35# Latest release (detects platform, verifies .sha256, installs `diskd`)36curl -fsSL https://raw.githubusercontent.com/diskd-ai/diskd-cli/main/install.sh | sh3738# Pin a version39curl -fsSL https://raw.githubusercontent.com/diskd-ai/diskd-cli/main/install.sh | DISKD_VERSION=v0.2.0 sh4041# Custom directory42curl -fsSL https://raw.githubusercontent.com/diskd-ai/diskd-cli/main/install.sh | DISKD_INSTALL_DIR="$HOME/bin" sh43```4445Update an installed binary with `diskd update` (`--force` to reinstall the46latest even when versions match). Human-facing commands print a yellow stderr47update notice when a newer release exists; the check is skipped for `--json`,48`--quiet`, and `diskd mcp serve`, and disabled by `DISKD_NO_UPDATE_CHECK=1`.4950## Quick Start: auth -> context -> files5152```sh53# 1. Authenticate (browser login stores only the bearer token under $DISKD_HOME/credentials)54diskd login # use --dev for https://app.upgraide.dev/oauth-apps55diskd login --token "$APIS_ACCESS_TOKEN" # non-interactive token login5657# 2. Verify identity (decodes workspace/subject from the token; never prints it)58diskd --json whoami5960# 3. Pick a project as the current path context61diskd --json project list # list accessible projects62diskd set-context 01PROJECTID # select project path/session scope63diskd get-context # show current context64diskd set-context --root # clear project, use workspace root6566# 4. Work with files under that context67diskd mkdir docs68diskd upload ./report.pdf --dest docs --force69diskd ls docs70diskd --json download docs/report.pdf ./report.pdf71diskd --json grep "payment terms" docs72diskd --json vsearch "contract renewal clauses" docs/report.pdf --top 57374# 5. Read sessions in the selected project75diskd --json session list76diskd --json session read 01SESSIONID --limit 2077diskd --json session messages 01SESSIONID --limit 2078```7980## Command Surface at a Glance8182| Command | Purpose |83| --- | --- |84| `ls [path]` | List a Drive path as `<DIR>/<FILE>`, size, indexing status, and copyable name with display metadata. Flags: `--recursive`, `--long`, `--show-hidden`, `--show-system`. |85| `tree [path]` | Render a Drive tree with bounded traversal when depth is set. Flags: `-L`/`--depth`/`--deep <n>`, `-a`/`--all`, `-d`/`--dirs-only`, `-f`/`--full-path`, `-s`/`--size`, `--show-system`. |86| `glob <pattern>` | Glob match. Flags: `--path <dir>`, `--show-hidden`, `--show-system`. |87| `grep <query> [paths...]` | Exact/BM25 content search. Flags: `--limit`, `--offset`. Paths default to the context root. |88| `vsearch <query> [paths...]` | Semantic search. Flags: `--limit` (alias `--top`), `--offset`. |89| `cat <path>` | Stream raw file bytes to stdout. Flag: `--version <n>`. |90| `download <path> <destination>` | Stream to an atomic local file. Flags: `--version <n>`, `--force`. |91| `read <path>` | Structured indexed document parts. Flags: `--limit`/`--offset` aliases for `--parts-limit`/`--parts-offset`. |92| `stat <path>` | Path metadata. |93| `biquery <question> [paths...]` | Natural-language query over indexed CSV/TSV/XLS/XLSX/mailbox spreadsheets; the backend converts the question to SQL and runs it. |94| `database <subcommand>` (`db`) | Generic Drive DB lifecycle. Subcommands: `create`, `insert`, `query`, `commit`, `rollback`, `metadata`, `drop`, `set-status`, `resolve-by-inode`, `resolve-with-settings`. |95| `telegram-db <subcommand>` | Telegram Drive DB lifecycle. Subcommands: `create`, `insert`, `query`, `commit`, `metadata`, `drop`. |96| `project <subcommand>` | Platform project lifecycle: `list`, `get`, `create`, `update`, `delete`. |97| `session <subcommand>` | Project-scoped Drive Session operations: `list`, `read`, `messages`, `save`, `append`, `remove`, `rollback`, `delete`. |98| `upload <local...>` | Upload file(s)/folder(s). Flags: `--dest <dir>`, `--recursive`, `--force`. |99| `mkdir <path>` | Create a folder. |100| `rm <path>` | Delete. Flag: `--recursive`. |101| `mv <src> <dst>` | Rename/move. |102| `cp <src> <dst>` | Copy (download then upload). Flag: `--force`. |103| `sync <folder>` | One-way local -> Drive. Flags: `--dest`, `--once`, `--interval-seconds <n>` (default 2). |104| `login` | Store a token or exchange client credentials. Flags: `--token`, `--credentials-file`. |105| `logout` | Delete stored credentials. |106| `whoami` | Decode token identity metadata. |107| `set-context` | Select project context. Flags: `--list`, `--root` (alias `--clear`). |108| `get-context` | Print current context. |109| `version` | Print CLI version. |110| `update` | Self-update from GitHub releases. Flag: `--force`. |111| `mcp serve` | Run the embedded MCP stdio server. |112113Full flag-by-flag detail and the exact Drive API method each command calls are114in [references/commands.md](references/commands.md).115116## Path Rules117118Paths are resolved relative to the current context. The CLI rejects `.` and119`..` segments **before** any network call.120121```text122# No project context (workspace root)123docs/a.txt -> /docs/a.txt124125# Project 01PROJECT selected126docs/a.txt -> /Projects/01PROJECT/docs/a.txt127```128129The selected project is local CLI context only; it is never sent as a public130Drive API field. See [references/auth-and-config.md](references/auth-and-config.md).131132## Key Behaviors to Know133134- **`--json` before the command** for scripting; pipe into `jq`:135 `diskd --json set-context --list | jq -r '.[].name'`.136- **`vsearch` reliability**: a specific **file** path is more reliable than a137 directory path, because the backend may not expand directory inodes for138 vector search. If a directory vsearch fails with a "directory without file id"139 style error, retry against a file or use `grep`.140- **`grep` flags `--ignore-case` / `--files-with-matches` are parsed but141 rejected** -- the current Drive grep contract has no matching fields. Do not142 rely on them.143- **`cat` writes bytes to stdout**, so redirection and pipes work as expected.144- **Read sessions by domain ID** with `session list`, `session read`, and145 `session messages`; never construct `.sessions` paths or pass inodes.146- **Session and project mutations are state-changing.** Run `save`, `append`,147 `remove`, `rollback`, and `delete` only when authorized. Destructive delete148 commands require `--yes`.149- **`download` is atomic** and refuses to replace a local destination unless150 `--force` is explicitly supplied.151- **`biquery` takes a plain-language question, not SQL.** The Drive backend152 reads the spreadsheet schema and uses an LLM to generate and run the SQL,153 returning a result table, e.g.154 `diskd --json biquery "total amount grouped by name" data/table.csv`. Point it155 at indexed spreadsheet files (`.csv`, `.tsv`, `.xls`, `.xlsx`, `.mailbox`); a156 directory path is expanded to the spreadsheet files inside.157- **`database query` is the generic SQL path.** It calls `drive/db/query`.158 Use `--db-type telegram`/`webarchive`/`session` when needed to disambiguate159 typed DB names. `database` also exposes commit, rollback, metadata, drop,160 status, and inode resolution methods.161- **`telegram-db query` is the SQL path.** It calls `drive/telegram/query`162 against a named Telegram SQLite DB. Use `--parameters '[...]'` for positional163 SQL parameters. `telegram-db insert` requires a JSON array through `--rows` or164 `--rows-file`.165- **`upload` preserves paths relative to each provided local directory** and166 computes SHA-256 per file (start -> PUT bytes -> commit).167168## References169170- **Full command reference** (every flag + Drive method): [references/commands.md](references/commands.md)171- **Auth, config, env vars, path context**: [references/auth-and-config.md](references/auth-and-config.md)172- **MCP stdio server** (config, tool names, JSON-RPC smoke tests): [references/mcp.md](references/mcp.md)173- **End-to-end workflows** (CSV/BI, CI, sync, agent integration, troubleshooting): [references/workflows.md](references/workflows.md)