hoja
Health Warn
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 6 GitHub stars
Code Fail
- spawnSync — Synchronous process spawning in npm/bin/hoja.mjs
- process.env — Environment variable access in npm/bin/hoja.mjs
- network request — Outbound network request in npm/bin/hoja.mjs
- rm -rf — Recursive force deletion command in web/public/install.sh
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Terminal reader for PDFs, arXiv papers, web articles, EPUB, Typst, and LaTeX built for you and your coding agent, in Ghostty and Rex.
Terminal reader for PDFs, arXiv papers, web articles, EPUB, Typst, and LaTeX built for you and your coding agent, in Ghostty and Rex.
Pixel-exact pages, continuous scroll, OKLab ink transfer, link hints that open citations inside your stack, layered human and agent annotations, cross-stack search, Obsidian export, and one-drag handoff to Claude Code, Codex, or fx.
hoja document.pdf # read any PDF in your terminal theme
hoja https://example.com/paper.pdf # open a remote PDF over http(s)
hoja https://example.com/post # open a web article, rendered through Typst
hoja book.epub # open an EPUB book, rendered through Typst
hoja notes.typ --watch # live-reload a Typst document on save
hoja paper.pdf --password 'secret' # open an encrypted PDF
hoja 1706.03762 # fetch and read an arXiv paper
hoja notes.md --watch # live-compile Markdown with LaTeX ($...$, $$...$$)
hoja paper.tex --watch # live-compile LaTeX via tectonic without losing scroll
hoja document.pdf --text -p 4 # extract page text for a coding agent
hoja document.pdf --png -p 4 -o p4.png
hoja annot add paper.pdf --by fx -p 1 --match "self-attention" --color amber
hoja annot export --active --obsidian -o lit-note.md
hoja ctl open ./related-paper.pdf # push a paper beside the reader, no focus stolen
hoja ctl search "scaled dot-product" # search every open paper in the stack
npx skills add crafter-station/hoja # teach Claude Code, Codex, or fx how to use hoja
hoja skills get core # serve the embedded agent playbook
hoja rex install # add Hoja actions to Rex's Cmd+Shift+P palette
Why
Terminal readers that convert PDFs into Markdown destroy dense LaTeX equations. Existing graphical terminal PDF viewers (tdf, fancy-cat) are AGPL-3.0 because of MuPDF, and none of them let you crop an equation straight into a coding agent pane, annotate pages side by side with an agent, or live-preview .md and .tex math.
hoja takes a different stance:
- Any document, not just arXiv. Books, technical docs, slide decks, arXiv preprints, remote
http(s)URLs validated by their%PDF-header, and encrypted PDFs (--password/HOJA_PDF_PASSWORD) open in the same viewer. Web articles (hoja https://...), EPUB books (hoja book.epub), Typst files (hoja notes.typ --watch),.tex, and.mdsources enter through the same sandboxed Typst and tectonic pipeline. Remote downloads are capped at 512 MiB and kept in the platform cache directory. - Pixels are the truth. PDFs are rendered with
pdfium-render(Apache/BSD, MIT-compatible) and presented over the Kitty Graphics Protocol, so equations stay identical to the typeset paper. - 100+ FPS virtualized GPU scroll. Pages virtualize in 3 layers (instant point-geometry strip, bounded 8-page LRU
PageCache, and double-buffered 3x GPU strips pre-composited on a background worker thread). Scrolling slides the active GPU texture via Kittya=pin~0.05 msper frame (ctoggles single-page mode,Dor--perfshows live FPS/transport), and per-page-size auto-crop strips white margins and arXiv stamps sofit-widthfills a narrow agent pane. - OKLab theme recoloring that respects diagrams, plots, and dark slides. Instead of inverting pixels (which turns red plots cyan),
hojamaps paper luminance to your terminalbgand ink to yourfgvia a cached64^3OKLab LUT, respects PDFXObjectFormtransforms and clip paths, blends white-background diagrams and light-canvas charts into your dark theme, recolors hairline rules and colorbar tick margins while keeping rainbow scales and real photographs untouched, and skips dark, chromatic, or busy slide decks automatically. - Follow citations without leaving the stack. Press
;in reading mode to label every visible link and plain-textarXiv:YYMM.NNNNNmention with a color-coded chip:skyfor internal jumps,mintfor arXiv papers, PDFs, and web articles,amberfor external web pages. Lowercasea-zor a click opens in place; uppercaseA-Z,Shift+Click, orAlt+Clickdownloads in a background worker so the paper you are reading keeps focus, and the chip flips to a1/2*unseen counter when it lands.Backspacewalks back, across papers as well as inside one. - Layered annotations, human and agent.
TabcyclesSNIP,HL, andNOTEmodes,t/Aopens the annotations drawer, and the agent in the next pane writes into its own layer throughhoja annot, so its marks never overwrite yours. - One reader, many documents. Every repo gets a lazy-loaded stack (opening 20+ PDFs boots in ~450 ms with human paper titles extracted from PDF metadata or page-1 typography):
bswitches,[/]orH/Lwalk it,'swaps back,xcloses the current paper, andTreads annotations across the whole stack. PressFto search every open document at once,Enterto jump into a hit, andBackspaceto walk the history back.Stoggles a side-by-side2upspread on terminals at 160 columns or wider.hoja ctlpushes documents into the running reader from any pane. - Search and export for agents.
hoja ctl search <query> [--limit N] [--json]lets a coding agent search every paper in a live reader and get a bounded JSON payload with document title, page, and snippet.hoja annot export --active --obsidian -o note.mdwrites a literature note with YAML frontmatter, page-grouped quotes, and Obsidian-safe escaping.
Install
# Shell installer (macOS & Linux prebuilt binary)
curl -fsSL https://hoja.crafter.run/install.sh | sh
# Homebrew (macOS & Linux)
brew install crafter-station/tap/hoja
# Cargo (crates.io)
cargo install hoja
# Bun / npm
bun add -g @crafter/hoja
Then initialize PDFium and verify your terminal:
hoja setup # downloads and SHA-256 verifies pinned libpdfium into the cache dir
hoja doctor # checks Kitty graphics, OSC 10/11 theme, libpdfium, tectonic, typst, and tmux
npx skills add crafter-station/hoja # install the hoja agent skill for Claude Code, Codex, or fx
Optional tools for source front doors:
typstfor.mdfiles with LaTeX math,.typfiles, web articles, and EPUB bookstectonicfor.texfilesdefuddlefor cleaner web article extraction. Without it, or withHOJA_DEFUDDLE=0, hoja falls back to its built-in HTML-to-Markdown extractor.
Inputs
| Source | Command | Notes |
|---|---|---|
| Local PDF | hoja book.pdf |
any page size, mixed sizes keep their geometry |
| Remote PDF | hoja https://example.com/paper.pdf |
validated by its %PDF- header, capped at 512 MiB |
| Web article | hoja https://example.com/post |
HTML to Markdown, compiled by Typst, cached with its <title> |
| EPUB book | hoja book.epub |
unpacked in memory, then rendered through Typst |
| Typst | hoja notes.typ --watch |
compiled with typst compile --root, live reload on save |
| LaTeX | hoja paper.tex --watch |
compiled through tectonic |
| Markdown | hoja notes.md --watch |
Typst with $...$ and $$...$$ math |
| arXiv | hoja 1706.03762 |
cached locally, resumes the last page |
Web articles prefer defuddle when it is on PATH and fall back to a built-in, pure-Rust HTML-to-Markdown extractor otherwise. Set HOJA_DEFUDDLE=0 to always use the built-in path. Articles and EPUB books compile through sandboxed Typst: the wrapper runs with --root pointed at a scratch directory, page content is never injected as raw Typst (raw-typst: false), and math passes through a MiTeX guard. EPUB archives are unpacked in memory with zip-bomb, zip-slip, XML entity, and DRM guards, so a hostile book fails before it renders.
Controls
Dvorak-friendly by default (no positional key clusters required; j/k remain available as aliases).
| Key / Input | Action |
|---|---|
↑ ↓ / wheel (j k) |
smooth continuous pixel scroll (never jumps abruptly in cont mode) |
d / u |
half-viewport down / up |
space / PageDown |
jump to the next page top |
shift+space / PageUp / shift+tab |
return to the current page top, then previous page |
← → |
horizontal pan when zoomed, or previous / next page |
g / G (Home / End) |
first / last page |
backspace |
jump back after following a link, outline entry, or cross-stack search hit (works across documents too) |
[ / ] or H / L |
previous / next doc in the stack |
b / ' |
doc switcher (also opens a new document) / jump to the last doc |
x |
close the current doc |
B |
toggle the wide rail (needs 140 columns, hides below 130) |
D |
toggle live FPS, frame time, and Kitty transport HUD (--perf at launch) |
+ or = / - / 0 |
zoom in / out / reset (preserves viewport center) |
f / m / p (i) / c |
toggle fit-w/fit-p, crop/full, theme/paper, cont/page |
S |
toggle the wide 2up spread on terminals at 160 columns or wider (remembered per document) |
/ then n N |
full-text search with pixel highlights across visible pages (Esc clears) |
F |
search every document in the stack (Enter jumps, Backspace walks back) |
; |
label visible links and arXiv: mentions with hint chips (a-z opens, A-Z fetches in the background) |
o |
outline modal with live filter |
Tab or s / h / a |
cycle or select tool mode (SNIP, HL, NOTE) |
1 2 3 4 |
highlight / note color (amber, mint, sky, rose) |
| drag | SNIP hands off 2x region.png, HL highlights text line by line (falls back to box on scans), NOTE opens note prompt |
| click | inspect any highlight or note (e edit, d delete, 1-4 color, y copy), add point note in NOTE mode, or follow internal/web link |
y / @ |
hand off the visible portion of the center page to the clipboard (any tool mode) |
t or A |
open the annotations drawer (↑ ↓ / j k move, g / G first/last, Enter jump, e edit, dd delete, u undo, k keep agent mark into your notes, a filter by author, y export Markdown, / filter, Esc / t / q close) |
v / T |
toggle agent layer visibility / show annotations across the whole stack |
? |
help overlay |
Esc |
clear search or close the current modal. Esc never quits |
q / Ctrl+C |
quit (saves reading position, view mode, zoom, fit, crop, and ink) |
Holding Space, PageDown, PageUp, g, or G is safe. Repeats inside a short burst are coalesced, so hoja skips the intermediate PDFium renders and rasterizes once when scrolling settles. Inside tmux, hoja wraps every graphics frame in a passthrough sequence automatically; hoja doctor prints the allow-passthrough state and the one command that fixes it (tmux set -g allow-passthrough on).
Annotations
Highlights and notes stay local, one JSON file per document and per layer:
~/Library/Application Support/hoja/annotations/ # macOS annotations
~/.local/share/hoja/annotations/ # Linux annotations
~/Library/Caches/hoja # macOS cache (libpdfium, downloads, stacks, handoff)
~/.cache/hoja # Linux cache (libpdfium, downloads, stacks, handoff)
<hash>.json # human layer
<hash>.<agent>.json # one file per agent layer
<hash>.md # Markdown export
Set HOJA_DATA_DIR to an absolute private directory (mode 0700, no ~, no ..) to keep annotations/, state/, and stacks/ together in one place, ready for dotfiles, iCloud, or a git repo. Control sockets stay in the cache directory because socket paths have a short length limit.
Your marks render solid. Agent marks render with dashed underlines and hollow badges, so a study guide written by the agent in the next pane never looks like your own work. In the drawer, a filters by author and k keeps an agent mark by promoting it into your notes. Press y inside the drawer to export Markdown: hoja writes <hash>.md beside the layer files. Exports of 32 KiB or less are copied to the clipboard directly via OSC 52 (plus pbcopy on macOS); larger exports copy the exported file path instead.
Bidirectional agent annotations
The agent beside you can read your marks and add its own, without writing into the human layer:
hoja annot ls paper.pdf --by human # what you already marked
hoja annot add paper.pdf --by fx -p 3 \
--match "scaled dot-product attention" --color mint
hoja annot add paper.pdf --by fx -p 5 \
--rect 0.12,0.30,0.68,0.42 --color sky --note "core equation"
hoja annot clear paper.pdf --by fx # drop that agent layer only
Batches land in one repaint and are all or nothing:
hoja annot apply paper.pdf - --by fx --batch study-1 <<'JSON'
[
{"op": "add", "page": 1, "match": "scholarly works", "color": "rose", "style": "underline"},
{"op": "note", "page": 1, "match": "Google Brain", "occurrence": 1, "note": "industry lab", "color": "mint"}
]
JSON
Phrase matching is reviewed by exit code: 3 means no match (with the closest page text printed), 4 means the phrase repeats (retry with --occurrence K or --all). --dry-run resolves every mark without writing. Full playbook:
hoja skills get annotate
Obsidian literature note export
Turn a document's marks into one Markdown note, ready to drop into a vault:
hoja annot export paper.pdf --obsidian -o papers/attention.md
hoja annot export --active --obsidian --include-agent -o lit-note.md
hoja annot export paper.pdf --obsidian # print the note to stdout
--obsidian adds YAML frontmatter with the title, document key, and export date. Quotes and notes are grouped by page, and text is escaped so brackets, pipes, and # do not turn into Obsidian syntax. --include-agent appends agent layers under their own heading. Files written with -o use atomic 0600 writes and refuse to replace an existing note unless you pass --force. --json returns the markdown plus a summary instead.
Multi-document control plane
One reader hosts one stack per repo, and any pane can drive it:
hoja ctl ls # live readers, pid, stack, active title
hoja ctl status # stack, anchor block, doc count
hoja ctl open ./related-paper.pdf # add in the background with a * badge
hoja ctl open 1706.03762 --focus -p 3 # add, focus, and land on page 3
hoja ctl switch 2 # 1-based index or title substring
hoja ctl goto --page 7 # jump the active document
hoja ctl peek --text # read the visible page without moving it
hoja ctl search "scaled dot-product" # search every open document at once
hoja ctl search "ablation" --limit 20 --json # bounded JSON payload for a coding agent
hoja ctl close 2 # close one document
Readers launched from Rex export HOJA_ANCHOR with the spawning pane id, so hoja ctl open finds the right reader instead of spawning a duplicate split.
Link hints and citation browsing
Press ; in reading mode and hoja labels every visible link, plus plain-text arXiv:YYMM.NNNNN mentions, with a hint chip:
| Chip | Target | Opens as |
|---|---|---|
sky |
internal jump (page, outline entry, footnote) | jumps inside the current paper |
mint |
arXiv paper, PDF, or web article | downloaded in the background, then added to your stack |
amber |
external web page | handed to your browser |
Typing the lowercase label (or clicking the chip) opens the target directly. Typing the uppercase label, Shift+Click, or Alt+Click fetches it in a background worker without stealing focus, so the paper in front of you keeps rendering; the chip flips to a 1/2* counter when the download lands unseen. Backspace walks the history back, both within a paper and across papers in the stack.
Cross-stack search
Inside the reader, F searches every open document in the stack and lists hits with their title, page, and snippet. Enter jumps to a hit in another document, and Backspace returns through the history. Agents get the same index without touching the reader:
hoja ctl search "scaled dot-product attention" --limit 10
hoja ctl search "ablation" --json
The JSON reply carries hits with the stack index, display title, page, and snippet for each match, plus truncated and searched_docs when the result was cut, and it always fits one bounded control frame.
Agent handoff
Raw PDF text layers mangle math. Dragging a rectangle over an equation hands off that exact region, and pressing y / @ hands off the visible portion of the center page. Both render at 2x in crisp paper ink, extract intersecting text, and write:
~/.cache/hoja/handoff/<timestamp>-p<N>/
region.png
selection.md
meta.json
The full-page render is capped at 3600 px wide. hoja copies the absolute path of region.png to your clipboard via OSC 52 (plus pbcopy on macOS). Paste it into fx, Codex, or Claude Code so the agent reads the exact equation.
Agents can also query documents directly without opening the TUI:
hoja document.pdf --text -p 4
hoja document.pdf --png -p 4 -o /tmp/page4.png --width 1800
hoja skills get core --full
Rex terminal plugin
hoja rex install
Writes lua/hoja/init.lua, registers it in ~/.config/rex/init.lua, runs rex config check, and reloads Rex automatically. Press Cmd+Shift+P and type Hoja:
Hoja: Open PDF / Paper / FileHoja: Open Side-by-Side (New Split)Hoja: Watch File (Live LaTeX / Markdown)Hoja: Open arXiv Paper or PDF URLHoja: Switch DocumentHoja: Doctor
Remove anytime with hoja rex uninstall. Also compatible with Amber:
{
"crafter-station/hoja",
main = "hoja",
}
License
MIT. Built at Crafter Station.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found