--- id: MEM-4 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-4 specification: FlowDrop Workflow Specification 1.0-draft licence: CC BY 4.0 --- # MEM-4 — Assembling messages concatenates in declared port order *GR-MEM (Part I) · level: extended · profiles: storage-api, runtime · added in 1.0* The node that joins several message sources into one list. Port order is the message order, and an unwired source adds nothing at all. ## The rule > **Normative.** This is the rule. > > 1. A message-assembly node takes any number of dynamically declared message-typed inputs and flattens them into one message-typed output. > > 2. The declared order of the inputs is the order of the messages. > > 3. A connected list contributes each of its items in order; a connected single message contributes one item; an input that is unwired or carries no value contributes nothing; no placeholder is emitted for it. ## What it means The output order follows how the author declared the ports, not the order a caller might expect from the port names or from wiring them up. Declare `b` before `a` and wire both — `b`'s messages come first regardless of what the names suggest. The other clause is the one a reader coming from a message-merging node would get wrong: an input port that is unwired, or carries no value, contributes nothing at all — no null placeholder takes its place in the output. A three-port assembly with the middle port unwired produces a two-item list, not a three-item list with a gap in it. ## Example Two ports declared in the order `b`, then `a`, each wired to one message: ```json title="Ports declared b before a" verdict="assembled" { "b": [{ "role": "user", "content": "second-declared-first" }], "a": [{ "role": "user", "content": "first-declared-second" }] } ``` ```json title="What the assembly outputs" [{ "role": "user", "content": "second-declared-first" }, { "role": "user", "content": "first-declared-second" }] ``` Three ports declared, the middle one left unwired: ```json title="in_1 and in_3 wired, in_2 left unwired" verdict="assembled" { "in_1": [{ "role": "user", "content": "a" }], "in_3": [{ "role": "user", "content": "c" }] } ``` ```json title="What the assembly outputs" [{ "role": "user", "content": "a" }, { "role": "user", "content": "c" }] ``` ## Related rules - Names: MEM-16 - Referenced by: MEM-16 --- 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.