Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"name": "turntax",
"source": "./plugins/turntax",
"description": "Measure the per-turn token cost of AI coding-agent instruction files and MCP servers, and preview safe fixes.",
"version": "0.9.0",
"version": "0.10.0",
"category": "development"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- id: turntax
name: turntax
description: Fail when an agent's instruction files go over a per-turn token budget (--max-tokens, or maxTokens in turntax.config.json).
entry: npx --yes turntax@0.9.0
entry: npx --yes turntax@0.10.0
language: system
pass_filenames: false
always_run: true
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.10.0 (2026-11-08)

- GitHub Copilot is modelled on what Copilot CLI 1.0.107 loads, checked with `scripts/observe.mjs` (62 of 62 checks), instead of the legacy VS Code Local harness. VS Code's Copilot harness shares that runtime. Counts change:
- `GEMINI.md` is read with `AGENTS.md` and `CLAUDE.md`, and nested copies of all three load when Copilot works in their folder.
- `@imports` in `AGENTS.md` and `CLAUDE.md` are followed.
- `.claude/rules` without `paths`, instructions files with no front matter (observed) and with `applyTo: **` or `**/*` load every turn.
- `.claude/CLAUDE.md` and `CLAUDE.local.md` are not read.
- With `--include-user`, `~/.claude/CLAUDE.md`, `~/.claude/rules` and `~/.claude/skills` no longer count for Copilot; `~/.copilot` and `~/.agents/skills` still do.
- An instructions file with a `description` and no `applyTo` keeps its description always and its body on demand; that case was not observed.
- A root `CLAUDE.md` over 4 MiB counts as not loaded for Claude Code, which skips it, and the finding says so.
- `scripts/observe.mjs` checks Copilot CLI too, and `--keep` keeps the fixtures for a closer look.

## 0.9.0 (2026-11-06)

- Claude Code's rules were also checked against Claude Code 2.1.296 itself. In three setups, the model reported all 41 checks as turntax counts them. `scripts/observe.mjs` runs the check, and [docs/how-it-counts.md](docs/how-it-counts.md) has the results.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Each agent's documented loading rules decide what is sent on every turn, what lo
| Devin Local / Devin CLI | `AGENTS.md`, `AGENTS.local.md`, `AGENT.md`, `.windsurfrules`, `CLAUDE.md` at every level, `.devin/rules/`, `.windsurf/rules/`, `.cursor/rules/`, skills |
| Factory Droid | `AGENTS.md` / `CLAUDE.md` (also in `.factory`, `.agents`, `.agent`), `DESIGN.md`, `.factory/skills`, `.agents/skills`, `.factory/droids` |
| Gemini CLI | `GEMINI.md`, skills in `.agents` and `.gemini` |
| GitHub Copilot | `.github/copilot-instructions.md`, `.github/instructions/`, `AGENTS.md`, `CLAUDE.md`, `.claude/rules`, skills in `.github`, `.claude`, `.agents` (VS Code Local harness defaults) |
| GitHub Copilot | `.github/copilot-instructions.md`, `.github/instructions/`, `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.claude/rules`, skills in `.github`, `.claude`, `.agents` (as Copilot CLI loads them) |
| Goose | `.goosehints`, `AGENTS.md`, `@`-included files, skills in `.agents`, `.goose`, `.claude` |
| Google Jules | root `AGENTS.md` |
| JetBrains Junie | `.junie/AGENTS.md`, or `AGENTS.md` with `.junie/rules/`, or `.junie/guidelines`; skills in `.junie`, `.agents` |
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: TorutDev/turntax@v0.9.0
- uses: TorutDev/turntax@v0.10.0
with:
max-increase: 500 # optional: fail when an agent grows by more than 500 tokens per turn
# max-tokens: 8000 # optional: absolute budget
Expand All @@ -232,7 +232,7 @@ The repository is also a [pre-commit](https://pre-commit.com) hook, which fails
```yaml
repos:
- repo: https://github.com/TorutDev/turntax
rev: v0.9.0
rev: v0.10.0
hooks:
- id: turntax
args: [--max-tokens, '8000']
Expand Down
32 changes: 18 additions & 14 deletions docs/how-it-counts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Rule folders inside a subdirectory (for example `packages/api/.claude/rules/` or

When an agent reads two skills with the same name at the same level, for example `.agents/skills/deploy/` and `.claude/skills/deploy/` (often symlinked copies), only the one from the folder that takes precedence is counted; the other is ignored with "same skill name as ...". A skill's name is its `name` frontmatter, else its folder name. The order is the agent's documented precedence; where its docs are silent, the order shown below is an assumption. Agents that list both copies (OpenAI Codex, GitHub Copilot, Devin Local / Devin CLI, and Warp, which also lists each skill's path) count both.

The rules below live in [`src/core/tools.ts`](../src/core/tools.ts). Each entry cites the page it came from; all were checked on 2026-11-06, except Windsurf Cascade (see its entry).
The rules below live in [`src/core/tools.ts`](../src/core/tools.ts). Each entry cites the page it came from; all were checked on 2026-11-06, Copilot on 2026-11-08, except Windsurf Cascade (see its entry).

## Checked against the agents

Expand All @@ -22,6 +22,8 @@ The rules come from the vendors' docs. [`scripts/observe.mjs`](../scripts/observ
| Agent | Version | Date | Result |
| --- | --- | --- | --- |
| Claude Code | 2.1.296 | 2026-11-06 | 41 of 41 checks as turntax expects, in three setups |
| Claude Code | 2.1.296 | 2026-11-08 | 39 of 41: in both setups that list it, a command's description was missing (see below) |
| GitHub Copilot CLI | 1.0.107 | 2026-11-08 | 62 of 62 in two setups, twice, after turntax took up what the CLI loads |
| OpenAI Codex | | | not run yet |

In Claude Code, started at the root of the repository:
Expand All @@ -31,7 +33,11 @@ In Claude Code, started at the root of the repository:

After Claude reads a file in a subfolder, that folder's `CLAUDE.md` and a rule with `paths` for it load too. With `AGENTS.md` and no `CLAUDE.md`, `AGENTS.md` loads.

To run the check yourself, install and sign in to the agents, then run `npm run build` and `node scripts/observe.mjs`. Each setup is one short prompt on your own account.
On 2026-11-08 Claude Code listed the command by name with no description, in every run that day. The likely cause, not confirmed: its skill listing is capped at 1% of the context window, and past that it drops the descriptions of the least-used entries, and the account used for the run had many plugin skills. A small fixture with only that command and one skill listed both descriptions. turntax counts every description and does not apply that cap.

Copilot CLI did not list what its instructions say when asked, so each Copilot fixture file gives it a project code to repeat, and the skills it lists are read from the CLI's own `session.skills_loaded` event. The first run disagreed with turntax's model of the VS Code Local harness in 14 of 31 checks at the root; turntax now models what the CLI loads, described under [GitHub Copilot](#github-copilot). Copilot CLI loads repository instructions only in a folder you trust; the script passes `--trust-folder`.

To run the check yourself, install and sign in to the agents, then run `npm run build` and `node scripts/observe.mjs` (`--agents claude-code,copilot,codex` picks some, `--keep` keeps the fixtures). Each setup is one short prompt on your own account.

## Claude Code

Expand Down Expand Up @@ -97,24 +103,23 @@ Which skill folder wins on a name clash is not documented; `.agents`, `.cursor`,

Sources: VS Code [custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions), [settings](https://code.visualstudio.com/docs/agents/reference/ai-settings) and [skills](https://code.visualstudio.com/docs/agent-customization/agent-skills); GitHub [repository instructions](https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions), [Copilot CLI instructions](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions), [support by surface](https://docs.github.com/en/copilot/reference/custom-instructions-support) and [skills](https://docs.github.com/en/copilot/concepts/agents/about-agent-skills)

Copilot surfaces read different files. turntax models the defaults of VS Code's Local harness (the `chat.useAgentsMdFile`, `chat.useClaudeMdFile` and `chat.useNestedAgentsMdFiles` settings are documented for Local harness sessions):
Copilot surfaces read different files. turntax models Copilot CLI 1.0.107 as observed on 2026-11-08 (see [Checked against the agents](#checked-against-the-agents)). VS Code's Copilot harness shares the Copilot CLI runtime ([agent harnesses](https://code.visualstudio.com/docs/agents/concepts/agent-harnesses)), so it is assumed to read the same files.

| File | Mode |
| --- | --- |
| `.github/copilot-instructions.md` | always |
| `.github/instructions/**/*.instructions.md` | `applyTo` on-demand; `description` only: description always, body on-demand; neither: manual |
| `AGENTS.md` at the root | always (`chat.useAgentsMdFile`, on by default) |
| `CLAUDE.md`, `.claude/CLAUDE.md`, `CLAUDE.local.md` at the root | always (`chat.useClaudeMdFile`, on by default), together with `AGENTS.md` |
| `.claude/rules/**/*.md` | on-demand: `paths`, which defaults to `**` |
| `AGENTS.md` or `CLAUDE.md` in a subdirectory | ignored (nested `AGENTS.md` needs `chat.useNestedAgentsMdFiles`, off by default) |
| `.github/copilot-instructions.md` | always; `@imports` in it are not followed |
| `.github/instructions/**/*.instructions.md` | always with no front matter or `applyTo: **` (`**/*` is assumed the same); other `applyTo` on-demand; `description` and no `applyTo`: description always, body on-demand |
| `AGENTS.md`, `CLAUDE.md` and `GEMINI.md` at the root | always, all together; `@imports` in `AGENTS.md` and `CLAUDE.md` are followed (at least six hops were) |
| `AGENTS.md`, `CLAUDE.md` or `GEMINI.md` in a subdirectory | on-demand, when Copilot works on a file there |
| `.claude/rules/**/*.md` | always without `paths`; on-demand with `paths` |
| `.claude/CLAUDE.md`, `CLAUDE.local.md` | ignored |
| `.github/skills/*/SKILL.md`, `.claude/skills/*/SKILL.md`, `.agents/skills/*/SKILL.md` | description always; body on-demand; `disable-model-invocation: true` manual; same-name skills in two folders are both counted |

Treating a description-only instructions file's description as always in context is an inference; VS Code says the agent decides from it. VS Code does not expand `@imports`. Other surfaces:
The docs say less than this, and in places differ: Copilot CLI's page also lists `.claude/CLAUDE.md` and imports in `copilot-instructions.md`, which the CLI did not read when observed, and no page says that an instructions file without front matter loads every turn. VS Code's docs say the agent decides from a `description`; files with one and no `applyTo` were not observed and are counted that way. Other surfaces:

- Copilot CLI reads `AGENTS.md`, `CLAUDE.md`, `.claude/CLAUDE.md` and `GEMINI.md` from the repository root, the working directory, the folders between and the folders of files it works on, combines them all, and expands `@path` references in `copilot-instructions.md`, `AGENTS.md` and `CLAUDE.md`.
- The legacy VS Code Local harness reads `CLAUDE.md`, `.claude/CLAUDE.md` and `CLAUDE.local.md` at the root, `.claude/rules` on demand, nested `AGENTS.md` only with `chat.useNestedAgentsMdFiles` (off by default), and no `GEMINI.md`. It also reads `~/.claude/CLAUDE.md`, `~/.claude/rules` and `~/.claude/skills`, which are not counted for Copilot.
- Copilot cloud agent uses the nearest `AGENTS.md`, or a single root `CLAUDE.md` or `GEMINI.md` instead.
- VS Code's Copilot harness shares the Copilot CLI runtime ([agent harnesses](https://code.visualstudio.com/docs/agents/concepts/agent-harnesses)), so it is assumed to read what the CLI reads, `GEMINI.md` included. `GEMINI.md` is not counted for Copilot, because the Local harness modelled here does not document it.
- Copilot code review also reads `REVIEW.md` and uses only skills in `.github/skills`.
- Copilot code review also reads `REVIEW.md`.

## Windsurf Cascade

Expand Down Expand Up @@ -360,7 +365,6 @@ With `--include-user`, files in the home directory are classified by the same ru
| `~/.gemini/GEMINI.md`, `~/.gemini/skills/` | Gemini CLI ([GEMINI.md](https://geminicli.com/docs/cli/gemini-md/), [skills](https://geminicli.com/docs/cli/skills/)) | root `GEMINI.md`, `.gemini/skills` |
| `~/.cursor/skills/`, `~/.claude/skills/`, `~/.codex/skills/` | Cursor ([skills](https://cursor.com/docs/skills)) | the same folders |
| `~/.copilot/copilot-instructions.md`, `~/.copilot/instructions/**/*.instructions.md`, `~/.copilot/skills/` | GitHub Copilot ([instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions), [skills](https://code.visualstudio.com/docs/agent-customization/agent-skills)) | `.github/copilot-instructions.md`, `.github/instructions/`, `.github/skills` |
| `~/.claude/CLAUDE.md`, `~/.claude/rules/`, `~/.claude/skills/` | GitHub Copilot in VS Code ([instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions), [settings](https://code.visualstudio.com/docs/agents/reference/ai-settings)) | the same paths |
| `~/.codeium/windsurf/memories/global_rules.md` | Windsurf Cascade ([rules](https://docs.devin.ai/desktop/cascade/memories)) | always loaded; limited to 6,000 characters |
| `~/.codeium/windsurf/skills/`, `~/.config/devin/skills/` | Windsurf Cascade ([skills](https://docs.devin.ai/desktop/cascade/skills)) | `.windsurf/skills`, `.devin/skills` |
| `~/Documents/Cline/Rules/`, `~/Cline/Rules/`, `~/.cline/rules/` | Cline ([rules](https://docs.cline.bot/customization/cline-rules)) | `.clinerules/` |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "turntax",
"version": "0.9.0",
"version": "0.10.0",
"description": "Measure the per-turn token cost of AI coding-agent instruction files (AGENTS.md, CLAUDE.md, Cursor, Copilot, Cline, Roo, Kiro, Windsurf and more) for every agent that reads them.",
"mcpName": "io.github.TorutDev/turntax",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions plugins/turntax/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "turntax",
"version": "0.9.0",
"version": "0.10.0",
"description": "Measure the per-turn token cost of AI coding-agent instruction files (AGENTS.md, CLAUDE.md, Cursor rules and more) and MCP servers, and preview safe fixes.",
"author": {
"name": "TORUT LTD",
Expand All @@ -15,7 +15,7 @@
"mcpServers": {
"turntax": {
"command": "npx",
"args": ["-y", "turntax@0.9.0", "mcp"]
"args": ["-y", "turntax@0.10.0", "mcp"]
}
}
}
2 changes: 1 addition & 1 deletion plugins/turntax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Measures how many tokens your agent instruction files (CLAUDE.md, `.claude/rules

## What it runs and sends

The server runs `npx -y turntax@0.9.0 mcp` on your machine. npx downloads the `turntax` package from npm on first use. `package.json` and `package-lock.json` in this folder pin the same version and its one dependency, with integrity hashes. The tools read instruction files and MCP configs in the folder you audit. They do not start the MCP servers they find, do not call any vendor API, and send nothing over the network.
The server runs `npx -y turntax@0.10.0 mcp` on your machine. npx downloads the `turntax` package from npm on first use. `package.json` and `package-lock.json` in this folder pin the same version and its one dependency, with integrity hashes. The tools read instruction files and MCP configs in the folder you audit. They do not start the MCP servers they find, do not call any vendor API, and send nothing over the network.

## Install

Expand Down
8 changes: 4 additions & 4 deletions plugins/turntax/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/turntax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"description": "Pins the turntax package that this plugin's MCP server runs (npx -y turntax@<version> mcp).",
"license": "MIT",
"dependencies": {
"turntax": "0.9.0"
"turntax": "0.10.0"
}
}
Loading
Loading