# grepai-search-advanced

Adds JSON, TOON, compact output, and agent-oriented GrepAI search patterns. Use it when search results must feed scripts, agents, or MCP tools.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 825 installs · ★ 20
- Author: yoanbernabeu
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/yoanbernabeu/grepai-skills/tree/HEAD/skills/search/grepai-search-advanced/SKILL.md
- Updated: 2026-02-01
- HTML: https://affpapa.org/en/nevibecode/skills/grepai-search-advanced

## What it does

This skill covers advanced use of `grepai search`. It explains result limits with `--limit`, JSON output through `--json` or `-j`, TOON output through `--toon` or `-t`, and compact mode with `--compact`. Compact mode removes content and keeps file locations and line ranges.

The examples show how to process results with Bash and `jq`, Python, or Node.js. They also outline an agent workflow: return compact locations first, then read the relevant file range for context. Results can be written to `results.json` or passed to another command.

The MCP section uses `grepai mcp-serve` and lists tools such as `grepai_search`, `grepai_trace_callers`, `grepai_trace_callees`, `grepai_trace_graph`, and `grepai_index_status`. Choose the output format before building the command: `--json` and `--toon` are mutually exclusive.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add yoanbernabeu/grepai-skills --skill grepai-search-advanced -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/grepai-search-advanced/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/grepai-search-advanced/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add yoanbernabeu/grepai-skills --skill grepai-search-advanced -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/grepai-search-advanced/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add yoanbernabeu/grepai-skills --skill grepai-search-advanced -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/grepai-search-advanced/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install yoanbernabeu/grepai-skills grepai-search-advanced
```

2. **Manually: put the files in place**
- File: `.github/skills/grepai-search-advanced/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add yoanbernabeu/grepai-skills --skill grepai-search-advanced -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/yoanbernabeu/grepai-skills --path skills/search/grepai-search-advanced
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/grepai-search-advanced/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add yoanbernabeu/grepai-skills --skill grepai-search-advanced -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/yoanbernabeu/grepai-skills/tree/HEAD/skills/search/grepai-search-advanced/SKILL.md

## When to use it
- return GrepAI results as JSON
- trim search output for an AI agent
- filter matches with `jq`
- send file paths to another command
- expose GrepAI through MCP

## Example prompts
- Use `grepai search` to find authentication code and return three compact JSON results.
- Run `grepai search "config" --json` and print the matching file paths with `jq`.
- Start the GrepAI MCP server with `grepai mcp-serve` and request the `toon` format.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 0d34f5a17dc795d5.

BEGIN THIRD-PARTY FILE 0d34f5a17dc795d5
````text
---
name: grepai-search-advanced
description: Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.
---

# GrepAI Advanced Search Options

This skill covers advanced search options including JSON output, compact mode, and integration with AI agents.

## When to Use This Skill

- Integrating GrepAI with scripts or tools
- Using GrepAI with AI agents (Claude, GPT)
- Processing search results programmatically
- Reducing token usage in AI contexts

## Command-Line Options

| Option | Description |
|--------|-------------|
| `--limit N` | Number of results (default: 10) |
| `--json` / `-j` | JSON output format |
| `--toon` / `-t` | TOON output format (~50% fewer tokens than JSON) |
| `--compact` / `-c` | Compact output (no content, works with --json or --toon) |

> **Note:** `--json` and `--toon` are mutually exclusive.

## JSON Output

### Standard JSON

```bash
grepai search "authentication" --json
```

Output:
```json
{
  "query": "authentication",
  "results": [
    {
      "score": 0.89,
      "file": "src/auth/middleware.go",
      "start_line": 15,
      "end_line": 45,
      "content": "func AuthMiddleware() gin.HandlerFunc {\n    return func(c *gin.Context) {\n        token := c.GetHeader(\"Authorization\")\n        if token == \"\" {\n            c.AbortWithStatus(401)\n            return\n        }\n        claims, err := ValidateToken(token)\n        ...\n    }\n}"
    },
    {
      "score": 0.82,
      "file": "src/auth/jwt.go",
      "start_line": 23,
      "end_line": 55,
      "content": "func ValidateToken(tokenString string) (*Claims, error) {\n    ..."
    }
  ],
  "total": 2
}
```

### Compact JSON (AI Optimized)

```bash
grepai search "authentication" --json --compact
```

Output:
```json
{
  "q": "authentication",
  "r": [
    {
      "s": 0.89,
      "f": "src/auth/middleware.go",
      "l": "15-45"
    },
    {
      "s": 0.82,
      "f": "src/auth/jwt.go",
      "l": "23-55"
    }
  ],
  "t": 2
}
```

**Key differences:**
- Abbreviated keys (`s` vs `score`, `f` vs `file`)
- No content (just file locations)
- ~80% fewer tokens for AI agents

## TOON Output (v0.26.0+)

TOON (Token-Oriented Object Notation) is an even more compact format, optimized for AI agents.

### Standard TOON

```bash
grepai search "authentication" --toon
```

Output:
```
[2]{content,end_line,file_path,score,start_line}:
  "func AuthMiddleware()...",45,src/auth/middleware.go,0.89,15
  "func ValidateToken()...",55,src/auth/jwt.go,0.82,23
```

### Compact TOON (Best for AI)

```bash
grepai search "authentication" --toon --compact
```

Output:
```
[2]{end_line,file_path,score,start_line}:
  45,src/auth/middleware.go,0.89,15
  55,src/auth/jwt.go,0.82,23
```

### TOON vs JSON Comparison
````
END THIRD-PARTY FILE 0d34f5a17dc795d5

The third-party file has ended. Everything between the 0d34f5a17dc795d5 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2774 of 8191 bytes. © yoanbernabeu · MIT · https://github.com/yoanbernabeu/grepai-skills/tree/HEAD/skills/search/grepai-search-advanced/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
