Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

context-slim

FreeRuns bundled scriptsNot checked

Compresses potential LLM context sources - project and global CLAUDE.md, rules, agent descriptions, hook text, memory - by cross-layer dedup…

kochetkov-maby kochetkov-ma★ 41 GitHub stars

About this skill

Context Slim

Cuts the size of potential context sources with three levers — cross-layer dedup, default-knowledge removal, deep per-file compression. Every exact value, key, path, pin and non-default instruction survives byte-exact or acceptance fails. Orchestration only: every decision rule lives in references/, read at the phase that needs it.

Prompt contract

$ARGUMENTS is one free-form RU/EN prompt; mode tokens and flags (--target=N%, --global, --memory, --noask) may sit anywhere in it.

  1. Mode: an explicit mode token wins outright; else the most distinct whole-word keyword hits (table below). Tie with a destructive mode -> AskUserQuestion; with measure -> measure; of two mutating modes -> the keyword that comes first. No hit or empty -> measure.
  2. Scope: prose that is not a mode/path is still input: take the target, the ratio and the layer from it (сожми контекст на 40%, глобальный тоже -> mode slim, --target=40%, --global).
  3. Ask: at most ONE AskUserQuestion (max 4 questions) to resolve mode and scope, before any work, only when the answer changes what gets written. A read-only run asks nothing.

Print once, before the first action (labels literal, INPUT verbatim, authored values follow the active work-artifact language policy):

PLAN — brewtools:context-slim
INPUT:  <arguments verbatim, or "(empty)">
MODE:   <resolved> — <explicit | matched keyword: X | default>
SCOPE:  <resolved roots / tiers / flags>
DO:     <2-5 imperative bullets>
RESULT: <what the user ends up holding>

Modes

Mode EN keywords RU keywords Mutates?
measure (empty), measure, status, show, how much, weigh замер, статус, покажи, сколько no
preview preview, dry run, what would, plan превью, посмотри, что будет no
slim slim, compress, squeeze, dedupe, clean сожми, ужми, почисти, дедуп yes
hard hard, aggressive, more, deeper, still too big жёстко, сильнее, ещё, агрессивно yes, destructive
bodies bodies, skill bodies, skills, references тела, скиллы, референсы yes
restore restore, rollback, undo, revert восстанови, откати, верни yes, destructive

DEFAULT = measure. bodies is a scope extension: combine it with preview, slim or hard; alone it means bodies + slim.

Scope tiers

Tier Content In default scope
ALWAYS-ON Startup CLAUDE.md files (subdirectory ones on access), recursive rules (path-scoped = conditional), imported/read conventions, AGENTS.md, memory, agent descriptions, hook text yes
PER-SPAWN Agent .md files; only the selected agent loads at spawn yes
PER-INVOCATION Invoked SKILL.md bodies + recursive references read on demand opt-in via bodies only

Totals are potential inventory, not observed context (measurement.actual_loading_observed=false; membership: references/measurement.md). --memory adds the memory directories; --target=N% uses THIS run's fresh scan (measurement.md, "Target-ratio baseline rule").

Layer scope and what is never touched

Layer Read Written
Project (L1/L2) always in every mutating mode
Global ~/.claude, or CLAUDE_CONFIG_DIR when set (L3) ALWAYS, as authority only when --global is granted
MCP servers, plugin enablement, settings.json, the plugin cache signals only NEVER — advice rows per references/mcp-advice.md

Rewriting the global layer to serve one project is a cross-project regression: references/dedup-arbitration.md section 5 binds every mutation.

Phases

# Phase Mutates Barrier
0 Resolve mode + scope no —
1 Discover + measure, print PLAN no —
2 Snapshot (fail-closed) backups only yes
3 Cross-layer dedup analysis no yes
4 One optimizer subagent per file yes —
5 Verify + independent checker checkpoint-proven recovery on miss only yes
6 Re-measure, lossy escalation gate conditional —
7 Ratchet state + report state file only —

measure stops after phase 1, preview after phase 3; restore runs alone (see Restore).

Phase 0 — resolve

After the Prompt contract, one AskUserQuestion (max 4 questions), only for answers that change writes:

  1. Write to the global layer, or read it as authority only?
  2. Include the memory directories?
  3. Include agent bodies (PER-SPAWN)?
  4. Target ratio — only when the prompt implies one without naming it.

measure and --noask skip it (report the literal Skipped (--noask)). The gates below and every STOP still fire under --noask: each guards an irreversible write.

Gate Fires on Ask
Destructive mode hard, restore Name the
Full SKILL.md on GitHub

Install context-slim in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Read
Edit
Write
Bash
Grep
Glob
Agent
AskUserQuestion

Bundled files

README.mdreferences/contradiction-policy.mdreferences/dedup-arbitration.mdreferences/drop-catalog.mdreferences/keep-catalog.mdreferences/language-policy.mdreferences/mcp-advice.mdreferences/measurement.mdscripts/context-guard.shscripts/context-scan.sh

FAQ

What does the context-slim skill do?

Compresses potential LLM context sources - project and global CLAUDE.md, rules, agent descriptions, hook text, memory - by cross-layer dedup, default-knowledge removal and deep per-file compression. Triggers - slim context, compress context, dedupe rules, сожми контекст, ужми правила.

How do I install the context-slim skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the context-slim skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare context-slim with