--- id: MEM-16 family: GR-MEM level: extended profiles: [storage-api, runtime] posture: normative-target added: "1.0" changed: "1.0" source: https://flowdrop.io/spec/rules/gr-mem/mem-16 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # MEM-16 — Text becomes a message under three closed rules *GR-MEM (Part I) · level: extended · profiles: storage-api, runtime · added in 1.0* The adapter every text producer needs to reach a message-shaped node. Its defaults are chosen so a malformed turn never reaches a provider. ## The rule > **Normative.** This is the rule. > > 1. A text-to-message node MUST turn a text value and a role into one message. > > 2. It MUST emit the message both as a one-element message-typed list and as the same row on a plain object-typed output. > > 3. Content MUST be coerced as conversation normalization coerces it: a scalar is cast, a non-scalar is serialized to text rather than blanked, and unserializable content falls back to the empty string. > > 4. Three rules are closed. > > 5. The role MUST resolve to one of `user`, `assistant`, `system` or `tool`; any other value, and an absent role, MUST resolve to `user`, so a role a provider would reject never leaves the node. > > 6. A tool call id MUST be attached only on role `tool`, trimmed. > > 7. An id that is blank once trimmed is a value, and MUST be kept as the empty string; pairing it with a call is left to tool-pairing repair. > > 8. An absent id MUST stay absent. > > 9. On any other role a tool call id names no pairing, and MUST be discarded. > > 10. Empty content MUST emit an empty list and an empty object rather than an empty turn, a `tool` row with no content included, so an unwired producer cannot become a silent request on a blank prompt. > > 11. Synthesizing an answer for an unanswered call belongs to tool-pairing repair. ## What it means The node closes three questions an author is not asked to answer for every piece of text a workflow turns into a message. A role a provider would reject — an unrecognised value, or none at all — never reaches the message; it becomes `user` instead of a validation error, so a producer that forgets to set a role, or sets one from a value the author never anticipated, still emits something a provider will accept. A pairing id only means something on a `tool` row: on any other role it is discarded rather than carried through, because attaching it there would claim a pairing that is not real. And a blank pairing id on a `tool` row is kept, as the empty string: blank is a value, not a missing id. Whether it pairs with any call is for tool-pairing repair to settle, not this node. ## Example The same text and role pair, differing only in the role's provider validity. ```json title="Text declared with a role no provider defines" {"text": "hello", "role": "operator"} ``` ```json title="What the node emits" verdict="normalized" {"role": "user", "content": "hello"} ``` A pairing id attached where only a `tool` row can carry one: ```json title="A pairing id declared on a user-role row" {"text": "hello", "role": "user", "tool_call_id": "call_1"} ``` ```json title="What the node emits" verdict="discarded" {"role": "user", "content": "hello"} ``` ## Why Recorded under [OPEN-25](https://flowdrop.io/spec/rulings/open-25), [OPEN-26](https://flowdrop.io/spec/rulings/open-26). ## Fixtures Test cases whose outcome this rule decides (fixtures/README.md defines each operation): - An absent role resolves to user (`text-to-message`): fixtures/presence/mem-absent-role-is-user.json - An absent tool call id stays absent (`text-to-message`): fixtures/presence/mem-absent-tool-call-id-absent.json - A blank tool call id is trimmed and kept as the empty string (`text-to-message`): fixtures/presence/mem-blank-tool-call-id-kept.json ## Related rules - Names: MEM-3, MEM-4, MEM-5 - Referenced by: MEM-4, MEM-5 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.