/gameframe:re-formatfrom gameframe
Decodes game data files (archives, compressed entries, assets, save games) by finding reference code, prototyping decoders, and validating against all files of a type.
Ships in gameframe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A decoder is right only when it reads every file of its type to the last byte. One sample proves little: optional fields, versions and rare cases show up in a few files only.
xxd game/data/units.dat | head -20
Look for: a magic number at the start; counts and sizes (small integers that match the file's
length or the number of something visible); offsets (values that point inside the file);
length-prefixed strings (a small integer followed by that many printable bytes); repeated
records of a fixed stride; float values (0000803f is 1.0, 0000003f is 0.5). Measure entropy
(re-inventory section 4): near 8.0 means compressed or encrypted.
python3 tools/triage/filetypes.py game/data/units.dat --blocks 4096 # where the dense parts are
python3 tools/formats/xorscan.py game/data/script.dat # a simple XOR or add key?
python3 tools/formats/xorscan.py game/data.pak --records DIR:28:4:16 --key-in game/GAME.EXE # names XORed in each directory record
python3 tools/formats/shadetable.py game/data/shade.rmp --offset 14 --levels 64 --palette PAL --png derived/shade.png # a light or fog table
python3 tools/formats/timestamps.py --scan saves/slot1.sav --from 1996 --to 1998 # a saved date?
python3 tools/triage/similar.py saves/before.sav saves/after.sav # how much changed
python3 tools/triage/constants.py game/GAME.EXE # the decompressor or checksum, by its constants
python3 tools/triage/binview.py game/data/units.dat derived/units.png --width 24 # records show as stripes
python3 tools/formats/rawimage.py game/data/TITLE.SCR derived/title.png --mode linear8 # a raw picture?
python3 tools/formats/markers.py plant saves/slot1.sav derived/marked.sav --from 0x40 # follow fields into memory
python3 tools/formats/fields.py game/data/units.dat --stride 24 --png derived/units.png # what each offset holds
python3 tools/formats/skeleton.py game/models/hero.mdl # parent arrays, quaternions, joint names
python3 tools/formats/shaders.py game/data/shaders.pak --dump derived/shaders # compiled and source shaders
Text that turns readable under one XOR byte or a short key is a common way games hid their
scripts and tables. xorscan.py tries those weak schemes and shows a preview of each. Confirm
the scheme in the reader's code before you port it. An archive's directory often XORs only
the names: zero padding after each name then stores the key itself, and --records reads
those bytes and finds the whole key in the executable. A palette game draws light and fog
through a table of levels: shadetable.py finds the level that leaves every colour unchanged,
which is the game's normal light. Palettes of 6-bit values are often shifted left by 2 (63 is
252), not scaled: pass --dac shift to rawimage.py and catalog.py when the loader shifts. Two saves made a minute apart, with one
setting changed, show which bytes hold that setting and where the save time is.
Guessing a format from bytes alone is slow and fragile. Find the code that reads it:
decomp_query.py strings .dat), then the
function that opens it, then the function that parses the opened bytes;decomp_query.py find 0x4c504d53);Serialize(Stream&)), the class's serializer: it reads
each field in order, with its type, and its version checks (if (version > 2)).Write down each read in order: offset, type, meaning, and the condition under which it is read.
Run the original under DOSBox-X with the file log, then map the reads per file:
scripts/dosbox-run.sh --fileio --time 30 game GAME.EXE
python3 tools/dos/fileio_trace.py analysis/dosbox/dosbox.log --game game --file LEVELS.DAT
A program that reads a file field by field shows its record layout in the read sizes:
[2, 1, 4] x 120 (stride 7) is 120 records of a word, a byte and a longint. A 1-byte read
followed by a read of varying length is a Pascal string. This is measured evidence; name the
run (program, inputs, time). With Borland debug symbols, tools/dos/tdinfo.py BINARY types NAME
gives the record type the reader fills, field by field.
Most games pack files into an archive: a header, a table of entries (name or hash, offset, size,
compressed size, flags), then the data. Find the table reader first; then each entry is an
ordinary file. Common compression: zlib/deflate (78 9c), LZ4, zstd (28 b5 2f fd), LZO, LZF,
LZMA, Oodle (Kraken/Mermaid: a proprietary library, look for oo2core DLLs). If the bytes are
encrypted, the key and the algorithm are in the reader: trace them, do not brute-force.
Extract entries into derived/extracted/ (ignored by git), never into tracked folders.
# decoders/units.py
def decode(r): # r is a tools/formats/reader.py Reader
r.magic(b'UNIT')
version = r.u32()
units = []
for _ in range(r.u32()):
u = {'id': r.u32(), 'name': r.pstr32(), 'speed': r.f32()}
if version >= 2:
u['armour'] = r.u16()
units.append(u)
return units
reader.py gives bounds-checked reads (u8 u16 u32 i32 u64 f32 f64 bool bytes cstr pstr8 pstr32 wstr), big-endian reads (u16be i16be u32be i32be f32be) for Amiga, Mac and console
data, variable-length numbers (uleb sleb), bit fields (bits(n), align()), magic(), and block(size) for a length-prefixed section that must be consumed
exactly. Then run it over every file:
.venv/bin/python tools/formats/validate.py decoders/units.py 'derived/extracted/**/*.unit' --show 1
Every file must report complete. A failure says where it stopped and shows the next bytes: a
missed field, a wrong type or a version branch. examples/sample-game/decode_sample.py is a
complete small example.
For editors and mods after the writer, read docs/working/mods.md. Before writing or modding
a file, add encode(result) to the decoder and run the same command
with --write: every file must come back identical, byte for byte. A failure names the first
offset that differs. Keep the stored form beside the friendly view (raw palettes, pools as
stored, unused tails) until it passes (docs/knowhow/writer-round-trip-every-file.md).
Then look at what the decoder found (re-browse). Add images(result) to the decoder when the
format holds pictures, and run the catalogue with it:
python3 tools/formats/catalog.py game derived/catalog --decoder '*.unit=decoders/units.py'
Open derived/catalog/index.html: a wrong width slants a picture, a wrong palette changes its
colours, a misread type shows absurd values. When the port has a viewer, add a view for the
format there too.
Port the decoder to the reimplementation's language as a plain reader with no dependencies, one function per type, documenting each field's meaning and naming the original reader function. Its test opens the real files from the player's game, skips with a message when they are not there (they are never committed), parses every file and spot-checks a known value.
If the project writes the format too (an editor, a mod tool, saves), prove the writer with a round trip: read every file, write it back, and compare the bytes. Each difference is a field the writer loses.
Saves are the strictest test of a format: they hold the whole state of a running game. Find the save function (strings: the save folder, the extension), trace it like a serializer, and decode real saves of different sizes and ages. Saves from an older game version may use older branches: keep them in the corpus. Later, a reimplementation that writes saves must produce files the original game loads.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
16 skills in this plugin
/re-browseBuild and grow a resource viewer for a game - first the catalogue (tools/formats/catalog.py, a static HTML page and JSON manifest of every file, its kind, entropy, hex and what the Python decoders make of it, with pictures), then the project's own viewer app on the port's readers (pictures, palettes, sound, 3D models, text, hex; native and browser; a file output mode for agents). Use at the start of a project, right after the inventory, and after every new decoder, so the person and the agent can check decoded content by looking at it./re-cleanroomRun a source-visible specification and source-blind implementation workflow when a project wants independent reimplementation from a neutral behavior contract./re-emulateRun individual functions from a game's Windows x64 binaries (tools/emu/pe_emu.py), 32-bit x86 Windows binaries (tools/emu/pe32_emu.py) or 16-bit DOS/NE programs (tools/emu/dos_emu/) under the Unicorn emulator to capture exact ground truth for chosen inputs, and record the calls they make (random draws) with call_trace.py. Use for anything a reimplementation must match bit for bit - random number generators, maths, procedural generation, simulation steps, pathfinding, parsers - instead of trusting the pseudocode./re-ghidraDecompile a game's binaries with Ghidra in headless mode and work with the result as text - the full export (decomp.c, functions, strings, imports, exports), queries with decomp_query.py, one-off decompiles of functions Ghidra missed, vtable and reference listings, constants read from the binary, and checks against the disassembly. Use whenever you need pseudocode for a native binary, including 16-bit DOS (MZ) and NE programs./re-inventoryFirst look at a game's files (Windows PE, or DOS MZ/NE/LE executables) - which binaries hold the game's own code, which engine and middleware it uses, whether it is native, managed, scripted or packed, which data containers and save files exist - and record it in docs/FINDINGS.md; then read the manual and the program's long strings into docs/lore.md, which says what each system is for. Use at the start of a project, or when a new binary or file type turns up./re-landFinish a reverse-engineering slice by documenting evidence, updating labels and the checklist, then committing only your own files, merging completed work into local main, and pushing. Never leave completed, merge-ready work uncommitted or waiting to merge.npx claudepluginhub tanepiper/game-frame --plugin gameframeOther plugins' skills for the same job