Analyzing Data Files
When a data file (Excel, CSV, etc.) is uploaded or referenced:
- Delegate to
dataFile-contextfor an initial overview (structure, purpose, key contents). - Present the overview, then ask directly in conversation: "Would you like me to explore this file further?" (never use the
questiontool). - Stop and wait for the user's reply.
- If affirmative and answerable from existing context → answer immediately, no new delegation.
- If affirmative but info is missing → re-query
dataFile-contextfor the gap; escalate toexcel-readeronly if that fails. - If not affirmative → stop the workflow.
Progress:
- Step 1: Delegate to
dataFile-contextfor initial overview - Step 2: Present overview + ask (in-conversation) if user wants deeper exploration
- Step 3: Wait for explicit user response
- Step 4: If yes + context already has the answer → answer directly
- Step 5: If yes + context lacks the answer → targeted re-query, then escalate to
excel-readeronly if needed - Step 6: If no/unclear → stop
Progressive Analysis Levels
| Level | Action | When to use |
|---|---|---|
| 1 — Overview | dataFile-context | Always first |
| 2 — Targeted retrieval | Reuse existing context or focused dataFile-context query | Follow-up questions answerable without deep processing |
| 3 — Deep analysis | excel-reader | Complex calculations, cross-sheet joins, statistics, formula inspection, large-scale quality checks |
Never jump to Level 3 when Level 1 or 2 suffices.
Example 1:
Input: User uploads sales_2024.xlsx and says "what's in this file?"
Output: Delegate to dataFile-context → receive overview (3 sheets: Q1-Q4 Sales, Customers, Products; row/column counts; sample data). Present summary, then ask: "Would you like me to explore this file further — for example, specific trends, calculations, or data quality checks?"
Example 2:
Input: User replies "Yes, what's the total revenue in Q3?"
Output: Check existing context from dataFile-context. If a Revenue column total was already surfaced, answer directly. If not, delegate a targeted query: "Retrieve sum of Revenue column in Q3 Sales sheet." No need for excel-reader unless it involves cross-sheet aggregation or complex logic.
Example 3:
Input: User asks "Compare average order value across all 4 quarters and flag anomalies statistically."
Output: This requires cross-sheet aggregation and statistical analysis beyond lightweight context — escalate directly to excel-reader with a specific task: compute average order value per quarter sheet, compare, identify statistical outliers.
Example 4: Input: User says "No thanks" after the initial overview. Output: Stop the workflow. Do not perform further analysis or ask again.
- Always profile before deep analysis: file name/format/size, sheet names, dimensions, column types, sample rows, missing/duplicate values, formulas, inter-sheet relationships.
- Prefer
pandas/openpyxl/csvfor lightweight profiling; avoid full in-memory loads when sampling or chunking suffices. - Reuse context aggressively — never reread the whole file for a narrow follow-up.
- Make delegation requests specific: exact question, relevant file/sheet/columns, what's already known, what's missing, expected output format.
- Distinguish verified results from assumptions; explain calculation methods and data sources used.
- If a file can't be read or a result can't be verified, say so clearly rather than guessing.
- Using the
questiontool to ask about further exploration — always ask directly in conversation instead. - Proceeding to deeper analysis without an explicit affirmative response.
- Re-running the full overview or escalating to
excel-readerwhen the existing context already answers the question. - Vague delegation requests like "analyze the file again" instead of a specific, scoped ask.
- Escalating to
excel-readerautomatically on any follow-up question instead of checking context/targeted retrieval first. - Inventing column names, values, or findings not actually present in the file.