mojibake

Fifth: ‘Look at the majesty sideways and all you see is the Tower, which our ancestors made idols from. Look at its center and all you see is the begotten hole, second serpent, womb-ready for the Right Reaching, exact and without enchantment.’ Sixth: ‘The heart of the second serpent holds the secret triangular gate. Seventh: ‘Look at the secret triangular gate sideways and you see the secret Tower.’ Eighth: ‘The secret Tower within the Tower is the shape of the only name of God, I.’ The ending of the words is ALMSIVI.

-36 Lessons of Vivec, Sermon 21

So, CAN AI use ssh to touch my virtualization server that runs my gaming vm and uses qm exec to write b64 encoded .ps1 scripts to a file that then run to do hand rolled byte editing on Bethesda proprietary mod file types, and do it reliably enough to be trusted to not break anything?

Actually yes. Really well in fact.

SOULD you? No are you insane? Of course not. The amount of tokens that requires is insane by comparison to what the actual lift gets you after the novelty the first few times.


Generation 1: Host SSH + qm guest exec + base64 PowerShell

There was no direct network path to the guest, so the guest was driven through the hypervisor. SSH to core, then use the QEMU guest agent (qm guest exec) to run a command inside VM 220. PowerShell payloads were base64-encoded and passed as powershell -EncodedCommand <b64> to survive the two layers of shell quoting between the local terminal, the core shell, and the guest agent.

# (reconstructed, illustrative): the shape of the gen-1 path.
# Encode a PowerShell script and run it in VM 220 via the guest agent on 'core'.
B64=$(python3 -c 'import base64,sys; \
  print(base64.b64encode(open(sys.argv[1],"rb").read().decode("utf-8") \
  .encode("utf-16-le")).decode())' local.ps1)
ssh root@100.64.0.1 "qm guest exec 220 -- powershell -EncodedCommand $B64"

I’ve been playing Skyrim for a well over decade. (At time of writing it is 2026, I am 28, and in 2011 I was 14). Yea whatever I know “Hey you…. You’re finally awake.” And Todd Howard’s million plus re releases has been memed into the ground and rightfully so, but it just feels like home.

Jeremy Soule’s compositions wandering Falkreath Hold, or the fall red of the aspens of the Reach. These digital memory fragments represented safety to me in a way my world a decade ago did not.

This even before I started exploring the deeper lore.


Generation 2: Direct SSH into the guest

A portable Win32-OpenSSH server was installed on the guest and a subnet route was published (core advertises 10.10.20.0/24; the Mac accepts the route), so the guest became directly reachable at ssh sadako@10.10.20.20, an elevated (admin-token) session that lands in PowerShell. The clean pattern for headless scripting is to author a .ps1 locally and pipe it in over stdin:

# (real): the canonical gen-2 headless-PowerShell pattern.
ssh sadako@10.10.20.20 "powershell -NoProfile -Command -" < local.ps1

Because scp to this box fails (“Connection closed”), binary files (including plugins) move as base64 over stdin, decoded on the far side:

# (real): base64-over-stdin file transfer (scp fails on this box).
base64 -i local_file.bin | ssh sadako@10.10.20.20 \
  "powershell -NoProfile -Command - " <<'PS'
$b64 = [Console]::In.ReadToEnd()
[IO.File]::WriteAllBytes('C:\chimcli\local_file.bin', [Convert]::FromBase64String($b64))
PS

Fantasy has this problem where Tolkien and Dungeons&Dragons kind of dominate the cultural image that comes to mind.

Now when your frame of reference for the elder scrolls is Skyrim, or even Oblivion, this will seem out of place. “Yeah man it’s dragons that’s not unique. It came out while game of thrones was starting, that’s not a unique cultural moment.” And you’re correct actually.

TES games over time have become a lot more watered down. Most emblematic of this shift is Morrowind. Much of Morrowind lore was written by Michael Kirkbride, a Dune and Warhammer fan. Bethesda was failing and the rest of the team was getting really out there with what they could build.

The result was this alien world.


Generation 3: Raw byte-editing Python (PowerShell demoted to transport)

The ESP-editing logic moved out of PowerShell and into Python that parses and patches plugin bytes directly with struct/bytes and correct unsigned math. PowerShell was demoted to transport: write the .py (or the plugin bytes) to the box, run the script, read back the result. The record header is a fixed 24-byte layout the Python code addresses by offset:

RECORD = 24-byte header + dataSize bytes of payload   (little-endian)
    0 : signature   4 ASCII      e.g. b"REFR"
    4 : dataSize    uint32       (bytes AFTER the 24-byte header)
    8 : flags       uint32
   12 : formID      uint32
   16 : timestamp + versionControl  uint32
   20 : internalVersion  uint16
   22 : unknown          uint16

A representative gen-3 edit, retarget a placement’s base object by rewriting the NAME subrecord’s FormID at a computed offset, looked like:

# (reconstructed, illustrative): a gen-3 one-off raw-byte edit.
# Repoint one uncompressed REFR's NAME (base FormID) in place.
import struct
 
buf = bytearray(open("Tel Solanum.esp", "rb").read())
 
# `rec_off` = byte offset of the REFR record header (found by an earlier walk).
sig      = bytes(buf[rec_off:rec_off + 4])            # b"REFR"
data_sz  = struct.unpack_from("<I", buf, rec_off + 4)[0]
payload  = rec_off + 24
end      = payload + data_sz
 
# Walk this record's subrecords to find NAME (base object FormID).
p = payload
while p < end:
    sr_sig = bytes(buf[p:p + 4])
    sr_len = struct.unpack_from("<H", buf, p + 4)[0]   # uint16 field size
    if sr_sig == b"NAME":                              # 4-byte FormID payload
        struct.pack_into("<I", buf, p + 6, 0x06022DD0) # -> new TS_ base
        break
    p += 6 + sr_len
 
open("Tel Solanum.esp", "wb").write(buf)

Pumice ash chokes the sky of this volcanic island in a constant state of eruption. The people of this island live in the dying aftershocks of theocratic regimes golden years. The worshipers of the old demon gods, the Daedra Azura, Mephala and Boethia, are banished and the cultural hegemony follows these 3 god kings who stole their power from the heart of a dead god Lorhkan The promethean figure who gave the mundane world life.

There was a battle between this hegemony and the Dwemer, or dwarves. Atheists who in their disbelief used the heart to turn themselves into the skin of a brass mechanical god in their own image, where in the aftermath of this war the leaders of the hegemonic army betrayed one of their own to take the power of the heart for themselves.

And now their power is waning. In Vivec city you feel the oppression. Empty streets patrolled by theocratic soldiers, all leading to a massive temple complex overshadowed by a suspended rock. The Bar Dau. This asteroid is being held in space by the will of the heretical God King for which the city is named. The seat of this theocratic dictatorship is also an ideological prison held hostage by this looming threat. Incidentally the rock itself has been hollowed out and used as a literal ideological prison to hold those who speak out against the regime.


Generation 4: A dedicated library and MCP server (chim)

The one-off scripts were canonized into a library, chim, at ~/Code/mojibake/chim. It provides a Record/Group/Plugin model (chim/esp/records.py) that parses and re-serializes byte-identical for an unmodified plugin (GRUP sizes are re-derived from the live tree on serialize; only HEDR is hand-bumped; each 24-byte header is retained verbatim and only the size fields re-synced), subrecord CRUD and higher-level edit ops (set-flag, move-ref, insert-ref, clone, delete), a safety.transaction wrapper around every mutation, and an MCP server exposing typed tools so an agent drives edits directly rather than writing scripts.

A mutating tool is a thin wire wrapper around the safety transaction. The real shape, from chim/server.py (esp_set_flag):

# (real): chim/server.py, the gen-4/5 tool + transaction shape.
with safety.transaction(host, path) as txn:
    plug = ops.load(txn.data)          # gen-4: parse_plugin(txn.data)
    rec = ops.find_record(plug, fid)
    if rec is None:
        raise ValueError(f"no record with formID {_hexid(fid)} in {plugin!r}")
    ops.set_flag(plug, fid, flag_bits, clear=clear)
    txn.data = ops.serialize(plug)     # gen-4: serialize(plug)

The transaction itself, from chim/esp/safety.py, is a context manager that lock-checks (Get-Process for CreationKit, ckpe_loader, SkyrimSE, SkyrimSELauncher; if any is running it raises LockError and touches nothing, because editing a plugin the CK has open corrupts it), backs up (copies to a timestamped .bak beside the file, <name>.<YYYYmmdd-HHMMSS>.bak, and keeps it), yields the current bytes as txn.data for the tool to edit, writes back txn.data on clean exit, and verifies walk-clean (re-reads and confirms the bytes re-parse cleanly from TES4 to EOF with nothing left over; if not, restores from the .bak and raises TransactionError).

An agent-driven edit is then just a typed tool call, for example force-enabling a reference by clearing its initially_disabled (0x800) bit:

// (real): an MCP tool call; force-enable a REFR by clearing 0x800.
{ "tool": "esp_set_flag",
  "args": { "plugin": "Tel Solanum.esp",
            "form_id": "0x0705ADD4",
            "flag": "initially_disabled",
            "clear": true } }

The server runs on the VM itself as a Scheduled Task (chim-mcp), reachable at http://10.10.20.20:8765/mcp. It uses LocalWindowsHost (direct local open(path, "wb"), plus a real local Get-Process lock-check) specifically because the alternative RemoteHost ships bytes as base64 in one powershell -EncodedCommand, which overflows the ~32 KB command line on a ~500 KB plugin: the same size ceiling from generation 1, one generation later.


You begin to see the disconnect. This is esoteric. Fantasy that isn’t “elves are pretty white people”. It has a point of view.

I’m going to be cringe and draw a LinkedIn coded parallel here.

Lots of Fantasy, even when written by a person, reminds me of AI. It’s an echo of the same. It’s self referential, all culture is, but overly so. Everyone wants to be Tolkien.

So when all culture and all fantasy is self referential, TES even starting as a D&D reskin, how do you differentiate?


Generation 5: The esplib rewrite (2026-07-11)

chim’s hand-rolled byte engine was replaced by the mature esplib (BadDogSkyrim, MPL-2.0, v0.2.0) via a thin adapter, chim/esp/ops.py (~700 lines), the only new code the rewrite introduced. The MCP server and safety.transaction are unchanged; the legacy byte modules stay on disk as a fallback. The adapter’s central job is a bytes to Plugin seam, because esplib normally loads from a path but the transaction owns the bytes:

# (real): chim/esp/ops.py, the bytes<->Plugin seam.
def load(data: bytes) -> Plugin:
    plug = Plugin()                          # bare ctor: no path -> no auto load
    plug.groups.clear()
    plug.records.clear()
    plug._parse_plugin(BinaryReader(data))   # parses TES4 header + the tree
    plug._link_records()
    plug._build_indexes()
    plug.modified = False
    return plug
 
def serialize(plug: Plugin) -> bytes:
    return plug.to_bytes()                   # esplib refreshes HEDR.num_records here

serialize(load(data)) == data holds for an unmodified plugin, the same byte-identical guarantee as gen-4, now carried by esplib. (esplib recomputes HEDR.num_records = records + groups, the true Bethesda definition, so no manual header bookkeeping remains.) The rewrite was not a leap of faith. It was verified byte-identical round-trip on the live Tel Solanum.esp (734469 to 734469 bytes), and an equivalence harness ran every mutating op through both engines: 12 of 13 byte-identical, the 13th (delete_cells) differing only where esplib’s HEDR count is more correct.

The concrete capability unlock is authoring structures the hand-rolled engine never modeled. VMAD authoring (retiring the opaque-byte QUST surgery that caused the plinth/quest bugs) via a read, edit, write JSON round-trip:

// (real): esplib-era VMAD authoring, read then write the same shape.
// esp_get_vmad returns exactly the dict esp_set_vmad accepts.
{ "tool": "esp_get_vmad",
  "args": { "plugin": "Tel Solanum.esp", "form_id": "0x0003A3DD" } }
// -> { "vmad": { "version": 5, "obj_format": 2, "scripts": [...],
//               "fragment_data": ..., "alias_scripts": [...] } }
 
{ "tool": "esp_set_vmad",
  "args": { "plugin": "Tel Solanum.esp", "form_id": "0x0003A3DD",
            "vmad_json": { /* edited dict of the same shape */ } } }

And master management (add/rename without renumbering any FormID), via ops.add_master:

# (real): chim/esp/ops.py add_master; append MAST/DATA so it reaches the bytes.
plug.add_master(name)                        # updates header.masters
rr = plug.header._raw_record
rr.add_subrecord("MAST", name.encode("cp1252") + b"\x00")
rr.add_subrecord("DATA", struct.pack("<Q", int(size) & 0xFFFFFFFFFFFFFFFF))
# esplib's PluginHeader.to_record reuses _raw_record, so appending MAST/DATA
# here is what actually gets the new master into the serialized file.

I’m exploring what it means to be a creator, artist OR engineer, in the AI age, much like everyone who wants to make something out of a vision is. It’s incredible seeing what people are doing with it, and I’m equally impressed with the places where AI is actively excluded.

The discretion of when to or not to use it is critical. What we bring to the table as the human half of this centaur is a point of view. We are the dreaming godhead running the engine of creation. We are the tower within the tower.

Sprinkled throughout have been shots of the world I created with this library.

My character Rotfern is a Dunmeri/Bosmeri mage who takes after the Telvanni of her Dunmeri homeland. Eccentric sorcerers who construct enormous mushroom towers to live within. The Bosmer however are from the forest, so I wanted her home to reflect this. What if externally it was a tower, but instead of an inner chamber, what if it was using Dwemeri tonal architecture to cut a rift into oblivion between Sanguines spare realms to sustain a pocket dimension. This suspended grotto in perpetual twilight with floating pylons to hoard/display objects of power that I’ve accumulated.

What was me and what was the AI? I drove all visual/aesthetic/thematic/artistic/content decisions. Every plant, every lighting choice, all me.

I’m quite proud of the idea that the door between the worlds, be it on the lawn, veranda, or pocket dimension, are all just a book on a table under an art nouveau street lamp. Very whimsical bordering on Lynchian.

The AI is wiring form edits so the world space can exist, or so the books that sit on the reading desk quaint Dwemeri lawn furniture can function as the door between worlds. It’s just linguistic/semantic substrate to make that vision real.

I honestly believe that the correct cultural course of action in the AI world is to get weirder. Get sloppier. You WILL find spelling, grammatical, and typographical errors in my writing. I write in obsidian on my phone. How else will you know it’s ME.

My favorite writer said “The moral of the story is – we’re here on Earth to fart around. Of course, the computers will do us out of that. But what the computer people don’t realise, or they don’t care, is we’re dancing animals. You know, we love to move around. And it’s like we’re not supposed to dance at all anymore.”

We are all the tower within the tower.