# GridTwin-HIL

- **Event:** [Meta Global AI Developer Hackathon](https://cerebralvalley.ai/e/meta-ai-developer-hackathon)
- **When:** Oct 26, 12:00 PM – Nov 4, 9:00 PM (EST)
- **Where:** Online
- **Team:** [Sujahath Siddeek](https://cerebralvalley.ai/u/sujahath98)
- **GitHub:** https://github.com/SujahathMSM/gridtwin
- **Demo video:** https://www.youtube.com/watch?v=pywOyFn6CGQ
- **Gallery:** https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2681

Every home battery, solar inverter and EV charger is protected by controller software that must cut power within milliseconds of a fault. Testing that software safely needs hardware-in-the-loop rigs that cost tens of thousands of dollars, so small teams test against mocks and find timing bugs in the field.

GridTwin-HIL turns a $20 STM32 into an emulated lithium battery and BMS that speaks real Modbus RTU and timestamps the controller's safety trip in hardware, to the microsecond. A real Raspberry Pi runs the controller under test. Meta Muse agents then attack it: an attacker (Muse Spark) designs fault scenarios on the real hardware, a judge (Muse Spark Open, open weights, on Baseten) reproduces each failure and finds the minimal failing case, a fixer (Muse Spark) writes the patch, the judge reviews it, and the orchestrator deploys and re-verifies it on the hardware. Each round attacks the controller as patched by the previous one.

Only the hardware decides: a finding without a measured failure is refused in code, the judge can only name a failure its own runs reproduced, and hidden checks the agents never see guard against fixes tuned to the bench.

Results: nearly 300 hardware runs. The agents found and fixed four real safety bugs, including a 503 ms deadline miss hidden behind the fixer's own claim (now about 100 ms worst case). After an outside review we added a fail-safe interlock and attacks on the controller itself (kill, freeze, cut wire). The open-weights judge then approved five patches that still hid a classic watchdog bug, and a hidden hardware check rejected all five: that round is honestly left open. Every run, patch and verdict is logged in the repo, with 46 Python tests and 25 firmware checks in CI.

## More from Meta Global AI Developer Hackathon

- [Siyuan Song](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2678)
- [JSama](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2679)
- [Souldbound](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2680)
- [Nevermind](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2682)
- [XOF](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2683)
- [TrueScene](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2684)

---

Markdown version of https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2681. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
