Generates CSV data export files. Triggered when the user asks to "export as CSV", "create a CSV file", "comma-separated values", "CSV export", "CSV dump", "download as CSV", or requests CSV output for tabular data.
Generate clean CSV data exports with proper encoding and formatting.
Before generating output, check that {WORKING_DIR}/.reporting-resolved/brand-config.json exists. If it does not, tell the user: "The branding plugin is required but has not run. Please install the branding plugin and run /reporting-plugins:brand first." Do not produce unbranded output.
If a JSON data file was generated earlier in this session (in output/text/), read it as the canonical data source to ensure cross-format parity. If no prior JSON exists, use data from the conversation context directly.
When both XLSX and CSV are requested: The XLSX must be generated FIRST. Derive the CSV from the same in-memory data used for the XLSX to prevent drift. Do not independently reconstruct the data from conversation context.
Read .reporting-resolved/brand-config.json for number formatting rules and date format.
output/csv/{slug}-{YYYY-MM-DD}-{HHmm}-{xxx}.csv\xEF\xBB\xBF at the start of the file. This ensures Excel opens the file with correct encoding.with open(output_path, "w", encoding="utf-8-sig", newline="") as f:
writer = csv.writer(f, quoting=csv.QUOTE_MINIMAL)
writer.writerow(headers)
writer.writerows(data)
12400000 not $12,400,000). Formatting is the consumer's responsibility.2026-04-04) for machine readability. If the user specifically requests formatted dates, use content.date_format from brand config.0.082 not 8.2%) for raw data. If the user requests formatted output, use 8.2%.,,), not null or N/A.true / false (lowercase).revenue_q1 or Revenue Q1.revenue_usd, growth_pct.