codebase-memory-index.freshness

codebase-memory-index.freshness is a cursor rule for Claude Code, Cursor from YuDefine/nuxt-supabase-starter. It costs 0 tokens per session (786 once invoked), scanned A, original, MIT.

Rules for keeping a codebase memory index up to date. A codebase memory index is a searchable record of a repository's code and relationships used by agent tools.

In plain words
What is it for?
It helps check index health, detect stale or missing indexes, refresh an old clean index, and decide whether graph searches are safe to use.
Why use it?
An index can be missing, stale, or based on an unknown revision, causing searches to describe the wrong code. These checks verify its freshness after commits, rebases, pulls, or session starts without assuming that hooks are connected.

Cursor rule for Claude CodeCursor

Written for Claude Code and Cursor: PostToolUse hook event, but also installed under .cursor/. Also seen: mentions AGENTS.md; mentions Codex.

Good fit It helps check index health, detect stale or missing indexes, refresh an old clean index, and decide whether graph searches are safe to use.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness
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/YuDefine/nuxt-supabase-starter

Made for: Claude Code, Cursor.

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 codebase-memory-index.freshness

README.md
[![agentmods](https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness/github.svg)](https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness)
Your own site
<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness/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 codebase-memory-index.freshness

Your own site · 80×15
<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/codebase-memory-index.freshness.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 786 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.00000 $0.00786
Opus 5 $0.00000 $0.00393
Sonnet 5 $0.00000 $0.00157
Haiku 4.5 $0.00000 $0.00079

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

Security

Grade A, and why

codebase-memory-index.freshness 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.

template/.cursor/rules/codebase-memory-index.freshness.mdc · 35 lines

What it actually says

codebase-memory index 保鮮的機械層

本檔是 [[codebase-memory-index]] 的 path-scoped sibling。三條 NEVER(裸跑 CLI/繞過 wrapper/ 把 auto_indexauto_watch 設回 true)留在常駐層,NEVER 因為本檔沒載入就當作可以裸跑。

已接通的 Claude hook 覆蓋
post-bash-cbm-index-refresh.sh / native PostToolUse 比對當下 HEAD 與 provenance;已有索引且 working tree 乾淨時,背景更新過期索引
session-start-cbm-index-check.sh / native SessionStart 同一健康判定,涵蓋人手動 commit、rebase / pull;缺索引、未知來源、dirty 或失敗時提示,同 session 狀態不變不重複

上表的自動觸發以該產品入口已安裝、啟用並驗證 hook 為前提。Codex/Cursor 的 hook adapter 存在不代表這兩支 handler 已接通。沒有該入口的自動檢查證據時,agent 在首次使用圖譜前, 從目前 repo 執行 bash ~/offline/clade/plugins/hub-core/hooks/session-start-cbm-index-check.sh, 讀取提示再決定是否經 wrapper 更新;commit/rebase/pull 後若還要查圖譜,再做相同檢查。 Clade 不在預設位置時使用其實際 checkout 路徑。檢查程式缺席或無法執行就回報保鮮未驗, 不把缺少自動觸發當成 index 新鮮,也不啟用 auto_indexauto_watch 補洞。

改動 config 或 wrapper 參數前先讀 [[pitfall-cbm-auto-index-concurrent-oom]]。

REQUIRED 欄位 內容
觸發條件 session-start-cbm-index-check.sh 在 index 落後 HEAD 或 DB 缺失 / 不可讀、dirty 或 provenance 不明時提示。提示不 block;已有索引且乾淨的過期 HEAD 自動背景刷新,缺索引仍由 bootstrap 或 wrapper 建立
消費端 要用 search_graph / trace_path / get_code_snippet 的 agent(讀提示決定要不要先 index);Claude hooks、Codex / Cursor 原生投影與 Pi extension 共用 cbm-health.ts
載入路徑 本檔由共同 rules planner 交付到所選 runtime 的原生規約入口;Claude 為 .claude/rules/codebase-memory-index.md,Codex baseline 為 AGENTS.md,Cursor 為 .cursor/rules/;clade home 經 .claude/rules/local/ pointer。規約載入與 hook 自動觸發分別驗證
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 · 35 lines · 0 tokens per session scan A 128f780eebee

Subscribe to this mod's changes

codebase-memory-index.freshness is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 786 tokens. 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-11.