PTWM

Extensions

Add new codecs, transforms, classifiers, and more as signed bundles — without modifying PTWM core.

PTWM has a native multi-language extension system. New codecs, preprocessing transforms, classifiers, scoring functions, and more can be added as separate signed bundles in WASM, native cdylib, or Python host form, without modifying PTWM core.

Full design and ABI reference:

For researchers

Install the extension-development extras and scaffold a new contribution:

pip install ptwm[ext-dev]
ptwm ext init my-codec --lang rust --kind plane_codec
cd my-codec
ptwm ext build
ptwm ext sign --key ~/.ptwm/keys/mykey.priv
ptwm ext pack

ptwm ext init generates a Rust (or Python) skeleton with the correct ABI stubs, a ptwm-ext.toml manifest, and a test harness. ptwm ext build compiles to WASM and native cdylib; ptwm ext sign attaches an Ed25519 signature; ptwm ext pack produces a .tar.zst bundle ready for distribution.

For operators

Install an extension and verify it is active:

ptwm trust add --bundled                   # one-time consent to the bundled keyring
ptwm ext install ./my-codec-0.1.0.tar.zst  # or https://, oci://, git+SHA, or pip name
ptwm ext list                              # confirm

Only contributions whose signatures chain to a trusted key are loaded. The ptwm trust sub-commands manage the user's accepted keyring.

Ablation

The extension system integrates with the benchmark tooling so that individual contributions can be isolated and attributed:

ptwm bench compress model.bin \
    --baseline policies/baseline.toml \
    --variant policies/no-huffman.toml \
    --trials 3 --out bench-out/
ptwm bench attribute model.bin --leave-one-out --out attr-out/

--leave-one-out runs N+1 compressions (one full, one per active contribution disabled) and reports the marginal ratio contribution of each extension.