Skip to content

VS Code Extension

The AI-Hydro VS Code extension is the primary interface for interacting with the platform. It embeds a full AI agent with direct access to the MCP tool server, and adds five specialised panels to VS Code's editor area.


The AI-Hydro icon in the VS Code activity bar opens the primary sidebar, where the main Chat panel lives. Additional panels open in the editor area:

Panel How to open What it does
Chat AI-Hydro icon in activity bar Main conversation interface; tool call log; file diff viewer
Map Map button in sidebar toolbar Interactive geospatial layer viewer — auto-receives analysis outputs
AI-Hydro Studio AI-Hydro Studio button in sidebar toolbar Built-in Python kernel for interactive HTML artifacts and learning modules
Skills Skills icon in sidebar toolbar Browse installed skills and the marketplace; install workflow playbooks
Connectors Connectors icon in sidebar toolbar Authenticate external data sources (Google Earth Engine, and more)

Chat Panel

The chat panel is where you interact with the agent:

  • Message input — describe your research task in plain language
  • Tool call log — each MCP tool call appears inline as a collapsible card showing parameters, status, and results
  • File diff viewer — when the agent writes or modifies files, a diff appears for review
  • Terminal integration — standalone Python scripts the agent writes appear in an integrated terminal
  • Plan mode — the agent proposes a plan before executing when the task involves multiple steps
  • Scroll to bottom — when you scroll up, a small round button appears at the bottom right of the transcript. It never replaces the action buttons: a pending Run / Deny or New chat stays visible while you read.
  • Composer — under the input, one row of small chips: Auto-run: N on (a count; a warning icon and the word risky appear on it when a risky class is on, for example editing any file, running any command, or an MCP tool set to always allow), an N paused chip when MCP "always allow" grants are paused by the host's run-time check (it asks first for those tools; the chip's popover says why and links to Hydro Tools & Data Sources), and the context ring. The auto-run chip opens the auto-run settings, which list the risky classes and carry the line "Does not approve claims. Claim approval is a signed step you perform in a terminal (aihydro-approve)." One Add button (the @ icon) holds context (@), files and images, and rules and workflows. Send is disabled until there is something to send; while a task runs it becomes Stop.
  • Agent to-do (self-reported) — the task header shows the agent's own checklist as n/m items checked. It is the model's bookkeeping, not a verified result; when every item is ticked it reads "All items checked". A repeated, unchanged list does not add a new row.
  • New task — the labelled New task button in the task header closes the current task view so you can start another (the title-bar + does the same).
  • Study chip — when the chat is bound to a study, the header shows the study / gauge id first and in full, then the site name.
  • Projects on chats — a project is a workspace folder; each new chat is placed in the project of the folder it starts in (the AI-Hydro server creates it, needs aihydro-tools 2.8.3 or newer). The chat's project is stored once on the chat and never changes, and is sent with every AI-Hydro tool call. The study chip's picker lists the studies of the chat's project, and its tooltip names the project. With an older or absent server the chat simply has no project and the tooltip says why.
  • Earlier chats are grouped once, by folder — on the first start with a 2.8.3 server, chats from before projects existed are placed in the project of the folder they were started in (the chat's recorded working folder, else its checkpoint folder). A backup of the history file (taskHistory.json.bak-pre-projects-<timestamp>) is taken once before anything is written. A chat with no recorded folder, or whose folder was moved or deleted, stays in "Unsorted": it is not guessed into another project, so grouping is lossy for chats whose folder moved. The step is repeatable: a second run changes nothing, and nothing is deleted. A short notice states how many chats were grouped and how many stay in Unsorted.
  • Chat names — every chat has a short name (at most 60 characters), never a bare gauge or site id, never a decimal number or a measurement (numbers belong to cited claims, not names). A chat started from the map is named by the question you asked, not by the map's wrapped prompt. The name is written by your own chat model after the first reply and once more when the chat first finishes (two short requests at most per chat; they carry the first message, the first reply cut short, the study name and tool names, never tool results, and go to the provider you already use). Settings, Features, "Write chat titles with a model" turns this off: no model is then called for a name, and chats get a plain name built from your first words. An optional Title model is a model id on the same provider. In History, press F2 on a name or use the pencil to rename it; Enter saves, Esc cancels. A name you type is locked: no later save, completion or automatic name replaces it, and Reset to automatic unlocks it. Each call sends your chat provider the first message (up to 2,500 characters), the first reply (up to 1,800) and up to 8 tool names, so it is on by default only because the provider already saw that text; the first time it happens a one-time notice says so and offers to turn it off. Cancelling stops reading the reply, but the extension's model interface has no abort signal, so the provider request itself may finish. Names are never part of telemetry.
  • Earlier chats get plain names, and a model only if you ask — on the first start with this version, chats with no name get the plain name built from their first words (a backup taskHistory.json.bak-pre-titles-<timestamp> is taken once first; nothing is sent anywhere). History then offers "Generate titles for N chats" with a rough token estimate; nothing is sent to a model until you click it, you can cancel it, and chats you renamed are left alone.

Map Panel

The Map panel renders geospatial analysis outputs as interactive layers inside VS Code. See the Map Panel guide for the full reference.

Key capabilities: - Auto-receives layers from analysis tools (delineate_watershed, compute_twi, create_cn_grid) - Drag-and-drop file loading — GeoJSON, KML, KMZ, GPX, Shapefile, GeoTIFF, CSV - Per-layer symbology editor with colour picker, opacity, and colormap selection - keyless basemaps (muted hydrology default on Esri Gray Canvas, USGS (US only), Esri), no API token - Agent can style and update layers via map_update_layer and map_apply_symbology MCP tools


AI-Hydro Studio

AI-Hydro Studio is a built-in execution environment for interactive HTML artifacts. See the AI-Hydro Studio guide for the full reference.

Key capabilities: - Runs Python cells inside HTML files via a built-in kernel — no Jupyter server needed - Auto-opens AI-Hydro learning modules when the agent writes them - Single-row toolbar: run cell, run all, restart & run all, stop, clear; animated kernel status chip - Python environment selector with per-artifact kernel isolation - Supports the show_html_preview MCP tool for agent-initiated opens


Skills Panel

The Skills panel manages workflow playbooks for the agent. See the Skills guide for the full reference.

Key capabilities: - Configured tab — all installed skills (marketplace, agent-created, manual, workspace-local) - Marketplace tab — browse and install skills from github.com/AI-Hydro/Skills - Skills are loaded automatically by the agent before planning any covered task - Agent-created skills (from save_skill()) appear here immediately


Connectors Panel

The Connectors panel manages authenticated links to external data sources. See the Connectors guide for the full reference.

Live connectors: - Google Earth Engine — OAuth-authenticated access to the GEE public catalog; three MCP tools (gee.status, gee.preview_layer, gee.extract_timeseries)

Coming soon: HAWQS, USGS NWIS, HydroShare, Planetary Computer, OpenTopography, NASA Earthdata


Interface Overview (continued)

Auto-Registration

On first activation, the extension automatically:

  1. Detects aihydro-mcp on your PATH (or python -m ai_hydro.mcp as fallback)
  2. Writes the server entry to aihydro_mcp_settings.json
  3. Starts the MCP server process

No manual JSON editing required.

Settings file location:

~/Library/Application Support/Code/User/globalStorage/aihydro.ai-hydro/settings/
└── aihydro_mcp_settings.json


Supported AI Providers

Configure your provider and API key in the extension settings panel. See the dedicated Models & Providers page for the current recommended model and the full provider matrix.

At a glance, AI-Hydro supports every provider the underlying agent supports — Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure OpenAI, OpenRouter, Ollama, LM Studio, and others — including local models for fully offline use.


Context Rules

AI-Hydro uses .aihydrorules files to inject persistent context into every conversation. These are placed in your workspace root or home directory.

The most important auto-generated file is .aihydrorules/research.md — written by sync_research_context — which injects your current session state, project context, and researcher profile into every conversation automatically.

.aihydrorules/research.md (auto-generated)
# AI-Hydro Research Context

## Active Sessions
- Gauge 01031500: watershed ✓, streamflow ✓, signatures ✓, model ✓

## Active Project
- New England Basins (4 gauges)

## Researcher Profile
- Mohammad Galib — Computational Hydrology, Purdue
- Focus: baseflow generation in fractured rock basins

Keyboard Shortcuts

Action Mac Windows/Linux
Open AI-Hydro panel Cmd+Shift+A Ctrl+Shift+A
New conversation Cmd+L Ctrl+L
Cancel running task Escape Escape

Ignoring Files

Create a .aihydroignore file in your workspace to prevent the agent from reading sensitive files:

.aihydroignore
.env
credentials/
private_data/
*.key

MCP Server Status

In Hydro Tools & Data Sources, each server row shows Trusted or Not trusted with the reason. "Trusted" means the server's launch (command, arguments, environment variables and working directory) matches the first-party launcher AI-Hydro recorded; only then are its instructions sent to the model and claim-approval prompts enabled. "Not trusted" explains why: a different server name, a changed launch line, different environment or working directory, a remote server, or a third-party server. If the recorded server is disabled and exactly one other enabled server has the first-party launch shape, AI-Hydro asks once at startup whether to trust it (it re-points silently only when the launch is identical to the one it already verified). Restart AI-Hydro to re-evaluate after editing the MCP settings. The environment comparison covers the env and cwd in the server's settings entry only: a PATH inherited from the process environment is not part of the identity, so a bare command (aihydro-mcp) is resolved by whatever PATH the extension host has.

DeepSeek native tool-call envelopes

DeepSeek models sometimes write a tool call as plain text (<tool_calls><invoke name=...>). For DeepSeek models only, a trailing envelope that starts its own line is turned into a normal tool call once the message completes (a missing final </tool_calls> is tolerated when every <invoke> is closed and only whitespace follows the last </invoke>); it needs the same approval as any other call. Limits worth knowing:

  • Built-in tool parameters that contain tags (for example HTML or XML in a file write) are refused in this envelope; the call is reported as malformed and the model retries through the normal tool format.
  • A task_progress parameter inside an MCP call is not sent to the server: it updates the task checklist like any other tool call (a tool that declares task_progress itself keeps it as an argument).
  • A repaired call goes to the one server that exposes the tool. If that server is not trusted it can still be routed to: it is an ordinary approval, and both the approval card and the muted "Repaired a native tool call" line name the server. A first-party-named server that is not trusted is not routed to while a trusted first-party server is connected; this only avoids confusion (the approval card would otherwise look like the real server) and is not a security control, the approval is.
  • An envelope that is not the last thing in the message (prose or a closing code fence follows it), is quoted, indented or after prose on the same line, or has an unclosed <invoke>, is not run. The text stays visible (tags inside it are inert) and one muted line, with the raw text behind a disclosure, says "Native tool call not at end of message; not run." If a real tool call follows such an envelope, the text before it is not re-presented, which is why the raw envelope text is also kept behind the notice. (or "malformed tool call; retried" with the raw text behind a disclosure).
  • Each of these muted lines is also recorded with a structured class and severity (infoNotice), so the transcript does not have to match on the words. The same applies to a forced context truncation ("Context window exceeded: dropped N earlier messages ..."), a command's exit code (a non-zero exit marks the command failed; an unobservable exit is recorded as unknown, never as success) and the level of an MCP server notification (warnings and errors use the warning colour).

If the server is not responding, check:

# Test server health
aihydro-mcp --diagnose

# Restart manually
pkill -f "aihydro-mcp"
aihydro-mcp

Or reload the VS Code window: Cmd+Shift+P → Developer: Reload Window.