Repository navigation
Sources and the Reading Room
| Source | Reading copy the guide searches | What you see |
|---|---|---|
| Text, Markdown, code | The file itself | The lines, with a link to the file |
| PDF, local or from the web | One text file per page, extracted with mupdf | The page region as an image where the terminal supports it, otherwise the extracted text. Its heading opens the PDF at that page |
| Web page | The main content as Markdown, extracted with defuddle | The text, with a link that opens the page at the passage |
| Image (PNG, JPEG, WebP, GIF, HEIC) | Its text, transcribed once by the transcription model and kept by a hash of the image | The image where the terminal shows images, with a link to the file |
Add a source with /add <web address or file>, or by dropping a file on the terminal in source mode (see Using omo).
Each sources folder gets a reading room in omo's store: a folder of reading copies that is the only folder the guide can see. omo keeps it in step with the sources folder when it opens. A PDF appears in the room as a folder named after it, with one text file per page (p0001.txt, p0002.txt, …). Web pages are under _web/.
omo writes nothing into your sources folder for its reading copies. A file you add from outside the folder is copied into the folder, since you asked for it to become a source.
- A web page is fetched once, and the original is kept in the store's
web/folder, shared by every sources folder. - A
#sectionin its address is dropped, so links to two sections of one page share one copy. - Its reading copy keeps the LaTeX a formula was written with, where the page carries it (Wikipedia does). A formula set on its own lines is put on one line,
$$ ... $$, so a pointer to lines never holds half a formula. - Fetching allows only
http:andhttps:addresses, gives up after 20 seconds, and refuses a body larger than 40 MB.
A reading copy is cut into units:
- Markdown (parsed with marked): a heading, paragraph, code or formula block, table or quote, and list items. Short list items are grouped up to 6 lines.
- Any other text, including a PDF page: a run of non-blank lines, so one PDF text block.
- A unit longer than 20 lines is cut, at the end of a sentence where one is in reach.
Pointers are widened to whole units. A pointer covers the units it covers at least half of, or that make up at least half of it. A pointer whose units run longer than 40 lines is refused, and the refusal names the units' lines so the guide can point at fewer.
Unit ids survive edits. A unit's id is its source's id plus a hash of its text, with whitespace, compatibility forms and soft hyphens evened out. An unchanged paragraph keeps its id when the rest of the file is edited.
Source ids survive moves. A source's id comes from a fingerprint of its text when it is first seen. The same text in two folders is one source, and an edited file keeps its id.
Edited units are found again. The first time a unit is pointed at, the ledger records its text and a little of its surroundings. When a unit is edited, it gets a new id. At start, an old id is mapped to the unit that now holds its text, found while tolerating small edits (approx-string-match). This happens only when that text is at least 20 characters long and lies inside exactly one unit. Nothing in the ledger is rewritten.
Your own files (photos of handwriting, PDFs, voice memos) and image sources are sent whole to the transcription model. pi-ai sends only text and images, so omo sends a file as pi-ai's image block carrying the file's own type. pi-ai's onPayload hook then rewrites that part into the form each API takes (src/media.ts). No pi package is changed.
| API | Images | Audio | |
|---|---|---|---|
Gemini (google-generative-ai, google-vertex) |
as pi-ai sends them, HEIC too | inlineData |
inlineData |
Chat completions (openai-completions: OpenRouter and others) |
as pi-ai sends them |
file part |
input_audio part |
OpenAI Responses, ChatGPT sign-in (openai-responses, openai-codex-responses) |
as pi-ai sends them |
input_file part |
refused |
Anthropic (anthropic-messages) |
as pi-ai sends them |
document block |
refused |
| Any other | as pi-ai sends them | refused | refused |
A file the chosen model cannot take is refused before anything is sent, with the reason. To transcribe audio, set the transcribe task to a model that takes it (/model transcribe).
Photos:
- A PNG, JPEG or WebP photo is sent without its metadata (where and when it was taken, the camera, text chunks). The metadata is cut out without decoding the image (exif-be-gone).
- A photo larger than 2048 pixels on a side or 3.5 MB, or one shown rotated, is sent instead as a new JPEG (photon). The new JPEG is smaller, upright as its EXIF orientation says (exifr), and has no metadata. The size limit is there because Anthropic takes at most 5 MB of base64 per image.
- Any file still larger than 14 MB is refused, since Gemini takes at most 20 MB per request and base64 makes a file a third larger.
The original file is what omo keeps.
on-my-own · AGPL-3.0-or-later · Repository