Skip to content

netanelavr/agent-kit / skills/kit-optimize-context

kit-optimize-context

Verified

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.

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
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 468kUpdated Claude CodeCodexUnverifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 321kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 321kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 321kUpdated Claude CodeCodexVerifiedInstall