> For the complete documentation index, see [llms.txt](https://docs.khotan.com/llms.txt). A markdown version of any page is available at its `index.md` URL.

# Projects

Use the `khotan` CLI to operate Khotan projects. Add `--json` for machine-readable output; results go to stdout, diagnostics to stderr.

## Commands

### khotan projects attach

Usage: `khotan projects attach <projectId> --resource-kind <string> --resource-id <string>`

Attach an app, pipeline, or database. A resource belongs to at most one project.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--resource-kind` — One of: app, pipeline, database. (required, body)
- `--resource-id` — The resource id. (required, body)

### khotan projects create

Usage: `khotan projects create --name <string> [--slug <string>] [--description <string>]`

Create a project and its root goal node. The slug is derived from the name when omitted.

Arguments & options:
- `--name` — Display name for the project. (required, body)
- `--slug` — Stable identifier; derived from the name when omitted. (optional, body)
- `--description` — Short summary shown in listings. (optional, body)

### khotan projects delete

Usage: `khotan projects delete <projectId>`

Soft-delete a project and free its slug. The linked tracker project is retained as the record of work done.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan projects detach

Usage: `khotan projects detach <projectId> --resource-kind <string> --resource-id <string>`

Remove the membership. The underlying resource is untouched.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--resource-kind` — One of: app, pipeline, database. (required, body)
- `--resource-id` — The resource id. (required, body)

### khotan projects get

Usage: `khotan projects get <projectId>`

Fetch one project by id or slug.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)

### khotan projects linear bind

Usage: `khotan projects linear bind <projectId> --linear-project-id <string>`

Bind this project to an existing Linear project. A new project mints its own on first push.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--linear-project-id` — The Linear project id to bind. (required, body)

### khotan projects linear options

Usage: `khotan projects linear options [--query <string>]`

List Linear projects this workspace can bind a Khotan project to.

Arguments & options:
- `--query` — Filter Linear projects by name. (optional, query)

### khotan projects list

Usage: `khotan projects list`

List the workspace's projects with their current spec revision and resource count.

### khotan projects members

Usage: `khotan projects members <projectId>`

List the apps, pipelines, and databases attached to a project.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)

### khotan projects metrics delete

Usage: `khotan projects metrics delete <projectId> <metricKey>`

Permanently delete a metric and all of its points.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `<metricKey>` — The metric key. (required, path)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan projects metrics get

Usage: `khotan projects metrics get <projectId> <metricKey> [--range <string>]`

Read one metric's points over a range, with the range value, the preceding range's value, and the change.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `<metricKey>` — The metric key. (required, path)
- `--range` — One of: 7d, 30d, 90d. Defaults to 30d. (optional, query)

### khotan projects metrics list

Usage: `khotan projects metrics list <projectId>`

List a project's metrics with their attributes, curation, and last-reported time.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)

### khotan projects metrics report

Usage: `khotan projects metrics report <projectId> --metrics <json>`

Create or update metrics and set their points. Idempotent: points are keyed by bucket, category, or point id, so a retried report never double-counts. Curation made in Khotan is never overwritten.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--metrics` — Array of metrics: { key, shape (series, breakdown, scatter), unit, goal, aggregate, grain, name?, description?, points }. At most 50 metrics and 10,000 points. (required, body)

### khotan projects metrics update

Usage: `khotan projects metrics update <projectId> <metricKey> [--display-name <string>] [--position <number>] [--hidden] [--headline]`

Change a metric's display name, position, hidden flag, or headline flag. A project has at most three headline metrics.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `<metricKey>` — The metric key. (required, path)
- `--display-name` — Curated name. Null clears it. (optional, body)
- `--position` — Sort position, ascending. (optional, body)
- `--hidden` — Hide the metric from readers. Clears headline. (optional, body)
- `--headline` — Lead the Metrics tab and the project card. Not available for scatter metrics. (optional, body)

### khotan projects node create

Usage: `khotan projects node create <projectId> --parent-id <string> --title <string> [--body <string>] [--position <number>]`

Create a child under an existing spec node — a delivery phase under Milestones, or an item under a phase.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--parent-id` — The parent node id. (required, body)
- `--title` — Display title for the node. (required, body)
- `--body` — Initial body. Empty when omitted. (optional, body)
- `--position` — Sibling position. Appended when omitted. (optional, body)

### khotan projects node delete

Usage: `khotan projects node delete <projectId> <nodeId>`

Soft-delete a spec node and its descendants. The goal node cannot be deleted.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `<nodeId>` — The spec node id. (required, path)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan projects node update

Usage: `khotan projects node update <projectId> <nodeId> [--title <string>] [--position <number>] [--parent-id <string>] [--start-date <string>] [--target-date <string>] [--depends-on-node-id <string>]`

Update a node's title, sibling position, parent, or milestone plan dates.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `<nodeId>` — The spec node id. (required, path)
- `--title` — Display title for the node. (optional, body)
- `--position` — Sibling position. (optional, body)
- `--parent-id` — Move the node under this parent. (optional, body)
- `--start-date` — Milestone plan start (YYYY-MM-DD). Only valid on a phase. (optional, body)
- `--target-date` — Milestone plan target (YYYY-MM-DD). Only valid on a phase. (optional, body)
- `--depends-on-node-id` — Milestone this phase waits on. Only valid on a phase. (optional, body)

### khotan projects revision

Usage: `khotan projects revision <projectId> <revision>`

Fetch one committed revision with its per-document diff and the cause/effect provenance edges attached to it.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `<revision>` — The revision number. (required, path)

### khotan projects revisions

Usage: `khotan projects revisions <projectId> [--limit <number>]`

List committed spec revisions newest-first, with actor, timestamp, and change summary.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--limit` — Maximum revisions to return (1-200). (optional, query)

### khotan projects spec

Usage: `khotan projects spec <projectId> [--altitude <string>]`

Read the spec tree at one altitude: high renders the goal, medium adds phases, low adds items and their mirrored tracker issues.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--altitude` — One of: high, medium, low. (optional, query)

### khotan projects update

Usage: `khotan projects update <projectId> [--name <string>] [--description <string>] [--lifecycle <string>] [--tags <a,b>]`

Update a project's name, description, lifecycle, or tags. Archive with lifecycle archived. An omitted field stays unchanged.

Arguments & options:
- `<projectId>` — The project id or slug. (required, path)
- `--name` — Display name for the project. (optional, body)
- `--description` — Short summary shown in listings. (optional, body)
- `--lifecycle` — One of: active, archived. (optional, body)
- `--tags` — Full tag list, comma-separated or repeatable; it replaces the stored list, and an empty value clears it. The server lowercases each tag and turns spaces into hyphens. Up to 10 tags of 1-32 lowercase letters, digits, or single hyphens. (optional, body)

<!-- generated from khotan catalog v2026-10-30 (adapter 0.10.0); do not edit by hand -->
