codesage-eval

A command that tests CodeSage search against real questions from a project's Claude Code session history. It builds a project-specific test collection from those past queries and reports the search results.

In plain words
What is it for?
Evaluate an onboarded project after it has enough session history, measure retrieval accuracy, and inspect which real queries find the right files.
Why use it?
It shows whether search works for the questions developers actually ask, rather than only for a general test suite.

Command

Part of the codesage-tools plugin — 1 skill, 10 commands, 2 agents, 1 hook 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 commands/iliaal/codesage/codesage-eval
Clone the repo
git clone --depth 1 https://github.com/iliaal/codesage

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

Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 985 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.00024 $0.00985
Opus 5 $0.00012 $0.00492
Sonnet 5 $0.00005 $0.00197
Haiku 4.5 $0.00002 $0.00098

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

Security

Grade A, and why

codesage-eval 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.

plugins/codesage-tools/commands/codesage-eval.md · 64 lines

How it starts

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

Evaluate CodeSage effectiveness on a specific project

Wraps ${CLAUDE_PLUGIN_ROOT}/bin/codesage-eval. Post-deployment effectiveness check: mine real user queries from this project's Claude Code session history, run them through CodeSage, and report how well retrieval actually performs on queries the user has asked on this codebase.

Use this AFTER /codesage-onboard and after the project has accumulated enough Claude Code session history (rule of thumb: at least a dozen sessions with real queries). On a freshly onboarded project with no session history, this command will fail with a clear error.

This is separate from /codesage-bench, which runs a regression suite across all corpora under $CODESAGE_BENCH_CORPUS_DIR (default: ./bench-corpora). /codesage-eval builds a fresh project-specific corpus every run (unless --no-extract is passed).

Step 1: Validate arguments

$ARGUMENTS — first positional arg is the project path. It must be a directory that exists AND has a corresponding ~/.claude/projects/<slug>/ directory with session transcripts. If either is missing, stop and explain why to the user.

Step 2: Run the eval

${CLAUDE_PLUGIN_ROOT}/bin/codesage-eval $ARGUMENTS

The script does two things:

  1. Mines up to --max-cases (default 50) session-based eval cases from the project's Claude Code history. Writes them to <corpus-dir>/<project-name>-session-eval.yaml, overwriting any previous extract unless --no-extract is passed.
  2. Runs codesage-bench-runner against the fresh corpus and saves a timestamped scorecard under <corpus-dir>/history/.

Total runtime: usually 30-90 seconds for a small corpus on GPU. Background if it runs over 2 minutes.

Step 3: Report the metrics

Surface the summary the script prints:

  • Cases mined
  • Miss rate (% of queries where no ground-truth file landed in top-10)
  • Median first-hit rank
  • Mean recall@5 and recall@10

Reference baselines from prior runs of this corpus (stored under the history/ subdirectory of $CODESAGE_BENCH_CORPUS_DIR). A reasonable healthy target across application codebases is miss rate ≤ 15% and recall@10 ≥ 0.55. If the fresh numbers regress noticeably vs a prior run on the same corpus, flag that clearly.

Read the full file on GitHub · 64 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 · 64 lines · 24 tokens per session scan A 6fe8697d02fa

Subscribe to this mod's changes

codesage-eval is a command published in the GitHub repository iliaal/codesage (20 stars, last pushed 3d ago), licensed MIT. It adds 24 tokens to every session and 985 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-08-30.