How Tasks Work

The PlanBuilder uses pattern matching to parse natural language queries. When you say "analyze my best session", it matches the ["analyze", "best"] pattern and builds a multi-step execution plan using the appropriate tools.

Session Analysis

"analyze my best session"

Finds session with most swings, loads summary, detects swings, and generates visualization

Tools: find_best_session → get_session_summary → detect_swings → visualize_session
"compare last 3 sessions"

Retrieves recent sessions and generates comparison metrics

Tools: get_recent_sessions → compare_sessions
"show linked data for 2024-12-15"

Gets synchronized Apple Watch + Zepp data for the specified date

Tools: get_linked_session_data → visualize_linked_comparison
"analyze session from yesterday"

Analyzes the most recent session with full metrics

Tools: get_recent_sessions → analyze_apple_watch_session

Visualization Requests

"visualize zepp impact heatmap"

Generates density heatmap of racquet impact positions

Tools: visualize_zepp_impact_heatmap
"show impact dashboard"

Opens interactive Zepp impact dashboard in browser

Tools: visualize_zepp_impact_dashboard
"visualize my session"

Generates timeseries visualization of session sensor data

Tools: visualize_session (viz_type=timeseries)
"show 3D trajectory for swing 5"

Creates 3D visualization comparing wrist and racquet paths

Tools: visualize_trajectory (swing_index=5)

Match Statistics

"how many matches did I play in 2024?"

Returns total matches, wins, losses, and win percentage for the year

Tools: get_match_count (year=2024)
"what is my win rate?"

Calculates overall win percentage from match history

Tools: get_match_count
"show my last match result"

Returns opponent, score, and outcome of most recent match

Tools: get_latest_match_result
"how many tournaments did I play?"

Counts distinct tournaments with match breakdown

Tools: get_tournament_count

Heart Rate Analysis

"compare heart rate in wins vs losses"

Analyzes HR statistics by match outcome

Tools: analyze_hr_by_outcome (outcome="all")
"what was my max heart rate during wins?"

Returns max HR for winning matches

Tools: analyze_hr_by_outcome (outcome="wins")
"is my heart rate higher when I win?"

Compares average HR between wins and losses

Tools: analyze_hr_by_outcome

Sensor Inventory

"how many sensor types do I have?"

Lists all sensor sources with session counts

Tools: get_sensor_inventory
"how many Zepp sessions this month?"

Returns practice session count and swing statistics

Tools: get_zepp_session_count
"show data sources"

Displays all available data sources with record counts

Tools: show_data_sources

Data Export

"export session to CSV"

Exports session data to specified format

Tools: export_data (format="csv")
"sync apple watch data"

Pulls latest sessions from Mac server

Tools: sync_apple_watch
"refresh babolat data"

Regenerates BabPopExt.db from app logs

Tools: refresh_babolat_data

Execution Flow

IDLE → PLANNING → AWAITING_APPROVAL → RUNNING → COMPLETED

The agent parses your query, builds a multi-step plan, shows it for approval, then executes each tool in sequence with dependency resolution.