Skip to main content

Posts

Setting a spending limit in GitHub Copilot CLI

There’s a moment when you hand a bigger task to Copilot CLI and wonder what it’s going to cost you. By default GitHub Copilot runs until the task is done or until you step in. Yesterday I showed how to tackle this in Claude Code. Today let’s have a look on how GitHub lets you cap that. Remark: Like with Claude Code, this isn’t a token limit. Copilot tracks AI credits, where each credit equals $0.01 USD. Usage depends on the model and the number of tokens consumed. Setting a limit in an interactive session Use /limits set : /limits set max-ai-credits 100 That’s a ceiling of $1.00. The limit applies to the entire session and depletes with every message, no matter how many messages you send.  To remove it again: /limits unset Setting a limit in non-interactive mode When you run the CLI programmatically, pass --max-ai-credits : copilot -p "Run the test suite and fix the failing tests" --max-ai-credits 100 Here the limit applies for the duration of Copilot’s...
Recent posts

Setting a spending limit on a Claude Code session

An agent that runs on its own stops when the task is done, not when your budget is. That’s fine for a quick question, but it’s a different story for a refactoring job in CI or a scheduled run overnight. So, the question becomes: how do you put a ceiling on a Claude Code session? Remark: Strictly speaking you can’t set a token limit. Claude Code caps on spend (tokens × price), so that’s what we’ll use. The naive approach Just run it and see what happens: claude -p "Run the test suite, fix the failing tests in src/ and commit the fix" There is no limit by default. Claude keeps going until it thinks it’s finished, and you find out the cost afterwards. Two flags can help Claude Code has two flags that act as a safety net in print mode ( -p ): claude -p "Run the test suite, fix the failing tests in src/ and commit the fix" \ --max-budget-usd 3.00 \ --max-turns 30 --max-budget-usd stops the run once the estimated spend on API calls reaches the...

Driving your AI agents in ECO mode

Planning and implementing are not the same kind of work. Planning needs a strong reasoning model that explores the codebase and weighs options. Implementing a clear, approved plan is mostly mechanical, and a cheaper, faster model can handle that. Picking one model for everything is not a good idea. You either overpay for the build, or you underpay for the plan. A colleague recently pointed out that JetBrains AI can split this, and it turns out Copilot can do something similar. Let’s look at both. Plan and build in VS Code The Plan agent in VS Code has its own model setting. Two settings matter: { "chat.planAgent.defaultModel": "<planning model>", "github.copilot.chat.implementAgent.model": "<implementation model>" } chat.planAgent.defaultModel is the model used by the Plan agent. github.copilot.chat.implementAgent.model is the model used when you click Start Implementation . Prefer to do it by hand in a Copil...

Let your agents cleanup after they leave your desk

If you let multiple agents work in parallel on your code base, you need a way to start an agent session with code isolation. The typical way to do this is by creating separate Git worktrees for each agent. This avoids that parallel agents overwrite each other’s files. But the sessions pile up, and so do the worktrees. Each one is a full checkout on your disk. Until recently I did the cleanup work myself, but now VSCode has a worktree cleanup feature to deal with this. Why do we need this? Before this feature, you had two options: do it by hand or ignore it. By hand meant something like this: git worktree list git worktree remove <path> git worktree prune That works. But it doesn’t tell you which worktree belongs to which agent session, whether the session is still relevant, or how much space you’ll get back. Archive, done or delete? Cleanup builds on how VS Code already finishes sessions. There are three actions: Close a chat tab: hides the conversation, not...

Track used skills, agents and MCP servers with the Copilot usage metrics API

As part of our AI adoption journey, we wanted to know which custom skills, agents and MCP servers were actually in use. So, we built a small tool that scanned our repositories for SKILL.md files, .agent.md files and MCP configuration. It worked, but it answered the wrong question. It told us what existed , not what developers used . The Copilot usage metrics API now closes that gap. What changed? In September the API got CLI customization metrics. The catch: every customer-defined skill, agent and MCP server was grouped under other , and slash commands under custom . Useful for trends, useless for “is our new skill being used?”. Since October 22, the totals_by_skill , totals_by_custom_agent , totals_by_mcp , totals_by_slash_cmd and totals_by_plugin arrays show the configured name of your own items. Each list also holds up to 25 entries per record, up from five. Remark: names are reported from Copilot CLI, the Copilot app, clients built on the Copilot SDK (like VS Code ...

Strongly typed IDs in .NET with Vogen

What does this method signature tell you? public Task<Order> GetOrder(Guid customerId, Guid orderId) Nothing that stops you from calling it like this: await repository.GetOrder(orderId, customerId); It compiles, it runs, and it returns nothing (or worse, the wrong thing). Every ID is a Guid , so the compiler can’t help you. This problem is called primitive obsession. We don't take real advantage of our type system but use any of the built-in primitives instead. The solution The obvious fix is a small wrapper type per ID. A readonly struct or a record does the job, but you end up writing the same boilerplate for every ID: equality, ToString , JSON serialization, a type converter for route binding, an EF Core value converter, Luckily someone already did all the hard work for us and created Vogen. Vogen is a source generator that does all the hard work. Add the package: dotnet add package Vogen And declare your ID: using Vogen; [ValueObject<Guid>]...

Generating architecture diagrams with the Archify skill

Keeping architecture diagrams up to date has always been a lot of work. They are outdated the moment your diagram is saved. Thanks to AI, keeping those diagrams up-to-date became a lot easier. I originally did this just by asking the AI to create and update mermaid diagrams, but recently I started experimenting with Archify . You describe a system in plain words (or point your agent at a codebase), and you get back an interactive HTML diagram. What is Archify? Archify is an agent skill and some tooling around it. It works with Claude Code, Codex, Cursor, OpenCode and GitHub Copilot. What makes it different, is that the agent doesn’t draw the diagram directly. It authors typed JSON that describes the system. Archify then renders that JSON and validates it. The output is a single, self-contained HTML file. Installing the skill For Claude Code: npx -y skills@latest add https://archify.si --skill archify --agent claude-code --global --copy --yes For GitHub Copilot: npx ...