autosearch:context-retention-policy

autosearch:context-retention-policy is a skill for Claude Code from 0xmariowu/Autosearch. It costs 89 tokens per session (1,188 once invoked), scanned A, original, MIT.

A policy for managing an AI agent’s working context during long research sessions. It says which recent results and important records to keep, when to move older evidence to files, and when to summarize it.

In plain words
What is it for?
Controlling tool-result history, archiving older research evidence, triggering context compaction, and retaining citations, rubrics, and other required records.
Why use it?
Research can produce more material than the agent can keep in its active context. The policy helps preserve citations and planning information while reducing older evidence.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the autosearch plugin — 55 skills, 1 agent shipped together

Good fit Controlling tool-result history, archiving older research evidence, triggering context compaction, and retaining citations, rubrics, and other required records.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/0xmariowu/autosearch/context-retention-policy
Install

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.

Any agent
npx skills add 0xmariowu/Autosearch --skill context-retention-policy
Clone the repo
git clone --depth 1 https://github.com/0xmariowu/Autosearch

Made for: Claude Code.

Or install autosearch, the plugin that ships this one along with the rest of its 55 skills, 1 agent.

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 autosearch:context-retention-policy

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xmariowu/autosearch/context-retention-policy/github.svg)](https://agentmods.dev/skills/0xmariowu/autosearch/context-retention-policy)
Your own site
<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.

agentmods 80×15 button for autosearch:context-retention-policy

Your own site · 80×15
<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>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,188 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 pass 7 Sept 2026
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.00089 $0.01188
Opus 5 $0.00044 $0.00594
Sonnet 5 $0.00018 $0.00238
Haiku 4.5 $0.00009 $0.00119

Measured 11d ago against content hash 30cb07dd25f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

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 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (__init__.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

autosearch/skills/meta/context-retention-policy/SKILL.md · 115 lines

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:

  1. Sort evidence / tool_results by age (oldest first).
  2. Identify candidates — everything NOT in never_compact and older than the last K results.
  3. 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_path for later recovery.
  4. Replace the original items with the digest. Keep URLs in the citation_index so citations still resolve.
  5. 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.

Read the full file on GitHub · 115 lines

Files

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.

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. 11d ago First seen · 115 lines · 89 tokens per session scan A 30cb07dd25f7

Subscribe to this mod's changes

autosearch:context-retention-policy is a skill published in the GitHub repository 0xmariowu/Autosearch (44 stars, last pushed 1mo ago), licensed MIT. It adds 89 tokens to every session and 1,188 once invoked, about $0.0004 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-08-30.

Related

Other skills, from other repositories

memem-mine

Opt in to memem's event-triggered mining. New sessions are mined automatically via the Stop hook.

TT-Wang/memem · 26 tokens

hypothesis-tracking

Retrieve and update company hypotheses in Primr. Use when the user asks what is already known, wants to validate a claim, or wants to persist a research finding.

blisspixel/primr · 38 tokens

stats

Show Captain Memo's corpus statistics (chunks per channel, observation counts, indexing progress, embedder info). Use when the user types /captain-memo:stats.

kalinbogatzevski/captain-memo · 36 tokens

observations

List recent captured session observations (the Haiku-summarized voyage logs). Use when the user wants to see what Captain Memo has logged from past sessions.

kalinbogatzevski/captain-memo · 34 tokens

recall

Use find before WebSearch or WebFetch for research, or before answering a why/how/what-did-we-decide question. Quarry indexes this codebase, design docs, prior session transcripts, and previously fetched web pages — it often already has the answer. Prefer grep for symbol and value lookups; prefer find for meaning.…

punt-labs/quarry · 155 tokens

claude-bridge-role-memory-keeper

Playbook for a Claude Code agent in the dedicated memory keeper role — single-writer for shared agent memory across a team of 3+ peers. Use when you are designated as the keeper (= other peers send you write candidates, you write them and watch for drift). Memory hygiene + reconciliation against the canon + drift…

michalekz/claude-bridge · 102 tokens