agentleFS
NVIDIAKnown publisherNVIDIA/nvrc/CLAUDE.md

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
  1. Distinctive:

    No libstd dependency (pure syscall interface)

    line 19
  2. Very specific:

    Offensive programming: Call the operation directly and use or_panic or expect to abort on failure.

    line 66
  3. Distinctive:

    API Compatibility: Keep std-compatible interfaces for easy exchange

    line 93
  4. Very specific:

    Functional style: Prefer functional programming idioms over imperative control flow.

    line 95
  5. Very specific:

    After completion: Run cargo fmt and cargo clippy

    line 98

≈ “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.

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

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:

  1. hardened_std::fs - File operations with path whitelisting
  2. hardened_std::process - Process execution with binary whitelisting
  3. hardened_std::os::unix::net - Unix sockets with path whitelisting
  4. Replace std::sync::Once with once_cell (no_std compatible)
  5. hardened_std::fs::exists() - Replace std::path::Path::exists()
  6. hardened_std::panic - Panic hook and power_off for VM shutdown
  7. Implement std::os::fd::AsFd for hardened types (nix poll integration)
  8. hardened_std::fs::copy() - Copy with source/destination whitelisting
  9. hardened_std::fs::set_permissions() - Permission control with path whitelisting
  10. hardened_std::fs::seal() - Make file immutable (FS_IMMFL ioctl)
  11. 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_std
  • nix - direct dependency (mount, reboot, fork, poll, ioctl); no_std goal is to replace it with direct libc syscalls
  • once_cell - yes, supports no_std
  • kernlog - 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_panic or expect to 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 str only (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 open takes runtime values (root hash, salt, block counts) from the measured cmdline, so they are as trustworthy as compile-time constants. The future process API should encode this (e.g. a MeasuredArg type) rather than a blanket String escape hatch; veritysetup joins 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

  1. API Compatibility: Keep std-compatible interfaces for easy exchange
  2. Tests: Minimal meaningful coverage. Tests can use std.
  3. Functional style: Prefer functional programming idioms over imperative control flow. Use combinators (map, and_then, inspect, filter, iterators) instead of if/else and mutable state where possible.
  4. After completion: Run cargo fmt and cargo clippy
  5. Minimize Rust Crates: Suggest smaller crates rather then pulling in huge crates like nix
  6. KISS: Minimize the cyclomatic complexity, keep code simple and stupid
  7. 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.

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.