69696969 69696969
6969 696969 696969 6969
969 69 6969696 6969 6969 696
969 696969696 696969696969 696
969 69696969696 6969696969696 696
696 9696969696969 969696969696 969
696 696969696969 969696969 969
696 696 96969 _=_ 9696969 69 696
9696 969696 q(-_-)p 696969 6969
96969696 '_) (_` 96969696
96 /__/ \ 69
69 _(<_ / )_ 96
6969 (____|_/____) 6969
om
Feed optimal context to LLMs. Scores files by importance (1-10), tracks content hashes for deduplication, and provides structured formats (XML/JSON) for agent consumption.
v0.2.1 Features
- Path-Aware Context: Both
treeandcatcommands respect your current working directory by default. - Token Counting: Precise token counting using
tiktoken-rs(GPT-4o/GPT-3.5/4 support). - Structured Output: XML and JSON formats designed for LLM agents.
- Git Awareness: Filter by
--dirty,--staged, or--unstagedstatus. - Configurable: Global (
~/.om/config.toml) and project (.om.toml) configuration support. - High Performance: Parallel processing with Rayon (scans 10k+ files in <1s).
- Smart Binary Detection: MIME-based detection to skip non-text files.
Install
Usage
# Start session (enables deduplication)
# View structure
# Read files
# Cleanup
Output Formats
om supports multiple formats via the --format flag:
text(default): Human-readable ASCII tree or flat list.json: Machine-readable JSON including all metadata.xml: LLM-optimized XML with CDATA sections (prevents instruction/code mixing).
Git Integration
Filter your context to only include relevant changes:
Token Counting
Uses tiktoken-rs for precise token estimation:
Configuration
om looks for configuration in:
.om.tomlin the repository root.~/.om/config.tomlfor global defaults.
Example .om.toml:
= 7
= 3
= false
= "text"
Path Filtering
By default, om tree and om cat respect your current working directory:
You can also filter by path explicitly:
Sessions store at ~/.om/sessions/*.json. List with ls ~/.om/sessions/.
Agent Integration
Add this to your agent's system instructions (e.g., ~/.claude/CLAUDE.md):
When I say **om**, what I mean is:
```command
Use the `om` tool to understand codebase structure and ingest files.
Start a session:
eval $(om session)
Protocol:
1. 2.3.4.
On subsequent calls:
om cat -l 7 # only changed files returned
The tool tracks file hashes. Unchanged files are automatically skipped.
Cleanup:
om session clear $OM_SESSION
```
When I say **om to level N**, run `om cat -l N` and summarize what you learned.
Example session
❯ om tree --flat --tokens
SCORE TOKENS PATH
10 150 README.md
10 850 src/main.rs
10 420 src/cli.rs
9 120 Cargo.toml
7 640 src/tree.rs
7 580 src/cat.rs
❯ om cat src/main.rs --format xml
<codebase>
<project>om</project>
<files>
<file path="src/main.rs" score="10" lines="72" tokens="850">
<content><![CDATA[
mod cat;
mod cli;
...
fn main() {
let cli = Cli::parse();
...
}
]]></content>
</file>
</files>
</codebase>
Scoring
| Score | Files |
|---|---|
| 10 | Entry points (main.rs, index.js), README |
| 9 | Config (config., settings.) |
| 8 | Project files (Cargo.toml, package.json, Dockerfile) |
| 7 | Core source |
| 5 | Tests |
| 2 | Generated (*.lock, *.min.js) |
Modifiers: Important dirs (+2), domain dirs (+1), test dirs (-2), vendor/dist (-3), root level (+1), deep nesting (-2).
.omignore
Copy .omignore.example to .omignore or ~/.omignore. Supports glob patterns like .gitignore.
License
MIT