# MAS — Mail Address Semantics ## Intent Build the smallest practical implementation of **Mail Address Semantics (MAS) v0.1** that can prove whether the specification is useful in real email workflows. The project should demonstrate that ordinary email addresses can carry limited, human-readable and machine-parseable semantics for: - opaque organizational targets, - resource addressing, - facets, - optional interaction preferences, without modifying SMTP and without turning addresses into credentials, commands, contracts, or payment instructions. The implementation must preserve the core architectural boundary of MAS: > **Parsing is local and deterministic. Discovery is networked. Policy is pure. Delivery remains external.** The first implementation should be deliberately narrow. Its purpose is not to build a full MAS ecosystem, but to test the convention against real messages, real routing, resource lifecycle, malformed input, and namespace metadata. --- ## Core hypothesis MAS is valuable if the following can be made both simple and reliable: ```text ticket!callback@great-service.example ``` can express: > initiate a ticket interaction with callback as the preferred continuation mode and result in a stable resource address: ```text ticket=GS-41872@great-service.example ``` that can subsequently be used to correlate email with that ticket without embedding application identifiers in subject lines. If this lifecycle works cleanly through ordinary email infrastructure, MAS has demonstrated its core value. --- ## Design principles ### 1. The parser does not use the network Parsing operates only on the address syntax. It must: - validate canonical MAS syntax, - produce an explicit parse tree, - identify which MAS profile the syntax requires, - never perform statute discovery, - never infer person, actor, or function kind from `.`, `-`, or `_`. Example: ```text ticket!callback ``` parses structurally as an interaction-bearing target and records: ```text required_profile = P2 ``` Whether the addressed namespace supports P2 is decided later. --- ### 2. Discovery returns facts or typed failure MAS discovery is responsible only for retrieving and validating the exact-host statute. Given: ```text anna.mueller@acme.coulomb.social ``` discovery targets: ```text https://acme.coulomb.social/.well-known/mas ``` It must not walk parent domains implicitly. Discovery should return either: ```text ValidatedStatute ``` or a typed failure such as: ```text NotFound HttpFailure CrossHostRedirect SchemaInvalid NamespaceMismatch InheritanceCycle UnsupportedVersion ``` Failure to discover MAS metadata does not invalidate the email address. --- ### 3. Policy is pure Policy evaluation takes: ```text parse tree + validated statute + optional local registry ``` and produces semantic interpretation. Policy performs no network access. This allows the same policy implementation to be exercised entirely through the conformance corpus. --- ### 4. No semantic inference from naming punctuation The following remain naming hints only: ```text . - _ ``` Therefore: ```text bernd.worsch@ research-companion@ invoice_ingest@ ``` may visually suggest person, actor, and function, but machine classification requires statute or registry metadata. No statute means: ```text kind = opaque ``` not: ```text kind = person-like ``` --- ### 5. Resource semantics are the primary proof The initial implementation should strongly support: ```text type=id@ ``` Resource addresses must remain usable as correlation identifiers while remaining independent of authorization. Example: ```text ticket=GS-41872@ ``` identifies the ticket communication endpoint. It does not grant permission to inspect or mutate ticket GS-41872. --- ### 6. Resource addressability outlives mutability Closed resources remain addressable. A closed ticket may: - archive later email, - reject mutation, - return lifecycle information, - create a linked follow-up ticket. It must not become mutable merely because mail can still reach its address. --- ### 7. Facets degrade safely A facet: ```text ticket=GS-41872+comments@ ``` may be stripped by existing email infrastructure. If so, the remaining address: ```text ticket=GS-41872@ ``` still identifies the base resource. Facet preservation is desirable but never assumed. --- ### 8. Interaction remains a preference The P2 syntax: ```text ticket!callback@ ``` requests that the addressed endpoint continue through `callback`. It does not imply: - who initiates the callback, - that callback is available, - that callback has been accepted, - an SLA, - a command. The application decides whether and how to satisfy the request. --- ### 9. Economic syntax remains closed The characters: ```text $ ^ ``` remain reserved only. No implementation work on price, reward, conditions, offers, contracts, or settlement belongs in this phase. --- ## Initial architecture The first repository should contain only the pieces needed for the experiment. ```text mas/ ├── mas_core/ │ ├── parser │ ├── model │ ├── discovery │ ├── policy │ └── lint ├── cli/ │ └── mas ├── conformance/ │ ├── addresses │ ├── statutes │ └── properties ├── examples/ │ ├── statute/ │ └── ticket_service/ ├── gateway/ │ └── smtp_or_webhook_to_http/ └── docs/ ``` The existing MAS v0.1 specification bundle is the normative basis. --- ## Initial components ### `mas-core` Python reference implementation. Responsibilities: - parse canonical MAS syntax, - expose structured parse objects, - identify required profile, - validate statutes, - discover exact-host statutes, - apply equivalence rules, - evaluate semantics from parse tree plus statute, - lint statutes. The first implementation should be clear and auditable rather than clever. --- ### `mas-cli` Primary human interface. Initial commands: ```text mas parse ADDRESS mas explain ADDRESS mas discover HOST mas lint-statute FILE mas test ``` `mas explain` should clearly distinguish: ```text syntactic facts discovered namespace facts policy-derived semantics unknowns ``` A discovery failure must remain visible. --- ### `mas-conformance` The conformance corpus should become a first-class package rather than an incidental test directory. It should contain: - positive syntax cases, - negative syntax cases, - parser expectations, - generator expectations, - statute validation cases, - discovery policy cases, - property and boundary cases. Every future language implementation should consume this corpus unchanged. --- ### Static statute The first service does not need a statute server framework. A static file served at: ```text /.well-known/mas ``` is sufficient. The point is to test discovery semantics, not middleware. --- ### Generic mail gateway The first mail integration should translate inbound mail into a simple HTTP request. It may receive mail via: - a local SMTP listener, or - a provider-style inbound webhook. Its responsibility should be minimal: ```text email recipient → MAS parse → statute/policy resolution → normalized HTTP event ``` It should not contain ticket-specific business logic. --- ### Reference ticket service A deliberately small example application proving the canonical lifecycle. Required behavior: #### Initial interaction Mail to: ```text ticket!callback@great-service.example ``` creates a ticket. The service generates: ```text ticket=GS-41872@great-service.example ``` #### Subsequent correlation Mail sent to: ```text ticket=GS-41872@great-service.example ``` is associated with that ticket without depending on the subject line. #### Closed lifecycle After the ticket is closed, its address remains routable. Later mail must not silently reopen or mutate the resource unless application policy explicitly allows it. --- ## Explicit non-goals The initial implementation does not include: - TypeScript reference library, - Go implementation, - Postfix policy daemon, - central MAS registry, - mail client plugin, - browser extension, - address composer, - payment semantics, - electronic signatures, - generalized service marketplace, - production identity federation, - automatic DNS-parent inheritance. These should be considered only after the reference experiment succeeds. --- ## Success criteria The first experiment succeeds if: 1. the parser conforms to the shared fixture corpus; 2. parser behavior requires no network access; 3. discovery produces validated statute or typed failure; 4. policy evaluation is deterministic and offline; 5. `mas explain` never invents semantics on discovery failure; 6. the ticket lifecycle works end to end; 7. ticket identifiers no longer need to be encoded in subject lines; 8. closed resources remain addressable without becoming mutable; 9. facet loss degrades safely; 10. the experiment exposes no need to change SMTP itself. --- ## Longer-term direction If the experiment validates the concept, MAS may later grow into: - additional language libraries, - infrastructure gateways, - mail client affordances, - signed semantic metadata, - richer interaction discovery, - economic profiles, - service-market coordination. Those extensions should remain subordinate to the core principle: > **MAS should add useful semantics to email without making ordinary email depend on MAS.**