Export Final
export_finalExports a validated batch transactionally: verifies the receipt and re-validates inputs, writes final QA/Cloze CSV files and manifest under one deck lock, and rolls back on failure.
Instructions
Final transactional export of a validated batch; the SOLE writer of the final CSV files and of the Manifesto post-export. Requires the content_hash returned by pipeline_gate_check / validate_batch on PASS. Order: receipt check and full re-validation (read-only) → under one deck lock: ID checks, staged writes, replace, manifesto save; any failure rolls files back. Re-running with the same receipt on an exported batch returns ALREADY_EXPORTED and writes nothing. Parameters: deck_dir; batch_id; qa_csv; cloze_csv; receipt_hash; new_ids_json (JSON array of {id, batch, type, status, topic, anchor}); new_topics_json (JSON array of strings); changelog_json (JSON array of changelog objects); topic_slug (optional, e.g. 'EscleroseMultipla'); write_to_deck_root (also copy into the deck root, default True). Writes: deck_dir/exports/{batch_id}[_{topic_slug}]_QA.csv and _Cloze.csv.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"deck_dir": "<deck_dir>",
"batch_id": "<batch_id>",
"qa_csv": "<qa_csv>",
"cloze_csv": "<cloze_csv>",
"receipt_hash": "<receipt_hash>"
},
"name": "export_final"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| qa_csv | Yes | ||
| batch_id | Yes | ||
| deck_dir | Yes | ||
| cloze_csv | Yes | ||
| topic_slug | No | ||
| new_ids_json | No | [] | |
| receipt_hash | Yes | ||
| changelog_json | No | [] | |
| new_topics_json | No | [] | |
| write_to_deck_root | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||