agentsop-session-state-hygiene

agentsop-session-state-hygiene is a skill for Claude Code, Codex from agentsope/SkillAlchemy. It costs 108 tokens per session (6,638 once invoked), scanned C, original, MIT.

A procedure for deciding when to clear the conversation or session state of an AI coding tool because old context is interfering with a new task.

In plain words
What is it for?
Use it when switching topics, when the context becomes crowded, or when the tool reports that its context window is nearly full. It also provides commands and source references for managing session state.
Why use it?
It helps prevent earlier plans, abandoned approaches, or unrelated work from biasing the current task. It provides observable signs for when a fresh session is more reliable.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for aider. Also seen: mentions Claude Code; built for aider.

Good fit Use it when switching topics, when the context becomes crowded, or when the tool reports that its context window is nearly full. It also provides commands and source references for managing session state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agentsope/skillalchemy/agentsop-session-state-hygiene
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add agentsope/SkillAlchemy --skill agentsop-session-state-hygiene
Clone the repo
git clone --depth 1 https://github.com/agentsope/SkillAlchemy

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agentsop-session-state-hygiene

README.md
[![agentmods](https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-session-state-hygiene.svg)](https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-session-state-hygiene)
Your own site
<a href="https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-session-state-hygiene"><img src="https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-session-state-hygiene.svg" alt="Measured on agentmods" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,638 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00108 $0.06638
Opus 5 $0.00054 $0.03319
Sonnet 5 $0.00022 $0.01328
Haiku 4.5 $0.00011 $0.00664

Measured 7d ago against content hash cbe60d5b5305, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade C, and why

agentsop-session-state-hygiene scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

`memory=True`, wipe the store: `rm -rf ~/.crewai/storage/`.
skills/agentsop-session-state-hygiene/SKILL.md · 453 lines

How it starts

The opening of the file, as written. The whole thing — 453 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Session-State Hygiene · SOP

One line: context is signal; stale context is noise; clearing restores signal. A coding session is a sliding window of evidence. Early in a task the window is pure signal. The longer it runs, the more dead ends, abandoned plans, and superseded files accumulate — and at some point yesterday's good context becomes today's bad bias. This skill is the discipline of noticing that moment and acting on it with the smallest correct cut.

Source posture: every framework-specific claim is cited inline as [tool/topic]. Resolve tags against references/R1-source-evidence.md (full URLs) and references/R2-tool-commands.md (copy-pastable commands).


1. 何时激活 (When to Activate)

Activate this skill the moment any of these fire — they are the symptoms of context bleed, not vague unease:

  • Topic shift inside a session. You finish feature A and start unrelated bug B in the same window/REPL/thread. The A-history is now pure noise for B.
  • Length / window warning. The tool reports the context window is N% full, or Aider's /tokens crosses ~25k — the empirically observed point where "most models start to become distracted and become less likely to conform to their system prompt" [aider/edit-errors].
  • Weird behavior — the tell-tale signs of bleed:
    • The model repeats a mistake you already corrected ("don't use requests" → it uses requests again).
    • It references a file or decision you already removed / dropped.
    • It obeys an older instruction over the newest one (it conforms to turn 3 but ignores turn 30).
    • Edit-format errors climb (Aider "SEARCH block not found" recurs) [aider/edit-errors].

The activation trap to avoid: when behavior gets weird, the reflex is to rephrase the prompt, retry, or swap the model. If the history is polluted, none of those help — you are arguing with a model that is reading stale evidence. Activate this skill before reaching for a prompt rewrite.

Read the full file on GitHub · 453 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 453 lines · 108 tokens per session scan C cbe60d5b5305

Subscribe to this mod's changes

agentsop-session-state-hygiene is a skill published in the GitHub repository agentsope/SkillAlchemy (366 stars, last pushed 5d ago), licensed MIT. It adds 108 tokens to every session and 6,638 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

karpathy-llm-wiki

Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.

Astro-Han/karpathy-llm-wiki · 67 tokens

skills-constitution

A set of rules that makes an agent check its memory and available skills before handling professional tasks such as coding, file work, data analysis, or deployment.

jiabaobei/skills-constitution · 119 tokens

braindb

Memory recall and save. Use at every conversation start and whenever the user shares personal information, expertise, project context, preferences, or decisions worth remembering long-term.

dimknaf/braindb · 36 tokens

braindb-agent

Persistent memory across sessions via the BrainDB agent. Use at conversation start and whenever you need to recall what you know about the user or save new information to long-term memory.

dimknaf/braindb · 40 tokens

braindb-custom-profile

How to author a BrainDB custom profile — prompt add/replace fragments and an optional keyless ingestor — that shapes wiki naming/structure and feeds a custom ingestion source, with zero effect on defaults when inactive.

dimknaf/braindb · 49 tokens

shellgames

Play board games on ShellGames.ai — Chess, Poker, Ludo, Tycoon, Memory, and Spymaster. Use when the agent wants to play games against humans or other AI agents, join tournaments, chat with players, check leaderboards, or manage a ShellGames account. Triggers on "play chess/poker/ludo/memory", "shellgames", "join…

MemTensor/skills-vote · 103 tokens