API & Commands

CLI & SDK Reference

Every subcommand, command-line flag, and programmatic Python interface available in MoroAI v0.1.0.

1. CLI Subcommands

moro init [DIR]

Initializes a new MoroAI foundry directory containing moro.yaml, datasets folder, and checkpoints directory.

moro init my-project
  

moro data build

Compiles, deduplicates, and validates raw data with the Epistemic Compiler.

  • --source <path>: Path to raw input file (.jsonl, .csv, .parquet).
  • --output <path>: Destination path for compiled dataset.
  • --mi-guard-threshold <float>: Mutual Information outlier preservation bound (default: 0.85).
  • --dedup-threshold <float>: Cosine similarity deduplication cutoff (default: 0.88).

moro recipe generate

Simulates memory requirements for a target base model and local GPU, writing optimal hyperparams to moro.yaml.

  • --model <id>: Hugging Face model identifier (e.g. Qwen/Qwen2.5-1.5B).
  • --hardware <detect|manual>: Automatically probe VRAM or specify manually.
  • --target-vram-gb <int>: Explicit maximum VRAM ceiling.

moro train

Executes local fine-tuning under the supervision of the autonomous 5-step self-healing daemon.

  • --config <path>: Path to configuration file (default: ./moro.yaml).
  • --auto-heal / --no-auto-heal: Enable/disable automatic OOM recovery and loss spike rollback (default: True).
  • --resume <checkpoint_dir>: Resume training from a specific step.

moro eval compare

Evaluates a fine-tuned adapter against a base model across deterministic rules, semantic judges, and Wasserstein drift bounds.

  • --checkpoint <path>: Checkpoint directory to test.
  • --suite <name>: Test suite name or YAML spec.
  • --gate-strict / --no-gate-strict: Enforce 100% pass on deterministic rules.

moro release deploy

Merges weights, applies GGUF quantization, generates cryptographic SHA-256 SBOM, and registers into local Ollama.

  • --target <ollama|vllm|docker|directory>: Deployment target runtime.
  • --quantize <q4_k_m|q8_0|fp16>: GGUF quantization mode.
  • --model-name <string>: Local name to register in Ollama.

moro dashboard

Launches the interactive real-time Mission Control web interface in your browser.

  • --host <string>: Bind host (default: 127.0.0.1).
  • --port <int>: Web server port (default: 8080).

2. Programmatic Python SDK

MoroAI can be invoked directly inside Python applications, scripts, or Jupyter notebooks:

from moro.core.compiler import EpistemicDataCompiler
from moro.core.recipe import RecipePredictor
from moro.engine.trainer import SelfHealingTrainer
from moro.eval.harness import MultiLayerEvalHarness

# 1. Compile data with MI Guard
compiler = EpistemicDataCompiler(mi_guard_threshold=0.85)
curated_data = compiler.compile("./raw_logs.jsonl")

# 2. Predict optimal VRAM recipe
predictor = RecipePredictor(model_id="Qwen/Qwen2.5-1.5B")
recipe = predictor.simulate_and_generate(device="cuda:0")

# 3. Train with autonomous recovery
trainer = SelfHealingTrainer(recipe=recipe, dataset=curated_data)
run_result = trainer.fit()

# 4. Evaluate release candidate
harness = MultiLayerEvalHarness()
eval_summary = harness.evaluate(run_result.checkpoint_dir)
if eval_summary.passed_gate:
    print(f"Model certified! Cryptographic ID: {eval_summary.signature}")
  

3. Configuration File (moro.yaml)

version: "1.0"
model:
  base_model: "Qwen/Qwen2.5-1.5B"
  quantization: "4bit"
  lora_r: 16
  lora_alpha: 32
  lora_dropout: 0.05
  target_modules: ["q_proj", "v_proj", "k_proj", "o_proj"]

data:
  train_path: "./datasets/curated_train.jsonl"
  val_path: "./datasets/curated_val.jsonl"
  max_seq_length: 2048

training:
  learning_rate: 0.0002
  micro_batch_size: 2
  gradient_accumulation_steps: 8
  epochs: 3
  auto_recovery: true