# query-listener

query-listener — a Claude Code subagent that hooks into the local Analysis Services instance and grabs the DAX a Power BI Desktop visual sends. Fire it off when you need to see the query behind a click.

- subagent · `type=agent` · Claude Code, Codex, Cursor, GitHub Copilot · ★ 1104 repo stars
- Author: Kurt Buhler
- License: GPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/data-goblin/power-bi-agentic-development/tree/HEAD/plugins/pbi-desktop/agents/query-listener.agent.md
- Updated: 2026-10-28
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/query-listener

## What it does

Under the hood the agent loads ADOMD.NET, reads the port of the running `msmdsrv` process from its command line, and opens a connection to that instance. It then polls `DISCOVER_SESSIONS` every 500 ms for up to 60 seconds, picking up sessions whose `SESSION_LAST_COMMAND` begins with `DEFINE`, `EVALUATE` or `VAR`. Duplicates are filtered out by the session timestamp.

Each captured query comes back with elapsed milliseconds, CPU time and the full DAX text. Once the run stops, the agent reports how many queries it caught, which one took longest, and any patterns worth a look — a missing filter context, an oversized TOPN, a pile of `VAR` blocks. Results land in a text file so they survive the agent finishing.

Its tool set is limited to `Bash`, `Read` and `Write`. ADOMD.NET has to be on the machine; the assembly is loaded from a local path, and without it the agent points you at the connect-pbid skill. Nothing shows up in the first 15 seconds more often than not, since slicers do not always fire a model query — click a regular visual instead.

## Requirements
- Works with: Power BI

## Install

### GitHub Copilot (native platform)

**Manually: put the files in place**
- File: `.github/agents/query-listener.agent.md`

### Claude Code

1. **Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add data-goblin/power-bi-agentic-development
```
In the agent chat (not a shell):
```text
/plugin install pbi-desktop@power-bi-agentic-development
```

2. **Manually: put the files in place**
- File: `.claude/agents/query-listener.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention. Copilot names tools its own way in the tools field: remove it or rewrite it for Claude Code

### Codex

**Manually: put the files in place**
- File: `.codex/agents/query-listener.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/query-listener.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/data-goblin/power-bi-agentic-development/tree/HEAD/plugins/pbi-desktop/agents/query-listener.agent.md

## When to use it
- see the exact DAX a single visual sends
- time how long a visual's query takes
- trace down why a matrix or chart runs slow
- compare queries from several visuals side by side
- keep captured queries in a file for later reading

## Example prompts
- Capture the DAX query my bar chart is sending
- Start listening for visual queries while I click around the report
- Grab the query and timing for my slow matrix

## Similar
- [Power BI Performance Expert Mode](https://affpapa.org/en/nevibecode/agents/power-bi-performance-expert-mode.md) — subagent · ★ 41430 repo stars
- [powerbi-modeling](https://affpapa.org/en/nevibecode/skills/powerbi-modeling.md) — skill · 9934 installs
- [SemanticOps MCP (for Power BI)](https://affpapa.org/en/nevibecode/mcp/semanticops-mcp-for-power-bi.md) — MCP server · ★ 256 repo stars
- [power-bi-build](https://affpapa.org/en/nevibecode/skills/power-bi-build.md) — skill · 688 installs
- [power-bi-salespulse-360-dashboard](https://affpapa.org/en/nevibecode/skills/power-bi-salespulse-360-dashboard.md) — skill · 661 installs
- [power-bi-retail-analytics-salespulse360](https://affpapa.org/en/nevibecode/skills/power-bi-retail-analytics-salespulse360.md) — skill · 659 installs

From the same set: [data-goblin/power-bi-agentic-development](https://affpapa.org/en/nevibecode/by/data-goblin/power-bi-agentic-development.md) — 59 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
