agentleFS
the-void-iathe-void-ia/void-box/.claude/skills/profile/SKILL.md

profile

Skill88 starsChanged 3 months agoApache-2.0View on GitHub

Use when investigating performance issues, VM freezes, high CPU usage, or when the user asks to profile a voidbox process. Also invoked as /perf.

29 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use apply, coverage and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • proficientlyjobsSkill

    apply

    Fill out a job application on Greenhouse, Lever, or Workday

    Also in 3 projects that use this

  • PydanticSkill

    coverage

    Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.

    Also in 3 projects that use this

  • dragonflydbSkill

    benchmark

    Benchmark Dragonfly (and compare against Valkey/Redis) on local or remote cloud instances, then produce a performance + memory report with charts and a raw-data appendix. Use this whenever the user runs /benchmark, or asks to benchmark / load-test / measure throughput, QPS, latency, or memory efficiency of Dragonfly or another Redis-compatible server, to compare Dragonfly vs Valkey or Redis, or to generate a benchmark report. Trigger it even when the user just describes the goal ("see how fast Dragonfly is on this box", "compare memory per key vs Valkey") without saying the word "benchmark".

    Also in 3 projects that use this

  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    docs

    Also in 3 projects that use this

  • VercelSkill

    setup

    Set up Vercel CLI and project configuration. Use when the user says "set up Vercel", "configure Vercel", "link to Vercel", or "vercel init".

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do NOT attempt to run sudo yourself.

    line 23
  2. Distinctive:

    Run these checks yourself (no sudo needed):

    line 27
  3. Very specific:

    After download or upgrade, ask the user to run the setcap command.

    line 58
  4. Very specific:

    If multiple processes, pick the voidbox shell one.

    line 74
  5. Distinctive:

    Use this workflow to find bottlenecks in a running (non-frozen) VM.

    line 115
  6. Distinctive:

    When a VM freezes (PTY stops producing output):

    line 152
  7. Distinctive:

    All threads normal → guest-side issue, check exit code

    line 164
  8. Distinctive:

    3. Exit code: after process dies:

    line 168

“Common” is measured: kept by at least 6 in 10 of the 23 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Profile a VoidBox Process

Profile CPU, off-CPU, and hardware counters using the eBPF-based perf-agent tool.

Prerequisites

Tell the user FIRST before doing anything else:

perf-agent requires Linux capabilities to run without sudo. Please run:

sudo setcap 'cap_sys_admin,cap_bpf,cap_perfmon,cap_sys_ptrace,cap_checkpoint_restore=ep' $HOME/.local/bin/perf-agent

(Only needed once after each download.)

Note: The binary must NOT be on a nosuid filesystem (e.g. /tmp), as file capabilities are silently ignored there.

Do NOT attempt to run sudo yourself. Ask the user and wait for confirmation.

Setup

Run these checks yourself (no sudo needed):

1. Detect architecture and download if needed:

ARCH=$(uname -m)
case "$ARCH" in
  x86_64)  SUFFIX="linux-amd64" ;;
  aarch64) SUFFIX="linux-arm64" ;;
esac

mkdir -p "$HOME/.local/bin"

LATEST=$(curl -s https://api.github.com/repos/dpsoft/perf-agent/releases/latest | grep '"tag_name"' | cut -d'"' -f4)

if [ -x "$HOME/.local/bin/perf-agent" ]; then
  CURRENT=$("$HOME/.local/bin/perf-agent" --version 2>/dev/null || echo "unknown")
  if echo "$CURRENT" | grep -q "${LATEST#v}"; then
    echo "perf-agent up-to-date ($LATEST)"
  else
    echo "Downloading perf-agent $LATEST..."
    curl -fSL -o "$HOME/.local/bin/perf-agent" "https://github.com/dpsoft/perf-agent/releases/download/${LATEST}/perf-agent-${SUFFIX}"
    chmod +x "$HOME/.local/bin/perf-agent"
  fi
else
  echo "Downloading perf-agent $LATEST..."
  curl -fSL -o "$HOME/.local/bin/perf-agent" "https://github.com/dpsoft/perf-agent/releases/download/${LATEST}/perf-agent-${SUFFIX}"
  chmod +x "$HOME/.local/bin/perf-agent"
fi

After download or upgrade, ask the user to run the setcap command.

2. Verify Go (required for pprof analysis):

go version

Find the PID

Auto-detect the running voidbox process:

pgrep -fa voidbox

If multiple processes, pick the voidbox shell one. If none found, tell the user to start a voidbox process first.

Collect

$HOME/.local/bin/perf-agent --pid <PID> --profile --offcpu --pmu \
  --duration 60s \
  --profile-output profile.pb.gz \
  --offcpu-output offcpu.pb.gz \
  --pmu-output pmu.txt

perf-agent flags

FlagDescriptionDefault
--pid <PID>Target process IDrequired (or --all)
-a, --allSystem-wide profiling (all processes)false
--profileEnable CPU profiling with stack tracesfalse
--offcpuEnable off-CPU profiling with stack tracesfalse
--pmuEnable PMU hardware countersfalse
--duration <DUR>Collection duration10s
--sample-rate <HZ>CPU profiling sample rate99
--profile-output <PATH>Output path for CPU profileauto-generated
--offcpu-output <PATH>Output path for off-CPU profileauto-generated
--pmu-output <PATH>Output path for PMU metricsstdout
--per-pidShow per-PID breakdown (only with -a --pmu)false
--tag key=valueAdd tag to profile (repeatable)—

Analyze

go tool pprof -text -nodecount=50 -cum profile.pb.gz    # call tree view
go tool pprof -text -nodecount=50 -cum offcpu.pb.gz     # off-CPU call tree
go tool pprof -text -nodecount=20 profile.pb.gz          # flat hotspots
cat pmu.txt                                              # PMU metrics

Performance Investigation

Use this workflow to find bottlenecks in a running (non-frozen) VM.

1. Baseline profile — capture 60s under normal workload.

2. Read PMU summary from pmu.txt:

  • IPC < 0.8 → memory-bound, look for cache thrashing
  • IPC > 1.5 → compute-bound, look for hot loops
  • Cache misses > 10/1K → data structures not cache-friendly
  • P99.9 on-CPU > 100ms → some thread holding CPU too long
  • Preempted > 20% → CPU saturation

3. CPU hotspots — functions consuming > 5% of flat CPU:

  • Packet parsing (BigEndian::read_u16, checksum) → optimize hot path
  • Filesystem ops (statx, getdents) → async or batch I/O
  • Lock overhead (MutexGuard::drop) → reduce critical section
  • Memory allocation (malloc, Vec::new) → pre-allocate or pool

4. Off-CPU bottlenecks — unexpected blocking:

  • Mutex::lock > 3% → lock contention, reduce lock scope
  • read/write on vCPU thread → blocking I/O on wrong thread
  • nanosleep in net-poll → normal (5ms poll interval)
  • epoll_wait in tokio → normal (idle reactor)

5. Thread-level snapshot with gstack:

gstack <PID> 2>&1 | awk '/^Thread/{t=$0} /void_box|slirp|virtio|vcpu_run|pty/{if(t){print t; t=""} print $0}'

6. Compare after optimization — re-profile and check IPC, cache misses, P99.9, and whether the target function dropped from top-20.

Frozen VM Triage

When a VM freezes (PTY stops producing output):

1. gstack first — identify which thread is stuck:

gstack <PID> 2>&1 | awk '/^Thread/{t=$0} /void_box|slirp|virtio|vcpu_run|pty|forward_dns/{if(t){print t; t=""} print $0}'

Key patterns:

  • vcpu-N NOT in KVM_RUN → stuck in host-side handler (blocking I/O)
  • vcpu-N in KVM_RUN + PTY at read_from_sync → guest process stopped output
  • vcpu-N in KVM_RUN + PTY at writer_handle.join() → guest sent PtyClosed
  • All threads normal → guest-side issue, check exit code

2. Profile for 30s to capture PMU metrics.

3. Exit code after process dies:

echo $?
# 153 = SIGXFSZ (file size limit), 137 = SIGKILL (OOM), 139 = SIGSEGV

PMU Reference

MetricHealthyInvestigate
IPC> 1.0< 0.8 (memory-bound)
Cache Misses/1K Instr< 5> 10 (cache thrashing)
P99.9 on-CPU< 50ms> 100ms (long hold)
Voluntary switches> 80%< 50% (CPU-bound)
Runqueue latency P99< 1ms> 5ms (CPU contention)

VoidBox Thread Reference

Thread nameExpected behavior
vcpu-NIn KVM_RUN ioctl (off-CPU is normal)
net-poll5ms sleep loop, slirp poll + relay
vsock-irqBlocked on vsock read (off-CPU is normal)
tokio-runtime-wepoll_wait when idle (normal)
PtySession::runBlocked on PTY read (normal)

Known Issues

  • vcpu-N stuck in forward_dns_query: DNS blocking vCPU (fixed in 50cdb9f)
  • vcpu-N stuck in TcpStream::connect_timeout: TCP connect blocking vCPU (known, not yet fixed)
  • Exit code 153 (SIGXFSZ): File size limit exceeded (fixed in cb2e2b1 for interactive mode)
  • High CPU in Virtio9pDevice::handle_readdir: Host FS ops on vCPU thread
  • Process dies during profiling: Profiles may not flush — rely on pmu.txt or stdout

Comparing Profiles

MetricMeaning
Max on-CPUWorst-case thread hold (stale if process was stuck earlier)
P99.9 on-CPUTail latency — should drop after fixing blocking calls
IPCHigher is better, < 0.8 is memory-bound
Cache misses/1KShould drop after removing hot-path work from vCPU threads

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.