# amfelt advise

Profile source tables and generate PCF configuration recommendations.

Profiles each table in an ODCS contract against the source database and calls
the Claude API to generate a recommended PCF "tables:" configuration block.

The profiler collects aggregate statistics (row count, null rate, distinct
count, min/max for temporal columns) and computes heuristic signals
(unique_identifier, temporal, event_date_candidate, always_null, etc.) entirely
in Go — no raw data values are sent to the LLM.

Requires ANTHROPIC_API_KEY to be set in the environment.

## Usage

```text
amfelt advise [flags]
```

## Examples

```text
advise --contract contracts/sales.odcs.yaml --source-url
postgres://user:pass@localhost:5432/sales --namespace public

Profiles the sales contract and prints recommended PCF YAML with token usage.
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--apply` | `bool` | `false` | Write the recommended tables: block into the PCF (requires `--path`) |
| `-c`, `--contract` | `string` | — | path to the ODCS contract file to deploy |
| `--mode` | `string` | — | Advisor mode: api (default) or direct (overrides advisor.mode in the agent's config.yaml) |
| `--model` | `string` | `claude-sonnet-4-6` | Claude model to use (direct mode only) |
| `--namespace` | `string` | — | source namespace to interact with (comma-separated for multi-schema; 'all' for all schemas) |
| `--path` | `string` | `amfelt.yaml` | path of the Amfelt project file |
| `--save-profile` | `bool` | `false` | Save data profile as `<contract>`.profile.yaml next to the contract file |
| `--show-tokens` | `bool` | `true` | Print token usage after the call |
| `--source-url` | `string` | — | connection URL for the source database plugin (e.g. postgres://user:pass@host:5432/db) |
{.clidoc-flags-table}

## Global flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--amfelt-dir` | `string` | `.amfelt` | directory for workspace files (such as plugins); does not move agent identity (controlled by AMFELT_DIR) |
| `--config` | `string` | — | directory or filename of the application configuration |
| `-f`, `--format` | `string` | `default` | log format to use; either default, pretty, or json |
| `-l`, `--level` | `string` | `info` | minimum log level to display; either error, warn, info, or debug |
| `-v`, `--verbose` | `bool` | `false` | trigger to use verbose logging |
{.clidoc-flags-table}

---

Generated from `amfelt` v5.6.3.
