AReaL: Skill for Claude Code

.agents/skills/add-reward/SKILL.md

add-reward is a skill for Claude Code, Codex from areal-project/AReaL. It costs 27 tokens per session (1,191 once invoked), scanned A, original, Apache-2.0.

A step-by-step guide for adding a function that scores a model's generated answer. The score, called a reward, can compare the generated answer with a known correct answer during training.

In plain words
What is it for?
Use it when creating a custom reward calculation for prompts, model completions, token IDs, and optional reference answers.
Why use it?
It removes uncertainty about the reward function's location, inputs, output, and basic error-handling structure.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is areal-project/AReaL's own configuration. It tells Claude Code and Codex how to work on AReaL itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything AReaL configures →

About the project

AReaL is an infrastructure system for training large language models with reinforcement learning, connecting model training to applications built around AI agents. Researchers and developers use it to train reasoning and agentic models through asynchronous workflows, and the catalogue add-ons support working with AReaL.

areal-project/AReaL · 5,748 stars · on GitHub · areal-ai.io

Reuse

Borrowing it

Nothing to install: this file belongs to areal-project/AReaL. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/areal-project/AReaL/main/.agents/skills/add-reward/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/areal-project/AReaL

Made for: Claude Code, Codex.

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 add-reward

README.md
[![agentmods](https://agentmods.dev/badge/skills/areal-project/areal/add-reward/github.svg)](https://agentmods.dev/skills/areal-project/areal/add-reward)
Your own site
<a href="https://agentmods.dev/skills/areal-project/areal/add-reward"><img src="https://agentmods.dev/badge/skills/areal-project/areal/add-reward/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 add-reward

Your own site · 80×15
<a href="https://agentmods.dev/skills/areal-project/areal/add-reward"><img src="https://agentmods.dev/badge/skills/areal-project/areal/add-reward.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,191 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • 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.00027 $0.01191
Opus 5 $0.00014 $0.00596
Sonnet 5 $0.00005 $0.00238
Haiku 4.5 $0.00003 $0.00119

Measured 10d ago against content hash 2db258f09580, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

add-reward 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 10d 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.

.agents/skills/add-reward/SKILL.md · 184 lines

How it starts

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

Add Reward

Add a new reward function to AReaL.

When to Use

This skill is triggered when:

  • User asks "how do I add a reward function?"
  • User wants to implement custom rewards
  • User mentions reward computation

Step-by-Step Guide

Step 1: Create Reward File

Create areal/reward/<name>.py:

from typing import Any

from areal.utils import logging

logger = logging.getLogger("MyReward")


def <name>_reward_fn(
    prompt: str,
    completions: str,
    prompt_ids,
    completion_ids,
    answer: str | None = None,
    **kwargs: Any,
) -> float:
    """Compute reward for a single completion.

    Args:
        prompt: Prompt string
        completions: Completion string (model output)
        prompt_ids: Tokenized prompt IDs
        completion_ids: Tokenized completion IDs
        answer: Ground truth answer from dataset (optional)
        **kwargs: Additional data from dataset

    Returns:
        Reward value (float), typically 0.0 or 1.0
    """
    try:
        # Extract answer from completion
        extracted = _extract_answer(completions)

        # Compare with ground truth
        if answer is not None and extracted == str(answer):
            return 1.0
        return 0.0
    except Exception:
        logger.warning("Exception in reward computation", exc_info=True)
        return 0.0


def _extract_answer(completion: str) -> str:
    """Extract the answer from a completion string.

    Implement your extraction logic here.
    """
    # Example: Extract content from \boxed{}
    import re

    match = re.search(r"\\boxed\{([^}]+)\}", completion)
    if match:
        return match.group(1).strip()
    return completion.strip()

Step 2: Register in init.py

Update areal/reward/__init__.py:

# Add to VALID_REWARD_FN
VALID_REWARD_FN = [
    # ... existing reward functions
    "<name>",
]

# Add to get_reward_fn function
def get_reward_fn(name: str, **kwargs):
    # ... existing code
    elif name == "<name>":
        from areal.reward.<name> import <name>_reward_fn
        return <name>_reward_fn

Read the full file on GitHub · 184 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. 10d ago First seen · 184 lines · 27 tokens per session scan A 2db258f09580

Subscribe to this mod's changes

add-reward is a skill published in the GitHub repository areal-project/AReaL (5,748 stars, last pushed today), licensed Apache-2.0. It adds 27 tokens to every session and 1,191 once invoked, about $0.0001 per session on Opus 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-30.