ryandonofrio3/osgrep
Overview
This skill provides semantic code search that finds code by meaning rather than exact text. Use it alongside grep: grep for literal matches, osgrep to locate concepts, logic, and orchestration across a codebase. It returns ranked snippets with context, labels, and call information to help you quickly understand relevant code paths.
How this skill works
You query with a natural language question or phrase and the tool returns about ten ranked code snippets with 15+ lines each, a relevance score, a category tag (e.g., ORCHESTRATION, DEFINITION), and calls made by the snippet. It supports tracing call graphs, generating compact file-only results, and producing skeleton outlines of large files. If the index is building, it will notify you so you can wait or accept partial results.
When to use it
- When you need to find where a behavior or concept is implemented (e.g., auth, caching, feature flags).
- When grep/ripgrep returns nothing because you’re searching by intent or architecture, not exact strings.
- When tracing how a request or action flows through services and functions.
- When you need compact pointers to where to read deeper instead of opening large files.
- When you want a quick summary of what a code range does before diving into implementation details.
Best practices
- Ask natural-language, specific questions: more words = better results (e.g., “where does the server validate JWT tokens”).
- Prioritize ORCHESTRATION results to understand logic and coordination points first.
- Read the exact line ranges osgrep returns instead of full files for focused context.
- If results look off, rephrase the query as you would ask a teammate.
- If you see indexing or syncing messages, decide whether to wait or accept partial/older results.
Example use cases
- Find where authentication or permission checks occur across the codebase.
- Locate entry points for incoming requests and understand request handling flow.
- Trace who calls a function and what that function calls using the trace command.
- Get a skeleton outline of a massive file to identify readable regions quickly.
- Produce compact lists of file paths when you only need locations for review or PRs.
FAQ
Grep matches exact strings; this tool matches concepts and intent via semantic embeddings, so it finds code you couldn’t locate with literal text alone.
What should I do if the index is building?
Stop and choose to wait for the index to finish or proceed with partial results. The tool will display an indexing message when this happens.