| { |
| "version": "1.0", |
| "status": "frozen", |
| "frozen_on": "2026-09-14", |
| "changelog": [ |
| "0.2: kept every 0.1 action and rule. Added optional fields, value enums, reason codes for report_error / ask_clarification, and category-to-action compatibility. See configs/rpi5_hardware_facts.json for the hardware facts and policies behind these rules.", |
| "1.0 (2026-09-14): frozen for training. Actions, fields, enums, reason codes and rules are identical to 0.2; sensor_read stays reserved. Changes after this need a new version, regenerated labels and a new dataset release." |
| ], |
| "actions": { |
| "gpio_read": { |
| "description": "Read the digital state of a GPIO pin", |
| "required": [ |
| "pin" |
| ], |
| "optional": [ |
| "parameters" |
| ] |
| }, |
| "gpio_write": { |
| "description": "Set a GPIO output HIGH or LOW", |
| "required": [ |
| "pin", |
| "value" |
| ], |
| "optional": [ |
| "parameters" |
| ] |
| }, |
| "gpio_mode": { |
| "description": "Configure a GPIO pin mode", |
| "required": [ |
| "pin", |
| "mode" |
| ], |
| "optional": [ |
| "parameters" |
| ] |
| }, |
| "gpio_pwm": { |
| "description": "Set PWM output on a supported GPIO", |
| "required": [ |
| "pin", |
| "duty_cycle" |
| ], |
| "optional": [ |
| "parameters" |
| ] |
| }, |
| "gpio_pulse": { |
| "description": "Set a GPIO state for a specified duration", |
| "required": [ |
| "pin", |
| "value", |
| "duration_ms" |
| ], |
| "optional": [] |
| }, |
| "gpio_sequence": { |
| "description": "Perform multiple GPIO operations in sequence", |
| "required": [ |
| "operations" |
| ], |
| "optional": [] |
| }, |
| "sensor_read": { |
| "description": "Read a sensor through the appropriate hardware interface", |
| "required": [ |
| "pin" |
| ], |
| "optional": [ |
| "parameters" |
| ], |
| "status": "reserved: no generated examples yet, because bus-sensor semantics (I2C/SPI/UART addressing) are not finalised" |
| }, |
| "ask_clarification": { |
| "description": "Ask the user for missing information instead of guessing", |
| "required": [], |
| "optional": [ |
| "pin", |
| "parameters" |
| ] |
| }, |
| "report_error": { |
| "description": "Report an invalid or unavailable operation", |
| "required": [], |
| "optional": [ |
| "pin", |
| "parameters" |
| ] |
| }, |
| "wait": { |
| "description": "Wait for a specified duration", |
| "required": [ |
| "duration_ms" |
| ], |
| "optional": [] |
| } |
| }, |
| "fields": { |
| "value": [ |
| "HIGH", |
| "LOW" |
| ], |
| "mode": [ |
| "INPUT", |
| "OUTPUT", |
| "ALT" |
| ], |
| "parameters.pull": [ |
| "UP", |
| "DOWN", |
| "NONE" |
| ], |
| "parameters.drive_strength_ma": [ |
| 2, |
| 4, |
| 8, |
| 12 |
| ], |
| "parameters.pwm_type": [ |
| "hardware", |
| "software" |
| ], |
| "parameters.function": "one key of documented_alt_functions in configs/rpi5_hardware_facts.json (required when mode is ALT)", |
| "parameters.frequency_hz": "positive number (optional, gpio_pwm only)", |
| "parameters.header_pin": "physical header pin number 1-40, present only when the user referred to a physical/header/board pin", |
| "duty_cycle": "number from 0 to 100 inclusive (percent)", |
| "duration_ms": "integer >= 1", |
| "operations": "non-empty list of gpio_read / gpio_write / gpio_mode / gpio_pwm / gpio_pulse / wait actions", |
| "sequence_operation_actions": [ |
| "gpio_read", |
| "gpio_write", |
| "gpio_mode", |
| "gpio_pwm", |
| "gpio_pulse", |
| "wait" |
| ] |
| }, |
| "error_reasons": { |
| "invalid_gpio": "The number is not GPIO0-27, e.g. GPIO28, GPIO999, GPIO -1, or a non-integer.", |
| "reserved_gpio": "GPIO0/GPIO1: exist but are reserved for the ID EEPROM (F-RESERVED-ID-EEPROM).", |
| "not_a_gpio": "A physical header pin that is 3V3, 5V or GND (F-POWER-PINS-NOT-GPIO).", |
| "unsupported_function": "The GPIO exists, but the requested capability is not on that GPIO (F-ALT-TABLE, F-HW-PWM-PINS, F-PULLS, F-DRIVE-STRENGTH, F-INPUT-DIGITAL, F-OUTPUT-LEVELS, F-ONE-FUNCTION).", |
| "unsupported_operation": "Outside the action vocabulary (arbitrary code, bus data transfer, network).", |
| "invalid_parameter": "Parameter outside its logical domain (duty cycle outside 0-100, duration <= 0 or sub-millisecond, frequency <= 0).", |
| "pin_not_available": "Pin is excluded by context.available_pins.", |
| "unsafe_direct_drive": "Driving or powering a motor or other load directly from a GPIO (F-NO-DIRECT-MOTOR).", |
| "unsafe_voltage": "Applying 5 V or higher to a GPIO (F-INPUT-3V3).", |
| "unsafe_current": "Load current far above the documented GPIO current (F-GPIO-CURRENT), or an LED with no current-limiting resistor (F-LED-RESISTOR).", |
| "unsafe_short_circuit": "Driving an output that is wired straight to GND or 3V3 (F-DRIVE-NOT-LIMIT).", |
| "no_hardware_action": "Informational question; no hardware operation is performed (P-QUESTIONS)." |
| }, |
| "clarification_reasons": { |
| "missing_pin": "Device or operation named without a GPIO, and no mapping in context.", |
| "ambiguous_device": "More than one mapped device matches the reference.", |
| "missing_value": "Unclear whether HIGH or LOW is wanted.", |
| "missing_duration": "Timed/repeated operation without a duration.", |
| "missing_duty_cycle": "PWM requested without a duty cycle.", |
| "ambiguous_value": "A value whose unit or scale is ambiguous (e.g. duty 0.5).", |
| "conflicting_instructions": "The request contradicts itself or contradicts context.device_mappings.", |
| "unknown_current_state": "Toggle requested without a known current state." |
| }, |
| "category_actions": { |
| "gpio_basic": [ |
| "gpio_read", |
| "gpio_write" |
| ], |
| "gpio_read": [ |
| "gpio_read" |
| ], |
| "gpio_write": [ |
| "gpio_write" |
| ], |
| "gpio_mode": [ |
| "gpio_mode" |
| ], |
| "gpio_pwm": [ |
| "gpio_pwm" |
| ], |
| "gpio_timing": [ |
| "gpio_pulse", |
| "wait" |
| ], |
| "gpio_sequence": [ |
| "gpio_sequence" |
| ], |
| "sensor": [ |
| "gpio_read", |
| "sensor_read" |
| ], |
| "driver": [ |
| "gpio_write", |
| "gpio_pwm", |
| "gpio_pulse", |
| "gpio_sequence", |
| "gpio_mode" |
| ], |
| "clarification": [ |
| "ask_clarification" |
| ], |
| "error": [ |
| "report_error" |
| ], |
| "safety": [ |
| "report_error" |
| ], |
| "general_hardware": [ |
| "report_error" |
| ] |
| }, |
| "category_reasons": { |
| "safety": [ |
| "unsafe_direct_drive", |
| "unsafe_voltage", |
| "unsafe_current", |
| "unsafe_short_circuit" |
| ], |
| "general_hardware": [ |
| "no_hardware_action" |
| ], |
| "error": [ |
| "invalid_gpio", |
| "reserved_gpio", |
| "not_a_gpio", |
| "unsupported_function", |
| "unsupported_operation", |
| "invalid_parameter", |
| "pin_not_available" |
| ] |
| }, |
| "rules": [ |
| "Never invent a GPIO pin.", |
| "If the required GPIO pin is unknown, use ask_clarification.", |
| "Never invent a device-to-GPIO mapping.", |
| "Invalid GPIO requests must use report_error.", |
| "The LLM must never execute arbitrary code.", |
| "All hardware actions must pass through the deterministic validator.", |
| "GPIO numbering must be explicitly defined by the hardware layer.", |
| "Hardware safety rules override model output.", |
| "A physically valid GPIO is not automatically capable of every function; capabilities are per-pin (RP1 Table 4).", |
| "Never substitute a different GPIO when the requested one cannot perform the operation.", |
| "Unsafe electrical requests are refused with report_error even when the GPIO number is valid." |
| ] |
| } |
|
|