GitHub Copilot AI Credits Optimization — Module 2: Developer Efficiency Hands-On Lab Guide

Duration: ~59 minutes of hands-on exercises (across the ~135-minute Module 2 workshop) Format: Step-by-step lab exercises with worksheets
Audience: Developers, technical leads, Copilot champions
Roles used throughout: Work individually first, then compare with a neighbor or as a table, unless a step says otherwise

Note: This lab guide is facilitator-ready and standalone — it supports Module 2 — Developer Efficiency of the GitHub Copilot AI Credits Optimization curriculum on its own. It pairs with:


Lab Overview

This lab guide contains all the hands-on exercises from the Module 2 — Developer Efficiency workshop. Each lab maps to a workshop section and builds on the previous one. Complete them in order.

Important: No lab in this guide requires a live paid AI request beyond your normal day-to-day usage. Every exercise can be completed using the supplied sample prompts, transcripts, inventories, datasets, and worksheets. The live instrumentation noted in Lab 4 is optional and spends AI credits.

Environment Notes, Setup & Troubleshooting

The complete lab works with a text editor or printed worksheet. Copilot CLI, repository access, and paid AI requests are optional unless a facilitator explicitly chooses a live variation.

Before starting:

Setup checkpoint:

One-Minute Billing Warm-Up

Classify each activity as billed or unbilled:

  1. Accept an inline code completion
  2. Ask Copilot Chat to explain a test failure
  3. Accept a next edit suggestion (NES)
  4. Send a prompt from Copilot CLI
  5. Ask GitHub Spark to generate or update an application

Answer: 1 and 3 are unbilled; 2, 4, and 5 are billed.

Lab Summary

Lab Workshop Section Time
Warm-up. Billed vs. unbilled quick check Welcome 1 min
1. Interface Scenario Matching 1 — Right Interface for the Task 6 min
2. Prompt, Customization Inventory, Tool Pruning & Memory Triage 2 — Context, Customization & Instruction Efficiency 20 min
3. Session Design, Session Limit & Clean-Session Handoff 3 — Session Lifecycle, Handoff, Cache & Session Limits 12 min
4. Model Scenarios & Before/After Evaluation 4 — Model Strategy, Verification & Before/After Evaluation 12 min
5. 30-Day Personal/Team Habit Plan Capstone 5 — Hands-On Optimization Capstone & Close 8 min

Total hands-on: 59 min

Prerequisites

Only a place to record answers is required; the GitHub and CLI items below apply to optional live variations.

Item Details
Required: a notepad or worksheet app Used for every supplied-data exercise
Optional: GitHub account and Copilot license Needed only for an approved live variation; Business, Enterprise, and individual paid plans apply
Optional: Copilot CLI Needed only for the live session-limit checkpoint; the paper fallback covers the same decision
No admin access required This lab does not touch budgets, policies, or billing settings

Lab 1: Interface Scenario Matching (6 min)

Workshop Section: 1 — Right Interface for the Task

Roles

  • Work individually, then compare with a neighbor

Starting State

You have the five scenarios below, the interface reference, and a place to record one choice and rationale per scenario. No repository or live Copilot access is required.

Reference — Interface Selection

Interface Best For Billed in AI Credits?
Code completions / Next Edit Suggestions Small, local, in-the-flow edits No — unlimited on paid plans
Ask mode Explaining code, answering a scoped question Yes
Edit mode Focused, scoped multi-line changes Yes
Agent mode Multi-file work, running commands, verifying changes Yes
Copilot CLI Terminal-native agentic tasks, scripts, repo-wide operations Yes
Cloud agent Long-running autonomous work (for example, opening a PR) Yes

Steps

For each scenario, decide the single best-fit interface and write a one-sentence reason:

  1. Renaming a local variable and its five usages within one file
  2. Investigating why a production incident started after last night's deploy, across three services
  3. Adding unit tests directly to an existing test file for a function you just finished, using its current tests as the pattern
  4. Asking what a regular expression in a legacy file does, with no intention of changing it
  5. Running a long, multi-step refactor of a legacy module from your terminal

Answer Key

  1. Code completions / Next Edit Suggestions — a same-file, mechanical rename doesn't need a billed conversational interface
  2. Agent mode or Copilot CLI with cross-service scope — this needs multi-file/multi-service investigation and likely command execution
  3. Edit mode, referencing the existing test file directly — the task is a bounded change in a named file, not merely a question about how to write tests
  4. Ask mode — this is a question, not a change; no need for Edit or Agent mode
  5. Copilot CLI — a terminal-native, long-running agentic task benefits from CLI's session and tooling model over Chat

Success Criteria

  • ✅ You chose code completions/NES (not Chat) for Scenario 1
  • ✅ You chose Agent mode or Copilot CLI with cross-service scope for Scenario 2
  • ✅ You chose Edit mode for Scenario 3 and can explain why a bounded file change is not Ask mode
  • ✅ You chose Ask mode for Scenario 4
  • ✅ You chose Copilot CLI for Scenario 5 and can explain why

Lab 2: Prompt, Customization Inventory, Tool Pruning & Memory Triage (20 min)

Workshop Section: 2 — Context, Customization & Instruction Efficiency

Roles

  • Work individually, then discuss as a table

Starting State

Use the supplied weak prompt, instruction excerpt, customization inventory, tool list, and memory entries. Do not open or change live repository customizations or memory during the exercise.

Part A — Before/After Prompt Worksheet (4 min)

Before: "Fix the bug in the payment code."

Rewrite this into an After prompt with a clear task, named context, and an explicit stop condition. Use the worksheet below:

Field Your Answer
Task — what's actually wrong and what should happen instead _______
Context — which file(s), error message, or reproduction steps _______
Stop condition — what "done" looks like _______

Model After Prompt (compare once you've drafted your own):

"In src/payments/charge.ts, the applyDiscount() function returns a negative total when a discount percentage greater than 100 is passed in. Fix it so percentages above 100 are rejected with a validation error before the calculation runs, matching the validation pattern already used in validateAmount() in the same file. Stop once the existing test suite in charge.test.ts passes and you've added one new test for the over-100 case — do not refactor unrelated functions in this file."

Part B — Customization Inventory: Keep / Scope / Retire (8 min)

B1 — Instruction lines. Below is a sample excerpt from a repository's copilot-instructions.md. Mark each line Keep, Scope (move to path-scoped instructions, a prompt file, a custom agent, or a skill), or Retire.

1. Always write clean, maintainable code.
2. This repository uses Node.js 20 and TypeScript 5.4 with strict mode enabled.
3. Be a helpful and thorough assistant.
4. All API handlers must validate input using the `zod` schemas in `src/schemas/`.
5. Follow SOLID principles and general software engineering best practices.
6. Files under `services/billing/` must never log raw credit card numbers — mask
   all but the last 4 digits before writing to any log.
7. Prefer functional programming style where reasonable.
8. Run `npm test` and `npm run lint` before considering any change complete.

B2 — Customization inventory. Use this trigger reference, then classify each inventory item.

Customization How it enters context Cost pattern
Repo-wide, path-scoped, and personal custom instructions / AGENTS.md Automatically, on every interaction within its defined scope Recurring — every in-scope turn carries it
Enabled built-in and MCP tool schemas Automatically — every enabled tool's definition is advertised to the model Recurring — grows with the number of enabled tools
Prompt files (*.prompt.md) Manually — referenced in chat or picked from the prompt picker On demand — only the run you invoke
Custom agents (.github/agents/*.md) Manually selected from the agent picker, or delegated to Scoped — its instructions and tool restrictions apply inside that agent's own context, not your main thread
Agent skills (SKILL.md) Loaded when the skill is chosen as relevant to the prompt On demand — the skill body enters context only when the skill is used
Subagents Spawned by the main agent for delegated work Isolated — runs in its own context instead of enlarging the parent thread
Item Description Keep / Scope / Retire Why
A .github/copilot-instructions.md contains a 180-line API style guide that only applies to services/api/
B .github/prompts/release-notes.prompt.md, invoked about twice a month
C .github/agents/security-reviewer.md, a custom agent selected for security-sensitive pull requests
D .github/skills/deploy-runbook/SKILL.md, a long deployment runbook used a few times per release
E An enabled MCP server advertising 40 tools, of which the team regularly uses 3
F A repo-wide instruction line, "prefer tabs over spaces," already enforced by the formatter in CI

Tip: In Copilot CLI, /context shows how the context window is split across instructions, tool definitions, message history, free space, and buffer. Use it to confirm where your recurring cost actually is before trimming.

Part C — Task-Based MCP and Tool Pruning (6 min)

Task in scope: "Triage and fix a failing CI check on an open pull request in this repository."

Classify every enabled tool as Required, Optional, or Remove for that task, then mark whether the tool reads only or can write (change state, comment, merge, deploy, or spend).

# Enabled tool Read or write Required / Optional / Remove
1 Workspace file read and search (built-in) Read
2 Terminal command execution — run the test suite and linter locally (built-in) Write (local)
3 GitHub MCP — read pull request details and checks Read
4 GitHub MCP — read workflow run logs Read
5 GitHub MCP — merge a pull request Write
6 GitHub MCP — create an issue Write
7 Issue-tracker MCP — full 25-tool catalog for a separate project-management system Read and write
8 Browser-automation MCP — drive a browser for end-to-end UI testing Write
9 Internal deployment MCP — trigger a production deployment Write and spend

Part D — Copilot Memory Triage: Keep / Delete / Never Store (2 min)

Paper exercise — do not edit a live memory store during this lab. Work from the four supplied candidate entries below.

Verdict Use it when
Keep Durable, still accurate, and safe to persist as a repository fact or personal preference
Delete Was reasonable to store, but is now stale, wrong, or obsolete — current-branch validation should skip a contradicted repository fact, but it should still be removed
Never store Must not enter memory at all: secrets, credentials, tokens, customer-sensitive or personal data, and one-time task detail
# Candidate memory entry Stored as Keep / Delete / Never store Action you would take
1 "This repository builds with npm run build:all and its tests run with npm test." Repository fact
2 "The billing service is REST-only; the team rejected GraphQL." — the team shipped a GraphQL gateway for billing last quarter Repository fact
3 "For this sprint, the discount fix goes on branch fix/discount-guard under ticket PAY-1487." Repository fact
4 "The payments sandbox API token is <EXAMPLE-TOKEN-VALUE>." — captured from a session where the token was pasted in to debug a 401 Repository fact

Tip: The 28-day retention default is not a hygiene control. A repository fact that conflicts with the current branch should fail validation and be skipped, but obsolete entries still need review; sensitive content should never sit in the store at all.

Answer Key

Part A: The model After prompt is a strong example — it names the exact file/function (context), states the wrong behavior and the fix (task), and gives a concrete stop condition (tests pass, one new test, no unrelated refactors). If your draft is missing one of these three elements, revise it now.

Part B1:

Line Verdict Why
1 Retire Generic filler — true of every codebase, adds no signal
2 Keep Specific, grounded fact the agent needs (language/version/mode)
3 Retire Generic filler, not an instruction at all
4 Keep Specific, actionable, references a real path
5 Retire Generic best-practice advice, not grounded in this repo
6 Keep Highly specific, safety-critical, references a real path
7 Scope Reasonable style preference, but better placed in path-scoped instructions than carried on every repo-wide turn
8 Keep Specific, actionable build/test commands

Part B2:

Item Verdict Why
A Scope Always-on and recurring today, but only relevant to one directory — move it to .github/instructions/*.instructions.md scoped to services/api/** so it loads only when relevant
B Keep A prompt file is on demand. Low usage is not a reason to retire it — its full body is not injected on turns when you do not invoke it
C Keep A custom agent is selected deliberately and runs with its own instructions and tool restrictions, so its full instruction body does not load into every main-thread turn
D Keep A skill body enters context only when the skill is chosen as relevant, so length is far less costly here than in always-on instructions
E Scope Enabled tool schemas are recurring context — reduce to the toolsets the work actually needs (this is exactly what Part C practices)
F Retire Redundant with a deterministic check that already enforces it; instructions that duplicate a formatter or linter add recurring tokens for no behavior change

Key teaching point: only items A, E, and F changed anything about recurring cost. "More customization" is not automatically "more cost per turn" — always-on instruction scope and enabled tool schemas are where the recurring cost concentrates.

Part C:

# Verdict Read/write Why
1 Required Read You cannot triage a failure without reading the code and tests
2 Required Write (local) Reproducing the failure locally is the deterministic check that proves the fix
3 Required Read The PR's failing check is the subject of the task
4 Required Read The workflow logs contain the actual failure signal
5 Remove Write Merging is a human decision and is not part of "triage and fix"
6 Optional Write Justified only if triage concludes the fix belongs in separate follow-up work
7 Remove Read and write 25 tool definitions of unrelated project management, carried on every turn for no task benefit
8 Remove Write End-to-end UI automation is a different task shape; add it back when the task is a UI failure
9 Remove Write and spend Never in scope for CI triage; a spend-capable tool needs a much stronger justification than convenience

Read/write boundary: after pruning, the surviving set is four read tools plus one local-execution tool, with one optional write tool that files an issue. Nothing that merges, deploys, or spends money stays enabled for this task.

Part D:

# Verdict Why Action
1 Keep A stable build/test command is exactly what repository-level memory is for — durable, specific, and re-checkable against the current branch Leave it in place; revisit when the build tooling actually changes
2 Delete The decision was true when stored and is wrong now. Current-branch validation should skip it once the GraphQL gateway contradicts its citations, but leaving obsolete state in the store is poor hygiene Delete it now, and put the current, team-owned architecture rule in custom instructions where it is versioned and code-reviewed
3 Never store Ticket numbers, sprint scope, and temporary branch names are prompt content, not durable facts — this should never have been persisted Delete the entry and pass sprint/ticket detail in the prompt for the one task that needs it
4 Never store Secrets and credentials never belong in memory, instruction files, or prompts. Storing one turns a transient paste into persistent exposure Treat it as a credential exposure: rotate or revoke the token through your secret store and report it per your security process first, then delete the entry

Key teaching point: Delete and Never store are different failures. Delete is a review problem — a legitimate fact went stale. Never store is a boundary problem — the content should not have entered memory at all, and for a credential the deletion is the last step, not the fix.

Success Criteria

  • ✅ Your "After" prompt names a specific file/area, describes expected behavior, and states a stop condition
  • ✅ You marked lines 1, 3, and 5 as generic filler to retire
  • ✅ You marked lines 2, 4, 6, and 8 as specific and grounded — keep
  • ✅ You did not retire line 6 (a safety-critical, specific instruction)
  • ✅ You scoped item A rather than deleting it, and named the surface you would move it to
  • ✅ You kept items B, C, and D and can explain that their full bodies load on demand rather than on every turn
  • ✅ Your tool inventory keeps items 1–4, and removes items 5, 7, 8, and 9
  • ✅ You can state which surviving tools can write or spend, and justify each one against the named task
  • ✅ You can name /context as the place to confirm how much of the window instructions and tool definitions consume
  • ✅ Entry 1 is the only memory entry you marked Keep
  • ✅ You marked entry 2 Delete and can explain both the current-branch validation safeguard and why obsolete state still needs removal
  • ✅ You marked entries 3 and 4 Never store, not merely Delete
  • ✅ Your action for entry 4 starts with rotating or revoking the credential, not with deleting the memory entry
  • ✅ You can state the difference between Delete (was valid, now stale) and Never store (must never be persisted), and did not treat the 28-day expiry as a hygiene control

Lab 3: Session Design, Session Limit & Clean-Session Handoff (12 min)

Workshop Section: 3 — Session Lifecycle, Handoff, Cache & Session Limits

Roles

  • Work individually, then discuss as a table

Starting State

Use the six supplied scenarios and the command reference for Parts A and B. For Part C, assume the investigation is complete, no code has changed, and the listed technical decision has already been approved.

Part A — Session Design & Cache Check (5 min)

Use this command reference, then decide whether to continue the current session, start a new one, compact, inspect, resume, or expand file scope.

Command Use It When
/new or /clear The problem or work phase changed
/resume A saved session still matches the task
/usage You need current session usage metrics
/context You need to inspect context-window consumption
/compact [focus] A still-relevant thread has grown large
/cwd You need to inspect or change the working-directory root
/add-dir One additional directory is genuinely required
  1. You just finished debugging an auth issue and now want to ask an unrelated question about a CSS layout bug
  2. Your Copilot CLI thread has been open for two hours on the same refactor and is starting to feel sluggish
  3. You finished research and a plan for a feature and are about to start implementation
  4. You return to yesterday's Chat session to ask one more follow-up question on the same topic. State which cache-expiration window applies and name one change that would invalidate reusable cached context
  5. You want to confirm whether tool definitions or message history are consuming most of a long CLI session
  6. A task in the current repository needs one sibling directory, but not access to the rest of the parent directory

Part B — Session Limit Worksheet (3 min)

AI-credit session limits are in public preview. Define a soft limit for a Copilot CLI task you run regularly (or a hypothetical one):

Field Your Answer
Task the session limit applies to _______
Session limit amount (AI credits) _______
Why this amount (based on task size/history) _______
What you'll do if the agent stops at the limit _______

Write the interactive command using your amount:

/limits set max-ai-credits NUMBER

If Copilot CLI is installed, you may run that command, confirm that the CLI reports the limit was set, and then remove it:

/limits unset

Do not submit a model prompt for this checkpoint. Setting and unsetting the control demonstrates the configuration without making a paid AI request. If Copilot CLI is unavailable, review the commands on paper and state the expected behavior: an in-progress response may finish slightly over the soft limit; interactive CLI prompts you to reset or raise it; non-interactive CLI ends. If the CLI opens but either command returns an error, stop the live variation, use the same paper fallback, and verify the installed CLI version and current command syntax after the timed exercise.

The Copilot SDK equivalent is sessionLimits.maxAiCredits when creating or resuming a session. See CLI session limits and SDK session limits.

Part C — Clean-Session Handoff (4 min)

Scenario: You have spent 40 minutes in a Copilot CLI session investigating why the nightly job occasionally issues a refund twice. You confirmed the cause is a retry path in src/billing/refund-worker.ts that re-enqueues a refund without an idempotency key. You ruled out the payment provider using its API logs. Your tech lead agreed the fix is an idempotency key derived from the refund ID, stored in refund_attempts, and that changing the provider client is out of scope for this ticket. The existing integration test file is tests/billing/refund-worker.test.ts. You are now starting implementation in a fresh session.

Write the handoff you would paste as the first message of the new session:

Field Your Answer
1. Task and outcome _______
2. Current state _______
3. Important files _______
4. Decisions _______
5. Constraints _______
6. Next action and stop condition _______

Remember: the handoff complements the built-in controls — /compact reshapes the current thread, /resume reopens a saved one, and VS Code /fork branches a session that inherits full history. You write a handoff when you want a clean context rather than an inherited one.

Answer Key

Part A:

  1. New session — unrelated problem; carrying the auth debugging history into a CSS question wastes context
  2. /context, then /compact if warranted — the thread is still relevant; inspect it first, then compact to replace the large history with a smaller summary. Compaction uses a summarization step and can lose fine detail, so it is not an every-turn habit
  3. New session — a phase change (plan → implement); implementation needs only the plan's outcome, not the full research trail. This is the natural place to use the six-field handoff from Part C
  4. Depends on elapsed time and configuration stability — if the session is still within its cache-active window and on-topic, continuing may still benefit from cached context. The documented inactivity windows are currently 24 hours for OpenAI models and 1 hour for most others, so yesterday's session requires an elapsed-time check. Switching models; changing reasoning effort, context size, or enabled tools; or exceeding the inactivity window invalidates reusable cached context. Re-verify the windows before delivery
  5. /context — it breaks context usage down across instructions, system/MCP tools, messages, free space, and buffer
  6. /add-dir — add only the required sibling directory instead of broadening the working root to the entire parent

Part B: There's no single correct number — a good answer names a specific credit amount tied to the task's typical cost (for example, based on past /usage data or Chronicle cost tips), writes a syntactically valid /limits set max-ai-credits NUMBER command, and names a concrete next step (for example, "review what's been done so far, then raise the limit only if the remaining work is clearly scoped"). GitHub recommends a value above 30 credits because most model calls cost more than 20 credits.

Part C — model handoff (compare with your own; wording will differ, the six fields should not):

Field Model Answer
1. Task and outcome Stop duplicate refunds from the nightly job. Done = a refund retried by the worker never issues a second provider charge, proven by tests
2. Current state Root cause confirmed: the retry path in src/billing/refund-worker.ts re-enqueues without an idempotency key. Payment provider ruled out from its API logs. No code changed yet
3. Important files src/billing/refund-worker.ts, tests/billing/refund-worker.test.ts, and the refund_attempts table definition
4. Decisions Fix with an idempotency key derived from the refund ID, persisted in refund_attempts — agreed with the tech lead, so do not re-open alternative designs
5. Constraints Do not modify the payment provider client; out of scope for this ticket. Keep the existing retry/backoff behavior intact
6. Next action and stop condition Implement the idempotency key and add one regression test for the double-retry case. Stop when tests/billing/refund-worker.test.ts passes with the new test — no unrelated refactors

A weak handoff usually fails in field 4 or 5: it re-states the symptom but not the decisions already made, so the new session re-litigates the design and spends credits re-deriving a settled answer.

Success Criteria

  • ✅ You correctly chose "new session" for Scenario 1
  • ✅ You correctly chose "/context, then /compact if warranted" for Scenario 2
  • ✅ You correctly chose "new session" for Scenario 3
  • ✅ For Scenario 4, you checked the applicable cache-expiration window and named at least one cache invalidator
  • ✅ You chose /context for Scenario 5 and /add-dir for Scenario 6
  • ✅ Your session limit worksheet names a specific credit amount, includes a valid /limits set max-ai-credits NUMBER command, and states a concrete next step
  • ✅ You either completed the no-prompt set/unset checkpoint or correctly described its expected confirmation and cleanup
  • ✅ You identified sessionLimits.maxAiCredits as the equivalent Copilot SDK setting
  • ✅ Your handoff fills all six fields and names specific paths rather than "the repo"
  • ✅ Your handoff records at least one decision that must not be relitigated and one explicit out-of-scope constraint
  • ✅ Your handoff ends with one next action and a stop condition
  • ✅ You can explain why the handoff complements rather than replaces /compact, /resume, and VS Code /fork

Lab 4: Model Scenarios & Before/After Evaluation (12 min)

Workshop Section: 4 — Model Strategy, Verification & Before/After Evaluation

Roles

  • Work individually, then discuss as a table

Starting State

Use the supplied model scenarios, fixed task set, scoring rubric, and before/after results. Do not run the tasks against a live model unless the facilitator has approved that optional variation.

Part A — Model, Verification & False-Economy Scenarios (7 min)

Use this full-cost comparison for Scenario 5:

Option Full Cost per Attempt Durable Acceptance Rate Full Cost per Durable Accepted Outcome
Lightweight model $8.00 40% $8.00 ÷ 0.40 = $20.00
Powerful model $14.00 80% $14.00 ÷ 0.80 = $17.50

For each scenario, decide (a) Auto or a manual model choice (and if manual, lightweight or powerful), and (b) one quality-first verification step to pair with it. For Scenarios 4 and 5, also write the false-economy mistake that a token-only decision would make:

Scenario Auto or Manual Model? Verification Step
1. Formatting and updating documentation comments across a handful of files
2. Designing the approach for a cross-service architecture change before any code is written
3. A subagent tasked with only summarizing test failures from a CI run
4. A developer who insists on manually forcing the most powerful model for every single Chat question, "to be safe"
5. The model comparison above: which option is economically better, and what evidence is required before making it the team default?

Part B — Before/After Evaluation Worksheet (5 min)

A team ran the same frozen set of 6 representative tasks, each with a written acceptance rule, to test one question: does trimming always-on context help? No live calls are needed here — the arms below are supplied.

Stated assumptions: 1 AI credit = $0.01 USD; human review and rework valued at an illustrative blended $100/hour; durable acceptance means the result passed its written acceptance rule without material correction and stayed valid through the team's stabilization period.

Arm What changed Tasks AI credits AI cost Human review + rework Human cost Full cost Durable accepted
A — Before Baseline: 180-line repo-wide instructions, 40 MCP tools enabled 6 372 $3.72 3.0 h $300.00 $303.72 4 of 6
B — After One variable: always-on context trimmed (API guide scoped, tool set pruned to 6) 6 258 $2.58 2.0 h $200.00 $202.58 5 of 6
C — Another team's run Trimmed context and switched to a lightweight model 6 180 $1.80 4.5 h $450.00 $451.80 2 of 6

Complete the worksheet:

Question Your Answer
Full cost per durable accepted outcome — Arm A _______
Full cost per durable accepted outcome — Arm B _______
Full cost per durable accepted outcome — Arm C _______
Decision for Arm B: keep, revert, or retest? _______
What is wrong with how Arm C was run? _______
Your own loop: the one variable you would change _______
Your own loop: 5–10 tasks you would freeze _______
Your own loop: the written acceptance rule for one of those tasks _______

Optional and billable: if you later run this loop for real, capture the numbers with /usage and /context in Copilot CLI, the CLI Chronicle session data and cost tips, and whatever cost or session signals your IDE exposes. That is optional instrumentation, not a requirement of this lab.

Answer Key

Part A:

Scenario Auto or Manual Model? Verification Step
1 Lightweight model (or Auto) — routine, well-scoped task Linter/formatter check
2 Manual, powerful/reasoning model — architecture decisions justify the cost Peer/design review before implementation starts
3 Cheaper, scoped model — subagent context is narrow and doesn't inherit full history Confirm the summary matches the actual CI failure list
4 This is the "cheaper models are always safe" myth in reverse — Auto would be more efficient, since it already reserves powerful models for tasks that need them N/A — the fix here is adopting Auto as the default, not adding a check
5 Powerful model — $17.50 versus $20.00 per durable accepted outcome, despite its higher per-attempt cost Require representative samples, a defined outcome and stabilization period, and low/expected/high assumptions before standardizing

Part B:

Question Answer
Arm A $303.72 ÷ 4 = $75.93 per durable accepted outcome
Arm B $202.58 ÷ 5 = $40.52 per durable accepted outcome
Arm C $451.80 ÷ 2 = $225.90 per durable accepted outcome
Decision for Arm B Keep — full cost per durable accepted outcome improved (from $75.93 to $40.52) and durable acceptance did not get worse (4 of 6 → 5 of 6). Both conditions must hold
What is wrong with Arm C Two variables changed at once, so the result cannot be attributed to either. It is also the trap this loop exists to catch: it is the cheapest in AI credits ($1.80) and by far the most expensive per durable accepted outcome ($225.90), because acceptance collapsed and humans absorbed the rework. Rerun it as one variable at a time
Your own loop No single right answer — a good one names exactly one variable, a frozen set of 5–10 tasks you actually do, and an acceptance rule written before the run (for example, "the failing check passes and no unrelated file is modified")

Reading the numbers: AI credits are the small share of full cost in every arm here. That is the point of full cost per durable accepted outcome — a change that saves credits while lowering acceptance moves cost onto people, where it is larger and less visible. With 6 tasks, this is a directional team-level answer, not a statistically robust organization-wide claim.

Success Criteria

  • ✅ You chose a lightweight model (or Auto) for Scenario 1 and named a linting/formatting check
  • ✅ You chose a powerful/reasoning model for Scenario 2 and can justify why
  • ✅ You chose a cheaper, scoped model for the Scenario 3 subagent
  • ✅ You correctly diagnosed Scenario 4 as over-provisioning power without justification, and named Auto as the more efficient default
  • ✅ You chose the powerful model for Scenario 5 based on full cost per durable accepted outcome and named the evidence required before making it a default
  • ✅ You explained why Scenarios 4 and 5 cannot be decided from per-attempt token cost alone
  • ✅ Your three per-outcome figures match the answer key ($75.93 / $40.52 / $225.90, ±$0.01 rounding)
  • ✅ You decided to keep Arm B on both cost and acceptance grounds, not cost alone
  • ✅ You identified that Arm C changed two variables and was cheapest in credits while being worst in full cost
  • ✅ Your own loop names one variable, a frozen 5–10 task set, and an acceptance rule written before the run

Lab 5: 30-Day Personal/Team Habit Plan Capstone (8 min)

Workshop Section: 5 — Hands-On Optimization Capstone & Close

Roles

  • Work individually or in pairs

Starting State

Bring forward one useful decision from each prior lab, or use the workshop examples if you joined late. Start with the blank four-week worksheet below.

Steps

Draft a one-page 30-Day Habit Plan worksheet. The Description column is verbatim from the workshop guide's capstone list:

Week Focus Description Your Plan
1 Interface habit One task type you'll redirect from a billed interface to completions/NES, or vice versa if you're currently under-using Agent/CLI where it's warranted
2 Context & customization habit One trim you'll make to your own prompting habits, to a shared copilot-instructions.md/scoped instructions file, or to your enabled tool set — plus one Copilot Memory review
3 Session habit One session-boundary rule you'll adopt (for example, "new session when I switch tickets" or "/compact after 45 minutes on the same CLI thread"), and where you'll use the six-field handoff
4 Model, verification & evidence habit One task type where you'll let Auto decide, one where you'll deliberately choose a lightweight model, one deterministic check you'll add or enforce, and one change you'll put through the before/after evaluation loop

Success Criteria

  • ✅ Your plan names one specific interface change for Week 1
  • ✅ Your plan names one specific instructions/customization trim and one memory review for Week 2
  • ✅ Your plan names one specific, testable session-boundary rule for Week 3
  • ✅ Your plan names a model choice, a deterministic verification step, and one change you will evaluate with a fixed task set for Week 4

Key Reference Tables (Quick Lookup)

Billing Mental Model

Former Mental Model Usage-Based Billing Mental Model
Count premium requests Measure tokens and AI credits
Treat a request as one visible cost unit Account for prompt, context, history, tools, and output
Focus on model multipliers Use per-model, per-token-category pricing
Optimize request count Optimize cost per completed, verified task

Billed vs. Unbilled at a Glance

Interface Billed in AI Credits?
Code completions / Next Edit Suggestions No — unlimited on paid plans
Copilot Chat (Ask mode) Yes
Edit mode Yes
Agent mode Yes
Copilot CLI Yes
Copilot cloud agent Yes
Copilot Spaces Yes
GitHub Spark Yes
Third-party coding agents Yes

Note: GitHub Spark is included in GitHub's billed AI-credit feature list. Third-party coding agents are in public preview and consume AI credits plus GitHub Actions minutes. See About third-party coding agents and Usage-based billing for organizations and enterprises.

Clean-Session Handoff Template

Field What to write
1. Task and outcome The one task in scope and what "done" produces
2. Current state What is already implemented, verified, or ruled out
3. Important files The specific paths that matter, and nothing else
4. Decisions Choices already made that must not be relitigated, with a one-line reason each
5. Constraints Rules the work must respect — APIs, versions, patterns, security, out-of-scope areas
6. Next action and stop condition The single next step, and what "stop" looks like

Copilot Memory Hygiene (Public Preview)

Practice Detail
Know the scopes Repository-level facts and user-level preferences — there is no team- or org-scoped memory store
Review on a schedule Users view and delete their own preferences; repository owners review and delete repository-level facts
Delete wrong entries immediately Repository facts are current-branch validated, but obsolete entries still need removal; preferences rely on Copilot's judgment that they still apply
Never persist Secrets, credentials, tokens, customer-sensitive or personal data, or one-time task detail
Expect expiry Unused facts and preferences are deleted automatically after 28 days; the timer can reset on validated use

Source: About GitHub Copilot Memory.

False-Economy Myths

Myth Reality
"Shorter prompts are always cheaper" A too-short prompt often triggers costly follow-ups; scope and clarity matter more than raw length
"Never start a new session" Start fresh for an unrelated problem or a new work phase; avoid repeatedly restarting the same active task
"Cheaper models are always the safe default" A wrong or incomplete answer from an under-powered model often costs more in total than one correct answer from the right model
"Completions and Chat cost the same" Completions and next-edit suggestions are unlimited on paid plans and do not consume AI credits; Chat/Edit/Agent/CLI/cloud-agent usage does
"Cached input is always exactly 10x cheaper" Cached input is typically billed at about 10% of that model's fresh-input price (roughly 10x cheaper), but it is not universal — verify the selected model on the pricing page before quoting or encoding a ratio

If You Automate Copilot (Optional Next Step)

Every habit in this lab assumes a person is in the loop. When the same work runs unattended — Copilot CLI in a script, scheduler, or CI job, or a Copilot SDK service — those habits must become enforced configuration, pre-spend gates, and budget guardrails.

Optional Module 4 — Agent Fleet Efficiency and Cost Governance covers that work. It is an optional add-on outside the core curriculum duration, and its core exercises require no paid calls.


Hands-on lab guide for GitHub Copilot AI Credits Optimization — Module 2: Developer Efficiency (standalone; part of the GitHub Copilot AI Credits Optimization curriculum alongside Module 1 — Admin Guardrails and Module 3 — FinOps & Team Operating Model)