/odin-native:memory-hierarchy-and-cachesfrom ODIN Native
Explains CPU cache concepts: levels, associativity, line size, false sharing, MESI coherence, and prefetching. Reads system cache geometry from getconf/lscpu/perf stat.
Ships in ODIN Native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Field | Bound contract |
|---|---|
| Trigger | Padding fixed a scaling problem and needs explaining, a struct layout for multicore needs choosing, a cache miss counter needs interpreting, or a DMA buffer disagrees with the CPU cache on an embedded SoC. |
| Authority | Read-only. The skill reads getconf, lscpu, and perf stat output and answers in chat. Nothing on disk changes, so there is nothing to roll back. No remote mutation. |
| Side effect | Chat output only. |
| Done | The answer names the level and the miss class involved, quotes the host's line size and cache sizes from the tools, and states the layout or access change with its condition. |
getconf -a | grep -i CACHE # line sizes, sizes, associativity
lscpu | grep -i cache
Line size is 64 bytes on current x86-64 and most AArch64 parts, and the tools above confirm it. Per-core L1 and L2 sizes and the shared last-level size vary by part; quote the numbers the tool prints. A microcontroller may have only tightly coupled memory and no L2 or L3 at all.
/* Two counters share one line; two cores fight over it. */
struct {
atomic_int counter_a;
atomic_int counter_b;
} stats;
/* Each counter owns a line. */
struct {
alignas(64) atomic_int counter_a;
alignas(64) atomic_int counter_b;
} stats;
__builtin_prefetch(&data[i + 8], 0, 3) helps only when the address is known several iterations ahead and the access would otherwise miss. Done when: the prefetch is kept with a measured gain or removed.perf stat -e cache-references,cache-misses,L1-dcache-load-misses ./app
For the layout work itself (AoS versus SoA, blocking, measured prefetch) use cpu-cache-opt. For the load-use stall this produces, use cpu-pipelines-and-hazards. For the translation miss that precedes the cache, use virtual-memory-paging-and-tlb. For remote-node latency, use numa-programming.
| Failure class | Behavior |
|---|---|
| No target machine | Deliver the mechanism and mark every size as to be read from the target. Do not quote recalled sizes as fact. |
perf stat denied | Report the perf_event_paranoid value the tool prints. Do not change the sysctl. |
| Scaling collapses with threads | False sharing. Align per-thread data to the line size and re-measure. |
| High last-level misses | Working set exceeds the shared cache. Block the algorithm or pin to one NUMA node. |
| Device sees stale data | The CPU cache and the DMA engine disagree. On Linux use the dma_sync_* API around each transfer; on a microcontroller clean or invalidate the buffer's lines explicitly. |
| Manual prefetch slowed the loop | The access was already covered by the hardware prefetcher or the address was not known early enough. Remove it. |
A chat answer that quotes the target's line size and cache sizes, names the level and miss class, and gives one layout or access change with the counter that will confirm it.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-native138 skills in this plugin
/abi-and-calling-conventionsUse when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi./adc-dac-baremetalUse when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal./af-xdpUse when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.Other plugins' skills for the same job