Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created December 7, 2025 20:16
Show Gist options
  • Select an option

  • Save johnlindquist/4034094b4d1c154c7abcb876b76f8900 to your computer and use it in GitHub Desktop.

Select an option

Save johnlindquist/4034094b4d1c154c7abcb876b76f8900 to your computer and use it in GitHub Desktop.
Microsoft AI Dev Days Talk: Scripting Copilot - Piping Hot Intelligence (Old Way vs New Way)

Scripting Copilot: Piping Hot Intelligence

Microsoft AI Dev Days Talk (15-20 min)

ANGLE: Old Way vs New Way Contrast


The Premise

Every demo follows the same rhythm:

  1. Show the PAINFUL old approach
  2. Pause. Let them feel it.
  3. Reveal the elegant new approach
  4. Make the contrast STARK

ACT 1: THE HOOK (1-2 minutes)

Opening: The Markdown That Runs

Terminal, large font:

$ ma task.copilot.md

Pause. Let it land.

"That markdown file just launched an AI agent. But here's the thing - I'm not here to talk about markdown files. I'm here to talk about pipes."

Reveal the real hook:

$ git diff | copilot -p "review this" -s

"Data goes in. Intelligence comes out. The pipe - that fifty-year-old operator - now carries something new."

Transition:

"Let me show you what I mean by contrasting the old way with the new way. The difference will become obvious."


ACT 2: MAIN CONTENT (12-15 minutes)

Section 2.1: The Fundamental Shift (2 min)

The Equation That Changed:

Old Way New Way
Software = Code + Data Software = Instructions + Tools

Visual: Side-by-side terminal windows

"For 50 years, we wrote code to manipulate data. Now we write instructions that leverage tools. Same inputs. Radically different outputs."


Section 2.2: Copilot CLI Deep Dive (8-10 min)


CONTRAST 1: Invoking AI

OLD WAY - Interactive Mode:

# Launch Copilot interactively
$ copilot

# Wait for prompt...
# Type your question...
# Get response with spinners and formatting...
# Can't pipe this anywhere
# Can't script this at all

Problems:

  • Requires human at keyboard
  • Can't automate
  • Can't compose
  • One-off interactions

NEW WAY - Non-Interactive Mode:

# The -p flag: prompt directly
$ copilot -p "explain this error"

# The -s flag: silent mode (pure output)
$ copilot -p "explain this error" -s

Why -s changes everything:

"Silent mode strips the spinners, the formatting, the decorations. What's left is pure text. And pure text... can be piped."


CONTRAST 2: Code Review

OLD WAY - Manual Review:

# Step 1: Generate diff
$ git diff > changes.txt

# Step 2: Open in editor, read line by line
$ vim changes.txt

# Step 3: Take mental notes or write comments
# Step 4: Switch context to PR interface
# Step 5: Type out review comments manually
# Step 6: Forget something, go back to diff

# Time: 20-30 minutes for moderate PR
# Mental load: HIGH

NEW WAY - Piped Intelligence:

$ git diff | copilot -p "review for bugs, security, and performance" -s

Even better - the chain:

$ git diff | \
    copilot -p "list changes as bullets" -s | \
    copilot -p "rate each: low/medium/high risk" -s | \
    copilot -p "format as PR review comment" -s

The pattern:

raw diff → summarize → evaluate → format

"Three AI calls. One pipeline. Each stage refines the output. Same keyboard time as one grep command."


CONTRAST 3: Model Selection

OLD WAY - One Size Fits All:

# Same model for everything
# Complex architectural question? Same model.
# Quick "yes or no" question? Same model.
# Same cost. Same latency. No optimization.

NEW WAY - The --model Flag:

Model Speed Cost Use Case
claude-haiku-4.5 5x faster 10x cheaper Triage, classification, simple tasks
claude-sonnet-4 Balanced Balanced Daily coding tasks
claude-opus-4.5 Deliberate Premium Deep analysis, architecture

The Escalation Pattern:

# Step 1: Haiku classifies (fast, cheap)
COMPLEXITY=$(echo "$TASK" | copilot -p "SIMPLE or COMPLEX? One word only." -s --model claude-haiku-4.5)

# Step 2: Route to appropriate model
if [ "$COMPLEXITY" = "COMPLEX" ]; then
  copilot -p "$TASK" -s --model claude-opus-4.5
else
  copilot -p "$TASK" -s --model claude-haiku-4.5
fi

"Use the cheap model to decide if you need the expensive model. Your bill will thank you."


CONTRAST 4: Permission Boundaries

OLD WAY - All or Nothing:

# Interactive mode: AI asks for permission each time
# Breaks automation
# Or: Trust completely (risky!)

NEW WAY - Declarative Boundaries:

# Read-only intelligence (safest)
$ copilot -p "analyze this codebase" -s \
    --allow-tool 'shell(git:*)' \
    --allow-tool 'Read'

# Scoped write access
$ copilot -p "fix linting errors" -s \
    --allow-tool 'shell(npm:lint*)' \
    --allow-tool 'Write'

# Full autonomy (use with supervision)
$ copilot -p "refactor auth module" -s \
    --allow-all-tools

The Trust Ladder:

Level 1: Pure pipes           cat code | copilot -p "find bugs" -s
Level 2: Read-only tools      --allow-tool 'Read' --allow-tool 'shell(git:*)'
Level 3: Scoped write         --allow-tool 'shell(npm:*)'
Level 4: Full autonomy        --allow-all-tools (supervised)

"The pipe doesn't grant permissions. You do. The trust ladder is in your hands."


DEMO: The Complete Pipeline

OLD WAY - Shell Script Hell:

#!/bin/bash
# review.sh - 50 lines of parsing, formatting, error handling

# Extract changed files
FILES=$(git diff --name-only HEAD~1)

# Loop through each file
for FILE in $FILES; do
  # Get file extension
  EXT="${FILE##*.}"

  # Different rules for different file types
  case $EXT in
    js|ts) npm run lint $FILE ;;
    py) pylint $FILE ;;
    *) echo "Unknown type" ;;
  esac
done

# Parse outputs, format report, handle errors...
# Another 40 lines of bash gymnastics

NEW WAY - Intelligence Pipeline:

#!/bin/bash
# review.sh - 4 lines

git diff | \
  copilot -p "List all changes with file:line format" -s | \
  copilot -p "For each: identify bug risk, perf impact, security concern" -s | \
  copilot -p "Format as markdown table sorted by risk level" -s > review.md

"The intelligence IS the script. The pipe IS the orchestration."


Section 2.3: Advanced Patterns (2-3 min)

Pattern: Debug Pipeline

OLD WAY:

# Run tests, get cryptic failure
# Copy error message
# Google it
# Read Stack Overflow
# Try suggestion
# Fail. Repeat.

NEW WAY:

npm test 2>&1 | \
  copilot -p "Extract failing test output only" -s | \
  copilot -p "Identify root cause" -s --model claude-sonnet-4 | \
  copilot -p "Generate fix with explanation" -s --model claude-opus-4.5

Pattern: Documentation Pipeline

OLD WAY:

# Open each file
# Read code
# Write JSDoc manually
# Repeat 50 times
# Miss half of them
# Inconsistent formatting

NEW WAY:

find src -name "*.ts" -exec cat {} \; | \
  copilot -p "Extract all exports" -s | \
  copilot -p "Generate JSDoc for each" -s | \
  copilot -p "Format as API reference" -s > docs/api.md

ACT 3: THE RESOLUTION (3-4 minutes)

The Problem Remains

"This is powerful. But be honest - will you remember all these flags tomorrow? Will your team use the same patterns?"

Pain points:

  • Complex flag combinations to memorize
  • Project-specific configurations scattered
  • Same pipelines typed repeatedly
  • Sharing patterns via Slack (yikes)

The Reveal: markdown-agent

The solution: Your pipelines become files.

$ ma review.copilot.md

Breakdown:

  • review = your workflow name
  • .copilot = executes with copilot command
  • .md = it's just markdown (version it!)

The file:

---
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.

Usage:

# Pipe data into your recipe
git diff | ma review.copilot.md

The Full Pattern: Variables and Imports

---
model: claude-sonnet-4
args:
  - base_branch
  - focus_area
---

## Gather the Context
!`git diff {{ base_branch | default: "main" }}..HEAD`

## Review 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 any

## Output Format
A PR description with summary and risk table.

Run with arguments:

ma pr-review.copilot.md --base_branch develop --focus_area security

Final Contrast

OLD WAY NEW WAY
Learn tools Write instructions
Memorize flags Describe intent
Write scripts Author markdown
Maintain bash Version prompts
Share via Slack Commit to git

The equation holds:

Software = Instructions + Tools
Your prompts = Your codebase

CLOSING (1 minute)

Call to Action

Start today:

  1. First pipe: copilot -p "your question" -s
  2. Add intelligence: git diff | copilot -p "review" -s
  3. Save the pattern: Create one .copilot.md file for something you do daily
  4. Share with team: Commit it. They'll thank you.

Resources

  • GitHub Copilot CLI: gh copilot
  • markdown-agent: github.com/johnlindquist/agents
  • This talk: [gist link]

Final Thought

"The pipe carried data for 50 years. Now it carries intelligence. Same operator. Radically different output. Start piping."


TIMING GUIDE

Section Time Cumulative
Hook: ma task.copilot.md + git diff demo 2 min 2 min
The Fundamental Shift 2 min 4 min
Contrast 1: Interactive vs Non-Interactive 2 min 6 min
Contrast 2: Manual Review vs Piped 2 min 8 min
Contrast 3: One Model vs Escalation 2 min 10 min
Contrast 4: All-or-Nothing vs Boundaries 2 min 12 min
Complete Pipeline Demo 2 min 14 min
Advanced Patterns 2 min 16 min
Resolution: markdown-agent reveal 3 min 19 min
Closing 1 min 20 min

KEY TAKEAWAYS

  1. -s is the key - Silent mode makes output pipeable
  2. Pipes carry intelligence - Same |, new power
  3. Chain AI calls - copilot | copilot | copilot is valid
  4. Pick your model - Haiku (fast/cheap) routes to Opus (deep)
  5. Declare boundaries - --allow-tool controls permissions
  6. Files capture patterns - Markdown becomes your executable spec

QUOTABLE MOMENTS

"For 50 years, we wrote code to manipulate data. Now we write instructions that leverage tools."

"Silent mode strips the decorations. What's left is pure text. And pure text can be piped."

"Three AI calls. One pipeline. Same keyboard time as one grep command."

"Use the cheap model to decide if you need the expensive model."

"The pipe doesn't grant permissions. You do."

"The intelligence IS the script. The pipe IS the orchestration."

"The pipe carried data for 50 years. Now it carries intelligence. Same operator. Radically different output."


DEMO CHECKLIST

  • Terminal with large font (24pt minimum)
  • Git repo with staged changes for git diff demos
  • Sample error.log with parseable errors
  • Pre-written .copilot.md agent files
  • Test all pipes before talk
  • Backup: screenshot/video of each demo
  • Verify copilot CLI is installed and authenticated
  • Split-screen setup for Old vs New comparisons

DEMO FILES

review.copilot.md

---
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.

triage.copilot.md

---
model: claude-haiku-4.5
silent: true
args:
  - task
---
Classify this task as SIMPLE, MODERATE, or COMPLEX.
Respond with ONLY one word.

Task: {{ task }}

pr-review.copilot.md

---
model: claude-sonnet-4
silent: true
args:
  - base
---
Generate a PR description from these changes:

!`git diff {{ base | default: "main" }}..HEAD`

## Summary
[2-3 sentences]

## Changes
[Bullet list]

## Risk Assessment
[low/medium/high with explanation]

Talk outline for Microsoft AI Dev Days Theme: Old Way vs New Way - Piping Hot Intelligence Duration: 15-20 minutes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment