kernel-invariants

kernel-invariants is a skill for Claude Code from Pinperepette/context-kernel. It costs 72 tokens per session (779 once invoked), scanned A, original, MIT.

A code-review step that turns a bug-fixing task and a selected code slice into a short list of rules the fix must preserve, with file-and-line references.

In plain words
What is it for?
Use it after selecting the relevant repository files and before writing a fix, to record contracts, data assumptions, expected behavior, and the path that causes the bug.
Why use it?
It converts a large amount of code into specific, checkable constraints before anyone changes the code. A code slice is the relevant part of a codebase and its dependencies.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the context-kernel plugin — 6 skills, 8 commands, 3 agents, 6 hooks, 1 MCP server shipped together

Good fit Use it after selecting the relevant repository files and before writing a fix, to record contracts, data assumptions, expected behavior, and the path that causes the bug.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add Pinperepette/context-kernel
Claude Code
/plugin install context-kernel

Made for: Claude Code.

Or install context-kernel, the plugin that ships this one along with the rest of its 6 skills, 8 commands, 3 agents, 6 hooks, 1 MCP server.

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 kernel-invariants

README.md
[![agentmods](https://agentmods.dev/badge/skills/pinperepette/context-kernel/kernel-invariants/github.svg)](https://agentmods.dev/skills/pinperepette/context-kernel/kernel-invariants)
Your own site
<a href="https://agentmods.dev/skills/pinperepette/context-kernel/kernel-invariants"><img src="https://agentmods.dev/badge/skills/pinperepette/context-kernel/kernel-invariants/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 kernel-invariants

Your own site · 80×15
<a href="https://agentmods.dev/skills/pinperepette/context-kernel/kernel-invariants"><img src="https://agentmods.dev/badge/skills/pinperepette/context-kernel/kernel-invariants.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 779 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.00072 $0.00779
Opus 5.5 $0.00029 $0.00312
Sonnet 5.5 $0.00014 $0.00156
Haiku 4.5 $0.00007 $0.00078

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

Security

Grade A, and why

kernel-invariants 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 3mo 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.

claude-context-kernel/skills/kernel-invariants/SKILL.md · 62 lines

How it starts

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

kernel-invariants — estrazione dei vincoli (T3)

Input: il manifest di kernel-repo-slice (o una lista di file) + il task Q. Output: la carta del task — poche proposizioni citabili che il fix deve rispettare. E' lossy per scelta: converte codice in vincoli. La regola che rende l'operazione verificabile: ogni vincolo cita la riga da cui viene.

Procedura

  1. Leggi i file della slice nell'ordine del manifest (seed -> 1 hop -> test). Per file grandi Python, usa kernel_slice (MCP) sul simbolo rilevante invece di leggere tutto.
  2. Estrai SOLO cio' che vincola il fix, in queste categorie:
    • Contratti: firme, tipi, eccezioni dichiarate/attese dai caller (api.py:12 si aspetta che connect() sollevi ConnectionError, non ritorni None)
    • Invarianti dei dati: assunzioni su forma/stato (db.py:30: pool inizializzato prima di connect — mai None dopo setup())
    • Comportamenti attesi: cosa fissano i test correlati (test_db.py:8: retry esattamente 3 volte prima di propagare)
    • Mappa del sintomo: errore -> raise site -> percorso dati che ci arriva
  3. Formato di output:
# carta del task
Q: <il bug, una riga>

## vincoli
1. [contratto]    <proposizione>          (file.py:riga)
2. [invariante]   <proposizione>          (file.py:riga)
3. [comportamento] <proposizione>         (test_x.py:riga)

## percorso del sintomo
<errore> nasce in <file:riga>, raggiunto da <catena breve>

## fuori slice ma sospetti (page fault suggeriti)
- <file/config> perche' <motivo>          (se nessuno: "nessuno")
  1. Salva la carta (la rende ATTIVA: la guardia sugli Edit inietta il vincolo giusto prima di ogni modifica a un file citato, e la carta sopravvive all'auto-compact):
python3 "${CLAUDE_PLUGIN_ROOT}/hooks/charter.py" save --repo <repo_root> <<'CK_EOF'
<la carta, esattamente come prodotta al punto 3>
CK_EOF

Regole

  • Un vincolo senza citazione file:riga NON e' un vincolo: eliminalo o trovala. (Vale anche meccanicamente: la guardia indicizza SOLO le citazioni.)
  • Massimo ~10 vincoli: se sono di piu', stai riassumendo, non estraendo.
  • Niente parafrasi del codice: solo cio' che il fix puo' violare.
  • La carta e' anche la checklist di review: dopo il fix, ripassala vincolo per vincolo (o passala a kernel-verify / al verifier agent).

Read the full file on GitHub · 62 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. 3mo ago First seen · 62 lines · 72 tokens per session scan A 273abd60e79d

Subscribe to this mod's changes

kernel-invariants is a skill published in the GitHub repository Pinperepette/context-kernel (24 stars, last pushed 4mo ago), licensed MIT. It adds 72 tokens to every session and 779 once invoked, about $0.0003 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

kernel-invariants compared with skills from other repositories

kernel-invariants next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
kernel-invariantsPinperepette/context-kernelSkill244mo agoMITA72Claude Code
autoreviewopenclaw/clawhubSkill9.6ktodayMITA17Claude Code, Codex
omh-code-reviewrlaope/oh-my-hermesSkill6.2ktodayMITA18Claude Code
agent-teams-simplify-and-hardenLeoYeAI/openclaw-master-skillsSkill2.2k9d agoMITA115Claude Code, Codex
asplos-writing-stylebrycewang-stanford/Awesome-Journal-SkillsSkill1.5k3d agoMITA65Claude Code
revdiff-planumputun/revdiffSkill9743d agoMITA84Claude Code
re0-mergeLilMGenius/paperthinSkill1.5kyesterdayMITA51Claude Code, Codex