Context detection

From monte-carlo-data/mc-agent-toolkit · View interactive version

Context detection is an AI agent skill from the GitHub repository monte-carlo-data/mc-agent-toolkit. Route data-related requests to the right Monte Carlo skill or workflow. USE WHEN alerts, incidents, data broken, stale, coverage gaps, data quality, or any ambiguous data observability request.

How to use this skill

Skill file

Monte Carlo Context Detection

This skill determines which Monte Carlo skill or workflow best fits the user's current context. It activates reactively for ambiguous or multi-step data-related messages, gathers signals, and routes to the right skill or workflow.

Monte Carlo tool routing (required): For Monte Carlo operations such as get_alerts, search

and get_asset, use the tool ID your client exposes on the connection for the intended account.

Proceed when there is one suitable connection and no evidence of an account or source mismatch. If

the choice is ambiguous, ask which connection to use before making a Monte Carlo call; if you

can't get an answer, leave the call pending. Use the selected connection throughout. If it is

unavailable or lacks the operation, follow this skill's fallback where it has one, or report what

is missing.

<!-- plugin-only:start -->

With the Agent Toolkit plugin: When using the toolkit plugin or its installer, prefer the

connection it provides or configures (normally named monte-carlo-mcp) when it is suitable for the

intended account. If you know that connection is missing, confirm the intended alternative before

using another one.

<!-- plugin-only:end -->

Reference file for signal definitions: references/signal-definitions.md (relative to this file). Read it before routing.

When to activate this skill

This skill is activated by the CLAUDE.md routing table when:

When NOT to activate this skill


Workflow: Reactive Routing

This skill is purely reactive — it activates for ambiguous or multi-step data-related messages and routes them.

Follow these steps in order.

Step 0: Fast-path clear intent (stop early if matched)

Before doing anything else, check whether the user's message unambiguously matches a single existing skill. If so, skip the rest of this workflow and immediately load that skill — do NOT read references/signal-definitions.md, do NOT make API probes.

| Clear user intent | Skill to load immediately |

|---|---|

| "Check health of [named table]" / "status of [named table]" | ../asset-health/SKILL.md |

| "Create a [monitor type] on [named table]" | ../monitoring-advisor/SKILL.md |

| "Investigate alert on [named table]" / "why is [named table] stale/broken?" | ../incident-response/SKILL.md |

| "What should I monitor?" / "where are my coverage gaps?" | ../proactive-monitoring/SKILL.md |

| "This monitor is noisy" / "my monitors keep firing for nothing" / "which monitors should I tune?" | ../tune-monitor/SKILL.md |

| "How do I fix this alert?" / "what's the fix for [alert]?" / "remediate this" | ../remediation/SKILL.md |

| "Instrument my agent" / "set up Monte Carlo tracing on [named framework] agent" / "setting up an agent" | ../instrument-agent/SKILL.md |

Context-detection is for ambiguous requests only. If the request is clear, routing through this skill wastes turns and tokens.

If no clear match, proceed to Step 1.

Step 1: Categorize intent

Read references/signal-definitions.md for the full signal catalog. Determine which category the user's message falls into:

| Category | Signals | Example messages |

|----------|---------|-----------------|

| Specific asset | User mentions a table name, or has a .sql model file open in their IDE | "what's wrong with stg_payments?", "check this table" |

| Active incident | Keywords: alert, broken, stale, failing, incident, triage, wrong data | "I have alerts firing", "data looks wrong", "something broke" |

| Coverage/monitoring | Keywords: monitor, coverage, gaps, unmonitored, what should I watch | "what should I monitor?", "where are my gaps?" |

| Monitor noise | Keywords: noisy, false positives, alerts that turn out to be nothing, tune, sensitivity, combined with monitor or alert context | "we get a lot of alerts on payments that don't look real, what do I do with these monitors?", "tune my monitors" |

| Alert fix intent | Keywords: how do I fix, what's the fix, remediate, combined with an alert | "how do I fix this alert?", "remediate the payments alert" |

| Agent instrumentation | Keywords: instrument, set up tracing, set up Monte Carlo tracing, setting up an agent. Often mentions an AI framework (LangChain, LangGraph, OpenAI, Anthropic, CrewAI, Bedrock, SageMaker, Vertex AI) | "instrument my agent", "set up MC tracing on my LangGraph agent", "setting up an agent" |

| General/exploratory | No clear category, broad question | "help me with data quality", "what can Monte Carlo do?" |

Monitor noise and Alert fix intent take precedence over the bare "alert" (Active incident) and "monitor" (Coverage/monitoring) keywords.

Step 2: Gather scope (only if needed)

Step 3: Scoped API probe (when scope is available)

Only make API calls when you have enough context to scope them:

Always scope MCP calls tightly. Unscoped get_alerts, search, or get_monitors on large accounts can return hundreds of results, overflow the tool-result token limit, spill to disk, and force expensive chunk reads — burning user tokens and risking workflow failure. Minimum scoping:

1. If the user named a warehouse (e.g. "analytics-snowflake") → auto-pick the match whose warehouse_display_name matches and proceed. Do NOT stop to ask.

2. If the user named a database/schema → auto-pick the match in that database/schema.

3. If one match is flagged is_key_asset: true and others aren't → auto-pick the key asset.

4. Only ask the user to disambiguate when none of the above resolve it.

If you don't have enough scope, ask the user before calling.

Step 4: Route

Based on the combined signals from Steps 1-3:

| Combined signals | Confidence | Action |

|-----------------|------------|--------|

| Active alerts found + incident intent | High | Auto-activate incident response workflow: read and follow ../incident-response/SKILL.md |

| Coverage intent + data project detected | High | Auto-activate proactive monitoring workflow: read and follow ../proactive-monitoring/SKILL.md |

| User asks to create a specific monitor (type + table known) | High | Auto-activate monitoring-advisor: read and follow ../monitoring-advisor/SKILL.md |

| Table mentioned + "health" / "status" / "check" intent | High | Auto-activate asset-health: read and follow ../asset-health/SKILL.md |

| Monitor noise intent (noisy, too many alerts, alerts that turn out to be nothing, tune) | High | Auto-activate tune-monitor: read and follow ../tune-monitor/SKILL.md. It starts from Monte Carlo's stored tuning suggestions, so no monitor needs to be named first |

| Fix intent on an alert ("how do I fix", "what's the fix", "remediate") | High | Auto-activate remediation: read and follow ../remediation/SKILL.md. It reads the existing troubleshooting analysis and remediation plan before doing any work, and starts troubleshooting when there is none, even for a low-priority alert. Don't write your own fix in place of the plan |

| Agent instrumentation intent (instrument / set up tracing / setting up an agent) + Python codebase context | High | Auto-activate instrument-agent: read and follow ../instrument-agent/SKILL.md |

| Ambiguous or conflicting signals | Low | Suggest options and wait for user to choose |

High confidence = auto-activate. Load the target skill's SKILL.md and begin executing it immediately. Do not ask for confirmation.

Low confidence = suggest. Present 2-3 options with brief descriptions and let the user choose. Example:

"Based on what you've described, I can:

1. Investigate alerts — triage and fix active data issues (incident response workflow)

2. Improve monitoring — find coverage gaps and create monitors (proactive monitoring workflow)

Which would be most helpful?"

Prevent guardrail

If the user is actively editing a dbt model file (making code changes, not just viewing or asking about it) and the prevent skill's hooks are active, do NOT route to any other skill. Instead respond:

"The prevent skill will automatically handle impact assessment for dbt model changes via its pre-edit hooks. No additional routing needed."

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.