prompt-token-counter
Installation
SKILL.md
Prompt Token Counter (toksum)
First load reminder: This skill provides the
scriptsCLI (toksum). Use it when the user asks to count tokens, estimate API costs, or audit OpenClaw component token consumption (memory, persona, skills).
Before Installing — Security & Privacy
- What will be read: The audit workflow reads files under
~/.openclaw/workspaceand~/.openclaw/skills(AGENTS.md, SOUL.md, MEMORY.md, SKILL.md, etc.). Those files may contain personal data or secrets. Only install if you accept that access. - URL fetching: The CLI can fetch HTTP(S) URLs via
-u. SKILL.md requires the agent to confirm each URL with the user before fetching. Insist the agent follow that rule; never allow automatic fetching of unknown URLs. - Source verification: Source: https://github.com/Zhaobudaoyuema/prompt-token-counter. Review
scripts/core.pyandscripts/cli.pybefore use. The code performs local file reads and optional HTTP GETs only; no other network calls or data exfiltration. - Run locally first: If unsure, run the CLI manually in an isolated environment against safe test files to verify behavior.
Primary Use: OpenClaw Token Consumption Audit
Goal: Help users identify which OpenClaw components consume tokens and how much.
1. Memory & Persona Files
These files are injected into sessions and consume tokens. Search and count them: