Opens (or creates) a JSONL file at {output_dir}/ai_decisions.jsonl and
returns an AuditLog S3 object that can be passed to
log_ai_decision throughout the pipeline.
Details
If the file already exists it is opened in append mode so that resumed runs continue the same log.
Two behaviours are worth noting:
It accepts
configso methodology metadata flows into every audit record. Whenconfig$methodology$modeis set,log_ai_decisionauto-stamps it on every JSONL record, which makes every logged decision unambiguously attributable to the methodology it was made under. Cross-mode comparison relies on this.Counter state (
n_written) lives in an internal environment so that increments fromlog_ai_decisionmutate correctly across function calls rather than being lost to R's pass-by-value semantics.