mcec: Instructions file for Codex

AGENTS.md

mcec AGENTS.md is an instructions file for Codex, OpenCode from tig/mcec. It costs 4,279 tokens per session, scanned A, original, MIT.

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

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md; mentions Codex.

This is tig/mcec's own configuration. It tells Codex and OpenCode how to work on mcec itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mcec configures →

Reuse

Borrowing it

Nothing to install: this file belongs to tig/mcec. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tig/mcec/develop/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/tig/mcec

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mcec AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/tig/mcec/agents-md/github.svg)](https://agentmods.dev/instructions/tig/mcec/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/tig/mcec/agents-md"><img src="https://agentmods.dev/badge/instructions/tig/mcec/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mcec AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/tig/mcec/agents-md"><img src="https://agentmods.dev/badge/instructions/tig/mcec/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.04279 $0.04279
Opus 5.5 $0.01712 $0.01712
Sonnet 5.5 $0.00856 $0.00856
Haiku 4.5 $0.00428 $0.00428

Measured 2mo ago against content hash b9aae5acb188, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (105 stars, last pushed 2mo ago), licensed MIT. It adds 4,279 tokens to every session, about $0.0171 per session on Opus 5.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.

Related

mcec AGENTS.md compared with instructions from other repositories

mcec AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
mcec AGENTS.mdtig/mcecInstructions file1052mo agoMITA4,279Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode