Download Game! Currently 74 players and visitors. Last logged in:CelbornKandaharIberiamsspGunk

Blitzer's Blog >> 72403

Back to blogs index
Posted: 15 Sep 2026 10:34 [ permalink ]
Using an envelope is an excellent architectural decision. Small models (like
the 2B or 7B parameter variants of Gemma) are heavily trained on
Markdown-formatted datasets. Because of this, they possess a strong, built-in
understanding of fenced code blocks as context boundaries.
By wrapping the payload in a specific Markdown fence, you give the model a
clear signal: outside the fence, you may use conversational English; inside
the fence, you must strictly output line-oriented machine code.
Building a compiler pipeline that extracts executable artifacts directly from
structured Markdown specifications is a highly reliable pattern, especially
for Node.js environments.
Here is how the envelope strategy optimizes the workflow for both the model
and the human.
The Envelope Format
You can define a custom language tag for the Markdown block, such as fso (Flat
Semantic Opcode).
LLM Output Example:
> Here is the compiled executable machine code based on your intent:
> LBL INIT
> VAR CURRENT_ROOM STR "CELL"
> VAR INVENTORY ARR []
> 
> LBL WAIT_INPUT
> OUT "What do you want to do?"
> INP PLAYER_COMMAND
> JMP_IF PLAYER_COMMAND IS "INVENTORY" CHECK_INV
> JMP WAIT_INPUT
> 
> LBL CHECK_INV
> OUT INVENTORY
> JMP WAIT_INPUT
> 
> Do you accept this program, and wish to save and run it?
> 
The Programmatic Unwrapper
Because the envelope is standard Markdown, the deterministic parser doesn't
need to do any complex natural language processing. The "Unwrapper" or Linker
script simply strips the conversational padding using a basic regular
expression before feeding the raw payload into the virtual machine's execution
engine.
/ A simple Node.js pipeline to extract the payload
function extractFSO(llmResponseText) {
    const regex = /```fso
([\s\S]*?)
```/;
    const match = llmResponseText.match(regex);
    
    if (match && match[1]) {
        return match[1].trim(); // The raw executable bytecode
    } else {
        throw new Error("Compilation Error: Could not locate the ```fso
envelope.");
    }
}

/ Example usage in the pipeline:
const rawLlmOutput = await fetchGemmaResponse(prompt);
const executableBytecode = extractFSO(rawLlmOutput);

/ Feed directly into the VM scheduler
vm.load(executableBytecode);
vm.run();

Why This Completes the Pipeline
 * Human Auditability: A human can read the conversational preamble, quickly
scan the fso block to ensure no hallucinatory opcodes were injected, and
explicitly approve the execution.
 * Model Focus: The model is not forced into a "JSON-only" mode, which often
causes small models to break character or hallucinate brackets when they
inevitably try to explain their reasoning. It lets the LLM be an LLM, while
the parser remains flawlessly deterministic.
 * Seamless Handoff: Once the text is extracted, it drops perfectly into the
custom VM's yield/resume mechanics, totally isolated from the natural language
that generated it.
With this three-stage pipeline (Intent  Structured Specification  FSO
Envelope), you essentially have a complete, end-to-end OS environment driven
by natural language.
As we look at extending this, how do you want to handle persistent storage for
the VM? Should the memory state (the variables) dump to a local JSON file when
the program yields or halts, so the state can be fully restored across
different sessions?