agentleFS
itsmuskanagarwalitsmuskanagarwal/claude-pack/skills/session-hygiene/SKILL.md

session-hygiene

Skill0 starsChanged 4 months agoMITView on GitHub

Keep Claude Code sessions effective on large codebases. Consult at the start of complex or long tasks, when a session has gone through two failed correction attempts, when the user asks why quality degraded, when switching to an unrelated task mid-session, or when context feels polluted. Encodes scoping, /clear discipline, restart-over-correct, and compaction awareness.

3 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

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    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:

    Prefer: entrypoint + direct dependencies + one test file as convention reference.

    line 20
  2. Very specific:

    Write acceptance criteria as commands (test/lint/build) into the task's first message or a state file.

    line 24

“Common” is measured: kept by at least 6 in 10 of the 3 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
<!-- owner: Muskan, added: 2026-07-16, model: claude-sonnet-5, review: quarterly -->

Session Hygiene

The five failure patterns and the countermeasure for each

  1. Kitchen-sink session (unrelated tasks share context) → propose /clear between unrelated tasks; state what will be lost and what to save first.
  2. Repeated correction (2 failed fixes) → STOP. Do not attempt a third patch on polluted context. Summarize the corrected understanding into a fresh prompt, recommend restart with that prompt.
  3. Infinite exploration → every investigation gets a scope sentence up front: "answering X by reading Y, Z; not reading beyond."
  4. Trust-then-verify gap → never assert a check passed without running it in this session. If it wasn't run, say "unverified".
  5. Repo-loading → include the files the task needs, not directories. Prefer: entrypoint + direct dependencies + one test file as convention reference.

Before long tasks

  • Write acceptance criteria as commands (test/lint/build) into the task's first message or a state file.
  • For work spanning sessions, maintain docs/state/<task>.md with: decisions made, files touched, next step. Update before context is compacted; assume anything not in a file may be lost to compaction.

Signals to surface to the user proactively

  • Context includes > ~3 abandoned approaches → recommend restart.
  • Task switched domains → recommend /clear.
  • About to exceed a diff budget → recommend splitting (see diff-budget hook).

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.