cortex qm / cortex mqm

The Model Quartermaster is an adaptive tool-prediction engine that observes tool calls across sessions, computes five weighted signal scores, and fuses them to predict which tool the agent should call next. cortex qm provides session-level analysis; cortex mqm provides model-level analysis.

Usage

cortex qm <subcommand> [options]
cortex mqm <subcommand> [options]

Five Prediction Signals

SignalDescription
TrajectoryHistorical tool call sequence patterns
EpisodicSimilar conversation context matching
Tool StatsStatistical success/failure rates per tool
Task ContextCurrent task type and requirements
ReflectionPer-turn reflection feedback integration

cortex qm Subcommands

SubcommandDescription
patternsList learned tool patterns
weightsShow current signal weights
statsDisplay tool usage statistics
decisionsShow prediction decisions for a session
traceTrace the prediction chain for a turn
dashboardRich visual dashboard with accuracy bars and top tools
accuracyShow prediction accuracy metrics
resetReset quartermaster state for a session
reset-allReset all quartermaster data

Options

OptionSubcommandDescription
--limit, -npatternsLimit number of patterns shown
--session, -sdecisions, dashboard, accuracyFilter by session ID
--limit, -ndecisionsLimit number of decisions shown

cortex mqm Subcommands

SubcommandDescription
statsModel-level tool usage statistics
decisionsModel-level prediction decisions
weightsModel-level signal weights
accuracyAccuracy metrics across all sessions
dashboardModel-level dashboard
resetReset model-level quartermaster
reset-allReset all model-level data

Options

OptionSubcommandDescription
--limit, -ndecisionsLimit number of decisions
--hours, -haccuracyTime window for accuracy calculation

Prediction Confidence Levels

ConfidenceAction
≥ 90%Automate — Execute tool automatically (safe tools only)
60–89%Suggest — Recommend tool to the agent
< 60% or unsafeDefer — Let the agent decide

Active Mode

The Quartermaster requires 50 observations before entering active prediction mode. Before this threshold, it operates in learning-only mode, collecting data without making predictions.

Reinforcement Learning

After each prediction, the Quartermaster evaluates correctness:

  • Reward: Increase signal weights for correct predictions
  • Punishment: Decrease weights for incorrect predictions
  • Adaptive EMA: Weights adjust via exponential moving average

Dashboard Output

The dashboard subcommand provides the richest output:

  • Accuracy bars per signal
  • Current signal weights visualization
  • Top tools by prediction accuracy
  • Session and model-level trends
  • Confidence distribution histograms

Examples

# View prediction dashboard for a session
cortex qm dashboard -s sess_abc123

# Show learned patterns
cortex qm patterns --limit 20

# Display signal weights
cortex qm weights

# Trace prediction for a specific turn
cortex qm trace 42

# Show accuracy metrics
cortex qm accuracy -s sess_abc123

# Model-level accuracy over last 24 hours
cortex mqm accuracy -h 24

# Reset all quartermaster data
cortex mqm reset-all