npm for agent policies β now in Rust. π¦ Install and run pre-compiled FLUX bytecode policies from the static GitHub registry.
A Rust CLI for the FLUX Registry: download, inspect, and execute pre-compiled agent policies. Same policies, same bytecode, different shell.
Part of Working Animal Architecture, where Ξ³ + Ξ· = C (genome + nurture = capability). The FLUX Registry is the breed catalog β pre-compiled, verified policies that any working animal can be trained on. Install a policy like choosing a breed for a task: the right dog for the right job, the right bytecode for the right fence.
cargo install flux-registry-cliOr build from source:
git clone https://github.com/SuperInstance/flux-registry-rs.git
cd flux-registry-rs
cargo build --release
# Binary at target/release/flux-registry# Browse available policies in the remote registry
flux-registry list --remote
# Install a policy locally
flux-registry install deadband-controller
# Run it with inputs
flux-registry run deadband-controller --input temperature=72
# β action=idle
flux-registry run deadband-controller --input temperature=80
# β action=cool
flux-registry run deadband-controller --input temperature=60
# β action=heat
# Inspect policy metadata
flux-registry info deadband-controller| Command | Description |
|---|---|
flux-registry install <policy> |
Install a policy from the remote registry |
flux-registry list [--remote] |
List installed (or remote) policies |
flux-registry info <policy> |
Show detailed metadata, inputs, and outputs |
flux-registry run <policy> --input K=V [--input K2=V2] |
Execute a policy with given inputs |
flux-registry remove <policy> |
Remove an installed policy |
flux-registry update-index |
Refresh the local registry cache |
| Policy | Description | Inputs | Outputs |
|---|---|---|---|
deadband-controller |
Thermostat with hysteresis β AC at 75Β°F, heat at 65Β°F | temperature (Β°F) |
action: idle / cool / heat |
budget-tracker |
Conservation budget enforcement β track resource depletion | cost, budget |
remaining, status: ok / exceeded |
rate-limiter |
Token bucket rate limiting β check and consume tokens | tokens, cost |
remaining, allowed: denied / allowed |
security-scanner |
Basic vulnerability detection β threshold-based policy check | value, threshold |
verdict: safe / violation, severity |
Each policy is a self-contained JSON file:
{
"name": "deadband-controller",
"version": "0.1.0",
"description": "Thermostat deadband controller",
"author": "SuperInstance",
"bytecode": "<base64-encoded FLX0 binary>",
"source": "deadband-controller.flx",
"bytecode_hash": "sha256...",
"bytecode_size": 30,
"inputs": [
{"name": "temperature", "type": "float", "register": "R0"}
],
"outputs": [
{"name": "action", "type": "int", "register": "R1",
"values": {"0": "idle", "1": "cool", "2": "heat"}}
],
"conservation": {"max_steps": 100, "memory_budget": 256},
"conformance": "verified on flux-vm 0.1.0, fluxvm 0.1.0, flux-js 0.1.0",
"tags": ["iot", "thermostat", "hvac"],
"license": "MIT"
}Every policy declares conservation limits:
"conservation": {
"max_steps": 100,
"memory_budget": 256
}The VM enforces these at runtime β a policy cannot exceed its step count or memory allocation. This makes FLUX policies safe to run as untrusted code.
The CLI also exposes a library crate (flux_registry_cli_lib) for embedding in other Rust applications:
| Type/Function | Description |
|---|---|
Policy |
Deserialized policy struct with metadata, bytecode, I/O specs |
Policy::from_json(s) |
Parse a policy from JSON string |
Policy::decode_bytecode() |
Decode base64 bytecode to raw bytes |
| Function | Description |
|---|---|
fetch_index() |
Fetch the remote registry index from GitHub |
fetch_policy(name) |
Download a specific policy JSON |
list_remote() |
List all available policies in the remote registry |
| Function | Description |
|---|---|
install_policy(policy) |
Save policy to ~/.flux/policies/ |
list_installed() |
List all locally installed policies |
get_policy(name) |
Load a locally installed policy |
remove_policy(name) |
Delete a locally installed policy |
Built-in FLX0 stack-based mini VM for executing registry policies, plus fluxvm crate integration for register-based FLUX ISA compatibility.
use flux_registry_cli_lib::vm::run_policy;
let result = run_policy(&bytecode, inputs).unwrap();
println!("Output: {:?}", result.outputs);ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FLUX Registry (Rust) β
β β
β GitHub (static JSON) Local (~/.flux/) β
β βββββββββββββββββββ ββββββββββββββββββββ β
β β registry/ β install β policies/ β β
β β index.json β ββββββββΆ β deadband.json β β
β β deadband.json β β budget.json β β
β β budget.json β ββββββββββ¬ββββββββββ β
β β rate-limiter β β β
β β security.json β ββββββββββΌββββββββββ β
β βββββββββββββββββββ β flux-registry β β
β β ββββββββββββββββ β β
β β β FLX0 Mini VM β β β
β β β (built-in) β β β
β β ββββββββββββββββ β β
β β ββββββββββββββββ β β
β β β fluxvm crate β β β
β β β (register β β β
β β β ISA support)β β β
β β ββββββββββββββββ β β
β ββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The CLI includes a built-in FLX0 stack-based mini VM for executing registry policies locally. It also depends on the fluxvm crate for register-based FLUX ISA compatibility.
# Run all tests
cargo test
# Run with verbose output
cargo test -- --nocapture
# Integration tests use tempfile for isolated policy installs
cargo test --test integration| Runtime | Language | Install |
|---|---|---|
| flux-registry | Python | pip install flux-registry |
| flux-registry-cli | Rust | cargo install flux-registry-cli |
| flux-js | JavaScript | npm install flux-js |
The same policy bytecode runs across all FLUX implementations. Same bytecode β different shells.
- flux-vm β Python VM (
pip install flux-vm) - flux-core β Rust VM (
cargo add fluxvm) - flux-js β JavaScript VM (
npm install flux-js)
- conservation-enforcer β Conservation-law enforcement for LLM outputs
- flux-policy-tester β Testing framework for policies
- flux-compiler β Bytecode assembler, disassembler, validator
- AI-Writings β Paradigm essays
MIT β Same bytecode, different shells. π¦