ubpf
Copilot instructions996 starsChanged 9 months agoApache-2.0View on GitHub
uBPF is a userspace eBPF virtual machine providing an Apache-licensed library for executing eBPF programs. It includes an eBPF assembler, disassembler, interpreter (all platforms), and JIT compiler (x86-64 and ARM64). - When performing a pull request or normal code review for this repository, use the code-review skill from .github/skills/code-review. - Treat code-review as the default review methodology for C and C++ changes unless the user explicitly asks for a different style of review. - The code-review skill should preserve as…
We split this copilot-instructions.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 95
Use fixed-width types from stdint.h (int64_t, uint8_t, not long, unsigned char)
- Very specific: line 96
Use const and static to limit scope
- Very specific: line 98
Use Doxygen comments with [in]/[out] annotations for public APIs
- Distinctive: line 101
All new files require:
- Very specific: line 117
When performing a pull request or normal code review for this repository, use the code-review skill from .github/skills/code-review.
- Very specific: line 119
Treat code-review as the default review methodology for C and C++ changes unless the user explicitly asks for a different style of review.
- Very specific: line 128
When asked to perform a deep manual branch-to-branch review or produce the full long-form adversarial report with coverage ledgers and a …
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for uBPF
Project Overview
uBPF is a userspace eBPF virtual machine providing an Apache-licensed library for executing eBPF programs. It includes an eBPF assembler, disassembler, interpreter (all platforms), and JIT compiler (x86-64 and ARM64).
Build and Test Commands
Prerequisites
- Initialize submodules:
git submodule update --init --recursive - Windows: Visual Studio with MSVC and
nuget.exein PATH - Linux: Run
./scripts/build-libbpf.sh - macOS: Install boost and optionally LLVM via Homebrew
Build
cmake -S . -B build -DUBPF_ENABLE_TESTS=true
cmake --build build --config DebugRun All Tests
# Linux/macOS
cmake --build build --target test
# Windows
ctest --test-dir buildRun a Single Test
# Run specific CTest by name pattern
ctest --test-dir build -R <test-name-pattern>
# Run Python tests directly with nose (requires build first)
cd test_framework && nosetests test_vm.py -m "add"Format Code
./scripts/format-code # Linux/macOS
./scripts/format-code.ps1 # WindowsArchitecture
Core Components
vm/- Core uBPF library (C)ubpf_vm.c- Interpreter implementationubpf_jit_x86_64.c- x86-64 JIT compilerubpf_jit_arm64.c- ARM64 JIT compilerubpf_loader.c- ELF loaderinc/ubpf.h- Public API header
ubpf/- Python assembler/disassembler toolsubpf_plugin/- BPF conformance test plugin
Test Structure
tests/- Data-driven test files (.dataformat with-- asm,-- result,-- memsections)test_framework/- Python test runners using nosecustom_tests/- C++ tests for scenarios needing custom setup- Each test has:
descrs/<name>.md,srcs/<name>.cc, optionallydata/<name>.input - Built with C++20
- Each test has:
Key VM APIs
struct ubpf_vm* ubpf_create(void);
int ubpf_load(struct ubpf_vm* vm, const void* code, uint32_t code_len, char** errmsg);
int ubpf_exec(const struct ubpf_vm* vm, void* mem, size_t mem_len, uint64_t* bpf_return_value);
ubpf_jit_fn ubpf_compile(struct ubpf_vm* vm, char** errmsg);Coding Conventions
Style
- LLVM-based style with Mozilla brace rules (see
.clang-format) - 120 column width
clang-formatversion 11+ required- Note:
docs/Contributing.mdmentions Allman braces and an 80 character column width, but.clang-formatis authoritative (Mozilla braces, 120 columns).
Naming
lower_snake_casefor variables, functions, file namesUPPER_SNAKE_CASEfor macros and constants- Prefix public API with
ubpf_ - Prefix internal/static functions with
_ - Structs: prefix with
_, typedef with_tsuffixtypedef struct _ubpf_widget { uint64_t count; } ubpf_widget_t;
Types and Headers
- Use fixed-width types from
stdint.h(int64_t,uint8_t, notlong,unsigned char) - Use
constandstaticto limit scope - Headers must be self-contained (include their dependencies)
- Use Doxygen comments with
[in]/[out]annotations for public APIs
License Header
All new files require:
// Copyright (c) <Contributor>
// SPDX-License-Identifier: Apache-2.0Pre-commit Hooks
The repository uses pre-commit hooks for:
- Secret detection (gitleaks)
- Shell script linting (shellcheck)
- C++ linting (cpplint)
- Python linting (pylint)
- Trailing whitespace and EOF fixes
Copilot Code Review
- When performing a pull request or normal code review for this repository, use the
code-reviewskill from.github/skills/code-review. - Treat
code-reviewas the default review methodology for C and C++ changes unless the user explicitly asks for a different style of review. - The
code-reviewskill should preserve as much of the adversarial review method as the review surface allows. Prefer fewer, higher-signal comments, and include severity, confidence, concrete consequence, and minimal fix direction in each finding. - Apply the review skill's adversarial process to changed files under
vm/with the highest priority, and use the same methodology for other runtime-critical changes when relevant. - When asked to perform a deep manual branch-to-branch review or produce the full
long-form adversarial report with coverage ledgers and a point-by-point fix list,
use the
adversarial-branch-reviewskill from.github/skills/adversarial-branch-review.
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- adversarial-branch-reviewSkill
- bootstrapSkill
- code-reviewSkill
- evolveSkill
- maintainSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

