Git-relevance ranking.
Modified files first, then recent diffs, then recent commits, weighted with churn and import fan-in, so the files you actually touched lead the document.
sift walks a project directory, ranks files by git relevance, and renders one LLM-ready context document. Token budgeting, secret redaction, and signature-only compression are built in.
Noise stays gray and drops out. Everything else gets ranked, then rendered full or as signatures until the budget runs out.
Three ways teams feed code to models today, and why each breaks down.
Raw concatenation doesn't rank. Piping every file into a prompt ships vendored code, lockfiles, build output, and secrets, unranked and over budget.
A cloud service sees your code. Hosted context tools charge per seat and upload your repository. sift is a local MIT-licensed binary. Nothing leaves your machine.
Hand-picking doesn't scale. Choosing files by hand stops working past a dozen. Git-relevance ranking re-curates on every run, for free.
Two ideas do the heavy lifting. Four more handle the details.
Modified files first, then recent diffs, then recent commits, weighted with churn and import fan-in, so the files you actually touched lead the document.
--mode signatures keeps declarations and doc comments via tree-sitter and drops function bodies. The full structure at a fraction of the tokens.
Set --budget and sift keeps the highest-priority files inside your model's context window.
AWS, GitHub, Slack, Google, and Stripe keys are redacted before anything renders. On by default.
A dual-pane TUI with per-file FULL/SIGS/SKIP modes, smart-select, and task prompts.
sift delta renders only what changed since your last dump, as full files or a raw patch.
TRY IT
An illustrative simulation of how sift fills a token budget by rank.
| Rank | File | Mode | Tokens |
|---|---|---|---|
| 01 | internal/api/handler.go | ||
| 02 | internal/api/router.go | ||
| 03 | cmd/api/main.go | ||
| 04 | internal/api/middleware.go | ||
| 05 | internal/store/postgres.go | ||
| 06 | README.md | ||
| 07 | internal/store/query.go | ||
| 08 | internal/legacy/parser.go | ||
| 09 | go.mod | ||
| 10 | internal/config/load.go |
Illustrative. Real token counts depend on your files and model.
// Rank orders files by git relevance, highest first.
func Rank(files []File, opts Options) []File {
scores := make(map[string]float64, len(files))
for _, f := range files {
scores[f.Path] = score(f, opts)
}
sort.SliceStable(files, func(i, j int) bool {
return scores[files[i].Path] > scores[files[j].Path]
})
return files
}11 lines
Run sift --help or sift <command> --help for the full flag list.
| Command | What it does |
|---|---|
sift | Launch the interactive picker |
sift dump [path] | Render every eligible file in the tree |
sift pick [path] | Select files interactively, then render |
sift select [path] | Auto-select the most useful files and render them |
sift diff [ref] | Render only files changed relative to a git ref |
sift delta [path] | Render only changes since the last recorded dump |
sift watch [path] | Re-render the document whenever files change |
sift serve | Local, password-locked web UI (alternative to the terminal picker) |
Mark files FULL, SIGS, or SKIP and watch the token total move.
Illustrative layout.
sift ships an MCP server so coding agents can request exactly the context they need, over stdio.
Pack ranked, budgeted context for a path.
Pack only files changed relative to a git ref.
List the project tree the agent can choose from.
macOS and Linux:
curl -fsSL https://bethropolis.github.io/sift/install.sh | shHomebrew, Scoop, go install, and building from source are on the install page.