agentleFS
MicrosoftKnown publishermicrosoft/MIDI/AGENTS.md

MIDI

AGENTS.md685 starsChanged 59 days agoMITView on GitHub

Windows MIDI Services. See README.md for what the project is, and CONTRIBUTING.md for contribution process. You may be given access to non-public source or documents to investigate a problem. Treat them as input to your decisions only. Nothing from them may appear in this repository, or in issues, pull requests or commit messages — not file or symbol names, not internal interfaces or keys, and not the mechanism behind a behavior. Describing externally observable behavior is fine; explaining how it…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the API cannot express what is needed, that is an API gap.

    line 39
  2. Very specific:

    Check your work with build/check_en_us_spelling.ps1 -Path <file or folder>.

    line 62
  3. Very specific:

    Read .github/skills/midi-contributing/SKILL.md before you edit any source file.

    line 74
  4. Distinctive:

    Match devices by the name Windows shows: Never invent an endpoint device ID.

    line 128
  5. Distinctive:

    Say what the app can't do: Don't build something that only looks like the feature the person asked for.

    line 131
  6. Very specific:

    If you change what MIDI Glass or MIDI Patchbay reads from or writes to these files, update the matching guide in the same change.

    line 134

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Instructions for coding agents

Windows MIDI Services. See README.md for what the project is, and CONTRIBUTING.md for contribution process.

This repository is public

You may be given access to non-public source or documents to investigate a problem. Treat them as input to your decisions only. Nothing from them may appear in this repository, or in issues, pull requests or commit messages — not file or symbol names, not internal interfaces or keys, and not the mechanism behind a behavior. Describing externally observable behavior is fine; explaining how it is implemented internally is not. If a document seems to need the internal mechanism to make sense, rewrite it in terms of what a customer can observe.

The configuration file is off limits

Windows MIDI Services keeps its configuration in %ALLUSERSPROFILE%\Microsoft\MIDI in a .midiconfig.json file named by a registry value. The JSON schema, the file name, the folder and the registry value are implementation details, not a contract. They can change in any release, without notice.

There are exactly two supported ways to read or change that configuration:

  • The Windows MIDI Services API — the Windows.Devices.Midi2.ServiceConfig namespace and the per-transport config types. It serializes access with the service, merges entries instead of rewriting the file, makes its own backups, validates what it writes, and applies the change to the running service as well as to disk.
  • The in-box tools built in this repository — the MIDI Settings app, the midi console and the PowerShell module — which call that same API.

Everything else is unsupported:

  • Do not write, ship, publish or recommend a script or tool that opens, parses, edits, merges, backs up or restores the configuration file directly. Care taken does not make it supported. Hash checks, exclusive file handles, before-images and temp-file swaps still race the service and the Settings app, still leave debris in ProgramData, and still break the day the format changes.
  • No one outside Microsoft may ship a product that manipulates the configuration file directly, for any reason, including backup, restore, migration or "personalization recovery".
  • If the API cannot express what is needed, that is an API gap. Say so, and file an issue for it. Do not fall back to the file. An unfinished feature is a better outcome than a tool that corrupts a customer's MIDI configuration after the next update.

Developer-only tools inside this repository

A tool in this repository that must touch the file directly — a test fixture, a diagnostic, a repair tool — is allowed, but it has to carry this disclaimer in the source and in any documentation for it, so that neither a human nor another agent learns the pattern from it:

UNSUPPORTED — DO NOT COPY THIS APPROACH. This code reads and writes the Windows MIDI Services configuration file directly. Microsoft does not support direct manipulation of that file by anything other than the in-box MIDI tools. Its format, its name, its location and the registry value that selects it are implementation details and can change in any release without notice, so this code can corrupt a configuration or stop working at any time. It exists for development and diagnostics inside the Windows MIDI Services repository only. Applications and third-party tools must use the Windows MIDI Services API (Windows.Devices.Midi2.ServiceConfig) instead.

Writing

Everything in this repository is authored in en-US, including identifiers, comments, UI strings and documentation. en-GB spellings are defects, not style preferences. Full rules and word list: .github/instructions/en-us-spelling.instructions.md. Check your work with build/check_en_us_spelling.ps1 -Path <file or folder>.

Never hard-wrap markdown. A paragraph is one line, however long. So is a bullet, including its continuation text, and so is a table row. Put newlines only between blocks — between paragraphs, between bullets, and around headings and code fences. Code fences and front matter keep their own line breaks. There is no column limit. This applies to every markdown file here, to GitHub issues and pull request descriptions, and to reports filed against other repositories.

Public documentation is written for an eighth grader. Short sentences, everyday words, and the plain term rather than the clever one. Contractions are welcome. Explain why a setting matters, not just what it is.

Leave the jargon out. That includes the figures of speech agents reach for by reflex: load-bearing, smoking gun, deep dive, surface it, unpack, low-hanging fruit, rabbit hole, move the needle. Write what actually happens instead — "removing this breaks every published link", "this is the proof", "show it in the UI".

Bug reports get the same rules, plus one more: be brief. Technical language is fine in a bug report. Length is not. Include the detail a developer needs and stop. Do not bury a fact in a paragraph of setup, restate the problem three ways, or summarize what you just wrote. Jargon and length are the two things that make an agent-written bug report useless.

Writing or reviewing code

Read .github/skills/midi-contributing/SKILL.md before you edit any source file. The rules that get broken most often:

  1. Changes to code that ships in Windows must be wrapped in a servicing gate (KIR), with the original behavior preserved exactly when the gate is disabled. The trigger is where the file lives, not how small the diff is. Where the branch goes — call site, a net-new function, in place, or a net-new class chosen at the factory — depends on the shape of the change.
  2. SAL-annotate every function parameter, and use _Use_decl_annotations_ with bare parameters in the .cpp when the declaration is in a header.
  3. User-facing strings go in resource files (.resw or .rc), never inline in code.
  4. Review your own diff for use after free, TOCTOU, escaping exceptions, lock inversions and untrusted input before submitting. An exception escaping a thread body or an HRESULT function in midisrv takes MIDI down for the whole machine.
  5. Do not change public WinRT API surface without asking. It ships in box and applications depend on it.

Filing bug reports and designing test plans

Full guidance, including a write-up template, is in .github/skills/midi-bug-reports/SKILL.md. Read it before drafting an issue or a test plan. The three rules that get broken most often:

  1. Scope the claim to what was actually tested. One device or one driver failing is a device-scoped or driver-scoped defect until a differently-plumbed device also fails. Do not write all, every, always or regression unless the set was enumerated in the same report. Put the scope in the title.
  2. Test the native path before filing a WinMM bug. WinMM goes through wdmaud2.drv; the Windows MIDI Services SDK does not. If the native UMP path also fails, the defect is in the service, transport or driver and should be filed as such. If only WinMM fails, it is in the WinMM client or the MIDI 1.0 translation. Report a result for each path, or mark it not tested.
  3. Report the API mode, and tell the user about Legacy API mode. Record midi api-mode get. For a WinMM failure, also try Legacy mode (UseLegacyMidi = 1): if it fails there too, it is not a Windows MIDI Services regression. Offer Legacy mode to the user as a way to stay unblocked, and state what it costs — no multi-client, no built-in loopbacks, no Network MIDI 2.0 or Bluetooth LE MIDI, no USB MIDI 2.0 devices. See docs/kb/how-to-change-api-mode.md.

The issue form requires AI-generated analysis to be tagged "AI Generated Content", and the "personal observation" field must be the reporter's own words. Do not write that field for them.

Making MIDI Glass layouts and themes, and MIDI Patchbay patches

When someone asks you to design a MIDI Glass layout or theme, or a MIDI Patchbay patch, read the matching guide from start to finish before you write anything. Each guide says what to ask, gives the whole file format with a working example, and has a script that checks the finished file.

To makeReadPublished at
A MIDI Glass layout (.midilayout)docs/kb/midi-glass-layouts-for-agents.mdhttps://microsoft.github.io/MIDI/kb/midi-glass-layouts-for-agents/
A MIDI Glass theme (.miditheme)docs/kb/midi-glass-themes.mdhttps://microsoft.github.io/MIDI/kb/midi-glass-themes/
A MIDI Patchbay patch (.midipatch)docs/kb/midi-patchbay-patches-for-agents.mdhttps://microsoft.github.io/MIDI/kb/midi-patchbay-patches-for-agents/

The rules that get broken most often:

  1. Use only the keys and values in the guide. A key the app doesn't know is ignored without an error, so a made-up key looks fine and does nothing.
  2. Match devices by the name Windows shows. Never invent an endpoint device ID.
  3. Count groups and channels from 0 in the file. People and the apps' screens count them from 1.
  4. Use a built-in theme by its exact name unless the person asks for a theme of their own.
  5. Say what the app can't do. Don't build something that only looks like the feature the person asked for.
  6. Check the file with the guide's script, and show the person a mockup or a plain-words plan before you hand it over.

If you change what MIDI Glass or MIDI Patchbay reads from or writes to these files, update the matching guide in the same change.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.