ml_switcheroo.semantics.autogen

Semantic Autogen: The Distributed Persistence Layer.

This module is responsible for finalizing “Candidate Standards” proposed by the Consensus Engine into the Distributed Knowledge Base.

It implements the Hub-and-Spoke write strategy: 1. Hub (Specs): Writes Abstract Definitions (std_args, description)

to the target spec file in semantics/.

  1. Spokes (Snapshots): Writes Implementation Details (api, args) to snapshots/{framework}_vlatest_map.json.

Policy: - Do Not Harm: Existing keys in Specs or Snapshots (implying manual curation)

are skipped to prevent overwriting high-quality manual edits.

  • Additive: New discoveries are added.

  • Atomic: Writes are performed per-file using standard JSON serialization.

Classes

SemanticPersister

Handles serialization of Discovered Standards to disk using Hub-and-Spoke architecture.

Module Contents

class ml_switcheroo.semantics.autogen.SemanticPersister

Handles serialization of Discovered Standards to disk using Hub-and-Spoke architecture.

persist(candidates: List[ml_switcheroo.discovery.consensus.CandidateStandard], target_spec_file: pathlib.Path) None

Splits and persists candidates into Specifications (Hub) and Snapshots (Spokes).

Parameters:
  • candidates – List of aligned CandidateStandard objects.

  • target_spec_file – Path to the JSON semantic spec file (Hub) to update/create. (e.g., semantics/k_framework_extras.json)