context-hygiene

context-hygiene is a skill for Claude Code from wrg32786/aigent-os. It costs 33 tokens per session (750 once invoked), scanned A, original, MIT.

A scheduled cleanup method for two project memory files: an active-priorities list and a dated session log. It archives older session entries and checks that file contents have not changed unexpectedly.

In plain words
What is it for?
Use it to archive old session-log blocks, retain recent entries, preserve archive links, and validate the file structure before editing.
Why use it?
It keeps context manageable without rewriting unfamiliar content or deleting records without an archive.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: agent in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is node daemons/nightly-context-hygiene.mjs --root <aigent-root>.

Good fit Use it to archive old session-log blocks, retain recent entries, preserve archive links, and validate the file structure before editing.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/wrg32786/aigent-os
agentmods
npx agentmods add skills/wrg32786/aigent-os/context-hygiene

Made for: Claude Code.

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 context-hygiene

README.md
[![agentmods](https://agentmods.dev/badge/skills/wrg32786/aigent-os/context-hygiene/github.svg)](https://agentmods.dev/skills/wrg32786/aigent-os/context-hygiene)
Your own site
<a href="https://agentmods.dev/skills/wrg32786/aigent-os/context-hygiene"><img src="https://agentmods.dev/badge/skills/wrg32786/aigent-os/context-hygiene/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for context-hygiene

Your own site · 80×15
<a href="https://agentmods.dev/skills/wrg32786/aigent-os/context-hygiene"><img src="https://agentmods.dev/badge/skills/wrg32786/aigent-os/context-hygiene.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 750 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Anti-Refusal · line 55
    Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.
    Fix: Remove instructions that suppress warnings, disclaimers, or ethical commentary. Let the agent surface safety-relevant caveats to the user.
How audits are shown
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.00033 $0.00750
Opus 5.5 $0.00013 $0.00300
Sonnet 5.5 $0.00007 $0.00150
Haiku 4.5 $0.00003 $0.00075

Measured 4d ago against content hash 39817a9161bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

context-hygiene scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/context-hygiene/SKILL.md · 88 lines

How it starts

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

/context-hygiene

This is the sole bounded compaction exception to the Session Log chronicle. It runs only when invoked, never while the framework is being installed or tested against a real vault.

Precondition

  1. Read vault/memory/SESSION_LOG.md and vault/memory/ACTIVE_PRIORITIES.md.
  2. Hash both exact byte streams with SHA-256.
  3. Run:
node daemons/nightly-context-hygiene.mjs --root <aigent-root>

Green means no edit is needed. Red permits only the bounded archive below. Unreadable or unfamiliar content is a failure, not permission to rewrite.

Session Log archive

Live entries appear newest first by date. A capsule entry is one line in the form - YYYY-MM-DD capsule-id: summary. The date must be a real calendar date. The capsule id and its optional preceding short name are each one token without whitespace. The summary must have text on the same line. Capsule lines go above the dated blocks, and a dated line inside a block is part of that block. The checker treats frontmatter as ordinary text, so keep lines starting with a dash and a date or with ## and a date out of it, and keep fence markers balanced.

A dated H2 block starts with ## YYYY-MM-DD - title and contains one nonempty occurrence of each bold field listed below.

  • Objective
  • Completed
  • Decisions
  • Open threads
  • Next action

Archival rules:

  • Keep the newest five entries across both formats.
  • Move older entries as whole lines or whole blocks to vault/memory/SESSION_LOG_ARCHIVE_<YYYY-MM-DD>.md.
  • Preserve source text and order.
  • Preserve frontmatter, title, schema guidance, and archive links.
  • Dedupe one-line entries by exact line and blocks by exact dated heading plus block hash.
  • Refuse a block whose boundary cannot be determined without judgment.

Active Priorities archive

The mechanically checkable live shape contains:

  • exactly one ## Operating Mode: <mode> heading;
  • one to five live bullet priorities under ## Tier 1, ## Tier 2, or ## Tier 3 headings;
  • no placeholder priority;
  • one valid Last reviewed: YYYY-MM-DD line; and
  • no embedded ## Archived section.

Read the full file on GitHub · 88 lines

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. 4d ago Changed · +6 lines 39817a9161bc
  2. 23d ago Changed · -6 tokens per session 555687e99f0f
  3. 3mo ago First seen · 82 lines · 39 tokens per session scan A 7672f45c749b

Subscribe to this mod's changes

context-hygiene is a skill published in the GitHub repository wrg32786/aigent-os (26 stars, last pushed today), licensed MIT. It adds 33 tokens to every session and 750 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.

Related

context-hygiene compared with skills from other repositories

context-hygiene next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
context-hygienewrg32786/aigent-osSkill26todayMITA33Claude Code
distillhiphapis/loopcraftSkill24mo agononeA80Claude Code
memory-to-skillzilliztech/memsearchSkill3.0k3d agoMITA82Claude Code, Codex
memory-recallzilliztech/memsearchSkill3.0k3d agoMITA152Claude Code
learnAgentToolkit/altk-evolveSkill1434d agoApache-2.0A40Claude Code, Codex
evolve-lite:retentionAgentToolkit/altk-evolveSkill1434d agoApache-2.0A34Claude Code, Codex
adapt-memoryAgentToolkit/altk-evolveSkill1434d agoApache-2.0A23Claude Code