> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic CLI Migration

> Move from terminal text scraping to stable JSON commands — agent contract upgrade.

## Old pattern

Do not scrape terminal output:

```bash theme={null}
sf portfolio history | grep ...
```

## New pattern

Use JSON:

```bash theme={null}
sf portfolio history --json --ticks 20 --trades 10 --since 2026-04-23
```

Parse stdout as one JSON document.

## Error handling

Use exit code and JSON error envelope:

```bash theme={null}
sf query x --json
```

returns:

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Query must be at least 2 characters."
  }
}
```

## Discovery

Replace hardcoded command assumptions with:

```bash theme={null}
sf describe --all --json
```
