amos f611da1e57 Batch 24: add 23 calibrated tasks written from Bos seed directions
Batch 24 (20261102-C-bos-seed-24) screened all 3078 Bos seed queries.
Only 23 themes were in scope (pure user-space reliability, at most one
task per theme); the rest were single operations or explanations,
installs and networking, system administration, ROS2, board-only or GUI
requests. Two finished drafts were withdrawn as too close to existing
tasks. Seeds supply direction only: all sources, contracts and tests are
new, and no task shares more than 14 characters with its seed text.

Each task passed the local gate and the trace6 Docker gate (5 runs per
sample class). Claude rebuilt the catalog from the calibration receipts:
23/23 USABLE. 16 of 23 are C/C++.

Only the task directories are taken; the batch worktree's lowered disk
floor in rollout/core.py stays out of main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:21:50 +08:00

58 lines
1.8 KiB
Python

"""Stable, human-auditable JSON decision journal."""
from decimal_units import format_energy
from dispatch_decisions import decision_events
ROW_ENERGY = ('demand', 'solar', 'pv_to_load', 'pv_to_battery', 'pv_spill',
'battery_to_load', 'grid_to_load', 'generator_to_load', 'unmet', 'soc_before', 'soc_after', 'fuel_before', 'fuel_after')
TOTAL_ENERGY = ('demand', 'solar', 'charged', 'discharged', 'grid', 'unmet',
'spilled', 'final_soc', 'generator', 'final_fuel')
def row_values(record):
action = record.actions
inputs = record.inputs
return {'demand': inputs.demand,
'solar': inputs.solar,
'pv_to_load': action.pv_to_load,
'pv_to_battery': action.pv_to_battery,
'pv_spill': action.pv_spill,
'battery_to_load': action.battery_to_load,
'grid_to_load': action.grid_to_load,
'generator_to_load': action.generator_to_load,
'unmet': action.unmet,
'soc_before': inputs.soc,
'soc_after': action.soc_after,
'fuel_before': inputs.fuel,
'fuel_after': action.fuel_after}
def render_row(record):
period = record.period
values = row_values(record)
result = {'index': record.index,
'id': period.identifier,
'minute': period.minute,
'duration_min': period.duration,
'mode': record.actions.mode}
for key in ROW_ENERGY:
result[key] = format_energy(values[key])
result['events'] = decision_events(record)
return result
def render_totals(ledger):
values = ledger.totals()
return {name: format_energy(values[name]) for name in TOTAL_ENERGY}
def render(ledger):
return {'rows': [render_row(row) for row in ledger.rows],
'totals': render_totals(ledger)}