CLI
The corec command covers corpus authoring, lifecycle, ingestion, retrieval evaluation, demonstrations, and licensed Enterprise workflows through one command surface.
Command families
Run corec <command> --help for the installed version's exact options. The Enterprise CLI page owns the licensed command reference.
| Command | Purpose | Distribution |
|---|---|---|
| corec init | Create and validate a starter corec.yaml from local documents, CSV, XLSX, or canonical JSONL | Core |
| corec validate | Validate a YAML or JSON corpus configuration | Core |
| corec schema | Print the public configuration schema | Core |
| corec db / tenant | Migrate the control plane and provision tenant state | Core |
| corec apply | Apply an immutable corpus-configuration revision | Core |
| corec source normalize | Normalize configured documents, tabular data, or canonical JSONL | Core |
| corec ingest | Run active chunking and projections for normalized records | Core |
| corec query retrieve | Run a named retrieval plan with principal access and exact filters | Core |
| corec validate-batch | Validate a prepared ingestion request offline | Core |
| corec eval | Evaluate retrieval rankings and generated answers | Core |
| corec demo | Run query-plan, adapter, graph, control-plane, and hosted retrieval demonstrations | Core |
| Licensed command groups | Source analysis, dataset preparation, experiment control, certification, and query routing | Enterprise |
Validate and inspect the configuration
- validate reads configuration and returns a failure exit code for an invalid contract.
- schema emits the machine-readable v1alpha1 configuration schema.
- demo query-plan compares capability-aware physical plans without changing corpus state.
corec validate ./knowledge-operations/corec.yaml
corec schema --output ./corec.schema.json
corec demo query-planInitialize and apply control-plane state
Tenant provisioning yields the UUID used by later operations. Apply returns the corpus UUID. Corpus inspect lists dataset UUIDs. Human-readable slugs and names remain in corec.yaml and cannot replace these runtime IDs. Apply records the actor and an idempotency key so a safe retry cannot create a second configuration revision.
corec db migrate --database-url "$DATABASE_URL"
corec tenant provision \
--database-url "$DATABASE_URL" \
--slug knowledge-ops \
--display-name "Knowledge Operations"
export TENANT_ID=<tenant-uuid-from-output>
corec apply \
--database-url "$DATABASE_URL" \
--tenant-id "$TENANT_ID" \
--actor analyst@example.com \
--idempotency-key knowledge-ops-config-v1 \
./knowledge-operations/corec.yaml
export CORPUS_ID=<corpus-uuid-from-output>
corec corpus inspect \
--database-url "$DATABASE_URL" \
--tenant-id "$TENANT_ID" \
--corpus-id "$CORPUS_ID"
export DATASET_ID=<dataset-uuid-from-output>Normalize and ingest records
Core ingests normalized JSONL through the active configuration. The selected chunker creates fragments before embedding and projection. The receipt records processor and configuration fingerprints.
corec source normalize \
--config ./knowledge-operations/corec.yaml \
--dataset change-records \
--output ./knowledge-operations/records.jsonl
corec ingest \
--database-url "$DATABASE_URL" \
--tenant-id "$TENANT_ID" \
--corpus-id "$CORPUS_ID" \
--dataset-id "$DATASET_ID" \
--actor analyst@example.com \
--idempotency-key change-records-2026-08-26 \
./knowledge-operations/records.jsonlRetrieve live evidence and test access
The Core command executes the applied retrieval plan. The principal and filters are enforced before evidence is returned. Repeat with a principal outside the allow list and confirm that hits is empty. corec query route belongs to the licensed advisory workflow and is not needed to execute Core retrieval.
corec query retrieve \
--database-url "$DATABASE_URL" \
--tenant-id "$TENANT_ID" \
--corpus-id "$CORPUS_ID" \
--plan default \
--principal group:readers \
--query "How is source identity preserved?" \
--filter 'category="provenance"' \
--limit 5Evaluate retrieval and generation
Both commands write machine-readable reports and miss files. The Evaluation guide defines their inputs, metrics, and pass conditions.
corec eval retrieval \
--fragments ./golden/fragments.jsonl \
--judgments ./golden/reviewed.jsonl \
--retrieval-mode hybrid \
--ranked-results ./runs/hybrid/rankings.jsonl \
--projection-receipt ./runs/hybrid/applied-receipt.json \
--limit 50 \
--hit-at-1-target 0.55 \
--output ./runs/hybrid/eval
corec eval generation \
--input ./runs/generation-reviewed.jsonl \
--retrieval-report ./runs/hybrid/eval/report.json \
--gate-policy answer-quality \
--faithfulness-target 0.80 \
--qualified-answer-target 0.80 \
--output ./runs/generationExit behavior and artifacts
- A contract, access, integrity, or quality-gate failure returns a non-zero exit status.
- Derived outputs go to explicit paths; source inputs remain immutable.
- Reports retain corpus configuration, judgment identity, hashes, retrieval mode, and gate decisions.
- Generated golden candidates remain unreviewed until a human promotes them.
- Prepared batches can be checked with corec validate-batch before any network or database write.