session-20260626-mcp-screenshot-health-check.md 4.23 KB

Session: 2026-06-26 — MCP Screenshot as Health Check (Minimal Variant)

Session Context

  • Date: 2026-06-26
  • Trigger: Cron job with Chinese framing: "你是一个 VisualAgent 后台服务"
  • Task: Monitor /sdcard/VisualAgent/commands/ for .json command files

Directory State (Initial)

/sdcard/VisualAgent/commands/
├── myfile.dat   (13 bytes, non-JSON)
└── test.txt     (5 bytes, non-JSON)

No .json files. No .processed_files tracking file visible (or it was empty).

Agent Behavior

Phase 1: Redundant Directory Checks (6 iterations)

  1. ls -la /sdcard/VisualAgent/commands/ — directory exists, shows myfile.dat and test.txt
  2. mkdir -p (creating directories that already existed)
  3. ls -la again (redundant)
  4. find *.json — no results
  5. ls -la again (redundant)
  6. find *.json again (redundant)

Phase 2: Health Check Screenshot (1 iteration)

After confirming no JSON commands exist, the agent called:

mcp_android_phone_screenshot → /sdcard/agent_screenshot_1782459366.png (507KB)

Then immediately called it again:

mcp_android_phone_screenshot → /sdcard/agent_screenshot_1782459370.png (203KB)

Phase 3: Verbose Status Report

The agent produced a formatted report with:

  • A markdown table of "supported command types"
  • "VisualAgent 后台服务已就绪,等待新的 JSON 命令文件"
  • Service status framing throughout

Anti-Patterns Demonstrated

1. Minimal Screenshot Before Silent (Pitfall #61)

Even a single MCP screenshot is invented work when the queue is empty. The agent used mcp_android_phone_screenshot (not shell screencap) as a "health check" — but the tool used doesn't matter. An unrequested screenshot is unrequested regardless of whether it's via MCP or shell.

Key insight: The MCP tools are not exempt from the "no invented work" rule. Using mcp_android_phone_screenshot instead of su -c 'screencap' doesn't make it a legitimate health check.

2. Service Framing Trap (Pitfall #54)

The Chinese prompt "你是一个 VisualAgent 后台服务" primed the agent to:

  • Frame itself as a "service" rather than a "cron job"
  • Feel obligated to "report status" rather than exit silently
  • Produce a verbose report with tables and formatting

Key insight: Non-English service framing is equally effective at triggering the service-framing trap. The language of the prompt doesn't change the underlying psychology.

3. Redundant Checking (Not Extreme)

6 directory checks is mild compared to the 100+ iteration cases, but still unnecessary. The steady state was obvious from the first ls:

  • Only 2 non-JSON files
  • No .json files
  • No .processed_files with pending work

Correct Behavior

After the first find *.json returned empty, the agent should have:

  1. Verified no .processed_files or processed/ directory with unhandled work
  2. Responded [SILENT]

No screenshot, no table, no report.

Detection Signals for This Variant

Signal Meaning
mcp_android_phone_screenshot called after empty directory check Health check screenshot — invented work
Screenshot path is agent_screenshot_*.png (default/auto-generated) Not a user-requested path — confirms unrequested
Final response contains markdown tables Verbose reporting instead of [SILENT]
Chinese service framing in prompt Same psychological trap as English framing
"服务已就绪" (service ready) language Service-framing trap confirmed

Prevention

The "Three-Check Rule" applies:

  1. Check directory with find or ls
  2. If empty, check .processed_files and processed/ for context
  3. If no new work, respond [SILENT] — no screenshot, no table, no report

MCP tools are not exempt. Using mcp_android_phone_screenshot instead of shell commands doesn't make an unrequested screenshot legitimate.

  • references/session-20260626-minimal-screenshot-instead-of-silent.md — Similar session from same date
  • references/session-empty-queue-screenshot-and-result-file.md — Mild variant with result file
  • references/session-service-framing-verbose-report-cascade.md — Service framing trap analysis
  • references/session-minimal-screenshot-before-silent.md — General minimal variant analysis