cache-invalidate

cache-invalidate is a command for Claude Code from gonzalezpazmonica/savia. It costs 16 tokens per session (748 once invoked), scanned A, original, MIT.

A command that removes selected cached context, either by layer or only where tracked files have changed. Cache invalidation means discarding stored data so newer data can be used.

In plain words
What is it for?
Use it to inspect cache state, detect relevant changes in project files, and invalidate the tools, system, document-retrieval, or conversation layer.
Why use it?
It avoids keeping outdated tools, instructions, documents, or conversation context after changes. Selective removal can preserve unaffected cached data.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: agent in frontmatter; mentions CLAUDE.md.

Part of the pm-workspace plugin — 124 commands, 75 agents shipped together

Good fit Use it to inspect cache state, detect relevant changes in project files, and invalidate the tools, system, document-retrieval, or conversation layer.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/gonzalezpazmonica/savia/cache-invalidate
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.

Clone the repo
git clone --depth 1 https://github.com/gonzalezpazmonica/savia

Made for: Claude Code.

Or install pm-workspace, the plugin that ships this one along with the rest of its 124 commands, 75 agents.

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 cache-invalidate

README.md
[![agentmods](https://agentmods.dev/badge/commands/gonzalezpazmonica/savia/cache-invalidate.svg)](https://agentmods.dev/commands/gonzalezpazmonica/savia/cache-invalidate)
Your own site
<a href="https://agentmods.dev/commands/gonzalezpazmonica/savia/cache-invalidate"><img src="https://agentmods.dev/badge/commands/gonzalezpazmonica/savia/cache-invalidate.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 748 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.00016 $0.00748
Opus 5 $0.00008 $0.00374
Sonnet 5 $0.00003 $0.00150
Haiku 4.5 $0.00002 $0.00075

Measured yesterday against content hash e5a4938f174c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

cache-invalidate 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 yesterday.

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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/commands/cache-invalidate.md · 122 lines

How it starts

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

/cache-invalidate

🦉 Savia invalida solo la capa que cambió — fino, no brusco.


Cargar perfil de usuario

Grupo: Context Engineering — cargar:

  • workflow.md — para validar impacto de invalidación

Ver docs/rules/domain/context-map.md.


Parámetros

--layer tools|system|rag|conversation    Capa a invalidar (por defecto: todas)
--selective                               Invalidación granular vs. full flush
--lang es|en                              Idioma del output

Flujo

Paso 1 — Verificar caché actual

  1. Leer estado del caché: $HOME/.pm-workspace/cache-state.json
  2. Mostrar: tamaño total, por capa, timestamp creación, edad fragmentos

Paso 2 — Detectar cambios (para --selective)

Si --selective: detectar qué cambió en .git/index:

  • Tools: cambios docs/rules/ → invalidar TOOLS
  • System: cambios CLAUDE.md → invalidar SYSTEM
  • RAG: cambios docs/ → invalidar RAG
  • Conversation: comandos ejecutados → invalidar CONVERSATION

Paso 3 — Proponer invalidación

Sin --layer (auto):

🔄 Invalidación Automática

Layers afectadas:
├─ ✅ TOOLS (cambios reglas)      → Invalidar
├─ ✅ SYSTEM (cambios CLAUDE.md)  → Invalidar
├─ ✅ RAG (cambios docs)          → Invalidar
└─ ⏸️ CONVERSATION (en sesión)    → Mantener

¿Proceder? (y/n)

Paso 4 — Crear backup pre-invalidación

  1. Guardar snapshot: $HOME/.pm-workspace/cache-backups/cache-{timestamp}.json.bak
  2. Registrar qué se invalidó
  3. Mostrar ruta del backup

Paso 5 — Ejecutar invalidación

Granular (--selective):

  • Marcar fragmentos como "stale" en cache-state.json
  • No borrar — dejar que expiren según TTL
  • Cuando se acceda → recargar

Full flush (sin --selective):

  • Borrar layer completa
  • Próximo comando → recarga completa

Mostrar:

✅ Invalidación Completada

Layer TOOLS: 45 ficheros invalidados
Layer SYSTEM: 1 fichero invalidado
Layer RAG: 12 ficheros invalidados

Impacto: próximos comandos +3s latencia

Paso 6 — Registrar rollback

Read the full file on GitHub · 122 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. yesterday First seen · 122 lines · 16 tokens per session scan A e5a4938f174c

Subscribe to this mod's changes

cache-invalidate is a command published in the GitHub repository gonzalezpazmonica/savia (50 stars, last pushed yesterday), licensed MIT. It adds 16 tokens to every session and 748 once invoked, about $0.0001 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-06.