Drive Move proof surface from runtime ring

This commit is contained in:
Meta Vens 2026-07-08 22:49:42 +01:00
commit 20a296a4a9
7 changed files with 320 additions and 6 deletions

View file

@ -97,6 +97,13 @@ a named invariant that the native runtime cannot protect yet.
and `Mimir.BufferSmoke --move-proof-runtime-frame-smoke` proves the frame is
empty before publish, contains the proof splines after publish, and clears
without leaving a repair loop behind.
- `MimirMoveProofRuntimeDriver` is the bounded runtime bridge from a Muninn
CultMesh shared-memory evidence ring to `MimirRuntime.PublishMoveProofSurface`.
It derives the Mimir evidence, Mimir pose, and Fensalir frame ids from the
actual Muninn frame suffix, calls the shared proof pipeline, and suppresses
duplicate frame admission. `Mimir.BufferSmoke --move-proof-runtime-driver-smoke`
proves `MimirRuntime.Update` can pull one ring frame into the same-sequence
proof chain and visible spline frame.
- `MimirMoveCalibrationProtocol` publishes the typed calibration preflight for
Starfire/Nightwing Moves: required Muninn evidence streams, optional
Quest headset/controller pose witnesses, stillness/sweep/validation phases, and
@ -405,11 +412,11 @@ a named invariant that the native runtime cannot protect yet.
becomes a deterministic timeline anchor before the actuator moves samples.
6. Prove the bioacoustic hybrid fallback through real loopback and microphones
with probe durations long enough to keep loopback and mic windows live.
7. Wire live Move proof production into `MimirRuntime.PublishMoveProofSurface`:
ingest real Muninn Nightwing and Starfire evidence through
`MimirMoveProofPipeline`, require calibrated optical witnesses, publish
`mimir:starfire:move-pose:<sequence>`, and capture a presented Fensalir
frame/probe for the same sequence.
7. Wire real Move proof production into `MimirMoveProofRuntimeDriver`: attach
real Muninn Nightwing and Starfire evidence rings, require calibrated optical
witnesses, publish `mimir:starfire:move-pose:<sequence>` through the shared
runtime path, and capture a presented Fensalir frame/probe for the same
sequence.
8. Bind Fensalir UI to the synchronization hub so buffer depth, stream cadence,
source timestamps, and output settings are visible and adjustable.
9. Implement the Mimir program scene graph as the shared commit primitive for

View file

@ -218,6 +218,13 @@ proof surface: `PublishMoveProofSurface` stores the latest Mimir-owned
`move-proof-*` probe splines into `AquariumFrame.Scene.SplineFrame` beside the
audio spectrum preview. Fensalir renders this frame; it still does not decide
proof.
`MimirMoveProofRuntimeDriver` is the runtime bridge from a Muninn CultMesh
shared-memory evidence ring into that attachment point. It derives the
Mimir evidence, Mimir pose, and Fensalir frame ids from the actual Muninn frame
suffix, calls `MimirMoveProofPipeline`, suppresses duplicate frame admission,
and lets `MimirRuntime.Update` publish the resulting proof surface. This proves
the runtime-owned path for a ring frame; real Nightwing hardware and calibrated
camera witnesses are still the missing field proof.
## Program Composition

View file

@ -3,6 +3,7 @@ using System.Numerics;
using System.Security.Cryptography;
using System.Text.Json;
using Aquarium.Engine;
using Aquarium.Engine.Input;
using GameCult.Caching;
using GameCult.Caching.MessagePack;
using GameCult.Mesh;
@ -153,6 +154,12 @@ if (args.Any(arg => string.Equals(arg, "--move-proof-runtime-frame-smoke", Strin
return RunMoveProofRuntimeFrameSmoke();
}
if (args.Any(arg => string.Equals(arg, "--move-proof-runtime-driver-smoke", StringComparison.OrdinalIgnoreCase)))
{
return RunMoveProofRuntimeDriverSmoke(
ParseStringOption(args, "--native-reservoir", DefaultNativeReservoirPath()));
}
if (args.Any(arg => string.Equals(arg, "--move-calibration-protocol-smoke", StringComparison.OrdinalIgnoreCase)))
{
return await RunMoveCalibrationProtocolSmokeAsync(
@ -2234,7 +2241,7 @@ static int RunMoveProofRuntimeFrameSmoke()
{
var surface = CreateMoveProofSurfaceSmokeDocument();
var runtime = new MimirRuntime(
new AquariumRuntimeOptions(Headless: true, CultCachePath: null),
new AquariumRuntimeOptions(Headless: true, CultCachePath: ""),
new MimirSynchronizationSettings());
var emptyFrame = runtime.Frame;
runtime.PublishMoveProofSurface(surface);
@ -2256,6 +2263,154 @@ static int RunMoveProofRuntimeFrameSmoke()
: 1;
}
static int RunMoveProofRuntimeDriverSmoke(string nativeReservoirPath)
{
if (!File.Exists(nativeReservoirPath))
{
Console.Error.WriteLine($"move-proof-runtime-driver-smoke missing-native path={nativeReservoirPath}");
return 1;
}
const ulong leftWitnessHash = 0x00000000000A11CE;
const ulong rightWitnessHash = 0x0000000000000B0B;
const string observedAt = "2026-06-11T18:30:00.0040000Z";
var streamId = "muninn:nightwing:move-evidence";
var frame = new MimirMuninnMoveEvidenceStreamFrame(
FrameId: "muninn:nightwing:move-evidence:79",
ProducerPeerId: "muninn:nightwing",
PublishedAtNs: 1_781_202_600_005_000_000,
MarkerCandidates:
[
new MuninnMoveMarkerCandidateDocument(
StreamId: "nightwing:ps3-eye-0:move-marker-candidates",
HostId: "nightwing",
CameraId: "ps3-eye-0",
FrameSequence: 9101,
SourceIdHash: leftWitnessHash,
TileX: 10,
TileY: 10,
CenterXPx: 170.0f,
CenterYPx: 120.0f,
RadiusPx: 12.0f,
AreaPx: 452,
MeanLuma: 0.64f,
PeakLuma: 252,
Score: 0.90f,
ObservedAt: observedAt),
new MuninnMoveMarkerCandidateDocument(
StreamId: "starfire:ps3-eye-1:move-marker-candidates",
HostId: "starfire",
CameraId: "ps3-eye-1",
FrameSequence: 9102,
SourceIdHash: rightWitnessHash,
TileX: 11,
TileY: 10,
CenterXPx: 150.0f,
CenterYPx: 120.0f,
RadiusPx: 12.0f,
AreaPx: 449,
MeanLuma: 0.62f,
PeakLuma: 250,
Score: 0.86f,
ObservedAt: observedAt)
],
ControllerStates:
[
new MuninnMoveControllerStateDocument(
StreamId: "nightwing:move-usb:move-controller-state",
HostId: "nightwing",
MoveId: "move-usb",
Sequence: 79,
SourceTimestampNs: 1_781_202_600_004_000_000,
AccelerometerXyz: [-0.01f, 0.10f, 0.99f],
GyroscopeXyz: [0.02f, -0.01f, 0.04f],
MagnetometerXyz: [0.0f, 0.0f, 0.0f],
TriggerValue: 0.5f,
Buttons: ["move", "trigger"],
Battery01: 0.72f,
ObservedAt: observedAt)
]);
var calibration = new MimirMoveFusionRigCalibration(
CalibrationId: "mimir-move-stage-calibration-v1",
TrackingSpaceId: "mimir-stage-space",
Cameras:
[
new MimirMoveFusionCameraCalibration(
CameraId: "nightwing:ps3-eye-0",
WitnessIdHash: leftWitnessHash,
PositionMeters: new MimirVector3Snapshot(-0.1, 0.0, 0.0),
Orientation: new MimirQuaternionSnapshot(0.0, 0.0, 0.0, 1.0),
FocalLengthXPx: 100.0,
FocalLengthYPx: 100.0,
PrincipalPointXPx: 160.0,
PrincipalPointYPx: 120.0),
new MimirMoveFusionCameraCalibration(
CameraId: "starfire:ps3-eye-1",
WitnessIdHash: rightWitnessHash,
PositionMeters: new MimirVector3Snapshot(0.1, 0.0, 0.0),
Orientation: new MimirQuaternionSnapshot(0.0, 0.0, 0.0, 1.0),
FocalLengthXPx: 100.0,
FocalLengthYPx: 100.0,
PrincipalPointXPx: 160.0,
PrincipalPointYPx: 120.0)
],
MaximumAssociationSkewMilliseconds: 20.0);
var catalog = CultMesh.CreateStreamCatalog();
catalog.Declare(MimirMuninnMoveEvidenceAdapter.CreateStreamDescriptor(
streamId,
"mimir-live",
"muninn:nightwing",
"nightwing:clock"));
using var ring = catalog.CreateSharedMemoryRing(streamId, slotCount: 4, slotByteLength: 8192);
var payload = MimirMuninnMoveEvidenceAdapter.SerializeStreamFrame(frame);
if (!ring.TryPublishCopy(payload, frame.PublishedAtNs, durationNs: 0, out var published))
{
Console.Error.WriteLine("move-proof-runtime-driver-smoke publish-failed");
return 1;
}
catalog.PublishFrame(published);
using var reservoir = new MimirNativeReservoirRuntime(nativeReservoirPath);
var driver = new MimirMoveProofRuntimeDriver(
ring,
reservoir,
calibration,
new MimirMoveProofRuntimeDriverOptions(
MimirEvidenceSourceId: "mimir:starfire:move-evidence",
MimirEvidenceFramePrefix: "mimir:starfire:move-evidence",
MimirPoseFramePrefix: "mimir:starfire:move-pose",
MimirPoseProducerPeerId: "mimir:starfire",
FensalirFramePrefix: "fensalir:starfire:presented-frame"));
var runtime = new MimirRuntime(
new AquariumRuntimeOptions(Headless: true, CultCachePath: ""),
new MimirSynchronizationSettings());
runtime.RegisterMoveProofDriver(driver);
runtime.OnSceneReady();
var input = new InputState();
runtime.Update(0.016f, input);
var proofFrame = runtime.Frame;
var proofSurface = driver.LastResult?.ProofSurface;
var proofSplineCount = proofFrame.Scene.SplineFrame.Splines.Count(spline =>
spline.Id.StartsWith("move-proof-", StringComparison.Ordinal));
runtime.Update(0.016f, input);
var duplicateSuppressed = reservoir.Status.MoveEvidenceCount.ToUInt64() == 1UL;
Console.WriteLine(
$"move-proof-runtime-driver-smoke proof={proofSurface?.ProofId ?? "none"} chain={proofSurface?.MuninnEvidenceFrameId ?? "none"}->{proofSurface?.MimirEvidenceFrameId ?? "none"}->{proofSurface?.MimirPoseFrameId ?? "none"}->{proofSurface?.FensalirFrameId ?? "none"} verdict={proofSurface?.Verdict.ToString() ?? "none"} splines={proofSplineCount} duplicateSuppressed={duplicateSuppressed}");
return proofSurface is not null &&
proofSurface.IsFullPose &&
proofSurface.MuninnEvidenceFrameId == "muninn:nightwing:move-evidence:79" &&
proofSurface.MimirEvidenceFrameId == "mimir:starfire:move-evidence:79" &&
proofSurface.MimirPoseFrameId == "mimir:starfire:move-pose:79" &&
proofSurface.FensalirFrameId == "fensalir:starfire:presented-frame:79" &&
proofFrame.Scene.SplineFrame.HasInput &&
proofSplineCount >= 3 &&
duplicateSuppressed
? 0
: 1;
}
static MimirMoveProofSurfaceDocument CreateMoveProofSurfaceSmokeDocument()
{
var pose = new MimirMoveControllerPoseDocument(

View file

@ -62,6 +62,7 @@ direct
private IReadOnlyList<MimirAudioSynchronizationReport> lastAudioSynchronizationReports = [];
private IReadOnlyList<MimirAudioSpectrumSnapshot> lastAudioSpectra = [];
private readonly Queue<IReadOnlyList<MimirAudioSpectrumSnapshot>> spectrumHistory = new();
private readonly List<MimirMoveProofRuntimeDriver> moveProofDrivers = [];
private MimirMoveProofSurfaceDocument? latestMoveProofSurface;
public MimirRuntime(AquariumRuntimeOptions options)
@ -181,6 +182,12 @@ direct
latestMoveProofSurface = null;
}
public void RegisterMoveProofDriver(MimirMoveProofRuntimeDriver driver)
{
ArgumentNullException.ThrowIfNull(driver);
moveProofDrivers.Add(driver);
}
public static AquariumSplineFrame ComposeFensalirSplineFrame(
AquariumSplineFrame baseFrame,
MimirMoveProofSurfaceDocument? moveProofSurface)
@ -223,6 +230,7 @@ direct
runtimeSeconds += Math.Max(deltaSeconds, 0.0f);
lastPollCount = synchronization.PollSources();
UpdateMoveProofSurfaces();
QueueCalibrationTimeline();
UpdateAudioSpectra();
UpdateAudioSynchronization();
@ -275,6 +283,7 @@ direct
panel.Readout("Chirplet reference", DescribeChirpletReference);
panel.Section("Move Proof");
panel.Readout("Latest proof", DescribeMoveProofSurface);
panel.Readout("Proof drivers", DescribeMoveProofDrivers);
panel.Section("Live FFT");
panel.Readout("Spectrum cadence", () => sceneReady
? $"{lastAudioSpectra.Count} spectra fft={lastAudioSpectra.FirstOrDefault()?.FftSize ?? 0} analyze={lastSpectrumAnalysisMilliseconds:0.00}ms"
@ -301,6 +310,41 @@ direct
return $"{surface.ProofId} verdict={surface.Verdict} confidence={surface.PoseConfidence:0.000} latency={surface.LatencyMilliseconds:0.00}ms chain={surface.MuninnEvidenceFrameId}->{surface.MimirEvidenceFrameId}->{surface.MimirPoseFrameId}->{surface.FensalirFrameId}";
}
private string DescribeMoveProofDrivers()
{
if (moveProofDrivers.Count == 0)
{
return "No Move proof runtime drivers registered.";
}
return string.Join(Environment.NewLine, moveProofDrivers.Select(driver => driver.Describe()));
}
private void UpdateMoveProofSurfaces()
{
if (moveProofDrivers.Count == 0)
{
return;
}
var presentedAtNs = NowUnixNs();
foreach (var driver in moveProofDrivers)
{
if (driver.TryBuildLatest(presentedAtNs, out var result) && result is not null)
{
PublishMoveProofSurface(result.ProofSurface);
}
}
}
private static ulong NowUnixNs()
{
var now = DateTimeOffset.UtcNow;
var secondsNs = checked((ulong)now.ToUnixTimeSeconds() * 1_000_000_000UL);
var tickRemainderNs = checked((ulong)(now.Ticks % TimeSpan.TicksPerSecond) * 100UL);
return checked(secondsNs + tickRemainderNs);
}
private static AquariumRenderPlan CreateRenderPlan()
{
var app = new AquariumApp();

View file

@ -0,0 +1,94 @@
using GameCult.Mesh;
namespace Mimir.Runtime.Synchronization;
public sealed record MimirMoveProofRuntimeDriverOptions(
string MimirEvidenceSourceId,
string MimirEvidenceFramePrefix,
string MimirPoseFramePrefix,
string MimirPoseProducerPeerId,
string FensalirFramePrefix,
string FusionAuthorityId = "mimir.runtime.move-fusion",
string ConsumerContract = "fensalir.move-controller-input");
public sealed class MimirMoveProofRuntimeDriver
{
private readonly CultMeshSharedMemoryFrameRing ring;
private readonly MimirNativeReservoirRuntime reservoir;
private readonly MimirMoveFusionRigCalibration calibration;
private readonly MimirMoveProofRuntimeDriverOptions options;
private string lastFrameId = "";
public MimirMoveProofRuntimeDriver(
CultMeshSharedMemoryFrameRing ring,
MimirNativeReservoirRuntime reservoir,
MimirMoveFusionRigCalibration calibration,
MimirMoveProofRuntimeDriverOptions options)
{
this.ring = ring ?? throw new ArgumentNullException(nameof(ring));
this.reservoir = reservoir ?? throw new ArgumentNullException(nameof(reservoir));
this.calibration = calibration ?? throw new ArgumentNullException(nameof(calibration));
this.options = options ?? throw new ArgumentNullException(nameof(options));
ArgumentException.ThrowIfNullOrWhiteSpace(options.MimirEvidenceSourceId);
ArgumentException.ThrowIfNullOrWhiteSpace(options.MimirEvidenceFramePrefix);
ArgumentException.ThrowIfNullOrWhiteSpace(options.MimirPoseFramePrefix);
ArgumentException.ThrowIfNullOrWhiteSpace(options.MimirPoseProducerPeerId);
ArgumentException.ThrowIfNullOrWhiteSpace(options.FensalirFramePrefix);
}
public MimirMoveProofPipelineResult? LastResult { get; private set; }
public bool TryBuildLatest(ulong fensalirPresentedAtNs, out MimirMoveProofPipelineResult? result)
{
result = null;
if (!ring.TryAcquireLatestRead(out var lease))
{
return false;
}
using (lease)
{
var frame = MimirMuninnMoveEvidenceAdapter.DeserializeStreamFrame(lease.Memory[..lease.Handle.ByteLength]);
if (string.Equals(frame.FrameId, lastFrameId, StringComparison.Ordinal))
{
return false;
}
var sequence = SequenceSuffix(frame.FrameId);
var pipelineOptions = new MimirMoveProofPipelineOptions(
MimirEvidenceSourceId: options.MimirEvidenceSourceId,
MimirEvidenceFrameId: $"{options.MimirEvidenceFramePrefix}:{sequence}",
MimirPoseFrameId: $"{options.MimirPoseFramePrefix}:{sequence}",
MimirPoseProducerPeerId: options.MimirPoseProducerPeerId,
FensalirFrameId: $"{options.FensalirFramePrefix}:{sequence}",
FensalirPresentedAtNs: fensalirPresentedAtNs,
FusionAuthorityId: options.FusionAuthorityId,
ConsumerContract: options.ConsumerContract);
if (!MimirMoveProofPipeline.TryBuild(frame, reservoir, calibration, pipelineOptions, out result))
{
return false;
}
lastFrameId = frame.FrameId;
LastResult = result;
return true;
}
}
public string Describe()
{
var last = LastResult?.ProofSurface;
return last is null
? $"{options.MimirEvidenceSourceId} waiting"
: $"{last.ProofId} verdict={last.Verdict} chain={last.MuninnEvidenceFrameId}->{last.MimirEvidenceFrameId}->{last.MimirPoseFrameId}->{last.FensalirFrameId}";
}
private static string SequenceSuffix(string frameId)
{
var separator = frameId.LastIndexOf(':');
return separator >= 0 && separator < frameId.Length - 1
? frameId[(separator + 1)..]
: frameId;
}
}

View file

@ -162,3 +162,4 @@
{"ts": "2026-07-08T22:28:32+01:00", "type": "implementation", "status": "ok", "note": "Added MimirMoveProofSurface as the first observer-only Fensalir-visible Move proof surface: it combines a Muninn evidence admission receipt, Mimir pose stream frame, and Fensalir presentation/probe timestamp into mimir.move_proof_surface.v1, lowers a dev AquariumSplineFrame probe, preserves source/publish/read/admit/fusion/present timing, and refuses to treat single-ray fallback as full pose. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-surface-smoke, and BufferSmoke --move-fusion-smoke. Live Nightwing hardware, calibrated camera witnesses, and actual Fensalir presented-frame capture remain pending."}
{"ts": "2026-07-08T22:34:00+01:00", "type": "implementation", "status": "ok", "note": "Added MimirMoveProofPipeline as the shared commit primitive for one Move proof frame: it reads a Muninn CultMesh shared-memory evidence frame, admits samples to native move_evidence, runs MimirMoveFusion, emits the mimir:starfire move-pose frame, creates mimir.move_proof_surface.v1, and lowers the Fensalir spline probe in one pass. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, and BufferSmoke --move-proof-pipeline-smoke against the native reservoir debug DLL. This proves the reusable Mimir owner path; live Nightwing hardware, calibrated camera witnesses, and actual presented-frame capture remain pending."}
{"ts": "2026-07-08T22:41:32+01:00", "type": "implementation", "status": "ok", "note": "Attached the Move proof surface to the actual MimirRuntime/Fensalir frame path: MimirRuntime.PublishMoveProofSurface stores the latest Mimir-owned mimir.move_proof_surface.v1 document, CreateFrame composes its observer-only move-proof-* splines into AquariumFrame.Scene.SplineFrame, and the UI exposes a display-only proof readout. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-runtime-frame-smoke, --move-proof-surface-smoke, and --move-proof-pipeline-smoke against the native reservoir debug DLL. Live Nightwing hardware, calibrated camera witnesses, and real presented-frame capture remain pending."}
{"ts": "2026-07-08T22:48:42+01:00", "type": "implementation", "status": "ok", "note": "Added MimirMoveProofRuntimeDriver as the runtime bridge from a Muninn CultMesh shared-memory evidence ring to MimirRuntime.PublishMoveProofSurface. The driver derives mimir:starfire evidence/pose ids and fensalir:starfire presented-frame id from the actual Muninn frame suffix, calls MimirMoveProofPipeline, and suppresses duplicate frame admission. Verified dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-runtime-driver-smoke against the native reservoir debug DLL, --move-proof-runtime-frame-smoke, --move-proof-surface-smoke, and --move-proof-pipeline-smoke. This proves the runtime-owned ring-to-visible-probe path with synthetic ring input; real Nightwing hardware, calibrated camera witnesses, and real presented-frame capture remain pending."}

View file

@ -149,6 +149,12 @@ accepted_design:
`move-proof-*` probe splines into `AquariumFrame.Scene.SplineFrame` beside
the audio spectrum preview. Fensalir remains a renderer, not a proof
authority.
- `MimirMoveProofRuntimeDriver` is the runtime bridge from a Muninn CultMesh
shared-memory evidence ring into `MimirRuntime.PublishMoveProofSurface`.
It derives the Mimir evidence, Mimir pose, and Fensalir frame ids from the
actual Muninn frame suffix, calls `MimirMoveProofPipeline`, and suppresses
duplicate frame admission so the live loop cannot re-admit one frame and
impersonate progress.
- `MimirMoveCalibrationProtocol` defines the runnable Starfire/Nightwing Move
calibration preflight as typed state: required Muninn Move evidence streams,
optional Quest headset/controller pose witnesses over USB,