# CLI reference

On Windows PowerShell or Command Prompt, replace `reliora` below with `reliora.cmd`. JSON success output uses `{ outputVersion, command, data, warnings }`; JSON errors are written to stderr with `{ outputVersion, command, error }`.

## Workspace and integration

```text
reliora init [--agent <codex|generic>] [--json]
reliora agent status [--json]
reliora agent remove [--json]
reliora agent instructions generic [--json]
```

`init` creates or reuses `.reliora/config.json` and `.reliora/experiences`. Agent instructions are installed only when `--agent` is supplied.

## Templates and records

```text
reliora template [--json]
reliora record <file.json|-> [--json]
reliora show <id> [--json]
```

`template` prints a valid draft. `record -` reads at most 1 MiB from stdin. Record success retains the Part 1 fields `ok`, `contractVersion`, `experienceId`, `title`, `storageId`, and full `experience`, and adds `storage.id` plus `storage.locator`. Similar records appear as `SIMILAR_EXPERIENCE_FOUND` warnings and do not block storage.

`show --json` returns the complete normalized experience and logical locator.

## Search

```text
reliora search <query> [--limit <1-100>] [--project-context <text>] [--json]
```

Default limit is 5. A project-context filter restricts candidates before scoring. Every JSON result includes:

- ID, locator, title, raw `score`, `matchLevel`, actual `scoreBreakdown`, and reasons;
- flat task, context, problem, failed-attempt, solution, causal, applicability, warning, verification, and confidence fields;
- all feedback counters and both lineage arrays;
- the complete nested `experience` for compatibility.

Invalid stored records are skipped and reported in `warnings` rather than hiding valid results.

## List

```text
reliora list [--tag <tag>] [--unused|--reused] [--since <duration-or-date>] [--limit <1-100>] [--sort <recent|used>] [--json]
```

Defaults are `--limit 20 --sort recent`. Tag matching is case-insensitive and exact. `--unused` and `--reused` are mutually exclusive. Applied use means success, partial, or failure. `--since` accepts an ISO date/time or `30m`, `12h`, `7d`, or `2w`, and filters by creation time.

The JSON data contract has `contractVersion`, normalized `appliedFilters`, `totalCount`, `matchedCount`, `returnedCount`, and compact `summaries`. A summary contains the locator, timestamps, context, confidence, all counters, applied-use total, last-use time, and lineage without copying long solution text.

## Stats

```text
reliora stats [--json]
```

Reports total, reused, unused, per-outcome totals, experiences without feedback, average applied uses among reused records, high/low confidence counts, the most reused summary, and up to five recently created summaries. These metrics are computed locally on demand.

## Feedback

```text
reliora feedback <id> (--outcome <success|partial|failure|not-applicable|outdated>|--success|--failure) [--impact <low|medium|high>] [--notes <text>] [--json]
```

Choose exactly one outcome source. `--success` and `--failure` are compatibility aliases. Notes must be non-empty, are limited to 500 characters, and pass the same common-secret screening as experience content. The JSON response includes the locator, selected outcome, new event, and complete feedback summary.

## General

```text
reliora <command> --help
reliora help <command>
reliora --version
```

Unknown flags and invalid positional counts are rejected. Exit codes are `0` success, `1` command/workspace/identifier error, `2` invalid or oversized data, and `3` possible secret.
