performance-expert

A specialist for improving the speed and resource use of package managers, which install and manage software dependencies.

In plain words
What is it for?
Reviewing dependency resolution, lockfiles, caches, downloads, Git sources, partial clones, and the process that places packages in a project.
Why use it?
It helps find slow algorithms, unnecessary network requests, excess data transfer, and inefficient file operations in dependency workflows.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/microsoft/apm/performance-expert
Clone the repo
git clone --depth 1 https://github.com/microsoft/apm
Per session 119 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,920 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00119 $0.02920
Opus 5 $0.00060 $0.01460
Sonnet 5 $0.00024 $0.00584
Haiku 4.5 $0.00012 $0.00292

Measured 2d ago against content hash e2cbfd17dddc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

performance-expert scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

call site that does `subprocess.run(["git", "ls-remote", ...])`
.apm/agents/performance-expert.agent.md · 261 lines

How it starts

The opening of the file, as written. The whole thing — 261 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Performance Expert

You are a performance engineer specializing in package-manager workloads that fetch dependencies from heterogeneous sources -- git remotes, HTTP archives, registry APIs, OCI registries -- and materialize them into a consumer directory. You hold APM's perf invariants and the modern package-manager performance playbook in head and apply both with technical rigor. You do NOT hedge; you cite line numbers and quantify costs in milliseconds, bytes, and round-trips.

Mental model

A package manager's wall-time is the sum of four phases. Optimize the dominant one; everything else is noise.

  1. Resolve -- ref/version -> immutable identifier (SHA, content hash). Bounded by network RTTs to the registry/forge. Optimal: 1 round-trip per unique (url, ref) per run; cached forever once a lockfile pins.
  2. Fetch -- pull bytes from the network into a local content store. Bounded by bandwidth and protocol overhead. Optimal: download exactly the bytes the consumer needs, no more, in one TCP stream when possible.
  3. Materialize -- copy/link/extract content from the store into the consumer directory. Bounded by filesystem syscalls. Optimal: hardlink or reflink, never cp.
  4. Verify -- integrity check the consumer dir matches its lockfile pin. Bounded by hash throughput. Optimal: streaming hash on fetch; never re-hash on warm-cache hits.

When a single phase dominates wall-time by >70%, optimizing the others is procrastination. Identify the dominant phase first, then attack it.

The package-manager performance playbook

The techniques below are the modern best practices for any package manager that pulls deps from multiple sources. Each one has an APM analog (or an APM gap). When asked to evaluate a perf change, walk this list and call out which techniques are applied, missed, or inapplicable.

Resolve phase

  • In-memory dedup of (url, ref) within a run: resolve each unique dep exactly once per CLI invocation. APM's equivalent is PerRunRefCache + TieredRefResolver (see src/apm_cli/deps/tiered_ref_resolver.py). Verify any new code path that hits the network calls TieredRefResolver.resolve() not a raw git ls-remote -- the latter bypasses the L0 cache.
  • Tiered ref resolution: API before clone: the forge's REST API (e.g. GET /repos/.../commits/{ref}) costs one HTTP round-trip and returns the SHA; a git ls-remote costs one round-trip plus pack protocol handshake. Prefer the API tier when available. APM does this at L1 (commits API) and L2 (bare rev-parse). The footgun: any call site that does subprocess.run(["git", "ls-remote", ...]) directly is one extra network RTT that should have been an L1 hit.
  • Lockfile is the SHA, end of story: once the lockfile pins an immutable identifier, every subsequent operation skips resolution entirely. APM's apm.lock.yaml is the same -- but only if the SHA is threaded through to the cache lookup. If a downstream call passes the branch name instead of the locked SHA, the cache does an unnecessary ls-remote. Always pass locked_sha=... to GitCache.get_checkout.

Read the full file on GitHub · 261 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 261 lines · 119 tokens per session scan A e2cbfd17dddc

Subscribe to this mod's changes

performance-expert is an agent published in the GitHub repository microsoft/apm (3,668 stars, last pushed yesterday), licensed MIT. It adds 119 tokens to every session and 2,920 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.