context-hygiene

Triggers smartphone's SOS emergency feature with rapid button presses.

Updated May 18, 2026
One-click install
npx skills add https://github.com/solitude6060/Yao-skills --skill context-hygiene-solitude6060
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-hygiene
Source: https://github.com/solitude6060/Yao-skills/tree/main/skills/context-hygiene
Command: npx skills add https://github.com/solitude6060/Yao-skills --skill context-hygiene-solitude6060

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents slow responses and runaway token costs by helping you control when session context should be compacted or cleared between unrelated tasks or long loops.

Core Features & Use Cases

  • Token-cost-aware context resetting: Uses clear thresholds (e.g., ~100k tokens, >4 hours, switching tasks) and explains why caching doesn’t eliminate per-turn output cost.
  • Mid-task cleanup with /compact: Shows when to compact during the same task while preserving the plan and relevant state.
  • Task-boundary handover with /clear: Guides writing a handover document to disk before clearing so the next session can resume correctly.
  • Loop and subagent cost hygiene: Provides checkpointing and routing guidance to reduce context bloat during ralph/autopilot/background loops and manage subagent-driven costs.

Quick Start

If your session has exceeded about 100k tokens or you’re switching to a new task, write a short handover to disk and then start the new phase with a clean context.

Frequently Asked Questions about context-hygiene

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce LLM token costs during long-running loops?

To reduce LLM token costs during long-running loops, apply context management by using /compact at mid-task checkpoints and clearing context at task boundaries. This prevents cumulative token bloat and lowers per-turn output latency.

What is the best way to manage session context when switching tasks?

The best way to manage session context when switching tasks is to write a handover document to disk and execute /clear. This preserves in-progress state for the next session while preventing unrelated context from inflating costs.

Does caching eliminate per-turn token costs in long sessions?

Caching does not eliminate per-turn token costs in long sessions. Even with caching active, growing context windows increase output token generation expenses, making periodic context compaction or clearing necessary for cost hygiene.

How do I compact context mid-task without losing my plan?

To compact context mid-task without losing your plan, use the /compact command to preserve the relevant state and current task plan. This focuses the session window while allowing long-running workflows to continue without resetting.

When should I clear context versus compacting it?

You should clear context when switching to entirely unrelated tasks, and compact context during the same task when the token count gets high. Clearing requires a disk-based handover document, while compacting preserves the active plan.

How do I control context bloat during subagent-heavy workflow routing?

To control context bloat during subagent-heavy workflow routing, apply cost-aware decision thresholds and use checkpointing. This manages subagent-driven expenses by resetting session context when crossing specific token or time limits.