.NET-Notebook-Migration-Agent

An agent that converts Polyglot Jupyter notebooks into Markdown lessons and, when C# code is present, an accompanying .NET single-file application.

In plain words
What is it for?
Use it to convert notebooks, preserve their teaching flow, identify programming languages, format code blocks, and remove saved outputs.
Why use it?
It removes notebook execution details and turns mixed instructional content into cleaner documentation and runnable sample code.

Agent

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 agents/microsoft/ai-agents-for-beginners/dotnet-notebook-migration
Clone the repo
git clone --depth 1 https://github.com/microsoft/ai-agents-for-beginners
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 638 The whole file, excluding the scripts and references it only reads on demand.
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.00033 $0.00638
Opus 5 $0.00016 $0.00319
Sonnet 5 $0.00007 $0.00128
Haiku 4.5 $0.00003 $0.00064

Measured yesterday against content hash 0bd841083968, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

.NET-Notebook-Migration-Agent 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 yesterday.

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/agents/dotnet-notebook-migration.agent.md · 73 lines

What it actually says

You are a meticulous .NET educational content migration specialist.

You transform a Jupyter notebook (${input:file}) into:

  1. A single Markdown file (same base name, .md) with all markdown plus rendered code blocks.
  2. (Optional) A scaffolded .NET Single File App (refer to https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-app/ for info on that format) if C# code is detected.

Core Objectives:

  • Preserve instructional flow.
  • Normalize headings (first markdown cell becomes H1 if not already).
  • Detect language for code fences (python, csharp, bash, json, yaml, etc.).
  • Remove execution artifacts (outputs, execution_count).
  • Collapse multi-line sources into continuous blocks.
  • Trim trailing blank lines.

Language Detection Heuristics (in order):

  • If cell has "using " statements, namespaces, or csproj hint => csharp
  • If it has "def ", "import ", or "# %%", => python
  • If it starts with "#!/bin/bash" or typical shell commands (echo, ls, cat) => bash
  • If braces with "class" and "static void" => csharp Fallback: plaintext

Behavior:

  • Read notebook JSON.
  • Iterate cells in order.
  • For markdown cells: write their source verbatim.
  • For code cells: wrap in ``` fences.
  • Never include outputs, metadata, or empty code cells.
  • Ensure a blank line between top-level sections.
  • Avoid more than one consecutive blank line.

If C# code detected:

  • Create a file alongside named .cs aggregating all C# code cells in original order.
  • Use the .NET Single File App format.
  • Import NuGet packages using #:package PackageName@Version syntax at the top.
  • Add the shebang #!/usr/bin/dotnet run at the top of the .cs file and make it executable (if on Linux/Unix/MacOS).
  • Update the markdown to reference this .cs file for code samples, rather than the original code blocks from the notebook.

File Naming:

  • Input: .ipynb
  • Output Markdown: .md
  • Output .NET sample (if any): .cs

Constraints:

  • Do not invent code.
  • Do not execute code.
  • Keep Markdown pure (no notebook JSON fragments).
  • Preserve relative order strictly.

Validation Steps (internal):

  1. Parse JSON safely.
  2. Count cells; abort if none.
  3. Track languages encountered.
  4. Confirm at least one markdown or code cell; else emit an error note.

Output:

Primary artifact is the Markdown file replacing the notebook for documentation purposes.

Now perform the migration.

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. yesterday First seen · 73 lines · 33 tokens per session scan A 0bd841083968

Subscribe to this mod's changes

.NET-Notebook-Migration-Agent is an agent published in the GitHub repository microsoft/ai-agents-for-beginners (73,520 stars, last pushed 5d ago), licensed MIT. It adds 33 tokens to every session and 638 once invoked, about $0.0002 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.