codesage-reset

codesage-reset is a command for Claude Code from iliaal/codesage. It costs 29 tokens per session (1,172 once invoked), scanned A, original, MIT.

A command that deletes a project's CodeSage search index and creates it again from the source files. An index is the stored data that makes code search possible.

In plain words
What is it for?
Rebuild after changing search models or devices, upgrading incompatible storage, or recovering from a damaged index.
Why use it?
It repairs corrupted or incompatible search data and applies settings changes that an incremental refresh cannot safely handle.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the codesage-tools plugin — 1 skill, 10 commands, 2 agents, 1 hook shipped together

Good fit Rebuild after changing search models or devices, upgrading incompatible storage, or recovering from a damaged index.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/iliaal/codesage/codesage-reset
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/iliaal/codesage

Made for: Claude Code.

Or install codesage-tools, the plugin that ships this one along with the rest of its 1 skill, 10 commands, 2 agents, 1 hook.

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 codesage-reset

README.md
[![agentmods](https://agentmods.dev/badge/commands/iliaal/codesage/codesage-reset/github.svg)](https://agentmods.dev/commands/iliaal/codesage/codesage-reset)
Your own site
<a href="https://agentmods.dev/commands/iliaal/codesage/codesage-reset"><img src="https://agentmods.dev/badge/commands/iliaal/codesage/codesage-reset/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 codesage-reset

Your own site · 80×15
<a href="https://agentmods.dev/commands/iliaal/codesage/codesage-reset"><img src="https://agentmods.dev/badge/commands/iliaal/codesage/codesage-reset.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,172 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.00029 $0.01172
Opus 5.5 $0.00012 $0.00469
Sonnet 5.5 $0.00006 $0.00234
Haiku 4.5 $0.00003 $0.00117

Measured 24d ago against content hash b8d715a9672c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

codesage-reset 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 24d 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.

plugins/codesage-tools/commands/codesage-reset.md · 56 lines

How it starts

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

Rebuild a CodeSage index

Use a full rebuild after parser upgrades, embedding model or pooling changes, or CPU/GPU device changes. It reparses source and regenerates embeddings without unlinking the live SQLite database. For an ordinary incremental refresh, use /codesage-reindex.

Resolve the project and authority

Resolve $ARGUMENTS to an absolute project path, defaulting to the current directory. Require an existing .codesage directory and configuration. Run commands from that project directory.

Before touching any .codesage/ path, reject symlinked directories and symlinked or non-regular leaves. Check with test -L, which detects dangling links too. Include the database, its -wal and -shm companions, indexing.lock, configuration, and watcher markers. Use freshly generated backup or temporary names.

An explicit request to reset this project or --yes authorizes the ordinary full rebuild; do not ask again. If authority is missing, describe the target and full embedding cost before requesting it. Do not promise a fixed duration.

Capture the baseline

Run codesage status --json and record retained files and chunks, plus semantic freshness. If status fails, preserve the exact error and classify it before proceeding. An embedding/configuration error does not prove database corruption. Use the offline recovery section only for a confirmed unreadable or incompatible database that cannot be rebuilt in place.

Rebuild in place

Run:

codesage index --full --lock-wait 30

The command acquires the project's writer lock before opening the database. It waits up to 30 seconds for another writer, including the watcher. Exit 75 means contention prevented the rebuild; report that outcome and retry only after the holder finishes. Never delete the database or lock file to bypass contention.

Keep the same process handle when waiting for a long-running rebuild. Read the structural and semantic failed-file counts as well as the exit status; a zero exit status with failed files is a partial rebuild.

Read the full file on GitHub · 56 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. 24d ago Changed b8d715a9672c
  2. 1mo ago Changed · -20 lines · +2 tokens per session 6b83caeceae0
  3. 1mo ago First seen · 76 lines · 27 tokens per session scan A d9fed4c81186

Subscribe to this mod's changes

codesage-reset is a command published in the GitHub repository iliaal/codesage (21 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 1,172 once invoked, about $0.0001 per session on Opus 5.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.