CleverFetch

A 1:1 Fastfetch-parity system information CLI written in CleverLang, with a formally verified pure math core, a zero-capability pure CleverLang Fastfetch formatting/config/logo engine (ffcore), native cross-platform Linux & macOS probes, and kernel-enforced --sandbox mode (Linux Landlock + seccomp-bpf, macOS Seatbelt).

                     ..'          xlab@maxmac
                 ,xNMM.           -----------
               .OMMMMo            OS: macOS Golden Gate 27.0.1 (26A434) arm64
               lMM"               Host: MacBook Pro (14-inch, 2021)
     .;loddo:.  .olloddol;.       Kernel: Darwin 27.0.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:     Uptime: 18 days, 18 hours, 6 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.     Packages: 143 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.       Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM:        Display (Color LCD): 3024x1964 @ 2x in 14", 120 Hz [Built-in]
:MMMMMMMMMMMMMMMMMMMMMMMM:        Window Manager: Quartz Compositor 1.600.0
.MMMMMMMMMMMMMMMMMMMMMMMMX.       WM Theme: Multicolor (Dark)
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.     Theme: Liquid Glass
 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk    Font: .AppleSystemUIFont [System], Helvetica [User]
  'XMMMMMMMMMMMMMMMMMMMMMMMMK.    Cursor: Fill - Black, Outline - White (32px)
    kMMMMMMMMMMMMMMMMMMMMMMd      Terminal: rex 0.1.0-preview.19
     ;KMMMMMMMWXXWMMMMMMMk.       CPU: Apple M1 Max (8+2) @ 3.23 GHz
       "cooc*"    "*coo'"         GPU: Apple M1 Max (32) @ 1.30 GHz [Integrated]
                                  Memory: 42.72 GiB / 64.00 GiB (67%)
                                  Swap: 8.95 GiB / 10.00 GiB (90%)
                                  Disk (/): 1.52 TiB / 1.81 TiB (84%) - apfs [Read-only]
                                  Local IP (en0): 10.64.207.220/24
                                  Battery (bq40z651): 100% [AC Connected]
                                  Power Adapter: 60W
                                  Locale: en_US.UTF-8

Full graphic


1:1 Fastfetch Parity

  • 76 registered modules (29 in default structure), matching fastfetch --list-modules 1:1.
  • 544 built-in named ASCII logos (+ ? fallback) and 37 built-in presets (all.jsonc, ci.jsonc, neofetch.jsonc, archey.jsonc, paleofetch.jsonc, screenfetch.jsonc, examples/2..32.jsonc), packed as pure zero-capability CleverLang .rodata byte blobs + Array<U32> offset/binary-search tables in ffassets/ (caps = [], zero C, zero runtime allocation, O(log N) alias lookup).
  • Zero-capability pure CleverLang Fastfetch core (ffcore/, caps = []):
    • Template format engine (ffcore/format.clvr): {{ escapes, {-} stop, nested {?arg}..{?} and {/arg}..{/} conditionals, {#color} / {#} ANSI colors, {$N} / {$-N} / {$ENV} constants & environment variables, {} / {0} / {N} / {name} case-insensitive placeholders, signed byte slicing {~start[,end]}, truncation {:w}, alignment {<w} / {>w} / {|w} with negative-width ellipsis …, outer ANSI CSI preservation, and --pipe suppression.
    • Color parser (ffcore/color.clvr): all 10 style modifiers, 9 standard + 8 light colors, keys/title/output/separator theme references, 256-color @0..@255, 24-bit #RGB / #RRGGBB, raw SGR, and \e[...m passthrough.
    • Units & parsers (ffcore/units.clvr): IEC/SI/JEDEC byte sizes, durations (half-up minute rounding + 100 days(!)), GHz/MHz frequencies, C/F/K temperatures, percentage numbers & multi-color/monochrome progress bars, version/semver comparison, GTK settings folding, property files, glob matching, and Unicode display width (wcwidth).
    • JSONC/JSON5 parser (ffcore/jsonc.clvr): // and /* */ comments, trailing commas, single-quoted strings, unquoted keys, and UTF-8 BOM.
    • Logo engine (ffcore/logo.clvr): soft $1..$9 colors, $$ escapes, hard ANSI carry-color (--file-raw/--data-raw), 4-space tab expansion, left/top/right/auto positioning, padding, and min width/height.
    • System file & plist parsers (ffcore/sysparse.clvr): pure CleverLang parsers for XML .plist, /etc/os-release, /proc/{meminfo,uptime,cpuinfo,loadavg,net/route,net/fib_trie}, /etc/resolv.conf, APK DB, macOS codename/theme/accent tables, and UTC ISO formatting.
  • Formally verified math kernel (layoutmath/layoutmath.clvr, caps = []): 8 machine-checked laws (clampPct_bounds, barFill_bounds, barFill_monotone, barBlocksHalfUp_bounds_and_monotone, usageTier_valid_and_monotone, padCount_exact, rssiNegToQuality_bounds_and_antitone, versionCmpOrd_reflexive_and_antisymmetric) proven by CleverLang's BV SAT/LRAT kernel (clever prove).
  • Minimal OS syscall & framework FFI shim (sys_host.c): strictly limited to kernel syscalls and platform framework APIs unavailable in Clever's standard Io (sysctlbyname, Mach host_statistics64, getmntinfo/statvfs, getifaddrs, libproc, ioctl, isatty, mmap+memmem, and Seatbelt-safe lazy dlopen of CoreFoundation/IOKit/CoreGraphics).
  • Kernel-sandboxed binary (cleverfetch-sandbox): built with clever c --exe --sandbox deriving Fs, Clock, Out (no Net) for Linux Landlock + seccomp-bpf and macOS Seatbelt confinement.

Usage

cleverfetch [OPTIONS]

Common options (matching Fastfetch CLI):

FlagDescription
-c, --config <preset|path|none>Load a built-in preset (e.g. neofetch, all, examples/2) or JSONC config file
-s, --structure <A:B:C>Override colon-separated module list
--format <default|json>Output format (--format json emits Fastfetch JSON schema)
--pipe [bool]Disable colors and terminal control sequences (auto-enabled when piped or NO_COLOR is set)
-l, --logo <name|small|none>Select built-in logo by name/alias, small, or none
--logo-type, --logo-positionConfigure logo type (auto|builtin|small|file|file-raw|data|data-raw|none) and position (left|top|right|auto)
--logo-color-[1-9], --logo-padding*Customize logo colors and padding
--file, --file-raw, --data, --data-rawLoad custom logo from file or inline string
--separator, --color*, --key-type, --key-widthCustomize key/value display styling
--size-binary-prefix, --size-ndigits, --percent-type, --bar-widthControl unit & bar formatting
--stat [ms]Print per-module execution time (0.012ms precision)
--list-modules, --list-logos, --list-presetsList all 76 modules, 544 built-in logos, or 37 built-in presets
--gen-config [path]Generate a starter JSONC configuration file
-v, --version, --version-raw, --print-structurePrint version or default module structure

Examples:

./cleverfetch
./cleverfetch -c neofetch
./cleverfetch --format json
./cleverfetch --logo ubuntu --logo-position top
./cleverfetch -s os:kernel:cpu:gpu:memory --percent-type 3 --bar-width 12
./cleverfetch --stat --pipe

Building & Testing

Build & Verify

# Build both `cleverfetch` (raw) and `cleverfetch-sandbox`
make

# Type, borrow, capability check across layoutmath, ffcore, tests, and cleverfetch + lockfile check
make check

# Re-prove all 8 layoutmath laws with Clever's BV SAT/LRAT kernel
make prove

# Run 299 ported Fastfetch core unit tests (ffcore)
make test-unit

# Run full E2E parity suite (299 unit tests + 71 E2E & head-to-head fastfetch parity checks)
make test

# Run head-to-head performance benchmark vs fastfetch
make bench

# Install to /usr/local/bin (override with PREFIX=~/.local)
make install PREFIX=~/.local

Docker Fast Path

DOCKER_BUILDKIT=1 docker build --target export --output ./dist .
./dist/cleverfetch
CLEVER_ROOT=/ ./dist/cleverfetch-sandbox

Sandboxed Mode (cleverfetch-sandbox)

CleverLang statically derives the capability surface reachable from main (Fs, Clock, Out — no Net) and installs a kernel sandbox before application code runs:

make print-sandbox
capabilities this build can exercise (host calls reachable from main): Fs, Clock, Out
macOS Seatbelt profile (ROOT = realpath($CLEVER_ROOT), default `.`):
(version 1)
(deny default)
(allow sysctl-read (sysctl-name "hw.optional.arm.FEAT_DIT"))
(allow file-read* file-write* (subpath "ROOT"))
Linux: Landlock handles every file right of the running ABI, allows them (but EXECUTE) beneath $CLEVER_ROOT; TCP bind/connect denied (ABI >= 4); no_new_privs; seccomp: execve, execveat, fork, vfork, clone without CLONE_THREAD -> EPERM, clone3 -> ENOSYS, socket(non-AF_UNIX) -> EPERM

Run sandboxed with CLEVER_ROOT=/:

CLEVER_ROOT=/ ./cleverfetch-sandbox

Benchmarks vs Fastfetch

Measured on macOS 27.0.1 (Apple M1 Max, ARM64), 10 warmup + 50 measured runs per scenario via python3 tests/bench_vs_fastfetch.py:

Scenariocleverfetch p50fastfetch 2.70.0 p50Speedup
Default full (29 modules + OS logo)30.22 ms49.79 ms1.65× faster (−19.57 ms)
JSON mode (--format json, 29 modules)29.79 ms50.42 ms1.69× faster (−20.63 ms)
Built-in preset (-c neofetch --pipe)29.85 ms48.68 ms1.63× faster (−18.83 ms)
Core 17 modules (no Display)9.81 ms21.94 ms2.24× faster (−12.12 ms)
Minimal fast path (os:kernel:cpu:memory)6.11 ms8.85 ms1.45× faster (−2.73 ms)
Sandboxed minimal (CLEVER_ROOT=/, Seatbelt)10.53 msn/aKernel-confined

Project Layout

cleverfetch/
├── clever.toml                     # Package manifest (`caps = []` on layoutmath, ffcore, ffassets)
├── clever.lock                     # Cryptographic dependency trust-surface lockfile
├── cleverfetch.clvr                # Main CleverLang CLI, 76 modules, cached probe & JSON engine
├── sys_host.c                      # Minimal cross-platform OS syscall & framework FFI shim
├── layoutmath/
│   ├── clever.toml                 # Pure zero-capability math subpackage
│   ├── layoutmath.clvr             # 8 verified functions + 8 BV SAT/LRAT laws
│   └── layoutmath.proofs.json      # Machine-checked proof manifest (`clever prove`)
├── ffcore/
│   ├── clever.toml                 # Pure zero-capability Fastfetch core subpackage
│   ├── color.clvr                  # ANSI / 256 / 24-bit / theme color parser
│   ├── units.clvr                  # Size, duration, freq, temp, percent/bar, semver, GTK, props, glob
│   ├── format.clvr                 # Full Fastfetch `{...}` template parser & renderer
│   ├── jsonc.clvr                  # JSONC/JSON5 pre-processor + parser
│   ├── logo.clvr                   # Soft/hard color logo renderer & position selector
│   └── sysparse.clvr               # Pure XML plist, /etc/os-release, /proc, /sys & macOS parsers
├── ffassets/
│   ├── clever.toml                 # Pure zero-capability `.rodata` asset subpackage
│   ├── logos.clvr                  # 545 built-in ASCII logos + O(log N) binary-search alias table
│   └── presets.clvr                # 37 built-in Fastfetch JSONC presets
├── tests/
│   ├── clever.toml                 # Unit test package manifest
│   ├── test_ffcore.clvr            # 337 ported Fastfetch core + sysparse + ffassets assertions
│   ├── run_fastfetch_parity.py     # 71 E2E & head-to-head parity checks vs fastfetch
│   └── bench_vs_fastfetch.py       # Head-to-head performance benchmark vs fastfetch
├── scripts/
│   ├── gen-assets.py               # Generator for pure CleverLang `.rodata` logos & presets
│   ├── setup-cleverlang.sh         # CI CleverLang bootstrap script
│   ├── verify-static.sh            # Full type/proof/trust/lock/sandbox verification
│   ├── smoke-test.sh               # Release binary smoke & sandbox enforcement test
│   └── publish-release.sh          # Trylle release publisher
├── Makefile                        # Build, verify, prove, test, bench, install, Docker
└── Dockerfile                      # Multi-stage build + binary export + runtime image