semantic-grep

semantic-grep is a skill for Claude Code from oaustegard/claude-skills. It costs 107 tokens per session (2,203 once invoked), scanned A, original, MIT.

A meaning-based search tool for text files. It can find passages related to an idea even when they do not use the exact words in the search query.

In plain words
What is it for?
Use it to locate notes, documents, or code discussions connected to a concept such as retry logic or regulatory constraints.
Why use it?
It helps when ordinary text search misses relevant wording or finds too many literal matches.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the code-intelligence plugin — 5 skills shipped together

Good fit Use it to locate notes, documents, or code discussions connected to a concept such as retry logic or regulatory constraints.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/oaustegard/claude-skills/semantic-grep
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.

Any agent
npx skills add oaustegard/claude-skills --skill semantic-grep
Clone the repo
git clone --depth 1 https://github.com/oaustegard/claude-skills

Made for: Claude Code.

Or install code-intelligence, the plugin that ships this one along with the rest of its 5 skills.

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 semantic-grep

README.md
[![agentmods](https://agentmods.dev/badge/skills/oaustegard/claude-skills/semantic-grep/github.svg)](https://agentmods.dev/skills/oaustegard/claude-skills/semantic-grep)
Your own site
<a href="https://agentmods.dev/skills/oaustegard/claude-skills/semantic-grep"><img src="https://agentmods.dev/badge/skills/oaustegard/claude-skills/semantic-grep/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 semantic-grep

Your own site · 80×15
<a href="https://agentmods.dev/skills/oaustegard/claude-skills/semantic-grep"><img src="https://agentmods.dev/badge/skills/oaustegard/claude-skills/semantic-grep.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 107 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,203 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00107 $0.02203
Opus 5 $0.00053 $0.01102
Sonnet 5 $0.00021 $0.00441
Haiku 4.5 $0.00011 $0.00220

Measured 2d ago against content hash 8f2fa35bb575, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

semantic-grep scanned grade A with 1 finding 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 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/semantic_grep.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
plugins/code-intelligence/skills/semantic-grep/SKILL.md · 153 lines

How it starts

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

Semantic Grep

jina-grep-style semantic search, done in-process via Python rather than as an external CLI. Embeds query + corpus chunks with gemini-embedding-2, ranks by cosine similarity, returns grep-format output.

When Semantic Search Helps

The core trade-off (lifted from jina-grep-cli's own docs and validated in testing):

Task Tool
Known exact string, filename, or regex grep / rg / searching-codebases
"What files discuss concept X" when X may not appear verbatim semantic-grep
Hybrid: prefilter with grep, rerank by concept grep → rerank_candidates()

Regression test result (workshop session corpus, 135 docs):

  • "handling regulatory constraints" → top hit "Engineering AI Systems Under Sovereignty Constraints" (0.67). ✓
  • "sessions about GEPA" → top hit "Gemma, DeepMind's Family of Open Models" (0.69). ✗ — false positive on phonetic neighbor. GEPA is mentioned verbatim in one session description; grep would find it correctly.

Rule: when the user query reads like a named entity or keyword, try grep first. Only reach for semantic-grep when paraphrase/concept matching is actually needed.

Setup

Credentials via proxy.env (Cloudflare AI Gateway w/ BYOK — same pattern as invoking-gemini):

CF_ACCOUNT_ID=...
CF_GATEWAY_ID=...
CF_API_TOKEN=...

Direct-API fallback: GOOGLE_API_KEY or GEMINI_API_KEY env var. No dependencies beyond requests + numpy.

Quick Start

import sys
sys.path.insert(0, '/mnt/skills/user/semantic-grep/scripts')
from semantic_grep import semantic_grep, format_grep

# Directory of .txt files
results = semantic_grep("error handling under load", "/path/to/notes",
                        top_k=5, granularity="paragraph")
print(format_grep(results))
# notes/incidents.txt:42:  When the queue depth exceeds... [0.71]
# notes/postmortem.txt:8:  Under sustained traffic we saw... [0.68]

Core API

semantic_grep(query, corpus, *, top_k=10, threshold=None, ...)

Read the full file on GitHub · 153 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago Changed 8f2fa35bb575
  2. 9d ago First seen · 153 lines · 107 tokens per session scan A 2fcf0e427bd5

Subscribe to this mod's changes

semantic-grep is a skill published in the GitHub repository oaustegard/claude-skills (148 stars, last pushed yesterday), licensed MIT. It adds 107 tokens to every session and 2,203 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

superdesign

Design or redesign frontend UI, presentations, and graphics on the Superdesign canvas with a choice of leading AI models. Use whenever the user wants to design a page, feature, flow, slide deck, or brand-new product; improve or reproduce existing UI; compare design results across top models; explore visual variants…

superdesigndev/superdesign-skill · 115 tokens

Linear

Managing Linear issues, projects, and teams. Use when working with Linear tasks, creating issues, updating status, querying projects, or managing team workflows.

wrsmith108/linear-claude-skill · 32 tokens

chanlun-engine-skill

A Chinese-language stock-analysis skill based on Chan theory, a method for interpreting price-chart structures such as turning points and trading ranges.

adsorgcn/chanlun-engine-skill · 128 tokens

youtube-summary

Summarize a YouTube video into structured notes — TL;DR, key takeaways, chapter-by-chapter breakdown, and reference links. Use when the user shares a YouTube URL (or invokes /youtube-summary ) and wants a summary, takeaways, transcript notes, or a write-up of a talk, lecture, or tutorial. Fetches the transcript and…

ParthGanatra/agent-skills · 137 tokens

plangate

Use for any non-trivial task with 2+ open decisions/tradeoffs OR multiple implementation steps — instead of deliberating one question at a time in chat, write a structured plan to a file and let the user review it inline in vim with > Q: / > A: blockquote markers, then revise until agreed before touching any code.…

ParthGanatra/agent-skills · 131 tokens

coinmarketcap

Expert assistant for CoinMarketCap Pro API — price quotes, listings, historical OHLCV, market metrics, Fear & Greed Index, CMC100/CMC20 indices, exchange data, DEX data, airdrops, trending, community sentiment. Covers 10+ endpoint categories across REST + MCP + x402 pay-per-call modes. Use when the user wants: current…

Vo1ganin/crypto-claude-skills · 183 tokens