> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://mammoth.io/docs/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# mammoth ai

> All 5 mammoth ai commands with examples, arguments and confirmation flags: Generate AI-assisted expressions and conditions.

> Generated from mammoth-cli 2.4.2, released 2026-11-02: `mammoth schema list`, `mammoth capability list` and the CLI's own `--help`. Do not edit by hand; run `npm run docs:capabilities`.

Generate AI-assisted expressions and conditions. 5 commands.

Every command also takes the [global flags](https://mammoth.io/docs/build/cli/global-flags/) (`--output`, `--yes`, `--confirm`, `--dry-run`, `--input`, `--profile`, ...), which are not repeated below. `--input` takes a JSON or YAML document of the input fields; `mammoth schema get COMMAND_ID` prints a command's full input schema.

**Confirmation.** Commands marked `--yes --confirm TARGET` or `--yes` always need those flags, even at a terminal: they never prompt. Commands marked "`--yes` or prompt" ask at an interactive terminal (table output, no `--no-input`) and otherwise need `--yes`. `--dry-run` skips confirmation and sends nothing.

## Summary

| Command | What it does | Effect | Confirmation |
|---|---|---|---|
| [`ai condition generate`](#mammoth-ai-condition-generate) | Generate a filter condition from a natural language intent. | Read | — |
| [`ai expression generate`](#mammoth-ai-expression-generate) | Generate a math/metric expression from a natural language intent. | Read | — |
| [`ai retention condition`](#mammoth-ai-retention-condition) | Generate or test a retention-policy WHERE clause for a dataset. | Benign mutation | — |
| [`ai sql generate`](#mammoth-ai-sql-generate) | Generate SQL from a natural language intent. | Read | — |
| [`ai suggestion list`](#mammoth-ai-suggestion-list) | List AI-powered suggestions for the active project. | Read | — |

## ai condition

### mammoth ai condition generate

Generate a filter condition from a natural language intent.

```bash
mammoth ai condition generate 123 --input '{"intent": "Summarize revenue by region"}'
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `DATASET_ID` | positional | yes | — | `int` | ID of the dataset to generate a condition for. |
| `intent` | `--input` field | yes | — | `str` |  |
| `dataview_id` | `--input` field | no | — | `int` |  |
| `sequence_number` | `--input` field | no | — | `int` |  |

- **Effect:** Read, scope `profile` · **Confirmation:** none
- **Preconditions:** Required inputs: DATASET_ID.
- **Id:** `ai.condition.generate` · **Result:** `AiConditionGenerateResult` · **Backed by:** SDK `mammoth.api.ai.AIAPI.condition_generate`, API `POST /workspaces/{workspace_id}/projects/{project_id}/sql_generation/condition` (GenerateCondition)

## ai expression

### mammoth ai expression generate

Generate a math/metric expression from a natural language intent.

```bash
mammoth ai expression generate 123 --input '{"intent": "Summarize revenue by region", "mode": "math"}'
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `DATASET_ID` | positional | yes | — | `int` | ID of the dataset to generate an expression for. |
| `intent` | `--input` field | yes | — | `str` |  |
| `mode` | `--input` field | yes | — | `str` |  |
| `dataview_id` | `--input` field | no | — | `int` |  |
| `sequence_number` | `--input` field | no | — | `int` |  |

- **Effect:** Read, scope `profile` · **Confirmation:** none
- **Preconditions:** Required inputs: DATASET_ID.
- **Id:** `ai.expression.generate` · **Result:** `AiExpressionGenerateResult` · **Backed by:** SDK `mammoth.api.ai.AIAPI.expression_generate`, API `POST /workspaces/{workspace_id}/projects/{project_id}/sql_generation/expression` (GenerateExpression)

## ai retention

### mammoth ai retention condition

Generate or test a retention-policy WHERE clause for a dataset.

```bash
mammoth ai retention condition 123 --input '{"mode": "generate", "intent": "completed payments older than 90 days"}' --project 456
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `DATASET_ID` | positional | yes | — | `int` | ID of the dataset. |
| `mode` | `--input` field | yes | — | `str` |  |
| `intent` | `--input` field | no | — | `str` |  |
| `condition_sql` | `--input` field | no | — | `str` |  |

- **Effect:** Benign mutation, scope `project` · **Confirmation:** none · **Waits:** starts a job; waits or returns it depending on input
- **Preconditions:** Requires explicit project context. Mode generate may return a job-backed result; mode test follows the release response union and must not be assumed to synchronously return row counts.
- **Id:** `ai.retention.condition` · **Result:** `AiRetentionConditionResult` · **Backed by:** SDK `mammoth.api.ai.AIAPI.retention_condition`, API `POST /workspaces/{workspace_id}/projects/{project_id}/sql_generation/retention_policy` (RetentionCondition)

## ai sql

### mammoth ai sql generate

Generate SQL from a natural language intent.

```bash
mammoth ai sql generate 'Summarize revenue by region' --input '{"dataset_id": 456, "dataview_id": 123}'
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `INTENT` | positional | no | — | `str` | Generation intent for the SQL query; or pass it via the 'intent' input field. Or the `intent` input field. |
| `intent` | `--input` field | no | — | `str` |  |
| `sequence_number` | `--input` field | no | `0` | `int` |  |
| `dataset_id` | `--input` field | yes | — | `int` |  |
| `dataview_id` | `--input` field | yes | — | `int` |  |
| `current_query` | `--input` field | no | — | `str` |  |

- **Effect:** Read, scope `profile` · **Confirmation:** none · **Waits:** waits for the job to finish (`--job-timeout`, `--return-running`)
- **Preconditions:** Returns a query and metadata; differs from view transform generate-sql, which adds and executes a pipeline task. Do not infer addon availability from an authorization error.
- **Id:** `ai.sql.generate` · **Result:** `AiSqlGenerateResult` · **Backed by:** SDK `mammoth.api.ai.AIAPI.generate_sql`, API `POST /workspaces/{workspace_id}/projects/{project_id}/sql_generation` (GenerateSql)

## ai suggestion

### mammoth ai suggestion list

List AI-powered suggestions for the active project.

```bash
mammoth ai suggestion list --input '{"suggestion_type": "generate_task", "params": {"prompt": "Filter rows where Price > 100"}, "dataset_id": 456, "dataview_id": 123}'
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `suggestion_type` | `--input` field | no | — | `str` |  |
| `params` | `--input` field | no | — | `dict[str, any]` |  |
| `dataset_id` | `--input` field | no | — | `int` |  |
| `dataview_id` | `--input` field | no | — | `int` |  |

- **Effect:** Read, scope `profile` · **Confirmation:** none · **Waits:** waits for the job to finish (`--job-timeout`, `--return-running`)
- **Preconditions:** Body is the release UnifiedPromptSpec. suggestion_type is one of extract_text, add_condition, generate_task, apply_ai_template, dashboards, derivative_fuzzy_bucket and params follows that type (generate_task {prompt}; add_condition {prompt, sequence_number}; extract_text {column_name, sequence_number, prompt}). dataset_id/dataview_id scope the request.
- **Id:** `ai.suggestion.list` · **Result:** `AiSuggestionListResult` · **Backed by:** SDK `mammoth.api.ai.AIAPI.get_suggestions`, API `POST /workspaces/{workspace_id}/projects/{project_id}/suggestions` (AiSuggestions)

---
Source: https://mammoth.io/docs/build/cli/ai.md · Updated: 2026-11-02
