From f26c4fa0dadec859753b90f9a50e401e6666bb81 Mon Sep 17 00:00:00 2001 From: Furkan Date: Mon, 9 Nov 2026 15:54:15 +0300 Subject: [PATCH 1/3] Claude Code skill listing budget finding; State recount - A finding when a repository's Claude Code skill and command descriptions pass the 30,000-character listing budget (1% of a 1M-token window, as Claude Code's debug log reports it), counted as Claude Code counts entries - scripts/state-of.mjs --recount counts an edition's repositories again at their pinned commits and prints how the headline and each agent move - Docs give the confirmed cause of Claude Code's 39 of 41: the account's listing was over budget --- CHANGELOG.md | 5 ++++ docs/how-it-counts.md | 4 ++-- scripts/state-of.mjs | 53 ++++++++++++++++++++++++++++++++++++++++++- src/core/advice.ts | 24 ++++++++++++++++++++ src/core/tools.ts | 23 ++++++++++++++++++- test/agents.test.ts | 25 ++++++++++++++++++++ 6 files changed, 130 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ad6028..193b4ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +- A finding when a repository's Claude Code skill and command descriptions pass the skill listing budget: 30,000 characters on a 1M-token context window, as Claude Code reports it in its debug log. Past it, Claude Code drops the descriptions of the skills invoked least. turntax counts each entry as Claude Code does, which matched its count for 160 skills to the character. +- `scripts/state-of.mjs --recount --out ` counts an edition's repositories again at the commits it pinned, with the current turntax, and prints how the median, the 90th percentile and each agent move. + ## 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: diff --git a/docs/how-it-counts.md b/docs/how-it-counts.md index 3b49a86..1807df7 100644 --- a/docs/how-it-counts.md +++ b/docs/how-it-counts.md @@ -33,7 +33,7 @@ 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. -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. +On 2026-11-08 Claude Code listed the command by name with no description, in every run that day. Its debug log (`--debug-file`) on 2026-11-09 gave the cause: "Skill listing over budget: 479 skills, 203121 chars > 30000 budget". The account used for the run has many plugin and user skills, so the listing was over budget before the fixture's skills were added, and Claude Code dropped descriptions of the skills invoked least. turntax counts every description and flags a repository whose own skills go over the budget (see [Claude Code](#claude-code)). 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`. @@ -54,7 +54,7 @@ Sources: [memory](https://code.claude.com/docs/en/memory), [skills](https://code | `.claude/agents/**/*.md` | description always; body is the subagent's own prompt | | `.claude/agents/` in a subdirectory | ignored: Claude Code finds subagents only from the launch directory up | -Claude Code caps the skill listing at 1% of the context window and drops the descriptions of the least-used skills past it; that cap is not applied. Skills with `paths` frontmatter are counted like other skills, since how they are listed is not documented. Claude Code warns at startup when the subagent descriptions together pass 15,000 tokens. +Claude Code fits the skill and command listing into 1% of the context window: 30,000 characters on a 1M-token window, as its debug log reports it, and twice that with `skillListingBudgetFraction: 0.02`. Past it, it drops the descriptions of the skills invoked least. turntax still counts every description, because user and plugin skills share the budget and which descriptions go depends on use; when the repository's own skill and command descriptions pass 30,000 characters, counted as Claude Code counts them (each entry `- name: description` and a newline, which matched its count for 160 skills to the character), a finding says so. Skills with `paths` frontmatter are counted like other skills, since how they are listed is not documented. Claude Code warns at startup when the subagent descriptions together pass 15,000 tokens. Claude Code skips a `CLAUDE.md` over 4 MiB at launch and loads none of it, and from 2.1.309 gives a `CLAUDE.md` or rule in a subdirectory only its first 40,000 characters on a 200K context window (more on a 1M window). `turntax` flags a `CLAUDE.md` or `CLAUDE.local.md` over 4 MiB at the root, in `.claude/` or in your home folder, and a `CLAUDE.md`, `CLAUDE.local.md` or `.claude/rules` file over 40,000 characters in a subfolder. The docs apply the 40,000 limit to path-scoped rules and to files imported by nested files too; turntax does not check those. A subdirectory's `AGENTS.md` loads only when that subdirectory has none of `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md`. diff --git a/scripts/state-of.mjs b/scripts/state-of.mjs index b4cad56..58e3445 100644 --- a/scripts/state-of.mjs +++ b/scripts/state-of.mjs @@ -6,10 +6,13 @@ * npm run build * GITHUB_TOKEN=$(gh auth token) node scripts/state-of.mjs [--limit 100] [--date YYYY-MM-DD] [--out web/state/YYYY-MM.json] * node scripts/state-of.mjs --index-only [--out web/state/YYYY-MM.json] + * GITHUB_TOKEN=$(gh auth token) node scripts/state-of.mjs --recount web/state/YYYY-MM.json --out * * --date reproduces an edition's selection (its selection.date): repositories pushed to in the 92 days before it. * After writing, editions.json next to --out is rebuilt from every YYYY-MM.json in that folder; * --index-only only rebuilds it, without the network or a token. + * --recount counts an edition's repositories again at the commits it pinned, with this turntax, and prints how the + * headline numbers move: a change between editions can come from the rules as well as from the repositories. * * Talks only to api.github.com (with the token) and raw.githubusercontent.com (without it). * Every file is read at the default branch's head commit, pinned by SHA. @@ -49,8 +52,10 @@ const { values: args } = parseArgs({ date: { type: 'string' }, out: { type: 'string' }, 'index-only': { type: 'boolean', default: false }, + recount: { type: 'string' }, }, }); +if (args.recount && !args.out) fail('--recount needs --out, outside web/state: a recount is not an edition.'); const LIMIT = Number(args.limit); if (!Number.isInteger(LIMIT) || LIMIT <= 0) fail('--limit must be a positive integer.'); const DATE = args.date ?? new Date().toISOString().slice(0, 10); @@ -232,7 +237,7 @@ async function scan(item) { async function scanRepo(item) { const fullName = item.full_name; - const sha = (await api(`/repos/${fullName}/commits/${encodeURIComponent(item.default_branch)}`, 'application/vnd.github.sha')).trim(); + const sha = item.sha ?? (await api(`/repos/${fullName}/commits/${encodeURIComponent(item.default_branch)}`, 'application/vnd.github.sha')).trim(); const tree = await api(`/repos/${fullName}/git/trees/${sha}?recursive=1`); if (tree.truncated) return { status: 'truncated' }; @@ -466,6 +471,7 @@ function summarize(repos) { } async function main() { + if (args.recount) return recount(args.recount); const generatedAt = new Date().toISOString(); const version = JSON.parse(readFileSync(resolve(ROOT, 'package.json'), 'utf8')).version; const engineCommit = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: ROOT, encoding: 'utf8' }).trim(); @@ -562,6 +568,51 @@ async function main() { writeIndex(dirname(OUT)); } +/** Counts an edition's repositories again at their pinned commits and prints how the headline numbers move. */ +async function recount(file) { + const before = JSON.parse(readFileSync(file, 'utf8')); + if (resolve(dirname(OUT)) === resolve(ROOT, 'web/state')) fail('--out must be outside web/state: a recount is not an edition.'); + const items = before.repos.map((r) => ({ full_name: r.full_name, stargazers_count: r.stars, language: r.language, default_branch: r.default_branch, sha: r.sha })); + const results = await mapLimited(items, REPO_CONCURRENCY, scan); + const repos = []; + const failed = []; + results.forEach((r, i) => { + if (r.status === 'qualifying') repos.push({ rank: before.repos[i].rank, ...r.record }); + else failed.push(`${items[i].full_name} (${r.status}${r.reason ? `: ${r.reason}` : ''})`); + }); + const summary = summarize(repos); + for (const r of repos) delete r._rootPair; + const version = JSON.parse(readFileSync(resolve(ROOT, 'package.json'), 'utf8')).version; + mkdirSync(dirname(OUT), { recursive: true }); + writeFileSync(OUT, `${JSON.stringify({ recountOf: before.edition, countedBefore: before.turntaxVersion, turntaxVersion: version, repos, summary }, null, 1)}\n`); + + const pick = (s) => ({ median: s.maxPerTurnO200kLinksOnce.median, p90: s.maxPerTurnO200kLinksOnce.p90 }); + const was = pick(before.summary); + const now = pick(summary); + const byName = new Map(before.repos.map((r) => [r.full_name, r])); + const perTurn = (r) => (r.maxPerTurnLinksOnce ?? r.maxPerTurn).o200k; + const moved = repos.map((r) => ({ name: r.full_name, was: perTurn(byName.get(r.full_name)), now: perTurn(r) })).filter((m) => m.was !== m.now); + // Per agent: how many repositories each agent loads more or less for. + const agents = {}; + for (const r of repos) { + const old = byName.get(r.full_name).agents; + for (const id of new Set([...Object.keys(old), ...Object.keys(r.agents)])) { + const d = (r.agents[id] ?? 0) - (old[id] ?? 0); + if (!d) continue; + const a = (agents[id] ??= { up: 0, down: 0, tokens: 0 }); + a[d > 0 ? 'up' : 'down']++; + a.tokens += d; + } + } + log(`Recount of ${before.edition} (counted with ${before.turntaxVersion}) with ${version}: ${repos.length} of ${items.length} repositories read again.`); + if (failed.length) log(`Not read: ${failed.join(', ')}`); + log(`Largest per-turn total, median ${was.median} -> ${now.median}, 90th percentile ${was.p90} -> ${now.p90}.`); + log(`${moved.length} repositories changed: ${moved.filter((m) => m.now > m.was).length} up, ${moved.filter((m) => m.now < m.was).length} down.`); + for (const [id, a] of Object.entries(agents).sort((x, y) => Math.abs(y[1].tokens) - Math.abs(x[1].tokens))) + log(` ${before.agentNames?.[id] ?? id}: ${a.up} up, ${a.down} down, ${a.tokens > 0 ? '+' : ''}${a.tokens} tokens in all`); + log(`Wrote ${OUT}.`); +} + /** The figures of one edition that the trend view compares; per-turn sizes count a symlinked file once, as the report does. */ function trendOf(edition, file, data) { const s = data.summary; diff --git a/src/core/advice.ts b/src/core/advice.ts index 6ac35b6..9fe8640 100644 --- a/src/core/advice.ts +++ b/src/core/advice.ts @@ -45,6 +45,7 @@ export function buildAdvice(units: LoadedUnit[], files: RepoFile[], opts: Advice const advice: Advice[] = [ ...misconfigured(units), ...sizeLimits(units, files), + ...listingBudgets(units), ...duplicates(units), ...contradictions(units, raw), ...sections(repo, opts.sectionTokens ?? DEFAULT_SECTION_TOKENS, raw, opts.exists), @@ -173,6 +174,29 @@ function sizeLimits(units: LoadedUnit[], files: RepoFile[]): Advice[] { return out; } +/** A tool's listed skill descriptions over the budget it fits them into. */ +function listingBudgets(units: LoadedUnit[]): Advice[] { + const out: Advice[] = []; + for (const tool of TOOLS) { + const budget = tool.listingBudget; + if (!budget) continue; + const listed = units.filter((u) => u.tool === tool.id && u.part === 'description' && u.mode === 'always' && budget.pattern.test(u.path)); + const chars = listed.reduce((n, u) => n + u.text.length + budget.perEntry, 0); + if (chars <= budget.chars) continue; + const largest = [...listed].sort((a, b) => b.text.length - a.text.length); + out.push({ + kind: 'size-limit', + severity: 'high', + tools: [tool.id], + paths: largest.slice(0, 3).map((u) => u.path), + message: `${listed.length} skill and command descriptions take about ${chars.toLocaleString('en-US')} characters, over the listing budget of ${budget.chars.toLocaleString('en-US')}. ${budget.text} Source: ${budget.source}`, + savingTokens: null, + savingNote: 'Fewer tokens load than counted, but skills past the budget lose the words Claude matches requests on; shorten descriptions or turn skills off.', + }); + } + return out; +} + /** Lowercased, whitespace-collapsed instruction lines long enough to be meaningful. */ function normalizedLines(text: string): Map { const out = new Map(); diff --git a/src/core/tools.ts b/src/core/tools.ts index ba411c9..aeb71a9 100644 --- a/src/core/tools.ts +++ b/src/core/tools.ts @@ -144,6 +144,17 @@ export interface SizeLimit { source: string; } +/** A budget the tool fits its skill listing into, dropping descriptions past it. */ +export interface ListingBudget { + /** Description units (by path) that share the budget. */ + pattern: RegExp; + chars: number; + /** Characters each entry adds around `name: description`. */ + perEntry: number; + text: string; + source: string; +} + export interface ToolSpec { id: ToolId; name: string; @@ -153,6 +164,7 @@ export interface ToolSpec { checkedAt: string; rules: FileRule[]; limits: SizeLimit[]; + listingBudget?: ListingBudget; notes: string[]; } @@ -292,10 +304,19 @@ export const TOOLS: ToolSpec[] = [ source: 'https://code.claude.com/docs/en/memory', }, ], + listingBudget: { + // Skills and commands share the listing; subagents are listed apart. + pattern: /(?:^|\/)\.claude\/(?:skills|commands)\//, + chars: 30000, + // "- " and a newline per entry: 160 skills measured 19,190 characters in Claude Code 2.1.296's own count. + perEntry: 3, + text: "Claude Code fits skill and command descriptions into 1% of the context window, 30,000 characters on a 1M-token window (a 200K window has a fifth of that). Past it, it drops the descriptions of the skills invoked least, and user and plugin skills share the same budget.", + source: 'https://code.claude.com/docs/en/skills', + }, notes: [ 'User files (~/.claude/CLAUDE.md, rules, skills, commands, agents) are counted only with --include-user; managed policy and auto-memory files are not counted.', 'With the "claude-md-and-agents-md" setting Claude Code reads AGENTS.md as well; the default reads it only when no CLAUDE.md exists.', - 'The skill listing is capped at 1% of the context window (skillListingBudgetFraction); past it, descriptions of the least-used skills are dropped. The cap is not applied here.', + 'The skill listing is capped at 1% of the context window (skillListingBudgetFraction): 30,000 characters on a 1M-token window, as Claude Code 2.1.296 reported it. Past it, descriptions of the least-used skills are dropped. Every description is still counted here, and a finding says when the repository alone goes over.', 'The 1,536-character description cap is configurable with skillListingMaxDescChars, and skillOverrides can list a skill by name only; neither is modelled.', 'Skills with paths frontmatter load automatically only for matching files; how they are listed is not documented, so they are counted like other skills.', 'Claude Code warns at startup when the combined subagent descriptions pass 15,000 tokens.', diff --git a/test/agents.test.ts b/test/agents.test.ts index 7abfdc4..9f54cf7 100644 --- a/test/agents.test.ts +++ b/test/agents.test.ts @@ -423,6 +423,31 @@ describe('Claude Code size limits', () => { }); }); +describe('Claude Code skill listing budget', () => { + const desc = (i: number) => `Handles workflow ${i} for reports, exports and audits of the billing service; use it when the user asks about ${i}.`.padEnd(190, '.'); + const skill = (dir: string, i: number, extra = '') => ({ path: `${dir}/s${i}/SKILL.md`, text: `---\nname: s${i}\ndescription: ${desc(i)}\n${extra}---\nBody.` }); + const budget = (files: Array<{ path: string; text: string }>) => + buildAdvice(classify(files, ['claude-code']), files).filter((a) => a.kind === 'size-limit' && /listing budget/.test(a.message)); + + it('flags skill and command descriptions over 30,000 characters', () => { + const files = [ + ...Array.from({ length: 140 }, (_, i) => skill('.claude/skills', i)), + ...Array.from({ length: 20 }, (_, i) => ({ path: `.claude/commands/c${i}.md`, text: `---\ndescription: ${desc(i)}\n---\nDo it.` })), + ]; + const [a] = budget(files); + expect(a).toMatchObject({ severity: 'high', tools: ['claude-code'], savingTokens: null }); + expect(a!.message).toMatch(/^160 skill and command descriptions take about 3\d,\d{3} characters, over the listing budget of 30,000\./); + expect(a!.paths).toHaveLength(3); + }); + + it('stays quiet under the budget, and leaves out subagents and skills hidden from the model', () => { + expect(budget(Array.from({ length: 100 }, (_, i) => skill('.claude/skills', i)))).toEqual([]); + const hidden = Array.from({ length: 200 }, (_, i) => skill('.claude/skills', i, 'disable-model-invocation: true\n')); + const agents = Array.from({ length: 200 }, (_, i) => ({ path: `.claude/agents/a${i}.md`, text: `---\nname: a${i}\ndescription: ${desc(i)}\n---\nPrompt.` })); + expect(budget([...hidden, ...agents])).toEqual([]); + }); +}); + describe('discovery patterns', () => { it('recognises the new agents files', () => { for (const p of [ From 1d8a93b7c820e5d72e51c5297a6b552c8c6442cd Mon Sep 17 00:00:00 2001 From: Furkan Date: Mon, 9 Nov 2026 16:05:54 +0300 Subject: [PATCH 2/3] Listing budget counts repository skills only; recount compares the same repositories; release 0.11.0 and extension 0.6.0 --- .claude-plugin/marketplace.json | 2 +- .pre-commit-hooks.yaml | 2 +- CHANGELOG.md | 4 ++-- README.md | 4 ++-- docs/how-it-counts.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- plugins/turntax/.claude-plugin/plugin.json | 4 ++-- plugins/turntax/README.md | 2 +- plugins/turntax/package.json | 2 +- scripts/state-of.mjs | 13 +++++++++---- server.json | 4 ++-- src/core/advice.ts | 4 +++- test/agents.test.ts | 9 +++++++++ vscode/CHANGELOG.md | 4 ++++ vscode/package-lock.json | 4 ++-- vscode/package.json | 2 +- 17 files changed, 44 insertions(+), 24 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 27bea37..92d72b4 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -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.10.0", + "version": "0.11.0", "category": "development" } ] diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 7fc323e..7dc526f 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -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.10.0 + entry: npx --yes turntax@0.11.0 language: system pass_filenames: false always_run: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 193b4ff..d18de2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog -## Unreleased +## 0.11.0 (2026-11-09) -- A finding when a repository's Claude Code skill and command descriptions pass the skill listing budget: 30,000 characters on a 1M-token context window, as Claude Code reports it in its debug log. Past it, Claude Code drops the descriptions of the skills invoked least. turntax counts each entry as Claude Code does, which matched its count for 160 skills to the character. +- A finding when a repository's Claude Code skill and command descriptions pass the skill listing budget: 30,000 characters on a 1M-token context window, as Claude Code reports it in its debug log. Past it, Claude Code drops the descriptions of the skills invoked least. turntax counts each entry as Claude Code 2.1.296 does, which matched its count for a fixture of 160 skills; user skills are left out. - `scripts/state-of.mjs --recount --out ` counts an edition's repositories again at the commits it pinned, with the current turntax, and prints how the median, the 90th percentile and each agent move. ## 0.10.0 (2026-11-08) diff --git a/README.md b/README.md index 1f68cec..50598ba 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: TorutDev/turntax@v0.10.0 + - uses: TorutDev/turntax@v0.11.0 with: max-increase: 500 # optional: fail when an agent grows by more than 500 tokens per turn # max-tokens: 8000 # optional: absolute budget @@ -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.10.0 + rev: v0.11.0 hooks: - id: turntax args: [--max-tokens, '8000'] diff --git a/docs/how-it-counts.md b/docs/how-it-counts.md index 1807df7..b4d87aa 100644 --- a/docs/how-it-counts.md +++ b/docs/how-it-counts.md @@ -54,7 +54,7 @@ Sources: [memory](https://code.claude.com/docs/en/memory), [skills](https://code | `.claude/agents/**/*.md` | description always; body is the subagent's own prompt | | `.claude/agents/` in a subdirectory | ignored: Claude Code finds subagents only from the launch directory up | -Claude Code fits the skill and command listing into 1% of the context window: 30,000 characters on a 1M-token window, as its debug log reports it, and twice that with `skillListingBudgetFraction: 0.02`. Past it, it drops the descriptions of the skills invoked least. turntax still counts every description, because user and plugin skills share the budget and which descriptions go depends on use; when the repository's own skill and command descriptions pass 30,000 characters, counted as Claude Code counts them (each entry `- name: description` and a newline, which matched its count for 160 skills to the character), a finding says so. Skills with `paths` frontmatter are counted like other skills, since how they are listed is not documented. Claude Code warns at startup when the subagent descriptions together pass 15,000 tokens. +Claude Code fits the skill and command listing into 1% of the context window: 30,000 characters on a 1M-token window, as its debug log reports it, and twice that with `skillListingBudgetFraction: 0.02`. Past it, it drops the descriptions of the skills invoked least. turntax still counts every description, because user and plugin skills share the budget and which descriptions go depends on use; when the repository's own skill and command descriptions pass 30,000 characters, counted as Claude Code counts them (each entry `- name: description` and a newline, which matched its count for a fixture of 160 skills to the character, with Claude Code 2.1.296), a finding says so. User skills from `--include-user` are left out of it, though they share the real budget. Skills with `paths` frontmatter are counted like other skills, since how they are listed is not documented. Claude Code warns at startup when the subagent descriptions together pass 15,000 tokens. Claude Code skips a `CLAUDE.md` over 4 MiB at launch and loads none of it, and from 2.1.309 gives a `CLAUDE.md` or rule in a subdirectory only its first 40,000 characters on a 200K context window (more on a 1M window). `turntax` flags a `CLAUDE.md` or `CLAUDE.local.md` over 4 MiB at the root, in `.claude/` or in your home folder, and a `CLAUDE.md`, `CLAUDE.local.md` or `.claude/rules` file over 40,000 characters in a subfolder. The docs apply the 40,000 limit to path-scoped rules and to files imported by nested files too; turntax does not check those. A subdirectory's `AGENTS.md` loads only when that subdirectory has none of `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md`. diff --git a/package-lock.json b/package-lock.json index c7d2594..e77a281 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "turntax", - "version": "0.10.0", + "version": "0.11.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "turntax", - "version": "0.10.0", + "version": "0.11.0", "license": "MIT", "dependencies": { "gpt-tokenizer": "4.1.0" diff --git a/package.json b/package.json index 9b93da3..a89c1ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "turntax", - "version": "0.10.0", + "version": "0.11.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", diff --git a/plugins/turntax/.claude-plugin/plugin.json b/plugins/turntax/.claude-plugin/plugin.json index 6e393e6..5150285 100644 --- a/plugins/turntax/.claude-plugin/plugin.json +++ b/plugins/turntax/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "turntax", - "version": "0.10.0", + "version": "0.11.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", @@ -15,7 +15,7 @@ "mcpServers": { "turntax": { "command": "npx", - "args": ["-y", "turntax@0.10.0", "mcp"] + "args": ["-y", "turntax@0.11.0", "mcp"] } } } diff --git a/plugins/turntax/README.md b/plugins/turntax/README.md index 4e8ca1e..045369f 100644 --- a/plugins/turntax/README.md +++ b/plugins/turntax/README.md @@ -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.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. +The server runs `npx -y turntax@0.11.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 diff --git a/plugins/turntax/package.json b/plugins/turntax/package.json index 928ccfe..15c3395 100644 --- a/plugins/turntax/package.json +++ b/plugins/turntax/package.json @@ -4,6 +4,6 @@ "description": "Pins the turntax package that this plugin's MCP server runs (npx -y turntax@ mcp).", "license": "MIT", "dependencies": { - "turntax": "0.10.0" + "turntax": "0.11.0" } } diff --git a/scripts/state-of.mjs b/scripts/state-of.mjs index 58e3445..fc93170 100644 --- a/scripts/state-of.mjs +++ b/scripts/state-of.mjs @@ -576,8 +576,11 @@ async function recount(file) { const results = await mapLimited(items, REPO_CONCURRENCY, scan); const repos = []; const failed = []; + const empty = []; results.forEach((r, i) => { if (r.status === 'qualifying') repos.push({ rank: before.repos[i].rank, ...r.record }); + // Read, but no agent loads anything from it any more: a change the rules made. + else if (r.status === 'none') empty.push(items[i].full_name); else failed.push(`${items[i].full_name} (${r.status}${r.reason ? `: ${r.reason}` : ''})`); }); const summary = summarize(repos); @@ -586,11 +589,12 @@ async function recount(file) { mkdirSync(dirname(OUT), { recursive: true }); writeFileSync(OUT, `${JSON.stringify({ recountOf: before.edition, countedBefore: before.turntaxVersion, turntaxVersion: version, repos, summary }, null, 1)}\n`); - const pick = (s) => ({ median: s.maxPerTurnO200kLinksOnce.median, p90: s.maxPerTurnO200kLinksOnce.p90 }); - const was = pick(before.summary); - const now = pick(summary); const byName = new Map(before.repos.map((r) => [r.full_name, r])); const perTurn = (r) => (r.maxPerTurnLinksOnce ?? r.maxPerTurn).o200k; + // Both sides over the repositories read again, so a repository that could not be read does not move the numbers. + const pick = (list) => ({ median: percentile(list.map(perTurn), 0.5), p90: percentile(list.map(perTurn), 0.9) }); + const was = pick(repos.map((r) => byName.get(r.full_name))); + const now = pick(repos); const moved = repos.map((r) => ({ name: r.full_name, was: perTurn(byName.get(r.full_name)), now: perTurn(r) })).filter((m) => m.was !== m.now); // Per agent: how many repositories each agent loads more or less for. const agents = {}; @@ -605,7 +609,8 @@ async function recount(file) { } } log(`Recount of ${before.edition} (counted with ${before.turntaxVersion}) with ${version}: ${repos.length} of ${items.length} repositories read again.`); - if (failed.length) log(`Not read: ${failed.join(', ')}`); + if (failed.length) log(`Not read, and left out of the comparison: ${failed.join(', ')}`); + if (empty.length) log(`No longer counted for any agent with these rules: ${empty.join(', ')}`); log(`Largest per-turn total, median ${was.median} -> ${now.median}, 90th percentile ${was.p90} -> ${now.p90}.`); log(`${moved.length} repositories changed: ${moved.filter((m) => m.now > m.was).length} up, ${moved.filter((m) => m.now < m.was).length} down.`); for (const [id, a] of Object.entries(agents).sort((x, y) => Math.abs(y[1].tokens) - Math.abs(x[1].tokens))) diff --git a/server.json b/server.json index ae12560..98e2941 100644 --- a/server.json +++ b/server.json @@ -8,12 +8,12 @@ "source": "github" }, "websiteUrl": "https://torutdev.github.io/turntax/", - "version": "0.10.0", + "version": "0.11.0", "packages": [ { "registryType": "npm", "identifier": "turntax", - "version": "0.10.0", + "version": "0.11.0", "runtimeHint": "npx", "packageArguments": [ { diff --git a/src/core/advice.ts b/src/core/advice.ts index 9fe8640..9aaf9a9 100644 --- a/src/core/advice.ts +++ b/src/core/advice.ts @@ -180,7 +180,9 @@ function listingBudgets(units: LoadedUnit[]): Advice[] { for (const tool of TOOLS) { const budget = tool.listingBudget; if (!budget) continue; - const listed = units.filter((u) => u.tool === tool.id && u.part === 'description' && u.mode === 'always' && budget.pattern.test(u.path)); + // The repository's own skills: user and plugin skills share the budget, but a finding on a repository file must be + // about the repository. + const listed = units.filter((u) => !u.scope && u.tool === tool.id && u.part === 'description' && u.mode === 'always' && budget.pattern.test(u.path)); const chars = listed.reduce((n, u) => n + u.text.length + budget.perEntry, 0); if (chars <= budget.chars) continue; const largest = [...listed].sort((a, b) => b.text.length - a.text.length); diff --git a/test/agents.test.ts b/test/agents.test.ts index 9f54cf7..3103563 100644 --- a/test/agents.test.ts +++ b/test/agents.test.ts @@ -7,6 +7,7 @@ import { classify } from '../src/core/classify.js'; import { getTool } from '../src/core/tools.js'; import { addImports, isInstructionFile } from '../src/core/files.js'; import { discover } from '../src/node/discover.js'; +import { classifyUser } from '../src/core/user.js'; import { find } from './helpers.js'; describe('Cline', () => { @@ -440,6 +441,14 @@ describe('Claude Code skill listing budget', () => { expect(a!.paths).toHaveLength(3); }); + it('counts only the repository: user skills (--include-user) neither trigger nor add to the finding', () => { + const repo = Array.from({ length: 100 }, (_, i) => skill('.claude/skills', i)); + const user = Array.from({ length: 100 }, (_, i) => skill('~/.claude/skills', i)); + const units = [...classify(repo, ['claude-code']), ...classifyUser(user).filter((u) => u.tool === 'claude-code')]; + expect(units.some((u) => u.scope === 'user' && u.part === 'description')).toBe(true); + expect(buildAdvice(units, [...repo, ...user]).filter((a) => /listing budget/.test(a.message))).toEqual([]); + }); + it('stays quiet under the budget, and leaves out subagents and skills hidden from the model', () => { expect(budget(Array.from({ length: 100 }, (_, i) => skill('.claude/skills', i)))).toEqual([]); const hidden = Array.from({ length: 200 }, (_, i) => skill('.claude/skills', i, 'disable-model-invocation: true\n')); diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index d039fc6..8219c23 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.6.0 + +- The engine of turntax 0.11.0: a finding when the repository's Claude Code skill and command descriptions pass the skill listing budget (30,000 characters on a 1M-token context window). + ## 0.5.0 - The engine of turntax 0.10.0: GitHub Copilot is counted as Copilot CLI loads instruction files (checked against Copilot CLI 1.0.107), which VS Code's Copilot harness shares, and a root `CLAUDE.md` over 4 MiB counts as skipped by Claude Code. diff --git a/vscode/package-lock.json b/vscode/package-lock.json index 5e2a90f..f4183ea 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "turntax", - "version": "0.5.0", + "version": "0.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "turntax", - "version": "0.5.0", + "version": "0.6.0", "license": "MIT", "devDependencies": { "@types/node": "20.19.43", diff --git a/vscode/package.json b/vscode/package.json index 933d4f7..9228404 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -2,7 +2,7 @@ "name": "turntax", "displayName": "turntax", "description": "Per-turn token cost of AI coding-agent instruction files (AGENTS.md, CLAUDE.md, Cursor rules, Copilot instructions, skills) in the status bar, with findings and safe fixes.", - "version": "0.5.0", + "version": "0.6.0", "publisher": "torut", "icon": "icon.png", "license": "MIT", From 6c01180d351e17147961795d55ceab4b225b6342 Mon Sep 17 00:00:00 2001 From: Furkan Date: Mon, 9 Nov 2026 16:24:31 +0300 Subject: [PATCH 3/3] Plugin lock pins the published turntax 0.11.0 --- plugins/turntax/package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/turntax/package-lock.json b/plugins/turntax/package-lock.json index 81acc27..15b44e1 100644 --- a/plugins/turntax/package-lock.json +++ b/plugins/turntax/package-lock.json @@ -7,7 +7,7 @@ "name": "turntax-claude-plugin", "license": "MIT", "dependencies": { - "turntax": "0.10.0" + "turntax": "0.11.0" } }, "node_modules/gpt-tokenizer": { @@ -17,9 +17,9 @@ "license": "MIT" }, "node_modules/turntax": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/turntax/-/turntax-0.10.0.tgz", - "integrity": "sha512-yXsjHFkObcXw6RvqkiW93YtCs5YwRJQfGSCXF3W44+sSFAXCBmHANh83PX56G5UlZXT0jQTDM5AQAF989tmy0A==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/turntax/-/turntax-0.11.0.tgz", + "integrity": "sha512-WGMUgE/Pm9RCeK7GmlV4ZMuGEwKSKDfsEMftbtedOIoPFcCiL11K3nd21Xrfccbin4dd+JyE2hgQUPeS9zv35w==", "license": "MIT", "dependencies": { "gpt-tokenizer": "4.1.0"