context-gc

context-gc is a skill for Claude Code, Codex from asherzj/ashers-agent-skills. It costs 56 tokens per session (978 once invoked), scanned A, original, MIT.

A read-only audit process for cleaning up project knowledge so it can be rebuilt from domain terms, architecture decisions, interfaces, code, and tests. It checks which source is authoritative when records disagree.

In plain words
What is it for?
Use it to audit context documents, architecture records, links, specifications, feature flags, compatibility layers, and task references, then separate mechanical fixes from changes that require human decisions.
Why use it?
It exposes stale, duplicated, contradictory, or unsupported documentation before anyone deletes or rewrites lasting project records.

Skill for Claude CodeCodex

Written for Claude Code and Codex: disable-model-invocation in frontmatter, but also agents/openai.yaml present. Also seen: mentions CLAUDE.md; mentions AGENTS.md.

Good fit Use it to audit context documents, architecture records, links, specifications, feature flags, compatibility layers, and task references, then separate mechanical fixes from changes that require human decisions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/asherzj/ashers-agent-skills/context-gc
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 asherzj/ashers-agent-skills --skill context-gc
Clone the repo
git clone --depth 1 https://github.com/asherzj/ashers-agent-skills

Made for: Claude Code, Codex.

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-gc

README.md
[![agentmods](https://agentmods.dev/badge/skills/asherzj/ashers-agent-skills/context-gc/github.svg)](https://agentmods.dev/skills/asherzj/ashers-agent-skills/context-gc)
Your own site
<a href="https://agentmods.dev/skills/asherzj/ashers-agent-skills/context-gc"><img src="https://agentmods.dev/badge/skills/asherzj/ashers-agent-skills/context-gc/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-gc

Your own site · 80×15
<a href="https://agentmods.dev/skills/asherzj/ashers-agent-skills/context-gc"><img src="https://agentmods.dev/badge/skills/asherzj/ashers-agent-skills/context-gc.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 978 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.
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.00056 $0.00978
Opus 5 $0.00028 $0.00489
Sonnet 5 $0.00011 $0.00196
Haiku 4.5 $0.00006 $0.00098

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

Security

Grade A, and why

context-gc 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 9d 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.

coding/context-gc/SKILL.md · 77 lines

What it actually says

项目上下文垃圾回收

项目上下文应当可从领域语言、架构决策、接口契约、代码和测试重新构建。本 Skill 先做只读审计,再让用户选择修复项;没有用户明确选择时,不删除、不重写长期记录。

1. 确定权威来源

先读取仓库的 AGENTS.mdCLAUDE.md,以及其指向的领域文档和工单约定。通常按以下职责判断权威位置:

  • 领域术语 → CONTEXT.md
  • 上下文关系和数据所有权 → CONTEXT-MAP.md
  • 难以回退且反直觉的取舍 → ADR;
  • 接口形状 → 类型、Schema、IDL 或 OpenAPI;
  • 行为约束 → 自动化测试;
  • 当前实现 → 代码、配置和迁移;
  • 当前工作 → 工单系统;
  • 原始讨论 → 逐字稿、会议记录或消息线程,仅作证据。

仓库有自己的规则时以仓库规则为准。不要把实现细节搬进领域词汇表。

2. 只读审计

检查并给出具体证据:

  1. 重复的 ADR 编号、失效链接和无效的 superseded 指针;
  2. 同一事实存在多个权威副本;
  3. 文档与代码、Schema、测试或运行配置矛盾;
  4. CONTEXT.md 混入实现状态、任务进度或临时设计;
  5. 架构文档仍描述已删除的模块、接口或依赖;
  6. 已完成、废弃或被取代的规格仍被当作当前规则;
  7. 临时兼容层、Feature Flag、旧 Adapter 或 TODO 没有删除条件和对应工单;
  8. 原始逐字稿中的未确认内容被升级为项目事实;
  9. 当前改动修改了代码语义,却没有同步相应的词汇、决策或行为证据。

把结果分成:

  • 确认一致:无需动作;
  • 可机械修复:编号、链接、索引等不涉及语义选择;
  • 需要人类决策:存在多个可能的当前真相;
  • 可归档或删除:已有明确替代物且无活跃引用。

报告每项的权威来源、冲突来源、建议动作和影响面。不要用文档的新旧时间戳代替语义判断。

3. 人类选择门禁

先展示审计结果,再让用户选择本轮修复项。删除、合并或改变长期语义必须逐项得到确认。发现真正的领域歧义时调用 grillingdomain-modeling;不能由 Agent 根据代码多数票决定业务含义。

4. 修复

按“一项事实、一个权威位置”处理:

  • 修正权威来源;
  • 其他位置改为引用或删除重复表述;
  • 被替代的 ADR 使用明确的 superseded 指针,保留其历史理由;
  • 原始逐字稿保留来源指针,不改写成规范;
  • 临时结构补充删除条件、责任工单和重新评估触发条件;
  • 只有术语或架构决策真实改变时才更新 CONTEXT.md 或 ADR。

不要顺手重构业务代码。审计暴露出的代码工作应提出为独立工单,只在用户或仓库流程授权时发布,再按合适的交付流程推进。

5. 验证与完成

重新运行链接、引用、编号和仓库规定的文档检查;抽样用代码和测试交叉验证已修复内容。最终报告:

  • 修复了哪些冲突;
  • 哪些记录被标记为已取代;
  • 哪些内容被删除或改为引用;
  • 哪些问题转成了工单;
  • 仍需人类决定的事项。

只有所有已选择修复项都完成且没有制造新的重复事实时,本轮垃圾回收才算完成。

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. 9d ago First seen · 77 lines · 56 tokens per session scan A bffc2907b3a3

Subscribe to this mod's changes

context-gc is a skill published in the GitHub repository asherzj/ashers-agent-skills (2 stars, last pushed 12d ago), licensed MIT. It adds 56 tokens to every session and 978 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

media-ingest

Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.

garrytan/gbrain · 52 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens

memory

Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.

opensquilla/opensquilla · 44 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

establishing-project-context

Use when the user asks to establish shared project language, or project work exposes a conflicting, renamed, or deprecated domain term that needs active semantic modeling. Routine small tasks stay on the fast path.

GanyuanRan/Aegis · 45 tokens