Skip to content

Feature Request: Native token compression for CLAUDE.md and instruction files #33464

@Gumby63

Description

@Gumby63

Summary

Claude Code loads CLAUDE.md, rules files, and project instructions into context on every session start. As these files grow with real usage, they compete with working memory for context space. Users who build serious assistant configurations hit this wall quickly. The platform should handle instruction file compression natively rather than requiring users to manually optimize their token footprint.

The Problem

Power users build CLAUDE.md files that grow to 10K-15K+ tokens as they add workflows, agent configurations, project context, and operational rules. Combined with .claude/rules/ files, memory systems, and project instructions, startup context can consume 20-30K tokens before the user says a word.

The current options are:

  1. Manually compress your instruction files (I reduced mine from ~15,600 tokens to ~2,800 by hand)
  2. Accept the context cost and hit compaction earlier
  3. Split files and load on-demand (requires building your own cold-start architecture)

All three put the optimization burden on the user.

Proposed Solutions

Any or all of these would help:

1. Automatic instruction file compression. When loading CLAUDE.md and rules files, compress them to a token-efficient representation while preserving semantic meaning. The user writes in natural English. Claude reads a compressed version. The algorithm is straightforward: remove filler words, collapse verbose instructions to shorthand, preserve specifics (paths, names, rules). I wrote a working version of this: https://build-tammy.netlify.app/token-trim

2. Semantic/progressive loading. Don't dump every rules file into context on every session. Load instruction sections that match the current task. If I'm writing an article, load the editorial rules. If I'm doing browser automation, load the browser rules. Expand sections on demand as the task requires.

3. A human-to-compressed interpreter. Users write CLAUDE.md in plain English because that's natural. Offer a tool or built-in process that automatically generates a token-optimized version. Most users don't know that "When editing or creating agent instruction files, every agent file must include a mission statement, protocol, output format template, quality standards, scope boundaries, and inter-agent routing" can be compressed to "agent files must include: mission, protocol, output format, quality standards, scope boundaries, inter-agent routing" with zero meaning loss.

Context

I'm a Max plan user running Claude Code as a full-time personal assistant for journalism and civic work. 27 agent files, 15+ custom skills, 200+ memories in a semantic search server, 18 active projects. My CLAUDE.md is heavily compressed already. Most users building toward this level of configuration won't know how to compress their instructions, and shouldn't have to.

The token-trim algorithm I built and use: https://build-tammy.netlify.app/token-trim

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions