staleness-gate

staleness-gate is a skill for Claude Code, Codex from benmarte/codemunch. It costs 54 tokens per session (1,310 once invoked), scanned A, original, MIT.

An automatic check that keeps codemunch's code map up to date before a search or other code query runs.

In plain words
What is it for?
Use it for first-time setup, freshness checks, and incremental updates that re-index only affected source files.
Why use it?
It removes the need to remember manual indexing and prevents results from relying on changed, added, or deleted source files.

Skill for Claude CodeCodex

Part of the codemunch plugin — 8 skills, 10 commands, 2 hooks shipped together

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.

agentmods
npx agentmods add skills/benmarte/codemunch/staleness-gate
Any agent
npx skills add benmarte/codemunch --skill staleness-gate
Clone the repo
git clone --depth 1 https://github.com/benmarte/codemunch

Made for: Claude Code, Codex.

Or install codemunch, the plugin that ships this one along with the rest of its 8 skills, 10 commands, 2 hooks.

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 staleness-gate

README.md
[![agentmods](https://agentmods.dev/badge/skills/benmarte/codemunch/staleness-gate.svg)](https://agentmods.dev/skills/benmarte/codemunch/staleness-gate)
Your own site
<a href="https://agentmods.dev/skills/benmarte/codemunch/staleness-gate"><img src="https://agentmods.dev/badge/skills/benmarte/codemunch/staleness-gate.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,310 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00054 $0.01310
Opus 5 $0.00027 $0.00655
Sonnet 5 $0.00011 $0.00262
Haiku 4.5 $0.00005 $0.00131

Measured 3d ago against content hash 896c903dfaff, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

staleness-gate 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 3d 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/staleness-gate/SKILL.md · 161 lines

How it starts

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

Staleness Gate Skill

Ensures the codemunch index is fresh before any query runs. This skill is called automatically — users never invoke it directly.

Decision flow

1. Does .claude/codemunch/index.json exist?
   NO  → First-run: run detect-lsp skill, then full index skill → done
   YES → Continue to step 2

2. Get index timestamp from index.json "generated" field

3. Find files changed since index was built:
   git diff --name-only --diff-filter=ACMRD $(git log -1 --format=%H --before="$GENERATED_TIMESTAMP") HEAD

   Also check for untracked source files:
   git ls-files --others --exclude-standard

4. Filter to source files only (exclude non-code files like .md, .txt, images, etc.)

5. Are there changed source files?
   NO  → Index is fresh, proceed with query
   YES → Run incremental re-index (step 6)

6. Incremental re-index:
   - For each changed/added file: re-extract symbols using the best available engine
   - For each deleted file: remove its symbols from the index
   - Update the "generated" timestamp
   - Update the "file_hashes" manifest
   - Report: "Auto-updated index: +N symbols, -M symbols, K files re-indexed"

Step 1 — Check index exists

# Check for index
if [ -f .claude/codemunch/index.json ]; then
  echo "INDEX_EXISTS"
else
  echo "NO_INDEX"
fi

If NO_INDEX:

  1. Check if .claude/codemunch/config.json exists — if not, run the detect-lsp skill first
  2. Run the index skill with full mode
  3. Report: "First-run: auto-built codemunch index (N symbols across M files)"
  4. Continue with the original query

Step 2 — Get index timestamp

# Extract the generated timestamp from index
python3 -c "
import json
with open('.claude/codemunch/index.json') as f:
    idx = json.load(f)
print(idx.get('generated', ''))
" 2>/dev/null || jq -r '.generated' .claude/codemunch/index.json

Step 3 — Find changed files since index was built

GENERATED="2026-03-11T02:14:00Z"

# Find the commit closest to when the index was built
BASE_COMMIT=$(git log -1 --format=%H --before="$GENERATED" 2>/dev/null)

if [ -z "$BASE_COMMIT" ]; then
  # No commit found before timestamp — index predates all commits, do full re-index
  echo "FULL_REINDEX_NEEDED"
else
  # Get changed files since that commit
  git diff --name-only --diff-filter=ACMRD "$BASE_COMMIT" HEAD 2>/dev/null
fi

# Also check untracked files (new files not yet committed)
git ls-files --others --exclude-standard 2>/dev/null

Read the full file on GitHub · 161 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. 3d ago First seen · 161 lines · 54 tokens per session scan A 896c903dfaff

Subscribe to this mod's changes

staleness-gate is a skill published in the GitHub repository benmarte/codemunch (7 stars, last pushed 5mo ago), licensed MIT. It adds 54 tokens to every session and 1,310 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

glossary-init

USE WHEN setting up a repo for AI-first work, when an agent hallucinates domain term meaning, or when user asks to bootstrap / extend the repo's domain glossary. Surfaces candidate terms by identifier frequency, asks the user for 1-sentence definitions, writes GLOSSARY.md at repo root. Idempotent — re-running adds new…

Filip-Podstavec/claude-leverage · 119 tokens

codex-pair-resume

Resume codex-pair for this project after a previous pause. Removes .codex-pair/state/paused and clears failure state. Review resumes on the next supported file edit; missing state is a no-op.

Lykhoyda/ask-llm · 51 tokens

conventions-init

USE WHEN setting up a repo for AI-first work (after /init-repo), or when the context-surface hook should start feeding repo conventions to agents before edits. Drafts conventions.yml at repo root: per-kind casing (inferred from the code), a vague-name denylist seed, directory roles, and a hand-filled house-rules…

Filip-Podstavec/claude-leverage · 124 tokens

opik

This skill should be used when the user needs to add Opik tracing or integrations to their code, instrument an LLM application, or needs reference for Opik SDK usage (Python, TypeScript, REST API). Use for tasks like "add tracing", "instrument my code", "use trackopenai", "add OpikTracer", "what span types are…

comet-ml/opik-claude-code-plugin · 84 tokens

codex-review

Get a second opinion from OpenAI Codex on your current code changes. Analyzes staged/unstaged diffs and returns prioritized findings. Use when user asks to "review with Codex", "Codex code review", or "ask Codex to check my code".

Lykhoyda/ask-llm · 60 tokens

ollama-review

Get a second opinion from a local Ollama LLM on your current code changes. Analyzes staged/unstaged diffs and returns prioritized findings. No API keys needed. Use when user asks to "review with Ollama", "local code review", or "review offline".

Lykhoyda/ask-llm · 61 tokens