# Add token count caching

> Cache token counts to avoid O(n) rescans on each message update. Scope: state.py and token_counter integration.

- Skill: `tools-only/add-token-count-caching` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/add-token-count-caching`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/add-token-count-caching/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-29
- Page: https://skillmd.com/skills/tools-only/add-token-count-caching

---

# Add token count caching

Cache token counts to avoid O(n) rescans on each message update. Scope: state.py and token_counter integration.

## Acceptance Criteria

Token count is recomputed only when message content changes; cached values are reused on subsequent updates; no new type errors.


