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.
npx skills add Aznatkoiny/zAI-Skills --skill cpp-reinforcement-learninggit clone --depth 1 https://github.com/Aznatkoiny/zAI-SkillsWrote 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.
[](https://agentmods.dev/skills/aznatkoiny/zai-skills/cpp-reinforcement-learning)<a href="https://agentmods.dev/skills/aznatkoiny/zai-skills/cpp-reinforcement-learning"><img src="https://agentmods.dev/badge/skills/aznatkoiny/zai-skills/cpp-reinforcement-learning/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.
<a href="https://agentmods.dev/skills/aznatkoiny/zai-skills/cpp-reinforcement-learning"><img src="https://agentmods.dev/badge/skills/aznatkoiny/zai-skills/cpp-reinforcement-learning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00131 | $0.01309 |
| Opus 5.5 | $0.00052 | $0.00524 |
| Sonnet 5.5 | $0.00026 | $0.00262 |
| Haiku 4.5 | $0.00013 | $0.00131 |
Grade A, and why
cpp-reinforcement-learning scanned grade A with 0 findings 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 25d ago.
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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.
C++ reinforcement learning
Help the user build RL in C++ that is correct first and fast second. The C++ frontend mirrors PyTorch's Python API closely, so a good approach is often to get the algorithm right against a Python reference (Stable-Baselines3 or CleanRL) and then translate it, checking the outputs match.
LibTorch changes between releases, and current versions require C++20. Check the version the user builds against (it's in <libtorch>/build-version) before relying on an API, and if a docs or web tool is available, look up anything you're unsure of.
Core Libraries
Primary: LibTorch (PyTorch C++ Frontend)
LibTorch provides the same tensor operations and autograd capabilities as PyTorch in C++.
Installation: Download from https://pytorch.org/get-started/locally (select C++/LibTorch)
CMake Integration:
cmake_minimum_required(VERSION 3.18)
project(rl_project)
set(CMAKE_CXX_STANDARD 20) # current libtorch requires C++20
find_package(Torch REQUIRED)
add_executable(train_agent src/main.cpp)
target_link_libraries(train_agent "${TORCH_LIBRARIES}")
Other pieces
- ONNX Runtime: cross-platform inference for policies exported from Python
- AOTInductor (
.pt2packages): the current way to run a Python-exported PyTorch model from C++; TorchScript is deprecated (seereferences/libtorch.md) - Environments: there's no standard C++ Gymnasium; most projects wrap their own simulator behind a small
reset()/step()interface
Quick Start: DQN Agent
#include <torch/torch.h>
struct DQNNet : torch::nn::Module {
torch::nn::Linear fc1{nullptr}, fc2{nullptr}, fc3{nullptr};
DQNNet(int64_t state_dim, int64_t action_dim) {
fc1 = register_module("fc1", torch::nn::Linear(state_dim, 128));
fc2 = register_module("fc2", torch::nn::Linear(128, 128));
fc3 = register_module("fc3", torch::nn::Linear(128, action_dim));
}
torch::Tensor forward(torch::Tensor x) {
x = torch::relu(fc1->forward(x));
x = torch::relu(fc2->forward(x));
return fc3->forward(x);
}
};
// Training loop
auto policy_net = std::make_shared<DQNNet>(state_dim, action_dim);
auto target_net = std::make_shared<DQNNet>(state_dim, action_dim);
torch::optim::Adam optimizer(policy_net->parameters(), lr);
// Compute loss
auto q_values = policy_net->forward(states).gather(1, actions);
// Tensor::max(dim) returns std::tuple<values, indices> in C++
auto next_q = std::get<0>(target_net->forward(next_states).max(1)).detach();
auto target = rewards + gamma * next_q * (1 - dones);
auto loss = torch::mse_loss(q_values.squeeze(), target);
// Backward pass
optimizer.zero_grad();
loss.backward();
optimizer.step();
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 25d ago Changed · -16 lines · +48 tokens per session 0eea3a9fdbbd
- 3mo ago First seen · 160 lines · 83 tokens per session scan A 579fbd7b22ea
cpp-reinforcement-learning is a skill published in the GitHub repository Aznatkoiny/zAI-Skills (10 stars, last pushed 26d ago), licensed MIT. It adds 131 tokens to every session and 1,309 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
cpp-reinforcement-learning compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cpp-reinforcement-learningAznatkoiny/zAI-Skills | Skill | 10 | 26d ago | MIT | A | 131 | Claude Code |
| r-ops0xDarkMatter/claude-mods | Skill | 86 | 9d ago | MIT | A | 83 | Claude Code |
| agent-cpp-experttravisjneuman/.claude | Skill | 116 | 2d ago | MIT | A | 88 | Claude Code |
| ia-c-systemsiliaal/whetstone | Skill | 37 | yesterday | MIT | A | 84 | Claude Code |
| clean-code-cppCassetteTapeCrackle/claude-starters | Skill | 1 | 1mo ago | MIT | A | 42 | Claude Code |
| clean-code-audioCassetteTapeCrackle/claude-starters | Skill | 1 | 1mo ago | MIT | A | 52 | Claude Code |
| clean-code-cCassetteTapeCrackle/claude-starters | Skill | 1 | 1mo ago | MIT | A | 34 | Claude Code |