CLI & Terminal
Documentation

CLI Reference: Sovereign Governance Terminal

Learn how to use the HardRAG CLI to audit, optimize, and manage the Sovereign AI Engine directly from your shell.

The HardRAG CLI is the professional command-line interface for developers and security analysts to audit, optimize, and manage the Sovereign Engine without a GUI.


đŸ—ī¸ Installation

The CLI is built with Typer and Rich for a premium terminal experience. Ensure the backend dependencies are installed.

# Register the HardRAG Sovereign Terminal
alias hardrag="python3 backend/app/cli.py"

đŸ•šī¸ Command Reference

1. System Health Audit

Verify the status and integrity of the local Sovereign Vault.

hardrag status
  • Action: Checks SHA-256 audit signing status and deployment mode (SOVEREIGN/CLOUD).

2. Surgical Inference Audit

Run a targeted security audit on a specific prompt string for rapid testing.

hardrag audit "Analyze patient record RX-901" --tier PLATFORM
  • Action: Initiates the Multi-Agent Consensus Jury.
  • Option: Use --json for machine-readable automation outputs.

3. Prompt Weight Optimization

Trigger the DSPy Feedback Loop to refine prompt boundaries based on historical corrections.

hardrag optimize
  • Action: Bootstraps few-shot examples from the audit log database.

đŸ› ī¸ Developer Integration

The CLI is designed for CI/CD pipelines. You can automate "Compliance Pre-checks" before deploying new RAG knowledge bases.

# Example: Automated Governance Check
import subprocess

def pre_deploy_check(query):
    result = subprocess.run(
        ["hardrag", "audit", query, "--json"], 
        capture_output=True, text=True
    )
    return result.stdout

[!IMPORTANT] Sovereign Access: The CLI requires local network access to the HardRAG Backend. For air-gapped environments, ensure the API_URL is mapped to the internal Docker mesh.