CLI Reference
A command-line interface for managing Stash from your terminal — push session events and manage all resources.
--json for machine-readable output and --ws ID to target a specific workspace.Install
pip install stashaiFirst-time setup
Run the interactive setup wizard. It configures the API endpoint, authenticates you (login or register), and creates a workspace — all in one shot. No manual config editing required.
stash connectThe wizard saves everything to ~/.stash/config.json. Once complete, commands like stash sessions push work without extra flags.
Virtual filesystem
Use stash vfs when an agent needs to browse workspace files, pages, sessions, stashes, and tables through one filesystem-shaped interface without mounting anything into the OS.
stash vfs ls /
stash vfs "find /workspaces -maxdepth 3 -type f"
stash vfs "rg 'database migration' /workspaces"
stash vfs "cat '/workspaces/<workspace>/README.md' | sed -n '1,80p'"stash vfs[--ws ID] [--cwd PATH] "command"Run bash-shaped read and write commands against the virtual Stash tree.
--wsstringExpose one workspace by ID. By default all accessible workspaces are exposed.
--cwdstringVirtual working directory. Defaults to /.
commandstringBash-shaped command such as ls, find, rg, cat, sed, tee, or redirection.
Authentication
stash login<name> --password <pw>Authenticate with username and password.
<name>stringREQUIREDYour username.
--passwordstringREQUIREDYour password.
stash signin[--api URL] [--no-browser] [--timeout N]Open the browser for OAuth sign-in. Blocks until the user authorizes. Writes credentials on success and auto-selects the default workspace if there is exactly one.
--apistringStash API base URL. Override for self-hosted deployments. Defaults to https://api.stash.ac.
--pagestringSign-in page URL. Defaults to the /connect-token page matching --api.
--no-browserflagSkip auto-opening the browser; just print the URL. Use on SSH or headless machines.
--timeoutnumberSeconds to wait for sign-in. Defaults to 120.
stash register<name> [--password <pw>]Create a new Stash account and store the API key.
<name>stringREQUIREDUsername for the new account.
--passwordstringPassword for the account.
stash auth<base_url> --api-key <key>Store existing credentials for a Stash instance.
<base_url>stringREQUIREDBase URL of the Stash server.
--api-keystringREQUIREDYour API key.
stash whoamiDisplay the currently authenticated user.
stash disconnectSign out and clear all stored credentials so the next stash connect re-onboards.
stash config[key] [value]View or update a configuration value. Keys: base_url, default_workspace, output_format. Run without arguments to show all config.
keystringConfig key to read or write.
valuestringNew value. Omit to read the current value.
stash connect, your defaults are stored. You can still override any value: e.g. stash config base_url https://joinstash.ai or set STASH_API_KEY / STASH_URL as environment variables for CI and scripts.Workspaces
stash workspaces listList workspaces you belong to.
stash workspaces create<name> [--description TEXT]Create a new workspace.
<name>stringREQUIREDName for the workspace.
--descriptionstringWorkspace description.
stash workspaces join<invite_code>Join a workspace by invite code.
<invite_code>stringREQUIREDInvite code or magic link token.
stash workspaces use<workspace> [--scope user|project]Set the default workspace for future commands. Accepts a workspace ID or name.
<workspace>stringREQUIREDWorkspace ID or name to set as default.
--scopestringWhere to write config: "user" or "project". Defaults to "user".
stash workspaces info<workspace_id>Show workspace details.
<workspace_id>stringREQUIREDID of the workspace.
stash workspaces members<workspace_id>List members of a workspace.
<workspace_id>stringREQUIREDID of the workspace.
Files
stash files pages[--ws ID] [--all]List pages in the current workspace.
--wsstringWorkspace ID override.
--allflagInclude pages from all workspaces.
stash files tree[--ws ID]Show the folder and page tree for a workspace.
--wsstringWorkspace ID override.
stash files create-folder<name> [--ws ID] [--parent FOLDER_ID]Create a folder in the files.
<name>stringREQUIREDFolder name.
--wsstringWorkspace ID override.
--parentstringParent folder ID.
stash files add-page<name> [--ws ID] [--folder FOLDER_ID] [--content '...']Add a new page to the files.
<name>stringREQUIREDPage title.
--folderstringFolder ID.
--contentstringInitial page content.
stash files read-page<page_id> [--ws ID]Read a page.
<page_id>stringREQUIREDID of the page.
--wsstringWorkspace ID override.
stash files edit-page<page_id> [--ws ID] --content '...'Update a page. Reads from stdin if --content is not given.
<page_id>stringREQUIREDID of the page.
--wsstringWorkspace ID override.
--contentstringNew page content. Reads from stdin if omitted.
Sessions
stash sessions push<content> [--agent cli] [--type message] [--session ID] [--attach FILE]Push a new event to the workspace session stream.
<content>stringREQUIREDEvent content to push.
--wsstringWorkspace ID override.
--agentstringAgent identifier. Defaults to "cli".
--typestringEvent type. Defaults to "message".
--sessionstringSession ID to group events under.
--toolstringTool identifier.
--attachpathLocal file path to upload and attach. Repeatable.
--attach-idstringPre-uploaded file ID to attach. Repeatable.
stash sessions query[--agent X] [--type Y] [-n 50] [--all]Query recent session events with optional filters.
--wsstringWorkspace ID override.
--agentstringFilter by agent identifier.
--typestringFilter by event type.
-n, --limitnumberMaximum number of results. Defaults to 50.
--allflagQuery across all workspaces.
stash search with --source sessions (see Sources & search below). It replaces the old per-resource search commands.stash sessions folders[--ws ID]List session folders — shareable groupings of sessions.
--wsstringWorkspace ID override.
stash sessions new-folder<name> [--ws ID]Create a session folder.
<name>stringREQUIREDFolder name.
--wsstringWorkspace ID override.
stash sessions assign<session_row_id> [--folder ID]Move a session into a session folder, or omit --folder to move it back to the ungrouped root.
<session_row_id>stringREQUIREDThe session row id to move.
--folderstringTarget folder id. Omit to ungroup.
--wsstringWorkspace ID override.
stash sessions agents[--ws ID]List distinct agent names that have logged events in this workspace.
--wsstringWorkspace ID override.
stash sessions transcript<session_id> [--ws ID] [--save PATH]Fetch a full session transcript and print or save it. Transcripts are stored gzipped on the server and decompressed automatically.
<session_id>stringREQUIREDID of the session.
--wsstringWorkspace ID override.
--savepathSave the transcript to a file instead of printing.
Sources & search
A source is anything the agent can read, exposed as a virtual file system: the two native sources — files and sessions — plus your connected sources (GitHub, Google Drive, Notion, Slack, Granola). Pick a source like a drive, browse it by path, read a document, or search one source — or everything at once.
stash sources ls[--ws ID]List every source you can read here: the native files and sessions sources plus your connected sources. Each row prints a source handle to use with the other commands.
--wsstringWorkspace ID override.
stash sources add<source_type> [--ref REF] [--name NAME]Connect a source. Slack and Granola resolve their reference from your connected token; the others need a --ref (e.g. a repo 'owner/name').
<source_type>stringREQUIREDgithub_repo | google_drive | notion | slack | granola.
--refstringExternal reference, e.g. a repo 'owner/name'.
--namestringDisplay name for the source.
--wsstringWorkspace ID override.
stash sources browse<source> [path] [--ws ID]List a source's entries like a file system.
<source>stringREQUIREDA source handle from stash sources ls.
pathstringPath prefix (connected sources only).
--wsstringWorkspace ID override.
stash sources read<source> <ref> [--ws ID]Read one document from a source.
<source>stringREQUIREDA source handle from stash sources ls.
<ref>stringREQUIREDPage id (files), session id (sessions), or document path (connected sources).
--wsstringWorkspace ID override.
stash sources sync<source_id> [--ws ID]Trigger an immediate re-index of a connected source you own.
<source_id>stringREQUIREDID of the connected source.
--wsstringWorkspace ID override.
stash sources rm<source_id> [--ws ID]Disconnect a source you own. Its indexed documents are removed.
<source_id>stringREQUIREDID of the connected source.
--wsstringWorkspace ID override.
stash search<query> [--source HANDLE] [--ws ID] [-n 20]Search across everything you can see — files, sessions, and connected sources. Pass --source to scope to one; omit it to search everything.
<query>stringREQUIREDSearch query.
--sourcestringScope to one source handle (from stash sources ls). Omit to search everything.
-n, --limitnumberMaximum number of results. Defaults to 20.
--wsstringWorkspace ID override.
Tables
stash tables list[--ws ID] [--all] [--personal]List tables in the current workspace.
--wsstringWorkspace ID override.
--allflagInclude tables from all workspaces.
--personalflagShow only personal tables.
stash tables create<name> [--ws ID] [--columns JSON]Create a new table with optional column definitions.
<name>stringREQUIREDName for the table.
--wsstringWorkspace ID override.
--columnsJSONColumn definitions as a JSON array of {name, type, options?}.
stash tables update<table_id> [--name TEXT] [--description TEXT]Update a table's name or description.
<table_id>stringREQUIREDID of the table.
--wsstringWorkspace ID override.
--namestringNew table name.
--descriptionstringNew table description.
stash tables schema<table_id>Show a table's column schema.
<table_id>stringREQUIREDID of the table.
--wsstringWorkspace ID override.
stash tables rows<table_id> [--sort COL] [--filter COL]Fetch rows from a table. Sort and filter accept column names, which are auto-resolved.
<table_id>stringREQUIREDID of the table.
--sortstringColumn name to sort by.
--filterstringColumn name to filter on.
--wsstringWorkspace ID override.
stash tables insert<table_id> <data_json>Insert a new row. Data is a JSON object with column names as keys.
<table_id>stringREQUIREDID of the table.
<data_json>JSONREQUIREDRow data as a JSON object.
--wsstringWorkspace ID override.
stash tables import<table_id> <file> [--format csv|json]Bulk import rows from a file. Auto-chunks into batches of 5000. CSV uses the first row as column headers. Supports piping: cat data.csv | stash tables import <id> --format csv.
<table_id>stringREQUIREDID of the table.
<file>pathREQUIREDPath to the import file.
--formatstringFile format: "csv" or "json". Auto-detected if omitted.
stash tables update-row<table_id> <row_id> <data_json>Update an existing row with a partial merge. Data is a JSON object with column names as keys.
<table_id>stringREQUIREDID of the table.
<row_id>stringREQUIREDID of the row to update.
<data_json>JSONREQUIREDUpdated row data as a JSON object.
--wsstringWorkspace ID override.
stash tables delete-row<table_id> <row_id>Delete a row from a table.
<table_id>stringREQUIREDID of the table.
<row_id>stringREQUIREDID of the row to delete.
--wsstringWorkspace ID override.
stash tables add-column<table_id> <name> [--type text] [--options TEXT]Add a column to a table.
<table_id>stringREQUIREDID of the table.
<name>stringREQUIREDColumn name.
--typestringColumn type. Defaults to "text".
--optionsstringComma-separated options for select/multiselect columns.
--wsstringWorkspace ID override.
stash tables delete-column<table_id> <column_id>Delete a column from a table.
<table_id>stringREQUIREDID of the table.
<column_id>stringREQUIREDColumn ID (col_xxx) or column name.
--wsstringWorkspace ID override.
stash tables count<table_id>Count rows in a table, optionally with filters.
<table_id>stringREQUIREDID of the table.
--wsstringWorkspace ID override.
stash tables export<table_id>Export all rows from a table as CSV.
<table_id>stringREQUIREDID of the table.
--wsstringWorkspace ID override.
stash tables delete<table_id> [-y]Delete a table and all its data.
<table_id>stringREQUIREDID of the table.
-y, --yesflagSkip confirmation prompt.
--wsstringWorkspace ID override.
Uploaded Files
stash files upload<path> [--ws ID]Upload a file to a workspace or to your personal files.
<path>pathREQUIREDPath to the file.
--wsstringWorkspace ID. Omit to upload as a personal file.
stash files list[--ws ID]List files in a workspace or your personal files.
--wsstringWorkspace ID. Omit to list personal files.
stash files rm<file_id>Delete a file.
<file_id>stringREQUIREDID of the file to delete.
stash files text<file_id>Print extracted text for a file (PDF, image OCR, or plain text).
<file_id>stringREQUIREDID of the file.
Cartridges
A Cartridge is a shareable bundle of pages, sessions, tables, and files — the unit you publish to a public link or share with specific people. (Cartridges are what earlier versions called “Stashes”; the stash CLI name is unchanged.)
stash cartridges list[--ws ID]List Cartridges in the workspace.
--wsstringWorkspace ID override.
stash cartridges create<title> [--public/--private] [--discover] [--items JSON]Create a Cartridge. Pass --items as JSON to attach resources up front.
<title>stringREQUIREDCartridge title.
--public/--privateflagVisibility. --public mints a shareable link.
--discoverflagList a public Cartridge in the Discover catalog (requires --public).
--itemsJSONItems as a JSON array of {object_type, object_id}.
--wsstringWorkspace ID override.
stash cartridges members<cartridge_id>List the people granted access to a Cartridge.
<cartridge_id>stringREQUIREDID of the Cartridge.
stash cartridges add-member<cartridge_id> <user_id> [--permission read]Grant a user access to a Cartridge.
<cartridge_id>stringREQUIREDID of the Cartridge.
<user_id>stringREQUIREDThe user to grant access.
--permissionstringread | write | admin. Defaults to read.
stash cartridges remove-member<cartridge_id> <user_id>Revoke a user's access to a Cartridge.
<cartridge_id>stringREQUIREDID of the Cartridge.
<user_id>stringREQUIREDThe user to revoke.
stash cartridges invitesList Cartridge invites pending for you — Cartridges shared with you, awaiting accept or dismiss.
stash cartridges dismiss-invite<invite_id>Dismiss a pending Cartridge invite.
<invite_id>stringREQUIREDID of the pending invite.
stash cartridges snapshot-source<cartridge_id> --source ID --path PATH [--ws ID]Copy a point-in-time snapshot of one connected-source document into the Cartridge as a page, so the bundle stays self-contained.
<cartridge_id>stringREQUIREDID of the Cartridge.
--sourcestringREQUIREDConnected-source id (from stash sources ls).
--pathstringREQUIREDDocument path within the source.
--wsstringWorkspace ID override.
stash cartridges add-external<slug> [--ws ID]Fork a public Cartridge into a workspace by its slug.
<slug>stringREQUIREDPublic Cartridge slug.
--wsstringWorkspace ID override.
stash cartridges delete<cartridge_id>Delete a Cartridge.
<cartridge_id>stringREQUIREDID of the Cartridge.
Shares
Share a single object — a folder, page, file, session, or table — with a specific person by email. If they don't have an account yet the share is recorded as pending and converts when they sign up. (To share a whole bundle, use a Cartridge above.)
stash shares ls<object_type> <object_id>List who an object is shared with.
<object_type>stringREQUIREDfolder | page | file | session | table.
<object_id>stringREQUIREDID of the object.
stash shares add<object_type> <object_id> <email> [--permission read]Share an object with a person by email.
<object_type>stringREQUIREDfolder | page | file | session | table.
<object_id>stringREQUIREDID of the object.
<email>stringREQUIREDRecipient email (pending until they sign up).
--permissionstringread | write | admin. Defaults to read.
stash shares rm<object_type> <object_id> <principal_id> [--principal-type user]Revoke a person's access to an object.
<object_type>stringREQUIREDfolder | page | file | session | table.
<object_id>stringREQUIREDID of the object.
<principal_id>stringREQUIREDThe user id to revoke (from stash shares ls).
--principal-typestringPrincipal kind. Defaults to "user".
Invites
stash invite[--ws ID] [--uses N] [--days N]Create a magic-link invite — a single-use, TTL-bounded token for zero-friction workspace onboarding.
--wsstringWorkspace ID to create the invite for.
--usesnumberMaximum times the link can be redeemed. Defaults to 1.
--daysnumberDays until the link expires. Defaults to 7.
stash invite list[--ws ID]List active invite tokens for a workspace.
--wsstringWorkspace ID override.
stash invite revoke<token_id> [--ws ID]Revoke an invite token so it can no longer be redeemed.
<token_id>stringREQUIREDID of the invite token to revoke.
--wsstringWorkspace ID override.
Keys
stash keys listList your active API keys (one per device / login).
stash keys revoke<key_id>Revoke an API key by ID. Any device using it will receive a 401 on the next call.
<key_id>stringREQUIREDID of the key to revoke.
Streaming & hooks
Install Stash hooks for all supported coding agents on your $PATH, then enable or disable streaming per repo.
stash installInstall hook plugins for all supported coding agents on your PATH.
stash enableRe-enable activity streaming for the current repository.
stash disableStop streaming for this repo without touching the committed manifest.
stash settings[--json]Open the interactive settings page.
--jsonflagPrint a read-only snapshot of settings instead of opening the interactive page.