Deterministic replay in CI

SectionMuse Code
Time to complete~20 min
Modelmuse-spark
HarnessMuse Code (the muse CLI)

Summary

This recipe shows how to turn recorded Muse Code events into a focused golden fixture and replay its model-context projection in CI. The check runs offline and blocks a merge when Muse Code reconstructs the committed events differently.

Muse Code journals each session to an append-only event log. A golden fixture keeps the relevant run events and the model context they should produce. muse trace inspect runs those events through Muse Code's projection code and reports any mismatch. It does not call a model, run a tool, or use the network.

The screenshot is from an actual Muse Code run, so your live result may differ. Fixture replay is deterministic: the same records and Muse Code revision produce the same report.

When To Use Replay

  • You changed Muse Code's event decoding or model-context projection and need a regression check.
  • You want a regression test that runs offline, with no model provider, no shell, and no network.
  • You changed an event schema and need to verify that committed fixtures still replay.

Replay answers one question: do these committed events still reconstruct the expected model-visible context?

Understand The Replay Contract

A golden trace is a set of committed event-log records plus the expected projection those records reduce to. Replay reconstructs the projection from the records alone and compares it to the expectation. Nothing calls a model, a tool, or the network.