---
name: context-tax-audit
description: Inventory everything an agent injects into each request besides the user's message, such as system prompt, environment info, skill list, tool definitions, per-turn context blocks and reminders, and check necessity, frequency, precision, position and prompt-cache impact. Use when reviewing an agent's prompt assembly, chasing low cache hit rates, or trimming per-turn overhead.
title: context-tax-audit
canonical_url: https://skilld.dev/gh/minimax-ai/mcode-stack/context-tax-audit
last_updated: 2026-10-30T23:03:42.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install minimax-ai/mcode-stack/context-tax-audit`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/context-tax-audit`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/minimax-ai/mcode-stack/context-tax-audit) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/context-tax-audit`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/context-tax-audit --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/context-tax-audit --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Context Tax Audit

Every request carries more than the user's sentence: system prompt,
environment info, the skill list, tool definitions, per-turn context blocks,
reminders. Most of it is worth paying for. The audit finds what is not, and
what is placed so that it breaks the prompt cache.

Companion to MCode Engineering Notes 05 (how the agent learns the
current time — and why stuffing `date` into the system prompt breaks the
prefix cache).
Plain-text checklist: `checklists/context-tax.md`.

## 1. Inventory one real request

Capture an actual request the agent sends (debug log, proxy, or the code that
assembles it). List every part except the user's message:

| Part | Where it sits | How often it changes | Tokens |
| --- | --- | --- | --- |

Count tokens with a tokenizer and name it; treat the counts as relative.
Do a fresh-session first request and a later turn, since they often differ.

## 2. Necessity - what breaks if you delete it?

For each part, write one sentence: "without this, the model would ...".
Typical answers: without environment info it guesses the OS and shell; without
the current time it assumes its training year; without a time budget it does
not wrap up before a deadline. If you cannot write the sentence, the part is a
candidate for removal.

## 3. Prompt-cache placement

Caches match on prefix. One changed byte invalidates everything after it.

1. Content that is **at the front and changes every request** is the most
   expensive. Move it later.
2. Content **written into history and never edited** costs once and then stays
   cacheable.
3. Content **attached only to the current request** is never cached and is
   paid at full price every time. Control its frequency.

Rules of thumb:

- Stable first, volatile last. Keep `# Environment` free of current time; put
  time in per-turn `<agent-context>` (or the equivalent user-message block).
- Never rewrite reminders already in history; change only future turns.
- Use only the precision you need. A timestamp to the second guarantees every
  copy differs once placement is already right.
- Request-only reminders never enter the cache — control how often they fire,
  but do not confuse that thrift with protecting the prefix.
## 4. Run the checklist

| Item | Question |
| --- | --- |
| Prefix awareness | Can you point to the stable prefix vs what changes every turn? |
| Necessity | For each part, where does the model go wrong without it? |
| Position | Is anything volatile inside the system prompt or tool definitions? (e.g. time in `# Environment`) |
| Frequency | Does a changing field need every turn / request, or only at the start, key points, or on change? |
| Precision | Does it need seconds, exact counts? Higher precision means more turn-to-turn variation. |
| History | Are reminders already in history ever rewritten later? |
| Recovery paths | If you remove something, does it vanish entirely on compaction, session resume or subagents? Who restores it? |
| Measurement | Before and after a change, do you look at cache hit rate, cost per turn and task quality, not just token count? |

## Output

The inventory table, a list of parts to cut, move, reduce in frequency or
reduce in precision (each with the reason), and what to measure to confirm
the change helped.
