Feature request : add command for grepai
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 81.1k
- Forks
- 5.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 35
Description
Summary
Add rtk grepai to filter grepai semantic code search output. Despite being AI-native, grepai's default output is verbose
for LLM consumption — it includes full code bodies, separator lines, and metadata that waste tokens. Its built-in --toon flag paradoxically makes output 2-3x
larger.
Motivation
grepai is increasingly used in Claude Code workflows for semantic search (grepai search) and call graph tracing (grepai trace callers/callees). These are
high-volume commands that return large outputs with embedded code blocks that the LLM already has access to via other tools.
Current pain:
grepai search "auth logic"(10 results) → ~716 tokens of code bodies, separators, whitespacegrepai trace callers login(27 callers) → ~319 tokens with repeated file entries and code snippets
Proposed Filters
filter_search() — 90%+ savings
Strip code bodies, keep one line per result:
Before (716 tokens)
Found 10 results for: "authentication logic"
────────────────────── Result 1 (score: 0.68) ──────────────────────
File: backend/src/some/path/api/auth.py:223-228
def authenticate_user(credentials):
"""Authenticate user with the given credentials."""
validated = validate_credentials(credentials)
...
After (48 tokens)
grepai: "authentication logic" — 10 results
0.68 auth.py:223-228 (backend/src/.../api/)
0.38 SKILL.md:330-394 (+51 lines) (.claude/skills/auth-flow/)
filter_trace() — 85%+ savings
Group callers/callees by file, deduplicate:
Before (319 tokens — 27 separate caller entries with code)
After (30 tokens)
login (function) @ auth.py:117 — 27 callers in 8 files:
authRepository.test.ts 18x (lines: 61,96,126,...)
test_exercise_library.py 2x (lines: 120,145)
conftest.py:598 1x
Passthrough
Other subcommands (init, watch, status, graph) pass through unfiltered but still tracked.
Hook Rewrite
Only rewrite search and trace (the filtered subcommands):
grepai search "query" → rtk grepai search "query"
grepai trace callers login → rtk grepai trace callers login
grepai init → (no rewrite, stays raw)
Expected Savings
┌────────────────────────────┬──────────────┬───────────────┬──────────────────┐
│ Subcommand │ Input tokens │ Output tokens │ Savings │
├────────────────────────────┼──────────────┼───────────────┼──────────────────┤
│ search (10 results) │ ~716 │ ~48 │ 93% │
├────────────────────────────┼──────────────┼───────────────┼──────────────────┤
│ trace callers (27 callers) │ ~319 │ ~30 │ 91% │
├────────────────────────────┼──────────────┼───────────────┼──────────────────┤
│ trace graph │ ~52 │ ~52 │ 0% (passthrough) │
├────────────────────────────┼──────────────┼───────────────┼──────────────────┤
│ status │ ~26 │ ~26 │ 0% (passthrough) │
└────────────────────────────┴──────────────┴───────────────┴──────────────────┘
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing CLI command entry points and hook rewrite logic for rtk grepai. Trace how grepai search and trace callers/callees output is handled, then compare behavior with the requested filtered examples. Done means search and trace are compact and deduplicated while init, watch, status, and graph pass through unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100