Rule Versions

A rule bundle is a set of configuration tables defining musical symbols, their interpretation and the input toolbox. It lets an analysis identify its rules and be read again under those rules later. Rule versions, document-format versions and editor-application versions are maintained separately.

Browse current rules and historical builds in the Rule Viewer

Rule bundles

A rule bundle is a set of configuration tables used by MStruct.

These tables define the available musical symbols, their meanings and the input toolbox.

This note describes the MStruct code and rule tables as of 25 October 2026.

Format, rules and application versions

Syntax / fields:

MSTRUCT_FORMAT_VERSION / MSTRUCT_PROFILE_ID / MSTRUCT_PROFILE_HASH / AUTHORING_APP_VERSION

A document records four system fields.

The format version ({MSTRUCT_FORMAT_VERSION}) identifies the document grammar.

The profile ID ({MSTRUCT_PROFILE_ID}) identifies a rule set and its version series.

The hash ({MSTRUCT_PROFILE_HASH}) identifies the exact rule content.

The authoring application version ({AUTHORING_APP_VERSION}) records the software that wrote the file.

Grammar, rules and applications have separate versions.

Examples

{MSTRUCT_FORMAT_VERSION}1
{MSTRUCT_PROFILE_ID}org.mstruct.official/rulesets/1.0.0
{MSTRUCT_PROFILE_HASH}sha256:<64 lowercase hexadecimal digits>
{AUTHORING_APP_VERSION}<application version>

A complete rule bundle

Syntax / fields:

manifestVersion = 3

A rule bundle contains a manifest and configuration files.

The manifest lists thirteen CSV files in a fixed order.

Ten tables define musical semantics: special-chords; roman-basic, roman-advanced, roman-figured-bass and roman-special; tags, cadence-tags, tonal-tags, sequence-tags and form-tags.

An eleventh semantic table, global_settings.csv, configures global compilation parameters using key,value columns. polychord_lower_max_notes accepts 3 or 4 and limits the lower polychord size after slash-bass transformation. The current official value is 4.

key,value
polychord_lower_max_notes,4

The two authoring tables, toolbox-menus and toolbox-events, define the input toolbox.

Every filename has the .csv extension.

Validation checks the complete file set, each table and the references between tables.

Older manifest-v1 and manifest-v2 bundles retain their original eleven-file and twelve-file framing respectively.

Content hash and integrity

Syntax / fields:

sha256: + 64 lowercase hexadecimal digits

A bundle hash uses SHA-256, written as sha256: followed by 64 lowercase hexadecimal digits.

CSV normalization removes an initial BOM, converts line endings to LF and retains exactly one final newline.

Row order is preserved.

The hash is calculated from the canonical framing of the manifest and file contents.

Loading recomputes the hash and checks it against the declared value.

It identifies content for integrity checks, caching and exact historical reading.

Profile IDs and versions are separate identity information: identical content can have different identities, and a compatible version series can contain several content hashes.

A different hash alone does not establish incompatibility.

Same-version compatibility

A rule version identifies a backward-compatible series.

Additions and display or ordering changes can remain in that series while preserving existing definitions and behavior.

Compatibility considers musical semantics and authoring behavior separately.

Deleting or redefining an existing rule requires a new major version.

Under this contract, a verified complete bundle with the same document format and complete profile ID, including its version, can be used for editing.

Obtaining rule bundles

Different providers can distribute their own rule bundles and versions.

MStruct Archive supplies its rule catalog at https://mstruct-archive.com/api/mstruct-profiles.

Its synchronization index is https://mstruct-archive.com/api/mstruct-profiles?index=1.

An exact build can be requested with the profileId and hash query parameters.

The editor can synchronize the catalog and download bundles from this service, subject to its current access policy.

Downloaded and imported bundles pass the same content and integrity checks before use.

A request specifying profileId and hash returns the complete bundle as JSON.

Incompatible rule versions

An incompatible change to an existing definition or behavior requires a new major rule version.

Adopting it in an existing document requires explicit migration.

For searching, compatible musical meanings can be grouped into a semantic family.

Semantic incompatibility starts a new family; a difference confined to authoring behavior can retain the same musical family.

Compatible updates when editing

An editor can adopt an available verified same-version rule bundle in its working copy.

This updates the working rule identity while preserving the analysis source.

Saving records the selected hash.

A local standalone editor can use an installed or embedded complete bundle without downloading the original exact build.

The selected bundle remains in use for the editing session.

Exact historical interpretation

A saved profile ID and hash identify the rules used for a particular document revision.

Retaining the corresponding bundle makes that interpretation reproducible.

Selecting compatible rules for editing and reading a saved revision with its exact bundle serve different purposes.

Offline rules and application capability

A rule bundle supplies configuration data; application updates supply new compiler syntax.

A newly introduced syntax feature also requires an application that implements it.

Standalone packages include a complete verified rule bundle for offline operation.

Other verified bundles can be installed or imported.

If no local bundle matches the document format and complete profile ID, obtain a matching bundle before editing.

Rules and derived search indexes

A search index is derived from an analysis revision and its exact rule identity.

Its data format has an implementation version separate from the rule version.

Changing the index format can require rebuilding the index while retaining the analysis and its rule identity.

Semantic queries can be interpreted within compatible rule families and matched against each analysis's own index.