mcec AGENTS.md

A set of agent instructions for MCEC, a Windows tool that lets an AI agent observe and control computer windows through MCP. It explains how to test MCEC with itself and preserve its security rules.

In plain words
What is it for?
Use it when developing or testing MCEC, especially its built-in guidance, MCP connection behavior, window targeting, dogfooding, and operational procedures.
Why use it?
It gives the agent a consistent way to target windows, act, observe the result, and avoid security regressions while changing the tool.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/tig/mcec/agents-md
Clone the repo
git clone --depth 1 https://github.com/tig/mcec

Made for: Codex, OpenCode.

Per session 4,279 This file is loaded in full into every session.
When invoked 4,279 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.04279 $0.04279
Opus 5 $0.02139 $0.02139
Sonnet 5 $0.00856 $0.00856
Haiku 4.5 $0.00428 $0.00428

Measured 2d ago against content hash b9aae5acb188, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcec AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 217 lines

How it starts

The opening of the file, as written. The whole thing — 217 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md: driving (and testing) MCEC with an agent

MCEC 3.0 (the Model Context Environment Controller) gives an AI agent eyes, hands, and a safe front door on Windows (Windows computer use, in the sense Claude, Codex, and similar agents use the term). This file is the self-reinforcing guidance loop: the canonical guidance an agent needs, plus the recipe to dogfood it (drive MCEC through its own MCP server) so the guidance stays honest. Each time MCEC changes, re-run the dogfood and refine the guidance below and in AgentServer.Instructions.

The built-in guidance (single source of truth)

The connect-time guidance an MCP client shows the model is authored in src/Agent/AgentInstructions.md. It is embedded into the exe at build time and returned in the MCP initialize response (result.instructions) via AgentServer.Instructions, which loads the embedded file and collapses each blank-line-separated paragraph to one line.

Work the loop observe → target → act → observe.

  1. Target a window by window (title substring), process (name without .exe), className, or foreground:true. At least one is required; a call with no target fails by design.
  2. Observe: query dumps the UI Automation tree (controlType, name, automationId, bounds, state, value; bounded by maxDepth and maxNodes); capture returns a PNG (renders composited WinUI/WPF surfaces correctly). Check results before trusting them: a capture with errorCategory: capture-blank is a black/empty frame (minimized/cloaked/occluded/locked session); restore or foreground the window and retry, don't trust the image; a capture-fallback warning means PrintWindow was refused and the picture may be wrong; a query with truncated:true (a tree-truncated warning) hit the node cap; raise maxNodes or target a deeper window. warnings are non-fatal; errorCategory tells you how to recover. (Shape: docs/agent_control.md and agent-tool-result.schema.json.)
  3. Act: prefer invoke (by name/automationId/classname; action invoke|toggle|setvalue| setfocus|expand|collapse|select) over coordinate clicks. invoke fast-fails if the control isn't present (it does not wait), so find/wait-for the control first; an invoke that returns no-target means it hasn't appeared yet; wait-for it rather than retrying blindly. Use select for TabItem/ListItem/RadioButton. To drag (resize a window by its sizing border, move one by its title bar, or drag a slider/handle; no invoke for these), use the drag tool: give a from and to, each an element { by, value } or an absolute screen pixel { x, y }, plus optional path waypoints; the whole press-move-release is dispatched atomically (prefer it over hand-rolling mouse:lbd/mouse:mt/mouse:lbu, which can interleave with other input). To click a point invoke can't reach (a custom-drawn cell, a canvas/map coordinate, a bare pixel), use the click tool. Before firing an app's own keyboard shortcut at a specific surface (e.g. a MAUI GraphicsView), focus it first; keystrokes only reach the foreground window's focused control. send_command is the raw escape hatch for any other MCEC command (keystrokes, a single mouse action, launch). Re-query after acting; bounds have moved.
  4. Verify with another query/capture.

Compose creatively. Many tasks have no single dedicated tool; build them from primitives. Launch an app with the launch tool (preferred). Use invoke action:select for tabs/list/radios. Drag/resize/move with the drag tool; switch a tab by invoke select or click; record a window by passing its query'd bounds as the record region; wait on window state with the windows tool + a timeout and a condition (appears/disappears/foreground). A capable agent uses the full command set; reach for a raw send_command before concluding something can't be done.

There is exactly one copy: edit that file. It is the observe → target → act → observe playbook (targeting; observation with query/capture/record/displays; invoke, drag, click, focus and send_command; the result envelope; creative composition of primitives; the on-screen overlay; and the security gates). Nothing here to keep in sync.

Read the full file on GitHub · 217 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 217 lines · 4,279 tokens per session scan A b9aae5acb188

Subscribe to this mod's changes

mcec AGENTS.md is an instructions file published in the GitHub repository tig/mcec (102 stars, last pushed 8d ago), licensed MIT. It adds 4,279 tokens to every session, about $0.0214 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.