ir-analysis
Compute information retrieval quality metrics (precision, recall, MRR, nDCG, MAP) comparing file retrieval across baseline and MCP configs against ground truth.
Skill by sourcegraph
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sourcegraph-ir-analysis
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/ir-analysis
What's inside
- Skill name
ir-analysis- Description
- Compute information retrieval quality metrics (precision, recall, MRR, nDCG, MAP) comparing file retrieval across baseline and MCP configs against ground truth. Triggers on ir analysis, retrieval metrics, file recall, ground truth, search quality.
- License
- Apache-2.0
- Instructions
- 126 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- files: referenced but missing: scripts/ir_analysis.py
Files (1)
- SKILL.md
SKILL.md (first lines)
# IR Analysis Measure how well agents find the right files, comparing baseline (local tools) vs MCP (Sourcegraph) retrieval against per-task ground truth. ## What This Does Runs `scripts/ir_analysis.py` which: 1. Loads ground truth files per task from `configs/ground_truth_files.json` (or builds it from benchmark task dirs) 2. Parses agent transcripts (`agent/claude-code.txt`) to extract which files were accessed via tool calls 3. Computes IR metrics: Precision@K, Recall@K, F1@K, MRR, nDCG@K, MAP, file-level recall, context efficiency 4. Aggregates by benchmark and config, with statistical significance tests ## Steps ### 1. Ensure ground truth is built If `configs/ground_truth_files.json` doesn't exist or needs refreshing: ```bash cd ~/CodeScaleBench && python3 scripts/ir_analysis.py --build-ground-truth ``` This extracts ground truth files from each benchmark's task structure (patches, diffs, ground_truth dirs, test scripts, instructions). Reports per-benchmark counts and confidence levels. ### 2. Run the IR analysis ```bash cd ~/CodeScaleBench && python3 scripts/ir_analysis.py --json 2>/dev/null ``` Or for human-readable table output: ```bash cd ~/CodeScaleBench && python3 scripts/ir_analysis.py 2>/dev/null ``` ### 3. Parse and present key findings **Per-benchmark IR scores:** | Benchmark | Config | N | File Recall | MRR | P@5 | R@5 | nDCG@5 | MAP | Ctx Eff | |-----------|--------|--:|------------:|----:|----:|----:|-------:|----:|--------:| **Overall aggregates:** | Config | File Recall | MRR | MAP | Context Efficiency | |--------|------------:|----:|----:|-------------------:| | baseline | X | X | X | X | | sourcegraph_full | X | X | X | X | **Statistical tests (baseline vs SG_full):** | Metric | Welch's t | p-value | Cohen's d | Bootstrap 95% CI | |--------|----------:|--------:|----------:|-----------------:| ### 4. Interpret results Key metrics to focus on: - **File recall**: Fraction of ground truth files the agent accessed (most important) - **MRR**: How quickly the agent found the first relevant file (1.0 = first file accessed was relevant) - **Context efficiency**: Relevant files / total files accessed (higher = less noise) - **P@K**: Precision at top-K accessed files (were early accesses relevant?) ### 5. Per-task drill-down (optional) For detailed per-task scores: ```bash python3 scripts/ir_analysis.py --per-task --json 2>/dev/null ``` Filter to a specific benchmark: ```bash python3 scripts/ir_analysis.py --suite csb_sdlc_swebenchpro 2>/dev/null ``` ## Variants ### Build/refresh ground truth only ```bash python3 scripts/ir_analysis.py --build-ground-truth ``` ### JSON output for programmatic use ```bash python3 scripts/ir_analysis.py --json > /tmp/ir_results.json ``` ### Filter to one benchmark ```bash python3 scripts/ir_analysis.py --suite csb_sdlc_pytorch ``` ### Per-task detail ```bash python3 scripts/ir_analysis.py --per-task ``` ## Key Technical Notes - **Ground truth confidence levels**: "high" (from patches/diffs — SWE-bench Pro, PyTorch, K8s Docs), "medium" (from test scripts), "low" (regex from instructions). High-confidence tasks give the most reliable IR metrics. - **Transcript parsing**: Reads Harbor's nested JSONL format from `agent/claude-code.txt`. Extracts file paths from Read, Grep, Glob, Write, Edit tool inputs and MCP tool results. - **Path normalization**: Strips `/workspace/` prefix, `a/`/`b/` diff notation, lowercases for comparison. - **Baseline retrieval**: For runs without MCP, "retrieved files" come from local Read/Grep/Glob calls. This measures manual navigation quality vs MCP search quality. - **Deduplication**: When multiple batches exist for the same task+config, the latest (by `started_at` timestamp) wins. - **Statistical tests**: Uses pure-stdlib implementations from `csb_metrics/statistics.py` — Welch's t-test, Cohen's d, bootstrap CI. No scipy dependency. ## Ground Truth Sources | Benchmark | Strategy | Source File | Confidence | |-----------|----------|-------------|:----------:| | SWE-bench Pro | Patch headers | `solve.sh` / `solution/solve.sh` | high | | PyTorch | Diff headers | `tests/expected.diff` / `instruction.md` | high | | K8s Docs | Directory listing | `ground_truth/` | high | | Governance | Test script paths | `tests/test.sh` | medium | | Enterprise | Test script paths | `tests/test.sh` | medium | | Others | Instruction regex | `instruction.md` | low |
From sourcegraph/CodeScaleBench, Apache-2.0.
More from sourcegraph/CodeScaleBench
- 0.499score
validate-tasks
sourcegraph
Pre-flight validation of benchmark tasks before launching runs.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
check-infra
sourcegraph
Verify infrastructure readiness before launching benchmark runs — tokens, Docker, disk, credentials.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
archive-run
sourcegraph
Archive old completed benchmark runs to save disk space and speed up scans.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
triage-failure
sourcegraph
Investigate a specific failed benchmark task — read logs, identify root cause, check if known pattern, suggest fix.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
run-status
sourcegraph
Quick status check on the currently active benchmark run.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
whats-next
sourcegraph
Analyze current benchmark state and recommend what to work on next.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
compare-configs
sourcegraph
Compare benchmark results across agent configurations (baseline, SG_full).
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
quick-rerun
sourcegraph
Run a single benchmark task locally to verify a fix.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
cost-report
sourcegraph
Token and cost analysis per run, suite, and config.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
sync-metadata
sourcegraph
Reconcile task metadata between selected_benchmark_tasks.json and task.toml files.
SkillDFreshness: D★ 37Claude Code +9 - 0.495score
mcp-audit
sourcegraph
Analyze MCP tool usage patterns, reward/time deltas conditioned on MCP adoption, and zero-MCP investigation.
SkillDFreshness: D★ 37Claude Code +9 - 0.495score
generate-report
sourcegraph
Generate the aggregate CSB evaluation report from completed Harbor runs.
SkillDFreshness: D★ 37Claude Code +9
Signals
- Stars
- 37
- Forks
- 5
- Open issues
- 0
- Last commit (this folder)
- Mar 17, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/sourcegraph/CodeScaleBench
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from sourcegraph
- 0.499score
archive-run
sourcegraph
Archive old completed benchmark runs to save disk space and speed up scans.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
quick-rerun
sourcegraph
Run a single benchmark task locally to verify a fix.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
check-infra
sourcegraph
Verify infrastructure readiness before launching benchmark runs — tokens, Docker, disk, credentials.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
compare-configs
sourcegraph
Compare benchmark results across agent configurations (baseline, SG_full).
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
cost-report
sourcegraph
Token and cost analysis per run, suite, and config.
SkillDFreshness: D★ 37Claude Code +9 - 0.499score
run-status
sourcegraph
Quick status check on the currently active benchmark run.
SkillDFreshness: D★ 37Claude Code +9
Cite this page
ir-analysis skill. Agent Mart. https://agentmart.dev/skills/sourcegraph-ir-analysis (last updated 2026-10-24)