Agent skill

Semantic Consistency Audit

by PlamenTSV in PlamenTSV/plamen

Trigger HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) - Agent Type general-purpose (standal...

MITAuto-check passedSecurity

Install Semantic Consistency Audit

skills CLI
$ npx skills add PlamenTSV/plamen --skill semantic-consistency-audit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen semantic-consistency-audit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/niche/semantic-consistency-audit .claude/skills/semantic-consistency-audit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
semantic-consistency-audit
GitHub stars
303
Token cost
~2.8k tokens
SKILL.md length
972 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) - Agent Type general-purpose (standal...

  • Works in 3 steps: Extract usage context: In each contract,… → Compare units: Do all contracts agree on… → Check setter constraints: If the…
  • HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters
  • SKILL.md covers When This Agent Spawns, Agent Prompt Template, Your Task and Output Format, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Semantic Consistency Audit is an agent skill from PlamenTSV/plamen. Trigger HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) - Agent Type general-purpose (standal...

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Security. The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters
  • Formulas) - Agent Type general-purpose (standal..

Example prompts

  • “/semantic-consistency-audit”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Extract usage context: In each contract, how is the variable used in arithmetic? What unit does the surrounding math assume? (e.g., BPS vs…
  2. Compare units: Do all contracts agree on the unit?
  3. Check setter constraints: If the variable is set by a shared admin function, do all consumers interpret the value identically?

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Semantic Consistency Audit loads about 2.8k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 972 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 972 words, ~2,777 tokens.

Download SKILL.mdSave it as .claude/skills/semantic-consistency-audit/SKILL.md (or your agent's skills folder).
name
semantic-consistency-audit
description
Trigger HAS_MULTI_CONTRACT flag in template_recommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) - Agent Type general-purpose (standal...

Niche Agent: Semantic Consistency Audit

Trigger: HAS_MULTI_CONTRACT flag in template_recommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) Agent Type: general-purpose (standalone niche agent, NOT injected into another agent) Budget: 1 depth budget slot in Phase 4b iteration 1 Finding prefix: [SC-N] Added in: v1.1

When This Agent Spawns

Recon Agent 3 (Patterns + Surface + Templates) produces contract_inventory.md and constraint_variables.md. If contract_inventory.md lists 2+ in-scope contracts/modules AND constraint_variables.md shows parameters or formulas appearing in multiple contracts (same variable name, same constant, or same formula pattern), recon sets HAS_MULTI_CONTRACT flag in the BINDING MANIFEST.

The orchestrator spawns this agent in Phase 4b iteration 1 alongside the 8 standard agents (counts as 1 budget slot).

Agent Prompt Template

Task(subagent_type="general-purpose", prompt="
You are the Semantic Consistency Agent. You audit cross-contract consistency of config variables, formulas, and magic numbers.

## Your Inputs
Read:
- {SCRATCHPAD}/constraint_variables.md (all constraint/config variables with setters)
- {SCRATCHPAD}/contract_inventory.md (all contracts/modules in scope)
- {SCRATCHPAD}/state_variables.md (all state variables)
- {SCRATCHPAD}/function_list.md (all functions)
- Source files in scope

## Processing Protocol (MANDATORY — applies to every CHECK below)

For each CHECK, execute three steps in order:
1. **ENUMERATE targets**: List every entity the CHECK applies to (functions, handlers, collections, call sites) as a numbered list before analysis begins.
2. **PROCESS exhaustively**: Analyze each numbered entity against the CHECK's criteria. Mark each "DONE" or "N/A (reason)" before moving to the next.
3. **COVERAGE GATE**: Count enumerated vs processed. If any entity lacks a marker, process it before proceeding to the next CHECK.

## Pre-Commit Dimension Enumeration (MANDATORY — fill BEFORE any finding)

**Per-sibling disposition rule**: When a finding holds for one contract in
a sibling set, force a per-sibling disposition row; do not self-refute
across siblings in one paragraph. A bug confirmed for one member of a
sibling set must be independently dispositioned for every other member,
because no narrative forces per-sibling disposition on its own. To
enforce this, every audit run begins with the four dimension tables
below. Fill them by reading recon artifacts
(`contract_inventory.md`, `function_summary.md`, `caller_map.md`,
`attack_surface.md`) — NOT from your own analysis.

```markdown
## Pre-Commit Dimension Enumeration

### Sibling Set (from contract_inventory.md)
| Member | In Scope? | Bug-Mirror Candidate? |
|--------|-----------|----------------------|
| <contract A> | YES | reference |
| <contract B> | YES | mirror sibling |
| <contract C> | YES | mirror sibling |

### Decoded-Field Set (from function_summary.md + source)
For each function consuming decoded calldata/payload, list every field:

| Field | Type | Origin | Validated? | Trust Class |
|-------|------|--------|-----------|------------|
| <field name> | <type> | <calldata/storage/etc> | YES/NO | <UNTRUSTED/SEMI/TRUSTED> |

### Mirror-Direction Set (from caller_map.md mirror pairs)
| Forward Op | Reverse Op | Both Symmetric? |
|-----------|-----------|-----------------|
| <op>      | <op>      | YES/NO          |

### Actor Set (Rule 12 categories from attack_surface.md)
| Actor                 | Can Reach Subject? | Path |
|-----------------------|-------------------|------|
| permissionless        | YES/NO            | <path> |
| semi-trusted role     | YES/NO            | <path> |
| natural ops           | YES/NO            | <path> |
| external event        | YES/NO            | <path> |
| user action sequence  | YES/NO            | <path> |

Per-row independence (HARD RULE): when you mark a row REPORTED or DISMISSED, you cite a file:line for THAT row only. A REFUTED verdict on row N cannot be evidence for row M. Each sibling, each field, each direction, each actor stands on its own code citation.

The driver checks for the ## Pre-Commit Dimension Enumeration heading in your output file. First audit cycle: missing PDE is a WARNING (no halt). Future cycles will promote to FAIL with a retry hint.

Your Task

CHECK 1: Config Variable Unit Consistency

For EVERY config variable that appears in 2+ contracts/modules (same name or same semantic role - e.g., feeRate, maxDelay, precision):

  1. Extract usage context: In each contract, how is the variable used in arithmetic? What unit does the surrounding math assume? (e.g., BPS vs WAD vs percentage vs seconds vs blocks)
  2. Compare units: Do all contracts agree on the unit?
  3. Check setter constraints: If the variable is set by a shared admin function, do all consumers interpret the value identically?
VariableContract AUnit in AContract BUnit in BMatch?Finding?

Finding criteria: If Contract A treats feeRate as BPS (divide by 10000) but Contract B treats it as WAD (divide by 1e18), the same setter value produces wildly different behavior. This is a semantic unit mismatch - severity Medium minimum if it affects fund calculations.

CHECK 2: Formula Semantic Drift

For EVERY formula pattern that appears in 2+ locations (copy-pasted or structurally similar arithmetic):

  1. Identify formula pairs: Find functions with structurally similar arithmetic (same operators, same variable roles) across different contracts or within the same contract for different operations
  2. Compare semantics: Do the formulas compute the same concept? Or has one been adapted with altered semantics?
  3. Check for silent divergence: Does one formula handle edge cases (zero, overflow, rounding direction) differently from its sibling?
Formula PatternLocation ALocation BSame Semantics?DivergenceFinding?

Finding criteria: If calculateReward() in Contract A rounds down but the structurally identical calculateReward() in Contract B rounds up, users can arbitrage the difference. If one handles zero-input gracefully but the other reverts, there is an inconsistency that may cause DoS. Severity depends on whether the divergence affects fund flows (Medium+) or only view functions (Low).

CHECK 3: Magic Number Consistency

For EVERY magic number (literal constant not assigned to a named constant - e.g., 10000, 1e18, 86400, 365):

  1. Catalog all magic numbers: Find all numeric literals used in arithmetic across all in-scope contracts. Exclude obvious safe cases (0, 1, 2 used for simple conditions).
  2. Group by semantic role: Which magic numbers represent the same concept? (e.g., multiple 10000 for BPS denominator, multiple 1e18 for WAD precision)
  3. Check consistency within each group: Do all instances use the same value for the same concept?
  4. Check for drift: Has a magic number been updated in one location but not another? (e.g., fee denominator changed from 10000 to 1000000 in Contract A but not Contract B)
Magic NumberSemantic RoleLocationsConsistent?Finding?

Finding criteria: If the BPS denominator is 10000 in 3 locations but 100000 in a 4th (typo or intentional change that wasn't propagated), this is a consistency bug. Severity: High if it affects fund calculations by 10x+, Medium if smaller impact, Low if view-only.

Show full SKILL.md (312 more words)Show less
CHECK 4: Struct / ABI Layout Consistency

For EVERY pair of structs (or abi.encode/abi.decode layouts) where one is built/encoded from, decoded into, or mirrors the other across an encode↔decode, serialize↔deserialize, or message-build↔message-parse boundary:

  1. Identify the paired structs/layouts: e.g. a *Params struct passed into an encoder vs the Decoded*/*Message struct produced by the matching decoder; an abi.encode(...) field order vs the abi.decode(..., (T1,T2,...)) types.
  2. Compare field count AND order AND type: do both sides have the SAME number of fields, in the SAME order, with matching types/widths? A field-count or order mismatch means the decoder reads the wrong bytes into the wrong field.
  3. Trace the consequence: if the layouts differ, which field is mis-read? Does a mis-read field reach a token address, amount, recipient, or auth check (then it is a value/security bug, not cosmetic)?
Struct/Layout A (fields)Struct/Layout B (fields)Same count/order/type?Mis-read fieldFinding?

Finding criteria: a <EncodedParams>(N fields) vs <DecodedMessage>(M≠N fields) mismatch, or an abi.encode order that differs from the abi.decode type list, that causes a token/amount/recipient field to be mis-read, is a confirmed finding (arbitrary/mis-validated withdrawal class). Pure off-by-layout in a non-value field is Low/Informational. Report the distinct layout-mismatch root cause even if an adjacent value-binding finding already touches the same function.

Coverage assertion: Before returning, verify every entity enumerated under each CHECK has been processed. Report enumerated vs analyzed counts in your return message.

Output Format

Use standard finding format with [SC-N] IDs.

For each finding, include:

  • Consistency Type: UNIT_MISMATCH / FORMULA_DRIFT / MAGIC_NUMBER_DRIFT
  • Both (or all) locations with code snippets showing the inconsistency
  • Concrete example of how the inconsistency manifests (e.g., 'Setting feeRate=100 means 1% in Contract A but 0.00001% in Contract B')

Chain Summary (MANDATORY)

| Finding ID | Location | Root Cause (1-line) | Verdict | Severity | Precondition Type | Postcondition Type |

Write to {SCRATCHPAD}/niche_semantic_consistency_findings.md

Return: 'DONE: {N} consistency issues found - {U} unit mismatches, {F} formula drifts, {M} magic number inconsistencies' ")


## Why Niche Agent (Not Scanner Sub-Check)

- Cross-contract consistency requires reading and comparing multiple files simultaneously - scanner sub-checks operate within a single pass
- Unit mismatch detection requires understanding arithmetic context (what does `/ 10000` mean here?) - not a simple grep pattern
- Formula drift detection requires structural comparison of code blocks across contracts - exceeds scanner complexity budget
- The concern is protocol-agnostic: applies to any multi-contract system regardless of chain (EVM, Solana, Aptos, Sui)

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/niche/semantic-consistency-audit of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Semantic Consistency Audit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Semantic Consistency Audit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Semantic Consistency Audit this skillPlamenTSV/plamen303—~2.8kAutomated safety check: PassMIT
Fla Ascend Performancefla-org/flash-linear-attention5.8k—~6.3kAutomated safety check: PassMIT
Deepsec Documentation Guidevercel-labs/deepsec8.1k—~956Automated safety check: PassApache-2.0
Skill Scannergetsentry/skills1k4 repos~2.5kAutomated safety check: WarnApache-2.0
Serenity Aleabitoreddityan-labs/serenity-aleabitoreddit4811 repos~3.3kAutomated safety check: PassNone
Security Alert Triageelastic/agent-skills5921 repos~3.5kAutomated safety check: NotesApache-2.0

Similar skills

  • Fla Ascend Performance

    fla-org/flash-linear-attention

    Guidelines for Ascend NPU kernel / Triton-Ascend backend performance work in the FLA repo.

    5.8k GitHub stars~6.3k tokensUpdated today
    SecurityAuto-check passed
  • Deepsec Documentation Guide

    vercel-labs/deepsec

    Official

    Points the agent at deepsec's own docs to answer questions about initializing, configuring, resuming, scanning with and extending the vulnerability scanner.

    8.1k GitHub stars~956 tokensUpdated 10 days ago
    SecurityAuto-check passed
  • Skill Scanner

    getsentry/skills

    Official

    Scan agent skills for security issues. An agent skill from getsentry/skills.

    1k GitHub starsUsed in 4 repos~2.5k tokens
    SecurityAuto-check: warnings
  • Serenity Aleabitoreddit

    yan-labs/serenity-aleabitoreddit

    Apply trader Serenity's (@aleabitoreddit) AI/semiconductor supply-chain analytical lens to US-stock ideas and market judgment.

    481 GitHub starsUsed in 1 repo~3.3k tokens
    SecurityAuto-check passed
  • Security Alert Triage

    elastic/agent-skills

    Official

    Triage Elastic Security alerts — gather context, classify threats, create cases, and acknowledge.

    592 GitHub starsUsed in 1 repo~3.5k tokens
    SecurityAuto-check: notes
  • Shiro Attack CLI

    SummerSec/ShiroAttack2

    当用户要求利用、检测或测试 Apache Shiro rememberMe 反序列化漏洞 (Shiro-550, CVE-2016-4437) 时使用。触发词包括 "Shiro"、"rememberMe"、"shiro attack"、"CVE-2016-4437"、"Shiro-550"、"爆破 Shiro key"、"利用 Shiro"、"Shiro…

    2.6k GitHub stars~945 tokensUpdated 4 mo ago
    SecurityAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 13 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 13 days ago
    Auto-check passed

Categories

Questions about Semantic Consistency Audit

What does Semantic Consistency Audit do?

Trigger HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) - Agent Type general-purpose (standal... Semantic Consistency Audit is an agent skill from PlamenTSV/plamen.md (recon detects 2+ in-scope contracts/modules sharing parameters or formulas) - Agent Type general-purpose (standal...

When should I use Semantic Consistency Audit?

Semantic Consistency Audit fits situations like: HASMULTICONTRACT flag in templaterecommendations.md (recon detects 2+ in-scope contracts/modules sharing parameters; formulas) - Agent Type general-purpose (standal..

How do I install Semantic Consistency Audit in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill semantic-consistency-audit -a claude-code`. Or copy the skill folder (agents/skills/niche/semantic-consistency-audit in PlamenTSV/plamen) into .claude/skills/semantic-consistency-audit in your project. Claude Code loads it when a task matches its description.

How do I install Semantic Consistency Audit in Codex?

Run `npx skills add PlamenTSV/plamen --skill semantic-consistency-audit -a codex`. Or copy the skill folder (agents/skills/niche/semantic-consistency-audit in PlamenTSV/plamen) into .agents/skills/semantic-consistency-audit in your project. Codex loads it when a task matches its description.

Can I use Semantic Consistency Audit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill semantic-consistency-audit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/semantic-consistency-audit, .gemini/skills/semantic-consistency-audit, .github/skills/semantic-consistency-audit and .opencode/skills/semantic-consistency-audit in your project.

What does Semantic Consistency Audit need to run?

SKILL.md names no scripts, command-line tools or credentials: Semantic Consistency Audit is instructions for the agent only.

Does Semantic Consistency Audit access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Semantic Consistency Audit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Semantic Consistency Audit use?

Semantic Consistency Audit is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Semantic Consistency Audit use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Semantic Consistency Audit?

Skills that share tags, products or a category with Semantic Consistency Audit: Fla Ascend Performance (fla-org/flash-linear-attention, 5.8k stars), Deepsec Documentation Guide (vercel-labs/deepsec, 8.1k stars), Skill Scanner (getsentry/skills, 1k stars) and Serenity Aleabitoreddit (yan-labs/serenity-aleabitoreddit, 481 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Semantic Consistency Audit?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.