windows-mqtt: Instructions file for Codex

AGENTS.md

windows-mqtt AGENTS.md is an instructions file for Codex, OpenCode from popstas/windows-mqtt. It costs 4,979 tokens per session, scanned A, original, MIT.

A contributor guide for a Tauri 2 desktop application that controls a PC through MQTT, a messaging protocol commonly used for device communication. It defines JavaScript module rules and explains parts of the application architecture and deployment.

In plain words
What is it for?
Use it when editing the Node.js, Rust, Tauri, MQTT, or OBS-related parts of the desktop application, and when preparing it for deployment.
Why use it?
It prevents import and module-format mistakes that can silently change how dependencies behave, especially when mixing modern JavaScript modules with older packages.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is popstas/windows-mqtt's own configuration. It tells Codex and OpenCode how to work on windows-mqtt 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 windows-mqtt configures →

Reuse

Borrowing it

Nothing to install: this file belongs to popstas/windows-mqtt. 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/popstas/windows-mqtt/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/popstas/windows-mqtt

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 windows-mqtt AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/popstas/windows-mqtt/agents-md/github.svg)](https://agentmods.dev/instructions/popstas/windows-mqtt/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/popstas/windows-mqtt/agents-md"><img src="https://agentmods.dev/badge/instructions/popstas/windows-mqtt/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 windows-mqtt AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/popstas/windows-mqtt/agents-md"><img src="https://agentmods.dev/badge/instructions/popstas/windows-mqtt/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,979 This file is loaded in full into every session.
When invoked 4,979 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.04979 $0.04979
Opus 5.5 $0.01992 $0.01992
Sonnet 5.5 $0.00996 $0.00996
Haiku 4.5 $0.00498 $0.00498

Measured 20d ago against content hash 8a4260184514, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

windows-mqtt 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 20d 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 · 286 lines

How it starts

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

AGENTS Instructions

This repo contains a Node.js project for controlling a PC via MQTT, wrapped in a Tauri v2 desktop app.

Environment

Run source "$HOME/.cargo/env" before any cargo/rust commands.

ESM-соглашения

Весь JS в проекте — ES-модули ("type": "module" в package.json). При правке кода:

  • Относительные импорты обязаны нести расширение .js (./foo.js, не ./foo).
  • CJS-зависимости импортируются дефолтом и деструктурируются (import pkg from 'x'; const { thing } = pkg;), а не именованными импортами — именованные экспорты из CJS зависят от cjs-module-lexer, который ненадёжен на пакетах с нативными аддонами.
  • Если у зависимости в exports есть ключ require, но нет import, голый import уходит в default и может отличаться от того, что отдавал require() — именно так одна строка молча сменила протокол OBS на msgpack вместо JSON (src/modules/obs.js, обходится импортом подпути obs-websocket-js/json). Перед переводом любой зависимости стоит сверить import.meta.resolve('pkg') с прежним require.resolve('pkg').
  • Тот же механизм уже стоил второго модуля: ws под ESM резолвится в wrapper.mjs, чей default — класс WebSocket БЕЗ статик, поэтому new WebSocket.Server() из src/modules/tabs.js падал с TypeError с самого перехода на ESM (глотал initModules()). Сервер берётся только именованным импортом import { WebSocketServer } from 'ws' — wrapper.mjs настоящий ESM, оговорка про cjs-module-lexer к нему не относится.
  • require() в проекте больше нет.
  • Планка рантайма: import.meta.dirname требует Node ≥ 20.11 (боевой код), registerHooks — Node ≥ 22.15 (только тесты, test/modules-registry.test.js). Поля engines в package.json намеренно нет.
  • data/ под .gitignore и содержит CommonJS-файлы (data/index.js и т. п.), поэтому там лежит собственный data/package.json с {"type":"commonjs"} — на свежем клоне его надо создать заново.

Tauri Architecture

  • Tauri v2 (not v1, not Electron). Config schema: https://schema.tauri.app/config/2
  • Rust backend in src-tauri/src/main.rs — resolves an "app root" (dev: project root; bundled: resource_dir/_up_) via resolve_app_root, spawns the Node.js server from setup() as a child process via tauri-plugin-shell, and kills it gracefully on Quit (sends app/shutdown IPC action, then hard-kills after 800ms)
  • Permissions defined in src-tauri/capabilities/default.json (replaces v1 allowlist)
  • Tray icon built inside .setup() using TrayIconBuilder, with on_menu_event and on_tray_icon_event closures
  • Shell commands use app.shell().command() (from ShellExt trait), NOT tauri::api::process::Command
  • CommandEvent::Stdout/Stderr returns Vec<u8>, convert with String::from_utf8_lossy
  • Build check: cd src-tauri && cargo check
  • Типы без TypeScript: jsconfig.json включает checkJs, npm run typecheck (tsc --noEmit) гоняется первым шагом npm test. Файлы остаются .js, шага сборки нет — bundle.resources, deploy-fast.js и спавн src/index.js из Rust продолжают работать с россыпью исходников. strict намеренно выключен: в нём проект даёт ~450 ошибок, из них ~380 — разметка implicit any без единого реального дефекта. Формы конфига описаны одним @typedef Config в src/config-loader.js (индексная сигнатура: ключи задаёт пользователь в YAML). Нетипизированные зависимости обязаны иметь @types/* в devDependencies — иначе allowJs заставляет tsc проверять их собственный JS и сыпать сотней чужих ошибок.
  • JS tests: npm test (npm run typecheck && node --test test/**/*.test.js). Pure logic only — never spawn Windows/native binaries in tests. Modules with native addons are covered by test/native-modules.test.js, which auto-skips where those addons aren't installed (e.g. Linux).
  • JS/Rust config-path coupling: resolveAppFile/resolveConfigPath in src/paths.js must stay in sync with config_candidates/resolve_config_path in src-tauri/src/main.rs (same search order, same config.example.yml fallback).
  • JS/Rust MQTT-address coupling: parseBroker/connectArgs in src/mqtt-broker.js (headless client) and parse_broker/tls_roots_for in src-tauri/src/mqtt_bridge.rs (Tauri bridge) read the same mqtt.host/mqtt.port/mqtt.ca and must agree: bare host[:port] = plain mqtt, mqtts:// = TLS, port from the address > port key (a number or a numeric string) > 1883/8883, anything else is a config error; relative ca resolves against the config.yml folder. The rule is shared with ccfzf-picker and windows11-manager. Both test files carry the same case list — change them together. Rust TLS uses webpki-roots, not TlsConfiguration::default() (it loads the lazily-filled Windows store and panics on failure); rustls must stay on the version rumqttc pulls (0.22 for rumqttc 0.24).
  • Dev run: npm run start-tauri or cargo tauri dev. The npm scripts use scripts/tauri-wrapper.js to ensure MSVC linker is available when running from Git Bash (vcvars64.bat is invoked before Tauri). If you see LNK1181: cannot open input file 'kernel32.lib', ensure the "Desktop development with C++" workload includes the Windows 10/11 SDK.

Read the full file on GitHub · 286 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. 20d ago Changed · +17 lines · +614 tokens per session 8a4260184514
  2. 2mo ago First seen · 269 lines · 4,365 tokens per session scan A b46b5f886b60

Subscribe to this mod's changes

windows-mqtt AGENTS.md is an instructions file published in the GitHub repository popstas/windows-mqtt (10 stars, last pushed 20d ago), licensed MIT. It adds 4,979 tokens to every session, about $0.0199 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-31.

Related

windows-mqtt AGENTS.md compared with instructions from other repositories

windows-mqtt AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
windows-mqtt AGENTS.mdpopstas/windows-mqttInstructions file1020d agoMITA4,979Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,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