Skip to content

skill: add demo simulation triggers to four bundled skills#165

Merged
AdeGneus merged 3 commits into
mainfrom
feat/demo-skill-triggers
Jun 16, 2026
Merged

skill: add demo simulation triggers to four bundled skills#165
AdeGneus merged 3 commits into
mainfrom
feat/demo-skill-triggers

Conversation

@AdeGneus

@AdeGneus AdeGneus commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

The demo-simulation package (ori-energy repo) proves the Ori runtime decision stack by evaluating simulated Lagos building sensor readings through ori.integration. The four bundled energy skills were missing triggers needed to cover all seven demo scenarios, so the demo was shipping a temporary ori-energy-demo skill YAML. This PR adds those triggers to the correct first-party skills so the demo can run against the real bundled stack with skills_root=None — removing the demo-specific skill entirely.

Scenario → skill mapping after this PR:

Scenario Skill Trigger Tier
Dangerous overcurrent energy-anomaly-detector dangerous_overcurrent (fixed) D
Voltage spike energy-anomaly-detector voltage_overvoltage (new) D
PHCN restoration energy-anomaly-detector grid_phcn_restored (new) B
Battery protection battery-lifecycle-observer battery_emergency_cutoff (new) D
Solar degradation solar-performance-monitor solar_output_degraded (new) A
Compressor fault hvac-refrigerant-monitor compressor_overload (new) C
Emergency circuit cutoff energy-anomaly-detector dangerous_overcurrent (fixed) D

Type of change

  • skill — new or updated bundled skill

Checklist

Required for all PRs

  • pytest tests/ -v passes with 0 failures
  • ruff check --fix ori/ tests/ skills/ is clean
  • Every new .py file has the Apache-2.0 license header
  • If capability behavior changed, docs/CAPABILITY_MATRIX.md is updated in this PR
  • If capability-impacting files changed but matrix update is intentionally not needed, add [skip-cap-matrix] in PR body with rationale
  • PR description explains why, not just what

If you used AI assistance

  • I can explain every line of AI-generated code in this PR
  • I have read and understood all files I am modifying
  • I am not submitting code I cannot defend in a review conversation

If this adds or modifies a bundled skill (/skills/)

  • action_tier is declared on every trigger
  • bypass_llm: true is only paired with action_tier: D
  • Tier C triggers declare requires_approval: true (compressor_overload)
  • No hooks.py changes — skill YAML only
  • No subprocess calls

Related issue

No issue opened — these triggers are the direct complement to the ori-energy demo simulation refactor (feat/demo-api-sim-structure-cleanup) and contain no novel capability decisions. All trigger semantics were validated against the simulator before this PR.

Testing notes

Triggers were validated against the demo-simulation physics engine. Each trigger condition was tested by copying the updated YAMLs into the local venv and running the full 131-test suite. Key guard rationale:

  • phcn_restore_active: 0 default — prevents grid_phcn_restored from firing on deployments without live hook context (hooks inject 1 when load is confirmed on generator)
  • compressor_fault_active: 0 default — prevents compressor_overload from firing until a technician commissions the baseline_current at the site
  • battery_emergency_cutoff Tier D bypass_llm: true — matches the same safety invariant as dangerous_overcurrent; no LLM delay is acceptable at <5% SOC with load drawing down

The demo-simulation package proves the Ori runtime decision stack by
evaluating simulated Lagos building sensor readings through ori.integration.
The four bundled energy skills were missing the triggers needed to cover all
seven demo scenarios, so the demo had to ship its own temporary skill YAML.

This commit adds those triggers to the correct first-party skills so the demo
can run against the real bundled stack with skills_root=None:

energy-anomaly-detector:
- Fix dangerous_overcurrent condition: add sensor_type guard so voltage and
  other non-current readings cannot false-fire the Tier D path
- Add voltage_overvoltage (Tier D) for grid overvoltage events (>260V)
- Add grid_phcn_restored (Tier B) for grid restoration detection;
  phcn_restore_active flag defaults to 0 and is injected by hooks when load
  is on generator, preventing false fires on deployments without live context

battery-lifecycle-observer:
- Add battery_emergency_cutoff (Tier D) for critical SOC (<5%); covers
  sensor_type='battery' (simulation), Growatt, Victron, and hook-derived
  is_soc_sensor so the same trigger works across all supported inverters

hvac-refrigerant-monitor:
- Add compressor_overload (Tier C, requires_approval) for overcurrent against
  a commissioning-measured baseline; compressor_fault_active flag defaults to
  0 and is set by hooks after the technician records the baseline draw

solar-performance-monitor:
- Add solar_output_degraded (Tier A) using performance_ratio forwarded from
  reading metadata; expected_output_watts defaults to 0.0 to suppress
  night-time firing without a live StateStore
@AdeGneus AdeGneus self-assigned this Jun 16, 2026
AdeGneus added 2 commits June 16, 2026 16:52
Five tests hardcoded trigger counts and condition strings that no longer
match after the demo simulation triggers were added in the previous commit.

- test_battery_lifecycle_skill: 3 → 4 triggers; tiers now {"A", "D"}
- test_energy_anomaly_skill: 4 → 6 triggers; tiers now {"A", "D", "B"}
- test_hvac_skill: 3 → 4 triggers
- test_solar_performance_skill: 3 → 4 triggers; tier set stays {"A"}
- test_integration_rule_evaluation: update proof_rule_condition string to
  match the sensor_type guard added to dangerous_overcurrent
@AdeGneus AdeGneus merged commit e226afd into main Jun 16, 2026
2 checks passed
@AdeGneus AdeGneus deleted the feat/demo-skill-triggers branch June 16, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant