<!-- Generated from the code by `make docs`. Change the code it describes, then run that; an edit here is overwritten. -->

# Command line

Every command of `codna`, the one binary that runs CoDNA and everything around it, with each command's flags.

`codna help` prints this:

```text
codna — company knowledge, organized by AI agents

Usage:
  codna <command> [flags]

Commands:
  serve                 Run the API, MCP endpoint, workers, and web UI
  migrate up            Apply pending database migrations
  migrate down          Roll back the most recent migration
  migrate status        Show applied and pending migrations
  migrate version       Show the version the schema is at
  bootstrap [email]     Create the first person (--sso-only), and a management token (--service-token)
  reindex               Rebuild the search index from Postgres
  ingest <dir>          Bulk-load files into raw: PDFs, Word, HTML, a shared drive
  import <dir>          Read a markdown tree back in, preserving addresses and ids
  export                Write out what one person can read (--as), or everything (--all)
  version               Print version information
  help                  Show this message

Running the instance, as management (each change is audited):
  people list [--all] | create <email> [--name N] [--sso-only]
         | deactivate <who> [--transfer-to <who>] | activate <who>
         | transfer <who> --to <who> | set-password <who> | sign-out <who>
  groups list | create <name> [--slug s] [--description d] | rename <slug> <name>
         | delete <slug> | members <slug> | add <slug> <who>... | remove <slug> <who>...
  tokens list | create <name> [--expires-in-days N] | revoke <id|prefix>
  agents list | create <slug> --name N --subject S [--responsible who,...] [--description d]
         | responsible <slug> <who>... | deactivate <slug> | activate <slug>
         | delete <slug> --transfer-to <who>
                        Agents built elsewhere, connected over MCP as service accounts
  documents find [--owner E] [--shared-with W] [--space S] [--status S] [--quarantined] [--trashed] [--after ID]
         | unshare <id> [--from W] | quarantine <id> --reason R | release <id> [--restore-sharing]
                        Break-glass without reading: by metadata, never by content
  status                How the instance is doing
  usage [--weeks N]     How it is used: people, writing and tool calls by week, and each person
  events dead | events retry <id>
                        What the outbox gave up on, and handing it back
  Passwords come from a prompt, or CODNA_PERSON_PASSWORD. --json prints JSON.

Configuration is read from the environment; see .env.example.
Deployment guides for Compose, Kubernetes, and VMs are in deploy/.
```

Below are each command's flags, as `-h` prints them. A flag can come before or after the arguments: `codna people create dana@acme.test --name Dana`. Every command reads its configuration from the environment; see [Settings](https://codna.me/docs/reference/settings.md).

## serve

No flags.

## migrate

### migrate up

No flags.

### migrate down

No flags.

### migrate status

No flags.

### migrate version

No flags.

## bootstrap

```text
  -service-token
    	also issue a management token, printed once, for running the instance
  -sso-only
    	create the person without a password; they sign in through the identity provider
  -token-name string
    	name for the management token (default "bootstrap")
  -token-scope string
    	scope of that token; "manage" is the only one (default "manage")
```

## reindex

No flags.

## ingest

```text
  -as string
    	email of the account to file the documents under (required)
  -dry-run
    	list what would be imported and stop
  -skip-existing
    	skip files already ingested under the same name
  -user string
    	alias for --as
```

## import

```text
  -as string
    	email of the account to import as (required)
  -dry-run
    	report what would be created and updated, and write nothing
  -space string
    	space for files whose path does not name one
```

## export

```text
  -all
    	export every document, whoever can read it (a backup or a move)
  -as string
    	email of the person to export as
  -include-deleted
    	include tombstoned documents
  -out string
    	directory to write into (default codna-export-<date>)
  -space string
    	comma-separated spaces to include (default all)
  -with-history
    	include every revision
  -with-originals
    	copy ingested source files next to their conversions (default true)
```

## people

### people list

```text
  -all
    	include deactivated people
  -json
    	print JSON
```

### people create

```text
  -json
    	print JSON
  -name string
    	the person's name (default: their email)
  -sso-only
    	no password; they sign in through the identity provider
```

### people deactivate

```text
  -json
    	print JSON
  -transfer-to string
    	then hand their documents and automations to this person
```

### people activate

```text
  -json
    	print JSON
```

### people transfer

```text
  -automations
    	move their automations; they arrive switched off (default true)
  -documents
    	move their documents, trashed ones included (default true)
  -json
    	print JSON
  -to string
    	who receives them (required)
```

### people set-password

```text
  -json
    	print JSON
```

### people sign-out

```text
  -json
    	print JSON
```

## groups

### groups list

```text
  -json
    	print JSON
```

### groups create

```text
  -description string
    	what the group is
  -json
    	print JSON
  -slug string
    	the group's slug (default: from its name)
```

### groups rename

```text
  -json
    	print JSON
```

### groups delete

```text
  -json
    	print JSON
```

### groups members

```text
  -json
    	print JSON
```

### groups add

```text
  -json
    	print JSON
```

### groups remove

```text
  -json
    	print JSON
```

## tokens

### tokens list

```text
  -json
    	print JSON
```

### tokens create

```text
  -expires-in-days int
    	days until it expires (default: never)
  -json
    	print JSON
```

### tokens revoke

```text
  -json
    	print JSON
```

## agents

### agents list

```text
  -json
    	print JSON
```

### agents create

```text
  -description string
    	what it is for
  -json
    	print JSON
  -name string
    	what people call it
  -responsible string
    	who answers for it: emails, comma-separated
  -subject string
    	its service account's subject at the identity provider
```

### agents responsible

```text
  -json
    	print JSON
```

### agents deactivate

```text
  -json
    	print JSON
```

### agents activate

```text
  -json
    	print JSON
```

### agents delete

```text
  -json
    	print JSON
  -transfer-to string
    	who gets the pages it wrote
```

## documents

### documents find

```text
  -after string
    	the next page: the id the previous page ended with
  -json
    	print JSON
  -limit int
    	how many, at most 200 (default 50)
  -owner string
    	the owner's email
  -quarantined
    	only quarantined documents
  -shared-with string
    	"everyone", "group:<slug>", an email, "any" or "none"
  -space string
    	raw, wiki or output
  -status string
    	draft, active or archived
  -trashed
    	only trashed documents
```

### documents unshare

```text
  -from string
    	take only this share away: "everyone", "group:<slug>" or an email
  -json
    	print JSON
```

### documents quarantine

```text
  -json
    	print JSON
  -reason string
    	why: the owner is told (required)
```

### documents release

```text
  -json
    	print JSON
  -restore-sharing
    	give back the shares the quarantine took away
```

## status

```text
  -json
    	print JSON
```

## usage

```text
  -json
    	print JSON
  -weeks int
    	how many weeks, this one included (at most 52) (default 8)
```

## events

### events dead

No flags.

### events retry

No flags.
