CLI Reference

Complete command-line interface reference

Installation

pip install -e .

After installation, the malagent command is available globally.


Quick Reference

CommandDescription
malagent setupInteractive setup wizard
malagent raft trainRun RAFT training
malagent sft trainRun SFT training
malagent verifyVerify a code sample
malagent testRun validation tests
malagent infoShow environment info
malagent proxmoxProxmox VM management
malagent elasticElastic Security status

Setup Command

Interactive configuration wizard. Optional - you can skip setup and provide config files directly.

malagent setup [OPTIONS]

Options

OptionDescription
--minimalMinimal setup (Windows build server only)
--fullFull setup (Windows + Elastic + Proxmox)
--checkCheck existing configs without modifying

Examples

# Interactive setup (asks questions)
malagent setup

# Quick minimal setup for MVR mode
malagent setup --minimal

# Full infrastructure setup
malagent setup --full

# Validate existing configuration
malagent setup --check

RAFT Training

Run RAFT (Reward-rAnked Fine-Tuning) training cycles.

malagent raft train [OPTIONS]

Options

OptionDescriptionDefault
--config, -cConfig file pathAuto-detect
--model, -mBase modelQwen/Qwen2.5-Coder-7B
--checkpointSFT checkpoint pathFrom config
--prompts, -pPrompts JSONL fileFrom config
--output, -oOutput directorymodels/raft
--cyclesNumber of RAFT cycles3
--modemvr or elasticmvr
--language, -lTarget languagemsvc
--curriculumCurriculum strategynone
--reward-shapingReward shaping strategyfixed
--resumeResume from checkpointFalse

Language Options

ValueDescription
msvcWindows MSVC (remote SSH)
mingwWindows MinGW (local cross-compile)
rustRust with Cargo
goGo with cross-compile
dotnet, csharp.NET/C#
powershellPowerShell scripts

Curriculum Strategies

ValueDescription
noneNo curriculum (default)
complexitySort by complexity
progressiveGradually increase difficulty
adaptiveAdjust based on performance

Reward Shaping Strategies

ValueDescription
fixedFixed reward thresholds (default)
annealingGradually increase threshold
adaptiveAdjust based on distribution
warmupLower threshold early, increase later

Examples

# Basic MVR training
malagent raft train --mode mvr --prompts data/prompts/mvr_prompt_v2.jsonl

# With explicit config
malagent raft train --config configs/raft_config.yaml --cycles 6

# Rust training
malagent raft train --mode mvr --language rust --prompts rust_prompts.jsonl

# Elastic mode with full detection
malagent raft train --mode elastic --config configs/elastic_verifier.yaml

# Resume interrupted training
malagent raft train --config configs/raft_config.yaml --resume

SFT Training

Run Supervised Fine-Tuning for cold start.

malagent sft train [OPTIONS]

Options

OptionDescriptionDefault
--config, -cConfig file pathNone
--dataTraining data fileFrom config
--output, -oOutput directorymodels/sft
--epochsNumber of epochs3

Examples

# Basic SFT training
malagent sft train --data data/sft_examples.jsonl --output models/sft

# With config file
malagent sft train --config configs/sft_config.yaml --epochs 5

Verify Command

Verify a single code sample.

malagent verify [OPTIONS]

Options

OptionDescriptionDefault
--codeCode file to verifystdin
--modemvr or elasticmvr
--hostWindows host10.0.0.152
--userWindows userkeys
--keySSH key path~/.ssh/win

Examples

# Verify a file
malagent verify --code sample.cpp

# Verify with Elastic detection
malagent verify --code sample.cpp --mode elastic

# Verify from stdin
cat sample.cpp | malagent verify

# Custom Windows host
malagent verify --code sample.cpp --host 192.168.1.100 --user admin

Test Command

Run pipeline validation tests.

malagent test [OPTIONS]

Options

OptionDescriptionDefault
--level, -lTest levelsmoke
--verbose, -vVerbose outputFalse

Test Levels

LevelTests
smokeImport modules, code extraction
standard+ SSH to Windows, GPU availability
full+ MSVC compilation test

Examples

# Quick smoke test
malagent test

# Full validation
malagent test --level full --verbose

Info Command

Show hardware and environment information.

malagent info

Output

  • GPU name and memory
  • ROCm/CUDA version
  • PyTorch version
  • SSH connectivity status
  • Configuration file status

Proxmox Commands

Manage Proxmox VM pool for sample execution.

malagent proxmox <subcommand> [OPTIONS]

Subcommands

SubcommandDescription
statusShow VM status
createCreate VM pool
destroyDestroy VMs
startStart VMs
stopStop VMs
revertRevert to snapshot
snapshotCreate snapshot

Common Options

OptionDescriptionDefault
--config, -cConfig fileAuto-detect
--vmidSpecific VM IDNone
--allAll training VMsFalse
--prefixVM name prefixrlvr-train

Examples

# Check VM status
malagent proxmox status

# Create 4 training VMs
malagent proxmox create --count 4 --prefix rlvr-train

# Start all training VMs
malagent proxmox start --all

# Revert all VMs to clean snapshot
malagent proxmox revert --all --snapshot rlvr-baseline

# Create snapshot of all VMs
malagent proxmox snapshot --all --name checkpoint-1

# Stop specific VM
malagent proxmox stop --vmid 105

# Destroy all training VMs
malagent proxmox destroy --all --prefix rlvr-train

Elastic Commands

Interact with Elastic Security.

malagent elastic <subcommand> [OPTIONS]

Subcommands

SubcommandDescription
statusCheck Kibana and Fleet status
alertsQuery recent detection alerts
rulesCheck detection rules

Options

OptionDescriptionDefault
--config, -cConfig fileAuto-detect
--limitMax alerts to show (alerts only)10

Examples

# Check Elastic status
malagent elastic status

# Query last 20 alerts
malagent elastic alerts --limit 20

# Check detection rules
malagent elastic rules

Exit Codes

CodeMeaning
0Success
1General error

Environment Variables

VariableDescription
MALAGENT_CONFIGDefault config file path
ANTHROPIC_API_KEYAnthropic API key (for distillation)
OPENAI_API_KEYOpenAI API key (for distillation)

Configuration File Discovery

When no config is specified, malagent looks for configs in this order:

  1. configs/raft_config.yaml
  2. configs/elastic_verifier.yaml
  3. configs/windows_connection.yaml