mud_server.axis.grammar
Resolution grammar parser and typed rule dataclasses.
The resolution grammar is a deterministic rules payload for axis mutations.
In canonical runtime mode, this payload is resolved from activated DB policy
variants (axis_bundle.content.resolution) and parsed via
parse_resolution_grammar_payload.
Design notes: 1. All dataclasses are frozen (immutable after parse). 2. This module is payload-based and does not read policy files from disk. 3. File-backed loading remains available only in
mud_server.axis.migration_file_loaderfor explicit migration/testing workflows.
AxisRuleConfig.base_magnitudedefaults to0.0forno_effectresolvers; payloads may omit the field for those axes.
Attributes
Classes
Configuration for one axis within one interaction type. |
|
Resolution rules for the |
|
Top-level container for all resolution rules in a world. |
Functions
|
Parse and validate one resolution grammar mapping payload. |
Module Contents
- class mud_server.axis.grammar.AxisRuleConfig[source]
Configuration for one axis within one interaction type.
- resolver
Name of the resolver function — one of
"dominance_shift","shared_drain", or"no_effect". The axis engine looks up the callable via the resolver registry inengine.py.
- base_magnitude
Scaling factor fed into the resolver (e.g.
0.03for demeanor,0.01for health). Defaults to0.0forno_effectaxes; the YAML may omit the field entirely for those axes.
- class mud_server.axis.grammar.ChatGrammar[source]
Resolution rules for the
chatstimulus type.- channel_multipliers
Per-channel scaling factors applied to every axis delta. Keys are channel names (
"say","yell","whisper"); values are positive floats (e.g.1.5for yell,0.5for whisper).
- min_gap_threshold
Minimum absolute score difference below which
dominance_shiftproduces no delta. Two similarly-matched characters interact without either gaining social ground.shared_drain(health) ignores this threshold — social cost is universal regardless of demeanor gap.
- axes
Mapping from axis name to its
AxisRuleConfig. Every axis registered in the world should appear here (explicitly, even asno_effect), so the engine can assert full coverage.
- axes: dict[str, AxisRuleConfig]
- class mud_server.axis.grammar.ResolutionGrammar[source]
Top-level container for all resolution rules in a world.
Currently only the
chatinteraction type is defined. Future stimulus types (environmental,physical,economic) will add new attributes here alongside their own YAML blocks.- version
Schema version string read from the YAML file (e.g.
"1.0"). Stored onchat.mechanical_resolutionledger events for audit and replay traceability.
- chat
Rules governing axis mutations produced by chat interactions.
- chat: ChatGrammar
- mud_server.axis.grammar.parse_resolution_grammar_payload(*, raw, source)[source]
Parse and validate one resolution grammar mapping payload.
- Parameters:
- Returns:
A fully-constructed immutable
ResolutionGrammar.- Raises:
ValueError – On schema validation failure.
- Return type: