agentleFS
netanelavrnetanelavr/dotcursor/skills/kit-optimize-context/SKILL.md

kit-optimize-context

Skill6 starsChanged 27 days agoMITView on GitHub

Analyze always-on agent context across coding hosts (Cursor, Claude Code, Codex, Gemini CLI, etc.) and suggest token reductions. Use when sessions feel heavy before you type anything.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not a rewrite of skills/rules content (edit those files directly)

    line 13
  2. Very specific:

    Not cutting extras inside a finished diff (kit-strip-diff)

    line 14
  3. Distinctive:

    Not installing/uninstalling tools — read-only audit

    line 15
  4. Distinctive:

    Ask once if unclear: which host to audit — Cursor, Claude Code, Codex, Gemini CLI, OpenCode / other, or all present.

    line 19
  5. Distinctive:

    Default: audit every host that has a detectable config/skills dir on this machine, plus the current repo’s agent folders.

    line 21
  6. Distinctive:

    always-on vs on-demand (how this host decides)

    line 41
  7. Distinctive:

    After explicit permission to run git (or skip if withheld):

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “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

Optimize Context

Map what loads into an agent session before the user types, then recommend cuts. Host-agnostic: detect or ask which host(s) to audit.

What this is NOT

  • Not a rewrite of skills/rules content (edit those files directly)
  • Not cutting extras inside a finished diff (kit-strip-diff)
  • Not installing/uninstalling tools — read-only audit

0. Scope the host(s)

Ask once if unclear: which host to audit — Cursor, Claude Code, Codex, Gemini CLI, OpenCode / other, or all present.

Default: audit every host that has a detectable config/skills dir on this machine, plus the current repo’s agent folders.

Token heuristic: chars ÷ 4 unless you can tokenize accurately. Mark estimates.

1. Always-on instructions (per host)

For each in-scope host, find always-on instruction surfaces that exist:

HostTypical paths / surfaces
Cursor<repo>/.cursor/rules/ (alwaysApply / requestable), user rules in Cursor settings
Claude CodeCLAUDE.md, <repo>/.claude/, ~/.claude/ settings / memory
CodexAGENTS.md, <repo>/.codex/, ~/.codex/
Gemini CLIGEMINI.md / .gemini/ if present
Shared / otherAGENTS.md, .agents/, host docs the user names

For each always-on file/rule:

  • filename/path
  • ~chars / ~tokens
  • always-on vs on-demand (how this host decides)
  • heaviest items
  • recommendation: keep always-on, split, or move to a skill / on-demand rule

Skip missing paths; say what you checked.

2. Skills / commands metadata

Count discrete skills (SKILL.md roots or declared entries) and metadata size visible before a skill body is opened:

SourceNotes
<repo>/.agents/skills/, <repo>/.cursor/skills/, <repo>/skills/repo-local
~/.agents/skills/, ~/.cursor/skills/, ~/.claude/skills/, ~/.codex/skills/, ~/.gemini/skills/user-global
Host-bundled / plugin skill rootsonly if discoverable on disk

Also note slash-command / prompt folders if the host keeps them separate (e.g. legacy commands/).

Per existing source: count, combined metadata ~tokens, whether disable-model-invocation (or host equivalent) keeps bodies out of default context.

3. Plugins / MCP / bridges

Where present and readable without secrets:

  • Enabled plugins / marketplaces (Claude settings.json, Cursor extensions, etc.)
  • MCP servers advertised into context (titles/descriptions only — redact URLs/tokens)
  • Flag plugins unlikely to matter for this repo’s domain

State limits when metadata is opaque.

4. Index / VCS noise

After explicit permission to run git (or skip if withheld):

  • git status --short line count
  • Untracked large dirs escaping ignore
  • Host ignore files if present (.cursorignore, .claudeignore, etc.) and what large paths they hide

5. Summary table

ComponentHost~Chars~TokensReducible?Recommended action

One row per major bucket (always-on packs, heavy files, skill metadata by source, plugins/MCP, ignore/git noise).

6. Top 3 quick wins

Highest impact for fresh sessions, ordered by estimated tokens saved. Each: savings bracket, how to do it, trade-off.

Constraints

  • Read-only — do not edit settings, ignores, rules, or plugins in this run
  • Redact secrets, tokens, private hostnames, employer-private plugin names (describe by category)
  • State methodology: hosts checked, paths missing, chars/4 vs tokenizer

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.