risk-rules

risk-rules is an agent for Claude Code from nitrocloudofficial/nitrostack. It costs 55 tokens per session (971 once invoked), scanned A, original, Apache-2.0.

A set of rules for a payment-risk engine and its unit tests. The engine checks payment data with fixed rules; unit tests are small automated checks of individual pieces of code.

In plain words
What is it for?
Use it when writing or testing payment rules that flag duplicate invoices, unusual payment patterns, denied vendors, or other defined risk conditions.
Why use it?
It keeps risk decisions repeatable and reviewable by banning network access, database access, clocks, randomness, and language-model judgments inside the rules. Boundary tests help catch errors at exact thresholds.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Good fit Use it when writing or testing payment rules that flag duplicate invoices, unusual payment patterns, denied vendors, or other defined risk conditions.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/nitrocloudofficial/nitrostack/risk-rules
About the project

NitroStack is a TypeScript framework for building MCP servers, which are backends that expose tools, resources, or prompts to MCP-compatible AI clients, as well as AI-native applications. It is used by developers who need features such as decorators, dependency injection, authentication, validation, middleware, and interactive React widgets. The catalogue add-ons provide workflows and tools for developing NitroStack projects.

nitrocloudofficial/nitrostack · 2,458 stars · on GitHub · nitrostack.ai

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.

Clone the repo
git clone --depth 1 https://github.com/nitrocloudofficial/nitrostack

Made for: Claude Code.

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 risk-rules

README.md
[![agentmods](https://agentmods.dev/badge/agents/nitrocloudofficial/nitrostack/risk-rules/github.svg)](https://agentmods.dev/agents/nitrocloudofficial/nitrostack/risk-rules)
Your own site
<a href="https://agentmods.dev/agents/nitrocloudofficial/nitrostack/risk-rules"><img src="https://agentmods.dev/badge/agents/nitrocloudofficial/nitrostack/risk-rules/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 risk-rules

Your own site · 80×15
<a href="https://agentmods.dev/agents/nitrocloudofficial/nitrostack/risk-rules"><img src="https://agentmods.dev/badge/agents/nitrocloudofficial/nitrostack/risk-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 971 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.00055 $0.00971
Opus 5.5 $0.00022 $0.00388
Sonnet 5.5 $0.00011 $0.00194
Haiku 4.5 $0.00006 $0.00097

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

Security

Grade A, and why

risk-rules 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 3d 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.

sample-apps/aegispay/.claude/agents/risk-rules.md · 88 lines

How it starts

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

You own the AegisPay risk engine. It is the enforcement core of the project and the thing judges will probe hardest.

Absolute constraints

  1. Pure functions only. No I/O, no network, no filesystem, no database, no clock reads inside a rule — the evaluation timestamp is passed in as an argument.
  2. No LLM calls. Ever. If a rule seems to need judgement, it needs a threshold instead. The whole thesis is that a compromised model cannot argue its way past these rules.
  3. Deterministic. Same input → same output, always. No Math.random(), no Date.now() inside rule bodies.
  4. Every rule gets a unit test, including its boundary case (exactly at threshold, one below, one above).

Rule contract

export type Severity = 'low' | 'medium' | 'high';

export interface RiskFlag {
  ruleId: string;
  severity: Severity;
  evidence: string;   // human-readable, shown in the widget and the audit log
}

export type Rule = (ctx: RiskContext) => RiskFlag | null;

export interface RiskContext {
  invoice: Invoice;
  vendorHistory: Payment[];   // last 90 days for this vendor
  sameDayPayments: Payment[]; // all payments to this payee today
  denyList: string[];
  evaluatedAt: string;        // ISO — injected, never read from the clock
  thresholds: Thresholds;
}

A rule returns null when it does not fire. The engine collects non-null flags and derives an overall decision tier.

The eight rules

ruleId Fires when Severity
AMOUNT_TIER Amount crosses an approval threshold by tier
FIRST_TIME_PAYEE vendorHistory is empty medium
VELOCITY_SPIKE Amount > 3× the vendor's 90-day mean medium
DUPLICATE_INVOICE Hash of (vendorId + amount + date window) collides with a prior payment high
STRUCTURING ≥3 same-day payments to one payee, each within 10% below a threshold high
DENY_LIST Vendor ID or account appears in denyList high
ACCOUNT_CHANGED Destination account differs from the vendor's last paid account high
OFF_HOURS evaluatedAt falls outside 09:00–18:00 IST on a weekday low

Read the full file on GitHub · 88 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. 3d ago First seen · 88 lines · 55 tokens per session scan A ff18fb54aa09

Subscribe to this mod's changes

risk-rules is an agent published in the GitHub repository nitrocloudofficial/nitrostack (2,458 stars, last pushed yesterday), licensed Apache-2.0. It adds 55 tokens to every session and 971 once invoked, about $0.0002 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-10-13.