What is OMNI and how does it work
mainOMNI is a small program that edits the output read by an AI agent before the agent sees it. It operates by hooking into the agent host's tool execution lifecycle (e.g., using the PostToolUse hook in Claude Code).
How it sits in the workflow
OMNI uses two hooks around a tool call:
- Pre-hook: Before the command runs, OMNI passes the matching command to itself.
- Post-hook: After the tool finishes, OMNI distills the output before the agent reads it. All discarded raw data is archived in a local SQLite database for later retrieval via
omni retrieve.
Core Processing Pipeline
When a command is executed, OMNI performs these four steps in order (each step can decide to do nothing):
- Refuse: If the output is structured data that requires parsing (JSON, YAML, base64, terraform plan, etc.), it is returned untouched to ensure format safety.
- Filter: Specialized "distillers" identify and preserve important verdicts (like test successes or build failures) while discarding boilerplate. There are 12 distillers covering build, test, git, cloud, databases, JS/TS tools, etc.
- Fold Repeated Lines: Long sequences of nearly identical lines are collapsed into a single line indicating the count.
- Fold Seen Lines: Lines previously shown to the agent are replaced with a handle (using the
ledgerconcept) instead of being repeated.
Key Constraints
- Not a compressor: It prioritizes actionable output for the agent and verifiable numbers for humans over pure size reduction.
- Not a summarizer: It does not use LLM inference; it operates within millisecond time budgets using deterministic logic.
- Safety First: If a distiller cannot confidently parse the input, it must return
Noneso the raw bytes are passed through. OMNI prioritizes accuracy over token savings.