From 92099139004e80c81f804aef10fe2deece98ede6 Mon Sep 17 00:00:00 2001 From: tommasodotnet Date: Thu, 28 May 2026 22:49:38 +0200 Subject: [PATCH 01/22] Add Reveal.js token optimization workshop deck Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- slides/index.html | 1793 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1793 insertions(+) create mode 100644 slides/index.html diff --git a/slides/index.html b/slides/index.html new file mode 100644 index 0000000..25c186e --- /dev/null +++ b/slides/index.html @@ -0,0 +1,1793 @@ + + + + + + GitHub Copilot Token Optimization - 8 Hour Workshop + + + + + +
+
+
+

8 hour customer workshop

+

GitHub Copilot Token Optimization

+

Spend fewer tokens. Keep quality. Build enterprise guardrails.

+

Reveal.js deck generated from repository guide content.

+ +
+ +
+

Workshop outcome

+
+
+

Explain cost

+

Input, output, cached tokens, agent loops, MCP schemas, model routing.

+
+
+

Change behavior

+

Prompt compression, output control, context hygiene, Ask/Edit/Agent routing.

+
+
+

Ship rollout plan

+

Enterprise budgets, model policy, instruction scope, monthly review loop.

+
+
+
+ +
+

Important framing

+
+ This deck is based on field guidance in this repo. It is not official GitHub or Microsoft guidance. +
+

Use docs.github.com/copilot for supported feature behavior, billing controls, and admin policy.

+
+ +
+

8 hour agenda

+ + + + + + + + + + + + + + +
TimeBlockOutput
00:00-00:30Why tokens matter + fast winsShared cost model
00:30-02:00Prompt, language, output labsTerse prompt templates
02:00-03:15Context + always-on filesInstruction pruning diff
03:15-04:15Workflow + modesMode routing cheat sheet
04:15-05:15MCP/tool costs + dataMCP audit list
05:15-06:15Practical setupRepo setup checklist
06:15-07:30Model/pricing + governanceCustomer admin rollout
07:30-08:00Capstone30 day token plan
+
+ +
+

Navigation

+

Horizontal = chapters. Vertical = chapter slides + labs.

+

Press Esc for overview. Press S for speaker notes.

+
+ +
+
+

Quick Start

+

11 things to do right now

+

Start with output, then shrink structural input, then route models and tools.

+
+ +
+

Fastest wins

+
    +
  1. Code-only responses: highest per-token ROI.
  2. +
  3. Constrain format: bullets, one sentence, JSON, tables.
  4. +
  5. Shrink always-on context: instructions and agent files.
  6. +
  7. Use Auto by default: pin premium only when justified.
  8. +
  9. Use Ask Mode for simple questions.
  10. +
+
+ +
+

More fast wins

+
    +
  1. Scope context with applyTo.
  2. +
  3. Write precise prompts: target file, function, done condition.
  4. +
  5. Retune prompts to target model.
  6. +
  7. Audit MCP servers.
  8. +
  9. Run /chronicle improve in Copilot CLI.
  10. +
  11. Try CodeAct for long CLI tool chains.
  12. +
+
+ +
+

The priority stack

+
+
+

Output first

+

Verbose answers are expensive. One default instruction changes every response.

+
+
+

Always-on second

+

Instruction files and tool schemas load repeatedly. Small baselines compound.

+
+
+

Mode third

+

Ask for questions. Edit for single-file changes. Agent for multi-step work.

+
+
+

Governance fourth

+

Budgets cap spend. Model policy limits expensive lanes.

+
+
+
+ +
+

Lab 0: baseline your habits

+
+

Goal

+

Identify your top 3 token leaks before learning techniques.

+

Do: mark each as green/yellow/red: output verbosity, instruction size, open tabs, Agent use, MCP count, model pinning, long chat history.

+

Deliverable: personal baseline + one "fix today" action.

+

Time: 10 minutes.

+
+
+
+ +
+
+

Part 1

+

Why tokens matter

+

Tokens drive cost, speed, limits, and context capacity.

+
+ +
+

Tokens are subwords

+
+
+

BPE behavior

+
    +
  • Common words can be one token.
  • +
  • Rare words split into pieces.
  • +
  • Punctuation and filler still count.
  • +
+
+
+

Core insight

+

Sure, I'd be happy to help! can burn around 10 tokens of zero technical value.

+
+
+
+ +
+

Cost model

+ + + + + + + +
BucketWhat it containsLever
InputPrompt, context, files, history, toolsScope and compress
CachedStable reused prefixesKeep stable context stable
OutputModel responseCode-only, concise format
+

Output tokens usually cost materially more than input tokens in vendor pricing examples.

+
+ +
+

Input is bigger than your prompt

+
Context window
+├─ System prompt
+├─ copilot-instructions.md / AGENTS.md
+├─ File context and open tabs
+├─ Conversation history
+├─ MCP tool schemas
+└─ Your typed prompt
+

Your 20-word prompt can ride inside thousands of hidden tokens.

+
+ +
+

Coding Agent multiplier

+

One issue-to-PR run is not one request.

+
+
+

Agent steps

+

Plan, search, read files, edit, run tests, inspect failures, retry.

+
+
+

Compounding

+

Every step reloads baseline context and adds previous tool results.

+
+
+
+ +
+

Lab 1: token anatomy

+
+

Goal

+

Separate visible prompt from hidden context.

+

Do: choose one recent Copilot task. List likely context sources: open files, referenced files, instructions, history, tools, output.

+

Discuss: which source was most controllable?

+

Time: 15 minutes.

+
+
+
+ +
+
+

Part 2.1

+

Prompt compression

+

Say same thing in fewer tokens. Preserve technical precision.

+
+ +
+

Caveman pattern

+
+
+

Drop

+

Articles, filler, pleasantries, hedging, softeners.

+
+
+

Keep

+

Technical terms, code, filenames, constraints, exact done condition.

+
+
+

[thing] [action] [reason]. [next step].

+
+ +
+

Before vs after

+ + + + + + + + + + + + +
VerboseCaveman
Could you please review this pull request and let me know if there are any issues?Review PR. Flag issues.
Can you explain what this error message means and how I should fix it?Explain error. How fix.
+
+ +
+

Compression levels

+ + + + + + + +
LevelStyleUse when
LiteProfessional but tightClient-facing, onboarding
FullFragments, no fluffDaily developer prompts
UltraAbbrev, arrows, terseHigh-volume, known domain
+
+ +
+

Structured beats prose

+
POST /api/users
+Validate:
+- name: string, required
+- email: string, required, valid
+400 on validation fail
+201 on success, return created user
+Save to DB
+

Bullets and key-value pairs force clarity and reduce filler.

+
+ +
+

Code-centric prompting

+
+
+

Natural language

+

Create a function that takes numbers, filters negative values, doubles remaining values, returns sum.

+
+
+

Code-centric

+

fn(nums) -> filter(>0) -> map(*2) -> sum

+

Like getUserById but for emails. 404 if missing.

+
+
+
+ +
+

Guardrails as invariants

+ + + + + + +
Verbose procedureCompressed invariant
Make sure every SQL query parameterizes values...SQL: parameterized queries only. No concatenation.
Please write tests for any new code...New code -> tests. Cover happy + error.
+
+ +
+

Lab 2: prompt compression ladder

+
+

Goal

+

Rewrite one real prompt three ways: lite, full, ultra.

+

Do: preserve file names, line numbers, constraints, done condition. Drop only fluff.

+

Compare: which version is shortest without adding ambiguity?

+

Time: 20 minutes.

+
+
+ +
+

Lab 3: prompt A/B

+
+

Try this vs that

+
A: Could you take a look at auth and improve error handling?
+
+B: File: src/auth/login.ts.
+Bug: null user causes .email crash.
+Fix: null guard before .email.
+Test: add null-user case.
+Done: targeted test passes.
+

Run: ask Copilot with A, then B. Compare file reads, clarifications, output length.

+
+
+
+ +
+
+

Part 2.2

+

Language comparison

+

English is usually most token-efficient for prompts.

+
+ +
+

CJK assumption fails

+ + + + + + + + + +
LanguageSentenceTokensvs English
EnglishI met a huge dog51.0x
SpanishConoci a un perro enorme81.6x
ChineseChinese equivalent112.2x
JapaneseJapanese equivalent112.2x
RussianRussian equivalent142.8x
+
+ +
+

Why

+
    +
  • BPE tokenizers are trained heavily on English.
  • +
  • Common English words often get one token.
  • +
  • CJK text has fewer characters, but more tokens per character.
  • +
  • Non-Latin scripts often cost more; transliteration can help.
  • +
+
+ +
+

Practical rule

+
+ Use terse English for prompts and instructions. Do not translate to CJK to save tokens. +
+

If a user writes better in native language, quality can outweigh token cost. For optimization, English wins.

+
+ +
+

Lab 4: tokenizer reality check

+
+

Goal

+

Disprove or confirm language assumptions with actual token counts.

+

Do: pick one prompt. Translate to your strongest non-English language. Compare token counts in tokenizer tool.

+

Deliverable: team language guidance: when English is required, when native language is OK.

+

Time: 20 minutes.

+
+
+
+ +
+
+

Part 2.3

+

Context management

+

Control what gets sent. Biggest input wins are structural.

+
+ +
+

Always-on files cost every turn

+

.github/copilot-instructions.md, AGENTS.md, CLAUDE.md, and similar files can become persistent context.

+

Duplicate content can be paid twice when multiple files are loaded by different tools.

+
+ +
+

Instruction compression example

+
Terse like caveman. Technical substance exact. Only fluff die.
+Drop: articles, filler (just/really/basically), pleasantries, hedging.
+Fragments OK. Short synonyms. Code unchanged.
+Pattern: [thing] [action] [reason]. [next step].
+

Around 50 tokens. Loaded on every interaction.

+
+ +
+

Context hygiene

+
    +
  • Close files not relevant to current task.
  • +
  • Keep files focused and small.
  • +
  • Ignore build output, vendor dirs, generated files.
  • +
  • Use Content Exclusion for sensitive paths in Business/Enterprise.
  • +
  • Start fresh conversations after topic changes.
  • +
+
+ +
+

Use scoped instructions

+
---
+applyTo: "src/api/**/*.ts"
+---
+API conventions:
+- Routes in src/api/routes/. Handlers thin, logic in services/.
+- Validate with zod.
+- Errors via Result<T,E>, never throw.
+

Pay path-specific guidance only when relevant files are in scope.

+
+ +
+

Always-on vs conditional vs on-demand

+ + + + + + + +
ScopeUse forToken posture
Always-onUniversal rulesKeep tiny
ConditionalPath/layer rulesapplyTo
On-demandReview checklists, release notesLoad only when invoked
+
+ +
+

Cache-friendly behavior

+
    +
  • Keep stable context at the top.
  • +
  • Do not churn instruction files constantly.
  • +
  • Reuse saved snippets instead of re-pasting large context.
  • +
  • Summarize and restart when history gets stale.
  • +
+
+ +
+

Enterprise note: Content Exclusion

+
+

Customer-side action

+

Configure Content Exclusion for sensitive files, generated bundles, large data files, and regulated paths.

+

Important: treat this as privacy/policy control first, token-saving side effect second. Check current surface support in official docs.

+
+
+ +
+

Lab 5: context audit

+
+

Goal

+

Find always-on context that should become scoped or on-demand.

+

Do: inspect repo instructions, AGENTS/CLAUDE files, open tabs, generated files, MCP config.

+

Deliverable: three-column list: keep always-on, move to applyTo, move on-demand/delete.

+

Time: 30 minutes.

+
+
+
+ +
+
+

Part 2.4

+

Output control

+

Tell model what not to say. Highest per-token ROI.

+
+ +
+

Default line

+
Code only, no explanation.
+

Best for generation tasks when team already understands desired change.

+
+ +
+

Format constraints

+ + + + + + + + + +
InstructionUse when
Answer in one sentenceQuick decision or explanation
3 bullets maxScan-friendly summary
Reply as JSONMachine-readable extraction
Yes/no, then one line whyReview gate
Diff onlyPatch inspection
+
+ +
+

Project default

+
Be concise. No explanations unless asked.
+Code only for generation tasks.
+Bullets over paragraphs.
+

Override when learning, debugging, or teaching: ask for explanation explicitly.

+
+ +
+

Lab 6: output A/B

+
+

Try this vs that

+
A: Add input validation to processOrder().
+
+B: Add input validation to processOrder().
+Code only. No explanation. Minimal diff.
+

Measure: response length, explanation tokens, diff usefulness.

+

Time: 15 minutes.

+
+
+ +
+

Lab 7: format forcing

+
+

Goal

+

Practice asking for bounded output.

+

Prompts: "3 bullets max", "table only", "JSON only", "one-line verdict + risk".

+

Deliverable: team snippet library for common Copilot outputs.

+
+
+
+ +
+
+

Part 2.5

+

Workflow optimization

+

Use cheaper interaction shapes before optimizing words.

+
+ +
+

Commit and PR text matter

+
+
+

Commit

+

feat: add password reset via settings page

+

Body only when "why" is not obvious.

+
+
+

Review

+

L42: bug: user can be null. Add guard before .email.

+

One-line, actionable, severity-coded.

+
+
+
+ +
+

Ask vs Edit vs Agent

+ + + + + + + + + +
TaskModeReason
What does function do?AskOne call
Syntax questionAskNo tools
Single-file tweakEditTargeted
Multi-file refactorAgentNeeds tools
Issue-to-PRCoding AgentAutonomous workflow
+
+ +
+

Auto model default

+

Auto is a good baseline: supported Auto pool, org policy-aware, discount on eligible paid-plan Chat usage per docs.

+

Auto does not mean "escalate into every premium model." Pin premium deliberately.

+
+ +
+

Retune prompts when model changes

+
Target model: GPT-5.5.
+Guide: <official prompting guide URL>
+Files: .github/copilot-instructions.md, .github/instructions/*.md
+Adapt prompts to guide. Preserve behavior. Reduce rework.
+Show diff only.
+
+ +
+

When not to compress

+
    +
  • Security warnings.
  • +
  • Irreversible operations.
  • +
  • Onboarding and teaching.
  • +
  • Regulatory/compliance language.
  • +
  • Complex instructions where fragments add ambiguity.
  • +
+
+ +
+

Close loop with usage coaching

+
+
+

/chronicle

+

Copilot CLI session history. Use /chronicle improve for recurring confusion.

+
+
+

AI Engineering Coach

+

VS Code local extension. Finds anti-patterns, context health, skill opportunities.

+
+
+
+ +
+

Lab 8: mode routing drill

+
+

Goal

+

Stop using Agent Mode for one-shot work.

+

Do: classify 20 sample tasks as Ask/Edit/Agent/Coding Agent. Defend choice.

+

Deliverable: team mode-routing cheat sheet.

+

Time: 20 minutes.

+
+
+ +
+

Lab 9: model routing drill

+
+

Goal

+

Prevent expensive-model pinning by default.

+

Do: map tasks to Auto, included/lower-cost, standard, premium. Include reasoning-effort choice if available.

+

Deliverable: model escalation rules.

+
+
+
+ +
+
+

Part 2.6

+

Always-on context problem

+

More context can make agents worse and cost more.

+
+ +
+

Research signal

+ + + + + + + + +
FindingObserved impact
LLM-generated context filesHurt in 5/8 settings
Average correctnessDown about 2%
Token costUp 20-23%
Reasoning overheadUp about 22% in cited setup
+
+ +
+

Why context hurts

+
+

Redundancy tax

Repeats facts agent can discover.

+

Attention tax

Important rules get lost in middle.

+

Anchoring trap

Outdated tool guidance over-influences agent.

+

Signal/noise

Routine facts dilute landmines.

+
+
+ +
+

Keep landmines only

+ + + + + + + + +
KeepDelete
Use uv instead of pipThis is a Python project
DB migrations must run in orderWe use PostgreSQL
Do not refactor auth module; audit pendingWe use JWT auth
Deploy requires VPNMain branch protected
+
+ +
+

Bug tracker model

+
Start almost empty.
+Agent trips on something -> add one line.
+Root cause fixed -> delete that line.
+

Instruction files should grow and shrink, not accumulate like a wiki.

+
+ +
+

Lab 10: landmine pruning

+
+

Goal

+

Cut context without losing correctness.

+

Do: mark each instruction as discoverable, style, landmine, stale, duplicate. Delete or scope everything except true always-on landmines.

+

Deliverable: 10-line max instruction file draft.

+

Time: 35 minutes.

+
+
+
+ +
+
+

Part 2.7

+

MCP and tool costs

+

Tool schemas are hidden token tax.

+
+ +
+

Measure first

+
/context
+
+System/Tools: MCPs + instructions + system prompt
+Messages: conversation history
+Free Space: remaining context
+

In VS Code, estimate active MCP servers x tools x about 200 tokens/tool.

+
+ +
+

Every tool costs tokens

+ + + + + + + + +
ComponentApprox cost
Name + description20-50 tokens
Simple parameter schema30-80 tokens
Complex parameter schema100-300 tokens
Total per tool100-500 tokens
+
+ +
+

Multiplication problem

+
10 MCP servers
+x 5 tools each
+x 200 tokens/tool
+= 10,000 tokens per step
+
+15 agent steps = 150,000 schema tokens
+
+ +
+

Audit rule

+
    +
  • Disable servers not needed now.
  • +
  • Use per-workspace config, not global everything.
  • +
  • Prefer built-in tools over duplicate filesystem MCPs.
  • +
  • Use skills for occasional capabilities.
  • +
  • Scope large plugins by namespace/mode when supported.
  • +
+
+ +
+

Tool output compression

+
+

RTK

+

CLI proxy filters noisy shell output before agent reads it: tests, git diff, grep, logs, file listings.

+
rtk init --copilot
+
+
+ +
+

Azure MCP case pattern

+

One large plugin can dominate System/Tools budget.

+
--namespace appservice --namespace cosmos --namespace keyvault --namespace storage
+

Scope by service/persona. Avoid "all tools" mode unless truly needed.

+
+ +
+

Lab 11: MCP audit

+
+

Goal

+

Remove hidden schema overhead.

+

Do: inventory enabled MCP servers, tool counts, global vs workspace scope, owner, frequency of use.

+

Deliverable: keep/disable/scope table + restart plan.

+

Time: 30 minutes.

+
+
+ +
+

Enterprise lab: tool policy

+
+

Customer-side action

+

Define approved MCP servers by persona: developer, data, platform, security, support.

+

Deliverable: default MCP profile per team + exception process for large plugins.

+
+
+
+ +
+
+

Part 3

+

Comparisons and data

+

Use evidence to pick habits with best impact-to-effort.

+
+ +
+

Same task, different cost

+ + + + + + + + +
TechniquePromptTokens
VerbosePlease add comprehensive error handling...~40
Caveman liteAdd error handling. Cover null, types, network.~16
Caveman fullError handling. Cover: null, bad type, net error.~12
UltraError handling: null/bad-type/net-err.~7
+
+ +
+

Big winners

+
    +
  1. Caveman-speak + precise prompts.
  2. +
  3. Code-only / constrained output.
  4. +
  5. Shrink always-on context.
  6. +
  7. Ask Mode for simple questions.
  8. +
  9. Audit MCP servers.
  10. +
  11. Retune prompts after model changes.
  12. +
+
+ +
+

Quality curve

+
Savings:  lite ---- full ---- ultra ---- extreme
+Risk:     low  ---- low  ---- medium --- high
+

Sweet spot: full caveman. Maximum return, negligible risk for technical users.

+
+ +
+

Lab 12: prioritize techniques

+
+

Goal

+

Pick changes by impact, effort, risk.

+

Do: rate each technique 1-5 for impact, effort, adoption friction, governance need.

+

Deliverable: team top 5 and "do not adopt" list.

+

Time: 25 minutes.

+
+
+
+ +
+
+

Part 4

+

Practical setup

+

Turn techniques into repo and team defaults.

+
+ +
+

Repo setup steps

+
    +
  1. Create compressed .github/copilot-instructions.md.
  2. +
  3. Add compressed project-specific rules.
  4. +
  5. Split path-specific guidance with applyTo.
  6. +
  7. Use Auto by default; pin only with reason.
  8. +
  9. Add copilot-setup-steps.yml for Coding Agent.
  10. +
+
+ +
+

Starter instruction template

+
Terse like caveman. Technical substance exact. Only fluff die.
+Drop: articles, filler, pleasantries, hedging.
+Fragments OK. Short synonyms. Code unchanged.
+Code only for generation tasks. No explanation unless asked.
+Minimize tool calls. Batch related reads/edits.
+
+ +
+

Coding Agent setup

+
# .github/copilot-setup-steps.yml
+steps:
+  - name: Install dependencies
+    run: npm ci
+  - name: Build
+    run: npm run build
+

Prevents discovery by trial and error. Saves agent steps.

+
+ +
+

Precise issue template

+
Bug: login fails when email contains "+".
+File: src/auth/login.ts, validateEmail() L42.
+Fix: URL-encode email before OAuth provider call.
+Test: add user+tag@example.com case.
+Done: targeted test passes.
+
+ +
+

Build habit over 4 weeks

+ + + + + + + + +
WeekHabit
1Compressed instructions + Ask Mode for questions
2Caveman-lite prompts
3Caveman-full + structured formats
4Code-only defaults + reusable snippets outside always-on context
+
+ +
+

Agent mode controls

+
{
+  "chat.agent.maxRequests": 10,
+  "github.copilot.chat.agent.model": "auto"
+}
+

Cap runaway sessions carefully. Increase only when task requires it.

+
+ +
+

Lab 13: repo implementation

+
+

Goal

+

Create a repo-ready token optimization PR draft.

+

Do: draft copilot-instructions.md, one scoped instruction file, one Coding Agent setup step, one issue template snippet.

+

Deliverable: branch or patch proposal.

+

Time: 45 minutes.

+
+
+
+ +
+
+

Part 4.2

+

Model selection and pricing

+

Separate Copilot docs, UBB framing, and vendor token pricing.

+
+ +
+

Three pricing views

+ + + + + + + +
ViewAnswers
GitHub Copilot docsPlan availability, model access, Auto behavior, published signals
UBB framingAI-credit budgets and governance after cutover
Vendor API pricingInput vs output intuition, not Copilot billing table
+
+ +
+

Auto: practical meaning

+
    +
  • Chooses from supported Auto pool.
  • +
  • Subject to plan and org policy.
  • +
  • Based on health and performance.
  • +
  • Discounted on eligible paid-plan Chat usage.
  • +
  • Does not automatically escalate to every premium model.
  • +
+
+ +
+

Reasoning effort

+ + + + + + + +
EffortUse for
LowHigh-volume simple chat/classification
MediumTypical coding and tool-heavy work where supported
High/maxArchitecture, security, novel decomposition
+

Use only on models that expose this control.

+
+ +
+

Anti-patterns

+
    +
  • Leaving premium model pinned all day.
  • +
  • Assuming Auto jumps to premium when task gets hard.
  • +
  • Equating vendor API pricing with Copilot billing.
  • +
  • Enabling every premium model for whole org first.
  • +
  • Ignoring plan/model availability.
  • +
+
+ +
+

Lab 14: model escalation policy

+
+

Customer-side action

+

Define when users may pin premium models and when Auto is required.

+

Do: map workflows to default model lane, escalation trigger, expected value, rollback signal.

+

Deliverable: one-page model policy draft.

+

Time: 30 minutes.

+
+
+
+ +
+
+

Part 4.3

+

Enterprise governance

+

Admin controls cap spend. Prompt habits improve efficiency.

+
+ +
+

Spend levers

+
    +
  1. Budget ceilings.
  2. +
  3. User-level AI-credit budgets.
  4. +
  5. Model availability policy.
  6. +
+

Prompt compression does not cap spend. It reduces waste inside allowed usage.

+
+ +
+

Set budgets first

+
+

Customer-side action

+

Set enterprise/org/cost-center budgets. Enable alerts early. Enable stop-usage after reporting is trusted. Review monthly.

+
+
+ +
+

User-level tightening

+
    +
  • Baseline users: low AI-credit budget.
  • +
  • Power users: higher budget with job need.
  • +
  • $0 budget: no usage-based features.
  • +
  • Review monthly and downgrade unused allocations.
  • +
+
+ +
+

Review models before enablement

+ + + + + + + + +
QuestionDecision
Which workflows need premium?Enable narrowly
Which teams create measurable value?Assign higher budgets
Which users can stay on Auto?Keep default path cheap
What rollback signal?Usage up, value flat
+
+ +
+

Instruction scope governance

+
    +
  • Org instructions: broad GitHub.com policy and review reminders.
  • +
  • Repo instructions: IDE workflow defaults and coding rules.
  • +
  • Path-specific instructions: local rules where context pays.
  • +
  • Do not assume org instructions apply everywhere; check docs.
  • +
+
+ +
+

Separate orgs: fallback only

+

Useful for different model policies or billing boundaries when org structure already matches groups.

+

Costs: admin overhead, license complexity, user sprawl, SCIM/cost-center constraints.

+
+ +
+

Measure right thing

+
    +
  1. Which teams exceed baseline?
  2. +
  3. Which users drive AI-credit usage?
  4. +
  5. Which models improve outcomes?
  6. +
  7. Which agent workflows spend without delivery value?
  8. +
+
+ +
+

June 1 cutover checklist

+
    +
  1. Move from request counters to AI-credit budgets.
  2. +
  3. Decide pooled vs user-level budgets.
  4. +
  5. Review model availability before premium becomes direct spend.
  6. +
  7. Remind teams completions/next edits stay outside AI-credit billing.
  8. +
  9. Watch long chat and agent workflows first.
  10. +
+
+ +
+

Lab 15: budget rollout

+
+

Customer-side action

+

Design budget rollout for one enterprise account.

+

Do: choose pilot org, cost center, baseline budget, alert threshold, stop-usage rule, user exceptions.

+

Deliverable: budget operating model.

+

Time: 35 minutes.

+
+
+ +
+

Lab 16: governance tabletop

+
+

Scenario

+

Agent sessions spike AI-credit usage 4x in one team. Delivery output unchanged.

+

Decide: budget action, model policy action, instruction/context action, MCP audit action, comms plan.

+

Time: 25 minutes.

+
+
+
+ +
+
+

Capstone

+

30 day token optimization plan

+

Turn workshop into customer rollout.

+
+ +
+

Week-by-week rollout

+ + + + + + + + +
WeekTeam actionAdmin action
1Output defaults + Ask ModeUsage baseline
2Instruction pruning + scoped rulesBudget pilot
3MCP audit + model routingModel access review
4Agent issue templates + setup stepsMonthly reporting cadence
+
+ +
+

Capstone lab

+
+

Goal

+

Create customer-specific action plan.

+

Sections: repo changes, user habits, MCP/tool policy, model policy, budgets, reporting, owner, due date.

+

Deliverable: 30 day plan ready for customer sponsor.

+

Time: 30 minutes.

+
+
+ +
+

Final checklist

+
+
+

Developer

+
    +
  • Code-only default
  • +
  • Ask/Edit/Agent routing
  • +
  • Concise prompts
  • +
  • Fresh sessions
  • +
+
+
+

Repository

+
    +
  • Tiny always-on instructions
  • +
  • Scoped applyTo files
  • +
  • Coding Agent setup steps
  • +
  • Precise issue templates
  • +
+
+
+

Platform

+
    +
  • MCP profiles
  • +
  • Content Exclusion
  • +
  • Model access policy
  • +
  • RTK/CLI tool output strategy
  • +
+
+
+

Enterprise

+
    +
  • Budgets
  • +
  • User-level caps
  • +
  • Usage reporting
  • +
  • Monthly review
  • +
+
+
+
+ +
+

Closing message

+
+ Cheap defaults first. Premium access by exception. Measurement before expansion. +
+
+
+
+
+ + + + + + + + From 05195bf5315ae9ffe4320e692756f06c106f22b2 Mon Sep 17 00:00:00 2001 From: Marco Olivo <8478776+olivomarco@users.noreply.github.com> Date: Mon, 1 Jun 2026 09:48:24 +0200 Subject: [PATCH 02/22] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- slides/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slides/index.html b/slides/index.html index 25c186e..079b477 100644 --- a/slides/index.html +++ b/slides/index.html @@ -4,8 +4,10 @@ GitHub Copilot Token Optimization - 8 Hour Workshop + + @@ -226,8 +247,9 @@

8 hour agenda

03:15-04:15Workflow + modesMode routing cheat sheet 04:15-05:15MCP/tool costs + dataMCP audit list 05:15-06:15Practical setupRepo setup checklist - 06:15-07:30Model/pricing + governanceCustomer admin rollout - 07:30-08:00Capstone30 day token plan + 06:15-07:10Model/pricing + governanceCustomer admin rollout + 07:10-07:40Outcome per tokenPlan/execute/verify loop + 07:40-08:00Capstone30 day token plan @@ -241,7 +263,7 @@

Navigation

Quick Start

-

11 things to do right now

+

14 things to do right now

Start with output, then shrink structural input, then route models and tools.

@@ -263,29 +285,42 @@

More fast wins

  • Write precise prompts: target file, function, done condition.
  • Retune prompts to target model.
  • Audit MCP servers.
  • +
  • Convert rich files to Markdown first.
  • + +
    + +
    +

    More fast wins, continued

    +
    1. Run /chronicle cost tips & /chronicle improve in Copilot CLI.
    2. +
    3. Use AI Engineering Coach for VS Code habit review.
    4. Try CodeAct for long CLI tool chains.
    5. +
    6. Build a Graphify map for repeated codebase navigation.

    The priority stack

    -
    +

    Output first

    -

    Verbose answers are expensive. One default instruction changes every response.

    +

    One default changes every response.

    Always-on second

    -

    Instruction files and tool schemas load repeatedly. Small baselines compound.

    +

    Small baselines compound.

    Mode third

    -

    Ask for questions. Edit for single-file changes. Agent for multi-step work.

    +

    Ask, Edit, Agent by task shape.

    Governance fourth

    -

    Budgets cap spend. Model policy limits expensive lanes.

    +

    Budgets and model policy cap spend.

    +
    +
    +

    Outcome fifth

    +

    Plan, route, verify, close.

    @@ -329,14 +364,7 @@

    Core insight

    Cost model

    - - - - - - - -
    BucketWhat it containsLever
    InputPrompt, context, files, history, toolsScope and compress
    CachedStable reused prefixesKeep stable context stable
    OutputModel responseCode-only, concise format
    + Token cost anatomy: input tokens include hidden context, output tokens are the visible answer, cached tokens reuse stable prefix.

    Output tokens usually cost materially more than input tokens in vendor pricing examples.

    @@ -384,6 +412,7 @@

    Goal

    Part 2.1

    Prompt compression

    Say same thing in fewer tokens. Preserve technical precision.

    + Prompt compression ladder from verbose to lite to full to ultra while preserving technical substance.
    @@ -593,24 +622,22 @@

    Use scoped instructions

    Always-on vs conditional vs on-demand

    - - - - - - - -
    ScopeUse forToken posture
    Always-onUniversal rulesKeep tiny
    ConditionalPath/layer rulesapplyTo
    On-demandReview checklists, release notesLoad only when invoked
    + Always-on context should be tiny; scoped instructions load by path; on-demand skills load when invoked. +
    + +
    +

    Normalize rich files first

    + Rich files carry format noise; MarkItDown converts them to clean Markdown before AI work.

    Cache-friendly behavior

    -
      -
    • Keep stable context at the top.
    • -
    • Do not churn instruction files constantly.
    • -
    • Reuse saved snippets instead of re-pasting large context.
    • -
    • Summarize and restart when history gets stale.
    • -
    + Stable thread reuses prefix; cache-busted thread switches model, tools, or agent and should start fresh with a handoff. +
    + +
    +

    Persistent graph navigation

    + Graphify builds graph.json once so agents can query the map instead of rereading broad file sets.
    @@ -718,16 +745,7 @@

    Review

    Ask vs Edit vs Agent

    - - - - - - - - - -
    TaskModeReason
    What does function do?AskOne call
    Syntax questionAskNo tools
    Single-file tweakEditTargeted
    Multi-file refactorAgentNeeds tools
    Issue-to-PRCoding AgentAutonomous workflow
    + Decision tree: use Ask for questions, Edit for targeted single-file changes, Agent for clear multi-file work, and clarify vague tasks first.
    @@ -770,6 +788,11 @@

    AI Engineering Coach

    +
    +

    Plan first, execute cheaply

    + Plan with strong model, save plan, execute in fresh cheaper session, then verify acceptance criteria. +
    +

    Lab 8: mode routing drill

    @@ -860,6 +883,7 @@

    Goal

    Part 2.7

    MCP and tool costs

    Tool schemas are hidden token tax.

    + Tooling stack: scope MCP schemas, use CodeAct for turn loops, RTK or snip for output, Graphify for orientation.
    @@ -908,11 +932,33 @@

    Audit rule

    Tool output compression

    -
    -

    RTK

    -

    CLI proxy filters noisy shell output before agent reads it: tests, git diff, grep, logs, file listings.

    -
    rtk init --copilot
    +
    +
    +

    RTK

    +

    Rust CLI proxy filters noisy shell output: tests, git diff, grep, logs, file listings.

    +
    rtk init --copilot
    +
    +
    +

    snip

    +

    YAML-extensible command filters with local savings stats and team-maintained rules.

    +
    snip init --agent copilot
    +
    +

    Pick one output filter layer per command path. Do not stack RTK and snip by default.

    +
    + +
    +

    One tool per layer

    + + + + + + + + + +
    LayerToolReduces
    Workflow turnsCodeActRepeated model-tool loops
    Command outputRTK or snipVerbose shell results
    Command choiceminimal-context-toolsBroad search/read behavior
    Codebase orientationGraphifyRepeated file rereads
    VisibilityChronicle / CoachWaste you would miss
    @@ -1063,6 +1109,22 @@

    Agent mode controls

    Cap runaway sessions carefully. Increase only when task requires it.

    +
    +

    Agent mode cost loop

    + Agent loop: load context, decide tool, ingest result, replay context, repeat. +
    + +
    +

    Session harness checklist

    +
    model
    +mode
    +agent/profile
    +active MCP/tools
    +output filter
    +repo instructions
    +

    Choose before the session starts. Stable harness = predictable cost and cache behavior.

    +
    +

    Lab 13: repo implementation

    @@ -1150,11 +1212,7 @@

    Enterprise governance

    Spend levers

    -
      -
    1. Budget ceilings.
    2. -
    3. User-level AI-credit budgets.
    4. -
    5. Model availability policy.
    6. -
    + Enterprise governance control plane connects budgets, user-level caps, model access, usage reports, cohorts, and policy review.

    Prompt compression does not cap spend. It reduces waste inside allowed usage.

    @@ -1248,6 +1306,98 @@

    Scenario

    +
    +
    +

    Part 4.4

    +

    Outcome per token

    +

    Optimize for accepted work, not the shortest prompt.

    +
    + +
    +

    The metric

    +
    + outcome per token = verified work completed / total tokens spent +
    +

    A short prompt that causes wrong-direction work is more expensive than a longer plan that lands correctly.

    +
    + +
    +

    Agentic cost research signal

    + + + + + + + + +
    FindingImplication
    Agentic coding can consume far more than chatDo not extrapolate simple-chat cost
    Same task can vary widely across runsUse budgets and stop rules
    More tokens do not guarantee accuracyOptimize loop quality
    Input dominates agentic costContext hygiene matters
    +
    + +
    +

    Outcome loop

    + Outcome-per-token loop: pick task shape, plan, route model, target context, verify evidence, close cleanly. +
    + +
    +

    Skills as practices

    + + + + + + + + + + +
    SkillToken effect
    BrainstormingPrevents early lock-in
    PlanningReduces guessing during execution
    GreennessAvoids debugging unknown baseline failures
    VerificationPrevents false completion
    Impeccable closePrevents review churn
    Branch-close disciplineStops stale context carryover
    +
    + +
    +

    Skill libraries: borrow patterns

    +
    +

    SDLC

    Superpowers, planning, TDD, branch finish.

    +

    Handoff

    agent-toolkit patterns for requirements, plans, entropy control.

    +

    Guardrails

    Secrets, cloud, DB, Docker, dependency, and retry-stop cautions.

    +

    QA / writing

    Browser evidence, writing review, QA depth on demand.

    +
    +

    Do not install every skill. Load only what changes the next action.

    +
    + +
    +

    Skill library adoption signal

    + Star history for selected community skill libraries. +

    Stars show attention, not quality. Judge by whether the skill changes the next agent action.

    +
    + +
    +

    Plan first, execute cheaply

    + Plan with strong reasoning model, save acceptance criteria, execute in a fresh cheaper session, verify implementation. +
    + +
    +

    Day-to-day model guidance

    +
      +
    1. Auto first for unknown everyday work.
    2. +
    3. Lightweight for tiny bounded work.
    4. +
    5. Mid-tier for normal implementation after clear plan.
    6. +
    7. Powerful for planning, architecture, hard debugging.
    8. +
    9. Fresh session when changing model/tool/agent lane.
    10. +
    +
    + +
    +

    Benchmark caveats

    +
      +
    • Benchmarks choose candidates; repo tasks choose defaults.
    • +
    • Harness, tools, retrieval, and reasoning effort affect scores.
    • +
    • Compare outcome and cost together, not score alone.
    • +
    • Label sources: verified, directional, anecdotal.
    • +
    +
    +
    +

    Capstone

    @@ -1261,9 +1411,9 @@

    Week-by-week rollout

    WeekTeam actionAdmin action 1Output defaults + Ask ModeUsage baseline - 2Instruction pruning + scoped rulesBudget pilot - 3MCP audit + model routingModel access review - 4Agent issue templates + setup stepsMonthly reporting cadence + 2Instruction pruning + scoped rules + Markdown conversionBudget pilot + 3MCP audit + output filter + Graphify pilotModel access review + 4Plan-first execution + verification/close disciplineMonthly outcome-per-token review
    @@ -1288,7 +1438,7 @@

    Developer

  • Code-only default
  • Ask/Edit/Agent routing
  • Concise prompts
  • -
  • Fresh sessions
  • +
  • Plan first, fresh sessions
  • @@ -1298,6 +1448,7 @@

    Repository

  • Scoped applyTo files
  • Coding Agent setup steps
  • Precise issue templates
  • +
  • Graphify map where useful
  • @@ -1306,7 +1457,8 @@

    Platform

  • MCP profiles
  • Content Exclusion
  • Model access policy
  • -
  • RTK/CLI tool output strategy
  • +
  • RTK or snip output strategy
  • +
  • One tool per layer
  • @@ -1315,7 +1467,7 @@

    Enterprise

  • Budgets
  • User-level caps
  • Usage reporting
  • -
  • Monthly review
  • +
  • Monthly outcome review
  • @@ -1337,6 +1489,68 @@

    Closing message

    + + + From 5cdc1b84d880717dae6d4aebb1315f2775f92769 Mon Sep 17 00:00:00 2001 From: Marco Olivo <8478776+olivomarco@users.noreply.github.com> Date: Thu, 23 Jul 2026 18:50:41 +0200 Subject: [PATCH 22/22] Add extra CSS styles for improved layout and design --- .github/workflows/deploy-pages.yml | 7 ++++++- docs/index.md | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index a948ca8..15224d4 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -6,6 +6,7 @@ on: - main paths: - docs/** + - slides/** - mkdocs.yml - requirements-docs.txt - .github/workflows/deploy-pages.yml @@ -41,7 +42,11 @@ jobs: run: python -m pip install --upgrade pip && pip install -r requirements-docs.txt - name: Build site - run: mkdocs build --strict --site-dir site + run: | + mkdocs build --strict --site-dir site + cp -R slides site/slides + mkdir -p site/docs + cp -R docs/assets site/docs/assets - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 diff --git a/docs/index.md b/docs/index.md index b2be97e..54b50e3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,8 +4,8 @@ Practical guide to reducing GitHub Copilot token spend while keeping answers and [Start with Part 1](01-why-tokens-matter.md){ .md-button .md-button--primary } [Jump to Practical Setup](10-practical-setup.md){ .md-button } -[Concise practitioner briefing](../slides/briefing.html){ .md-button } -[Full 8-hour workshop](../slides/index.html){ .md-button } +Concise practitioner briefing +Full 8-hour workshop ## What This Covers