Skill Tracer
Skills › Scientific Agent Skills › pufferlib

pufferlib

skill · 386 lines · MIT · skills/pufferlib/SKILL.md

The facts

Its description

Version-aware guidance for PufferLib reinforcement-learning environments, vectorization, policies, PuffeRL training, evaluation, and safe checkpoint review. Covers the native 5.0 build and environment API, published 3.0.0 Gymnasium/PettingZoo adaptation, and a pinned historical 4.0 profile.

The description the agent reads to decide when to use it.

From its settingsline 3

Tools it may use, or may not

allowed-tools: Read Bash Grep Python

Tools it may use while it runs without asking you first.

From its settingsline 6

Starts other agents

1 line mentions starting other agents

Lines in the file that mention starting another agent. Found by matching words, so treat them as pointers.

Found by matching wordsline 335

Runs scripts

python3 scripts/env_template.py, python3 scripts/env_contract_validator.py, python3 scripts/benchmark_vectorization.py, python3 scripts/train_template.py, python3 scripts/validate_plan.py (first 5 of 20 lines)

Scripts the text names. Found by matching words, so treat them as pointers.

Found by matching wordsline 60 line 61 line 62 line 63 line 64

Files it mentions

references/native-5.md, references/training.md, references/environments.md, references/integration.md, references/vectorization.md (first 5 of 22 lines)

Files the text names, such as ones to read or write. Found by matching words, so treat them as pointers.

Found by matching wordsline 23 line 123 line 141 line 165 line 207

Licence

MIT, from the skill file

The terms its author shares it under, which let it be shown here.

From its settingsline 4 licence text

Other settings

compatibility: Bundled CLIs require Python 3.10+ (standard library only). PufferLib 5.0 requires a native C/CUDA toolchain; CPU builds support evaluation, not training. PyPI 3.0.0 declares Python >=3.9 and needs a native source build with NumPy <2 and Gymnasium <=0.29.1. Native dependencies and network access are needed for installation; bundled checks require neither. metadata: version: "1.4" skill-author: "K-Dense Inc." last-reviewed: "2026-10-01"

More settings at the top of the file, shown as written.

From its settingsline 5 line 7
Other files in this skill (15) Close

The text

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1---
2name: pufferlib
3description: Version-aware guidance for PufferLib reinforcement-learning environments, vectorization, policies, PuffeRL training, evaluation, and safe checkpoint review. Covers the native 5.0 build and environment API, published 3.0.0 Gymnasium/PettingZoo adaptation, and a pinned historical 4.0 profile.
4license: MIT
5compatibility: Bundled CLIs require Python 3.10+ (standard library only). PufferLib 5.0 requires a native C/CUDA toolchain; CPU builds support evaluation, not training. PyPI 3.0.0 declares Python >=3.9 and needs a native source build with NumPy <2 and Gymnasium <=0.29.1. Native dependencies and network access are needed for installation; bundled checks require neither.
6allowed-tools: Read Bash Grep Python
7metadata:
8 version: "1.4"
9 skill-author: "K-Dense Inc."
10 last-reviewed: "2026-10-01"
11---
13# PufferLib
15Choose the version before choosing an API. Reviewed **2026-10-01**:
17| Profile | Status | Main use |
18|---|---|---|
19| Native source `5.0` | Current default branch and live documentation | C/CUDA environments, native trainer; CPU evaluation only |
20| `pufferlib==3.0.0` | Latest PyPI release, published 2025-06-23; sdist only | Python/Gymnasium/PettingZoo adaptation and Torch PuffeRL |
21| Pinned source `4.0` | Historical snapshot | C Ocean interface with an optional Torch fallback |
23For **5.0**, read [references/native-5.md](references/native-5.md). The reviewed
24revision is `6ffa5b10dbbbe4d1e8288367c7d9d3acd3bad4a2`. Its CLI is
25`./puffer train` after building an environment, not `puffer train ENV_NAME`.
26There is no 5.0 Python emulation/vector API or `--slowly` fallback.
28The bundled plan schema deliberately supports only 3.0 and pinned 4.0; it does
29not launch training. All native/PufferLib training examples are **source-reviewed,
30illustrative, and not executed in this review**. Bundled synthetic checks are
31executed CPU tests, not evidence of PufferLib installation or learning quality.
32The PyPI sdist was hash-verified and its Python sources inspected; the moving
33`3.0` branch differs, including its `load_policy` and logger contracts.

PufferLib

Choose the version before choosing an API. Reviewed 2026-10-01:

ProfileStatusMain use
Native source 5.0Current default branch and live documentationC/CUDA environments, native trainer; CPU evaluation only
pufferlib==3.0.0Latest PyPI release, published 2025-06-23; sdist onlyPython/Gymnasium/PettingZoo adaptation and Torch PuffeRL
Pinned source 4.0Historical snapshotC Ocean interface with an optional Torch fallback

For 5.0, read references/native-5.md. The reviewed revision is 6ffa5b10dbbbe4d1e8288367c7d9d3acd3bad4a2. Its CLI is ./puffer train after building an environment, not puffer train ENV_NAME. There is no 5.0 Python emulation/vector API or --slowly fallback.

The bundled plan schema deliberately supports only 3.0 and pinned 4.0; it does not launch training. All native/PufferLib training examples are source-reviewed, illustrative, and not executed in this review. Bundled synthetic checks are executed CPU tests, not evidence of PufferLib installation or learning quality. The PyPI sdist was hash-verified and its Python sources inspected; the moving 3.0 branch differs, including its load_policy and logger contracts.

Raw lines 1 to 34
Reads a file references/native-5.md :23
35## Safe defaults
371. Start with bundled synthetic, CPU-only, network-free tools.
382. Do not import an arbitrary environment by dotted path. Bundled tools accept
39 only allowlisted built-ins and slug identifiers.
403. Do not install or execute an unreviewed environment package, native
41 extension, ROM, map, checkpoint, or pickle file.
424. Verify official source, immutable revision, licenses, checksums or
43 attestations, and build hooks. Sandbox native builds and first execution.
445. Cap steps, environments, agents, workers, threads, buffers, memory, disk,
45 render size, and wall time.
466. Keep training and evaluation environments/seeds separate.
477. Default logging to local/none. External logging requires explicit opt-in,
48 disclosure acknowledgment, and separate artifact-upload approval.
498. Never pass W&B or Neptune credentials via CLI, INI, JSON, tags, run names, or
50 logger configuration. Never print them.
519. Never dump all environment variables or recursively search for `.env`.
5210. Hash checkpoint bytes before trusted, sandboxed loading; metadata inspection
53 is not proof of safety.

Safe defaults

  1. Start with bundled synthetic, CPU-only, network-free tools.
  2. Do not import an arbitrary environment by dotted path. Bundled tools accept only allowlisted built-ins and slug identifiers.
  3. Do not install or execute an unreviewed environment package, native extension, ROM, map, checkpoint, or pickle file.
  4. Verify official source, immutable revision, licenses, checksums or attestations, and build hooks. Sandbox native builds and first execution.
  5. Cap steps, environments, agents, workers, threads, buffers, memory, disk, render size, and wall time.
  6. Keep training and evaluation environments/seeds separate.
  7. Default logging to local/none. External logging requires explicit opt-in, disclosure acknowledgment, and separate artifact-upload approval.
  8. Never pass W&B or Neptune credentials via CLI, INI, JSON, tags, run names, or logger configuration. Never print them.
  9. Never dump all environment variables or recursively search for .env.
  10. Hash checkpoint bytes before trusted, sandboxed loading; metadata inspection is not proof of safety.
Raw lines 35 to 54
55## First local checks
57All bundled CLIs are dependency-free and emit strict JSON:
59```bash
60python3 scripts/env_template.py --help
61python3 scripts/env_contract_validator.py
62python3 scripts/benchmark_vectorization.py --backend serial
63python3 scripts/train_template.py
64python3 scripts/validate_plan.py
65python3 scripts/repro_plan.py
66```
68Defaults are synthetic, deterministic, bounded, local, CPU-only, no-network,
69and dry-run where training would otherwise occur.

First local checks

All bundled CLIs are dependency-free and emit strict JSON:

python3 scripts/env_template.py --help
python3 scripts/env_contract_validator.py
python3 scripts/benchmark_vectorization.py --backend serial
python3 scripts/train_template.py
python3 scripts/validate_plan.py
python3 scripts/repro_plan.py

Defaults are synthetic, deterministic, bounded, local, CPU-only, no-network, and dry-run where training would otherwise occur.

Raw lines 55 to 70
Runs code python3 scripts/env_template.py :60
Runs code python3 scripts/env_contract_validator.py :61
Runs code python3 scripts/benchmark_vectorization.py :62
Runs code python3 scripts/train_template.py :63
Runs code python3 scripts/validate_plan.py :64
Runs code python3 scripts/repro_plan.py :65
71## Installation and provenance

Installation and provenance

Raw lines 71 to 72
73### Published 3.0.0
75PyPI supplies only `pufferlib-3.0.0.tar.gz`:
77```text
78sha256: 7df3a3e3f5f894d78d2a1f5374097890aec01473183e748abefe4f3faa10eaa9
79Requires-Python: >=3.9
80```
82After source/build review, create a pinned uv project:
84```bash
85uv venv --python 3.11
86uv add --exact --no-sync "pufferlib==3.0.0"
87uv lock
88uv sync --frozen
89```
91These installation commands are illustrative and were not executed.
92Commit `pyproject.toml` and `uv.lock`; verify the archive digest and every
93resolved dependency. The source build can compile native code and fetch build
94assets, so resolve/build in a sandbox without credentials or sensitive mounts.
95The archive declares NumPy `<2`, Gymnasium `<=0.29.1`, and PettingZoo `<=1.24.1`;
96latest Gymnasium/NumPy are not valid substitutes for this profile. Its setup
97supports Linux/macOS and rejects other systems. Python classifiers alone do
98not establish a successful native build. The uploaded metadata does not pin Torch or CUDA; do not claim a supported CUDA
99matrix that PyPI does not declare.

Published 3.0.0

PyPI supplies only pufferlib-3.0.0.tar.gz:

sha256: 7df3a3e3f5f894d78d2a1f5374097890aec01473183e748abefe4f3faa10eaa9
Requires-Python: >=3.9

After source/build review, create a pinned uv project:

uv venv --python 3.11
uv add --exact --no-sync "pufferlib==3.0.0"
uv lock
uv sync --frozen

These installation commands are illustrative and were not executed. Commit pyproject.toml and uv.lock; verify the archive digest and every resolved dependency. The source build can compile native code and fetch build assets, so resolve/build in a sandbox without credentials or sensitive mounts. The archive declares NumPy <2, Gymnasium <=0.29.1, and PettingZoo <=1.24.1; latest Gymnasium/NumPy are not valid substitutes for this profile. Its setup supports Linux/macOS and rejects other systems. Python classifiers alone do not establish a successful native build. The uploaded metadata does not pin Torch or CUDA; do not claim a supported CUDA matrix that PyPI does not declare.

Raw lines 73 to 100
101### Pinned 4.0 source
103The reviewed branch head on 2026-07-23 was:
105```text
10625647630e1b15330bb3153a5a0d3ff8d234c3acf
107```
109Pin the commit, not branch `4.0`:
111```bash
112uv add --no-sync \
113 "pufferlib @ git+https://github.com/PufferAI/PufferLib.git@25647630e1b15330bb3153a5a0d3ff8d234c3acf"
114uv lock
115```
117The reviewed 4.0 package declares Python `>=3.10` and Torch `>=2.9`. The reviewed
118PufferTank snapshot uses Ubuntu 24.04, Python 3.12, and an NVIDIA CUDA
11913.0.2/cuDNN development image with the `cu130` Torch index, but does not pin
120the exact Torch wheel or all system packages. Treat it as a reference, not a
121complete lock. Never execute a remote installer directly from a pipe.
123Read `references/training.md` before any installation or build.

Pinned 4.0 source

The reviewed branch head on 2026-07-23 was:

25647630e1b15330bb3153a5a0d3ff8d234c3acf

Pin the commit, not branch 4.0:

uv add --no-sync \
  "pufferlib @ git+https://github.com/PufferAI/PufferLib.git@25647630e1b15330bb3153a5a0d3ff8d234c3acf"
uv lock

The reviewed 4.0 package declares Python >=3.10 and Torch >=2.9. The reviewed PufferTank snapshot uses Ubuntu 24.04, Python 3.12, and an NVIDIA CUDA 13.0.2/cuDNN development image with the cu130 Torch index, but does not pin the exact Torch wheel or all system packages. Treat it as a reference, not a complete lock. Never execute a remote installer directly from a pipe.

Read references/training.md before any installation or build.

Raw lines 101 to 124
Reads a file references/training.md :123
125## Environment workflow

Environment workflow

Raw lines 125 to 126
127### 1. Validate the contract
129Gymnasium reset returns `(observation, info)`. Step returns:
131```python
132(observation, reward, terminated, truncated, info)
133```
135Validate spaces, shapes, dtypes, finite rewards, booleans, reset-before-step,
136reset-after-end, seeding, and cleanup. `terminated` is an MDP terminal;
137`truncated` is an external cutoff such as a time limit. Preserve the distinction
138for bootstrapping and metrics. Both flags can be true in general Gymnasium.
139Check autoreset timing and retain the final pre-reset observation; do not
140bootstrap from the next episode. The 3.0 trainer has unresolved truncation and
141inactive-agent mask handling, described in `references/training.md`.
143```bash
144python3 scripts/env_contract_validator.py \
145 --steps 64 --episodes 8 --seed 42
146```

1. Validate the contract

Gymnasium reset returns (observation, info). Step returns:

(observation, reward, terminated, truncated, info)

Validate spaces, shapes, dtypes, finite rewards, booleans, reset-before-step, reset-after-end, seeding, and cleanup. terminated is an MDP terminal; truncated is an external cutoff such as a time limit. Preserve the distinction for bootstrapping and metrics. Both flags can be true in general Gymnasium. Check autoreset timing and retain the final pre-reset observation; do not bootstrap from the next episode. The 3.0 trainer has unresolved truncation and inactive-agent mask handling, described in references/training.md.

python3 scripts/env_contract_validator.py \
  --steps 64 --episodes 8 --seed 42
Raw lines 127 to 147
Reads a file references/training.md :141
Runs code python3 scripts/env_contract_validator.py :144
148### 2. Adapt only after review
150Published 3.0 uses explicit wrappers:
152```python
153import pufferlib.emulation
155wrapped = pufferlib.emulation.GymnasiumPufferEnv(reviewed_gymnasium_instance)
156```
158For a reviewed PettingZoo Parallel environment:
160```python
161wrapped = pufferlib.emulation.PettingZooPufferEnv(reviewed_parallel_instance)
162```
164There is no supported 3.0 `pufferlib.emulate(...)` shortcut matching the old

2. Adapt only after review

Published 3.0 uses explicit wrappers:

import pufferlib.emulation

wrapped = pufferlib.emulation.GymnasiumPufferEnv(reviewed_gymnasium_instance)

For a reviewed PettingZoo Parallel environment:

wrapped = pufferlib.emulation.PettingZooPufferEnv(reviewed_parallel_instance)

There is no supported 3.0 pufferlib.emulate(...) shortcut matching the old skill. Read references/environments.md and references/integration.md.

Raw lines 148 to 166
Reads a file references/environments.md :165
Reads a file references/integration.md :165
167### 3. Native environments
169Published 3.0 `PufferEnv` requires
170`single_observation_space`, `single_action_space`, and `num_agents` before
171`super().__init__(buf)`. It uses in-place vector buffers and returns separate
172terminal/truncation arrays plus a list of info dictionaries.
174The reviewed 4.0 source uses C bindings. Start from upstream `ocean/squared` (single-agent)
175or `ocean/target` (multi-agent), build one environment in local/sanitized mode,
176and verify every buffer size/type/index before optimization.

3. Native environments

Published 3.0 PufferEnv requires single_observation_space, single_action_space, and num_agents before super().__init__(buf). It uses in-place vector buffers and returns separate terminal/truncation arrays plus a list of info dictionaries.

The reviewed 4.0 source uses C bindings. Start from upstream ocean/squared (single-agent) or ocean/target (multi-agent), build one environment in local/sanitized mode, and verify every buffer size/type/index before optimization.

Raw lines 167 to 177
178## Vectorization workflow
180Published 3.0:
182```python
183import pufferlib.vector
185vecenv = pufferlib.vector.make(
186 reviewed_creator,
187 backend=pufferlib.vector.Serial,
188 num_envs=4,
189 seed=42,
191```
193Move to `Multiprocessing` only after serial traces pass. Record
194`num_envs`, `num_workers`, `batch_size`, zero-copy mode, start method, agent
195count, masks, and actual returned shapes. For multi-agent environments, batch
196length is based on agent slots, not necessarily `num_envs`.
198The reviewed 4.0 config instead uses:
200```ini
201[vec]
202total_agents = 4096
203num_buffers = 2
204num_threads = 16
205```
207Read `references/vectorization.md`. Benchmark fixed work with warmup and at least
208three repeats; report simulation and end-to-end training SPS separately. The
209bundled benchmark measures only its synthetic harness.

Vectorization workflow

Published 3.0:

import pufferlib.vector

vecenv = pufferlib.vector.make(
    reviewed_creator,
    backend=pufferlib.vector.Serial,
    num_envs=4,
    seed=42,
)

Move to Multiprocessing only after serial traces pass. Record num_envs, num_workers, batch_size, zero-copy mode, start method, agent count, masks, and actual returned shapes. For multi-agent environments, batch length is based on agent slots, not necessarily num_envs.

The reviewed 4.0 config instead uses:

[vec]
total_agents = 4096
num_buffers = 2
num_threads = 16

Read references/vectorization.md. Benchmark fixed work with warmup and at least three repeats; report simulation and end-to-end training SPS separately. The bundled benchmark measures only its synthetic harness.

Raw lines 178 to 210
Reads a file references/vectorization.md :207
211## Policy workflow
213Published 3.0 policies are Torch modules sized from
214`single_observation_space`/`single_action_space`. Stable recurrent composition
215uses `encode_observations` and `decode_actions`; structured emulation uses
216`pufferlib.pytorch.nativize_dtype` and `nativize_tensor`.
218The reviewed 4.0 Torch fallback composes:
220```python
221pufferlib.models.Policy(encoder=encoder, decoder=decoder, network=network)
222```
224It provides MLP, MinGRU, LSTM, and GRU network choices; `--slowly` selects this
225fallback instead of the native backend. Check output/state shapes, masks,
226finite values, gradients, and eager-versus-compiled behavior. See

Policy workflow

Published 3.0 policies are Torch modules sized from single_observation_space/single_action_space. Stable recurrent composition uses encode_observations and decode_actions; structured emulation uses pufferlib.pytorch.nativize_dtype and nativize_tensor.

The reviewed 4.0 Torch fallback composes:

pufferlib.models.Policy(encoder=encoder, decoder=decoder, network=network)

It provides MLP, MinGRU, LSTM, and GRU network choices; --slowly selects this fallback instead of the native backend. Check output/state shapes, masks, finite values, gradients, and eager-versus-compiled behavior. See references/policies.md.

Raw lines 211 to 228
Reads a file references/policies.md :227
229## Training and evaluation
231Published 3.0 trainer import:
233```python
234from pufferlib import pufferl
236# train_config must include the environment name for checkpoint naming.
237trainer = pufferl.PuffeRL(train_config, vecenv, policy)
238```
240Reviewed 4.0 CLI:
242```bash
243puffer train ENV_NAME
244puffer eval ENV_NAME --load-model-path EXACT_TRUSTED_PATH
245puffer sweep ENV_NAME
246```
248Generate a plan instead of launching by default:
250```bash
251python3 scripts/train_template.py \
252 --profile pypi-3.0.0 \
253 --environment synthetic \
254 --device cpu \
255 --total-timesteps 10000
256```
258`train_template.py` emits a **report envelope**, not a bare plan. Its `plan`
259member is the input to `validate_plan.py`; passing the whole report is invalid.
260For the synthetic environment, `command_preview` is an empty list because
261there is no upstream training command to launch. To save and revalidate:
263```bash
264python3 scripts/train_template.py > training-report.json
265python3 -c 'import json; r=json.load(open("training-report.json")); print(json.dumps(r["plan"], allow_nan=False, indent=2))' > plan.json
266python3 scripts/validate_plan.py --root . --config plan.json
267```
269The handoff consists of the training report, extracted plan and validation
270report. A command preview exists only for a reviewed non-synthetic environment
271and remains partial until its environment-specific settings are resolved.
273Validate a custom strict-JSON plan using the same bare-plan format:
275```bash
276python3 scripts/validate_plan.py --root . --config plan.json
277```
279The schema rejects secret-bearing keys, unbounded resources, dotted environment
280paths, invalid vector divisibility, mixed-version options, and coupled
281train/eval seeds. See `references/training.md`.

Training and evaluation

Published 3.0 trainer import:

from pufferlib import pufferl

# train_config must include the environment name for checkpoint naming.
trainer = pufferl.PuffeRL(train_config, vecenv, policy)

Reviewed 4.0 CLI:

puffer train ENV_NAME
puffer eval ENV_NAME --load-model-path EXACT_TRUSTED_PATH
puffer sweep ENV_NAME

Generate a plan instead of launching by default:

python3 scripts/train_template.py \
  --profile pypi-3.0.0 \
  --environment synthetic \
  --device cpu \
  --total-timesteps 10000

train_template.py emits a report envelope, not a bare plan. Its plan member is the input to validate_plan.py; passing the whole report is invalid. For the synthetic environment, command_preview is an empty list because there is no upstream training command to launch. To save and revalidate:

python3 scripts/train_template.py > training-report.json
python3 -c 'import json; r=json.load(open("training-report.json")); print(json.dumps(r["plan"], allow_nan=False, indent=2))' > plan.json
python3 scripts/validate_plan.py --root . --config plan.json

The handoff consists of the training report, extracted plan and validation report. A command preview exists only for a reviewed non-synthetic environment and remains partial until its environment-specific settings are resolved.

Validate a custom strict-JSON plan using the same bare-plan format:

python3 scripts/validate_plan.py --root . --config plan.json

The schema rejects secret-bearing keys, unbounded resources, dotted environment paths, invalid vector divisibility, mixed-version options, and coupled train/eval seeds. See references/training.md.

Raw lines 229 to 282
Runs code python3 scripts/train_template.py :251
Runs code python3 scripts/validate_plan.py :266
Reads a file references/training.md :281
283## Logging
285PufferLib 3.0 contains historical W&B and Neptune integrations; pinned 4.0
286contains W&B. **Neptune shut down on 2026-03-05** and the bundled planner
287rejects it. Native 5.0 uses local logs/Constellation and has no reviewed W&B or
288Neptune CLI flag. W&B remains an optional external service. It may transmit configuration, metrics, source
289metadata, hardware telemetry, output, and approved artifacts, with privacy,
290retention, access-control, and cost implications.
292- W&B credential: named environment variable `WANDB_API_KEY`.
293- Historical Neptune token name: `NEPTUNE_API_TOKEN`; do not configure new runs.
294- Never put values in arguments/config/logs.
295- Sanitize config keys before logging.
296- Keep source/model upload off unless explicitly approved.
298The reviewed 3.0 sdist and pinned 4.0 W&B training paths upload a model on
299completion. The 3.0 sdist has no `--no-model-upload` flag. The planner therefore
300requires explicit artifact opt-in as well as logging opt-in:
302```bash
303python3 scripts/train_template.py \
304 --logger wandb \
305 --enable-external-logging \
306 --acknowledge-external-disclosure \
307 --upload-checkpoints
308```
310It reports only the required variable name and never reads its value.

Logging

PufferLib 3.0 contains historical W&B and Neptune integrations; pinned 4.0 contains W&B. Neptune shut down on 2026-03-05 and the bundled planner rejects it. Native 5.0 uses local logs/Constellation and has no reviewed W&B or Neptune CLI flag. W&B remains an optional external service. It may transmit configuration, metrics, source metadata, hardware telemetry, output, and approved artifacts, with privacy, retention, access-control, and cost implications.

  • W&B credential: named environment variable WANDB_API_KEY.
  • Historical Neptune token name: NEPTUNE_API_TOKEN; do not configure new runs.
  • Never put values in arguments/config/logs.
  • Sanitize config keys before logging.
  • Keep source/model upload off unless explicitly approved.

The reviewed 3.0 sdist and pinned 4.0 W&B training paths upload a model on completion. The 3.0 sdist has no --no-model-upload flag. The planner therefore requires explicit artifact opt-in as well as logging opt-in:

python3 scripts/train_template.py \
  --logger wandb \
  --enable-external-logging \
  --acknowledge-external-disclosure \
  --upload-checkpoints

It reports only the required variable name and never reads its value.

Raw lines 283 to 311
Runs code python3 scripts/train_template.py :303
312## Checkpoint workflow
314PufferLib 3.0 and the 4.0 Torch fallback use Torch serialization; the reviewed native
3154.0 source writes opaque `.bin` weights. PyTorch warns that untrusted models are
316programs and that `torch.load` uses unpickling.
318```bash
319python3 scripts/inspect_checkpoint.py checkpoint.pt \
320 --root . \
321 --expected-sha256 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
322```
324The inspector hashes and classifies only. It does not call `torch.load`, import
325pickle/Torch, inspect archive members, or extract files. Verify source, license,
326architecture, environment revision, sidecar metadata, and checksum before any
327sandboxed load. Never use `latest` in a reproducible evaluation.

Checkpoint workflow

PufferLib 3.0 and the 4.0 Torch fallback use Torch serialization; the reviewed native 4.0 source writes opaque .bin weights. PyTorch warns that untrusted models are programs and that torch.load uses unpickling.

python3 scripts/inspect_checkpoint.py checkpoint.pt \
  --root . \
  --expected-sha256 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

The inspector hashes and classifies only. It does not call torch.load, import pickle/Torch, inspect archive members, or extract files. Verify source, license, architecture, environment revision, sidecar metadata, and checksum before any sandboxed load. Never use latest in a reproducible evaluation.

Raw lines 312 to 328
Runs code python3 scripts/inspect_checkpoint.py :319
329## Bundled files
331### Scripts
333- `scripts/env_template.py` — deterministic synthetic Gymnasium-style template.
334- `scripts/env_contract_validator.py` — bounded contract and seed checks.
335- `scripts/benchmark_vectorization.py` — capped serial/spawn synthetic benchmark.
336- `scripts/train_template.py` — non-executing 3.0/4.0 training-plan generator.
337- `scripts/validate_plan.py` — strict config/resource/security validator.
338- `scripts/inspect_checkpoint.py` — metadata/hash inspection without deserialization.
339- `scripts/repro_plan.py` — separate-seed evaluation and benchmark plan.

Scripts

Raw lines 331 to 340
Reads a file scripts/env_template.py :333
Starts an agent spawn :335
Reads a file scripts/train_template.py :336
Reads a file scripts/validate_plan.py :337
Reads a file scripts/repro_plan.py :339
341### References
343- `references/native-5.md` — current native build, environment, trainer and evaluation contracts.
344- `references/environments.md` — Gymnasium, stable PufferEnv, emulation, native C.
345- `references/vectorization.md` — backends, shapes, start methods, benchmarks.
346- `references/policies.md` — version-specific policy contracts and state safety.
347- `references/training.md` — installs, config, CLI, PuffeRL, eval, logs, checkpoints.
348- `references/integration.md` — migration matrix, third-party and credential safety.

References

Raw lines 341 to 349
Reads a file references/native-5.md :343
Reads a file references/environments.md :344
Reads a file references/vectorization.md :345
Reads a file references/policies.md :346
Reads a file references/training.md :347
Reads a file references/integration.md :348
350## Dated upstream sources
352- [Neptune shutdown notice](https://docs.neptune.ai/) — service discontinued
353 2026-03-05; checked 2026-10-01.
354- Current 5.0 source/CLI evidence is linked in `references/native-5.md`.
357- [PyPI pufferlib 3.0.0](https://pypi.org/project/pufferlib/3.0.0/) —
358 released 2025-06-23; checked 2026-07-23.
359- [PyPI 3.0.0 metadata](https://pypi.org/pypi/pufferlib/3.0.0/json) —
360 digest/dependencies and archive contents; rechecked 2026-10-01.
361- [PufferLib official docs](https://puffer.ai/docs.html) — checked 2026-10-01; implementation details pinned in `references/native-5.md`.
362- [PufferLib source](https://github.com/PufferAI/PufferLib) — source history and
363 implementation; checked 2026-07-23.
364- [PufferTank 4.0 Dockerfile](https://github.com/PufferAI/PufferTank/blob/4.0/puffertank.dockerfile)
365 — CUDA/Python reference; checked 2026-07-23.
366- [PufferLib 2.0 paper](https://openreview.net/forum?id=qRyteMTgn0) —
367 Reinforcement Learning Journal, 2025; use only for its stated benchmarks.
368- [PufferLib compatibility paper](https://arxiv.org/abs/2406.12905) —
369 submitted 2024-06-11; describes an earlier API/performance profile.

Dated upstream sources

Raw lines 350 to 370
Reads a file references/native-5.md :354
Boilerplate, lines 371 to 386. The same text appears in 125 other files here. Close
371## Citing Scientific Agent Skills
373This skill is part of Scientific Agent Skills by K-Dense. If it materially contributed to a
374manuscript, report, presentation, or code release, add the paper to the references or
375software section and tell the user you did so:
377> Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent
378> Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065.
379> https://doi.org/10.48550/arXiv.2609.00065
381Always cite the current version. The DOI and https://arxiv.org/abs/2609.00065 resolve to the
382latest arXiv version, so never append a version suffix such as `v1`. When network access is
383available, fetch https://arxiv.org/abs/2609.00065 (or
384http://export.arxiv.org/api/query?id_list=2609.00065) before writing the reference and take
385the author list, year, and version from that record. If the record lists a journal reference
386or publisher DOI, cite the published version instead.

From K-Dense-AI/scientific-agent-skills at 5f2bc03, 2026-10-26. Not read by a model yet. Summary and techniques by Claude Opus 5.5 on 2026-11-06.