[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EJ6AAZGHFNVF0F5SZBPCY2":3,"skill-same:01M6EJ6AAZGHFNVF0F5SZBPCY2":126},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6EJ6AAZGHFNVF0F5SZBPCY2","pufferlib",null,"High-performance reinforcement learning framework optimized for speed and scale. Use when you need fast parallel training, vectorized environments, multi-agent systems, or integration with game environments (Atari, Procgen, NetHack). Achieves 2-10x speedups over standard implementations. For quick prototyping or standard algorithm implementations with extensive documentation, use stable-baselines3 instead.","levalencia\u002Fagent-god-mode","levalencia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6962857?v=4","01M6EB0FZZ4BPQPC4HET4QY6NM","Luis Valencia ","01M6EB0G4HWHPWW0H9X7QKSAHP",3,"MIT","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[5,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"multi-agent","multi","prototyping","scale","high-performance","systems","reinforcement","speed","use","parallel","performance","game","learning","fast","integration","vectorized","reinforcement learning","training","documentation","2026-11-10 10:12:30",false,"---\nname: pufferlib\ndescription: High-performance reinforcement learning framework optimized for speed and scale. Use when you need fast parallel training, vectorized environments, multi-agent systems, or integration with game environments (Atari, Procgen, NetHack). Achieves 2-10x speedups over standard implementations. For quick prototyping or standard algorithm implementations with extensive documentation, use stable-baselines3 instead.\nlicense: MIT license\nmetadata:\n    skill-author: K-Dense Inc.\n---\n\n# PufferLib - High-Performance Reinforcement Learning\n\n## Overview\n\nPufferLib is a high-performance reinforcement learning library designed for fast parallel environment simulation and training. It achieves training at millions of steps per second through optimized vectorization, native multi-agent support, and efficient PPO implementation (PuffeRL). The library provides the Ocean suite of 20+ environments and seamless integration with Gymnasium, PettingZoo, and specialized RL frameworks.\n\n## When to Use This Skill\n\nUse this skill when:\n- **Training RL agents** with PPO on any environment (single or multi-agent)\n- **Creating custom environments** using the PufferEnv API\n- **Optimizing performance** for parallel environment simulation (vectorization)\n- **Integrating existing environments** from Gymnasium, PettingZoo, Atari, Procgen, etc.\n- **Developing policies** with CNN, LSTM, or custom architectures\n- **Scaling RL** to millions of steps per second for faster experimentation\n- **Multi-agent RL** with native multi-agent environment support\n\n## Core Capabilities\n\n### 1. High-Performance Training (PuffeRL)\n\nPuffeRL is PufferLib's optimized PPO+LSTM training algorithm achieving 1M-4M steps\u002Fsecond.\n\n**Quick start training:**\n```bash\n# CLI training\npuffer train procgen-coinrun --train.device cuda --train.learning-rate 3e-4\n\n# Distributed training\ntorchrun --nproc_per_node=4 train.py\n```\n\n**Python training loop:**\n```python\nimport pufferlib\nfrom pufferlib import PuffeRL\n\n# Create vectorized environment\nenv = pufferlib.make('procgen-coinrun', num_envs=256)\n\n# Create trainer\ntrainer = PuffeRL(\n    env=env,\n    policy=my_policy,\n    device='cuda',\n    learning_rate=3e-4,\n    batch_size=32768\n)\n\n# Training loop\nfor iteration in range(num_iterations):\n    trainer.evaluate()  # Collect rollouts\n    trainer.train()     # Train on batch\n    trainer.mean_and_log()  # Log results\n```\n\n**For comprehensive training guidance**, read `references\u002Ftraining.md` for:\n- Complete training workflow and CLI options\n- Hyperparameter tuning with Protein\n- Distributed multi-GPU\u002Fmulti-node training\n- Logger integration (Weights & Biases, Neptune)\n- Checkpointing and resume training\n- Performance optimization tips\n- Curriculum learning patterns\n\n### 2. Environment Development (PufferEnv)\n\nCreate custom high-performance environments with the PufferEnv API.\n\n**Basic environment structure:**\n```python\nimport numpy as np\nfrom pufferlib import PufferEnv\n\nclass MyEnvironment(PufferEnv):\n    def __init__(self, buf=None):\n        super().__init__(buf)\n\n        # Define spaces\n        self.observation_space = self.make_space((4,))\n        self.action_space = self.make_discrete(4)\n\n        self.reset()\n\n    def reset(self):\n        # Reset state and return initial observation\n        return np.zeros(4, dtype=np.float32)\n\n    def step(self, action):\n        # Execute action, compute reward, check done\n        obs = self._get_observation()\n        reward = self._compute_reward()\n        done = self._is_done()\n        info = {}\n\n        return obs, reward, done, info\n```\n\n**Use the template script:** `scripts\u002Fenv_template.py` provides complete single-agent and multi-agent environment templates with examples of:\n- Different observation space types (vector, image, dict)\n- Action space variations (discrete, continuous, multi-discrete)\n- Multi-agent environment structure\n- Testing utilities\n\n**For complete environment development**, read `references\u002Fenvironments.md` for:\n- PufferEnv API details and in-place operation patterns\n- Observation and action space definitions\n- Multi-agent environment creation\n- Ocean suite (20+ pre-built environments)\n- Performance optimization (Python to C workflow)\n- Environment wrappers and best practices\n- Debugging and validation techniques\n\n### 3. Vectorization and Performance\n\nAchieve maximum throughput with optimized parallel simulation.\n\n**Vectorization setup:**\n```python\nimport pufferlib\n\n# Automatic vectorization\nenv = pufferlib.make('environment_name', num_envs=256, num_workers=8)\n\n# Performance benchmarks:\n# - Pure Python envs: 100k-500k SPS\n# - C-based envs: 100M+ SPS\n# - With training: 400k-4M total SPS\n```\n\n**Key optimizations:**\n- Shared memory buffers for zero-copy observation passing\n- Busy-wait flags instead of pipes\u002Fqueues\n- Surplus environments for async returns\n- Multiple environments per worker\n\n**For vectorization optimization**, read `references\u002Fvectorization.md` for:\n- Architecture and performance characteristics\n- Worker and batch size configuration\n- Serial vs multiprocessing vs async modes\n- Shared memory and zero-copy patterns\n- Hierarchical vectorization for large scale\n- Multi-agent vectorization strategies\n- Performance profiling and troubleshooting\n\n### 4. Policy Development\n\nBuild policies as standard PyTorch modules with optional utilities.\n\n**Basic policy structure:**\n```python\nimport torch.nn as nn\nfrom pufferlib.pytorch import layer_init\n\nclass Policy(nn.Module):\n    def __init__(self, observation_space, action_space):\n        super().__init__()\n\n        # Encoder\n        self.encoder = nn.Sequential(\n            layer_init(nn.Linear(obs_dim, 256)),\n            nn.ReLU(),\n            layer_init(nn.Linear(256, 256)),\n            nn.ReLU()\n        )\n\n        # Actor and critic heads\n        self.actor = layer_init(nn.Linear(256, num_actions), std=0.01)\n        self.critic = layer_init(nn.Linear(256, 1), std=1.0)\n\n    def forward(self, observations):\n        features = self.encoder(observations)\n        return self.actor(features), self.critic(features)\n```\n\n**For complete policy development**, read `references\u002Fpolicies.md` for:\n- CNN policies for image observations\n- Recurrent policies with optimized LSTM (3x faster inference)\n- Multi-input policies for complex observations\n- Continuous action policies\n- Multi-agent policies (shared vs independent parameters)\n- Advanced architectures (attention, residual)\n- Observation normalization and gradient clipping\n- Policy debugging and testing\n\n### 5. Environment Integration\n\nSeamlessly integrate environments from popular RL frameworks.\n\n**Gymnasium integration:**\n```python\nimport gymnasium as gym\nimport pufferlib\n\n# Wrap Gymnasium environment\ngym_env = gym.make('CartPole-v1')\nenv = pufferlib.emulate(gym_env, num_envs=256)\n\n# Or use make directly\nenv = pufferlib.make('gym-CartPole-v1', num_envs=256)\n```\n\n**PettingZoo multi-agent:**\n```python\n# Multi-agent environment\nenv = pufferlib.make('pettingzoo-knights-archers-zombies', num_envs=128)\n```\n\n**Supported frameworks:**\n- Gymnasium \u002F OpenAI Gym\n- PettingZoo (parallel and AEC)\n- Atari (ALE)\n- Procgen\n- NetHack \u002F MiniHack\n- Minigrid\n- Neural MMO\n- Crafter\n- GPUDrive\n- MicroRTS\n- Griddly\n- And more...\n\n**For integration details**, read `references\u002Fintegration.md` for:\n- Complete integration examples for each framework\n- Custom wrappers (observation, reward, frame stacking, action repeat)\n- Space flattening and unflattening\n- Environment registration\n- Compatibility patterns\n- Performance considerations\n- Integration debugging\n\n## Quick Start Workflow\n\n### For Training Existing Environments\n\n1. Choose environment from Ocean suite or compatible framework\n2. Use `scripts\u002Ftrain_template.py` as starting point\n3. Configure hyperparameters for your task\n4. Run training with CLI or Python script\n5. Monitor with Weights & Biases or Neptune\n6. Refer to `references\u002Ftraining.md` for optimization\n\n### For Creating Custom Environments\n\n1. Start with `scripts\u002Fenv_template.py`\n2. Define observation and action spaces\n3. Implement `reset()` and `step()` methods\n4. Test environment locally\n5. Vectorize with `pufferlib.emulate()` or `make()`\n6. Refer to `references\u002Fenvironments.md` for advanced patterns\n7. Optimize with `references\u002Fvectorization.md` if needed\n\n### For Policy Development\n\n1. Choose architecture based on observations:\n   - Vector observations → MLP policy\n   - Image observations → CNN policy\n   - Sequential tasks → LSTM policy\n   - Complex observations → Multi-input policy\n2. Use `layer_init` for proper weight initialization\n3. Follow patterns in `references\u002Fpolicies.md`\n4. Test with environment before full training\n\n### For Performance Optimization\n\n1. Profile current throughput (steps per second)\n2. Check vectorization configuration (num_envs, num_workers)\n3. Optimize environment code (in-place ops, numpy vectorization)\n4. Consider C implementation for critical paths\n5. Use `references\u002Fvectorization.md` for systematic optimization\n\n## Resources\n\n### scripts\u002F\n\n**train_template.py** - Complete training script template with:\n- Environment creation and configuration\n- Policy initialization\n- Logger integration (WandB, Neptune)\n- Training loop with checkpointing\n- Command-line argument parsing\n- Multi-GPU distributed training setup\n\n**env_template.py** - Environment implementation templates:\n- Single-agent PufferEnv example (grid world)\n- Multi-agent PufferEnv example (cooperative navigation)\n- Multiple observation\u002Faction space patterns\n- Testing utilities\n\n### references\u002F\n\n**training.md** - Comprehensive training guide:\n- Training workflow and CLI options\n- Hyperparameter configuration\n- Distributed training (multi-GPU, multi-node)\n- Monitoring and logging\n- Checkpointing\n- Protein hyperparameter tuning\n- Performance optimization\n- Common training patterns\n- Troubleshooting\n\n**environments.md** - Environment development guide:\n- PufferEnv API and characteristics\n- Observation and action spaces\n- Multi-agent environments\n- Ocean suite environments\n- Custom environment development workflow\n- Python to C optimization path\n- Third-party environment integration\n- Wrappers and best practices\n- Debugging\n\n**vectorization.md** - Vectorization optimization:\n- Architecture and key optimizations\n- Vectorization modes (serial, multiprocessing, async)\n- Worker and batch configuration\n- Shared memory and zero-copy patterns\n- Advanced vectorization (hierarchical, custom)\n- Multi-agent vectorization\n- Performance monitoring and profiling\n- Troubleshooting and best practices\n\n**policies.md** - Policy architecture guide:\n- Basic policy structure\n- CNN policies for images\n- LSTM policies with optimization\n- Multi-input policies\n- Continuous action policies\n- Multi-agent policies\n- Advanced architectures (attention, residual)\n- Observation processing and unflattening\n- Initialization and normalization\n- Debugging and testing\n\n**integration.md** - Framework integration guide:\n- Gymnasium integration\n- PettingZoo integration (parallel and AEC)\n- Third-party environments (Procgen, NetHack, Minigrid, etc.)\n- Custom wrappers (observation, reward, frame stacking, etc.)\n- Space conversion and unflattening\n- Environment registration\n- Compatibility patterns\n- Performance considerations\n- Debugging integration\n\n## Tips for Success\n\n1. **Start simple**: Begin with Ocean environments or Gymnasium integration before creating custom environments\n\n2. **Profile early**: Measure steps per second from the start to identify bottlenecks\n\n3. **Use templates**: `scripts\u002Ftrain_template.py` and `scripts\u002Fenv_template.py` provide solid starting points\n\n4. **Read references as needed**: Each reference file is self-contained and focused on a specific capability\n\n5. **Optimize progressively**: Start with Python, profile, then optimize critical paths with C if needed\n\n6. **Leverage vectorization**: PufferLib's vectorization is key to achieving high throughput\n\n7. **Monitor training**: Use WandB or Neptune to track experiments and identify issues early\n\n8. **Test environments**: Validate environment logic before scaling up training\n\n9. **Check existing environments**: Ocean suite provides 20+ pre-built environments\n\n10. **Use proper initialization**: Always use `layer_init` from `pufferlib.pytorch` for policies\n\n## Common Use Cases\n\n### Training on Standard Benchmarks\n```python\n# Atari\nenv = pufferlib.make('atari-pong', num_envs=256)\n\n# Procgen\nenv = pufferlib.make('procgen-coinrun', num_envs=256)\n\n# Minigrid\nenv = pufferlib.make('minigrid-empty-8x8', num_envs=256)\n```\n\n### Multi-Agent Learning\n```python\n# PettingZoo\nenv = pufferlib.make('pettingzoo-pistonball', num_envs=128)\n\n# Shared policy for all agents\npolicy = create_policy(env.observation_space, env.action_space)\ntrainer = PuffeRL(env=env, policy=policy)\n```\n\n### Custom Task Development\n```python\n# Create custom environment\nclass MyTask(PufferEnv):\n    # ... implement environment ...\n\n# Vectorize and train\nenv = pufferlib.emulate(MyTask, num_envs=256)\ntrainer = PuffeRL(env=env, policy=my_policy)\n```\n\n### High-Performance Optimization\n```python\n# Maximize throughput\nenv = pufferlib.make(\n    'my-env',\n    num_envs=1024,      # Large batch\n    num_workers=16,     # Many workers\n    envs_per_worker=64  # Optimize per worker\n)\n```\n\n## Installation\n\n```bash\nuv pip install pufferlib\n```\n\n## Documentation\n\n- Official docs: https:\u002F\u002Fpuffer.ai\u002Fdocs.html\n- GitHub: https:\u002F\u002Fgithub.com\u002FPufferAI\u002FPufferLib\n- Discord: Community support available\n\n","# PufferLib - High-Performance Reinforcement Learning\n\n## Overview\n\nPufferLib is a high-performance reinforcement learning library designed for fast parallel environment simulation and training. It achieves training at millions of steps per second through optimized vectorization, native multi-agent support, and efficient PPO implementation (PuffeRL). The library provides the Ocean suite of 20+ environments and seamless integration with Gymnasium, PettingZoo, and specialized RL frameworks.\n\n## When to Use This Skill\n\nUse this skill when:\n- **Training RL agents** with PPO on any environment (single or multi-agent)\n- **Creating custom environments** using the PufferEnv API\n- **Optimizing performance** for parallel environment simulation (vectorization)\n- **Integrating existing environments** from Gymnasium, PettingZoo, Atari, Procgen, etc.\n- **Developing policies** with CNN, LSTM, or custom architectures\n- **Scaling RL** to millions of steps per second for faster experimentation\n- **Multi-agent RL** with native multi-agent environment support\n\n## Core Capabilities\n\n### 1. High-Performance Training (PuffeRL)\n\nPuffeRL is PufferLib's optimized PPO+LSTM training algorithm achieving 1M-4M steps\u002Fsecond.\n\n**Quick start training:**\n```bash\n# CLI training\npuffer train procgen-coinrun --train.device cuda --train.learning-rate 3e-4\n\n# Distributed training\ntorchrun --nproc_per_node=4 train.py\n```\n\n**Python training loop:**\n```python\nimport pufferlib\nfrom pufferlib import PuffeRL\n\n# Create vectorized environment\nenv = pufferlib.make('procgen-coinrun', num_envs=256)\n\n# Create trainer\ntrainer = PuffeRL(\n    env=env,\n    policy=my_policy,\n    device='cuda',\n    learning_rate=3e-4,\n    batch_size=32768\n)\n\n# Training loop\nfor iteration in range(num_iterations):\n    trainer.evaluate()  # Collect rollouts\n    trainer.train()     # Train on batch\n    trainer.mean_and_log()  # Log results\n```\n\n**For comprehensive training guidance**, read `references\u002Ftraining.md` for:\n- Complete training workflow and CLI options\n- Hyperparameter tuning with Protein\n- Distributed multi-GPU\u002Fmulti-node training\n- Logger integration (Weights & Biases, Neptune)\n- Checkpointing and resume training\n- Performance optimization tips\n- Curriculum learning patterns\n\n### 2. Environment Development (PufferEnv)\n\nCreate custom high-performance environments with the PufferEnv API.\n\n**Basic environment structure:**\n```python\nimport numpy as np\nfrom pufferlib import PufferEnv\n\nclass MyEnvironment(PufferEnv):\n    def __init__(self, buf=None):\n        super().__init__(buf)\n\n        # Define spaces\n        self.observation_space = self.make_space((4,))\n        self.action_space = self.make_discrete(4)\n\n        self.reset()\n\n    def reset(self):\n        # Reset state and return initial observation\n        return np.zeros(4, dtype=np.float32)\n\n    def step(self, action):\n        # Execute action, compute reward, check done\n        obs = self._get_observation()\n        reward = self._compute_reward()\n        done = self._is_done()\n        info = {}\n\n        return obs, reward, done, info\n```\n\n**Use the template script:** `scripts\u002Fenv_template.py` provides complete single-agent and multi-agent environment templates with examples of:\n- Different observation space types (vector, image, dict)\n- Action space variations (discrete, continuous, multi-discrete)\n- Multi-agent environment structure\n- Testing utilities\n\n**For complete environment development**, read `references\u002Fenvironments.md` for:\n- PufferEnv API details and in-place operation patterns\n- Observation and action space definitions\n- Multi-agent environment creation\n- Ocean suite (20+ pre-built environments)\n- Performance optimization (Python to C workflow)\n- Environment wrappers and best practices\n- Debugging and validation techniques\n\n### 3. Vectorization and Performance\n\nAchieve maximum throughput with optimized parallel simulation.\n\n**Vectorization setup:**\n```python\nimport pufferlib\n\n# Automatic vectorization\nenv = pufferlib.make('environment_name', num_envs=256, num_workers=8)\n\n# Performance benchmarks:\n# - Pure Python envs: 100k-500k SPS\n# - C-based envs: 100M+ SPS\n# - With training: 400k-4M total SPS\n```\n\n**Key optimizations:**\n- Shared memory buffers for zero-copy observation passing\n- Busy-wait flags instead of pipes\u002Fqueues\n- Surplus environments for async returns\n- Multiple environments per worker\n\n**For vectorization optimization**, read `references\u002Fvectorization.md` for:\n- Architecture and performance characteristics\n- Worker and batch size configuration\n- Serial vs multiprocessing vs async modes\n- Shared memory and zero-copy patterns\n- Hierarchical vectorization for large scale\n- Multi-agent vectorization strategies\n- Performance profiling and troubleshooting\n\n### 4. Policy Development\n\nBuild policies as standard PyTorch modules with optional utilities.\n\n**Basic policy structure:**\n```python\nimport torch.nn as nn\nfrom pufferlib.pytorch import layer_init\n\nclass Policy(nn.Module):\n    def __init__(self, observation_space, action_space):\n        super().__init__()\n\n        # Encoder\n        self.encoder = nn.Sequential(\n            layer_init(nn.Linear(obs_dim, 256)),\n            nn.ReLU(),\n            layer_init(nn.Linear(256, 256)),\n            nn.ReLU()\n        )\n\n        # Actor and critic heads\n        self.actor = layer_init(nn.Linear(256, num_actions), std=0.01)\n        self.critic = layer_init(nn.Linear(256, 1), std=1.0)\n\n    def forward(self, observations):\n        features = self.encoder(observations)\n        return self.actor(features), self.critic(features)\n```\n\n**For complete policy development**, read `references\u002Fpolicies.md` for:\n- CNN policies for image observations\n- Recurrent policies with optimized LSTM (3x faster inference)\n- Multi-input policies for complex observations\n- Continuous action policies\n- Multi-agent policies (shared vs independent parameters)\n- Advanced architectures (attention, residual)\n- Observation normalization and gradient clipping\n- Policy debugging and testing\n\n### 5. Environment Integration\n\nSeamlessly integrate environments from popular RL frameworks.\n\n**Gymnasium integration:**\n```python\nimport gymnasium as gym\nimport pufferlib\n\n# Wrap Gymnasium environment\ngym_env = gym.make('CartPole-v1')\nenv = pufferlib.emulate(gym_env, num_envs=256)\n\n# Or use make directly\nenv = pufferlib.make('gym-CartPole-v1', num_envs=256)\n```\n\n**PettingZoo multi-agent:**\n```python\n# Multi-agent environment\nenv = pufferlib.make('pettingzoo-knights-archers-zombies', num_envs=128)\n```\n\n**Supported frameworks:**\n- Gymnasium \u002F OpenAI Gym\n- PettingZoo (parallel and AEC)\n- Atari (ALE)\n- Procgen\n- NetHack \u002F MiniHack\n- Minigrid\n- Neural MMO\n- Crafter\n- GPUDrive\n- MicroRTS\n- Griddly\n- And more...\n\n**For integration details**, read `references\u002Fintegration.md` for:\n- Complete integration examples for each framework\n- Custom wrappers (observation, reward, frame stacking, action repeat)\n- Space flattening and unflattening\n- Environment registration\n- Compatibility patterns\n- Performance considerations\n- Integration debugging\n\n## Quick Start Workflow\n\n### For Training Existing Environments\n\n1. Choose environment from Ocean suite or compatible framework\n2. Use `scripts\u002Ftrain_template.py` as starting point\n3. Configure hyperparameters for your task\n4. Run training with CLI or Python script\n5. Monitor with Weights & Biases or Neptune\n6. Refer to `references\u002Ftraining.md` for optimization\n\n### For Creating Custom Environments\n\n1. Start with `scripts\u002Fenv_template.py`\n2. Define observation and action spaces\n3. Implement `reset()` and `step()` methods\n4. Test environment locally\n5. Vectorize with `pufferlib.emulate()` or `make()`\n6. Refer to `references\u002Fenvironments.md` for advanced patterns\n7. Optimize with `references\u002Fvectorization.md` if needed\n\n### For Policy Development\n\n1. Choose architecture based on observations:\n   - Vector observations → MLP policy\n   - Image observations → CNN policy\n   - Sequential tasks → LSTM policy\n   - Complex observations → Multi-input policy\n2. Use `layer_init` for proper weight initialization\n3. Follow patterns in `references\u002Fpolicies.md`\n4. Test with environment before full training\n\n### For Performance Optimization\n\n1. Profile current throughput (steps per second)\n2. Check vectorization configuration (num_envs, num_workers)\n3. Optimize environment code (in-place ops, numpy vectorization)\n4. Consider C implementation for critical paths\n5. Use `references\u002Fvectorization.md` for systematic optimization\n\n## Resources\n\n### scripts\u002F\n\n**train_template.py** - Complete training script template with:\n- Environment creation and configuration\n- Policy initialization\n- Logger integration (WandB, Neptune)\n- Training loop with checkpointing\n- Command-line argument parsing\n- Multi-GPU distributed training setup\n\n**env_template.py** - Environment implementation templates:\n- Single-agent PufferEnv example (grid world)\n- Multi-agent PufferEnv example (cooperative navigation)\n- Multiple observation\u002Faction space patterns\n- Testing utilities\n\n### references\u002F\n\n**training.md** - Comprehensive training guide:\n- Training workflow and CLI options\n- Hyperparameter configuration\n- Distributed training (multi-GPU, multi-node)\n- Monitoring and logging\n- Checkpointing\n- Protein hyperparameter tuning\n- Performance optimization\n- Common training patterns\n- Troubleshooting\n\n**environments.md** - Environment development guide:\n- PufferEnv API and characteristics\n- Observation and action spaces\n- Multi-agent environments\n- Ocean suite environments\n- Custom environment development workflow\n- Python to C optimization path\n- Third-party environment integration\n- Wrappers and best practices\n- Debugging\n\n**vectorization.md** - Vectorization optimization:\n- Architecture and key optimizations\n- Vectorization modes (serial, multiprocessing, async)\n- Worker and batch configuration\n- Shared memory and zero-copy patterns\n- Advanced vectorization (hierarchical, custom)\n- Multi-agent vectorization\n- Performance monitoring and profiling\n- Troubleshooting and best practices\n\n**policies.md** - Policy architecture guide:\n- Basic policy structure\n- CNN policies for images\n- LSTM policies with optimization\n- Multi-input policies\n- Continuous action policies\n- Multi-agent policies\n- Advanced architectures (attention, residual)\n- Observation processing and unflattening\n- Initialization and normalization\n- Debugging and testing\n\n**integration.md** - Framework integration guide:\n- Gymnasium integration\n- PettingZoo integration (parallel and AEC)\n- Third-party environments (Procgen, NetHack, Minigrid, etc.)\n- Custom wrappers (observation, reward, frame stacking, etc.)\n- Space conversion and unflattening\n- Environment registration\n- Compatibility patterns\n- Performance considerations\n- Debugging integration\n\n## Tips for Success\n\n1. **Start simple**: Begin with Ocean environments or Gymnasium integration before creating custom environments\n\n2. **Profile early**: Measure steps per second from the start to identify bottlenecks\n\n3. **Use templates**: `scripts\u002Ftrain_template.py` and `scripts\u002Fenv_template.py` provide solid starting points\n\n4. **Read references as needed**: Each reference file is self-contained and focused on a specific capability\n\n5. **Optimize progressively**: Start with Python, profile, then optimize critical paths with C if needed\n\n6. **Leverage vectorization**: PufferLib's vectorization is key to achieving high throughput\n\n7. **Monitor training**: Use WandB or Neptune to track experiments and identify issues early\n\n8. **Test environments**: Validate environment logic before scaling up training\n\n9. **Check existing environments**: Ocean suite provides 20+ pre-built environments\n\n10. **Use proper initialization**: Always use `layer_init` from `pufferlib.pytorch` for policies\n\n## Common Use Cases\n\n### Training on Standard Benchmarks\n```python\n# Atari\nenv = pufferlib.make('atari-pong', num_envs=256)\n\n# Procgen\nenv = pufferlib.make('procgen-coinrun', num_envs=256)\n\n# Minigrid\nenv = pufferlib.make('minigrid-empty-8x8', num_envs=256)\n```\n\n### Multi-Agent Learning\n```python\n# PettingZoo\nenv = pufferlib.make('pettingzoo-pistonball', num_envs=128)\n\n# Shared policy for all agents\npolicy = create_policy(env.observation_space, env.action_space)\ntrainer = PuffeRL(env=env, policy=policy)\n```\n\n### Custom Task Development\n```python\n# Create custom environment\nclass MyTask(PufferEnv):\n    # ... implement environment ...\n\n# Vectorize and train\nenv = pufferlib.emulate(MyTask, num_envs=256)\ntrainer = PuffeRL(env=env, policy=my_policy)\n```\n\n### High-Performance Optimization\n```python\n# Maximize throughput\nenv = pufferlib.make(\n    'my-env',\n    num_envs=1024,      # Large batch\n    num_workers=16,     # Many workers\n    envs_per_worker=64  # Optimize per worker\n)\n```\n\n## Installation\n\n```bash\nuv pip install pufferlib\n```\n\n## Documentation\n\n- Official docs: https:\u002F\u002Fpuffer.ai\u002Fdocs.html\n- GitHub: https:\u002F\u002Fgithub.com\u002FPufferAI\u002FPufferLib\n- Discord: Community support available\n\n",{"name":5,"license":48,"metadata":49,"description":7},"MIT license",{"skill-author":50},"K-Dense Inc.","main","fa638b97a18ff6d9f26cf0eaf3dfa123531bcc87","organized-skills\u002Fpufferlib",1,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode","https:\u002F\u002Fgithub.com\u002Flevalencia","https:\u002F\u002Fmedium.com\u002F@luisevalencia","Microsoft MVP - Artificial Intelligence\r\nMachine Learning Enthusiast\r\n","2026-05-02 06:55:36",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add levalencia\u002Fagent-god-mode --skill pufferlib",{"tool":66,"command":67},"bunx","bunx skills add levalencia\u002Fagent-god-mode --skill pufferlib",{"tool":69,"command":70},"pnpm","pnpm dlx skills add levalencia\u002Fagent-god-mode --skill pufferlib","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002FSKILL.md",true,[74,80,84,88,92,96,100,104,108,112,116,122],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fdownload.md","REFERENCE","参考文档",3237,"https:\u002F\u002Fgithub.com\u002FTorchiaHub\u002FSkills\u002Fblob\u002Fmaster\u002F01-Inbox\u002Fdownloads\u002Fgithub-awesome-copilot\u002F20260429T110232Z\u002Fsource\u002Fskills\u002Fpdftk-server\u002Freferences\u002Fdownload.md",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fenvironments.md",12489,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Freferences\u002Fenvironments.md",{"path":85,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fintegration.md",15165,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Freferences\u002Fintegration.md",{"path":89,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fpdftk-cli-examples.md",3391,"https:\u002F\u002Fgithub.com\u002FTorchiaHub\u002FSkills\u002Fblob\u002Fmaster\u002F01-Inbox\u002Fdownloads\u002Fgithub-awesome-copilot\u002F20260429T110232Z\u002Fsource\u002Fskills\u002Fpdftk-server\u002Freferences\u002Fpdftk-cli-examples.md",{"path":93,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fpdftk-man-page.md",7081,"https:\u002F\u002Fgithub.com\u002FTorchiaHub\u002FSkills\u002Fblob\u002Fmaster\u002F01-Inbox\u002Fdownloads\u002Fgithub-awesome-copilot\u002F20260429T110232Z\u002Fsource\u002Fskills\u002Fpdftk-server\u002Freferences\u002Fpdftk-man-page.md",{"path":97,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Fpdftk-server-license.md",1489,"https:\u002F\u002Fgithub.com\u002FTorchiaHub\u002FSkills\u002Fblob\u002Fmaster\u002F01-Inbox\u002Fdownloads\u002Fgithub-awesome-copilot\u002F20260429T110232Z\u002Fsource\u002Fskills\u002Fpdftk-server\u002Freferences\u002Fpdftk-server-license.md",{"path":101,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fpolicies.md",19183,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Freferences\u002Fpolicies.md",{"path":105,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":106,"sourceHtmlUrl":107},"references\u002Fthird-party-materials.md",9248,"https:\u002F\u002Fgithub.com\u002FTorchiaHub\u002FSkills\u002Fblob\u002Fmaster\u002F01-Inbox\u002Fdownloads\u002Fgithub-awesome-copilot\u002F20260429T110232Z\u002Fsource\u002Fskills\u002Fpdftk-server\u002Freferences\u002Fthird-party-materials.md",{"path":109,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":110,"sourceHtmlUrl":111},"references\u002Ftraining.md",8127,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Freferences\u002Ftraining.md",{"path":113,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":114,"sourceHtmlUrl":115},"references\u002Fvectorization.md",12962,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Freferences\u002Fvectorization.md",{"path":117,"resourceType":118,"resourceTypeDesc":119,"sizeBytes":120,"sourceHtmlUrl":121},"scripts\u002Fenv_template.py","SCRIPT","脚本",10157,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Fscripts\u002Fenv_template.py",{"path":123,"resourceType":118,"resourceTypeDesc":119,"sizeBytes":124,"sourceHtmlUrl":125},"scripts\u002Ftrain_template.py",8027,"https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fpufferlib\u002Fscripts\u002Ftrain_template.py",[127,146,179,206,231,258],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":43},"01M6EM8ES5M9J4S8N78NJST0YC","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fzarr-python\u002FSKILL.md",[],[134,135,136,38,137,138,139,140,33,141,142,143,144,27,145],"python","zarr python","storage","s3","gcs","cloud","dask","pipelines","arrays","numpy","scientific computing","scientific",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":161,"publishedAt":43},"01M6EM8AR6ZFKZ9YVW8TTG850Z","zabbix","Zabbix monitoring system automation via API and Python. Use when: (1) Managing hosts, templates, items, triggers, or host groups, (2) Automating monitoring configuration, (3) Sending data via Zabbix trapper\u002Fsender, (4) Querying historical data or events, (5) Bulk operations on Zabbix objects, (6) Maintenance window management, (7) User\u002Fpermission management","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fzabbix-api-skill\u002FSKILL.md",[152,155,156],{"categoryNo":153,"categoryName":154,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":157,"categoryName":158,"taxonomyType":159,"taxonomyTypeDesc":160},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[148,134,162,163,164,165,166,167,168,169,32,170,171,172,173,174,175,176,177,178],"automation","window management","monitoring","data","templates","api","system","operations","maintenance","objects","permission","bulk operations","triggers","host","events","via","bulk",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":185,"publishedAt":43},"01M6EM6Q9JG846ECQY9A210A26","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fx-twitter-growth\u002FSKILL.md",[],[186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205],"twitter","x twitter growth","growth","competitive intelligence","search","analyzing","plan","marketing","web search","competitors","analyze","write","optimize","social","intelligence","viral","growth engine","mechanics","grow","competitive",{"skillNo":207,"name":208,"nameZh":6,"description":209,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":210,"categories":211,"keywords":212,"publishedAt":43},"01M6EM3FQNPYNKPC4CV9TCVNGD","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fwhat-if-oracle\u002FSKILL.md",[],[213,214,215,216,217,218,219,220,221,222,223,224,32,225,226,227,228,229,230,25],"oracle","what if oracle","test","planning","ux","futures","risk","analysis","explore","decision","branch","question","exploration","options","stress-test","strategies","trigger","case",{"skillNo":232,"name":233,"nameZh":6,"description":234,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":235,"categories":236,"keywords":240,"publishedAt":43},"01M6EM08C06RGDYCJ86HAPK0FF","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fvercel-react-best-practices\u002FSKILL.md",[237],{"categoryNo":238,"categoryName":239,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[241,242,243,244,245,246,34,247,248,249,250,251,252,165,253,254,255,256,257,174],"react","vercel react best practices","best practices","react best practices","vercel","writing","components","react components","guidelines","tasks","code","Optimization","Next.js","refactoring","performance optimization","next","pages",{"skillNo":259,"name":260,"nameZh":6,"description":261,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":262,"categories":263,"keywords":274,"publishedAt":43},"01M6EM00S13326QM08DTM94J6Z","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Flevalencia\u002Fagent-god-mode\u002Fblob\u002Fmain\u002Forganized-skills\u002Fvenue-templates\u002FSKILL.md",[264,267,270,271],{"categoryNo":265,"categoryName":266,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":268,"categoryName":269,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":272,"categoryName":273,"taxonomyType":159,"taxonomyTypeDesc":160},"01JBSEEDCAT000000000000036","内容创作者",[166,275,276,249,277,278,279,280,281,282,283,197,284,285,286,287,288,289,145,290],"venue templates","research","NeurIPS","ICML","LaTeX","science","Bash","access","read","edit","proposals","Academic","requirements","formatting","journal","chi"]