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.
git clone --depth 1 https://github.com/wrg32786/aigent-osnpx agentmods add skills/wrg32786/aigent-os/context-hygieneWrote 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.
[](https://agentmods.dev/skills/wrg32786/aigent-os/context-hygiene)<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="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector warn
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.
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00039 | $0.00625 |
| Opus 5 | $0.00019 | $0.00313 |
| Sonnet 5 | $0.00008 | $0.00125 |
| Haiku 4.5 | $0.00004 | $0.00063 |
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 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.
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.
How it starts
The opening of the file, as written. The whole thing — 82 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
- Read
vault/memory/SESSION_LOG.mdandvault/memory/ACTIVE_PRIORITIES.md. - Hash both exact byte streams with SHA-256.
- 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
The executable target schema uses newest-first dated H2 blocks. A canonical
block starts with ## YYYY-MM-DD - title and contains one nonempty occurrence
of each field:
ObjectiveCompletedDecisionsOpen threadsNext action
Archival rules:
- Keep the newest five live dated blocks.
- Move older 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 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 3headings; - no placeholder priority;
- one valid
Last reviewed: YYYY-MM-DDline; and - no embedded
## Archivedsection.
Move only content explicitly marked stale, superseded, or archived to
vault/memory/ACTIVE_PRIORITIES_ARCHIVE_<YYYY-MM-DD>.md. If removal requires a
human decision, preserve it and report the gate.
Compare-and-swap
Immediately before each write, hash the live source again. If either hash
differs from the precondition hash, abort with CONTEXT_HYGIENE_RACE. Archive
must be durable before the source is trimmed.
After writing, re-run the checker. Only its literal
CONTEXT_HYGIENE PASS receipt may record the checkpoint green. Return archive
paths and before/after hashes in bounded detail. Never touch another memory
file.
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.
- 7d ago First seen · 82 lines · 39 tokens per session scan A 7672f45c749b
context-hygiene is a skill published in the GitHub repository wrg32786/aigent-os (18 stars, last pushed today), licensed MIT. It adds 39 tokens to every session and 625 once invoked, about $0.0002 per session on Opus 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.
Other skills, from other repositories
hive.context-preservation
Proactively extract critical values from tool results into working notes before automatic context pruning destroys them.
hive.note-taking
Maintain a free-form scratchpad of decisions, extracted values, and open questions so context pruning doesn't lose anything you still need.
memory-flush
Promote important recent log entries into MEMORY.md and prune stale ones.
Vizra ADK Memory System
Implement persistent memory, session context, and vector memory (RAG) for AI agents.
continuum-memory
Configure and use Continuum's two-tier memory system — mem0+Qdrant/Milvus for long-term facts, Redis for short-term sessions, with multi-tenant scopes (USER / AGENT / SHARED / RUN / CONVERSATION). Invoke when the user asks about "remember", "user preferences", "long-term memory", "vector search over memories"…
carryover
Use when recalling, saving or curating carryover memory, wikis, playbooks or the Obsidian vault.