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.
npx skills add 0xmariowu/Autosearch --skill context-retention-policygit clone --depth 1 https://github.com/0xmariowu/AutosearchWrote 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/0xmariowu/autosearch/context-retention-policy)<a href="https://agentmods.dev/skills/0xmariowu/autosearch/context-retention-policy"><img src="https://agentmods.dev/badge/skills/0xmariowu/autosearch/context-retention-policy/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.
<a href="https://agentmods.dev/skills/0xmariowu/autosearch/context-retention-policy"><img src="https://agentmods.dev/badge/skills/0xmariowu/autosearch/context-retention-policy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00089 | $0.01188 |
| Opus 5.5 | $0.00036 | $0.00475 |
| Sonnet 5.5 | $0.00018 | $0.00238 |
| Haiku 4.5 | $0.00009 | $0.00119 |
Grade A, and why
autosearch:context-retention-policy 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 1mo 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 — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context Retention Policy — Session-Level Context Governance
A research session can generate more evidence / tool results than any reasonable context window. This skill tells the runtime AI what to keep, what to offload, and when to compact.
Policy Parameters (defaults)
policy:
keep_last_k_tool_results: 12 # inline, full
keep_all_citations_index: true # citation_index stays in context always
keep_all_rubrics: true # rubrics stay in context always
offload_trigger_token_ratio: 0.7 # compact when context ≥ 70% full
offload_target_token_ratio: 0.4 # after compact, aim for 40% full
offload_archive_path: "session/<id>/offloaded/<ts>.jsonl"
prefer_compact_over_drop: true # summarize instead of silently drop
never_compact:
- clarify_result
- reflective_loop_state
- graph_plan
- citation_index
- rubrics
Compaction Procedure
When current_tokens / max_tokens >= offload_trigger_token_ratio:
- Sort evidence / tool_results by age (oldest first).
- Identify candidates — everything NOT in
never_compactand older than the last K results. - For each candidate batch (every ~3 evidence items):
- If
prefer_compact_over_drop: use a Fast-tier LLM to summarize the batch into a single "digest" item (5-10 lines max, preserves URLs + key specifics verbatim). - Else: drop the batch but write full content to
offload_archive_pathfor later recovery.
- If
- Replace the original items with the digest. Keep URLs in the citation_index so citations still resolve.
- Recheck token ratio. If still above
offload_target_token_ratio, iterate.
Preservation Rules (never compact these)
- The current reflective-search-loop state (gaps, visited, bad_urls).
- The current graph-search-plan graph structure.
- The citation-index entries (they're short and referenced by all sections).
- The rubrics from run_clarify.
- The original query + clarify verification message.
- The last 3 tool results regardless of K.
What ships with it
1 file 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.
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.
- 1mo ago First seen · 115 lines · 89 tokens per session scan A 30cb07dd25f7
autosearch:context-retention-policy is a skill published in the GitHub repository 0xmariowu/Autosearch (52 stars, last pushed 2d ago), licensed MIT. It adds 89 tokens to every session and 1,188 once invoked, about $0.0004 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-08-30.
Other skills, from other repositories
quarry-capture
Persist something worth keeping into quarry so it survives context compaction and is findable by quarry-recall later — a durable fact, a distilled lesson, or a URL to index. Trigger phrases: "remember this", "save this fact", "note that we decided X", "learn this lesson", "the rule going forward is X", "ingest this…
quarry-recall
Retrieve what quarry already knows before researching from scratch or guessing. Covers three overlapping intents, one tool: understand code ("how does X work", "where is X defined", "what calls X"); recall project knowledge or a decision ("what did we decide about X", "why is it this way", "did we consider Y…
stats
Show Captain Memo's corpus statistics (chunks per channel, observation counts, indexing progress, embedder info). Use when the user types /captain-memo:stats.
search
Hybrid search across Captain Memo's local memory + skills + observations. Use when the user types /captain-memo:search to retrieve top hits without the model having to decide whether to call searchall on its own.
doctor
Health probe across the worker, embedder, summarizer, queue, vector index, schema, cross-AI wiring and plugin install (cache and live versions). Use when the user types /captain-memo:doctor or when something seems wrong.
observations
List recent captured session observations (the summarized voyage logs). Use when the user wants to see what Captain Memo has logged from past sessions.