Terminal, large font. Nothing else.
$ ma task.copilot.mdSay this:
"What if your markdown files could run AI? What if that documentation you already write... was executable?"
Pause. Let them process.
"That command just parsed a markdown file, extracted configuration from YAML frontmatter, and spawned an AI agent. But that's the punchline. Let me show you the setup."
The real magic:
$ git diff | copilot -p "review this" -s"Data in. Intelligence out. The fifty-year-old pipe operator now carries something it never carried before: cognition."
The Unix Philosophy, Extended
Traditional: grep ERROR log.txt | sort | uniq -c
AI-powered: git diff | copilot -p "review" -s
What changed:
- Same
|operator - Same stdin/stdout contract
- New capability: the transformation is now semantic, not syntactic
The core equation:
Software = Instructions + Tools
"We're not replacing tools. We're adding a new class of transformation to the pipeline."
The interaction modes:
# Interactive (default) - human in the loop
$ copilot
> What would you like help with?
# Non-interactive with prompt - for scripting
$ copilot -p "explain the error in this file"
# Silent mode - pure output, no chrome
$ copilot -p "explain the error" -sWhy -s is critical for pipelines:
# Without -s: ANSI codes, spinners, stats
$ copilot -p "summarize"
[spinner] Thinking...
Summary: Here's what's happening...
Tokens: 150 | Time: 1.2s
# With -s: Clean, pipeable text only
$ copilot -p "summarize" -s
Summary: Here's what's happening..."Silent mode strips everything but the answer. That's what makes it composable."
# The fundamental pattern: stdin → AI → stdout
cat error.log | copilot -p "What went wrong?" -s
# Git integration - the killer use case
git diff | copilot -p "Review for bugs" -s
# Test output analysis
npm test 2>&1 | copilot -p "Why is this failing?" -s
# Documentation generation
cat src/utils.ts | copilot -p "Generate JSDoc comments" -sUnder the hood:
- Pipe sends data to copilot's stdin
-pprovides the instruction- Model processes context + instruction
-soutputs clean text to stdout- Ready for next stage
Multi-stage pipeline:
git diff | \
copilot -p "list changes as bullets" -s | \
copilot -p "rate each: low/medium/high risk" -s | \
copilot -p "format as PR description" -sWhat's happening at each stage:
Stage 1: raw diff → structured list
Stage 2: structured list → risk-annotated list
Stage 3: annotated list → formatted output
"Each stage refines the previous output. This is functional composition, but the functions understand natural language."
Edge case - context accumulation:
# BAD: Context explodes at each stage
big_file.ts | copilot -p "summarize" -s | copilot -p "expand" -s
# GOOD: Filter early, expand late
big_file.ts | copilot -p "extract function signatures only" -s | copilot -p "generate docs" -sAvailable models (as of Dec 2024):
--model claude-haiku-4.5 # Fast, cheap - triage/classification
--model claude-sonnet-4 # Balanced - daily tasks (default)
--model claude-sonnet-4.5 # Enhanced reasoning
--model claude-opus-4.5 # Maximum capability
--model gpt-5.1-codex # GPT family - code focused
--model gemini-3-pro-preview # Google's modelThe escalation pattern:
#!/bin/bash
# Smart escalation based on task complexity
TASK="$1"
# Use fast model to classify
COMPLEXITY=$(echo "$TASK" | copilot -p "Respond ONLY: SIMPLE or COMPLEX" -s --model claude-haiku-4.5)
if [ "$COMPLEXITY" = "COMPLEX" ]; then
copilot -p "$TASK" -s --model claude-opus-4.5
else
copilot -p "$TASK" -s --model claude-haiku-4.5
fiCost/Speed comparison:
| Model | Relative Speed | Relative Cost | Use Case |
|---|---|---|---|
| haiku-4.5 | 5x faster | 10x cheaper | Triage, classification, simple transforms |
| sonnet-4 | Baseline | Baseline | General purpose |
| opus-4.5 | 3x slower | 15x more | Deep analysis, complex reasoning |
"Use the fast model to decide if you need the powerful model. Don't pay for Opus to answer 'yes or no' questions."
The permission model:
# Deny all tools by default (pure analysis)
copilot -p "Analyze this code" -s
# Allow specific tool patterns
copilot -p "Fix this" -s --allow-tool 'shell(git:*)'
# Allow file operations
copilot -p "Refactor this" -s --allow-tool 'write' --allow-tool 'Read'
# Full autonomy (use with caution)
copilot -p "Implement feature X" -s --allow-all-toolsThe tool permission syntax:
# Pattern: 'toolName(pattern)'
--allow-tool 'shell(git:*)' # All git commands
--allow-tool 'shell(npm:*)' # All npm commands
--allow-tool 'shell(git push)' # Specific command
--allow-tool 'Read' # File reading
--allow-tool 'write' # File writing
# Deny takes precedence
--allow-tool 'shell(git:*)' --deny-tool 'shell(git push --force)'Trust ladder for automation:
Level 1: Pure pipes cat code | copilot -p "find bugs" -s
(safest) No tool access, analysis only
Level 2: Read-only copilot -p "audit" -s --allow-tool 'Read' --allow-tool 'shell(git log)'
(inspection) Can read, can't modify
Level 3: Scoped writes copilot -p "fix lint" -s --allow-tool 'shell(npm:*)' --allow-tool 'write'
(controlled) Specific modification rights
Level 4: Full autonomy copilot -p "implement" -s --allow-all-tools
(supervised) Human monitors, agent acts
"The pipe doesn't grant permissions. You do, explicitly, with flags. This is the control surface for AI automation."
#!/bin/bash
# review-pipeline.sh
git diff main..HEAD | \
copilot -p "List changes with file:line format" -s --model claude-haiku-4.5 | \
copilot -p "For each change: [BUG_RISK], [PERF_IMPACT], [SECURITY]" -s --model claude-sonnet-4 | \
copilot -p "Sort by risk, format as markdown table" -s --model claude-haiku-4.5 > review.mdWhy three models?
- Stage 1 (haiku): Structural transformation - fast, cheap
- Stage 2 (sonnet): Judgment/evaluation - needs reasoning
- Stage 3 (haiku): Formatting - mechanical transform
#!/bin/bash
# debug-pipeline.sh
npm test 2>&1 | \
copilot -p "Extract ONLY the failing test output" -s --model claude-haiku-4.5 | \
copilot -p "Identify root cause from stack trace and assertions" -s --model claude-sonnet-4 | \
copilot -p "Generate a fix with explanation" -s --model claude-opus-4.5Escalation in action: Filter fast, analyze balanced, generate with maximum capability.
# Process multiple files through AI pipeline
find src -name "*.ts" -print0 | \
xargs -0 -I {} sh -c 'cat {} | copilot -p "Extract exported types" -s >> types.md'
# Parallel processing (careful with rate limits)
find src -name "*.ts" | \
xargs -P 4 -I {} sh -c 'cat {} | copilot -p "Generate JSDoc" -s > {}.doc'"Everything we've built is powerful. But be honest - will you remember
--allow-tool 'shell(git:*)'next week?"
Pain points with raw CLI:
- Complex flag combinations forgotten
- Project-specific configurations lost
- Team patterns shared via... Slack?
- No version control on prompts
The concept:
$ ma review.copilot.mdHow the filename works:
review= your task name.copilot= execute with copilot CLI.md= it's markdown (you already know this)
The file structure:
---
model: claude-sonnet-4
allow-tool:
- 'shell(git:*)'
- Read
silent: true
---
Review these code changes for:
1. Bug risks
2. Performance issues
3. Security concerns
Prioritize by severity.What ma does:
- Parse YAML frontmatter → CLI flags
- Process markdown body → prompt
- Resolve
copilotfrom filename - Spawn:
copilot --model claude-sonnet-4 --allow-tool 'shell(git:*)' --allow-tool Read -s -p "Review these code changes..."
---
model: claude-sonnet-4
args:
- base_branch
- focus_area
silent: true
---
## Context
!`git diff {{ base_branch | default: "main" }}..HEAD`
## Instructions
Review changes with focus on {{ focus_area | default: "all areas" }}.
For each change:
- Risk level (low/medium/high)
- Category (bug fix, feature, refactor)
- Concerns if anyUsage:
ma pr-review.copilot.md --base_branch develop --focus_area securityUnder the hood:
- LiquidJS templating engine
!backticks`` inline shell commands@./pathimports file contents- Default values with filters
# Pipe works just like raw copilot
git diff | ma review.copilot.md
# The agent file receives stdin as context
cat error.log | ma diagnose.copilot.md --severity criticalWhy this matters:
- Your pipelines, versioned in git
- Team patterns, shared via PRs
- Project standards, automated
-senables composability - Silent mode produces pipeable output|carries intelligence - Same Unix pipes, new transformation type--modelcontrols capability/cost - Escalate intentionally--allow-tooldefines trust - Explicit permission boundaries.copilot.mdfiles capture patterns - Version control your AI workflows
# Step 1: Try piping
git diff | copilot -p "review" -s
# Step 2: Add model selection
git diff | copilot -p "review" -s --model claude-haiku-4.5
# Step 3: Create an agent file
echo "Review this code for bugs" > review.copilot.md
git diff | ma review.copilot.md
# Step 4: Commit your agent
git add review.copilot.md && git commit -m "Add code review agent"- Copilot CLI:
copilot --help(it's comprehensive) - markdown-agent:
github.com/johnlindquist/agents - This outline: [gist link]
"The pipe operator hasn't changed in fifty years. What changed is what flows through it. When text carries intention, and tools can interpret that intention, the transformation isn't syntactic anymore. It's semantic. That's the paradigm shift: your shell just learned to understand."
| Section | Duration | Cumulative |
|---|---|---|
Hook: ma task.copilot.md + git diff demo |
2 min | 2 min |
| Architecture: Unix philosophy extended | 2 min | 4 min |
-p and -s flags deep-dive |
2 min | 6 min |
| Demo 1: Basic piping patterns | 2 min | 8 min |
| Demo 2: Chaining intelligence | 2 min | 10 min |
Demo 3: Model selection (--model) |
2 min | 12 min |
Demo 4: Permission boundaries (--allow-tool) |
2 min | 14 min |
| Advanced patterns | 2 min | 16 min |
| Resolution: markdown-agent reveal | 3 min | 19 min |
| Closing: Technical summary | 1 min | 20 min |
- Terminal: 24pt+ font, dark theme, minimal prompt
- Git repo with staged changes for
git diffdemos - Sample
error.logwith realistic stack traces - Pre-written
.copilot.mdfiles tested and working -
copilotCLI authenticated and rate limits checked - Backup: Screen recordings of each demo
- Network: Stable connection, cellular backup
- Test all pipes 1 hour before talk
---
model: claude-sonnet-4
allow-tool:
- 'shell(git:*)'
- Read
silent: true
---
Review this code for bugs, security issues, and performance concerns.
Prioritize findings by severity.
Format as markdown with headers: ## Critical, ## Warning, ## Info---
model: claude-haiku-4.5
silent: true
---
Classify this task as SIMPLE or COMPLEX.
Respond with ONLY one word.#!/bin/bash
# Demonstrates intelligent model selection
TASK="$1"
COMPLEXITY=$(echo "$TASK" | ma triage.copilot.md)
if [ "$COMPLEXITY" = "COMPLEX" ]; then
echo "Escalating to Opus..."
copilot -p "$TASK" -s --model claude-opus-4.5
else
echo "Handling with Haiku..."
copilot -p "$TASK" -s --model claude-haiku-4.5
fi"Data in. Intelligence out. The pipe operator now carries cognition."
"Silent mode strips everything but the answer. That's what makes it composable."
"Use the fast model to decide if you need the powerful model."
"The pipe doesn't grant permissions. You do, explicitly, with flags."
"Your shell just learned to understand."
Microsoft AI Dev Days - Technical Deep-Dive "Scripting Copilot: Piping Hot Intelligence" Duration: 15-20 minutes