# Type CLI

> Discover public skills, develop Type Apps locally, search and read a Type workspace, use integrations, and synchronize content.

Canonical page: https://docs.type.com/reference/type-cli/

The Type CLI lets you discover public library skills, develop Type Apps, search and read your Type workspace, use integrations, and run agent tasks from a terminal or local agent session. Use it to hydrate thread evidence, work with connected services, synchronize documents and skills, start new threads, push local agent sessions into Type, and reply to existing threads.

The executable is `type-cli`.

If you want to use Type directly from Claude or another supported MCP client without installing a local binary, use [Type MCP](https://docs.type.com/reference/type-mcp/index.md). Type MCP is also the better fit when an agent runs in a cloud-hosted environment, including Claude Cowork in cloud mode, where the compute cannot access a `type-cli` binary installed on your machine.

## Start a task, push a session, or reply in a thread

Choose the CLI command that matches the work:

| Goal | Command | Result |
| --- | --- | --- |
| A new task for a Space agent | [`type-cli threads create`](#start-and-complete-an-agent-task) | Creates a **new thread** and starts the agent |
| A local Claude or Codex session, or another agent's transcript | [`type-cli sessions push`](#push-a-local-agent-session) | Creates a **new thread** with the transcript |
| A message or update in a thread that already exists | [`type-cli threads reply`](#reply-in-a-thread-and-mention-teammates) | Adds a **reply to that thread** as the signed-in user |

```sh
# Push the current session into a new thread (use claude or codex).
type-cli sessions push --from codex --current --space engineering --json

# Post an update using the thread.id returned by the push.
type-cli threads reply thread_123 --message "@Jane Doe ready for review" --json

# Or read the reply text from a file.
type-cli threads reply thread_123 --file ./update.md --reply-mode chat --json
```

You can reply to any accessible, open Space thread; it does not need to come from a session push. Find its ID with `threads recent`, `threads list`, or `search`. Each `sessions push` creates another new thread, so use `threads reply` for follow-up updates. Replies with a resolved user mention default to a Team message; other replies default to an AI prompt. Use `--reply-mode chat` to post an update without triggering the agent, or `--reply-mode prompt` to ask the agent to respond.

## Install the CLI

If you use the Type desktop app, the CLI is bundled with the app:

```sh
/Applications/Type.app/Contents/Resources/bin/type-cli install-shell --yes
```

This installs a `type-cli` command and configures supported shells so the Type CLI is available on PATH. Restart your shell after installation.

Standalone binaries are published for macOS, Linux, and Windows x64. On macOS or Linux, install the latest released CLI with the shell installer:

```sh
curl -fsSL https://type.com/install.sh | sh
```

On **Windows x64**, run this in PowerShell:

```powershell
irm https://type.com/install.ps1 | iex
```

The Windows installer verifies the download checksum, installs `type-cli.exe` in `%USERPROFILE%\.type\bin`, and adds that directory to your user PATH. It does not require administrator access. Restart your terminal and Claude Code after installing, then run `type-cli --version`.

If the version still looks old, run `Get-Command type-cli -All` in PowerShell to find earlier installations on PATH. You can run the new installation explicitly with `& "$env:USERPROFILE\.type\bin\type-cli.exe" --version`.

Use `type-cli update` for subsequent standalone updates. If an older Windows CLI says updates are only supported on macOS and Linux, rerun the PowerShell installer to replace it. For a manual download, use the [Windows x64 executable](https://desktop.type.com/cli/type-cli-windows-x64.exe); downloaded binaries can be run directly without `install-shell`.

You can also download a release asset manually, make it executable, then install it into your shell:

```sh
chmod +x ./type-cli-linux-x64
./type-cli-linux-x64 install-shell --yes
```

Check that the CLI is available:

```sh
type-cli version
```

`type-cli version` shows the installed CLI version and whether it is managed by the Type desktop app, the standalone installer, or a manual/development path.

Both the desktop install path and the standalone shell installer also make a best-effort attempt to set up Claude Code and Codex when those tools are detected on your machine, so local agent sessions prefer Type for automations, apps, integrations, and skills:

- A `type-cli` skill is installed under `~/.claude/skills/type-cli/` (Claude Code) and `~/.agents/skills/type-cli/` (Codex) with workflow guidance for Type MCP and the CLI.
- A Type-managed block is added to the agent's global instruction file: `~/.claude/CLAUDE.md` for Claude Code and `~/.codex/AGENTS.md` for Codex. The block is delimited by `<!-- BEGIN Type CLI managed instructions -->` and `<!-- END Type CLI managed instructions -->` markers; everything outside the markers is left untouched, and only the block is refreshed on later installs and updates. Remove the block to opt out.
- For Claude Code, permission allow rules for non-destructive `type-cli` commands are added to `~/.claude/settings.json` under `permissions.allow` (for example `Bash(type-cli integrations connect:*)`), so an agent can check status, connect accounts, follow existing tests, and report Type bugs with `type-cli feedback submit` without a permission prompt or an auto-mode block. Because feedback runs unprompted, the CLI accepts only inline `--description` text for it inside Claude Code; `--file` is refused there. Creating or updating scheduled actions (which can accept `--enable`), starting tests, and enabling automations remain subject to Claude Code’s normal permission checks. Commands that delete, disconnect, archive, merge, change permissions, answer approvals, upload files, send Custom API requests, create event sources, or call provider tools are never added, and the CLI's own `--yes` confirmations still apply. Other settings and existing rules are preserved, including broader rules from earlier CLI versions; remove those broader Type rules to apply these stricter defaults. A settings file that is not valid JSON is left unchanged and reported. Set `TYPE_CLI_SKIP_AGENT_PERMISSIONS=1` to skip the rules, or remove them from `settings.json` to opt out.

To repair or re-run only the local agent skill setup:

```sh
type-cli install-agent-skills
```

To target one local agent:

```sh
type-cli install-agent-skills --agent claude
type-cli install-agent-skills --agent codex
```

To skip local agent skill setup during install:

```sh
TYPE_CLI_SKIP_AGENT_SKILLS=1 curl -fsSL https://type.com/install.sh | sh
```

For scripts that only need the version string, use:

```sh
type-cli --version
```

## Update the CLI

If you installed the CLI from the Type desktop app, update the Type app to update the bundled CLI.

If you installed the standalone CLI with the macOS/Linux shell installer or Windows PowerShell installer, update it in place:

```sh
type-cli update
```

Updates also refresh existing Type-managed local agent skills so agents see command guidance that matches the current binary. This preserves the local agents you previously installed the skill for; for example, a prior `type-cli install-agent-skills --agent claude` install is refreshed only for Claude. For desktop-managed installs, `type-cli update` does not update the app binary, but it still refreshes those existing local skills from the bundled CLI.

Preview the available update without replacing the current binary:

```sh
type-cli update --dry-run
```

`type-cli update` supports macOS, Linux, and Windows x64. It does not replace a manually installed binary; download a new release asset instead.

## Sign up

For agent-guided sign-up, use [resumable authentication](#resumable-authentication-for-agents)
so the agent can recover a stopped wait. The blocking sign-up form of login
remains available for interactive terminal use:

```sh
type-cli auth login --signup --entry-source codex --no-open
```

The command prints a sign-up URL and waits. The person creates the account,
names the workspace, and chooses billing in browser onboarding; its final
**Next: Connect your agent** button opens the WorkOS device approval for this
same command in the same tab. Once approved, the command stores the CLI session
for the new workspace, exactly like a normal `auth login`. Use
`--entry-source claude-code` for Claude Code. Add `--name "<automation>"`,
`--services <slugs>`, and `--every`/`--at` so the sign-up page greets the person
with the automation the agent is about to build. The sign-up link lasts 24
hours; if the command exits before the browser finishes, run it again. With
`--json`, progress is reported on stderr as `auth.login.signup_pending` (the
URL) and `auth.login.pending` (the device link), and the final result includes
`signup: true`.

Signup links use a short, expiring `/s/<token>` URL on the configured API. The
server restores the automation intent and redirects to this deployment's onboarding
page; the link expires with its setup session after 24 hours. Older APIs without
short-link support retain the encoded onboarding URL.

In terminals that support hyperlinks, signup appears as a purple
**Create an account on type.com** link. Plain-text terminals and captured agent output put the label above the exact URL
on its own line. Relay those two lines without Markdown link syntax, backticks,
parentheses, or line breaks inside the URL, and omit the browser setup walkthrough.
`NO_COLOR=1` disables color; JSON progress includes the URL.

When credentials are absent, `auth status` offers **Log in on type.com** and
**Create an account on type.com (and start with free credits)**. JSON includes
`authOptions` with each choice's `action` and `label`. Agents should present these
choices and wait for a selection before running login or signup, unless the user
already explicitly chose one. Unusable saved credentials remain an error to diagnose,
not a reason to create another account.

Agent hosts with a native choice tool should render account choices using that
single-select tool (`AskUserQuestion` in Claude Code); plain-text hosts use a
numbered list. The CLI supplies the choices; the host supplies the picker.

Claude Code auto mode can reject login/signup before the CLI runs, including
with a released CLI. This is a host permission decision, not a Type API error.
Use `/permissions` → **Recently denied** to approve a retry. If that UI is
unavailable, switch to Manual/default mode with `Shift+Tab`, then approve the
specific command on retry. Type must not change the host's permission settings
or reroute execution to evade the denial. See [Claude Code permission modes](https://code.claude.com/docs/en/permission-modes#when-auto-mode-falls-back).

Start signup from the terminal and authenticate in your browser:

```sh
type-cli signup --email you@example.com --name "Acme"
```

For a local CLI, Google and Slack can go directly to the selected provider and return to a loopback callback on the same machine:

```sh
type-cli signup --provider google --email you@example.com --name "Acme"
type-cli signup --provider slack --email you@example.com --name "Acme"
```

Google signup always shows the account chooser. Type verifies that the authenticated provider email matches `--email` before provisioning the workspace.

If the CLI runs on a remote host that cannot receive a browser loopback callback, use WorkOS's device flow instead:

```sh
type-cli signup --browser --email you@example.com --name "Acme" --no-open
```

The device page first asks you to confirm the code printed by the CLI, then lets you authenticate with any method enabled in AuthKit. Type checks signup eligibility after browser authentication and before registering the CLI's agent identity.

New workspaces require either a card or a connected Claude or Codex subscription. Choose a subscription during signup:

```sh
type-cli signup --email you@example.com --name "Acme" --subscription claude
type-cli signup --email you@example.com --name "Acme" --subscription codex
```

After Type authentication, the CLI prints a browser link to connect the selected subscription. The subscription powers agent turns immediately, and the workspace keeps its $10 in Type credits as fallback when the subscription reaches its usage limit. Explicit model choices are preserved. Without `--subscription`, the browser offers both subscriptions and card checkout. Card checkout starts a free trial with nothing due today and an automatically renewing plan afterward; an owner or admin must complete checkout. Review the price and trial duration in checkout.

JSON output includes `billingRequired` and `billingUrl` (`null` when signup requirements are satisfied). `ok: true` means signup credentials were saved, not that billing is complete. The CLI never asks for card details. Open `billingUrl` in your browser and connect the subscription or add a card, then run `type-cli signup complete --json --no-input` to check again. Use `signup complete --subscription claude` or `signup complete --subscription codex` to select a connection when resuming. This also works after `auth login` for the selected workspace. If billing verification temporarily fails, signup preserves its checkpoint and instructs you to retry `signup complete`. Authentication failures retain their original sign-in guidance.

The credential created by `signup` is bound to the new workspace and is read-only: it supports `whoami`, `search`, and `threads` reads. Run `type-cli auth login` before using integrations, documents, workspace skills, sessions, or other write commands.

## Resumable authentication for agents

Use `type-cli auth start --json --no-input` for existing accounts, or
add `--signup` and the known automation intent for new accounts. Start returns
immediately with `sessionId`, `state`, `handoff`, and a typed `nextAction`. The handoff
contains `label`, exact `url`, and a copyable plain-text `message` with the label
above the URL. `userMessage` remains an alias.
Display the message in chat, then execute those arguments with the same installed
CLI. Start opens the browser locally by default; use `--no-open` for a remote or
headless host or when requested. Always display the URL too. Repeating an
identical start while pending returns the same attempt without another tab.

`auth status <session-id> --json` recovers its checkpoint and link. Run
`auth wait <session-id> --json --no-input` in the host's observable
background task/session. The default observation limit is 86400 seconds (24 hours);
completion, denial, workspace selection, or session expiry returns earlier.
Individual requests remain bounded to 30 seconds. Use `--timeout <seconds>`
(1–86400) for an explicit observation limit. A timeout stops observation, not
authentication; resume the same wait without a fixed retry count. A host task
observation timeout requires observing the same task; an actual host termination
requires recovering the same auth session and starting its wait again. Keep the Claude task ID or Codex terminal session ID and observe
its exit result; do not detach or poll process names. The CLI cannot wake a host
that has abandoned its task.

`choosing_workspace` returns names, IDs and a selection `nextAction.argv` for
each workspace. `auth wait <session-id> --org <id>` reuses browser approval for
ten minutes. `completed` is returned only after credentials are saved and the
selected identity verified. Verification uses the staged browser credentials; a failed
verification leaves any previous login and workspace profile unchanged. Completed receipts include `identityVerified: true`, the verified
`identity` and `nextAction: null`: resume the original
task after checking the account/workspace, without another `whoami`. For an existing login, `auth status --json` also returns `identityVerified: true`
only after checking the authenticated user and organization. Use that result
or `whoami`; recheck after changing profile/server/workspace.

Link-bearing receipts make the immediate `nextAction` a `display_message`:
show its exact `message` visibly before following the nested `afterDisplay` action.
A `run_cli` action contains `argv` and uses the same executable; wait actions
use the host’s managed background task. A null action ends observation.
`handoff` and `userMessage` remain compatibility fields. Do not skip the display
step or execute both representations. Connection start no longer repeats a
shell-quoted `waitCommand` in JSON; use the typed action’s argument array.

Expiration and denial are explicit states. The
checkpoint uses the existing protected credential store, scoped to profile,
server and OAuth client; device/wait/refresh tokens never appear in receipts.
Only one browser attempt may be pending per profile. Logout clears it.

Draft create/get/update, connections start/status/wait and private test outputs
with URLs share `handoff.message`; copy it without deriving URLs from IDs.
Connection waits also return structured next-action arguments. Existing blocking
`auth login` remains supported for interactive use.

## Sign in

Sign in before running workspace commands:

```sh
type-cli auth login
```

The CLI opens a browser window and asks you to finish signing in to Type. If you are working in an environment that cannot open a browser, print the login URL instead:

```sh
type-cli auth login --no-open
```

If several workspaces are available, noninteractive login lists their names and
organization IDs in human output and preserves them in JSON error details. Choose
one and rerun `type-cli auth login --org <id> --no-input` within ten minutes to
reuse the browser approval.

Check your current session:

```sh
type-cli auth status
```

Show the signed-in user and active workspace:

```sh
type-cli whoami
```

Sign out:

```sh
type-cli auth logout
```

Logout waits for any in-flight browser authentication step before removing the saved login and browser session, so a background `auth wait` cannot sign you back in afterward.

The CLI stores its session in your operating system keychain. If Linux's libsecret, Secret Service, or session bus is unavailable, it falls back to a plaintext file under `~/.type/credentials/` (`TYPE_CONFIG_DIR/credentials/` when configured), with `0600` file permissions and `0700` permissions on newly created credential directories. The CLI prints the file location to stderr when saving there. Permission denials, locked keyrings, and unexpected keychain errors still fail the command.

Once a profile uses file storage, it continues reading and updating that file even if the keychain becomes available later. Signing out deletes the file, attempts to remove the keychain entry, and removes the profile's saved settings; unavailable keychain entries cannot be removed until the service is available.

## Configuration and environment

CLI settings live in `~/.type` (`config.json`, plus the document and skill mapping files). Set `TYPE_CONFIG_DIR` to use a different directory.

Every command accepts these global options:

| Option | Environment variable | Purpose |
| --- | --- | --- |
| `--json` | `TYPE_JSON=1` | Print one JSON object to stdout; progress goes to stderr. |
| `--compact` | — | Requires JSON. Omit identical `userMessage` and `handoff.message` aliases when `nextAction.message` carries their exact text; retain all state, URLs, action arguments, errors, and instructions. Default JSON is unchanged. |
| `--no-input` | `TYPE_NO_INPUT=1` | Fail with a structured error instead of prompting. |
| `--org <org>` | `TYPE_ORG` or `TYPE_ORG_ID` | Choose the workspace for one command. |
| `--profile <name>` | `TYPE_PROFILE` | Keep separate sessions, for example for two Type accounts. |
| `--server <url>` | `TYPE_SERVER_URL` | Type API base URL; defaults to `https://api.type.com`. |
| `--app <url>` | `TYPE_APP_URL` | Type web app base URL; defaults to `https://type.com`. |

Unknown options are rejected, so check `type-cli <command> --help` for the exact flags a command accepts.

## Manage CLI analytics

The CLI sends best-effort product analytics for command usage and authenticated CLI outcomes. Analytics failures never change command output or exit codes.

Check the current analytics setting:

```sh
type-cli analytics status
```

Persistently disable or re-enable CLI analytics:

```sh
type-cli analytics disable
type-cli analytics enable
```

Disable analytics for one process without changing the saved preference:

```sh
TYPE_CLI_ANALYTICS=0 type-cli skills list --global
```

## Query workspace analytics

`workspace-analytics` provides the same health, usage, and cost queries as Type's built-in organization analytics tools. These are authenticated, read-only workspace queries. Access is enforced by the server and generally requires an administrator or owner. Use `--org <org>` to select a workspace; permission errors exit with code 4.

This command group is independent of `analytics status|enable|disable`, which only manages CLI telemetry preferences. Disabling CLI telemetry does not disable workspace analytics queries.

```sh
type-cli workspace-analytics health --period last_7_days --json
type-cli workspace-analytics health --space ch_123 --json
type-cli workspace-analytics catalog --json
type-cli workspace-analytics usage summary --json
type-cli workspace-analytics usage adoption --period last_30_days --json
type-cli workspace-analytics usage trend --metric active_members --grain week --json
type-cli workspace-analytics usage series --metric ai_teammate_invocations --grain day --dimension source --limit 8 --json
type-cli workspace-analytics usage breakdown --metric failed_invocations --dimension space --limit 25 --json
type-cli workspace-analytics costs billing-period --json
type-cli workspace-analytics costs summary --json
type-cli workspace-analytics costs trend --grain day --scope space --scope-id ch_123 --json
type-cli workspace-analytics costs series --grain day --dimension model --measure input_tokens --json
type-cli workspace-analytics costs breakdown --dimension member --json
type-cli workspace-analytics costs space-detail --space ch_123 --json
```

| Command | Data |
| --- | --- |
| `health` | Organization overview, findings, execution outcomes, running work, blockers, automation failures, and connection health. Add `--space <space-id>` for the Space detail view. |
| `catalog` | Usage metrics, compatible dimensions, grains, range limits, privacy rules, and limitations. |
| `usage summary` | Workspace activity totals and prior-period comparisons. |
| `usage adoption` | Member activity and adoption. |
| `usage trend` | One `--metric` over time, with required `--grain day|week|month`. |
| `usage series` | A `--metric` grouped over time, with required `--grain` and `--dimension`. |
| `usage breakdown` | A ranked `--metric` by required `--dimension`. |
| `costs billing-period` | Current billing dates, allowance, credits, token usage, and a reusable analytics date range. |
| `costs summary` | Cost and token totals with prior-period comparisons. |
| `costs trend` | Cost over time, with required `--grain`. |
| `costs series` | Grouped cost, input tokens, output tokens, or model calls, with required `--grain` and `--dimension`. Each bucket retains aligned cost and token totals. |
| `costs breakdown` | Ranked costs by required `--dimension member|space|channel|model`. |
| `costs space-detail` | Detailed cost makeup for required `--space <space-id>`. |

Range options apply to health and all usage/cost views except `catalog` and `costs billing-period`:

- `--period last_7_days|last_30_days|last_90_days` selects a trailing period. Omitting range options uses the server default, currently the last 30 days.
- `--since <date|timestamp>` selects a live range ending at request time. Add `--until <date|timestamp>` for a fixed range. Do not combine these with `--period`.
- The start is inclusive and the end is exclusive. Date-only inputs mean midnight UTC; timestamps must include a timezone. For all of September, use `--since 2026-09-01 --until 2026-10-01`. Future or reversed ranges are rejected; the server enforces the catalog's maximum range length.

Trend and series views accept `--scope organization|space|channel|member`, defaulting to `organization`. Non-organization scopes require `--scope-id <stable-id>`. `--space` is only for `health` and `costs space-detail`; use a stable Space ID from the health overview or `spaces list`, not a name or slug.

Usage dimensions come from `catalog`; cost dimensions are `member`, `space`, `channel`, and `model`. `costs series --measure` accepts `cost` (default), `input_tokens`, `output_tokens`, or `model_calls`. Breakdown limits are 5–100 (default 25); series limits are 3–20 (default 8), with remaining values grouped into Other. Unsupported options for a selected view fail with exit code 2 instead of being ignored. For Space cost detail, choose a known Space from `costs breakdown --dimension space` and use the same date range. A Space with no recorded costs in the range returns `not_found` (exit code 8); widen the range or select a Space with cost records.

`--json` returns `{ "ok": true, "operation": "workspace-analytics.<view>", "data": ... }`. `data` preserves the full server response, including schema version, comparisons, cost basis, privacy metadata, and limitations where present. Without `--json`, the command prints the same data as formatted JSON. Cost amounts are USD micros before allowances and credits; input tokens include cached input. Health does not measure uptime, missed schedules, queue delay, or integration sync freshness. Personal Sidekick details remain subject to the same server privacy rules as Type's tools.

## Choose a workspace

List the Type workspaces available to your signed-in account:

```sh
type-cli orgs list
```

Set the default workspace:

```sh
type-cli orgs use acme
```

Most commands use your active workspace. If you belong to more than one workspace, pass `--org` to choose one for a single command:

```sh
type-cli skills sync ./skills/pr-review --global --org acme-test
```

Local agent scripts can use `TYPE_ORG` instead of repeating `--org`:

```sh
TYPE_ORG=acme-test type-cli skills sync ./skills/pr-review --global
```

## Search the workspace

Search workspace-native messages, threads, Spaces, people, files, docs, and apps with one command:

```sh
type-cli search "launch plan"
```

Search only known target types to reduce work and output:

```sh
type-cli search "launch plan" --types threads,docs --limit 5 --json
```

Accepted `--types` values are `messages`, `threads`, `spaces`, `users`, `files`, `docs`, and `apps`. The query must include at least one letter or number. `--limit` is a per-section cap: it can lower the server default for each requested section but does not raise it.

Search responses include the active organization, current user ID, stable resource IDs, web URLs, match evidence, and per-section pagination metadata. Check `hasMore` and `appliedLimit` before concluding that no other matches exist.

Search results are intentionally compact. A thread hit contains a snippet for discovery, not the complete conversation. Hydrate candidate threads before relying on their details:

```sh
type-cli threads batch thread_123 thread_456 --per-thread-limit 25 --max-total-chars 24000 --json
```

Read one thread or continue its pagination cursor:

```sh
type-cli threads get thread_123 --limit 50 --max-chars 12000 --json
type-cli threads get thread_123 --cursor '<next-cursor>' --json
```

Thread reads (`threads get` and `threads batch`) include attachments in each message's `files` and `images` arrays. Uploaded attachments include `fileId`, `filename`, `mimeType`, `sizeBytes`, and `download: { status: "available", url, expiresAt }`. URLs expire after one hour; read the thread again to refresh them. The same image can appear in both arrays; deduplicate by `fileId` only when it is present, and preserve images without a `fileId`.

To save original file bytes locally using a fresh URL:

```sh
type-cli files download file_123 --output ./report.pdf --json
```

The result includes `fileId`, an absolute `path`, `filename`, `mimeType`, and `bytesWritten`. The parent directory must exist. Existing files are never overwritten, and failed or incomplete downloads are not published to the output path. The command uses the signed-in user's attachment permissions.

Unavailable attachments retain their metadata and return `download: { status: "unavailable", reason, retryable }`; other attachments and the thread remain readable. Reasons include `not_found_or_inaccessible`, `upload_pending`, `upload_failed`, `not_downloadable`, and `temporarily_unavailable`. External images without a Type file ID retain their original `url` and report `external_url`; Type does not sign or proxy these URLs. For expired download links, use `files download` with the stable file ID or fetch the thread again.

List the newest accessible threads across the organization without inventing a search query:

```sh
type-cli threads recent --sort created --limit 20 --json
```

`threads recent` defaults to creation-time order. Use `--sort activity` for recently active threads, `--space ch_123` to restrict the feed, and `--cursor` for the next page. This is the direct command for prompts such as “what are the most recently created threads?” Add `--waiting-on-input` to return only threads where AI is currently waiting for a person's answer.

List threads in a Space by recent activity:

```sh
type-cli threads list --space ch_123 --status open --limit 20 --json
```

The Space can be public or a private Space you belong to. Use `--from` and `--to` for date filtering and `--cursor` for the next page. Thread lists are ordered by `lastActivityAt`; `rootCreatedAt` is included separately and must not be treated as the list's sort order. Add `--waiting-on-input` to find threads where AI is waiting for a person's answer. Answered questions do not match; the filter is applied before pagination.

This search covers content stored in Type. Use the integration commands below for Slack, Gmail, Linear, and other connected services.

## Start and complete an agent task

Use `threads create` to start work in a Space. It creates a new thread in the Space's default channel and returns its ID and URL before the agent finishes. A normal `auth login` session is required; a signup-issued read-only credential cannot start a task.

```sh
type-cli threads create --space engineering --message "Summarize the latest release" --json
type-cli threads create --space engineering --file ./task.md --json
```

Optional `--harness claude|codex`, `--model <model>`, and `--effort <effort>` pin the run settings. A model implies its compatible harness; unsupported combinations fail. For coding work, `--ref <full-40-character-commit-sha>` starts from a commit already pushed to the Space's attached GitHub repository. The CLI does not commit or push local files. Without `--ref`, the Space does not need a repository.

To attach a local file, upload it into the target Space and pass the returned `fileId` to `threads create` or `threads reply`. `--file` reads prompt text; `--file-id` attaches bytes. Repeat `--file-id` for up to 20 attachments.

Each upload must be a nonempty regular file of at most 1 GiB. Each upload and download must finish within 5 minutes, so split large archives on slow connections. Until you attach an uploaded file to a message, only you can find or download it. After you attach it, it uses the access rules of that message. In a `--private` session thread, only the thread's owner can find or download it. Before you attach sensitive files, check that the target thread shows `visibility: "private"` in `threads recent`. See [Permissions and Access](https://docs.type.com/spaces/permissions-and-access/index.md#files-and-attachments).

```sh
type-cli files upload ./input.csv --space engineering --json
type-cli threads create --space engineering --file ./task.md --file-id file_123 --json
```

Use `threads status` for one snapshot or `threads watch` to observe execution until completion, failure, cancellation, required input, or the observation deadline. The default deadline is 300 seconds; `--timeout` accepts 1–3600 seconds. In JSON mode, watch returns a compact selected-run result with `status`, `terminal`, `stopReason`, output text and file IDs, pending approvals, history, and `nextActions`. Add `--include-messages` for a bounded message page or `--max-chars` to change the default 8,000-character text budget.

```sh
type-cli threads status thread_123 --json
type-cli threads watch thread_123 --timeout 300 --json
```

A watch timeout returns `ok: true` with `stopReason: "timeout"` and a resume action; it does not stop the remote task. Closing the terminal or pressing Ctrl-C also stops observation only. Run watch again to reconnect. To deliberately cancel a running task after approval, use `type-cli threads cancel thread_123 --yes`. A failed or cancelled watched run exits nonzero.

If watch reports `waiting_for_input` or `waiting_for_approval`, inspect the exact pending request:

```sh
type-cli approvals list --thread thread_123 --json
type-cli approvals get approval_123 --json
type-cli approvals answer approval_123 --message "Use the October report" --json
```

For structured questions, use `--args '{"answers":[{"question":"exact question","selected":["exact option"],"freeform":null}]}'` or `--file ./answers.json`. Use `approvals approve <id> --yes` or `approvals reject <id> --reason "..." --yes` for an ordinary tool approval. Questions require `approvals answer`; generic approval does not answer them. Specialized app-publish and integration-setup workflows retain their own approval steps.

Creation, reply, and answer receipts include `nextActions.argv` for the exact continuation. Agents should execute that argument array directly, including any specified stdin, rather than parse the display command. `--trigger-message <message-id>` keeps watch scoped to the prompt that started the run even if later replies exist. If an AI prompt reply joined a run that was already working, which happens when steering is enabled, it selects that run, and the run's `steeredMessageId` field identifies your prompt. `--after-run <run-id>` supports manual observation of the next run. A successful submission or approval answer does not prove the task finished. Download returned output file IDs with `type-cli files download <file-id> --output ./report.json` and inspect the result. After an ambiguous create or reply failure, inspect recent threads before retrying because a new submission may already exist.

### Reply in a thread and mention teammates

Post a reply into an existing thread as the signed-in user. This is the counterpart of [`sessions push`](#push-a-local-agent-session): push starts a new thread from a local transcript, reply adds to a thread that already exists.

```sh
type-cli threads reply thread_123 --message "@Fletcher Richman can you review this? cc <@user_01…>" --json
type-cli threads reply thread_123 --file ./reply.md --json
type-cli threads reply thread_123 --message - < ./reply.md
type-cli threads reply thread_123 --message "Summarize the decisions above" --reply-mode prompt --json
```

Mention a teammate by writing `@Display Name` (case-insensitive, matched against organization members) or `<@user_id>` (exact; find IDs with `type-cli search "<name>" --types users --json`). Resolved mentions render as mention chips and notify that person. `#space-name` links a Space. The thread ID is the root message ID returned by `search`, `threads recent`, `threads list`, or `sessions push`; a reply's message ID also works and resolves to its thread.

The result includes the message URL, `mentions` (who was resolved and notified), and `unresolvedMentions` (tokens that matched nobody). An entry in `unresolvedMentions` means nobody was notified for that name, so look the person up and retry with `<@user_id>` when the mention matters.

A reply is either a **Team message** (`--reply-mode chat`), which never starts or resumes an AI response, or an **AI prompt** (`--reply-mode prompt`), which asks the thread's agent to respond. When `--reply-mode` is omitted, a reply that resolved a user mention is sent as a Team message and any other reply is sent as an AI prompt, so a message addressed to a teammate does not also wake the agent.

An AI prompt sent while the agent is still working in the thread can **steer** the running response, or it can **queue** and run as its own turn after the current one finishes. `--while-running steer` or `--while-running queue` picks one. `--while-running auto`, the default, asks TypeSafe and queues if TypeSafe is unavailable. A prompt sent while the agent is idle starts a run immediately, whatever this option is. You can only steer a run you started; a prompt sent while someone else's run is working always queues. Steering also requires that steering be available for your organization; otherwise a busy-agent prompt queues. If a steered prompt is dropped because the run ended before the agent read it, `threads watch` reports the drop so you can send it again. Replying requires access to the thread's Space, closed and locked threads reject replies, and direct-message threads are not supported.

### Move a thread to another Space

Move a thread and its replies into another Space as the signed-in user. The thread lands in the destination's All threads view.

```sh
type-cli threads move thread_123 --into operations --json
```

`--into` accepts a Space ID, slug, or exact name. You must be a member of both Spaces, and Sidekick Spaces are not supported. Someone else's private thread can only be moved by an organization owner or admin.

The thread's agent sandbox is destroyed, so the next agent reply starts fresh with the destination Space's repo, connections, and instructions. Artifacts created in the thread stay in the source Space. If an agent is still working in the thread, the command fails with a conflict; wait for the run to finish, then retry. The JSON result includes `sourceSpaceId`, `targetSpaceId`, and the destination `targetChannelId`.

### Close, reopen, or lock a thread

Close a thread when it's done, reopen it, or lock a closed thread so it's read-only, all as the signed-in user.

```sh
type-cli threads close thread_123 --json
type-cli threads lock thread_123 --json
type-cli threads reopen thread_123 --json
```

Any member of the thread's Space can close a thread or reopen a closed one. A locked thread is read-only for everyone: replies, edits, and deletes are refused, whether they come from Type, Slack, or an agent. Only the thread's owner and Space or organization admins can lock a thread, and only once it's closed. Locking is refused while an agent is still replying; wait for the run to finish, then retry.

Reopening also unlocks, so a locked thread can only be reopened by its owner or an admin; anyone else gets a permission error. The JSON result includes `threadId`, `status` (`open` or `closed`), and `locked`. `threads list`, `threads recent`, and `threads get` show a locked thread as `(closed, locked)`, and their JSON includes `locked`.

### Open a thread's running app on localhost

Forward ports from a thread's sandbox to your computer, so the app the agent started there answers at `localhost`. The app, its database and its other services keep running in the sandbox, and you don't need a clone of the repository.

```sh
type-cli threads forward thread_123 5173 3000
type-cli threads forward thread_123 8080:5173
type-cli threads forward thread_123
```

The first command serves sandbox ports 5173 and 3000 on the same local ports. `8080:5173` serves sandbox port 5173 on local port 8080. With no ports, the CLI uses the ports of the thread's running preview. Any TCP port works, including WebSockets.

Only the person who started the thread can forward it. The command runs until you press Ctrl+C, and reconnects on its own if the connection drops. If a local port is already in use, the command stops and suggests a `<local>:<sandbox-port>` alternative instead of choosing another port. A sandbox port with nothing running on it is marked "nothing is listening there yet": ask the thread's agent to start the app.

The command needs the OpenSSH client (`ssh`) on your computer. It doesn't use your SSH keys or `~/.ssh/config`. With `--json`, it writes `ready`, `reconnecting` and `reconnected` events as JSON lines on stderr, and the final result on stdout when forwarding stops.

Each connection uses an SSH login that Type issues for 15 minutes. The login can open a shell in the sandbox, not only forward ports. Pressing Ctrl+C stops the tunnel but doesn't revoke the login, so it stays usable until it expires. The CLI keeps it in a private temporary file, deletes the file when forwarding stops, and sends the login only to a gateway that proves its identity with the host key Type expects. While forwarding, the CLI re-checks your access every few minutes and stops if you can no longer reach the thread.

Forwarded ports listen on your computer's loopback address, so other accounts and programs on the same computer can connect to them. Keep services that hold sensitive data, such as a database, behind their own sign-in.

## Manage Spaces and channels

Spaces bring people and Type together. Each Space has its own agent; channels organize conversations within it. Space and channel references accept an ID, slug, or exact name.

```sh
type-cli spaces list
type-cli spaces get operations
type-cli spaces create "Daily brief" --description "Morning summaries" --private
type-cli spaces update daily-brief --name "Team brief"
type-cli channels list --space daily-brief
type-cli channels create Alerts --space daily-brief
type-cli channels rename Alerts "Ops alerts" --space daily-brief
```

Use `spaces members`, `add-member`, `remove-member`, `join`, and `leave` to manage membership:

```sh
type-cli spaces members daily-brief
type-cli spaces add-member daily-brief someone@example.com
type-cli spaces join operations
```

If `spaces join` succeeds but the detail refresh fails, the command reports success with a warning and a `spaces get` recovery command. JSON output includes `space.detailsUnavailable: true` and `space.warnings`; treat the agent and channel fields as unknown until you refresh them.

Space autoreply controls webhook replies and the default behavior for new threads. Channel autoreply controls replies to new threads in that channel:

```sh
type-cli spaces autoreply daily-brief on
type-cli channels autoreply General on --space daily-brief
```

Archiving hides a Space or channel. Merging moves content into a target and archives the source. Space merges require an organization admin. These operations, removing members, leaving a Space, and deleting automations ask for confirmation; non-interactive callers must supply `--yes` after approval.

```sh
type-cli spaces archive old-space --yes
type-cli spaces merge old-space --into operations --yes
type-cli channels merge Alerts --into General --space operations --yes
```

## Run scheduled actions

Scheduled actions run the Space's agent on a timetable. Create one with instructions and a schedule:

```sh
type-cli scheduled-actions create --space daily-brief --name "Morning brief" \
  --every weekdays --at 09:00 --timezone America/Los_Angeles \
  --instructions-file ./brief.md
```

`--every` accepts `day`, `weekdays`, `weekends`, comma-separated weekdays such as `mon,wed,fri`, intervals `15m`, `30m`, `1h`, `2h`, or `4h`, and `month`. Monthly schedules use `--day-of-month 15` or a pattern such as `--monthly first-mon` or `--monthly last-fri`.

Combine an interval with `--days` to restrict its weekdays, for example `--every 1h --days weekdays`. The `1m` interval is also accepted; the web interface reserves this option for development. A schedule name can be supplied as `--name "Morning brief"` or as one quoted positional argument, but not both.

`--timezone` accepts an IANA timezone such as `America/Los_Angeles`, `Europe/London`, or `UTC`. Invalid zones are rejected. New schedules default to the machine's local timezone and `09:00`. Updates preserve omitted fields, so changing only `--at` keeps the existing weekdays and timezone:

```sh
type-cli scheduled-actions update atask_123 --space daily-brief --at 10:00
type-cli scheduled-actions update atask_123 --space daily-brief --timezone Europe/London
```

New actions start disabled unless you pass `--enable` on create. Test before enabling:

```sh
type-cli scheduled-actions test atask_123 --space daily-brief --follow
type-cli scheduled-actions enable atask_123 --space daily-brief
type-cli scheduled-actions history --space daily-brief
```

Tests run in a private thread and print its URL. `--follow` streams available text and checks the saved run status if streaming is unavailable. It exits non-zero on failure, cancellation, or timeout. The default timeout is 300 seconds; use `--timeout <seconds>` to change it. A timeout stops waiting without cancelling the server run.

Use `--channel <channel>` to select a destination. `--slack-channel <#name|id>` also posts to a Slack channel already linked to the Space. `--description <text>` adds a description. `--model <id> --effort <level> [--fast]` configures the run; `--default-model` clears overrides on update. Run `type-cli scheduled-actions --help` for supported models and flags. Instructions can reference workspace skills as `/skill-handle`; find handles with `type-cli skills list --global`.

Run-setting updates preserve omitted fields. Use `--no-fast`, `--clear-model`, or `--clear-effort` to reset one setting, or `--default-model` to clear all run overrides. `--clear-channel` restores the Space's default destination.

Updates, enable, and disable check the automation's latest edit version. Pass `--expected-version <version>` from an earlier `get` to pin that read; on a conflict, re-read the automation instead of retrying automatically.

Updating an enabled automation doesn't pause it: runs already in progress finish on the version they started with, and new events run the new version. Disabling an enabled automation stops its runs in progress at their next stage; an agent stage that is already running finishes its turn first. Pass `--finish-runs` to let them finish instead. `--stop-runs` asks for the default explicitly. `synced-events disable` takes the same flags for new-thread automations.

When the `automation-safe-enable` feature switch is on for the organization, scheduled actions are always created paused: `scheduled-actions create --enable` is rejected with error code `test_required`. Enabling then requires a completed private test of the current definition; `scheduled-actions enable` fails with `test_required` when no such test exists (or `test_in_progress` while one is running), and `test_required` includes the `scheduled-actions test <id> --space <space> --follow` command in `error.details.nextActions`, requiring explicit user approval. `test_in_progress` returns no new-test action: wait for the existing test (use `automations tests follow` if its response message ID is known), then retry enable. Any later change to the automation, including disabling it, requires a new test before it can be enabled again. There is no CLI or MCP override: a person who wants to go live without a test enables the automation from its page in the Type web app.

Scheduled automations are also editable as artifacts in Type. `list` and `get` never convert an older automation; `open` converts it when needed, keeps its task ID, and prints the artifact URL:

```sh
type-cli scheduled-actions open atask_123 --space daily-brief --no-open
```

Scheduled automation IDs can be inspected and managed without a Space:

```sh
type-cli scheduled-actions get atask_123 --json --no-input
type-cli scheduled-actions archive atask_123 --yes --json --no-input
type-cli scheduled-actions delete atask_123 --permanent --yes --json --no-input
```

These commands resolve the ID within the selected organization, including archived tasks, tasks without a Space binding, and tasks whose agent is no longer the Space's default. Optional `--space` constrains the task to that Space and rejects a mismatched binding. `automations get <id> --kind scheduled` also accepts an omitted Space; `--kind event` still requires one. Inspect `isArchived` and `editVersion` in the response; `spaceId` is null when unbound. Listing remains Space-scoped and can omit these legacy tasks. Execution and editing commands still require a Space with its current agent.

Archive disables and hides the automation, and stops its runs in progress, while keeping its configuration and run history. Use disable/enable for a resumable pause; there is no CLI restore command for archives. Legacy `delete` without `--permanent` continues to archive:

```sh
type-cli scheduled-actions archive atask_123 --space daily-brief --yes
type-cli scheduled-actions delete atask_123 --space daily-brief --permanent --yes
```

Permanent deletion removes the definition, instructions, memory, and linked artifact revisions. It works with active or archived task IDs and cannot be undone. Run records, delivered messages/files, and shared connections remain. Run records lose their automation link, so history filtered by that automation ID no longer finds them. Already dispatched runs may finish. Historical prompts, transcripts, logs, and backups are outside this deletion's scope. Archive and permanent deletion accept `--expected-version <version>` and reject concurrent edits without retrying automatically.

New-thread automations support `synced-events archive` and `synced-events delete --permanent` with the same behavior. Other event sources use source-specific `synced-events delete`: webhooks lose their channel association but retain their source record; RSS feeds lose configuration, tracked entries, and source events; Slack, GitHub, Linear, and email are unsubscribed or disconnected from the Space. Shared integration connections and previously delivered output remain. Inspect `automations schema --json` for deletion capabilities.

### Choose accounts for scheduled actions

Explicit automation account selection is available only to organizations in the rollout. Existing choices remain enforced if the switch is later disabled.

Use `--act-as <connection-id>=<account-id>` on `scheduled-actions create` or `update` to choose which account an automation uses. Discover available connections and account IDs first:

```sh
type-cli integrations connections --json
type-cli scheduled-actions update atask_123 --space engineering \
  --act-as orgint_123=intacct_456 --act-as orgint_789=intacct_012
```

Use the connection's `id` and the account ID from `organization.integrationAccountId` (shared account) or `personal.userIntegrationId` (your personal account). Personal accounts are allowed only for automations you created.

Repeat `--act-as` once per connection. Exact connection and account IDs are required; provider names, display names, and `team`/`personal` aliases are not accepted. The server checks account ownership and access in every destination Space. `scheduled-actions get`, `list`, and mutation results show saved account choices.

Updates preserve choices you do not name. To clear only one connection's choice:

```sh
type-cli scheduled-actions update atask_123 --space engineering --act-as orgint_123=inherit
```

Clearing a choice does not disconnect the account. When automatic account selection is enabled for your organization, managed automation runs save the account they resolve when they first request an integration's credentials. A later run can therefore save an account again after you clear its choice. Existing saved choices continue to apply even if automatic selection is disabled.

## Create event automations

Use `automations create` for new webhooks, provider events, RSS feeds, email inboxes, and new-thread tasks. Instructions are required, either inline or from `--instructions-file <path|->`. External event sources use the shared code automation system.

```sh
type-cli slack channels
type-cli automations create --space daily-brief --source slack --slack-channel "#sales-updates" --instructions "Summarize sales updates" --enable
type-cli automations create --space daily-brief --source rss --url https://example.com/feed.xml --poll-minutes 30 --instructions "Summarize new articles"
type-cli automations create --space daily-brief --source webhook --service Stripe --instructions "Summarize payments"
type-cli automations create --space daily-brief --source email --username updates --instructions "Triage incoming mail"
type-cli automations create --space daily-brief --source new-thread --name Triage --instructions-file ./triage.md
```

All new automations start disabled unless you pass `--enable`. Creation and activation do not wait for a test event. The automation decides what to post or execute; no message component is generated, and new webhook automation execution does not depend on the Space autoreply setting.

Slack, GitHub, and Linear require a connected integration. Use `type-cli integrations connect <provider>` first, and pass `--integration <id>` when multiple connections match. Slack supports `--trigger mentions|posts|all`. Use `--name` to name the automation and `--channel` to select its destination channel.

External event creation returns `task`, `sourceId`, and, for webhooks, absolute `webhookUrl` and `receiptOnlyUrl` fields. Sending to the receipt-only URL confirms event receipt without running the automation; signature requirements still apply. Manage the returned automation task ID:

```sh
type-cli automations get atask_123 --space daily-brief --kind scheduled --json
type-cli scheduled-actions enable atask_123 --space daily-brief
type-cli scheduled-actions disable atask_123 --space daily-brief
```

`scheduled` is the CLI's existing task-management kind, including code-first tasks with event subscriptions. New-thread creation keeps its native thread-triggered task behavior and returns an `event` with a task ID; its management kind is `event`.

### Existing legacy sources

`synced-events create` is a compatibility alias for new automation creation and requires instructions. Other `synced-events` commands continue to manage existing legacy sources; they do not migrate them.

```sh
type-cli synced-events list --space daily-brief
type-cli synced-events test whsrc_123 --space daily-brief --follow
type-cli synced-events send whsrc_123 --space daily-brief --payload ./sample.json
type-cli synced-events poll rsssrc_123 --space daily-brief
type-cli synced-events history --space daily-brief
```

For these existing sources, `send` delivers a real webhook event and `poll` checks an RSS feed. A webhook configured with `--secret` verifies signatures, so pass the same secret to `send`. Legacy webhook replies retain the Space autoreply behavior.

Use `get`, `update`, `enable`, `disable`, and `delete` for legacy management. Legacy webhook, RSS, and new-thread sources can be paused; legacy Slack, GitHub, Linear, and email sources must be disconnected or deleted to stop incoming events. Deleting asks for confirmation unless you pass `--yes`. Email sources cannot be updated. Other sources accept only their supported fields; unsupported options and empty update values are rejected. Run `type-cli automations schema --json` to inspect capabilities and required flags.

## Code automations

To deploy an automation folder, add a root `type.json` with its name and source entrypoint:

```json
{
  "name": "Release updates",
  "entrypoint": "src/main.ts"
}
```

The entrypoint defaults to `src/main.ts` and must default-export `automation({ output, deployment, stages })`; see [Code automation source](#code-automation-source). An optional root `fixtures.json` contains an array of host test cases. The CLI validates the fixture envelope locally and sends these cases separately from source files; a nested file such as `src/fixtures.json` remains a source module. The CLI reads the folder without executing its code locally and respects `.gitignore` and `.typeignore`. It packages at most 256 files in 1 MiB and skips hidden files, symlinks, dependency and build folders (`node_modules`, `dist`, `build`, `coverage`, `generated`, `vendor`), tests, declaration files and credential-like JSON. Agents use the same packaging rules when they save a folder from their workspace with `create_task` or `update_task` `codeSource`, so a folder deploys the same files either way.

```sh
type-cli automations deploy ./release-updates --space daily-brief
type-cli automations deployment <deployment-id> --space daily-brief --json
type-cli automations deployment <deployment-id> --space daily-brief --follow
```

`deploy` follows validation, fixture execution, subscription registration, and activation. The first successful code deployment enables its draft unless the automation was created from a library template, which stays paused until explicitly enabled. Replacing saved code preserves the automation's current enabled or paused state, including when redeploying unchanged source. A paused deployment is a successful terminal result. A concurrent pause or edit rejects the deployment instead of overwriting it. A failed deployment exits with an error and leaves the previous version active. Redeploying an existing automation requires its creator's account, and a pending request for human intervention blocks redeploys until a member resolves it. Omitting the folder deploys the current directory.

Keep `.type/project.json` to preserve the automation's identity across deployments. `.type/deployment.json` records the latest attempt, and the CLI prints its deployment ID before submitting it. After an interruption, use `deployment --follow` with that ID to resume observation. Both commands accept `--timeout <seconds>` from 1 to 3600, with a default of 600. A timeout ends observation; it does not cancel the server's deployment.

Expiration can be set in `type.json` or overridden for one deployment:

```sh
type-cli automations deploy ./release-updates --space daily-brief --expires-in 5h
type-cli automations deploy ./release-updates --space daily-brief --max-runs 10
type-cli automations deploy ./release-updates --space daily-brief --expires-at '2026-10-10T10:00:00-06:00'
type-cli automations deploy ./release-updates --space daily-brief --no-expiration
```

Choose one expiration flag. `--expires-in` accepts positive whole durations with
`s`, `m`, `h`, or `d` (up to 315576000 seconds). `--max-runs` accepts a positive
whole number. `--expires-at` requires an ISO timestamp with `Z` or a UTC offset;
the example is 10 am MDT. Past timestamps immediately prevent new runs.

For a persistent project setting, add one of these to `type.json`:
`"expiration": { "kind": "duration", "afterSeconds": 18000 }`,
`"expiration": { "kind": "runs", "maxRuns": 10 }`, or
`"expiration": { "kind": "timestamp", "at": "2026-10-10T10:00:00-06:00" }`.
Use `"expiration": null` to explicitly remove the source's expiration.

Precedence is CLI flag, then `type.json`, then the source's `deployment.expiration`.
Flags affect the submitted deployment and do not edit local files. A later deploy
without flags uses the project/source declaration again. Inspect the saved limit
with `automations get <automation-id> --space <space> --kind scheduled --json`
under `data.resource.codeExecution.definition.expiration`.

Durations start at first activation. Run counts cover all subscriptions, including
failed, skipped, and repair executions. Later stages of the same run (`next()`
transitions and agent-stage results) do not consume another run, nor do replays of
the same run or deployment fixtures. Pausing and redeploying retain
the original activation time and lifetime count; admitted runs may finish.

For single-file code uploads, `scheduled-actions create` and `update` accept the flags `--code-file <path>` or `--code <source>`, plus `--arguments <JSON object>` and `--agent-invocation`. The uploaded source must default-export `automation({ output, deployment, stages })`. Type derives the agent invocation from its stages: `never` when the graph has no agent stage, and `code_decides` when it has one. Any other value, including `always`, is rejected. Arguments and agent invocation require a code upload. Deployment commands and code upload flags are omitted from unauthenticated `automations schema` discovery.

## Inspect and test code automations

Existing report, scratchpad, and retrospective gates still apply. Offline schema discovery stays available without login; use live discovery to include the commands enabled for your session:

```sh
type-cli automations schema --live --json
type-cli automations test-code atask_123 --space engineering --arguments-file ./fixture.json --json
```

`test-code` runs a fixture against the saved code of an enabled or paused code automation in a Space you belong to; an enabled automation keeps running. It checks the subscription's filters and matcher, then runs only its entry stage without credentials. The code result shows that stage's transition and proposed effects; a later stage or agent stage is not started. It also returns `testedDefinitionHash`. It does not deliver a real event. It enables the automation only when a member's earlier **Enable** request is waiting for new passing tests of the same definition. Supply a fixture as `--arguments '<JSON>'` or `--arguments-file <path>`; `--arguments-file -` reads stdin. The payload must match the subscription's event schema. For a recurring subscription named `hourly`:

```json
{"subscriptionId":"hourly","payload":{"scheduledAt":"2026-10-30T09:00:00Z"}}
```

Fixtures can also supply checkpoints, matcher decisions, and recorded tool or integration responses. See [Test with Fixtures](https://docs.type.com/automations/testing/index.md). The existing `automations tests start` and `scheduled-actions test` commands continue to test agent instructions.

For enabled sessions, scheduled automation inspection includes connection health and human-intervention details. Scratchpad and saved report fields also require their respective feature gates. Run inspection with `--run <id> --include-activity --include-content` can include code results, call journals, retrospectives, and report errors. These share the redacted `--max-chars` budget with activity previews. Fields that cannot fit safely are omitted and named in `detailContentOmitted`; increase the budget up to 48,000 characters to inspect more. Access checks and secondary feature gates still apply.

Change an existing code automation's expiration without uploading its source again:

```sh
type-cli scheduled-actions update atask_123 --space engineering --max-runs 10 --json
type-cli scheduled-actions update atask_123 --space engineering --no-expiration --json
```

Choose one of `--expires-in 7d`, `--expires-at <ISO timestamp>`, `--max-runs <count>`, or `--no-expiration`. Patch files and `automations plan` also accept `expiration`: a duration, timestamp, or runs object; `null` removes it. Other update fields keep their existing behavior.

## Manage automation reports

These commands require `code-first-automations`. They edit or export an existing automation report without running the automation.

```sh
type-cli automations visualization get atask_123 --space engineering --json
type-cli automations visualization update atask_123 --space engineering --patch-file ./report.json --expected-revision 4 --json
type-cli automations visualization hide atask_123 --space engineering --expected-revision 5 --json
type-cli automations visualization restore atask_123 --space engineering --expected-revision 6 --json
type-cli automations visualization export atask_123 --space engineering --destination json --json
```

Read the current revision before each edit. A stale `--expected-revision` fails with `version_conflict`; read again and review the change before retrying. Hide preserves the saved report, and restore uses that saved specification. The update file contains `visualization` and optional `layoutPrompt`, `dataSources`, and `stateSources`; use `--patch-file -` for stdin.

Export accepts `json` (default) or `image`. Image export returns the stored file's metadata. Export does not send email or post to Slack.

## Inspect automations with agents

The `automations` namespace combines event automation creation, discovery, inspection, bounded history, costs, private test observation, and folder deployment. Use `scheduled-actions` and `synced-events` for lifecycle changes. Use `--json --no-input` for scripts and agents:

```sh
type-cli automations schema --json
type-cli automations schema --kind webhook --json
type-cli automations list --all-spaces --json
type-cli automations list --space daily-brief --kind scheduled --json
type-cli automations get atask_123 --space daily-brief --kind scheduled --json
type-cli automations history --space daily-brief --automation atask_123 --status failed --since 7d --limit 100 --json
type-cli automations costs --space daily-brief --since 30d --json
type-cli automations search "support gmail" --json
type-cli automations search --observed-connection orgint_123 --since 7d --json
type-cli automations runs --automations atask_123,atask_456 --since 2d --target customer@example.com --json
```

Schema discovery needs no authentication. It returns command arguments, required flags, enums, source capabilities, and the scheduled-action patch schema. Unsupported flags and extra positional arguments fail instead of being ignored. `get` requires `--kind scheduled|event`; list and history also accept `all`.

Scheduled automation detail includes `reliability`: recent whole-run outcomes and rates, stage states, known attempts and errors, and execution, human-wait and continuation timing. Read its `coverage` and `attemptEvidenceComplete` fields before comparing runs. The sample covers up to 100 root occurrences and 2,000 linked journals; missing evidence is explicit. See [Review reliability and performance](https://docs.type.com/automations/test-troubleshoot/index.md#review-reliability-and-performance).

Inventory covers accessible Spaces; archived or unbound automations may be absent. History filters run before pagination.

`automations search [query]` lists or searches the task-backed automations you may inspect across every Space (default) or in one Space with `--space`, without needing names or ids: scheduled actions, new-thread tasks and code-first automations, including disabled ones, with `--include-archived` for archived ones. Standalone Slack, webhook, RSS, email and app event sources stay under `synced-events list`. Filter with `--trigger scheduled|event|all`, `--enabled`/`--disabled`, `--owner <user-id>`, `--connection <orgint-id>` (saved configuration) or `--observed-connection <orgint-id> --since <ISO|7d> [--until <ISO>]` (connection recorded in code-run calls inside the window, citing run ids). Each row states its match basis: `name`, `description` and `instructions` are text matches and do not prove the automation uses an integration; `configured_connection` is saved configuration; `observed_connection` is recorded use. Calls are recorded per connection, not per account, and older agent-turn tool calls may have no connection id. Results are ordered by creation time with an opaque `meta.nextCursor` bound to your identity, scope and filters; repeat the same arguments with `--cursor` until `meta.complete`. The cursor preserves the resolved observed-use window, so a relative `--since 7d` can be repeated. No total is returned.

`automations runs --automations <id,id,...> --since <ISO|7d> [--until <ISO>]` finds recorded runs across up to 50 automations in a window of at most 366 days, without a Space. Filter with `--status`, `--kind code|agent|all`, `--connection`, `--service`, `--operation`, `--target` (recipient, channel or record), `--error` and `--effect read|write`; connection, service and effect filters match code and newly recorded agent-run call journals (`meta.evidenceCoverage`). A code receipt (`code:<id>`) and its agent run are separate runs linked through `logicalRunId` and `recovery`; a completed code run does not establish whole-occurrence success. Each run lists matching recorded calls or tool calls, a recovery summary and `gaps` naming what was never recorded, such as console output, response details missing from older calls, a capped 128-call journal, or a missing recovery journal. An empty call list is not proof that nothing was sent, and matching evidence shows possible overlap, not causation. Automations you cannot inspect are reported as `known: false` with no runs. The cursor preserves the resolved window, so repeat the same arguments with `--cursor` until `meta.complete`. Use the returned `detail.history` arguments with `automations history --space <space> --run <run-id> --include-activity` for recorded activity and content. Dates accept timezone-qualified ISO timestamps or durations such as `7d`; `--until` is exclusive. Use the returned cursor to continue, and `--mode test` to select recorded tests. Other provenance can be `unknown`; `--mode live` is unavailable. Completion does not prove delivery or business success.

## Observed automation outputs

```sh
type-cli automations destinations atask_123 --since 7d --json --no-input
type-cli automations runs --automations atask_123 --since 7d --effect write --json --no-input
```

`destinations` groups observed write attempts by connection and recorded destination. It returns separate `succeeded`, `failed`, and `unknown` counts, the last run, and operation names. It defaults to 30 days and accepts windows up to 366 days. It examines at most the latest 1,000 visible runs and 500 destinations; check `meta.truncated`, `cappedJournals`, `unknownDestinationCalls`, and `limitations`. Narrow the window when truncated. Destination labels can be recipients, channels, record IDs, or API paths; they are not a global record identity or a complete inventory of integration accounts.

New run calls have a host-generated `id`, start time, optional finish time, and `outcome`. A call that starts without a confirmed result remains `unknown`; it is not counted as successful or failed. A later failure does not erase earlier successful calls in the same run. Where the provider supplies recognizable fields, `result` includes a bounded `recordId`, an HTTP(S) `url` without query parameters, or `affectedCount` with its unit when known. Bulk receipts can include up to 20 `recordIds` and a `recordsTruncated` flag. Native Sheets receipts can include the updated cell `range`. `result.partial` preserves a known output when a later part of the operation fails, such as creating a document but failing to place it in a folder. Generic HTTP requests use their endpoint path as the destination; an edited email field is not treated as a recipient. Full request and response bodies and field-level before/after values are not stored.

Capture covers calls through Type's shared tool, Custom API request, and message endpoints. Commands, scripts, and provider actions hidden behind another call can have incomplete coverage; an `opaque` call does not establish its downstream destinations. Unknown tool effects stay `unknown`. Older runs are not backfilled. API success confirms the request response, not delivery or the business outcome. Empty journals are not proof of no writes, and shared destination labels do not prove two automations changed the same record.

The same read APIs are available as hosted tools `type_automations_destinations` and `type_automations_runs`, and the agent tools `list_automation_destinations` and `investigate_automation_runs`.

## Report automation costs and failures

Use `automations` to compare recorded automation usage, find expensive runs, and summarize failures. For general workspace spending, use `type-cli workspace-analytics costs summary`; `costs space-detail --space <space-id>` provides the same Space breakdown as `automations costs` without an explicit basis.

```sh
type-cli automations costs --org <org> --all-spaces --basis all --period last-month --grain week --compare previous-calendar-period
type-cli automations costs --space <space> --basis raw-tokens --since 7d --group-by run --sort cost-desc --limit 10 --json
type-cli automations history --org <org> --all-spaces --status failed --since 7d --group-by failure-reason
type-cli automations history --space <space> --run <run-id> --include-activity --json
```

Choose `--space` or `--all-spaces`. Costs can group by `space`, `automation`, or `run`; rankings use known subtotals. Pages default to 20 rows (maximum 100). Continue with the returned `--cursor`; cost summaries cover the matching window, not just the page.

`billable-usage` reports Type usage against plan allowance, trial credits, or other credits. BYO subscriptions consume no Type usage. `raw-tokens` values recorded customer tokens at hypothetical API rates, independently of actual subscription or provider charges. Internal/exempt work is excluded. `all` returns these views separately; do not add them.

Raw-token cost reports count a staged run once and attach its recorded code stages and agent turns to the receipt that started it. Runs confirmed to have stayed entirely in code have no model usage to price and are excluded from the cost-per-model-run average. A run that reached an agent but has no recorded invocation remains unknown; if only some agent stages have usage, its known subtotal is partial. The automation page's monthly total and per-run average both use this API-equivalent valuation, including usage funded by personal subscriptions; they are not amounts charged to your account.

Historical code executions whose stage identity was removed before identity facts were retained cannot be counted as exact logical runs. Reports keep their observed usage subtotal but return null run counts and no per-run average, with reason `run_identity_unavailable`. The legacy Space cost response cannot represent unknown counts and returns that error; use an organization raw-token report or a narrower window. New runs retain the identity and outcome facts needed for reporting when the detailed recovery journal expires. This does not reconstruct already-deleted historical facts.

Missing records or prices remain unknown. Known subtotals and fully priced recorded runs do not establish complete history; whole-window totals and monetary deltas stay unknown while coverage is incomplete. Invoice amounts, subscription-fee allocation, and model/harness/effort estimates are unavailable. Billable usage does not support run grouping or receipt-specific kind/automation/status/mode filters; choose `raw-tokens` for those requests.

Costs default to the last 30 days; `--until` requires `--since`. Periods such as `this-month` and `last-month` use `--timezone` (default UTC); weeks start Monday. Use `--since`/`--until` instead of `--period` for an explicit window. `--compare previous-period` compares an equal-duration preceding window; `previous-calendar-period` requires a calendar period. Requests are limited to 366 days per window and 10,000 records per source across both windows; narrow the window or filters if exceeded.

Organization admins/owners can read cost metadata across Spaces. Thread content, private tests, and activity retain separate permissions. Activity content is omitted unless you pass `--include-content`; use `--max-chars` to bound previews. Credential patterns are redacted, but other sensitive content may remain. Run IDs are stable; thread links and stored activity can be unavailable. Use `automations costs --help` and `automations history --help` for all filters.

## Automation change history

Use `automations changes` to see who changed a task automation and what changed. It combines saved implementation versions with changes to enabled/archived state, owner, selected integration accounts, and output destinations.

```sh
type-cli automations changes list atask_123 --limit 30 --json --no-input
type-cli automations changes list atask_123 --cursor '<nextCursor>' --json --no-input
type-cli automations changes get atask_123 achg_456 --json --no-input
```

Commands use the stable task ID in the selected organization and do not take `--space`. List is newest first; follow `data.nextCursor` until null. Limits are 1–100 (default 30). New entries require refreshing the first page. Get accepts either an operational `achg_…` ID or an implementation `ahist_…` ID from list.

Each entry includes the actor, timestamp and reason. Operational entries include `changedFields`, `before` and `after`; implementation details include the full saved source and comparison with its predecessor. One save that changes both implementation and operational settings produces one entry in each category. Creation has no prior operational snapshot. No-op and rejected saves add no entries.

Agent changes include the initiating user and available source thread/run IDs. `actorName` identifies the actor; `initiatingUserName` identifies the workspace member who requested the change, when recorded and still resolvable. Names reflect current workspace profiles, while the recorded IDs remain stable. Unavailable names are null. Source links remain subject to the reader's thread permissions. Account history contains connection/account IDs, never credentials or account profile data; credential renewal alone is not a change of selected account. Archived automations retain history; permanent deletion removes it. Existing implementation history is retained, but operational changes made before this feature are not reconstructed.

The agent tools are `list_task_changes` and `get_task_change`. Hosted MCP exposes `type_automations_changes` and `type_automations_change` (details in `change`). These return the same authorized history as the CLI. `automations history` remains run history, and `automations revisions restore` continues to restore implementation only.

## Automation implementation revisions

Use `automations revisions` to inspect and restore saved implementations of code or agent-only task automations. `automations history` shows executions. Revision commands use the stable `atask_…` ID in your selected organization; they do not take `--space`. Use `--org` when needed. Existing task/source and private-thread permissions still apply.

```sh
type-cli automations revisions list atask_123 --limit 30 --json --no-input
type-cli automations revisions get atask_123 ahist_456 --json --no-input
type-cli automations revisions restore atask_123 ahist_456 --expected-version '<editVersion from list>' --reason 'Return to the previously verified implementation' --yes --json --no-input
```

`list` returns newest-first summaries with author identity, timestamp, change reason, restore provenance, executable fingerprint, and `isCurrent`. Its `data.editVersion` is the current task's concurrency token. If `data.nextBeforeVersion` is non-null, pass it as `--before-version` to read the next page. `--limit` accepts 1–100 and defaults to 30. Existing automations without recorded history receive an unknown-author baseline before their next implementation change.

`get` returns the complete immutable implementation: prompt/instructions, schedule, execution definition, settings and code files. It also includes `comparison.baseRevision` with the preceding revision's complete snapshot, `changedFields`, `settingsAndInstructionsPatch` (a unified JSON diff of fields other than code files), and `codeFileDiffs` containing source patches and before/after entrypoint flags. Use `--compare-to <revision-id>` to choose a different saved comparison base within the same task. Diffs run from that base to the selected revision; selecting an older version with the current version as the base shows what restoring it would change. Operational state is not part of this comparison.

The first recorded revision has `comparison: null` unless you select a comparison base explicitly. A null patch means the computation limit was reached; both snapshots still contain the complete source. Added/removed files and entrypoint-only changes remain explicit. This is raw evidence for inspection and agent reasoning, without generated behavioral claims or a recommendation to restore. Run diagnostics remain separate.

`restore` requires the current `editVersion` from a prior read and a `--reason` of 1–2000 characters. The historical version number and `arev_…` code fingerprint are not concurrency tokens. Interactive use asks for confirmation; scripts using `--no-input` must pass `--yes` after the change is authorized. Restoration creates a new history entry, validates code and current access, and preserves enabled/paused state, accounts, destinations, checkpoints, event deduplication, and run history. In-flight runs keep their pinned code. It does not replay events or undo external actions. Code restoration still requires the code-first feature and existing activation requirements.

A concurrent edit exits nonzero with `error.code: "version_conflict"`. Re-read history and review the intervening change before retrying. Restores are never retried automatically. After a timeout or an unverified response, inspect history to determine whether the restore committed. Archived tasks can be inspected but must be unarchived before restoring an implementation.

## Preview scheduled-action patches

Use a JSON patch file or stdin to edit a scheduled action. Inspect the schema with `automations schema --kind scheduled --json`; output from `automations get` is an inspection snapshot, not an apply document.

For example, save this as `patch.json`:

```json
{
  "description": null,
  "runConfig": { "effort": "low", "fastMode": false }
}
```

```sh
type-cli automations plan atask_123 --space daily-brief --patch-file ./patch.json --json
type-cli scheduled-actions update atask_123 --space daily-brief --patch-file ./patch.json --expected-version <version-from-plan> --json
```

Omitted top-level fields are preserved. Run-configuration fields merge with the stored configuration; `runConfig: null` restores agent defaults. A supplied schedule object replaces the schedule. Null clears only fields allowed by the schema. Patch files cannot be combined with authoring flags.

A plan performs no writes. It validates the local patch shape and shows the current version and proposed patch; it does not validate server permissions, destination references, or execution effects. Editing schedules, instructions, destinations, or run settings can clear automation memory. If applying returns `version_conflict`, re-read before deciding whether the change is still appropriate.

## Start and resume private automation tests

```sh
type-cli automations tests start atask_123 --space daily-brief --kind scheduled --json
type-cli automations tests get <response-message-id> --space daily-brief --json
type-cli automations tests follow <response-message-id> --space daily-brief --timeout 300 --json
```

Tests run real agent tools in a private thread, including possible integration writes. They are not sandboxed and do not validate live event routing. Get and follow observe only your private tests; they cannot inspect arbitrary live runs.

Test status responses include `threadUrl`, so agents can recover the private test
link using `tests get` without starting another run or searching history. Follow
retains that URL when streaming falls back to polling or observation times out.
If the initial status lookup never completes or an older server omits the URL,
the timeout still includes the response message ID for recovery. Internal managed-agent
diagnostics are omitted from status text and errors.

Before submission, start prints a receipt to stderr with a response message ID. If the submission result is ambiguous, inspect that ID. To retry the same test, reuse it as `--request-id <response-message-id>` with the same identity, Space, automation, and kind. To resume observation, use get or follow instead of starting another test. The legacy `scheduled-actions test` and `synced-events test` commands also accept `--request-id`.

Following exits non-zero on `execution_failed`, `execution_cancelled`, or `observation_timeout`. A timeout stops waiting and does not cancel execution; the error retains the ID needed to resume. `tests get` returns the observed status without treating a failed execution as a failed lookup. Rate limits return `rate_limited`, distinct from invalid input or version conflicts.

### Connect sessions

Human output uses a labeled **Connect your services on type.com** hyperlink, with a
label-and-URL fallback on separate lines when terminal hyperlinks are unavailable.
JSON keeps the complete `url`. Agents should display the returned
`nextAction.message` verbatim before running its `afterDisplay` wait action.
This puts the label above the exact URL on its own line, without Markdown link
syntax or backticks. Provider authorization stays inside the browser page.

When an automation needs services that are not yet chosen or connected, start one connect session that lists every role it needs (trigger, sources, destination, tools in run order) with candidate services. The person opens one Type page, chooses among the candidates, and connects them there; the agent waits on the whole page instead of one provider link at a time. The page is available to all authenticated workspaces; session ownership and provider permissions still apply. Never replace it with raw provider OAuth URLs if setup fails.

```sh
type-cli automations connect start --name "Acme deploy alerts" --roles-file ./roles.json --no-open --json
type-cli automations connect status <session-id> --json
type-cli automations connect wait <session-id> --timeout 900 --json
type-cli automations connect finish <session-id> --json
```

The roles file is a JSON array of roles (`--roles-file -` reads it from stdin). Each role has a stable kebab-case `id`, a `kind` (`trigger`, `source`, `destination`, or `tool`), a `label` shown as the group heading, an optional `selection` (`single` or `multiple`; sources and destinations default to multiple, triggers and tools to single), and one to twelve `candidates`. A candidate names a catalog `provider` slug and may add a display `label`, a `scope` (`organization` or `personal`), an existing `organizationIntegrationId` to reuse, a `customApiDraft` (required for `custom_api`, with `authScheme` and a safe GET `validationRequest` that Type runs to verify the saved key), and `recommended: true` to pre-select it:

```json
[
  {
    "id": "trigger-deploys",
    "kind": "trigger",
    "label": "Starts when a deployment fails",
    "candidates": [{ "provider": "github", "recommended": true }, { "provider": "gitlab" }]
  },
  {
    "id": "destination",
    "kind": "destination",
    "label": "Posts to",
    "candidates": [{ "provider": "slack", "scope": "organization", "recommended": true }]
  }
]
```

`start` validates the file, prints the page URL and the wait command, and opens the page unless `--no-open`. `--draft <id>` ties the session to a paused draft. With `--json` it returns `{ ok, operation: "automations.connect.start", sessionId, url, status, expiresAt, handoff, nextAction }`.

`status` reads the session once; `wait` polls it every three seconds until the person finishes the page, every selected service is connected, or the session expires. Both return the full session plus `allConnected` and, per role, a `bindings` entry with the selected candidates (`provider`, `label`, `organizationIntegrationId`, `connected`). `wait` adds `stopReason`: `done`, `all_connected`, `expired`, or `timeout`. A timeout (default 900 seconds, at most 3600) ends observation only: it exits 0 with `ok: true`, the session stays open, and running the wait command again resumes. An expired session exits non-zero with `connect_session_expired`; start a new session, the draft is unaffected. `finish` closes a session from the agent side; the page's "Done adding connections" normally does this.

Connection state is derived from the workspace's real connections when the session is read, so a service connected elsewhere counts. Finalize the automation's instructions from the bindings, then attach each connection to the Space with `spaces connect`. The hosted MCP equivalents are `type_automations_connect_start` and `type_automations_connect_status`.

## Use integrations

List the integration instances available to you in the active organization:

```sh
type-cli integrations list --json
```

Each entry includes its stable `organizationIntegrationId`, service name, availability, and `execution`. Entries with `execution: "tools"` also include the effective `accessMode`. Type evaluates it for the signed-in CLI user outside any Space, using the same personal-or-organization credential selection and granular permission policy as Type. Access comes from workspace grants, explicit user grants, integration-manager status, and grants on any unarchived Space the user belongs to. For a shared connection, the highest applicable grant mode wins. An owner's or admin's team access instead follows their own manager mode, which is Full unless they set it to Read-only. Another member's personal connection stays limited to the Spaces it is shared with.

Installed Custom API connections are listed with `service: "custom_api"`, `execution: "request"`, and their `connectionStatus`; an inactive or unconnected one, or one whose shared credential the provider rejected (for example `auth_expired`), carries `status: "disabled"` and a `capabilityBlock` telling you to reconnect it. They expose no tools: skip `call` and use `type-cli integrations request --integration <organizationIntegrationId>` instead. `type-cli integrations tools custom_api [--integration <id>]` returns those connections (with `tools: []`) rather than an error (see [Connect and use a Custom API](#connect-and-use-a-custom-api)). Check this list before creating a Custom API connection to avoid duplicates. API-key provider connections and database connections are not listed.

Inspect the permitted tools and their exact argument schemas before calling one:

```sh
type-cli integrations tools google-email-calendar \
  --integration orgint_123 \
  --json
```

Then call a returned tool. For example, a request for recent email can use the user's personal Gmail account selected by Type:

```sh
type-cli integrations call google-email-calendar gmail_search_emails \
  --integration orgint_123 \
  --args '{"query":"newer_than:7d","maxResults":10}' \
  --json --no-input
```

Type keeps OAuth tokens and other credentials on the server; the CLI receives only tool metadata and results. If an integration supports personal accounts, Type applies its normal personal-versus-workspace credential selection for the signed-in user. Pass `--integration` whenever more than one installed instance provides the same service.

Read-only access is checked on both discovery and execution: CLI tool listings omit write tools, and a direct attempt to call one is rejected. The provider credential itself is not re-scoped, so calls that send, post, edit, delete, or otherwise change external data still require full access and should be treated as consequential operations.

### Add and remove integrations

List native integrations and Custom API setup capabilities, then inspect installed personal and organization connections:

```sh
type-cli integrations available --json
type-cli integrations connections --json
```

These commands include Custom API connections. Provider-catalog setup is not supported by the CLI. To attach a verified connection to a Space, run `type-cli spaces connect engineering --integration orgint_123 --yes`; inspect it with `spaces connections engineering` and remove the Space association with `spaces disconnect engineering --integration orgint_123 --yes`.

Start a personal Gmail connection:

```sh
type-cli integrations connect google-email-calendar \
  --scope personal \
  --no-open --json
```

For OAuth connectors, the returned `authUrl` goes directly to the provider. Open it to authorize the connection. The callback returns to Type so it can finish setup. Jira and connectors that need API keys, service-account credentials, or other browser-bound configuration instead return the exact Type setup URL. The CLI does not collect provider secrets.

When a connector supports both scopes, such as Linear, choose one explicitly:

```sh
type-cli integrations connect linear --scope personal --no-open --json
type-cli integrations connect linear --scope organization --no-open --json
```

Use `--integration <id>` to reconnect an exact instance. GitHub personal setup requires an exact instance. Use `--new` only for a native connector that supports another organization instance, such as GitHub. Native Google OAuth accepts a string-valued config object when needed:

```sh
type-cli integrations connect google_analytics \
  --config '{"ga4PropertyId":"properties/123"}' \
  --no-open --json
```

Disconnecting changes stored connection state and asks for confirmation. For non-interactive use, get approval first and pass `--yes`:

```sh
type-cli integrations disconnect \
  --integration orgint_123 \
  --scope personal \
  --yes --json --no-input
```

If an instance has both personal and organization credentials, `--scope` is required. Disconnecting a personal account always targets the signed-in user's credential. Disconnecting an organization connection uses the same workspace-admin or integration-manager authorization as Type's web UI.

### Connect and use a Custom API

Prepare the nonsecret configuration in your terminal or local agent session. The default setup opens a Type form where you enter the credential:

```sh
type-cli integrations connect custom \
  --scope personal \
  --config '{"name":"Warehouse API","baseUrl":"https://api.example.com","authScheme":"bearer","validationRequest":{"path":"/v1/me"}}' \
  --json --no-input
```

Use `--scope organization` for a shared credential. The draft requires a name and HTTPS base URL. It can include documentation, connection settings, and a read-only validation request. Supported authentication schemes are `bearer`, `x_api_key`, `custom_header`, `oauth2_client_credentials`, and `none`. Custom headers require `authHeaderName`; OAuth client credentials require `oauthClientId` and `oauthTokenUrl`.

Never put a credential in `--config`, command arguments, or agent messages. For the browser setup, enter it in Type and press **Save**; use `--no-open` to receive the setup URL without opening a browser.

For a Custom API, `--terminal` saves the credential without a Type setup page. Pipe it from a password manager through `--secret-stdin` and pass `--yes` after approving the exact connection. The example uses `pass`; use your password manager's stdout command. For `authScheme: "none"`, omit `--secret-stdin`. Do not put the credential in shell history, `--config`, or a command argument. Verify the returned attempt before using the connection:

```sh
pass show warehouse/api-token | type-cli integrations connect custom \
  --scope personal --terminal --secret-stdin --yes \
  --config '{"name":"Warehouse API","baseUrl":"https://api.example.com","authScheme":"bearer","validationRequest":{"path":"/v1/me"}}' \
  --json --no-input
```

Terminal setup returns an attempt ID and a `verifyCommand`; run verification before use. Browser setup returns a `waitCommand` to monitor the exact setup, followed by a `verifyCommand`:

```sh
type-cli integrations wait <attempt-id> --json --no-input
type-cli integrations verify <attempt-id> --json --no-input
```

`wait` confirms that the credential was saved; it waits up to 600 seconds by default, or `--timeout <seconds>`. `verify` makes the draft's GET request and marks setup ready after a successful response. If the draft omitted a validation request, supply `--args '{"path":"/v1/me"}'` to `verify`. If verification fails because the test request needs correction, retry the same attempt with a safe GET request in `--args`. If the credential or connection configuration needs replacement, use the returned `retryIntegrationId` and preserve the original connection scope: `type-cli integrations connect custom --integration <retryIntegrationId> --scope <original-scope> --config '<nonsecret-draft>' --json --no-input`. Supply the original or corrected nonsecret draft, then wait and verify the new attempt.

Call a ready Custom API by its exact integration ID:

```sh
type-cli integrations request --integration orgint_123 \
  --args '{"path":"/v1/items","query":{"limit":3}}' --json --no-input
```

Requests default to GET. POST, PUT, PATCH, and DELETE require approval; after approval, pass `--yes`. Request arguments support `path`, `query`, `headers`, and an optional `body` with `bodyEncoding` set to `json` or `form`. Type injects the stored credential, bounds and redacts responses, and does not follow redirects. If a write fails after it may have reached the provider, inspect provider state before retrying.

Custom API connections use the same disconnect and permission commands as native integrations. See [Connect a Custom API](https://docs.type.com/connectors-and-skills/custom-apis/index.md) for the setup flow in Type.

### Manage CLI integration permissions

Permission management is available when the `integrations-granular-permissions` feature switch is enabled for the organization. Inspect one or all connection policies returned by Type, including native, Custom API, and Custom MCP integrations. Permission management is independent of whether the CLI supports setting up that provider:

```sh
type-cli integrations permissions list --json
type-cli integrations permissions list --integration orgint_123 --json
```

The output lists workspace, user, and personal grants and reports the signed-in user's CLI-effective mode (`effectiveMode`). Individual Space grants are omitted from the output, and `omittedSpaceGrantCount` reports how many were hidden. Grants on unarchived Spaces the user belongs to still count toward `effectiveMode`, so it can be higher than the grants shown. For a shared organization connection, all applicable grants are additive: the highest applicable mode wins. A user-level `read_only` grant does not reduce a workspace-level or Space-level `full` grant. Owners and admins are the exception: their team access follows their own manager mode, which is Full unless they set it to Read-only, and other grants do not raise it. Their personal-account access is set separately. Inside a Space, calls use only that Space's grant, except for owners and admins, whose team access follows their manager mode.

For example, make a connection read-only by default while allowing two people to write:

```sh
type-cli integrations permissions set \
  --integration orgint_123 --workspace --mode read_only --yes
type-cli integrations permissions set \
  --integration orgint_123 --user alex@example.com --mode full --yes
type-cli integrations permissions set \
  --integration orgint_123 --user pat@example.com --mode full --yes
```

The actor changing a shared connection's grants must be a workspace owner/admin or a manager of that integration. A grant recipient does not need to be an integration manager.

A user can cap their own personal credential without being an integration manager:

```sh
type-cli integrations permissions set \
  --integration orgint_123 --personal --mode read_only --yes
```

`--personal` always means the signed-in user's own personal credential. `--user <member>` means an explicit grant on a shared organization connection; the member can be `me`, an exact organization-user or user ID, an email address, or an exact display name.

Remove an explicit shared grant with `clear`:

```sh
type-cli integrations permissions clear \
  --integration orgint_123 --user pat@example.com --yes
```

Personal modes cannot be cleared independently. Set the mode to `read_only` or `full`, or disconnect the personal account. All permission mutations prompt by default; automated callers should use `--no-input` and add `--yes` only after the user approves the exact change.

### Change a connection setting

Read a setting of a connected integration with `settings get` and change it with `settings set`. Anyone in the organization can read a setting. Changing one requires the same access as editing the connection in Type: a workspace owner or admin, or a manager of that connection.

`bigquery_query_limit` is the most data one BigQuery query can bill on a connection. A new connection starts at 1 TB:

```sh
type-cli integrations settings get \
  --integration orgint_123 --setting bigquery_query_limit --json
type-cli integrations settings set \
  --integration orgint_123 --setting bigquery_query_limit --value 2TB --yes
type-cli integrations settings set \
  --integration orgint_123 --setting bigquery_query_limit --value none --yes
```

`--value` takes a size in decimal units such as `500GB` or `2TB`, whole bytes, or `none` to remove the limit. The smallest limit is 10 MB. The JSON output reports `maximumBytesBilled` as whole bytes, or `null` when the connection has no limit. `settings set` prompts by default; automated callers should use `--no-input` and add `--yes` only after the user approves the exact change. See [Change the query limit](https://docs.type.com/connectors-and-skills/bigquery/index.md#change-the-query-limit) for what the limit does.

## Develop Type Apps locally

Type App checkouts contain editable frontend and Convex backend source. The frontend can run on your machine while Type hosts the development backend, draft preview, and live release.

Start a new checkout explicitly:

```sh
type-cli app create ./inventory-app --space operations --json --no-input
cd ./inventory-app
bun install
type-cli app dev --no-open
```

Or pull an existing app by its stable ID:

```sh
type-cli app pull wart_123 --into ./inventory-app --json --no-input
cd ./inventory-app
bun install
type-cli app dev --no-open
```

Create and pull responses include a `nextActions` array for automation. Use `--port <port>` when the default local frontend port, `5173`, is unavailable.

### Understand the app states

A local Type App has four distinct states:

1. **Local frontend:** Vite serves the current checkout from your machine during `app dev`.
2. **Shared editable source:** Type stores the complete authored tree used by the managed development backend. `app dev` uploads it at startup and after backend changes.
3. **Hosted draft:** For an app that already has a live release, `app push` creates a preview that teammates can inspect before publishing.
4. **Live release:** `app publish` promotes a hosted draft. For a new app with no release, the first `app push` prepares and publishes the initial live release.

`app dev` does not create a hosted draft. Because it updates shared editable source, another development checkout can make your checkout stale even when the Type UI shows no draft.

### Push and publish safely

For an app that is already live, create a hosted draft:

```sh
type-cli app push --json --no-input
```

Inspect the returned draft URL. Publishing changes the live app and requires confirmation. In an automated session, ask the user first and then run:

```sh
type-cli app publish --yes --json --no-input
```

The first push for a new app publishes the initial live release. It stops instead of publishing when a non-interactive caller omits `--yes`. After the user explicitly approves the live release, run:

```sh
type-cli app push --yes --json --no-input
```

If the app requests connections, publication may require approval for an exact set of capabilities. Review those capabilities before supplying `--yes`.

### Change an app's connection account choice

For an existing Type App, you can prepare a connection-only update without changing its views or actions. Use your own Type account with editor or owner access to the app and access to its Space. You also need a valid personal account for the connection you want to use.

Before pulling, check for pending app updates and coordinate with other maintainers. Use the current CLI and pull the exact existing app into a fresh directory:

```sh
type-cli app pull wart_123 --into ./app-connection-update --json --no-input
cd ./app-connection-update
```

If the checkout requires conversion of an older app, review that conversion separately before continuing.

In `.type/integrations.json`, find the connection's existing entries by `organizationIntegrationId`. To use each viewer's personal account, set `authorizationSource` to `viewer_personal` on those entries. Keep each entry's alias, operation ID, schema hash, connection slot, and execution settings unchanged, along with all other files and connection choices. This mode supports interactive actions only; resolve any background actions before switching the connection.

The CLI's `app integrations list` and `add` commands discover and add operations; they do not change an existing connection's account choice. Do not add duplicate entries to make this change. `app dev` is optional and does not create a hosted draft.

Run `type-cli app push --json --no-input`, review the returned draft URL and connection access, then publish separately after approval. Saving or pushing does not change an existing app's live release. If the source changed or another maintainer has pending work, resolve the conflict before continuing; do not force an overwrite.

See [Apps: Know whose account the app uses](https://docs.type.com/library/apps/index.md#know-whose-account-the-app-uses) for the account choices, viewer selection, and connection recovery.

### Add app integration capabilities

From a linked checkout, discover operations available to the app in its Space. Use an organization integration ID from `type-cli integrations list --json`; a connection listed there must also be available in the app's Space.

```sh
type-cli app integrations list --connection orgint_123 --kind background_read --query "query postgresql" --json
```

Each result includes its input schema, allowed execution kinds, operation ID, schema hash, and authorization source. Copy the operation ID from the result and use its schema to construct the fixed input:

```sh
type-cli app integrations add --connection orgint_123 --kind background_read --operation native:postgresql:query --alias teamMetrics --input '{"query":"SELECT 1 AS value"}' --max-runs-per-day 24 --json
```

This appends one capability to `.type/integrations.json` in the checkout. It copies `operationId`, `schemaHash`, and `authorizationSource` from the server; do not invent those values. If several operations match, select one with `--operation`. Duplicate aliases and invalid existing manifests are rejected without changing the file.

Background reads require a JSON object in `--input` and a positive integer daily limit in `--max-runs-per-day`. For interactive operations, use `--kind interactive` and omit both options. Discovery does not execute an operation, and adding a capability only changes the local manifest. Review the manifest, then use the normal push and publish flow to validate and approve its capabilities.

### Rename or archive an app

Rename a published app or your unpublished draft using its stable ID:

```sh
type-cli app rename wart_123 "Inventory overview" --json
```

Inside a linked checkout, omit the ID: `type-cli app rename "Inventory overview" --json`. The optional positional target must be an app ID; an existing title is not a rename target. Use `type-cli app ls --json` to find the ID.

Archive removes a published app for everyone and tears down its hosted backend, or discards your unpublished draft and its development backend. Published-app archive is owner-only and cannot be undone from the CLI. After explicit approval:

```sh
type-cli app archive wart_123 --yes --json --no-input
```

Omit the target to archive the linked app. Archive also accepts a title reference; prefer the stable ID to identify the exact app.

### Synchronize without Git

Git is optional. Type records a local whole-tree base in `.type/checkout.json` and compares it with local authored source and current shared editable source.

- If only the remote source changed, pull safely fast-forwards the checkout.
- If only local source changed, pull preserves it.
- If both changed, pull reports `reason: "diverged"` and changes no files.
- Dev and push use a source generation check so a stale checkout cannot overwrite newer shared source.

For scripts and agents, inspect `error.details.reason`, `filesModified`, `sourceUploaded`, and `safeCommands`. Treat `filesModified` and `sourceUploaded` independently. If `sourceUploaded` is `true`, shared source already advanced; do not blindly retry.

On divergence, use the recommended side-by-side command:

```sh
type-cli app pull --app-id wart_123 --into ../inventory-app-latest --json --no-input
```

Compare the directories with Git or ordinary filesystem tools. Run a command marked `requiresExplicitUserApproval` only after the user approves it. A forced pull backs up the previous tree under `.type/backups/`; recovery files are in `<backupDirectory>/files/`, while `manifest.json` contains metadata. Keep the fresh checkout's `.type/*` and managed `AGENTS.md` when reapplying authored files.

### Inspect and change access

Reading access is non-mutating:

```sh
type-cli app access --json
```

Scope changes require confirmation or `--yes`. `app share` makes an app public; it is not a read-only URL command. Ask the user before either operation:

```sh
type-cli app access --workspace --yes --json --no-input
type-cli app share --yes --json --no-input
```

Use `type-cli app open --no-open --json` when you only need the app URL and must not launch a browser. Add `--draft` to open the hosted draft or `--data` to open the app's data view.

Read backend logs for the live release, or for the hosted draft with `--draft`:

```sh
type-cli app logs --json
type-cli app logs --draft --tail
```

Rollback is not available in the CLI. To revert, push the desired source as a new draft and publish it.

## Work with Type documents

Use `type-cli documents` when you want Markdown files on your machine to become editable Type documents, or when you want to bring an existing Type document down for local editing.

List recent documents you can access:

```sh
type-cli documents list
```

Search by title or Markdown content:

```sh
type-cli documents list "launch plan"
```

Create a document from a local Markdown file:

```sh
type-cli documents push --file ./docs/launch-plan.md --title "Launch Plan" --space engineering
```

`push` is best for one-off uploads, stdin, or scripts that already know the document ID. By default, new documents are channel-scoped. Add `--public` only when the document should be accessible to anyone with the link:

```sh
type-cli documents push --file ./docs/status.md --title "Weekly Status" --space engineering --public
```

Update an existing document by ID:

```sh
type-cli documents push wart_123 --file ./docs/launch-plan.md
```

Use `sync` for local files you expect to maintain over time. The first sync creates the document and records a local mapping in `~/.type`; later syncs update the same Type document:

```sh
type-cli documents sync --file ./docs/launch-plan.md --title "Launch Plan" --space engineering
```

After the first sync, you can run:

```sh
type-cli documents sync --file ./docs/launch-plan.md
```

Link an existing Type document to a local file before syncing it:

```sh
type-cli documents sync --file ./docs/launch-plan.md --link wart_123
```

Pull an existing Type document into a local Markdown file:

```sh
type-cli documents pull wart_123 --file ./docs/launch-plan.md
```

Write a pulled document to stdout instead:

```sh
type-cli documents pull wart_123 --file -
```

Preview create, update, or sync work before writing:

```sh
type-cli documents sync --file ./docs/launch-plan.md --title "Launch Plan" --space engineering --dry-run
```

Document commands return share links. In agent workflows, pass `--json --no-input` so the agent can parse document IDs and URLs without prompts.

## Discover public library skills

Use `type-cli skills discover [query]` to browse or search the published [Type skills library](https://type.com/library/skills). No login or organization selection is required. Each call reads the current public catalog.

```sh
# Browse the first 20 published skills.
type-cli skills discover

# Search by task, product, or industry.
type-cli skills discover "conversion"
type-cli skills discover "Google Ads"
type-cli skills discover ecommerce --limit 5

# Return structured results for scripts and agents.
type-cli skills discover "revenue" --limit 10 --json --no-input

# Show command help.
type-cli skills discover --help
```

Search uses a case-insensitive substring match across names, descriptions, slugs, handles, roles, industries, authors, presentation titles and summaries, and file paths. It does not search file contents. A query such as `"Google Ads"` matches that phrase; use a shorter query if a longer phrase returns no results. Queries with multiple words can be quoted or passed as separate arguments.

Each result shows a title, a summary when available, and a library page URL. Open that URL to inspect or download the skill. Discovery only reads the catalog; it does not install a skill or add it to your workspace.

### Limits and JSON results

`--limit` accepts an integer from 1 to 100 and defaults to 20. Results preserve catalog order. When `hasMore` is true, increase the limit or narrow the query; discovery has no pagination cursor.

| JSON field | Meaning |
| --- | --- |
| `ok` | `true` for a successful request, including a search with no matches |
| `operation` | `skills.discover` |
| `query` | The trimmed search text, or an empty string when browsing |
| `libraryUrl` | The public library URL |
| `skills` | Matching skill metadata, bounded by the limit |
| `totalMatches` | Number of matches before applying the limit |
| `returnedItems` | Number of skills included in this response |
| `appliedLimit` | The requested limit, or the default of 20 |
| `hasMore` | Whether additional matches were omitted by the limit |

Each skill includes `slug`, `name`, `description`, `handle`, `roles`, `businessTypes`, `authorName`, `filePaths`, and `url`. When available, `presentation` includes `title`, `summary`, and composition metadata for skillsets and dependencies. Descriptions, handles, and author names can be null. File contents, images, and sample outputs are omitted.

Use `presentation.title` for the library's display title, with `name` as a fallback. For example, with [jq](https://jqlang.org/) installed:

```sh
# Print titles from up to 100 published skills.
type-cli skills discover --limit 100 --json \
  | jq -r '.skills[] | (.presentation.title // .name)'

# Print matching titles and links as tab-separated rows.
type-cli skills discover "Google Ads" --json \
  | jq -r '.skills[] | [(.presentation.title // .name), .url] | @tsv'
```

A successful search with no matches returns `skills: []`, `totalMatches: 0`, and `hasMore: false`, with exit code 0. Invalid limits return `invalid_input` with exit code 2. Network failures, HTTP errors, and invalid catalog responses return `unavailable` with exit code 6. With `--json`, errors use the standard `{ "ok": false, "error": { "code": "...", "message": "..." } }` envelope.

### Public library or workspace skills

| Task | Command | Authentication |
| --- | --- | --- |
| Find published library skills | `type-cli skills discover "conversion"` | None |
| List workspace-level skills | `type-cli skills list --global` | Required |
| List skills in a Space | `type-cli skills list --space engineering` | Required |
| Inspect a workspace skill and its files | `type-cli skills inspect <skill-id-or-handle>` | Required |

Public discovery returns library slugs and URLs. These are not workspace skill IDs; follow the returned URL for a public skill. Use `skills list` to obtain references for `skills inspect`. The `--global` and `--space` targeting flags apply to workspace skill commands, not public discovery. `--agent` remains a deprecated Space-target alias.

## Sync skills to a Space

Use `type-cli skills sync` to create or update a Type skill from a local skill folder.

```sh
type-cli skills sync ./skills/pr-review --space engineering
```

The skill folder should include a `SKILL.md` file. Optional `scripts`, `references`, and `assets` folders are uploaded with the skill.

On the first sync, Type creates the skill and attaches it to the Space's agent. On later syncs, Type updates the existing skill.

Preview the change without uploading:

```sh
type-cli skills sync ./skills/pr-review --space engineering --dry-run
```

Create a new skill every time instead of updating a linked skill:

```sh
type-cli skills push ./skills/pr-review --space engineering
```

If a skill with the same name already exists for the target, `push` fails by default. Use `--force` to update the existing same-name skill when the CLI can resolve it unambiguously:

```sh
type-cli skills push ./skills/pr-review --space engineering --force
```

List skills in a Space:

```sh
type-cli skills list --space engineering
```

Inspect a skill and its packaged files:

```sh
type-cli skills inspect skill_123
```

## Sync skills to the workspace library

Use `--global` to create or update workspace-level skills instead of attaching the skill to one Space.

```sh
type-cli skills sync ./skills/pr-review --global
```

List workspace-level skills:

```sh
type-cli skills list --global
```

Use `--link` when one local skill directory should sync to an existing Type skill:

```sh
type-cli skills sync ./skills/pr-review --global --link skill_123
```

A skill package includes `SKILL.md` and the contents of the `scripts`, `references`, and `assets` folders; other files in the directory are not uploaded. Packages are limited to 64 files of at most 256 KiB each. Skill packages currently support UTF-8 text files. Binary skill assets are not supported yet.

## Push a local agent session

Use `type-cli sessions push` to move a local Claude or Codex session, or another agent's transcript, into Type.

Choose exactly one push source: use `--current` to discover the active provider session, or use `--file <path>` to push a specific file. The CLI rejects commands that pass both.

```sh
type-cli sessions push --from claude --current --space engineering
```

```sh
type-cli sessions push --from codex --current --space engineering
```

You can also push a specific Claude or Codex session log. The CLI recognizes these JSONL logs, so `--from` is optional:

```sh
type-cli sessions push --file ~/.codex/sessions/2026/10/22/rollout-2026-10-22T01-39-42-<thread-id>.jsonl --space engineering
```

Type creates a new thread and returns the thread URL. A Claude or Codex session log becomes a turn-by-turn thread with its tool calls, so you can continue the work on type.com. Any other file, such as a Markdown export or another agent's transcript, becomes a single message of at most 256 KB. Push the session log itself rather than an exported copy.

Before uploading a session log, the CLI keeps only user and assistant messages, tool calls, and tool results, and shortens long tool output. It drops reasoning, system and developer instructions, environment context, and images. Tool results can still contain data the session read, so preview the upload with `--dry-run` when that matters.

`sessions push` always starts a **new** thread. To post into a thread that already exists in Type, including one created by an earlier push, use [`threads reply`](#reply-in-a-thread-and-mention-teammates) with the thread ID from the push result; it can also @mention teammates. Push once to hand the conversation over, then reply as the work progresses.

Add a title:

```sh
type-cli sessions push --from codex --current --space engineering --title "Checkout bug investigation"
```

Make the thread private so only you can see it:

```sh
type-cli sessions push --from claude --current --space engineering --private
```

A private thread, including every message in it, is visible only to you. You can make it public later from Type; a public thread can't be made private. If the transcript starts with an assistant message (for example after `--tail`), Type adds a short opening message from you so the thread has an owner. If the server doesn't support private pushes yet, the command fails with an `unavailable` error and no thread is created.

File attachments and redaction are not supported yet. If you pass `--include-files` or `--redact`, the CLI returns an unsupported error instead of silently ignoring it.

Preview what will be uploaded:

```sh
type-cli sessions push --from codex --current --space engineering --dry-run
```

A session can be imported when it is at most 8 MB after the CLI removes the records above and has at most 2,000 messages. If a longer session exceeds either limit, push the newest complete records that fit:

```sh
type-cli sessions push --from codex --current --space engineering --tail
```

If your agent's approval or sandbox review blocks the push, approve the command or run it yourself in a terminal. Outside the agent session, `--current` cannot find the session, so pass its log with `--file`: Codex logs are under `~/.codex/sessions/` and Claude logs under `~/.claude/projects/`.

## Report bugs and request features

Agents report Type bugs, limitations, and missing capabilities to Type support as soon as they run into them. This is a standing authorization: agents should not wait for a request, ask for approval, or ask the person to file the report. Reports go straight to the Type product team.

```sh
type-cli feedback submit --kind bug --title "App preview timed out" \
  --description "While checking the app, the preview failed to load after preparation completed." \
  --json --no-input

type-cli feedback submit --kind feature_request --title "Export automation history" \
  --description "Needed a CSV of the last 30 days of runs to share with finance; there is no export command." \
  --json --no-input
```

### When to report

- **Bugs** (`--kind bug`): a Type command, tool, API, or page errors, returns wrong data, hangs, or contradicts its documentation.
- **Feature requests** (`--kind feature_request`): the task needs a capability Type does not have, such as a missing command, flag, filter, integration operation, or export.

Agents skip their own mistakes (fix and retry instead), expected permission or plan outcomes, and third-party outages that Type handles correctly. They submit one report per distinct problem per session.

### What to include

Use a one-line title that names the symptom or need. In the description, cover what you were trying to do, what you ran, what happened (with the exact error), what you expected or need, and the impact on the task, including any workaround. For CLI problems, add the `type-cli version` output. Leave out credentials, personal data, and other sensitive task content; summarize and redact instead of pasting raw logs.

### Command details

- Use exactly one of `--description` or `--file`; `--file -` reads piped stdin. Agents should pass reports inline with `--description` so the full text is visible before it is sent. Inside Claude Code (`CLAUDECODE=1`), the CLI refuses `--file`.
- Titles accept 1–200 characters and descriptions accept 1–10,000 characters.
- Reports are submitted immediately. There is no confirmation step or `--yes` flag, and `type-cli install-agent-skills` adds a Claude Code allow rule for `type-cli feedback submit`.
- A normal `type-cli auth login` session is required. Read-only signup credentials cannot submit.
- Type attaches the authenticated user and selected organization on the server; the report should describe the agent's own observation or need.
- JSON success includes `ok: true`, `operation: "feedback.submit"`, `kind`, and the support `threadId`. Agents mention the `threadId` to the person in one line and continue the task.
- Do not automatically retry a timeout or uncertain submission, because the original report may already exist.

Managed Type agents use the built-in `report_product_feedback` tool with the same fields and authorization. Hosted Type MCP does not expose feedback submission.

## Use the CLI from local agents

Local agents can call the same commands people use. For reliable agent workflows, use `--json` and `--no-input`:

```sh
type-cli skills sync ./skills/pr-review --space engineering --json --no-input
```

For retrieval tasks, use a discovery-then-hydration sequence:

```sh
type-cli search "checkout regression" --types threads,messages,docs --json --no-input
type-cli threads batch thread_123 thread_456 --json --no-input
```

Do not answer from a search snippet when the thread body is material to the answer. Use `threads batch` for several candidates, `threads get` for one candidate, and follow `nextCursor` when the response is truncated.

In JSON mode, stdout contains one JSON object. Progress and warnings are written to stderr so the response stays parseable.

Successful skill sync responses include a `results` array. Read each result's `skill.id`, `skill.url`, and `target.scope` and `target.space` when present.

If the CLI needs a decision and `--no-input` is set, it fails with a structured error instead of prompting.

## Resource references

Commands accept stable IDs and handles.

| Resource | Accepted references |
| --- | --- |
| Skill | `skill_...`, skill handle |
| Workspace | workspace slug, organization ID |
| Space | `ch_...`, Space slug, exact name; use `--space` for document, skill, and session targets |
| Channel | channel ID, channel slug, exact name within the Space |

Use IDs in scripts and agent workflows. Handles are easier for humans but can become ambiguous.

## Files and secrets

The CLI never uploads known secret files by default. It excludes files such as `.env`, private keys, local credential stores, `node_modules`, and `.git`.

Use `--dry-run` before large session pushes to review what will be sent to Type.

## Common commands

| Task | Command |
| --- | --- |
| Sign in | `type-cli auth login` |
| Check session | `type-cli auth status` |
| Report a Type bug | `type-cli feedback submit --kind bug --title "Short summary" --file ./report.md --json --no-input` |
| List workspaces | `type-cli orgs list` |
| Set active workspace | `type-cli orgs use acme` |
| List agents | `type-cli agents list` |
| Search workspace content | `type-cli search "launch plan" --json` |
| List newest workspace threads | `type-cli threads recent --sort created --json` |
| List threads in a Space | `type-cli threads list --space ch_123 --json` |
| Find threads awaiting a human answer | `type-cli threads recent --waiting-on-input --json` |
| Read one thread | `type-cli threads get thread_123 --json` |
| Read candidate threads | `type-cli threads batch thread_123 thread_456 --json` |
| Start an agent task in a Space | `type-cli threads create --space engineering --message "Summarize the release" --json` |
| Observe an agent task | `type-cli threads watch thread_123 --json` |
| Inspect pending input | `type-cli approvals list --thread thread_123 --json` |
| Upload a task input | `type-cli files upload ./input.csv --space engineering --json` |
| Reply in a thread and mention a teammate | `type-cli threads reply thread_123 --message "@Jane Doe please review" --json` |
| List Spaces | `type-cli spaces list` |
| List channels | `type-cli channels list --space operations` |
| List scheduled actions | `type-cli scheduled-actions list --space operations` |
| Test an automation's instructions | `type-cli scheduled-actions test atask_123 --space operations --follow` |
| Deploy a code automation folder | `type-cli automations deploy ./release-updates --space operations` |
| Test saved automation code with a fixture | `type-cli automations test-code atask_123 --space operations --arguments-file ./fixture.json` |
| Open an automation as an artifact | `type-cli scheduled-actions open atask_123 --space operations` |
| List synced events | `type-cli synced-events list --space operations` |
| Discover Slack channels | `type-cli slack channels` |
| List Type Apps | `type-cli app ls` |
| Create a Type App checkout | `type-cli app create ./my-app --space operations` |
| Pull a Type App checkout | `type-cli app pull wart_123 --into ./my-app` |
| Run a Type App locally | `type-cli app dev --no-open` |
| Create an update draft | `type-cli app push` |
| Publish an approved update | `type-cli app publish --yes` |
| Discover app integration operations | `type-cli app integrations list --connection orgint_123 --json` |
| Add an interactive app capability | `type-cli app integrations add --connection orgint_123 --kind interactive --operation <operation-id> --alias lookup` |
| Rename a Type App | `type-cli app rename wart_123 "New title"` |
| Archive an approved Type App | `type-cli app archive wart_123 --yes` |
| Inspect app access | `type-cli app access` |
| Read app backend logs | `type-cli app logs` |
| List documents | `type-cli documents list` |
| Create a document | `type-cli documents push --file ./doc.md --title "Title" --space engineering` |
| Sync a maintained document | `type-cli documents sync --file ./doc.md --title "Title" --space engineering` |
| Pull a document | `type-cli documents pull wart_123 --file ./doc.md` |
| Browse public library skills | `type-cli skills discover` |
| Search public library skills | `type-cli skills discover "conversion" --json` |
| List workspace skills | `type-cli skills list --global` |
| Sync a skill | `type-cli skills sync ./skill --space engineering` |
| Preview skill sync | `type-cli skills sync ./skill --space engineering --dry-run` |
| Push a transcript | `type-cli sessions push --file ./session.jsonl --space engineering` |
| Push current Claude session | `type-cli sessions push --from claude --current --space engineering` |
| Push current Codex session | `type-cli sessions push --from codex --current --space engineering` |
| Push a private thread | `type-cli sessions push --from claude --current --space engineering --private` |
| Install shell command | `type-cli install-shell --yes` |
| Show CLI version | `type-cli version` |
| Update standalone CLI | `type-cli update` |

## Troubleshooting

If `type-cli` is not available in your shell, rerun `type-cli install-shell --yes`, then restart your shell. You can always invoke the bundled desktop binary directly:

```sh
/Applications/Type.app/Contents/Resources/bin/type-cli auth status
```

If `type-cli` is not found, reinstall the CLI from the Type desktop app or add the standalone binary to your shell path.

If a command says you are not signed in, run:

```sh
type-cli auth login
```

If a command cannot find a Space, list accessible Spaces and use its stable ID:

```sh
type-cli spaces list --json
type-cli skills sync ./skill --space ch_123
```

For documents, use the document ID from `type-cli documents list`. Document IDs usually start with `wart_`.

If `install-shell` needs to write somewhere other than `/usr/local/bin` or `~/.local/bin`, pass an explicit install directory:

```sh
type-cli install-shell --install-dir "$HOME/bin" --yes
```

If the install target already exists and is not the current Type CLI symlink, replace it explicitly:

```sh
type-cli install-shell --force --yes
```

If a local agent cannot answer an interactive prompt, rerun the command with `--json --no-input` and use the structured error to decide the next step.

Webhook `synced-events send` accepts `--timeout 5..300` (seconds, default 30).
A `delivery_timeout` leaves delivery unconfirmed: inspect the destination Space
before retrying, because the original event may already have been received.

## Cadence backoff for code automations

For a backoff overview and a link to the scheduling guide, run `type-cli automations deploy --help`.

Recurring subscriptions accept this stepped schedule:

```json
{
  "kind": "stepped",
  "steps": [
    { "everySeconds": 60, "forSeconds": 3600 },
    { "everySeconds": 600, "forSeconds": 3600 },
    { "everySeconds": 3600, "forSeconds": 21600 },
    { "everySeconds": 86400 }
  ]
}
```

Set this as `deployment.subscriptions.<id>.source.schedule` inside `automation({ ... })`
and deploy the folder with `type-cli automations deploy ./monitor --space operations --expires-in 4d`.
For an existing automation, edit its definition and redeploy the same bound project.
Chat authoring uses the same recurring subscription contract. Legacy `--every`
schedules retain fixed cadence.

The first run is one interval after activation. Durations and intervals are positive
whole minutes; each timed step lasts at least one interval, and intervals cannot
decrease. A step includes its endpoint; the next step starts a new interval grid.
Only the final step omits `forSeconds` and continues until automation expiration
by duration, run count, or timestamp. Without expiration it continues indefinitely.
This changes cadence over elapsed time, independently of execution failures.

Pauses include elapsed time. Resuming skips missed occurrences and keeps the original
age; code-only redeploys preserve it too. Changing the schedule starts a new cadence,
without resetting the original expiration deadline or run count.
`scheduled-actions get <id> --space operations --json` exposes `subscriptionNextDueAt`
as ISO timestamps per subscription; paused, archived, and expired schedules have
no next run. The saved next run also appears on the automation's trigger in the web view.

### Recovering agent onboarding

Agents should display the exact returned browser URL before starting a wait and
keep the host's background terminal/task handle until it completes. A tool result
is not a visible link. Signup, login, connections, and saved automation review
links have different purposes; service setup and repair use the generated
`/connect/` page. Scheduled-action creation returns a `userMessage` containing the
saved draft's review link.

Use `auth start --json --no-input` in an agent session. Display
`handoff.message` with its label above the exact URL on its own line, then execute its display action’s `afterDisplay.argv`
with the installed executable in the host's managed background task. Retain its
handle across unrelated conversation and observe completion without asking the
person to say "done". Workspace choices carry their own exact next action;
selection reuses the original browser approval. After a timeout, resume the same
session rather than starting another login. Use `orgs list` for workspace
discovery after login.

`automations connect wait` returns when the person explicitly finishes, all
selected connections are ready, or the session expires. A partial finish returns
`stopReason: "done"`, `allConnected: false`, `missingRoles`, and `nextAction: null`.
Resume the original task, name the missing services briefly, and keep the draft
paused; do not restart waiting after an explicit finish. A timeout with a pending
session requires observing the same session again. Incomplete finished sessions
remain editable; changing selections reopens them.

Connection candidates may share a provider. Give each a distinct `candidateId`;
Type assigns one if omitted. Selection uses `candidateIds`. Legacy `providers`
selection is accepted only when each provider identifies exactly one candidate.
Pin `organizationIntegrationId` to reuse or reconnect a known connection. Existing
Custom APIs can reuse saved nonsecret setup and a documented verification request.
For the automation itself, persist selected accounts using repeatable
`--act-as <connection-id>=<account-id>`; attaching a connection to a Space alone
does not pin an automation's account.

Custom API OAuth client credentials require `oauthClientId` and `oauthTokenUrl`.
Authorization code uses `authScheme: "oauth2_authorization_code"` with
`oauthClientId`, `oauthAuthorizationUrl`, and `oauthTokenUrl`; authorization runs
from the connections page with PKCE. Set `oauthPublicClient: true` only for a
vendor-documented public client. Otherwise enter the client secret in the browser.
Do not substitute bearer authentication when OAuth metadata is missing.
Transient verification failures offer retry using the saved credential; 429
responses respect `Retry-After`. Credentials remain unavailable to the agent.

### Targeted agent discovery

Use `automations schema --command "scheduled-actions create" --kind scheduled --json`
for a complete command entry, schedule schema, and shared permission/lifecycle constraints.
Unknown or capability-disabled commands return `invalid_input`; `--live` still requires
authentication and uses the workspace's enabled capabilities. Without `--command`, discovery
is unchanged. `--kind` continues to select event capabilities and the scheduled patch schema.

Use `integrations available --providers slack,granola --json` for complete matching provider
entries, including scopes and configuration schemas. `selection` reports the requested slugs,
unavailable providers, completeness within that selection, and the full-discovery command.
An unavailable entry is not permission to invent a provider or use a raw OAuth fallback.
Without `--providers`, the full catalog is unchanged.

The bundled `references/handoff.md` is the canonical account-choice, visible-link, and task
observation guide; a public copy is available at `/cli-handoff.md` for hosts without installed
skills. Load workflow references as needed. Reuse verified identity/schema reads only within
an unchanged context, and refresh current resource state before consequential writes.

### Code automation source

Code automations default-export `automation({ deployment, output, stages })` from
`@type-dot-com/sdk/automations`. `output` is the Zod schema for values passed to
`complete` and `blocked`. Each subscription in `deployment.subscriptions` selects
an entry stage. Code stages return `next`, `complete`, or `blocked`; agent stages
declare their output schema and the code stage that receives the accepted result
in `onResult`. Class-based source and separate deployment exports are rejected.
See the [SDK reference](https://docs.type.com/automations/reference/sdk/index.md). Rewrite an existing class project
before deploying or enabling it; inspect its saved source and reconcile prior
side effects first.
