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
| Signal | Description |
|---|
| Trajectory | Historical tool call sequence patterns |
| Episodic | Similar conversation context matching |
| Tool Stats | Statistical success/failure rates per tool |
| Task Context | Current task type and requirements |
| Reflection | Per-turn reflection feedback integration |
cortex qm Subcommands
| Subcommand | Description |
|---|
patterns | List learned tool patterns |
weights | Show current signal weights |
stats | Display tool usage statistics |
decisions | Show prediction decisions for a session |
trace | Trace the prediction chain for a turn |
dashboard | Rich visual dashboard with accuracy bars and top tools |
accuracy | Show prediction accuracy metrics |
reset | Reset quartermaster state for a session |
reset-all | Reset all quartermaster data |
Options
| Option | Subcommand | Description |
|---|
--limit, -n | patterns | Limit number of patterns shown |
--session, -s | decisions, dashboard, accuracy | Filter by session ID |
--limit, -n | decisions | Limit number of decisions shown |
cortex mqm Subcommands
| Subcommand | Description |
|---|
stats | Model-level tool usage statistics |
decisions | Model-level prediction decisions |
weights | Model-level signal weights |
accuracy | Accuracy metrics across all sessions |
dashboard | Model-level dashboard |
reset | Reset model-level quartermaster |
reset-all | Reset all model-level data |
Options
| Option | Subcommand | Description |
|---|
--limit, -n | decisions | Limit number of decisions |
--hours, -h | accuracy | Time window for accuracy calculation |
Prediction Confidence Levels
| Confidence | Action |
|---|
| ≥ 90% | Automate — Execute tool automatically (safe tools only) |
| 60–89% | Suggest — Recommend tool to the agent |
| < 60% or unsafe | Defer — 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