LEAP
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
Decision protocol for managing the context/session state of an AI coding tool: when to /clear, when to keep context, and how to detect "context bleed" — the failure mode where stale conversation history biases the model against the current task. Surfaces a discipline that Aider
$ npx -y skills add agentsope/SkillAlchemy --skill agentsop-session-state-hygiene --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/agentsop-session-state-hygieneContext preview
The summary Claude sees to decide when to auto-load this skill.
Decision protocol for managing the context/session state of an AI coding tool: when to /clear, when to keep context, and how to detect "context bleed" — the failure mode where stale conversation history biases the model against the current task. Surfaces a discipline that Aider
name: agentsop-session-state-hygiene version: 0.1.0 description: | Decision protocol for managing the context/session state of an AI coding tool: when to /clear, when to keep context, and how to detect "context bleed" — the failure mode where stale conversation history biases the model against the current task. Surfaces a discipline that Aider (/clear), Claude Code (/clear), CrewAI (memory=False, re-instantiate), and LangGraph (new thread_id, subgraph isolation) all encode separately but none name as a skill. phase: D tier: common frequency: daily audience: coder-agents and human engineers who run multi-turn LLM coding sessions source: aider-sop, crewai-sop, langgraph-sop (local) + vendor docs
> 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).
---
Activate this skill the moment **any** of these fire — they are the symptoms of context bleed, not vague unease:
bug B in the same window/REPL/thread. The A-history is now pure noise for B.
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]`.
`requests`" → it uses `requests` again).
3 but ignores turn 30).
`[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.
Do **not** activate for: a single LLM call, a one-shot RAG query, or a brand new session with <25k tokens that is behaving correctly. Hygiene on a clean window is just superstition — see §6.
---
**Context is signal; stale context is noise; clearing restores signal.**
Three load-bearing ideas ride this axiom:
Every turn you add to a session is evidence the model reasons over. Good evidence (the current goal, the relevant files, the last working diff) raises signal. Stale evidence (a failed approach you abandoned, a 5k-token search dump you no longer need, a file you dropped) raises noise. The signal-to-noise ratio of the window — not its absolute size — is what governs output quality. A 10k window of pure noise is worse than a 30k window of pure signal.
Aider's tooling is built around a hard, published number: above **~25k tokens** "most models start to become distracted" `[aider/edit-errors]`. No other framework publishes a number, but the heuristic transfers: treat ~25k as the point where you should be *actively* shedding context, not passively letting it grow. This is why `/tokens` exists and why it is the first move in Aider's edit-error remediation, *before* swapping model or edit format `[aider/edit-errors]`.
"Clear the context" is not one operation — it is a family ordered by blast radius. The skill is choosing the *smallest* cut that removes the noise:
smallest cut largest cut
┌───────────────┬────────────────┬───────────────┬──────────────────┐
│ drop one item │ trim history │ clear history │ fresh session / │
│ (a file, a │ (keep last N │ (keep files, │ new thread_id │
│ message) │ messages) │ drop history) │ (zero carry-over)│
└───────────────┴────────────────┴───────────────┴──────────────────┘
OP-004 partial OP-004 partial OP-002 save+clear OP-003 freshReaching for "fresh session" when a single `/drop` would do is as wrong as never clearing at all. Match the cut to the noise.
A subtle trap: "session state" is broader than the visible transcript. CrewAI's `memory=True` keeps a **separate persistent store** (LanceDB by default) that a `Crew()` re-instantiation does **not** wipe `[crewai/memory]`. LangGraph's state lives in a **checkpointer** keyed by `thread_id` — a new `thread_id` is clean, but reusing the old one resumes from the last checkpoint `[langgraph/persistence]`. "I cleared the chat but it still remembers" almost always means a persistent store you didn't clear (§6, AP-005).
---
The flow is four steps: **recognize → save what's worth → clear → restart focused.** Walk it top-down; each step has a gate.
Gate: *name the symptom in one line* before touching anything. "The model is still using the JWT approach we abandoned." "Token count is 38k and edits are failing." Naming forces you to identify the **single offending source**
Turn people, methods, and experience into installable, reusable agent skills. SkillAlchemy is an open-world agent skill creation system that turns underspecified skill briefs and open-world sources into installable, reusable agent skills.
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
Lens — Add a cognitive lens to any problem. It accepts a task description and produces an enhanced description that surfaces hidden dimensions, prerequisites,…
Cross-framework enhancement overlay for choosing a multi-agent topology BEFORE writing any agent. A binary-question rubric — is single-agent + tools enough? do…
SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format + human-in-loop REPL). Use when editing…
Screens biomedical / life-science papers for signs of data fabrication, image manipulation, and statistical anomalies, using the detection techniques distilled…
Universal discipline for any LM-driven loop — agent retries, plan-act-observe, multi-agent handoffs, optimiser passes, test-fix cycles. Encodes the one rule…