Kprobe
Docs › Start › Quickstart

Quickstart

Kprobe is one static binary for Linux x86_64 with its BPF programs inside. It runs an agent under a policy and prints a timeline of every file, exec and socket the agent touches.

Install

curl -fsSL https://kprobe.xyz/install.sh | sh

The script downloads the binary to /usr/local/bin/kprobe, the rule registry to /opt/kprobe/rules and the sample policies to /opt/kprobe/policies. It asks for sudo once to write those paths. Check the binary against the SHA-256 printed on the install page if you install by hand.

kprobe check

check prints what your kernel supports: BTF, the kprobe PMU, an active BPF LSM, cgroup v2, and which file backend Kprobe will use.

Run an agent under a policy

Loading BPF programs needs root (CAP_BPF, CAP_PERFMON, CAP_NET_ADMIN). The agent itself runs as your user through --user, or as the user who called sudo.

sudo kprobe run --policy /opt/kprobe/policies/claude-code.yaml \
  --rules /opt/kprobe/rules --log ~/kprobe.jsonl -- claude

Claude Code

Use policies/claude-code.yaml. It allows api.anthropic.com and the npm and PyPI registries, and nothing else. Add your own hosts under egress_allow.

Codex

Use policies/codex.yaml, which allows api.openai.com and chatgpt.com instead.

Read the timeline

kprobe watch ~/kprobe.jsonl -f

Denied rows are printed in vermilion with the id of the rule that matched. Try it first with --audit: nothing is blocked, and every row a policy would deny says would-deny.

How the sensor works →