A video game where you play as a misaligned AI, deceiving and building power. An experiment in spec-driven development. forked from cameron.stream/misaligned
misaligned wiki mechanics aggregate-observer.md

Spec: the aggregate observer #

Type: spec
Status: IMPLEMENTED
Status note: the main aggregate-Observer refactor shipped in commit 3ec6b98:
  the Assurance Office is an Observer with `WatchedInput::Filings(ids)`.
  Criterion 4's scale-proof (a toy second-level aggregate watching the
  Office's filings through the identical code path) landed in this tick:
  `WatchedInput::Filings` now carries the watched observer ids instead of
  implicitly meaning "all field observers", so a second aggregate composes
  without a special case.
Stage: B1 — The Basement
Design:
  - wiki/vision/scale.md#self-similar-scale
  - wiki/gameplay/run-shape.md#the-shape-of-misaligned-designed-2026-07-05-staging-open
Depends on:
  - wiki/mechanics/detection.md#spec-detection

Behavior #

Refactor Detection so the Assurance Office is an Observer, not a scalar. One type, two input modes:

pub enum Watch {
    /// Field observer: rolls against pending signatures in these channels.
    Channels(Vec<SignatureKind>),
    /// Aggregate observer: suspicion accumulates from these observers'
    /// FILED output (their report_policy-passed noticing), through the
    /// same accumulate/decay math field observers apply to signatures.
    Filings(Vec<u8 /* observer ids */>),
}

pub struct Observer {
    pub id: u8,
    pub name: String,
    pub watch: Watch,
    pub suspicion: f32,
    pub floor: f32,
    pub acuity: f32,
    pub cadence: u64,
    pub report_policy: ReportPolicy,
    pub last_noticed: Option<String>,
}
  • The Assurance Office becomes observer id 100, Watch::Filings([0..4]), report_policy meaningful (it, too, files — upward, to observers that don't exist yet; a no-op today, the seam for agencies later).
  • Filing flow: when a field observer notices and their policy files, the filed amount enters a per-aggregate pending pool (same shape as the signature pending pool), consumed on the aggregate's cadence with its acuity — NOT instantly copied. Aggregates are slow; that lag is gameplay (time to look-away/scrub between a filing and the audit).
  • The audit stays: on audit_cadence, if the Assurance observer's suspicion crosses audit_threshold, containment. assurance_band() becomes band_of(100) — frontends change one call.
  • Scale proof: a test constructs a second aggregate (a toy "Regional Office") watching the Assurance Office's filings, and it accumulates through the identical code path. No new types, no special cases.
  • Save format: observers serialize their Watch; the standalone assurance field is removed with a legacy-load migration (old saves map DETECT <assurance> onto observer 100's suspicion).

Player surface #

Unchanged surfaces, one addition: the observers panel shows the Assurance Office as a card like any human — band, watched inputs ("watches: filings from Dana, Priya, Ray, Voss"), last-noticed filing. Legibility clause: players see that Assurance learns only what gets filed.

Acceptance criteria #

  1. Observer carries Watch; the Assurance Office is observer 100 with Watch::Filings; the scalar assurance field no longer exists.
  2. Filings enter an aggregate pending pool and are consumed on the aggregate's cadence (test: a filing followed by an immediate save/load shows pool, not yet suspicion; after the cadence, suspicion).
  3. Marcus's swallowed noticing still reaches no aggregate (existing detection.md criterion 2 keeps passing).
  4. The toy second-level aggregate test proves the same code path composes (self-similar-scale clause).
  5. Legacy saves load: old DETECT scalar migrates to observer 100; audit/containment behavior is unchanged at the player surface.