forked from olivomarco/github-copilot-token-optimization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1795 lines (1655 loc) · 77.2 KB
/
Copy pathindex.html
File metadata and controls
1795 lines (1655 loc) · 77.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub Copilot Token Optimization - 8 Hour Workshop</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@5.2.1/dist/reset.css" integrity="sha384-AJKv9Ui5SfA0VsFksFI9GuA1ztX9Ca3CLP6HGfX4YY/tYSVodC+PUszaQZFIlkuy" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@5.2.1/dist/reveal.css" integrity="sha384-tK61vs+AeByBmiQ/i6CLgp/PbaaoB/k7M4J5mlX70GVtBPGUk5avjbXhSwhsf3fS" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@5.2.1/dist/theme/black.css" integrity="sha384-tGFyyraypan1jA66tD+w5qjIQFygKQc3MiwIrZTma4BXsJ58dSimuWOGWd+SGa1M" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@5.2.1/plugin/highlight/monokai.css" integrity="sha384-0rrWATPYzlkqxkUhsXu1QkrO6K3rq4d6FqJQhcCJ7jQcZhb6plkpODMjpoiAYidE" crossorigin="anonymous">
<style>
:root {
--r-main-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--r-heading-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--r-link-color: #58a6ff;
--r-selection-background-color: #238636;
}
.reveal {
font-size: 34px;
}
.reveal h1,
.reveal h2,
.reveal h3 {
text-transform: none;
letter-spacing: -0.03em;
}
.reveal h1 {
font-size: 2.2em;
}
.reveal h2 {
font-size: 1.65em;
}
.reveal h3 {
font-size: 1.25em;
}
.reveal p,
.reveal li,
.reveal td,
.reveal th {
line-height: 1.24;
}
.reveal ul,
.reveal ol {
width: 88%;
}
.reveal table {
font-size: 0.58em;
margin-top: 0.6em;
}
.reveal pre {
width: 96%;
font-size: 0.58em;
box-shadow: none;
}
.reveal code {
background: rgba(110, 118, 129, 0.22);
border-radius: 0.18em;
padding: 0.06em 0.18em;
}
.reveal pre code {
background: #0d1117;
border: 1px solid #30363d;
border-radius: 10px;
padding: 1em;
}
.kicker {
color: #7ee787;
font-size: 0.62em;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.muted {
color: #8b949e;
}
.small {
font-size: 0.68em;
}
.tiny {
font-size: 0.52em;
}
.accent {
color: #7ee787;
}
.warning {
color: #ffa657;
}
.danger {
color: #ff7b72;
}
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.65em;
align-items: stretch;
}
.grid-3 {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0.55em;
}
.card {
background: rgba(22, 27, 34, 0.92);
border: 1px solid #30363d;
border-radius: 16px;
padding: 0.75em;
text-align: left;
}
.card h3,
.card h4 {
margin: 0 0 0.35em 0;
}
.card p,
.card li {
font-size: 0.72em;
}
.lab {
border-left: 8px solid #7ee787;
}
.enterprise {
border-left: 8px solid #58a6ff;
}
.checkpoint {
border-left: 8px solid #ffa657;
}
.quote {
font-size: 1.05em;
color: #c9d1d9;
border-left: 8px solid #7ee787;
padding-left: 0.8em;
text-align: left;
}
.two-col {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.8em;
align-items: start;
}
.center {
text-align: center;
}
.left {
text-align: left;
}
</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<p class="kicker">8 hour customer workshop</p>
<h1>GitHub Copilot Token Optimization</h1>
<p>Spend fewer tokens. Keep quality. Build enterprise guardrails.</p>
<p class="small muted">Reveal.js deck generated from repository guide content.</p>
<aside class="notes">
Open with disclaimer: community guide, not official GitHub or Microsoft guidance. Use official docs for supported controls.
</aside>
</section>
<section>
<h2>Workshop outcome</h2>
<div class="grid-3">
<div class="card">
<h3>Explain cost</h3>
<p>Input, output, cached tokens, agent loops, MCP schemas, model routing.</p>
</div>
<div class="card">
<h3>Change behavior</h3>
<p>Prompt compression, output control, context hygiene, Ask/Edit/Agent routing.</p>
</div>
<div class="card">
<h3>Ship rollout plan</h3>
<p>Enterprise budgets, model policy, instruction scope, monthly review loop.</p>
</div>
</div>
</section>
<section>
<h2>Important framing</h2>
<div class="quote">
This deck is based on field guidance in this repo. It is not official GitHub or Microsoft guidance.
</div>
<p class="small">Use <code>docs.github.com/copilot</code> for supported feature behavior, billing controls, and admin policy.</p>
</section>
<section>
<h2>8 hour agenda</h2>
<table>
<thead>
<tr><th>Time</th><th>Block</th><th>Output</th></tr>
</thead>
<tbody>
<tr><td>00:00-00:30</td><td>Why tokens matter + fast wins</td><td>Shared cost model</td></tr>
<tr><td>00:30-02:00</td><td>Prompt, language, output labs</td><td>Terse prompt templates</td></tr>
<tr><td>02:00-03:15</td><td>Context + always-on files</td><td>Instruction pruning diff</td></tr>
<tr><td>03:15-04:15</td><td>Workflow + modes</td><td>Mode routing cheat sheet</td></tr>
<tr><td>04:15-05:15</td><td>MCP/tool costs + data</td><td>MCP audit list</td></tr>
<tr><td>05:15-06:15</td><td>Practical setup</td><td>Repo setup checklist</td></tr>
<tr><td>06:15-07:30</td><td>Model/pricing + governance</td><td>Customer admin rollout</td></tr>
<tr><td>07:30-08:00</td><td>Capstone</td><td>30 day token plan</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Navigation</h2>
<p>Horizontal = chapters. Vertical = chapter slides + labs.</p>
<p class="small muted">Press <code>Esc</code> for overview. Press <code>S</code> for speaker notes.</p>
</section>
<section>
<section>
<p class="kicker">Quick Start</p>
<h2>11 things to do right now</h2>
<p>Start with output, then shrink structural input, then route models and tools.</p>
</section>
<section>
<h2>Fastest wins</h2>
<ol>
<li><strong>Code-only responses</strong>: highest per-token ROI.</li>
<li><strong>Constrain format</strong>: bullets, one sentence, JSON, tables.</li>
<li><strong>Shrink always-on context</strong>: instructions and agent files.</li>
<li><strong>Use Auto by default</strong>: pin premium only when justified.</li>
<li><strong>Use Ask Mode</strong> for simple questions.</li>
</ol>
</section>
<section>
<h2>More fast wins</h2>
<ol start="6">
<li><strong>Scope context with <code>applyTo</code></strong>.</li>
<li><strong>Write precise prompts</strong>: target file, function, done condition.</li>
<li><strong>Retune prompts to target model</strong>.</li>
<li><strong>Audit MCP servers</strong>.</li>
<li><strong>Run <code>/chronicle improve</code></strong> in Copilot CLI.</li>
<li><strong>Try CodeAct</strong> for long CLI tool chains.</li>
</ol>
</section>
<section>
<h2>The priority stack</h2>
<div class="grid">
<div class="card">
<h3>Output first</h3>
<p>Verbose answers are expensive. One default instruction changes every response.</p>
</div>
<div class="card">
<h3>Always-on second</h3>
<p>Instruction files and tool schemas load repeatedly. Small baselines compound.</p>
</div>
<div class="card">
<h3>Mode third</h3>
<p>Ask for questions. Edit for single-file changes. Agent for multi-step work.</p>
</div>
<div class="card">
<h3>Governance fourth</h3>
<p>Budgets cap spend. Model policy limits expensive lanes.</p>
</div>
</div>
</section>
<section>
<h2>Lab 0: baseline your habits</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Identify your top 3 token leaks before learning techniques.</p>
<p><strong>Do:</strong> mark each as green/yellow/red: output verbosity, instruction size, open tabs, Agent use, MCP count, model pinning, long chat history.</p>
<p><strong>Deliverable:</strong> personal baseline + one "fix today" action.</p>
<p><strong>Time:</strong> 10 minutes.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 1</p>
<h2>Why tokens matter</h2>
<p>Tokens drive cost, speed, limits, and context capacity.</p>
</section>
<section>
<h2>Tokens are subwords</h2>
<div class="two-col">
<div class="card">
<h3>BPE behavior</h3>
<ul>
<li>Common words can be one token.</li>
<li>Rare words split into pieces.</li>
<li>Punctuation and filler still count.</li>
</ul>
</div>
<div class="card">
<h3>Core insight</h3>
<p><code>Sure, I'd be happy to help!</code> can burn around 10 tokens of zero technical value.</p>
</div>
</div>
</section>
<section>
<h2>Cost model</h2>
<table>
<thead><tr><th>Bucket</th><th>What it contains</th><th>Lever</th></tr></thead>
<tbody>
<tr><td>Input</td><td>Prompt, context, files, history, tools</td><td>Scope and compress</td></tr>
<tr><td>Cached</td><td>Stable reused prefixes</td><td>Keep stable context stable</td></tr>
<tr><td>Output</td><td>Model response</td><td>Code-only, concise format</td></tr>
</tbody>
</table>
<p class="small warning">Output tokens usually cost materially more than input tokens in vendor pricing examples.</p>
</section>
<section>
<h2>Input is bigger than your prompt</h2>
<pre><code class="language-text">Context window
├─ System prompt
├─ copilot-instructions.md / AGENTS.md
├─ File context and open tabs
├─ Conversation history
├─ MCP tool schemas
└─ Your typed prompt</code></pre>
<p class="small">Your 20-word prompt can ride inside thousands of hidden tokens.</p>
</section>
<section>
<h2>Coding Agent multiplier</h2>
<p>One issue-to-PR run is not one request.</p>
<div class="grid">
<div class="card">
<h3>Agent steps</h3>
<p>Plan, search, read files, edit, run tests, inspect failures, retry.</p>
</div>
<div class="card">
<h3>Compounding</h3>
<p>Every step reloads baseline context and adds previous tool results.</p>
</div>
</div>
</section>
<section>
<h2>Lab 1: token anatomy</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Separate visible prompt from hidden context.</p>
<p><strong>Do:</strong> choose one recent Copilot task. List likely context sources: open files, referenced files, instructions, history, tools, output.</p>
<p><strong>Discuss:</strong> which source was most controllable?</p>
<p><strong>Time:</strong> 15 minutes.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.1</p>
<h2>Prompt compression</h2>
<p>Say same thing in fewer tokens. Preserve technical precision.</p>
</section>
<section>
<h2>Caveman pattern</h2>
<div class="grid">
<div class="card">
<h3>Drop</h3>
<p>Articles, filler, pleasantries, hedging, softeners.</p>
</div>
<div class="card">
<h3>Keep</h3>
<p>Technical terms, code, filenames, constraints, exact done condition.</p>
</div>
</div>
<p class="accent"><code>[thing] [action] [reason]. [next step].</code></p>
</section>
<section>
<h2>Before vs after</h2>
<table>
<thead><tr><th>Verbose</th><th>Caveman</th></tr></thead>
<tbody>
<tr>
<td>Could you please review this pull request and let me know if there are any issues?</td>
<td><code>Review PR. Flag issues.</code></td>
</tr>
<tr>
<td>Can you explain what this error message means and how I should fix it?</td>
<td><code>Explain error. How fix.</code></td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Compression levels</h2>
<table>
<thead><tr><th>Level</th><th>Style</th><th>Use when</th></tr></thead>
<tbody>
<tr><td>Lite</td><td>Professional but tight</td><td>Client-facing, onboarding</td></tr>
<tr><td>Full</td><td>Fragments, no fluff</td><td>Daily developer prompts</td></tr>
<tr><td>Ultra</td><td>Abbrev, arrows, terse</td><td>High-volume, known domain</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Structured beats prose</h2>
<pre><code class="language-text">POST /api/users
Validate:
- name: string, required
- email: string, required, valid
400 on validation fail
201 on success, return created user
Save to DB</code></pre>
<p class="small">Bullets and key-value pairs force clarity and reduce filler.</p>
</section>
<section>
<h2>Code-centric prompting</h2>
<div class="grid">
<div class="card">
<h3>Natural language</h3>
<p>Create a function that takes numbers, filters negative values, doubles remaining values, returns sum.</p>
</div>
<div class="card">
<h3>Code-centric</h3>
<p><code>fn(nums) -> filter(>0) -> map(*2) -> sum</code></p>
<p><code>Like getUserById but for emails. 404 if missing.</code></p>
</div>
</div>
</section>
<section>
<h2>Guardrails as invariants</h2>
<table>
<thead><tr><th>Verbose procedure</th><th>Compressed invariant</th></tr></thead>
<tbody>
<tr><td>Make sure every SQL query parameterizes values...</td><td><code>SQL: parameterized queries only. No concatenation.</code></td></tr>
<tr><td>Please write tests for any new code...</td><td><code>New code -> tests. Cover happy + error.</code></td></tr>
</tbody>
</table>
</section>
<section>
<h2>Lab 2: prompt compression ladder</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Rewrite one real prompt three ways: lite, full, ultra.</p>
<p><strong>Do:</strong> preserve file names, line numbers, constraints, done condition. Drop only fluff.</p>
<p><strong>Compare:</strong> which version is shortest without adding ambiguity?</p>
<p><strong>Time:</strong> 20 minutes.</p>
</div>
</section>
<section>
<h2>Lab 3: prompt A/B</h2>
<div class="card lab">
<h3>Try this vs that</h3>
<pre><code class="language-text">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.</code></pre>
<p><strong>Run:</strong> ask Copilot with A, then B. Compare file reads, clarifications, output length.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.2</p>
<h2>Language comparison</h2>
<p>English is usually most token-efficient for prompts.</p>
</section>
<section>
<h2>CJK assumption fails</h2>
<table>
<thead><tr><th>Language</th><th>Sentence</th><th>Tokens</th><th>vs English</th></tr></thead>
<tbody>
<tr><td>English</td><td>I met a huge dog</td><td>5</td><td>1.0x</td></tr>
<tr><td>Spanish</td><td>Conoci a un perro enorme</td><td>8</td><td>1.6x</td></tr>
<tr><td>Chinese</td><td>Chinese equivalent</td><td>11</td><td>2.2x</td></tr>
<tr><td>Japanese</td><td>Japanese equivalent</td><td>11</td><td>2.2x</td></tr>
<tr><td>Russian</td><td>Russian equivalent</td><td>14</td><td>2.8x</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Why</h2>
<ul>
<li>BPE tokenizers are trained heavily on English.</li>
<li>Common English words often get one token.</li>
<li>CJK text has fewer characters, but more tokens per character.</li>
<li>Non-Latin scripts often cost more; transliteration can help.</li>
</ul>
</section>
<section>
<h2>Practical rule</h2>
<div class="quote">
Use terse English for prompts and instructions. Do not translate to CJK to save tokens.
</div>
<p class="small">If a user writes better in native language, quality can outweigh token cost. For optimization, English wins.</p>
</section>
<section>
<h2>Lab 4: tokenizer reality check</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Disprove or confirm language assumptions with actual token counts.</p>
<p><strong>Do:</strong> pick one prompt. Translate to your strongest non-English language. Compare token counts in tokenizer tool.</p>
<p><strong>Deliverable:</strong> team language guidance: when English is required, when native language is OK.</p>
<p><strong>Time:</strong> 20 minutes.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.3</p>
<h2>Context management</h2>
<p>Control what gets sent. Biggest input wins are structural.</p>
</section>
<section>
<h2>Always-on files cost every turn</h2>
<p><code>.github/copilot-instructions.md</code>, <code>AGENTS.md</code>, <code>CLAUDE.md</code>, and similar files can become persistent context.</p>
<p class="small warning">Duplicate content can be paid twice when multiple files are loaded by different tools.</p>
</section>
<section>
<h2>Instruction compression example</h2>
<pre><code class="language-text">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].</code></pre>
<p class="small">Around 50 tokens. Loaded on every interaction.</p>
</section>
<section>
<h2>Context hygiene</h2>
<ul>
<li>Close files not relevant to current task.</li>
<li>Keep files focused and small.</li>
<li>Ignore build output, vendor dirs, generated files.</li>
<li>Use Content Exclusion for sensitive paths in Business/Enterprise.</li>
<li>Start fresh conversations after topic changes.</li>
</ul>
</section>
<section>
<h2>Use scoped instructions</h2>
<pre><code class="language-markdown">---
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.</code></pre>
<p class="small">Pay path-specific guidance only when relevant files are in scope.</p>
</section>
<section>
<h2>Always-on vs conditional vs on-demand</h2>
<table>
<thead><tr><th>Scope</th><th>Use for</th><th>Token posture</th></tr></thead>
<tbody>
<tr><td>Always-on</td><td>Universal rules</td><td>Keep tiny</td></tr>
<tr><td>Conditional</td><td>Path/layer rules</td><td><code>applyTo</code></td></tr>
<tr><td>On-demand</td><td>Review checklists, release notes</td><td>Load only when invoked</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Cache-friendly behavior</h2>
<ul>
<li>Keep stable context at the top.</li>
<li>Do not churn instruction files constantly.</li>
<li>Reuse saved snippets instead of re-pasting large context.</li>
<li>Summarize and restart when history gets stale.</li>
</ul>
</section>
<section>
<h2>Enterprise note: Content Exclusion</h2>
<div class="card enterprise">
<h3>Customer-side action</h3>
<p>Configure Content Exclusion for sensitive files, generated bundles, large data files, and regulated paths.</p>
<p><strong>Important:</strong> treat this as privacy/policy control first, token-saving side effect second. Check current surface support in official docs.</p>
</div>
</section>
<section>
<h2>Lab 5: context audit</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Find always-on context that should become scoped or on-demand.</p>
<p><strong>Do:</strong> inspect repo instructions, AGENTS/CLAUDE files, open tabs, generated files, MCP config.</p>
<p><strong>Deliverable:</strong> three-column list: keep always-on, move to <code>applyTo</code>, move on-demand/delete.</p>
<p><strong>Time:</strong> 30 minutes.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.4</p>
<h2>Output control</h2>
<p>Tell model what not to say. Highest per-token ROI.</p>
</section>
<section>
<h2>Default line</h2>
<pre><code class="language-text">Code only, no explanation.</code></pre>
<p>Best for generation tasks when team already understands desired change.</p>
</section>
<section>
<h2>Format constraints</h2>
<table>
<thead><tr><th>Instruction</th><th>Use when</th></tr></thead>
<tbody>
<tr><td>Answer in one sentence</td><td>Quick decision or explanation</td></tr>
<tr><td>3 bullets max</td><td>Scan-friendly summary</td></tr>
<tr><td>Reply as JSON</td><td>Machine-readable extraction</td></tr>
<tr><td>Yes/no, then one line why</td><td>Review gate</td></tr>
<tr><td>Diff only</td><td>Patch inspection</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Project default</h2>
<pre><code class="language-text">Be concise. No explanations unless asked.
Code only for generation tasks.
Bullets over paragraphs.</code></pre>
<p class="small">Override when learning, debugging, or teaching: ask for explanation explicitly.</p>
</section>
<section>
<h2>Lab 6: output A/B</h2>
<div class="card lab">
<h3>Try this vs that</h3>
<pre><code class="language-text">A: Add input validation to processOrder().
B: Add input validation to processOrder().
Code only. No explanation. Minimal diff.</code></pre>
<p><strong>Measure:</strong> response length, explanation tokens, diff usefulness.</p>
<p><strong>Time:</strong> 15 minutes.</p>
</div>
</section>
<section>
<h2>Lab 7: format forcing</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Practice asking for bounded output.</p>
<p><strong>Prompts:</strong> "3 bullets max", "table only", "JSON only", "one-line verdict + risk".</p>
<p><strong>Deliverable:</strong> team snippet library for common Copilot outputs.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.5</p>
<h2>Workflow optimization</h2>
<p>Use cheaper interaction shapes before optimizing words.</p>
</section>
<section>
<h2>Commit and PR text matter</h2>
<div class="grid">
<div class="card">
<h3>Commit</h3>
<p><code>feat: add password reset via settings page</code></p>
<p>Body only when "why" is not obvious.</p>
</div>
<div class="card">
<h3>Review</h3>
<p><code>L42: bug: user can be null. Add guard before .email.</code></p>
<p>One-line, actionable, severity-coded.</p>
</div>
</div>
</section>
<section>
<h2>Ask vs Edit vs Agent</h2>
<table>
<thead><tr><th>Task</th><th>Mode</th><th>Reason</th></tr></thead>
<tbody>
<tr><td>What does function do?</td><td>Ask</td><td>One call</td></tr>
<tr><td>Syntax question</td><td>Ask</td><td>No tools</td></tr>
<tr><td>Single-file tweak</td><td>Edit</td><td>Targeted</td></tr>
<tr><td>Multi-file refactor</td><td>Agent</td><td>Needs tools</td></tr>
<tr><td>Issue-to-PR</td><td>Coding Agent</td><td>Autonomous workflow</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Auto model default</h2>
<p>Auto is a good baseline: supported Auto pool, org policy-aware, discount on eligible paid-plan Chat usage per docs.</p>
<p class="warning">Auto does not mean "escalate into every premium model." Pin premium deliberately.</p>
</section>
<section>
<h2>Retune prompts when model changes</h2>
<pre><code class="language-text">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.</code></pre>
</section>
<section>
<h2>When not to compress</h2>
<ul>
<li>Security warnings.</li>
<li>Irreversible operations.</li>
<li>Onboarding and teaching.</li>
<li>Regulatory/compliance language.</li>
<li>Complex instructions where fragments add ambiguity.</li>
</ul>
</section>
<section>
<h2>Close loop with usage coaching</h2>
<div class="grid">
<div class="card">
<h3><code>/chronicle</code></h3>
<p>Copilot CLI session history. Use <code>/chronicle improve</code> for recurring confusion.</p>
</div>
<div class="card">
<h3>AI Engineering Coach</h3>
<p>VS Code local extension. Finds anti-patterns, context health, skill opportunities.</p>
</div>
</div>
</section>
<section>
<h2>Lab 8: mode routing drill</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Stop using Agent Mode for one-shot work.</p>
<p><strong>Do:</strong> classify 20 sample tasks as Ask/Edit/Agent/Coding Agent. Defend choice.</p>
<p><strong>Deliverable:</strong> team mode-routing cheat sheet.</p>
<p><strong>Time:</strong> 20 minutes.</p>
</div>
</section>
<section>
<h2>Lab 9: model routing drill</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Prevent expensive-model pinning by default.</p>
<p><strong>Do:</strong> map tasks to Auto, included/lower-cost, standard, premium. Include reasoning-effort choice if available.</p>
<p><strong>Deliverable:</strong> model escalation rules.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.6</p>
<h2>Always-on context problem</h2>
<p>More context can make agents worse and cost more.</p>
</section>
<section>
<h2>Research signal</h2>
<table>
<thead><tr><th>Finding</th><th>Observed impact</th></tr></thead>
<tbody>
<tr><td>LLM-generated context files</td><td>Hurt in 5/8 settings</td></tr>
<tr><td>Average correctness</td><td>Down about 2%</td></tr>
<tr><td>Token cost</td><td>Up 20-23%</td></tr>
<tr><td>Reasoning overhead</td><td>Up about 22% in cited setup</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Why context hurts</h2>
<div class="grid">
<div class="card"><h3>Redundancy tax</h3><p>Repeats facts agent can discover.</p></div>
<div class="card"><h3>Attention tax</h3><p>Important rules get lost in middle.</p></div>
<div class="card"><h3>Anchoring trap</h3><p>Outdated tool guidance over-influences agent.</p></div>
<div class="card"><h3>Signal/noise</h3><p>Routine facts dilute landmines.</p></div>
</div>
</section>
<section>
<h2>Keep landmines only</h2>
<table>
<thead><tr><th>Keep</th><th>Delete</th></tr></thead>
<tbody>
<tr><td>Use <code>uv</code> instead of <code>pip</code></td><td>This is a Python project</td></tr>
<tr><td>DB migrations must run in order</td><td>We use PostgreSQL</td></tr>
<tr><td>Do not refactor auth module; audit pending</td><td>We use JWT auth</td></tr>
<tr><td>Deploy requires VPN</td><td>Main branch protected</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Bug tracker model</h2>
<pre><code class="language-text">Start almost empty.
Agent trips on something -> add one line.
Root cause fixed -> delete that line.</code></pre>
<p>Instruction files should grow and shrink, not accumulate like a wiki.</p>
</section>
<section>
<h2>Lab 10: landmine pruning</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Cut context without losing correctness.</p>
<p><strong>Do:</strong> mark each instruction as discoverable, style, landmine, stale, duplicate. Delete or scope everything except true always-on landmines.</p>
<p><strong>Deliverable:</strong> 10-line max instruction file draft.</p>
<p><strong>Time:</strong> 35 minutes.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 2.7</p>
<h2>MCP and tool costs</h2>
<p>Tool schemas are hidden token tax.</p>
</section>
<section>
<h2>Measure first</h2>
<pre><code class="language-text">/context
System/Tools: MCPs + instructions + system prompt
Messages: conversation history
Free Space: remaining context</code></pre>
<p class="small">In VS Code, estimate active MCP servers x tools x about 200 tokens/tool.</p>
</section>
<section>
<h2>Every tool costs tokens</h2>
<table>
<thead><tr><th>Component</th><th>Approx cost</th></tr></thead>
<tbody>
<tr><td>Name + description</td><td>20-50 tokens</td></tr>
<tr><td>Simple parameter schema</td><td>30-80 tokens</td></tr>
<tr><td>Complex parameter schema</td><td>100-300 tokens</td></tr>
<tr><td>Total per tool</td><td>100-500 tokens</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Multiplication problem</h2>
<pre><code class="language-text">10 MCP servers
x 5 tools each
x 200 tokens/tool
= 10,000 tokens per step
15 agent steps = 150,000 schema tokens</code></pre>
</section>
<section>
<h2>Audit rule</h2>
<ul>
<li>Disable servers not needed now.</li>
<li>Use per-workspace config, not global everything.</li>
<li>Prefer built-in tools over duplicate filesystem MCPs.</li>
<li>Use skills for occasional capabilities.</li>
<li>Scope large plugins by namespace/mode when supported.</li>
</ul>
</section>
<section>
<h2>Tool output compression</h2>
<div class="card">
<h3>RTK</h3>
<p>CLI proxy filters noisy shell output before agent reads it: tests, git diff, grep, logs, file listings.</p>
<pre><code class="language-bash">rtk init --copilot</code></pre>
</div>
</section>
<section>
<h2>Azure MCP case pattern</h2>
<p>One large plugin can dominate System/Tools budget.</p>
<pre><code class="language-bash">--namespace appservice --namespace cosmos --namespace keyvault --namespace storage</code></pre>
<p class="small">Scope by service/persona. Avoid "all tools" mode unless truly needed.</p>
</section>
<section>
<h2>Lab 11: MCP audit</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Remove hidden schema overhead.</p>
<p><strong>Do:</strong> inventory enabled MCP servers, tool counts, global vs workspace scope, owner, frequency of use.</p>
<p><strong>Deliverable:</strong> keep/disable/scope table + restart plan.</p>
<p><strong>Time:</strong> 30 minutes.</p>
</div>
</section>
<section>
<h2>Enterprise lab: tool policy</h2>
<div class="card enterprise">
<h3>Customer-side action</h3>
<p>Define approved MCP servers by persona: developer, data, platform, security, support.</p>
<p><strong>Deliverable:</strong> default MCP profile per team + exception process for large plugins.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 3</p>
<h2>Comparisons and data</h2>
<p>Use evidence to pick habits with best impact-to-effort.</p>
</section>
<section>
<h2>Same task, different cost</h2>
<table>
<thead><tr><th>Technique</th><th>Prompt</th><th>Tokens</th></tr></thead>
<tbody>
<tr><td>Verbose</td><td>Please add comprehensive error handling...</td><td>~40</td></tr>
<tr><td>Caveman lite</td><td>Add error handling. Cover null, types, network.</td><td>~16</td></tr>
<tr><td>Caveman full</td><td>Error handling. Cover: null, bad type, net error.</td><td>~12</td></tr>
<tr><td>Ultra</td><td>Error handling: null/bad-type/net-err.</td><td>~7</td></tr>
</tbody>
</table>
</section>
<section>
<h2>Big winners</h2>
<ol>
<li>Caveman-speak + precise prompts.</li>
<li>Code-only / constrained output.</li>
<li>Shrink always-on context.</li>
<li>Ask Mode for simple questions.</li>
<li>Audit MCP servers.</li>
<li>Retune prompts after model changes.</li>
</ol>
</section>
<section>
<h2>Quality curve</h2>
<pre><code class="language-text">Savings: lite ---- full ---- ultra ---- extreme
Risk: low ---- low ---- medium --- high</code></pre>
<p class="accent">Sweet spot: full caveman. Maximum return, negligible risk for technical users.</p>
</section>
<section>
<h2>Lab 12: prioritize techniques</h2>
<div class="card lab">
<h3>Goal</h3>
<p>Pick changes by impact, effort, risk.</p>
<p><strong>Do:</strong> rate each technique 1-5 for impact, effort, adoption friction, governance need.</p>
<p><strong>Deliverable:</strong> team top 5 and "do not adopt" list.</p>
<p><strong>Time:</strong> 25 minutes.</p>
</div>
</section>
</section>
<section>
<section>
<p class="kicker">Part 4</p>
<h2>Practical setup</h2>