windows-mqtt AGENTS.md

windows-mqtt AGENTS.md is an instructions file for Codex, OpenCode from popstas/windows-mqtt. It costs 4,365 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

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/popstas/windows-mqtt/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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,365 This file is loaded in full into every session.
When invoked 4,365 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.04365 $0.04365
Opus 5 $0.02183 $0.02183
Sonnet 5 $0.00873 $0.00873
Haiku 4.5 $0.00436 $0.00436

Measured 5d ago against content hash b46b5f886b60, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 5d 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 · 269 lines

How it starts

The opening of the file, as written. The whole thing — 269 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).
  • 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 · 269 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. 5d 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 18d ago), licensed MIT. It adds 4,365 tokens to every session, about $0.0218 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-31.