maf-doctor: Instructions file for GitHub Copilot

.github/instructions/maf-deployment.instructions.md

maf-doctor maf-deployment.instructions.md is an instructions file for GitHub Copilot from joslat/maf-doctor. It costs 1,884 tokens per session, scanned A, original, MIT.

Production deployment guidance for Microsoft Agent Framework (MAF), a toolkit for building AI agents. It applies rules to application startup, dependency setup, and infrastructure configuration.

In plain words
What is it for?
Use it when wiring MAF into a production .NET application, configuring Azure identity, setting model token limits, handling secrets, or adding OpenTelemetry monitoring.
Why use it?
It helps prevent deployment mistakes involving identity, secrets, token limits, monitoring, and analyzer warnings. These issues can cause authentication failures or regressions after release.

Instructions file for GitHub Copilot

Written for GitHub Copilot: a Copilot instructions file.

This is joslat/maf-doctor's own configuration. It tells GitHub Copilot how to work on maf-doctor 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 maf-doctor configures →

Reuse

Borrowing it

Nothing to install: this file belongs to joslat/maf-doctor. 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/joslat/maf-doctor/main/.github/instructions/maf-deployment.instructions.md
Clone the repo
git clone --depth 1 https://github.com/joslat/maf-doctor

Made for: GitHub Copilot.

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 maf-doctor maf-deployment.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/joslat/maf-doctor/maf-deployment/github.svg)](https://agentmods.dev/instructions/joslat/maf-doctor/maf-deployment)
Your own site
<a href="https://agentmods.dev/instructions/joslat/maf-doctor/maf-deployment"><img src="https://agentmods.dev/badge/instructions/joslat/maf-doctor/maf-deployment/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 maf-doctor maf-deployment.instructions.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/joslat/maf-doctor/maf-deployment"><img src="https://agentmods.dev/badge/instructions/joslat/maf-doctor/maf-deployment.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,884 This file is loaded in full into every session.
When invoked 1,884 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.01884 $0.01884
Opus 5 $0.00942 $0.00942
Sonnet 5 $0.00377 $0.00377
Haiku 4.5 $0.00188 $0.00188

Measured 9d ago against content hash 5084d00627b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

maf-doctor maf-deployment.instructions.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 9d 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.

.github/instructions/maf-deployment.instructions.md · 167 lines

How it starts

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

MAF Production Deployment — Patterns That Hold Up

This file is loaded when you edit a file that wires MAF into a host process (Program.cs, DI registration, infrastructure). The rules below are the ones we've learned the hard way — every one has a production incident behind it.

Identity — the rule that catches half of all incidents

// ❌ NEVER in production
services.AddSingleton<TokenCredential>(_ => new DefaultAzureCredential());

// ✅ Production
services.AddSingleton<TokenCredential>(_ => new ManagedIdentityCredential());

Why: DefaultAzureCredential walks a chain of credential providers (env vars, CLI, VS, IDE, MSI). In dev that's convenient. In prod it's a footgun: a dev's stale AZURE_* env var leaking into the container, an unintended az login token surviving in the build image, and silent fallback when MSI isn't available all produce subtle, hard-to-trace auth failures. The Roslyn analyzer MAF002 fires on any new DefaultAzureCredential() outside test code — keep it pinned to "warning" or escalate to "error" in CI.

When you NEED a fallback chain (e.g., for a tool that runs both locally and in the cloud), build the chain explicitly with ChainedTokenCredential — never rely on DefaultAzureCredential's implicit chain.

Cost — every chat-completion call needs a ceiling

// ❌ Unbounded — production cost incident waiting to happen
_agent = new ChatClientAgent(client, new ChatClientAgentOptions
{
    ChatOptions = new ChatOptions { Instructions = "..." }
});

// ✅ Always cap MaxOutputTokens
_agent = new ChatClientAgent(client, new ChatClientAgentOptions
{
    ChatOptions = new ChatOptions
    {
        MaxOutputTokens = 1024,        // hard ceiling — adjust per agent intent
        Instructions = "..."
    }
});

Why: A misbehaving prompt or an injection-induced "summarize this 30-page doc again" can blow through token budget in seconds. The MafEstimateCost tool surfaces every unbounded site; MafDoctor weights them into the grade. Default cap recommendation: 1024 for chat agents, 4096 for summarization agents, 8192+ ONLY for explicitly-scoped batch jobs.

Read the full file on GitHub · 167 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. 9d ago First seen · 167 lines · 1,884 tokens per session scan A 5084d00627b7

Subscribe to this mod's changes

maf-doctor maf-deployment.instructions.md is an instructions file published in the GitHub repository joslat/maf-doctor (14 stars, last pushed 22d ago), licensed MIT. It adds 1,884 tokens to every session, about $0.0094 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.