Command-line tools for working with the LNMP protocol.
- 11 Command Groups with 60+ subcommands
- Performance Benchmarking - Quantify LNMP's advantages
- Format Conversion - JSON, binary, shortform
- Vector Operations - Embeddings with quantization and delta encoding
- Spatial Data - Position, rotation, streaming
- Transport Bindings - HTTP, Kafka, gRPC, NATS
- Validation & Security - Sanitization, compliance checking
cd tools/cli
cargo build --release
cargo install --path .# Parse an LNMP file
lnmp-cli codec parse input.lnmp
# Inspect a container file
lnmp-cli container inspect file.lnmp
# Benchmark performance
lnmp-cli perf benchmark codec
# Compare with JSON
lnmp-cli perf compare json
# Get version info
lnmp-cli info versionInspect and manipulate .lnmp container files.
# Inspect container metadata
lnmp-cli container inspect file.lnmp
# Decode container to text
lnmp-cli container decode file.lnmp
# Encode text to container
lnmp-cli container encode --mode text input.txt -o output.lnmp
# Extract metadata
lnmp-cli container metadata file.lnmpSubcommands:
inspect- Show container structuredecode- Extract content from containerencode- Create container (text/binary/stream/delta modes)metadata- Show/modify metadata
Parse, format, and validate LNMP text format.
# Parse LNMP text
lnmp-cli codec parse input.lnmp
# Format with pretty-printing
lnmp-cli codec format input.lnmp
# Validate syntax
lnmp-cli codec validate input.lnmp
# Compute semantic checksum
lnmp-cli codec checksum input.lnmpSubcommands:
parse- Parse and display structureformat- Pretty-print LNMP textvalidate- Check syntax validitychecksum- Compute SC32 checksumnormalize- Normalize to canonical form
Work with embedding vectors, quantization, and deltas.
# Encode vector
lnmp-cli embedding encode vector.txt
# Compute delta between vectors
lnmp-cli embedding delta compute base.bin target.bin -o delta.bin
# Calculate similarity
lnmp-cli embedding similarity vec1.bin vec2.bin --metric cosineSubcommands:
encode- Encode f32 vector to binarydecode- Decode binary to f32 vectordelta- Compute/apply vector deltassimilarity- Calculate vector similarity
Handle position, rotation, velocity data.
# Encode spatial data
lnmp-cli spatial encode spatial.txt
# Stream spatial updates
lnmp-cli spatial stream --rate 60hz
# Validate spatial data
lnmp-cli spatial validate data.binSubcommands:
encode- Encode spatial datadecode- Decode spatial datadelta- Compute spatial deltasstream- Stream spatial updatesvalidate- Validate spatial data
Compress embeddings with quantization.
# Quantize to QInt8
lnmp-cli quant quantize vec.bin --scheme qint8
# Dequantize back to FP32
lnmp-cli quant dequantize quantized.bin
# Adaptive quantization
lnmp-cli quant adaptive vec.bin --target high
# Batch quantization
lnmp-cli quant batch vectors/ --output quantized/Subcommands:
quantize- Quantize vectors (QInt8/QInt4/Binary/FP16)dequantize- Restore to FP32adaptive- Auto-select schemebatch- Batch processingbenchmark- Performance testing
Encode/decode for different transport protocols.
# Encode for HTTP
lnmp-cli transport http encode data.lnmp
# Decode from Kafka
lnmp-cli transport kafka decode message.bin
# gRPC payload
lnmp-cli transport grpc encode data.lnmp
# NATS message
lnmp-cli transport nats encode data.lnmpProtocols:
http- HTTP transportkafka- Apache Kafkagrpc- gRPCnats- NATS messaging
Wrap data with envelope metadata (trace IDs, timestamps, etc.).
# Create envelope
lnmp-cli envelope create --trace-id abc123
# Wrap data
lnmp-cli envelope wrap data.lnmp
# Unwrap envelope
lnmp-cli envelope unwrap wrapped.lnmp
# Extract metadata
lnmp-cli envelope extract wrapped.lnmpSubcommands:
create- Create new envelopewrap- Add envelope to dataunwrap- Remove envelopeextract- Get envelope metadata
Convert between LNMP, JSON, binary, and shortform.
# LNMP to JSON
lnmp-cli convert to-json input.lnmp
# JSON to LNMP
lnmp-cli convert from-json input.json
# To binary format
lnmp-cli convert to-binary input.lnmp
# To shortform
lnmp-cli convert to-shortform input.lnmpSubcommands:
to-json/from-jsonto-binary/from-binaryto-shortform/from-shortform
Get version, features, and statistics.
# Version information
lnmp-cli info version
# Supported features
lnmp-cli info features
# Statistics for a file
lnmp-cli info stats file.lnmp
# Performance profile
lnmp-cli info profileSubcommands:
version- CLI and protocol versionfeatures- Supported LNMP featuresstats- File statisticsprofile- Performance profile
Sanitize and validate LNMP data.
# Sanitize untrusted input
lnmp-cli validate sanitize untrusted.lnmp
# Quick validation check
lnmp-cli validate check file.lnmp
# Strict validation
lnmp-cli validate strict file.lnmp
# LNMP compliance check
lnmp-cli validate compliance file.lnmpSubcommands:
sanitize- Clean untrusted inputcheck- Basic validationstrict- Strict mode validationcompliance- Spec compliance check
NEW! Quantify LNMP's performance advantages.
# Benchmark codec performance
lnmp-cli perf benchmark codec --iterations 10000
# Benchmark embedding operations
lnmp-cli perf benchmark embedding --dimensions 384
# Compare with JSON
lnmp-cli perf compare json
# Generate performance report
lnmp-cli perf report summaryExample Output:
π― LNMP Codec Benchmark
ββββββββββββββββββββββββββββββββββββββββββββββ
Parse Performance:
Speed: 284.58K ops/sec
Latency: 3.51 ΞΌs
Memory: 142 B
π‘ Comparison:
β LNMP parsing is typically 3-4x faster than JSON
β Lower memory overhead due to streaming parser
Subcommands:
benchmark- Run performance tests (codec/embedding/transport/full)compare- Compare with JSON/gRPC/Protobufreport- Generate performance reports (summary/details/export)
Performance Highlights:
- 3-4x faster parsing than JSON
- 2-3x smaller payload size
- 991K ops/sec quantization performance
- 757K ops/sec delta computation
Configure via environment variables:
# Log level
export LNMP_LOG_LEVEL=debug # error, warn, info, debug, trace
# Default output format
export LNMP_FORMAT=json # text, json, binary, compact
# Verbose/quiet mode
export LNMP_VERBOSE=1
export LNMP_QUIET=1
# Color output
export LNMP_COLOR=always # auto, always, never
export NO_COLOR=1 # Standard disable colors
# Validation profile
export LNMP_PROFILE=strict # loose, standard, strictSee CONFIG.md for details.
# Prepare LLM response in LNMP format
echo 'F1="token_text"\nF2=0.95\nF3=[1,2,3]' | lnmp-cli codec parse
# Compare size with JSON
lnmp-cli perf compare json
# Result: 1.4x smaller payload, 73% bandwidth savings# Encode query vector
lnmp-cli embedding encode query.txt -o query.bin
# Quantize for faster search (4x compression)
lnmp-cli quant quantize query.bin --scheme qint8 -o query_q.bin
# Calculate similarity
lnmp-cli embedding similarity query_q.bin doc1_q.bin --metric cosine# Agent state delta
lnmp-cli embedding delta compute old_state.bin new_state.bin -o delta.bin
# Encode for transport
lnmp-cli transport kafka encode delta.bin -o kafka_message.bin
# Wrap with envelope (trace ID, timestamp)
lnmp-cli envelope wrap kafka_message.bin --trace-id agent-001# Validate data before deployment
lnmp-cli validate strict edge_data.lnmp
# Convert to binary for efficiency
lnmp-cli convert to-binary edge_data.lnmp -o edge_data.bin
# Benchmark performance
lnmp-cli perf benchmark codec
# Result: 280K ops/sec on edge hardware# Build
cargo build
# Run tests
cargo test
# Format code
cargo fmt
# Lint
cargo clippy
# Run with logging
LNMP_LOG_LEVEL=debug cargo run -- info versionsrc/
βββ main.rs # Entry point
βββ cli.rs # Command definitions (clap)
βββ commands/ # Command implementations
β βββ container.rs # Container operations
β βββ codec.rs # Text codec
β βββ embedding.rs # Vector operations
β βββ spatial.rs # Spatial data
β βββ quant.rs # Quantization
β βββ transport.rs # Transport protocols
β βββ envelope.rs # Envelope metadata
β βββ convert.rs # Format conversion
β βββ info.rs # Information
β βββ validate.rs # Validation
β βββ perf.rs # Performance benchmarking β
βββ config.rs # Global configuration
βββ error.rs # Error types
βββ io.rs # I/O helpers
βββ print.rs # Output formatting
βββ perf/ # Performance module
β βββ mod.rs
β βββ metrics.rs # Benchmark metrics
βββ utils.rs # Shared utilities
README.md- This file (main documentation)MIGRATION.md- Backward compatibility guideCOMPLETIONS.md- Shell completion setupARCHITECTURE.md- Module structureCONFIG.md- Configuration guideERROR_HANDLING.md- Error model- Implementation plan and walkthrough in
.gemini/artifacts
Part of the LNMP Protocol implementation.
CLI: v0.5.7
Protocol: v0.5.7
Performance is now measurable. Run lnmp-cli perf report summary to see LNMP's advantages quantified.