Multimodal — Context schema parser (<context>…</context>)
The `<context>` snatcher that closes the loop on model memory
- updated_context
- raw_text
This is the other half of the pack's "give your LLM a memory" trick. The ContextSchemaBuilder wraps a model's output in a contract that says if you update the context, put the full updated version inside <context>…</context>. The model dutifully does it - and then you're left with a reply that's part JSON, part reasoning, part context block, and all of it unusable as a clean value. This node is the scissors that cuts the context block out and hands it to you as a clean string.
How it works
Dead simple under the hood: a regex search. It takes the model's raw text (model_text), finds everything between context_open_tag (default <context>) and context_close_tag (default </context>), and returns that inner content stripped and trimmed as updated_context. Because the tags are inputs, you're not locked into the defaults - if your prompt contract uses [memory]…[/memory] or <<ctx>>…<<ctx>>, the parser follows.
Two outputs:
updated_context- the extracted block, ready to wire straight back into the LLM node'sextra_contextfor the next turn.raw_text- the full model reply, unchanged, so the parser is never a dead end; you can branch off the raw text for other purposes or just inspect it.
The fallback_to_empty toggle (default true) answers the question "what if the model didn't include a context block at all?" True gives you an empty updated_context (clean, safe - you just keep your previous context); false echoes the whole model_text back as the "updated" context, which is almost never what you want unless you're testing something pathological. Leave it true.
Where it fits
It's the parse step in the "describe → contract → generate → parse → feed back" loop. Workflow looks like: ContextSchemaBuilder feeds the contract into the LLM node → the node returns a reply → ContextSchemaParser extracts the updated context → that string goes into the next run's extra_context, alongside whatever fresh user_prompt you're sending. Presto: a stateless quantized model now carries a character sheet, a style brief, or an editing-invariants checklist forward turn after turn without you hand-curating anything.
The honest caveat mirrors its sibling: this is a text parser, not a validator. If the model mangled the tags - nested a <context> inside another, or forgot the closing tag - the regex grabs whatever it can, and garbage-in-garbage-out applies. Which is exactly why raw_text is exposed. When the loop starts drifting, the first debugging step is looking at what the model actually wrote, and this node gives you both halves of that answer in one pass.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model_text | STRING | — | |
| context_open_tag | STRING | <context> | — |
| context_close_tag | STRING | </context> | — |
| fallback_to_empty | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| updated_context | STRING | — |
| raw_text | STRING | — |