pufferlib

pufferlib is a skill for Claude Code from K-Dense-AI/scientific-agent-skills. It costs 65 tokens per session (3,259 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 · 44,220 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 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,259 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 9 Apr 2026
  • Snyk pass 9 Apr 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.00065 $0.03259
Opus 5 $0.00032 $0.01630
Sonnet 5 $0.00013 $0.00652
Haiku 4.5 $0.00006 $0.00326

Measured 7d ago against content hash dc920861122e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 7d 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

1 near-identical copy found in the catalogue:

  • pufferlib — 91% identical, 19 lines differ
skills/pufferlib/SKILL.md · 346 lines

How it starts

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

PufferLib

Use PufferLib with an explicit version profile. Upstream currently has two incompatible surfaces:

Profile Status on 2026-07-23 Main use
pufferlib==3.0.0 Latest stable PyPI release, published 2025-06-23 Python/Gymnasium/PettingZoo emulation, pufferlib.vector, Torch PuffeRL
source 4.0 Upstream default branch; not the latest stable PyPI artifact Native C Ocean environments, native CUDA trainer, optional Torch fallback

Do not combine 3.0 imports with 4.0 config/CLI examples. The 4.0 redesign removed the 3.0 emulation, vector, and pytorch modules from the current package tree.

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.

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

Read the full file on GitHub · 346 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. 7d 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 (44,220 stars, last pushed 3d ago), licensed MIT. It adds 65 tokens to every session and 3,259 once invoked, about $0.0003 per session on Opus 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.