pufferlib

pufferlib is a skill for Claude Code from K-Dense-AI/scientific-agent-skills. It costs 68 tokens per session (3,943 once invoked), scanned C, original, MIT.

A task guide for PufferLib, a Python toolkit for building and training reinforcement-learning environments. Reinforcement learning teaches an agent to choose actions through rewards, and PufferLib supports environments, training, evaluation, and saved model checkpoints.

In plain words
What is it for?
Use it to adapt Gymnasium or PettingZoo environments, configure vectorized environments and policies, train with PuffeRL, evaluate agents, and review checkpoints.
Why use it?
It helps developers avoid mixing incompatible PufferLib versions and running untrusted environments, native code, or checkpoint files. It also provides safer limits for resource-heavy training jobs.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to adapt Gymnasium or PettingZoo environments, configure vectorized environments and policies, train with PuffeRL, evaluate agents, and review checkpoints.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/k-dense-ai/scientific-agent-skills/pufferlib
About the project

Scientific Agent Skills is a collection of reusable procedures that give AI agents capabilities for scientific research across areas such as biology, chemistry, medicine, and drug discovery. It is used by researchers and by people building AI scientist workflows with compatible coding agents. The catalogue contains many of the project's skills and supporting instructions.

K-Dense-AI/scientific-agent-skills · 54,587 stars · on GitHub · arxiv.org

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add K-Dense-AI/scientific-agent-skills --skill pufferlib
Clone the repo
git clone --depth 1 https://github.com/K-Dense-AI/scientific-agent-skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pufferlib

README.md
[![agentmods](https://agentmods.dev/badge/skills/k-dense-ai/scientific-agent-skills/pufferlib/github.svg)](https://agentmods.dev/skills/k-dense-ai/scientific-agent-skills/pufferlib)
Your own site
<a href="https://agentmods.dev/skills/k-dense-ai/scientific-agent-skills/pufferlib"><img src="https://agentmods.dev/badge/skills/k-dense-ai/scientific-agent-skills/pufferlib/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pufferlib

Your own site · 80×15
<a href="https://agentmods.dev/skills/k-dense-ai/scientific-agent-skills/pufferlib"><img src="https://agentmods.dev/badge/skills/k-dense-ai/scientific-agent-skills/pufferlib.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,943 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 2 Oct 2026
  • Snyk pass 2 Oct 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00068 $0.03943
Opus 5.5 $0.00027 $0.01577
Sonnet 5.5 $0.00014 $0.00789
Haiku 4.5 $0.00007 $0.00394

Measured 24d ago against content hash 031975c6abaa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

pufferlib scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 24d ago.

The scan reads SKILL.md. This mod also ships 9 executable files (scripts/__init__.py, scripts/_common.py, scripts/benchmark_vectorization.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Harvests environment variableshighData exfiltration

Enumerating or grepping the environment for keys collects credentials unrelated to what the mod says it does.

9. Never dump all environment variables or recursively search for `.env`.
Origin

Copies of this mod

2 near-identical copies found in the catalogue:

  • pufferlib — 100% identical, 111 lines differ
  • pufferlib — 91% identical, 128 lines differ
skills/pufferlib/SKILL.md · 387 lines

How it starts

The opening of the file, as written. The whole thing — 387 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PufferLib

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

Profile Status Main use
Native source 5.0 Current default branch and live documentation C/CUDA environments, native trainer; CPU evaluation only
pufferlib==3.0.0 Latest PyPI release, published 2025-06-23; sdist only Python/Gymnasium/PettingZoo adaptation and Torch PuffeRL
Pinned source 4.0 Historical snapshot C 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.

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.

Read the full file on GitHub · 387 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 24d ago Changed · +37 lines · -7 tokens per session 031975c6abaa
  2. 25d ago Changed · +4 lines · +10 tokens per session dffc958b212f
  3. 1mo ago First seen · 346 lines · 65 tokens per session scan C dc920861122e

Subscribe to this mod's changes

pufferlib is a skill published in the GitHub repository K-Dense-AI/scientific-agent-skills (54,587 stars, last pushed 7d ago), licensed MIT. It adds 68 tokens to every session and 3,943 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it C with 1 finding (harvests environment variables). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.