{
  "generatedAt": "2026-06-09T03:35:44.902Z",
  "endpoint": "https://api.anthropic.com/v1/messages/count_tokens?beta=true",
  "model": "claude-opus-4-8",
  "method": {
    "total": "Official Anthropic Messages count_tokens endpoint",
    "attribution": "Sequential controlled ablation over 3 overview categories",
    "drilldowns": "Independent item estimates against a common baseline; intentionally non-additive"
  },
  "provenance": {
    "capture": {
      "generatedAt": "2026-06-08T23:41:32.043Z",
      "captureMethod": "Claude Agent SDK query() sent to a loopback fake Anthropic endpoint",
      "isolation": {
        "settingSources": [],
        "freshHome": true,
        "freshClaudeConfigDir": true,
        "autoMemoryDisabled": true,
        "prompt": "say hi"
      },
      "request": {
        "method": "POST",
        "url": "/v1/messages?beta=true",
        "redactedBodySha256": "8ecb466f2776c376fee0475837d115de702b218c8e4b44e1f6efea84e09ea074",
        "redactedCanonicalBodySha256": "fa61f50501d2ed1f7156a0e4d435d1d1830f9fd03dcc74fcad3a8872d9cd86d7",
        "rawBodySha256": "3849fdac0bc544fa0332a3529d7dccf674536dee2e4588e5fe8f61b2fa428d41",
        "normalizedLoadedContextSha256": "492853beb90082dd9e8e933faf48b3d3583a147fa6693e802e813456144f0645",
        "priorCaptureComparison": {
          "path": "outputs/sdk-builtin-default-query-request.redacted.json",
          "normalizedLoadedContextSha256": "492853beb90082dd9e8e933faf48b3d3583a147fa6693e802e813456144f0645",
          "exactMatchAfterDynamicFieldNormalization": true
        }
      },
      "sdk": {
        "package": "@anthropic-ai/claude-agent-sdk",
        "version": "0.3.168",
        "claudeCodeVersion": "2.1.168",
        "entryPath": "work/npm-sdk/sdk.mjs",
        "entrySha256": "0632ab830c1b7157fd7b39fbbe017ac45ae06046a9e345863921627ce7043b6b",
        "tarballPath": "work/anthropic-ai-claude-agent-sdk-0.3.168.tgz",
        "tarballSha256": "d1d88e345a8e0f99a6b49028d4da595aff9e75c90cc4805e5c7ced716ccff066"
      },
      "runtime": {
        "node": "v24.14.0",
        "platform": "darwin",
        "arch": "arm64",
        "claudeVersion": "2.1.168 (Claude Code)",
        "claudeSha256": "377f0ecedba8246bdabdf312ce8b7cc8ae1160997b26f5edca352a4a8d61dc78",
        "claudeExecutable": "claude"
      },
      "comparisonCatalog": {
        "repository": "https://github.com/Piebald-AI/claude-code-system-prompts",
        "commit": "8643350dbda610265ae7a9fe981243b9ee9ecbd1"
      }
    },
    "countableFullBodyCanonicalSha256": "d87aa5f349109324f0cc80267cdc6d8a5750cb414e50293972791e834bd3d8e4",
    "capturedAnthropicBeta": "claude-code-20250219,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,mid-conversation-system-2026-04-07,advisor-tool-2026-03-01,effort-2025-11-24",
    "rawRequestResponseDirectory": "raw/count-tokens"
  },
  "mece": {
    "totalTokens": 31432,
    "attributedTokenSum": 31432,
    "rows": [
      {
        "category": "built_in_tool_definitions",
        "tokens": 29645,
        "percent": 94.314711122423,
        "method": "Marginal count from including tools: full request minus request without tools"
      },
      {
        "category": "skill_descriptions",
        "tokens": 1486,
        "percent": 4.727666072792059,
        "method": "No-tools request minus request without skill descriptions"
      },
      {
        "category": "everything_else",
        "tokens": 301,
        "percent": 0.9576228047849326,
        "method": "Valid request without tools or skill-description text"
      }
    ],
    "overviewCounts": {
      "full": 31432,
      "withoutTools": 1787,
      "withoutToolsOrSkillDescriptions": 301
    }
  },
  "promptAblation": {
    "withoutUserPromptTokens": 31428,
    "capturedPromptMarginalTokens": 4,
    "method": "Captured request minus the user-prompt content block; all SDK-supplied context held constant"
  },
  "skills": [
    {
      "skill": "deep-research",
      "description": "Deep research harness — fan-out web searches, fetch sources, adversarially verify claims, synthesize a cited report. - When the user wants a deep, multi-source, fact-checked research report on any topic. BEFORE invoking, check if the question is specific enough to research directly — if underspecified (e.g., \"what car to buy\" without budget/use-case/region), ask 2-3 clarifying questions to narrow scope. Then pass the refined question as args, weaving the answers in.",
      "estimatedTokens": 155,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "update-config",
      "description": "Use this skill to configure the Claude Code harness via settings.json. Automated behaviors (\"from now on when X\", \"each time X\", \"whenever X\", \"before/after X\") require hooks configured in settings.json - the harness executes these, not Claude, so memory/preferences cannot fulfill them. Also use for: permissions (\"allow X\", \"add permission\", \"move permission to\"), env vars (\"set X=Y\"), hook troubleshooting, or any changes to settings.json/settings.local.json files. Examples: \"allow npm commands\", \"add bq permission to global settings\", \"move permission to user settings\", \"set DEBUG=true\", \"when claude stops show X\". For simple settings like theme/model, suggest the /config command.",
      "estimatedTokens": 229,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "keybindings-help",
      "description": "Use when the user wants to customize keyboard shortcuts, rebind keys, add chord bindings, or modify ~/.claude/keybindings.json. Examples: \"rebind ctrl+s\", \"add a chord shortcut\", \"change the submit key\", \"customize keybindings\".",
      "estimatedTokens": 90,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "verify",
      "description": "Verify that a code change actually does what it's supposed to by running the app and observing behavior. Use when asked to verify a PR, confirm a fix works, test a change manually, check that a feature works, or validate local changes before pushing.",
      "estimatedTokens": 72,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "code-review",
      "description": "Review the current diff for correctness bugs and reuse/simplification/efficiency cleanups at the given effort level (low/medium: fewer, high-confidence findings; high→max: broader coverage, may include uncertain findings). Pass --comment to post findings as inline PR comments, or --fix to apply the findings to the working tree after the review.",
      "estimatedTokens": 110,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "simplify",
      "description": "Review the changed code for reuse, simplification, efficiency, and altitude cleanups, then apply the fixes. Quality only — it does not hunt for bugs; use /code-review for that.",
      "estimatedTokens": 61,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "fewer-permission-prompts",
      "description": "Scan your transcripts for common read-only Bash and MCP tool calls, then add a prioritized allowlist to project .claude/settings.json to reduce permission prompts.",
      "estimatedTokens": 55,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "loop",
      "description": "Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m) - When the user wants to set up a recurring task, poll for status, or run something repeatedly on an interval (e.g. \"check the deploy every 5 minutes\", \"keep running /babysit-prs\"). Do NOT invoke for one-off tasks.",
      "estimatedTokens": 120,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "claude-api",
      "description": "Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration.\nTRIGGER — read BEFORE opening the target file; don't skip because it \"looks like a one-liner\" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens).\nSKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).",
      "estimatedTokens": 451,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "run",
      "description": "Launch and drive this project's app to see a change working. Use when asked to run, start, or screenshot the app, or to confirm a change works in the real app (not just tests). First looks for a project skill that already covers launching the app; otherwise falls back to built-in patterns per project type (CLI, server, TUI, Electron, browser-driven, library).",
      "estimatedTokens": 110,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "init",
      "description": "Initialize a new CLAUDE.md file with codebase documentation",
      "estimatedTokens": 22,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "review",
      "description": "Review a pull request",
      "estimatedTokens": 6,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    },
    {
      "skill": "security-review",
      "description": "Complete a security review of the pending changes on the current branch",
      "estimatedTokens": 17,
      "note": "Description serialized independently as text against the common baseline; official and non-additive estimate."
    }
  ],
  "tools": [
    {
      "tool": "Agent",
      "estimatedTokens": 1263,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "AskUserQuestion",
      "estimatedTokens": 1411,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Bash",
      "estimatedTokens": 1034,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "CronCreate",
      "estimatedTokens": 1519,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "CronDelete",
      "estimatedTokens": 140,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "CronList",
      "estimatedTokens": 90,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Edit",
      "estimatedTokens": 329,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "EnterPlanMode",
      "estimatedTokens": 1608,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "EnterWorktree",
      "estimatedTokens": 1301,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "ExitPlanMode",
      "estimatedTokens": 884,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "ExitWorktree",
      "estimatedTokens": 898,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Monitor",
      "estimatedTokens": 2394,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "NotebookEdit",
      "estimatedTokens": 607,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "PushNotification",
      "estimatedTokens": 500,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Read",
      "estimatedTokens": 587,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "ScheduleWakeup",
      "estimatedTokens": 1392,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Skill",
      "estimatedTokens": 604,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "TaskCreate",
      "estimatedTokens": 978,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "TaskGet",
      "estimatedTokens": 380,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "TaskList",
      "estimatedTokens": 436,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "TaskOutput",
      "estimatedTokens": 523,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "TaskStop",
      "estimatedTokens": 197,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "TaskUpdate",
      "estimatedTokens": 1375,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "WebFetch",
      "estimatedTokens": 283,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "WebSearch",
      "estimatedTokens": 292,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Workflow",
      "estimatedTokens": 7608,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    },
    {
      "tool": "Write",
      "estimatedTokens": 222,
      "note": "Captured tool object serialized independently as JSON text against the common baseline; official and non-additive estimate."
    }
  ]
}
