Agent skill

Token Optimization

by cwinvestments in cwinvestments/memstack

A skill your agent uses when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity.

ProprietaryAuto-check passedAI & LLM Engineering

Install Token Optimization

skills CLI
$ npx skills add cwinvestments/memstack --skill token-optimization -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cwinvestments/memstack token-optimization --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cwinvestments/memstack.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/token-optimization .claude/skills/token-optimization && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
token-optimization
GitHub stars
423
Token cost
~1.4k tokens
SKILL.md length
666 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
Proprietary

At a glance

A skill your agent uses when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity.

  • Works in 3 steps: Enable the proxy: python -m… → Optionally activate a Pro license to… → Read your savings on the dashboard…
  • The user says token optimization
  • SKILL.md covers Activation, Context Guard, What TokenStack Is and Enabling It, plus 6 more sections
  • Calls python and curl

What it does

Token Optimization is an agent skill from cwinvestments/memstack. Use when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity. Covers TokenStack, the built-in compression proxy that shrinks Claude Code tool output before it reaches the Anthropic API. Do NOT use for proxy troubleshooting or live status (Compress skill).

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering LLM cost and token optimization and Context engineering. It works with Anthropic API. The repository describes itself as: Structured skill framework for Claude Code. 130 skills, persistent memory, TokenStack compression, localhost dashboard with 3-agent runner, real-time streaming, MCP tools.

When your agent uses it

  • The user says token optimization
  • Asks about extending context window capacity
  • Proxy troubleshooting
  • Live status (Compress skill)

Example prompts

  • “token optimization”
  • “save tokens”
  • “context window”
  • “/token-optimization”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Enable the proxy: python -m memstack_skill_loader dashboard --with-proxy.
  2. Optionally activate a Pro license to unlock the seven Pro transforms.
  3. Read your savings on the dashboard (Overview header and Burn Report).

What it can do on your machine

Read from SKILL.md and the folder at commit 00370ce. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python
    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use curl, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Token Optimization loads about 1.4k tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 666 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

Its licence (Proprietary) doesn't allow us to republish the file, so here is its outline and opening line. It has 666 words (~1,415 tokens).

“One built-in compression proxy that shrinks Claude Code tool output before it reaches the Anthropic API.”

— opening of SKILL.md by cwinvestments, Proprietary
name
token-optimization
version
2.0.0
license
Proprietary - MemStack Pro by CW Affiliate Investments LLC. See LICENSE.txt

Read the full SKILL.md on GitHub

Files

Just SKILL.md in skills/token-optimization of cwinvestments/memstack.

Open the folder on GitHubat commit 00370ce

Compare with similar skills

Token Optimization next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Token Optimization compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Token Optimization this skillcwinvestments/memstack423—~1.4kAutomated safety check: PassProprietary
Cco Budgetegorfedorov/claude-context-optimizer114—~808Automated safety check: PassMIT
Claude APIkid-sid/claude-spellbook189—~2.7kAutomated safety check: PassMIT
Prompt Caching Patternssoftspark/ai-toolkit179—~1.1kAutomated safety check: PassApache-2.0
Context Compressionmajiayu000/claude-skill-registry6661 repos~2.2kAutomated safety check: PassMIT
Agents Best PracticesDenisSergeevitch/agents-best-practices2.4k—~7.4kAutomated safety check: PassMIT

Similar skills

  • Cco Budget

    egorfedorov/claude-context-optimizer

    Configure token budget limits, auto-compact settings, and view current budget status (model-aware — Claude 5 lineup, Opus 5.5 default fallback, full 1M context at standard price)

    114 GitHub stars~808 tokensUpdated 7 days ago
    AI & LLM EngineeringAuto-check passed
  • Claude API

    kid-sid/claude-spellbook

    A skill your agent uses when building or debugging apps that call the Claude API — implementing tool use, streaming, vision, prompt caching, batch processing, extended thinking, or an agentic loop…

    189 GitHub stars~2.7k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Prompt Caching Patterns

    softspark/ai-toolkit

    Anthropic API prompt caching: TTL, breakpoints, stacking, invalidation, hit rate.

    179 GitHub stars~1.1k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Context Compression

    majiayu000/claude-skill-registry

    Compress selected context to a target token budget while preserving decisions, evidence, constraints, and unresolved questions.

    666 GitHub starsUsed in 1 repo~2.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Agents Best Practices

    DenisSergeevitch/agents-best-practices

    A skill your agent uses when designing, generating an MVP blueprint for, auditing, troubleshooting, refactoring, or explaining an agentic harness for any domain.

    2.4k GitHub stars~7.4k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • OmniRoute RTK Context Filters

    diegosouzapw/OmniRoute

    Controls the RTK filter set and context-handling settings in OmniRoute, with endpoints to try compression on sample text and read back retained output.

    74k GitHub starsUsed in 1 repo~618 tokens
    AI & LLM EngineeringAuto-check passed

More from cwinvestments/memstack

All 87 skills in this repo
  • Memstack SEO Site Audit

    cwinvestments/memstack

    A skill your agent uses when the user says 'SEO audit', 'site audit', 'check SEO', 'audit my site', 'SEO check', 'technical SEO', or is evaluating a website's search engine optimization health, meta…

    423 GitHub stars~3.5k tokensUpdated 10 days ago
    Auto-check passed
  • Memstack SEO Schema Markup

    cwinvestments/memstack

    A skill your agent uses when the user says 'add schema', 'schema markup', 'JSON-LD', 'structured data', 'rich results', 'rich snippets', or is adding or fixing schema.org structured data for better…

    423 GitHub stars~2.7k tokensUpdated 10 days ago
    Auto-check passed
  • Compress

    cwinvestments/memstack

    A skill your agent uses when the user says 'tokenstack', 'compression', 'token savings', 'proxy status', or asks about context window usage.

    423 GitHub stars~1.2k tokensUpdated 10 days ago
    Auto-check passed
  • Diary

    cwinvestments/memstack

    A skill your agent uses when the user says 'save diary', 'log session', 'wrapping up', or at end of a productive session.

    423 GitHub stars~5k tokensUpdated 10 days ago
    Auto-check passed
  • Echo

    cwinvestments/memstack

    A skill your agent uses when the user references past sessions, asks 'what did we do', 'do you remember', 'last session', 'recall', or 'continue from'.

    423 GitHub stars~1.7k tokensUpdated 10 days ago
    Auto-check passed
  • Familiar

    cwinvestments/memstack

    A skill your agent uses when the user says 'dispatch', 'send familiar', 'split task', or needs work split across parallel CC sessions.

    423 GitHub stars~556 tokensUpdated 10 days ago
    Auto-check passed

Works with

Questions about Token Optimization

What does Token Optimization do?

A skill your agent uses when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity. Token Optimization is an agent skill from cwinvestments/memstack. Use when the user says 'token optimization', 'save tokens', 'context window', 'reduce tokens', 'token stack', or 'TokenStack', or asks about extending context window capacity.

When should I use Token Optimization?

Token Optimization fits situations like: the user says token optimization; asks about extending context window capacity; proxy troubleshooting; live status (Compress skill).

How do I install Token Optimization in Claude Code?

Run `npx skills add cwinvestments/memstack --skill token-optimization -a claude-code`. Or copy the skill folder (skills/token-optimization in cwinvestments/memstack) into .claude/skills/token-optimization in your project. Claude Code loads it when a task matches its description.

How do I install Token Optimization in Codex?

Run `npx skills add cwinvestments/memstack --skill token-optimization -a codex`. Or copy the skill folder (skills/token-optimization in cwinvestments/memstack) into .agents/skills/token-optimization in your project. Codex loads it when a task matches its description.

Can I use Token Optimization in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cwinvestments/memstack --skill token-optimization -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/token-optimization, .gemini/skills/token-optimization, .github/skills/token-optimization and .opencode/skills/token-optimization in your project.

What does Token Optimization need to run?

Going by SKILL.md and its folder, Token Optimization needs the command-line tools its instructions call (python and curl). Our summary lists: Python 3.

Does Token Optimization access the network?

SKILL.md contains no URLs. Its commands use curl, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Token Optimization safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Token Optimization use?

Token Optimization carries a proprietary licence (declared in SKILL.md). It is published on GitHub, but it is not open source: read the licence file before using or sharing it.

How many tokens does Token Optimization use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Token Optimization?

Skills that share tags, products or a category with Token Optimization: Cco Budget (egorfedorov/claude-context-optimizer, 114 stars), Claude API (kid-sid/claude-spellbook, 189 stars), Prompt Caching Patterns (softspark/ai-toolkit, 179 stars) and Context Compression (majiayu000/claude-skill-registry, 666 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Token Optimization?

cwinvestments (a GitHub user) maintains it in cwinvestments/memstack, which has 423 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: cwinvestments/memstack on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.