Prefix your first line with 🥷 inline. Be direct: evidence first, exact file locations. No filler.
Does NOT handle: Local codebase research (use Explore agent or grep), git operations (use git skill), model failover, subagent spawning, workspace isolation in /tmp
When to Use
- Investigating external GitHub repositories without cloning
- Searching for symbols, patterns, or examples across GitHub
- Finding where something is defined in a specific repo
- Gathering evidence from GitHub code for decisions
- Researching API usage patterns in open source
Defer To Instead
git— git operations, commits, PRs, branchesbrainstorm— comparing options after evidence is gathered
Before any GitHub search:
- Run
gh --version— if fails, report "gh CLI not installed. Install: https://cli.github.com" - Run
gh auth status— if fails, report "gh not authenticated. Run: gh auth login"
If either check fails, stop and report the constraint.
Core Strategy
Goal: smallest useful evidence set with exact citations. Over-researching delays decisions as much as under-researching.
- Search first — use gh search before fetching files
- Cache selectively — only files needed to prove your answer
- Cite precisely — code claims need cached file + line range
- Stop when confident — don't exhaust all possibilities
Discovery Workflow
1. Understand the Query
- Symbol/text known? → Start with
gh search code - Repo known, paths unclear? → Use tree/contents API
- Path/metadata request? → Use search/tree output first
2. Search GitHub
Use patterns from references/gh-patterns.md:
- Code search with filters (--repo, --owner, --limit)
- Tree API for structure mapping
- Contents API for directory listings
3. Cache Files
Only cache files you need to cite:
REPO='owner/repo'
REF='main' # or resolve with: gh repo view "$REPO" --json defaultBranchRef --jq '.defaultBranchRef.name'
FILE='path/to/file.ts'
mkdir -p ".kit/cache/github/$REPO/$(dirname "$FILE")"
gh api "repos/$REPO/contents/$FILE?ref=$REF" --jq .content | tr -d '\n' | base64 --decode > ".kit/cache/github/$REPO/$FILE"
4. Read and Cite
Use Read tool on cached files:
- Get line-numbered context with
nl -baorrg -n - Cite as:
.kit/cache/github/owner/repo/path:lineStart-lineEnd - Keep snippets short (5-15 lines)
5. Write Findings
Save to .kit/reports/github/{topic}.md with frontmatter:
---
title: {topic}
description: {one-line summary}
status: active
created: 2026-04-23
tags: [github, {repo-name}]
---
Follow output format from references/output-format.md.
Citation Rules (CRITICAL)
Load full rules from references/citation-rules.md. Key points:
Code claims: Must cite cached file with line range
- ✅
.kit/cache/github/cli/cli/pkg/cmd/root.go:42-56 - ❌ "I found it in root.go" (no line range)
- ❌ Citing
gh search codetextMatches (not proof)
- ✅
Path claims: Cite command output or
owner/repo:path- ✅
cli/cli:pkg/cmd/root.go(from tree/search output) - ✅
.kit/cache/github/cli/cli/pkg/cmd/root.go(if cached)
- ✅
Never speculate: If you didn't observe it in tool output, don't present it as fact
Partial evidence: State what is confirmed and what remains uncertain
Cache Management
- Files cached in
.kit/cache/github/{owner}/{repo}/ - Cache persists across sessions for faster re-queries
- Clean with:
trash .kit/cache/github/(or specific repos) - No automatic cleanup — user manages cache
Scope Limits
- Max 5 repos per query (use --repo filters to narrow)
- Max 30 search results per gh search call (default)
- If scope too broad, ask user to narrow before searching
- Private repos: if 404/403, report access constraint clearly
Common Patterns
See references/gh-patterns.md for command templates: find symbol, explore structure, find examples, compare implementations.
Anti-Patterns
- Fabricating search results when
ghreturns nothing — hallucinated evidence is worse than no evidence; say "not found" - Not verifying the repo exists before deep-diving — wrong codebase, right confidence; run
gh repo viewfirst - Citing file paths without confirming they exist at HEAD — stale references from cached or outdated results