---
name: osgrep
description: Run lightweight semantic grep over the current repository using the osgrep CLI (natural-language search, JSON output, hot daemon).
---

Note: path should be ~/.factory/skills/osgrep/SKILL.md

# Install osgrep

## Install / Warm Up

`npm install -g osgrep`
`osgrep setup` (downloads models once; optional but faster later)

# osgrep Skill

Minimal semantic grep harness. Use when you need fast, local, natural-language search over the repo without spinning up MCP servers.

## Core Search

```bash
osgrep "how do we validate auth?"
osgrep --json "pagination helper"    # machine-readable
osgrep "error handling" --per-file 3 # deeper per file
osgrep "feature flags" --compact     # file paths only
```

- Run from the repo root so auto-store detection works.
- Pipe long JSON to a file if needed: `osgrep --json "query" > /tmp/osgrep.json`.

## Keep Index Fresh

```bash
osgrep --sync "recent changes"   # re-index modified files before search
osgrep index                     # manual full re-index
```

## Hot Daemon (optional)

```bash
osgrep serve            # keeps embeddings warm (default port 4444)
```

The CLI auto-falls back to on-demand mode if the server isn’t running.

## Diagnostics & Cleanup

```bash
osgrep list    # show indexed repos
osgrep doctor  # verify install + models
```

Delete a store anytime via `rm -rf ~/.osgrep/data/<store>` if you need a clean slate.
