kernel-gate-counts
FreeNo executable scriptsNot checkedCompile noir-protocol-circuits (kernels, rollup, etc.) and compute their gate counts with `bb gates`, for both the chonk (client IVC) and ultra_honk schemes…
by AztecProtocol★ 458 GitHub starsAbout this skill
Protocol-Circuit Gate Counts & Variant Regeneration
When to Use
Use this skill when asked to:
- Compile protocol circuits (private kernels, rollup circuits, etc.) with
nargo - Regenerate circuit variants (e.g. after adding
init-N/inner-N/ reset crates) - Measure gate counts / circuit sizes with
bb gates, for either:--scheme chonk— client-IVC circuits (private kernels)--scheme ultra_honk— standalone UltraHonk circuits (rollup circuits)
Key Paths
All paths relative to the git root.
- Protocol circuits workspace:
noir-projects/fnd/noir-protocol-circuits/ - Circuit crates:
noir-projects/fnd/noir-protocol-circuits/crates/<crate-name>/ - Variant generator:
noir-projects/fnd/noir-protocol-circuits/scripts/generate_variants.js - Workspace manifest (generated):
noir-projects/fnd/noir-protocol-circuits/Nargo.toml - Workspace template (source of truth):
noir-projects/fnd/noir-protocol-circuits/Nargo.template.toml nargobinary:noir/noir-repo/target/release/nargo— do NOT use a globally installed nargo; version mismatches produce opaque bytecode failures.bbbinary:barretenberg/cpp/build/bin/bbbb-avmbinary:barretenberg/cpp/build/bin/bb-avm— required for circuits that recurse the AVM (see Gotchas).- Compiled artifacts:
noir-projects/fnd/noir-protocol-circuits/target/<package_name>.json
Step 1 — Regenerate Variants (only when crates were added/removed)
generate_variants.js regenerates the reset-circuit variants under
crates/autogenerated/ AND rewrites the workspace Nargo.toml from
Nargo.template.toml. Run it after adding or removing crates so the new crates
are actually included in the workspace — otherwise nargo won't see them.
cd noir-projects/fnd/noir-protocol-circuits
node scripts/generate_variants.js
Verify the crates you expect are now listed, e.g.:
grep -nE "inner|init" Nargo.toml
Note: numbered kernel variants (init-N / inner-N) are hand-written crates
committed under crates/, not auto-generated. The generator only (re)writes
Nargo.toml and the crates/autogenerated/ reset variants. Running node
before compiling newly-added crates is needed purely to refresh Nargo.toml
from the template. If no crates changed, you can skip this step.
Step 2 — Compile
Package names use underscores, not dashes. A directory like
crates/private-kernel-inner-N has package name private_kernel_inner_N
(check the name = field in <crate>/Nargo.toml). Passing the dashed form to
--package fails with "invalid character '-' in package name".
cd noir-projects/fnd/noir-protocol-circuits
NARGO=../../noir/noir-repo/target/release/nargo
$NARGO compile --package <package_name> --silence-warnings
Discover package names for a family of crates automatically:
for d in crates/private-kernel-init crates/private-kernel-init-* \
crates/private-kernel-inner crates/private-kernel-inner-*; do
[ -d "$d" ] && grep -h '^name' "$d/Nargo.toml"
done
The *_simulated crates are unconstrained witness-generation variants, NOT
proving circuits — exclude them from gate counting unless explicitly asked.
Step 3 — Gate Counts
Pass the compiled .json artifact as the bytecode path:
bb gates --scheme <chonk|ultra_honk> -b target/<package_name>.json
Reading the result (works for both schemes): bb gates prints a JSON
object to stdout with the gate count in functions[].circuit_size
(acir_opcodes is the ACIR opcode count):
{"functions": [
{
"acir_opcodes": 8653,
"circuit_size": 32209
}
]}
Extract it robustly with jq (ignores any warnings on stderr):
bb gates --scheme chonk -b target/private_kernel_init.json 2>/dev/null \
| jq '.functions[].circuit_size'
The chonk scheme additionally prints a human-readable line to stderr
(capture with 2>&1, not 2>/dev/null):
ChonkStats - circuit: ivc_circuit, acir_opcodes: 8653, circuit_size: 32209 (mem: 30.22 MiB)
Example A — chonk circuit: private kernel init
cd noir-projects/fnd/noir-protocol-circuits
NARGO=../../noir/noir-repo/target/release/nargo
BB=../../barretenberg/cpp/build/bin/bb
$NARGO compile --package private_kernel_init --silence-warnings
$BB gates --scheme chonk -b target/private_kernel_init.json 2>/dev/null \
| jq '.functions[].circuit_size'
Example B — ultra_honk circuit: private base rollup
Rollup circuits recursively verify proofs that carry IPA (the rollup uses IPA
for the inner proofs), so you must pass --verifier_target noir-rollup.
Without it the construction aborts with IPA proofs present when not expected.
cd noir-projects/fnd/noir-protocol-circuits
NARGO=../../noir/noir-repo/target/release/nargo
BB=../../barretenberg/cpp/build/bin/bb
$NARGO compile --package rollup_tx_base_private --silence-warnings
$BB gates --scheme ultra_honk -t noir-rollup -b target/rollup_tx_base_private.json 2>/de
Install kernel-gate-counts in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the kernel-gate-counts skill do?
Compile noir-protocol-circuits (kernels, rollup, etc.) and compute their gate counts with `bb gates`, for both the chonk (client IVC) and ultra_honk schemes. Use when asked to regenerate circuit variants, compile protocol circuits, or measure gate/circuit sizes.
How do I install the kernel-gate-counts skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the kernel-gate-counts skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic