Context Budget Tuning

Context Budget Tuning is a skill for Claude Code from s977043/river-review. It costs 45 tokens per session (1,867 once invoked), scanned A, original, MIT.

A review guide for tuning how much repository context an automated code review receives and how files are ranked for inclusion. It checks these settings against the chosen model and repository size.

In plain words
What is it for?
Use it when changing .river-review context budgets, review modes, or ranking weights. It helps verify token and character limits, model fit, and valid configuration keys.
Why use it?
Poor context limits can hide relevant code or exceed what a model can process, while unsuitable ranking weights can make reviews focus on the wrong files.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the river-review plugin — 138 skills, 18 commands, 5 agents, 3 hooks shipped together

Good fit Use it when changing .river-review context budgets, review modes, or ranking weights. It helps verify token and character limits, model fit, and valid configuration keys.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/s977043/river-review/context-budget-tuning
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 s977043/river-review --skill context-budget-tuning
Clone the repo
git clone --depth 1 https://github.com/s977043/river-review

Made for: Claude Code.

Or install river-review, the plugin that ships this one along with the rest of its 138 skills, 18 commands, 5 agents, 3 hooks.

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 Context Budget Tuning

README.md
[![agentmods](https://agentmods.dev/badge/skills/s977043/river-review/context-budget-tuning/github.svg)](https://agentmods.dev/skills/s977043/river-review/context-budget-tuning)
Your own site
<a href="https://agentmods.dev/skills/s977043/river-review/context-budget-tuning"><img src="https://agentmods.dev/badge/skills/s977043/river-review/context-budget-tuning/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 Context Budget Tuning

Your own site · 80×15
<a href="https://agentmods.dev/skills/s977043/river-review/context-budget-tuning"><img src="https://agentmods.dev/badge/skills/s977043/river-review/context-budget-tuning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,867 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.
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.00045 $0.01867
Opus 5 $0.00023 $0.00933
Sonnet 5 $0.00009 $0.00373
Haiku 4.5 $0.00005 $0.00187

Measured 8d ago against content hash 8778e6e3ec01, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

Context Budget Tuning 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 8d 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.

skills/upstream/context-budget-tuning/SKILL.md · 121 lines

How it starts

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

Pattern declaration

Primary pattern: Reviewer Secondary patterns: Tool Wrapper Why: .river-review の context 設定変更時に、reviewMode プリセット選択 / token・char 上限 / ranking weights をモデル仕様と照合してレビューする educator スキル。

Goal / 目的

  • .river-review.{yaml,json}context.reviewMode / context.budget / context.ranking 変更が モデル仕様 (model.modelName) と整合しているか をレビューで確認する。
  • reviewMode: tiny | medium | large プリセットの 既定値 (1024 / 4000 / 16000 max tokens) と explicit budget の優先関係を理解させる。
  • ranking weights (pathProximity / symbolUsage / siblingTest / commitRecency) の 0.0〜1.0 範囲 とスキーマキー名を schema (src/config/schema.mjs) と照合する。

Guidance

reviewMode プリセット既定値 (src/lib/context-presets.mjs)

reviewMode maxTokens 既定 想定モデル
tiny 1024 コンテキスト窓の小さいモデル / 短い PR
medium 4000 gpt-4o-mini / sonnet 級モデルの通常 PR
large 16000 大型モデルでの深掘りレビュー
  • 明示的 context.budget がある場合は 常に preset より優先 する。
  • budget.maxTokens の上限は schema で 64000maxChars200000 まで。

モデル仕様との整合チェック

  • context.budget.maxTokens使用する model.modelName の公式仕様(または運用上採用している実効 context window) を超えないように設定する。プロバイダの仕様変更で値は変動するため、本スキルでは具体値を固定しない。
  • 小型モデル(例: gpt-4o-mini 級)に large プリセット (16000 token) を当てると、モデルの実効 context window を超える分は切捨てられて redundant になり、コストのみ増える。プリセットの maxTokens がモデル仕様の上限を上回らないか を確認する。
  • 逆に大型モデルに tiny プリセット (1024 token) を当てている場合は、context が不足してレビュー品質が落ちる可能性を指摘する。

ranking weights のレビュー

  • キーは schema 定義 (pathProximity / symbolUsage / siblingTest / commitRecency) と一致しなければならない。古い名称(symbolOverlap / testAffinity)は #728 で廃止済み
  • contextRankingSchema.weights.strict() のため、未知キーを含む設定は 設定ロード時に Unknown key エラーで失敗 する(silently 無視されない)。古い名称が残っている設定は CI でも気付かれず動き続けることはなく、即座に明示的なエラーになる。
  • 各 weight は 0.01.0。合計が 1 を超えても問題ないが、scoreContextCandidate が weighted average を取るため相対比のみが意味を持つ。

Read the full file on GitHub · 121 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. 8d ago First seen · 121 lines · 45 tokens per session scan A 8778e6e3ec01

Subscribe to this mod's changes

Context Budget Tuning is a skill published in the GitHub repository s977043/river-review (3 stars, last pushed yesterday), licensed MIT. It adds 45 tokens to every session and 1,867 once invoked, about $0.0002 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-09-03.

Related

Other skills, from other repositories

review-all

Multi-agent code review for diffs (project-agnostic). Covers standards, bugs, security, DRY, smells, perf, tests, API contracts, a11y/i18n. Verifies each finding to eliminate false positives. Use for /review-all, pre-PR/pre-commit review, or auditing uncommitted/staged changes.

ncoevoet/claude-review-all · 74 tokens

logic-health

Sweep a directory, module, or full codebase for logic correctness and produce a scored health dashboard with systemic patterns. Trigger when the user requests a health view — "audit the whole codebase", "health check", "health overview", "logic health overview", "audit src/", "audit auth and payments modules", "where…

hyhmrright/logic-lens · 180 tokens

omnicheck-gitlab

Use when checking if MR review findings have been applied — verifies both OmniForge-generated and human reviewer comments against the current diff, posts nudge replies on unaddressed threads.

nexiouscaliver/OmniForge · 41 tokens

omnicheck-github

Use when checking if PR review findings have been applied — verifies both OmniForge-generated and human reviewer comments against the current diff, posts nudge replies on unaddressed threads.

nexiouscaliver/OmniForge · 40 tokens

omnicreate-gitlab

Use when creating a GitLab merge request (OmniForge). Auto-populates title and description from commits, supports draft MRs, labels, assignees, reviewers, and issue linking.

nexiouscaliver/OmniForge · 45 tokens

logic-diff

Compare two code versions for semantic equivalence via semi-formal tracing of both versions side-by-side. Trigger when the user shares a refactor, rewrite, migration, or A/B implementation and wants to confirm behavior is unchanged — "did I break anything", "is this equivalent", "are these equivalent", "semantically…

hyhmrright/logic-lens · 192 tokens