Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

prx (Praxis)

AI coding agents burn most of their context window re-discovering code they’ve already seen. prx fixes that at the source.

prx is a single Rust binary that replaces the Unix tools coding agents lean on most: grep, cat, find, sed, diff. Every command returns structured JSON with ranked results, hard token budgets, and content hashes. One call returns a budgeted answer instead of a wall of text the agent has to read, parse, and re-read.

The problem

Every coding agent runs some version of this loop:

1. grep "authenticate" src/          → file paths, line numbers
2. cat src/auth/handler.ts           → entire file (thousands of tokens)
3. grep "authenticate" src/ -A 5     → same noise, wider context

Most of those tokens are waste: whole files read to use ten lines, the same file loaded twice in a session, test logs dumped in full to find one failure. The tools aren’t broken. They were built for humans reading a terminal, not for an agent paying for every token inside a fixed context window. That mismatch is the tax prx removes.

What makes prx different

It replaces the tools, it doesn’t wrap them. Compression tools shell out to grep/cat and squeeze the output afterward. prx does the search, reading, and diffing itself. No subprocess, no re-parsing, no lossy post-processing.

It covers the whole loop, not just search. Retrieval-only tools still leave your agent to read, edit, diff, and run tests with the old noisy tools. prx handles search, structured reads, safe edits, semantic diffs, and parsed test/build output behind one consistent JSON envelope.

No runtime dependencies. One static binary, ~49 MB, no Python, no package manager, no network at runtime. It runs in containers and sandboxes as-is.

The semantic model is built in. A 32M-parameter retrieval-optimized embedding model (potion-retrieval-32M, stored as float16) is compiled directly into the binary. Semantic search runs on CPU in milliseconds. No model server, no vector database, no setup step.

It’s fast. Indexing runs on all CPU cores in parallel (7.6x speedup on 10 cores). Embeddings are memory-mapped with zero-copy access. A 50-query benchmark suite runs in 0.23 seconds.

All commands

CommandReplacesWhat it does
prx searchgrep, rgHybrid search: literal + semantic + structural. Ranked, token-budgeted.
prx readcat, head, tailStructured reading with --if-changed cache, --skeleton, --mode, --snap.
prx findfind, ls, treeCodebase mapping with tree or flat output, inline metadata, semantic scoring.
prx editsed, awkSafe edits with literal matching, dry-run by default, tree-sitter syntax validation.
prx diffdiff, git diffSemantic diffs with function-level attribution and natural-language summaries.
prx runParsed test/build/lint output. 22 parsers; --auto-json for structured output.
prx contextModule context package: stats, docs, entrypoints, skeletons, import edges.
prx impactReverse dependency analysis: what depends on a given file.
prx outlinectagsSymbol table for a file or directory.
prx existsgrep -qFast bloom-filter existence check, near-zero tokens.
prx indexParallel persistent index: 11K files in ~55s (7.6x speedup via rayon).
prx mcpMCP server over stdio for direct agent integration.
prx batchxargsParallel JSONL batch execution.
prx initDetects agent frameworks and generates integration configs.
prx statsToken-savings dashboard with --compare.
prx benchSide-by-side benchmark: prx vs grep+cat.
prx bench-ndcgNDCG search quality benchmark against labeled datasets.

Token savings at a glance

FeatureScenarioSavings
read --if-changed (cache hit)Re-reading an unchanged file~99%
read --mode diffFile with local changes98-99%
read --skeletonFull file reduced to signatures~90%
runPassing test suites95-99%
read --mode entropyGenerated / highly repetitive code~86%
searchvs grep + follow-up reads~35%

Full telemetry data and methodology: Token Savings.


Get started: Quick Start