consensus-math-correctness

consensus-math-correctness is a skill for Claude Code, Codex from PlamenTSV/plamen. It costs 30 tokens per session (1,108 once invoked), scanned A, original, MIT.

A review of arithmetic that determines blockchain consensus, such as difficulty, rewards, moving averages, and target timing. Consensus is the shared rule that lets network nodes agree on the chain's state.

In plain words
What is it for?
Use it when checking Go or Rust code for truncation, incorrect bounds, reversed moving-average adjustments, or threshold edge cases.
Why use it?
Small arithmetic errors can consistently produce the wrong protocol result, such as a miscalculated difficulty or threshold.

Skill for Claude CodeCodex

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

Good fit Use it when checking Go or Rust code for truncation, incorrect bounds, reversed moving-average adjustments, or threshold edge cases.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/plamentsv/plamen/consensus-math-correctness
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 PlamenTSV/plamen --skill consensus-math-correctness
Clone the repo
git clone --depth 1 https://github.com/PlamenTSV/plamen

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 consensus-math-correctness

README.md
[![agentmods](https://agentmods.dev/badge/skills/plamentsv/plamen/consensus-math-correctness/github.svg)](https://agentmods.dev/skills/plamentsv/plamen/consensus-math-correctness)
Your own site
<a href="https://agentmods.dev/skills/plamentsv/plamen/consensus-math-correctness"><img src="https://agentmods.dev/badge/skills/plamentsv/plamen/consensus-math-correctness/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 consensus-math-correctness

Your own site · 80×15
<a href="https://agentmods.dev/skills/plamentsv/plamen/consensus-math-correctness"><img src="https://agentmods.dev/badge/skills/plamentsv/plamen/consensus-math-correctness.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,108 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.00030 $0.01108
Opus 5.5 $0.00012 $0.00443
Sonnet 5.5 $0.00006 $0.00222
Haiku 4.5 $0.00003 $0.00111

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

Security

Grade A, and why

consensus-math-correctness 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 1mo 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/injectable/l1/consensus-math-correctness/SKILL.md · 125 lines

How it starts

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

Injectable Skill: Consensus Math Correctness

L1 trigger: CONSENSUS flag AND (adjust_difficulty OR difficulty_adjust OR ema OR moving_average OR reward_curve OR target_time detected) Inject Into: depth-consensus-invariant or depth-edge-case Language: Go and Rust Finding prefix: [CM-N]

Consensus math bugs are small, deterministic, and load-bearing. They rarely need fancy exploit chains: one wrong operator, one dead bound, or one flipped EMA direction can permanently skew the chain.

1. Division-before-multiplication

For every expression of the form (A / B) * C, test whether A < B is possible. If so, the intermediate division truncates to zero before the multiplication and the protocol silently loses precision.

Questions:

  1. Can A < B happen at runtime?
  2. Is the intended formula mathematically (A * C) / B?
  3. If multiplication moves first, is there an overflow guard on the wider intermediate?

Tag: [CONSENSUS-MATH:DIV-FIRST]

2. Declared-but-unapplied bounds

Consensus configs often declare bounds that never influence runtime math.

Questions:

  1. Which config fields look like bounds or caps? Example names: max_difficulty_adjustment_factor, min_reward, max_step_count.
  2. Is each field used only during config parsing, or also in the live computation?
  3. If a field is declared but never applied at runtime, what unbounded state transition does that permit?

Tag: [CONSENSUS-MATH:UNUSED-BOUND]

3. EMA / moving-average direction

For each moving-average implementation, identify the prior sample, current sample, and smoothing factor.

Questions:

  1. Does the code use the same sample ordering as the design doc or comments?
  2. Is the "previous" state actually previous, or has the implementation swapped current and prior inputs?
  3. If the direction is flipped, does the chain overreact instead of smoothing?

Tag: [CONSENSUS-MATH:EMA-DIRECTION]

4. Threshold operators

Consensus edge cases often live at threshold-1, threshold, and threshold+1.

Read the full file on GitHub · 125 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. 1mo ago First seen · 125 lines · 30 tokens per session scan A a64476cbb442

Subscribe to this mod's changes

consensus-math-correctness is a skill published in the GitHub repository PlamenTSV/plamen (306 stars, last pushed 21d ago), licensed MIT. It adds 30 tokens to every session and 1,108 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

alchemy-cli

Use the Alchemy CLI (@alchemy/cli) for live blockchain data, transaction lookups, NFT/token/portfolio queries, simulation, tracing/debugging, account abstraction (bundler + gas manager), webhook management, Solana RPC/DAS, and Alchemy app administration. Preferred runtime path for live agent work (querying, admin…

alchemyplatform/alchemy-claude-plugin · 156 tokens

debug

Troubleshoot ChainGPT API errors and issues. Use when: chaingpt error, api not working, 401, 402, 403, 404, 429, insufficient credits, rate limit, streaming broken, nft stuck, chat history not working. Diagnoses the problem and provides the fix.

ChainGPT-org/chaingpt-claude-skill · 65 tokens

evm-tx-debugger

Debug failed EVM transactions by decoding revert reasons, analyzing gas consumption, parsing events, and explaining execution errors across 7 chains. No API keys required.

XSpoonAi/spoon-awesome-skill · 38 tokens

solidity-debug

A failed-transaction debugging guide for Solidity networks using Foundry's command-line tools. It explains how to inspect a transaction receipt and details, distinguish running out of gas from a contract revert, and decode the called function.

0xlayerghost/solidity-agent-kit · 57 tokens

postgresql-indexing

PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing…

prowler-cloud/prowler · 108 tokens

gh-aw

Create and maintain GitHub Agentic Workflows (gh-aw) for Prowler. Trigger: When creating agentic workflows, modifying gh-aw frontmatter, configuring safe-outputs, setting up MCP servers in workflows, importing Copilot Custom Agents, or debugging gh-aw compilation.

prowler-cloud/prowler · 59 tokens