maui-labs devflow-architecture.instructions.md

Architecture instructions for DevFlow, a system that connects a command-line tool or coding agent to a .NET MAUI app through a broker and an in-app agent. The instructions explain its communication layers, packages, abstractions, and extension points.

In plain words
What is it for?
Understanding connections between the CLI, broker, app agent, platform APIs, packages, and the split between shared abstractions and platform-specific backends.
Why use it?
They give developers the context needed to change or extend DevFlow without misunderstanding how its parts communicate.

Instructions file for GitHub Copilot

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/dotnet/maui-labs/devflow-architecture
Clone the repo
git clone --depth 1 https://github.com/dotnet/maui-labs

Made for: GitHub Copilot.

Per session 2,643 This file is loaded in full into every session.
When invoked 2,643 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.02643 $0.02643
Opus 5 $0.01321 $0.01321
Sonnet 5 $0.00529 $0.00529
Haiku 4.5 $0.00264 $0.00264

Measured 3d ago against content hash fdfde23ec283, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

maui-labs devflow-architecture.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 3d 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/devflow-architecture.instructions.md · 205 lines

How it starts

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

DevFlow Architecture

Communication Model

DevFlow uses a three-tier architecture:

┌──────────────┐                ┌──────────────┐                ┌──────────────────────────┐
│  CLI / MCP   │  HTTP (direct) │    Broker     │  WebSocket     │  Agent (in-app)          │
│  (maui devflow)│ ◄──────────► │  (port 19223) │ ◄───────────── │  (dynamic port)          │
└──────────────┘  (after port   └──────────────┘  (registration) └──────────────────────────┘
      │            discovery)          │                                │
      │ HTTP (direct, after discovery) │                                │ Platform APIs
      └────────────────────────────────┼────────────────────────────────┘
      ▲                                                               
      │ MCP (stdio)                                                   
      ▼                                                               
┌──────────────┐                                              
│  AI Agent    │                                              
│  (Copilot,   │                                              
│   Claude,    │                                              
│   etc.)      │                                              
└──────────────┘
  1. Agent runs inside the app process (added via NuGet package — MAUI or plain .NET). Exposes HTTP API on a dynamic port. Registers with the Broker over WebSocket. Has direct access to the visual tree, pages, platform views.
  2. Broker runs on the developer machine (port 19223). Agents register with it via WebSocket. CLI discovers agent ports through the broker's HTTP API.
  3. CLI (maui devflow) discovers agents via the broker, then communicates directly with agents over HTTP. Also hosts the MCP server for AI agent integration.

Package Dependency Graph

Microsoft.Maui.DevFlow.CLI (global tool)
├── Microsoft.Maui.DevFlow.Driver (platform drivers)
│   └── Microsoft.Maui.DevFlow.Client (AgentClient — public protocol API)
├── ModelContextProtocol (MCP server)
├── System.CommandLine (CLI framework)
├── Spectre.Console (terminal UI)
└── Websocket.Client (broker transport)

Microsoft.Maui.DevFlow.Client (netstandard2.0 + modern .NET)
├── AgentClient, ElementInfo, protocol DTOs, HTTP/JSON operations
└── System.Text.Json

Microsoft.Maui.DevFlow.Driver (modern .NET, platform-specific)
├── Microsoft.Maui.DevFlow.Client
├── App process management, UI Automation, Mac accessibility
└── SkiaSharp (screenshot processing)

Microsoft.Maui.DevFlow.Agent.Abstractions (no MAUI dependency)
├── AgentHttpServer, AgentOptions, routing, DevFlowAgentService
├── ElementInfo + DTOs, Css/, Network/, Profiling/, extensions
├── Fizzler (CSS selector parsing)
└── SkiaSharp (screenshot capture/resize)

Microsoft.Maui.DevFlow.Agent.Core (MAUI UI backend)
└── Microsoft.Maui.DevFlow.Agent.Abstractions

Microsoft.Maui.DevFlow.Agent (NuGet package for MAUI app developers)
├── Microsoft.Maui.DevFlow.Agent.Core
└── Microsoft.Maui.DevFlow.Blazor (optional — CDP bridge for Blazor WebViews)

Microsoft.Maui.DevFlow.Agent.Gtk (NuGet package for GTK/Linux apps)
├── Microsoft.Maui.DevFlow.Agent.Core
└── Microsoft.Maui.DevFlow.Blazor.Gtk (optional — WebKitGTK CDP)

Microsoft.Maui.DevFlow.Agent.WPF (NuGet package for WPF apps)
└── Microsoft.Maui.DevFlow.Agent.Core

Microsoft.Maui.DevFlow.Agent.Native (plain .NET android/ios/maccatalyst/macos — no MAUI)
├── Microsoft.Maui.DevFlow.Agent.Abstractions
└── NativeUi.{Android,UIKit,AppKit}, NativeDevFlowAgentService, DevFlowAgent.Start()

Microsoft.Maui.DevFlow.Agent.Native.Essentials (optional add-on)
└── Microsoft.Maui.DevFlow.Agent.Native + Microsoft.Maui.Essentials

Microsoft.Maui.DevFlow.Logging (standalone — no MAUI dependency)

Read the full file on GitHub · 205 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. 3d ago First seen · 205 lines · 2,643 tokens per session scan A fdfde23ec283

Subscribe to this mod's changes

maui-labs devflow-architecture.instructions.md is an instructions file published in the GitHub repository dotnet/maui-labs (212 stars, last pushed 5d ago), licensed MIT. It adds 2,643 tokens to every session, about $0.0132 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.