agentleFS
Bexruz-cellBexruz-cell/agent-skills/skills/context-optimizer/SKILL.md

context-optimizer

Skill1 starsChanged 49 days agoMITView on GitHub

Reduce context window and token usage for AI coding agents. Use when working with large repositories, large files, context overflow risks, or when the user asks to optimize tokens, compress prompts, or reduce context. Prefer targeted search (rg/grep) over full-file reads; ignore node_modules, .git, build artifacts, lockfiles and binaries.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not read an entire large file when only a fragment is needed.

    line 15
  2. Very specific:

    Prefer targeted search first: rg, grep, find, git grep.

    line 16
  3. Distinctive:

    Never load without need:

    line 18
  4. Distinctive:

    Prefer compact structured output for large results.

    line 23
  5. Distinctive:

    Do not repeat already-known context.

    line 24
  6. Distinctive:

    Do not load the entire repository when the task is local.

    line 25
  7. Very specific:

    When a reference is needed from the agentic stack, load one file from references/repositories/ after consulting the registry — never all 50.

    line 27
  8. Distinctive:

    Does not replace model context limits.

    line 37
  9. Very specific:

    Good: Read registry → filter category context-compression → open only 001-llmlingua.md.

    line 53

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Trigger Criteria

Activate when:

  • User mentions: reduce context, optimize tokens, compress prompt, large file edit, context overflow, huge repository, large codebase, reduce token usage
  • Working in large monorepos or files > ~500 lines
  • Approaching model context limits

Core Rules

  1. Do not read an entire large file when only a fragment is needed.
  2. Prefer targeted search first: rg, grep, find, git grep.
  3. Locate symbol / function / class first, then read a limited line range.
  4. Never load without need:
    • node_modules/, .git/, build/, dist/, caches
    • lock files
    • binary files
  5. For JSON: strip unnecessary whitespace while preserving structure and important fields.
  6. Prefer compact structured output for large results.
  7. Do not repeat already-known context.
  8. Do not load the entire repository when the task is local.
  9. Index / search first, then targeted read.
  10. When a reference is needed from the agentic stack, load one file from references/repositories/ after consulting the registry — never all 50.

Expected Output

  • Concise findings or edits
  • Explicit file:line ranges used
  • Token-conscious summaries instead of full dumps

Limitations

  • Does not replace model context limits; it reduces waste.
  • Heuristic; agents must still respect host tool budgets.

References

  • references/awesome_agentic_stack.json (registry — filter, do not dump)
  • references/INDEX.md
  • references/repositories/001-llmlingua.md (context compression)
  • docs/AGENT_COMPATIBILITY.md

Examples

Bad: cat src/huge_module.py
Good: rg -n "def process_" src/ then read only the matching function range.

Bad: Load all 50 repository reference files.
Good: Read registry → filter category context-compression → open only 001-llmlingua.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.