home / skills / mkalhitti-cloud / universal-or-strategy / nt8-log-monitor

nt8-log-monitor skill

/.agent/skills/nt8-log-monitor

This skill autonomously monitors NinjaTrader 8 logs and traces to detect errors and crashes, ensuring healthy deployments and quick issue detection.

npx playbooks add skill mkalhitti-cloud/universal-or-strategy --skill nt8-log-monitor

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.8 KB
---
name: nt8-log-monitor
description: Autonomous monitoring of NinjaTrader 8 logs and trace files for errors, rejections, and crashes.
---

# NinjaTrader 8 Log Monitor Skill

This skill allows Antigravity to autonomously verify the health of the NinjaTrader 8 environment by scanning system logs and trace files.

**Universal Path:** `${PROJECT_ROOT}`
**Executors:** ${BRAIN} (Reasoning), ${HANDS} (Gemini Flash via delegation_bridge)

## Related Skills
- [file-manager](../file-manager/SKILL.md) - File operations and deployment
- [delegation-bridge](../delegation-bridge/SKILL.md) - Safe deployment execution
- [wearable-project](../antigravity-core/wearable-project.md) - Portability standards

## Core Capabilities

1.  **Identify Latest Logs**: Finds the most recent `.txt` log files and Rithmic/Brokerage trace files.
2.  **Error Detection**: Scans for "Rejected", "Termination", "Error", and "Exception".
3.  **Instrument Monitoring**: Scans specifically for events related to MES or MGC.

## When to Use

- **After Deployment**: Always run this skill after deploying a new version of the Master Strategy (`UniversalORStrategyV8_X`) to ensure it initialized without errors.
- **After Rejection**: If you suspect an order was rejected or a stop wasn't placed, use this skill to check the `log/` directory.
- **Connection Issues**: Check the `trace/` directory for Rithmic disconnects or timeout errors.

## Script Usage

### Find Latest Logs
```powershell
.agent\skills\nt8-log-monitor\scripts\Get-LatestLog.ps1
```

### Scan for Errors
```powershell
.agent\skills\nt8-log-monitor\scripts\Scan-LogsForErrors.ps1 -Keywords @("Rejected", "Error", "MGC")
```

## Protocol: Post-Deployment Health Check
After updating a strategy:
1.  Run `Scan-LogsForErrors.ps1`.
2.  Look for any `Termination` or `Error` logs timestamped within the last 5 minutes.
3.  Report status to the user.

Overview

This skill autonomously monitors NinjaTrader 8 log and trace files to detect errors, rejections, and crashes affecting MES/MGC strategies. It locates the most recent logs and trace files, scans for key failure indicators, and highlights instrument-specific events. The goal is rapid health checks after deployments or when suspected order/connection issues occur.

How this skill works

The skill searches the project root for the latest .txt logs and brokerage/Rithmic trace files, then parses them for keywords like Rejected, Error, Exception, and Termination. It filters results for instrument identifiers (MES, MGC) and timestamps recent events to surface critical issues. Scripts are provided to automate finding latest logs and scanning for errors, and the skill can be invoked as part of a post-deployment health check.

When to use it

  • Immediately after deploying or updating the Master Strategy to verify initialization completed without errors
  • When an order is suspected to have been rejected or a stop/exit did not execute
  • If connection instability or Rithmic disconnects/timeouts are observed
  • As a routine health check during monitoring windows or after automated restarts
  • Before escalating issues to support or rolling back a deployment

Best practices

  • Run the log scan within five minutes of deployment to catch initialization failures
  • Include instrument filters (MES, MGC) to reduce noise and focus on relevant trade events
  • Combine log scans with timestamp checks to correlate errors with recent trading activity
  • Automate the script in CI/CD or deployment hooks so health checks run consistently
  • Keep archive retention settings reasonable so required trace files remain available for diagnostics

Example use cases

  • Post-deployment verification: run the scan to confirm no Termination or Exception entries after a strategy update
  • Order troubleshooting: detect Rejected messages and capture related trace lines for root cause analysis
  • Connection diagnostics: scan trace files to find Rithmic disconnects, timeouts, or reconnection attempts
  • Automated alerting: integrate the scan into monitoring to notify operators when Error or Termination keywords appear
  • Investigations: collect and export matching log segments for support tickets or post-mortem reviews

FAQ

Which files and folders does the skill inspect?

It targets the project root log/ and trace/ locations, locating recent .txt logs and brokerage/Rithmic trace files for analysis.

What keywords does the scanner look for by default?

Default keywords include Rejected, Error, Exception, and Termination; you can extend this list to include instrument tags like MES or MGC.

How quickly should I run this after deployment?

Run the scan within five minutes of deployment to catch startup or initialization errors that happen immediately after strategy load.