agentleFS
OrionicsLtdOrionicsLtd/claude-skills/skills/lean-context/SKILL.md

lean-context

Skill1 starsChanged 21 days agoMITView on GitHub

Practices for keeping the context window lean while working. Apply at the START of any task that involves exploring, understanding, editing, or debugging a codebase, and BEFORE reading files or running commands that dump large output. Scout with search instead of reading whole files, delegate broad multi-file exploration to subagents, read only the slices you need, never re-read what's already in context, filter command output, and offload intermediates to the filesystem.

5 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

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every files, commands etc you pull in stays in the window, dilutes attention, and buries the few lines that actually matter.

    line 15
  2. Distinctive:

    Don't read whole files or directories to "get oriented." Locate first, then read only the relevant span:

    line 22
  3. Distinctive:

    Read a function or section, not the 800-line file, when you know what you need.

    line 27
  4. Distinctive:

    When answering means sweeping many files ("how does X work?", "where is Y handled?", naming conventions across the tree), spawn an Explore …

    line 33
  5. Distinctive:

    Don't re-open files already in context, and don't re-run a search whose answer you already have.

    line 42
  6. Distinctive:

    If output is large but you might need parts later, redirect it to a file and read only the slice you need, when you need it.

    line 52
  7. Distinctive:

    Use files as memory instead of the context window.

    line 57
  8. Distinctive:

    When you catch yourself scrolling back through the whole transcript to reconstruct context, that's the signal to distill it into a few …

    line 72

“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

Every files, commands etc you pull in stays in the window, dilutes attention, and buries the few lines that actually matter. The goal is to hold the minimum needed to act correctly, not everything that might be relevant. Optimize for signal, not coverage.

Scout, then read the slice

Don't read whole files or directories to "get oriented." Locate first, then read only the relevant span:

  • grep/Glob to find the symbol, definition, or call site; then Read with offset/limit around it.
  • Read a function or section, not the 800-line file, when you know what you need.
  • Skim structure (signatures, a grep of function names) before committing to a full read.

Delegate broad exploration to a subagent

When answering means sweeping many files ("how does X work?", "where is Y handled?", naming conventions across the tree), spawn an Explore or general-purpose subagent. It reads the files in its own context and returns just the conclusion — the file dumps never touch your window. This is the single biggest lever for keeping the main thread lean; use it liberally for open-ended searches, and keep only the summary.

Don't re-read

Don't re-open files already in context, and don't re-run a search whose answer you already have.

Filter output; never dump

A command's full output is rarely the thing you need:

  • Pipe through grep/head/tail/field-selection; ask for the specific line, count, or status — not the whole log/dataset.
  • Strip known noise (build chatter, warnings) so it doesn't crowd the signal.
  • If output is large but you might need parts later, redirect it to a file and read only the slice you need, when you need it.

Offload to the filesystem

Use files as memory instead of the context window. Write scratch scripts, intermediate results, and long artifacts to a scratchpad/temp path; reference them by path and re-read just the relevant slice later. A path is cheap to carry; a pasted 500-line blob is not.

Load just-in-time, not just-in-case

Pull in a file, doc, or reference at the moment the task reaches it — not speculatively at the start. Most "let me load everything first" reads are never used and just add noise. Fetch on demand.

On long/multi-step tasks, keep a compact working state

As a session grows, track a short running state — what's done, what's next, key decisions and values — rather than re-deriving it from the full history each turn. When you catch yourself scrolling back through the whole transcript to reconstruct context, that's the signal to distill it into a few lines instead.

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.