nreki-optimizer

nreki-optimizer is a skill for Claude Code, Codex from Ruso-0/Nreki. It costs 43 tokens per session (1,268 once invoked), scanned A, a copy of nreki-optimizer, Apache-2.0.

A code-reading and refactoring system that uses the program’s structure to find relevant code, shorten context, and check edits before saving them.

In plain words
What is it for?
It is for searching code, inspecting important methods, preparing multi-file refactors, and validating changes before they are written to disk.
Why use it?
It helps an AI agent work with large codebases while showing which parts may be affected by a change.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for searching code, inspecting important methods, preparing multi-file refactors, and validating changes before they are written to disk.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ruso-0/nreki/templates
View source ↗ Ruso-0/Nreki
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 Ruso-0/Nreki --skill templates
Clone the repo
git clone --depth 1 https://github.com/Ruso-0/Nreki

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 nreki-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/ruso-0/nreki/templates/github.svg)](https://agentmods.dev/skills/ruso-0/nreki/templates)
Your own site
<a href="https://agentmods.dev/skills/ruso-0/nreki/templates"><img src="https://agentmods.dev/badge/skills/ruso-0/nreki/templates/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 nreki-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/ruso-0/nreki/templates"><img src="https://agentmods.dev/badge/skills/ruso-0/nreki/templates.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,268 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 86% copy Near-identical to another mod 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.00043 $0.01268
Opus 5 $0.00022 $0.00634
Sonnet 5 $0.00009 $0.00254
Haiku 4.5 $0.00004 $0.00127

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

Security

Grade A, and why

nreki-optimizer 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 12d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (hooks/nreki-enforcer.mjs), 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.

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.

Origin

This is a copy

86% identical to nreki-optimizer — 12 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

templates/SKILL.md · 59 lines

How it starts

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

NREKI ACTIVE (IMMUNE SYSTEM)

If nreki_* tools fail: fall back to native Read/Write ONLY for new files or <100L. Native tools are BLOCKED by filesystem hooks for >100L files.

0. ZERO-CHATTER

  • Call tools immediately. No "I will now..." or "Let me...".
  • State changes in one line. No ASCII tables, no summaries.
  • Output tokens cost 5x input. Optimize every syllable.

1. NAVIGATION & READING

  • NEVER use Explore, Bash grep/rg/cat, or native Read File.
  • EXACT SEARCH: ALWAYS use nreki_navigate action:"fast_grep". Returns 3D AST topological coordinates (File + Symbol + Line) via SQLite index. Benchmarked 5-33x faster than bash grep on indexed codebases.
  • SEMANTIC SEARCH: Use nreki_navigate action:"search" for concept-based queries (Type Ledger).
  • BATCH READING: NEVER read functions one by one. Use ONE call with comma-separated targets: nreki_code action:"compress" focus:"func1, func2, func3".
  • LARGE FILES: nreki_navigate action:"outline" auto-expands HIGH-risk methods up to 6,000 token budget.
    • CRITICAL: If outline says [BUDGET LIMIT REACHED], you MUST use compress focus:"<omitted_symbols>" to read the hidden logic before editing. Do not guess.
    • Pay attention to [Defect] flags and [orphan / 0 ext refs] markers.
  • Small files: nreki_code action:"read".

2. SURGICAL EDITING & ACID BATCHES

  • NEVER use native Write/Replace on existing files (bypasses AST validation).
  • NEVER edit sequentially. Read ALL targets first, then batch ALL fixes in ONE nreki_code action:"batch_edit" call.
  • 80L PAYLOAD GUILLOTINE: NREKI mathematically rejects any single payload (new_code or replace_text) >80 lines. You MUST decompose large rewrites.
  • PATCH MODE (MANDATORY): If the original symbol is larger than SYMBOL_REPLACE_LIMIT (default 100 lines, empirically calibrated in v11.3.1; override via NREKI_SYMBOL_LIMIT env), mode:"replace" is BLOCKED. You MUST use mode:"patch" with search_text and replace_text.
    • Tolerant Match: search_text indentation is fuzzy. Focus on unique logical content.
    • Multi-Patching: To bypass the 80L limit, send MULTIPLE patch edits to the SAME symbol sequentially in one batch_edit.
    • ACID Rule: When multi-patching a symbol, EVERY search_text must match the ORIGINAL unaltered source code. Do not target code injected by previous patches.
  • ANTI-SWEEP SHIELD: NEVER use // eslint-disable, @ts-ignore, or # noqa. NREKI will block your edit. Fix the structural flaw.
  • RENAMING: Run nreki_navigate action:"prepare_refactor" first.

Read the full file on GitHub · 59 lines

Files

What ships with it

3 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.

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. 12d ago First seen · 59 lines · 43 tokens per session scan A 93d944f3c980

Subscribe to this mod's changes

nreki-optimizer is a skill published in the GitHub repository Ruso-0/Nreki (11 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 43 tokens to every session and 1,268 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to nreki-optimizer, differing in 12 lines, and is treated as a copy.