
grepai-search-advanced
Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.
- Installs
- 828
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-search-advanced- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads grepai-search-advanced automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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:
--jsonand--toonare mutually exclusive.
JSON Output
Standard JSON
grepai search "authentication" --json
Output:
{
"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)
grepai search "authentication" --json --compact
Output:
{
"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 (
svsscore,fvsfile) - 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
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)
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
| Format | Tokens (5 results) | Best For |
|---|---|---|
| JSON | ~1,500 | Scripts, parsing |
| JSON compact | ~300 | AI agents |
| TOON | ~250 | AI agents |
| TOON compact | ~150 | Token-constrained AI |
When to Use TOON
- Use TOON when integrating with AI agents that support it
- Use TOON compact for maximum token efficiency (~50% smaller than JSON compact)
- Stick with JSON for traditional scripting (jq, programming languages)
Compact Format Reference
| Full Key | Compact Key | Description |
|---|---|---|
query | q | Search query |
results | r | Results array |
score | s | Similarity score |
file | f | File path |
start_line/end_line | l | Line range ("15-45") |
total | t | Total results |
Combining Options
# 5 results in compact JSON
grepai search "error handling" --limit 5 --json --compact
# 20 results in full JSON
grepai search "database" --limit 20 --json
AI Agent Integration
For Claude/GPT Prompts
Use compact mode to minimize tokens:
# Agent asks for context
grepai search "payment processing" --json --compact --limit 5
Then provide results to the AI with file read tool for details.
Workflow Example
- Search for relevant code:
grepai search "authentication middleware" --json --compact --limit 3
- Get response:
{
"q": "authentication middleware",
"r": [
{"s": 0.92, "f": "src/auth/middleware.go", "l": "15-45"},
{"s": 0.85, "f": "src/auth/jwt.go", "l": "23-55"},
{"s": 0.78, "f": "src/handlers/auth.go", "l": "10-40"}
],
"t": 3
}
- Read specific files:
AI reads
src/auth/middleware.go:15-45for full context.
Scripting with JSON
Bash + jq
# Get just file paths
grepai search "config" --json | jq -r '.results[].file'
# Filter by score
grepai search "config" --json | jq '.results[] | select(.score > 0.8)'
# Count results
grepai search "config" --json | jq '.total'
Python
import subprocess
import json
result = subprocess.run(
['grepai', 'search', 'authentication', '--json'],
capture_output=True,
text=True
)
data = json.loads(result.stdout)
for r in data['results']:
print(f"{r['score']:.2f} | {r['file']}:{r['start_line']}")
Node.js
const { execSync } = require('child_process');
const output = execSync('grepai search "authentication" --json');
const data = JSON.parse(output);
data.results.forEach(r => {
console.log(`${r.score.toFixed(2)} | ${r.file}:${r.start_line}`);
});
MCP Integration
GrepAI provides MCP tools with format selection (v0.26.0+):
# Start MCP server
grepai mcp-serve
MCP tools support JSON (default) or TOON format:
| MCP Tool | Parameters |
|---|---|
grepai_search | query, limit, compact, format |
grepai_trace_callers | symbol, compact, format |
grepai_trace_callees | symbol, compact, format |
grepai_trace_graph | symbol, depth, format |
grepai_index_status | format |
Format Parameter
{
"name": "grepai_search",
"arguments": {
"query": "authentication",
"format": "toon",
"compact": true
}
}
Valid values: "json" (default) or "toon"
Token Optimization
Token Comparison
For a typical search with 5 results:
| Format | Approximate Tokens |
|---|---|
| Human-readable | ~2,000 |
| JSON full | ~1,500 |
| JSON compact | ~300 |
When to Use Each Format
| Format | Use Case |
|---|---|
| Human-readable | Manual inspection |
| JSON full | Scripts needing content |
| JSON compact | AI agents, token-limited contexts |
Piping Results
To File
grepai search "authentication" --json > results.json
To Another Tool
# Open results in VS Code
grepai search "config" --json | jq -r '.results[0].file' | xargs code
# Copy first result path to clipboard (macOS)
grepai search "config" --json | jq -r '.results[0].file' | pbcopy
Batch Searches
Run multiple searches:
#!/bin/bash
queries=("authentication" "database" "logging" "error handling")
for q in "${queries[@]}"; do
echo "=== $q ==="
grepai search "$q" --json --compact --limit 3
echo
done
Error Handling
JSON Error Response
When search fails:
{
"error": "Index not found. Run 'grepai watch' first.",
"code": "INDEX_NOT_FOUND"
}
Checking for Errors in Scripts
result=$(grepai search "query" --json)
if echo "$result" | jq -e '.error' > /dev/null 2>&1; then
echo "Error: $(echo "$result" | jq -r '.error')"
exit 1
fi
Best Practices
- Use compact for AI agents: 80% token savings
- Use full JSON for scripts: When you need content
- Use human-readable for debugging: Easier to read
- Limit results appropriately: Don't fetch more than needed
- Check for errors: Parse JSON response properly
Output Format
Advanced search output (JSON compact):
{
"q": "authentication middleware",
"r": [
{"s": 0.92, "f": "src/auth/middleware.go", "l": "15-45"},
{"s": 0.85, "f": "src/auth/jwt.go", "l": "23-55"},
{"s": 0.78, "f": "src/handlers/auth.go", "l": "10-40"}
],
"t": 3
}
Token estimate: ~80 tokens (vs ~800 for full content)
FAQ
What does the grepai-search-advanced skill do?
Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.
How do I install grepai-search-advanced?
Run npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-search-advanced in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/grepai-search-advanced/ (personal) or .claude/skills/grepai-search-advanced/ (project).
Which AI agents can use grepai-search-advanced?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is grepai-search-advanced safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains grepai-search-advanced?
It is published by yoanbernabeu in yoanbernabeu/grepai-skills. It has 828 recorded installs.
More from yoanbernabeu/grepai-skills
grepai-search-basics
yoanbernabeu/grepai-skills
Basic semantic code search with GrepAI. Use this skill to learn fundamental search commands and concepts.
grepai-trace-graph
yoanbernabeu/grepai-skills
Build complete call graphs with GrepAI trace. Use this skill for recursive dependency analysis.
grepai-ollama-setup
yoanbernabeu/grepai-skills
Install and configure Ollama for local embeddings with GrepAI. Use this skill when setting up private, local embedding generation.
grepai-trace-callers
yoanbernabeu/grepai-skills
Find function callers with GrepAI trace. Use this skill to discover what code calls a specific function.
grepai-search-tips
yoanbernabeu/grepai-skills
Tips and best practices for effective GrepAI searches. Use this skill to improve search result quality.
grepai-trace-callees
yoanbernabeu/grepai-skills
Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available