agentleFS
sayeediftekharsayeediftekhar/lean-context/skills/lean-context/SKILL.md

lean-context

Skill0 starsChanged 4 months agoMITView on GitHub

Cut an AI coding agent's always-on / standing context and keep it cut. Use when the instruction file (CLAUDE.md, AGENTS.md, .cursorrules, copilot- instructions) has grown large or carries project memory inline; when a session front-loads big docs (CONTEXT.md, LEARNINGS.md) at start; when someone wants to reduce token cost, tier their knowledge base into load-on-demand structure, or measure and shrink standing context. Also use to audit a repo's context system or to scaffold one on a fresh repo. Keywords: context bloat, token optimization, front-loading, tiering, window × turns, CLAUDE.md too big.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. Kevinchamplin/claude-skills★ 3same name
    2. liujiarui0918/claude-code-codex-strongest★ 1same name
    3. OrionicsLtd/claude-skills★ 1same name
    4. EARTH157/claude-skills★ 0same name
    5. wangxiaohuiboy/lean-agent-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use ${CLAUDE_PLUGIN_ROOT}/INDEX.md as the map.

    line 40
  2. Very specific:

    Measure, don't estimate: Never report a token count from chars ÷ 4 — it has undercounted by ~65%.

    line 44
  3. Distinctive:

    Read the referenced file(s) now, then proceed against them — do not act from this summary alone for a real migration.

    line 54

“Common” is measured: kept by at least 6 in 10 of the 5 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

Lean Context — cut standing context, keep it cut

This skill runs the context-engineering half of this repo. The full material is on disk; load only what the task needs.

The rule that governs everything

Hold the minimum needed to choose the next action; fetch, isolate, or defer everything else. The token bill is window size × turns — a file loaded at session start is paid every turn, not once. Cost and quality are the same problem: a crowded window also reasons worse.

What to do

  1. If the task is to actually migrate/refactor a repo's context system (new or existing): read and execute ${CLAUDE_PLUGIN_ROOT}/DIRECTIVE.md. It is a self-contained, STOP-gated procedure — Discover → Propose → Migrate → Verify. Honor every STOP: wait for explicit human approval before writing, moving, or deleting anything. Do not summarize records to shrink them; move verbatim.
  2. If the task is to understand the why, or diagnose a bloat problem: read ${CLAUDE_PLUGIN_ROOT}/PLAYBOOK.md. It carries the economics, the three-way test (lesson vs history vs state), the guard failure modes, and the measurement discipline.
  3. If the task also touches the harness (loops, gates, routing, session ritual): the context tiers connect to ${CLAUDE_PLUGIN_ROOT}/HARNESS.md §9. Use ${CLAUDE_PLUGIN_ROOT}/INDEX.md as the map.

Non-negotiables (pulled forward so they can't be missed)

  • Measure, don't estimate. Never report a token count from chars ÷ 4 — it has undercounted by ~65%. Measure one file with the real tokenizer, scale the rest, label which numbers are measured vs scaled.
  • Snapshot before touching. Copy any file to _archive/ before editing.
  • Preserve every fact. This is a re-filing, not a rewrite. Unsure if a line is live? Keep it and flag it. Verify a fact landed before removing the source.
  • A guard you haven't watched go red is faith, not enforcement.
  • Anything that must be guaranteed (a commit gate, a forbidden command) belongs in a hook or deny-list, not in prose.

Read the referenced file(s) now, then proceed against them — do not act from this summary alone for a real migration.

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.