nvrc
CLAUDE.md47 starsChanged 31 days agoApache-2.0View on GitHub
Read ARCHITECTURE.md first to understand the security model, threat landscape, and design rationale before making changes. NVRC is a minimal init process (PID 1) for ephemeral confidential VMs with NVIDIA GPUs. It configures GPU resources, starts required daemons (nvidia-persistenced, nv-hostengine, etc.), and hands off to kata-agent. The goal is to eventually run NVRC as no_std. We are slowly transitioning by building hardened_std as our security-hardened std replacement. This enables: **no_std Transition Roadmap:** Runtime-writable config pattern: The rootfs image is read-only.…
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
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
- Distinctive: line 19
No libstd dependency (pure syscall interface)
- Very specific: line 66
Offensive programming: Call the operation directly and use or_panic or expect to abort on failure.
- Distinctive: line 93
API Compatibility: Keep std-compatible interfaces for easy exchange
- Very specific: line 95
Functional style: Prefer functional programming idioms over imperative control flow.
- Very specific: line 98
After completion: Run cargo fmt and cargo clippy
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md 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
NVRC Development Guide
Read ARCHITECTURE.md first to understand the security model, threat landscape, and design rationale before making changes.
Project Overview
NVRC is a minimal init process (PID 1) for ephemeral confidential VMs with NVIDIA GPUs. It configures GPU resources, starts required daemons (nvidia-persistenced, nv-hostengine, etc.), and hands off to kata-agent.
Long-term Goal: no_std
The goal is to eventually run NVRC as no_std. We are slowly transitioning
by building hardened_std as our security-hardened std replacement. This
enables:
- Smaller binary size
- No libstd dependency (pure syscall interface)
- Reduced attack surface
- Better control over all system interactions
no_std Transition Roadmap:
hardened_std::fs- File operations with path whitelistinghardened_std::process- Process execution with binary whitelistinghardened_std::os::unix::net- Unix sockets with path whitelisting- Replace
std::sync::Oncewithonce_cell(no_std compatible) hardened_std::fs::exists()- Replacestd::path::Path::exists()hardened_std::panic- Panic hook and power_off for VM shutdown- Implement
std::os::fd::AsFdfor hardened types (nix poll integration) hardened_std::fs::copy()- Copy with source/destination whitelistinghardened_std::fs::set_permissions()- Permission control with path whitelistinghardened_std::fs::seal()- Make file immutable (FS_IMMFL ioctl)- Audit all dependencies for no_std compatibility
Runtime-writable config pattern:
The rootfs image is read-only. Config files that need modification at runtime
(e.g. fabricmanager.cfg) must be copied to a writable tmpfs (/run) before
editing. Since /run is a writable tmpfs on an otherwise read-only root, the
file must be sealed after writing: copy() -> write() ->
set_permissions(0o400) -> seal(). The seal() sets the immutable flag via
FS_IMMFL ioctl so even root cannot modify or delete the file without first
clearing the flag. hardened_std should enforce this copy-write-seal pattern
for any file written to tmpfs.
Dependencies no_std status:
anyhow- yes, supports no_std (disable default features)log- yes, supports no_stdnix- direct dependency (mount, reboot, fork, poll, ioctl); no_std goal is to replace it with direct libc syscallsonce_cell- yes, supports no_stdkernlog- no, requires std (may need replacement)rlimit- needs investigation
hardened_std
Security-hardened std replacement with whitelist-only access to filesystem, processes, and sockets.
Core Principles:
- Fresh filesystem on every boot - creation fails if a path already exists
- Offensive programming: Call the operation directly and use
or_panicorexpectto abort on failure. Let creation failures expose unexpected state; do not add defensive existence checks. Disabled optional setup is a no-op. - No
remove_file- we setup clean state, not fix bad state - Whitelist-only: paths, binaries, socket paths must be explicitly allowed
- Static arguments:
&'static stronly (no runtime injection) - Minimal surface: implement only what NVRC actually needs
- Single-threaded: NVRC is PID 1 (init) with no threads - no thread::sleep, no mutexes, no thread-safe synchronization needed in production code
Composable image extensions (migration notes):
- Prefix whitelisting: extensions mount under
/run/kata-extensions/<name>/, a runtime-built path, so the whitelist needs a prefix rule for that tree, not exact paths. The extension-name charset check (reject../traversal) keeps the prefix sound. - Measured arguments:
veritysetup opentakes runtime values (root hash, salt, block counts) from the measured cmdline, so they are as trustworthy as compile-time constants. The futureprocessAPI should encode this (e.g. aMeasuredArgtype) rather than a blanketStringescape hatch;veritysetupjoins the binary whitelist. - Loader path: everything (kata-agent, the CDI hooks it runs, and NVRC's own GPU tools) finds the GPU libraries via the loader cache, which NVRC rebuilds from the extension's lib dir.
Guidelines
- API Compatibility: Keep std-compatible interfaces for easy exchange
- Tests: Minimal meaningful coverage. Tests can use std.
- Functional style: Prefer functional programming idioms over imperative
control flow. Use combinators (
map,and_then,inspect,filter, iterators) instead ofif/elseand mutable state where possible. - After completion: Run
cargo fmtandcargo clippy - Minimize Rust Crates: Suggest smaller crates rather then pulling in huge crates like nix
- KISS: Minimize the cyclomatic complexity, keep code simple and stupid
- Self-describing code: Names carry the WHAT so comments can focus on the WHY. If you reach for a comment to explain what a function, type, or variable does, rename it instead. Reserve comments for non-obvious WHY: hidden constraints, subtle invariants, source citations for magic constants (e.g. NIST test vectors), or workarounds for specific bugs. Don't restate what well-named code already says.
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
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.

