Documentation · v0.2.1

Your first session in five minutes.

Install hoja, connect Claude Code, Codex, or fx via npx skills add crafter-station/hoja, open an arXiv paper, EPUB book, web article, or Typst file, follow citations without leaving your terminal, and export your annotated session to Obsidian. Everything below matches the shipped v0.2.1 binary.

MITmacOS + LinuxGhostty + Rexv0.2.1View .md

00 · Five-Minute Session

Complete the full loop once.

Instead of memorizing flags first, run the real end-to-end study loop: install, teach your agent, open a paper, follow a citation, ask for an annotated guide, and export to Obsidian.

complete loop
# 1. Install hoja and verify graphics + libpdfiumcurl -fsSL https://hoja.crafter.run/install.sh | shhoja setuphoja doctor # 2. Teach Claude Code, Codex, or fx how to drive hojanpx skills add crafter-station/hoja # 3. Open a paper in a Ghostty or Rex split panehoja 1706.03762# Inside hoja: press ; then uppercase A-Z to queue a cited paper in the background

Paste this to your coding agentClaude Code · Codex · fx

“Inspect my active paper in hoja, check what I already highlighted, add a color-coded study guide in your own layer (claims amber, caveats rose underline, definitions mint, core equations sky), and export our combined notes to Obsidian at papers/attention.md.”
what the agent runs underneath
hoja ctl peek --texthoja annot ls --active --by humanhoja annot apply --active - --by fx --batch study-1 < marks.jsonhoja annot export --active --obsidian --include-agent --output papers/attention.md

Terminal compatibility

TerminalStatusNotes
GhosttyTested (primary)Native Kitty Graphics Protocol, OSC 10/11 theme sync, OSC 52 handoff
RexTested (primary)Includes native Cmd+Shift+P Lua plugin via hoja rex install and HOJA_ANCHOR pairing
tmux (inside Ghostty / Rex)TestedAutomatic APC passthrough wrapping; enable tmux set -g allow-passthrough on
Kitty / WezTerm / othersNot CI-tested yetRequires Kitty Graphics + OSC 10/11; run hoja doctor inside your pane to verify
macOS Terminal.appUnsupportedNo Kitty Graphics Protocol; headless --text / --png still work

00b · Guides & Playbooks

Focused guides by job to be done.

Every topic below has its own dedicated URL and clean .md mirror for agents. The full single-page reference continues directly below.

01 · Install

Quick start and installation.

One script, one package manager, one checksum-verified PDF engine. Pick the channel you already trust and run the same two commands afterwards.

install
# Shell installer, macOS and Linux prebuilt binarycurl -fsSL https://hoja.crafter.run/install.sh | sh # Homebrewbrew install crafter-station/tap/hoja # Cargo, from crates.iocargo install hoja # Bun, or npm install -g @crafter/hojabun add -g @crafter/hoja

Then initialize the PDF engine and prove your terminal can host the reader:

setup
hoja setup      # downloads and SHA-256 verifies pinned libpdfium into the cache dirhoja doctor     # checks Kitty graphics, OSC 10/11 theme, libpdfium, tectonic, typst, tmuxhoja 1706.03762 # open Attention Is All You Need in your terminal theme

You need

  • A terminal with the Kitty Graphics Protocol and OSC 10/11 theme queries. Ghostty and Rex are the tested pair.
  • macOS or Linux. macOS Terminal.app is not supported.
  • Optional: typst for Markdown math, Typst files, web articles, and EPUB books, and tectonic for TeX.

What setup buys you

  • A pinned libpdfium downloaded once and verified by SHA-256.
  • Pixel-exact pages rendered through pdfium-render (Apache/BSD, MIT compatible), not a Markdown conversion.
  • A clean hoja doctor report before you open an issue.
Tip
Run hoja setup once per machine. Upgrades keep the same cache; hoja doctor is the fastest way to see which optional tool is missing. Inside tmux, graphics passthrough wrapping is automatic, and hoja doctor prints the one setting that can still block frames: tmux set -g allow-passthrough on.

02 · Research

An arXiv reading desk in one pane.

Pass one ID or twenty. Each document joins the repo stack, and the stack boots without rendering every page up front.

twenty papers
hoja 2305.10601 1706.03762hoja https://arxiv.org/abs/2305.10601

Human titles are extracted from PDF metadata or page-1 typography, so the switcher reads Tree of Thoughts and Attention Is All You Need instead of file hashes. Opening 20+ PDFs boots in about 450 ms because the stack is lazy.

KeyWhat it does
bDocument switcher, which also opens a new document
'Jump back to the last document you read
H LPrevious and next document in the stack
[ ]Aliases for the same stack walk
BWide rail: needs 140 columns, hides below 130 columns
FSearch every open document and jump into a hit
SSide-by-side 2up spread on terminals at 160 columns or wider
TRead annotations across the whole stack
xClose the current document
Pane math
A narrow agent split is around 80 columns, so B hides there on purpose. Widen the reader pane past 140 columns and the rail returns. f plus auto-crop keeps the page legible when the rail is off.

03 · Inputs

PDFs, web articles, books, Typst source.

hoja is not an arXiv viewer with extra steps. The same reader opens a 500 page book, a dark conference deck, a password-protected report, a remote PDF, a blog post, an EPUB novel, and a Typst file.

open anything
hoja book.pdf                        # local filehoja https://example.com/paper.pdf   # remote http(s) URLhoja https://example.com/post        # web article, converted and compiled by Typsthoja novel.epub                      # EPUB book, unpacked in memoryhoja notes.typ --watch               # Typst source, live reload on savehoja secret.pdf --password 'hunter2' # encrypted PDFexport HOJA_PDF_PASSWORD='hunter2'   # or keep it out of shell historyhoja secret.pdf
SourcePipeline
.pdf, arXiv ID, remote PDFpdfium over the Kitty Graphics Protocol, downloads capped at 512 MiB
http(s) articleHTML to Markdown, then sandboxed Typst, cached with the page title
.epubUnpacked in memory, then the same sandboxed Typst pipeline
.typtypst compile --root on the source itself
.md and .texcmarker plus mitex, and tectonic
  • Long books stay flat. A bounded 8 page LRU page cache plus three double-buffered GPU strips mean a 500 page book keeps the same small working set as a 5 page memo.
  • White diagrams melt into your theme. Neutral paper and ink move through a cached 64³ OKLab lightness LUT, so a white-background Seaborn plot or a hairline rules diagram blends into dark glass without turning hues inside out.
  • Dark and chromatic pages are left alone. Full-bleed covers and colored slide decks are detected and kept uncropped and unrecolored.
  • Mixed page sizes keep geometry. Covers, landscape slides, and appendices render at their own dimensions; auto-crop is computed per page-size group.
  • Remote PDFs are validated, not trusted. The download must start with %PDF- and is capped at 512 MiB before it reaches the renderer.
  • Articles arrive as clean Markdown. defuddle runs when it is on PATH. Otherwise a built-in, pure-Rust HTML extractor takes over. Set HOJA_DEFUDDLE=0 to always use the built-in path.
  • EPUB books are unpacked defensively. Zip bombs, zip slip paths, XML entity tricks, and DRM-protected files are rejected before anything renders.
Sandbox
Articles and EPUB books compile through a scratch directory with --root, page content is never injected as raw Typst (raw-typst: false), and math passes through a MiTeX guard.
adjust the page
hoja document.pdf        # then: f fit, m crop, p theme, c single page
Passwords
--password is read from the flag or HOJA_PDF_PASSWORD and used in memory only. hoja never writes it to a cache file, a stack entry, or a log line.

04 · Author

Live LaTeX and Markdown, scroll intact.

Write the source in one pane, read the typeset page in the other. Reloads keep your reading position instead of jumping to page one.

watch
hoja notes.md --watch   # typst + cmarker + mitex, about 100 ms warmhoja paper.tex --watch  # tectonichoja notes.typ --watch  # typst compile --root, reload on savehoja document.pdf --watch

Markdown compiles with $...$ and $$...$$ math through Typst using cmarker and mitex. TeX compiles through tectonic, Typst files compile directly with --root, and a local PDF can also be watched and reloaded live.

SourceCompilerWarm reload
.md with mathtypst + cmarker + mitexabout 100 ms
.textectonicincremental
.typtypst compile --rooton save
.pdfnone, reloads the fileimmediate
Doctor
hoja doctor reports whether typst and tectonic are on your PATH. Missing compilers only cost you the source front doors, never PDF reading.

05 · Citations

Follow citations without leaving the stack.

A paper cites another paper, and you want it open, not in a browser tab. Press the semicolon, pick a chip, and hoja adds the target to the same reading stack.

link hints
;          # label every visible link and arXiv:YYMM.NNNNN mentiona          # open the labeled target in placeA          # or Shift+Click / Alt+Click: fetch it in the background
ChipTargetResult
skyinternal jump: page, outline entry, footnotejumps inside the current paper
mintarXiv paper, PDF, or web articledownloads in a background worker, then joins your stack
amberexternal web pageopens in your browser
  • Lowercase labels and clicks open the target directly. Uppercase labels, Shift + click, and Alt + click fetch in the background so the page you are reading keeps its frames.
  • When a background fetch lands unseen, the chip flips to a 1/2* counter, the same marker the stack uses for documents you have not opened yet.
  • Backspace walks the history back, within one document and across documents in the stack.
Plain text
Citations written as plain text, like arXiv:1706.03762, get a chip too. You do not need a PDF link annotation to jump from a reference list.

06 · Handoff

Hand an equation to your coding agent.

Raw PDF text layers mangle fractions, radicals, and nested subscripts. hoja hands off the pixels instead, plus the text that intersects them.

  • Drag a SNIP box over any equation or figure.
  • Or press y / @ to hand off the visible portion of the center page in any tool mode.

Both paths render at 2x density in crisp paper ink, extract intersecting text, and write a self-contained bundle. The full-page render is capped at 3600 px wide.

handoff bundle
~/.cache/hoja/handoff/<timestamp>-p<N>/  region.png      # 2x crisp crop  selection.md    # text that intersects the region  meta.json       # page, rect, source document  # older bundles are pruned past 50

The absolute path of region.png lands on your clipboard through OSC 52 plus pbcopy on macOS. Paste it into fx, Codex, or Claude Code, and the agent reads the exact equation.

headless extraction
hoja document.pdf --text -p 4hoja document.pdf --png -p 4 -o /tmp/page4.png --width 1800

07 · Annotations

Your notes and the agent's notes, side by side.

One human layer that only the reader can write, plus one isolated JSON sidecar per agent. The two can never overwrite each other.

FileWritten byRenders as
<hash>.jsonthe TUI onlysolid marks
<hash>.<agent>.jsonhoja annot --by <agent>dashed underline, hollow badge
<hash>.mddrawer exportMarkdown file
<hash>.lockflockwrite lock

From the reader

  • Tab cycles SNIP, HL, and NOTE. s, h, and a select them directly.
  • 1 to 4 pick amber, mint, sky, or rose.
  • HL selects text line by line and falls back to a box on scans. NOTE opens a note prompt; a click drops a point note.
  • Click any mark to inspect it: e edit, d delete, 1-4 recolor, y copy.
  • t or A opens the drawer. y exports Markdown beside the layer JSON; up to 32 KiB is copied straight to the clipboard, larger exports copy the file path.
  • v toggles the agent layer. T shows annotations across the whole stack. k in the drawer promotes an agent mark into your notes.

From the agent pane

agent annotations
hoja annot ls paper.pdf --by humanhoja annot add paper.pdf --by fx -p 3 --match "scaled dot-product attention" --color minthoja annot add paper.pdf --by fx -p 5 --rect 0.12,0.30,0.68,0.42 --color sky --note "core equation"hoja annot note paper.pdf 7 "revisit the ablation" --by fxhoja annot rm paper.pdf 6 7 --by fxhoja annot clear paper.pdf --by fx     # drop that agent layer onlyhoja annot clear paper.pdf --by agent  # safe reset for every agent layer
atomic batch
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"},  {"op": "add", "page": 5, "rect": [0.12, 0.30, 0.68, 0.42], "color": "sky", "note": "core equation"}]JSON

A batch is all or nothing: the first failing item aborts the run with its 0-based index and writes nothing. Add --dry-run to resolve every mark without touching disk.

ExitMeaningFix
3no_match or no_live_readerread the printed candidates and tighten the phrase
4ambiguousretry with --occurrence K, or mark all with --all

Export a literature note

obsidian export
hoja annot export paper.pdf --obsidian -o papers/attention.mdhoja annot export --active --obsidian --include-agent -o lit-note.mdhoja annot export paper.pdf --obsidian          # print the note to stdout

The note carries YAML frontmatter with the title, the document key, and the export date. Quotes and notes group by page, and text is escaped so brackets, pipes, and hashes stay literal in Obsidian. -o writes a private 0600 file atomically and refuses to replace an existing note without --force.

Human layer
The CLI rejects --by human. Only the TUI writes the human layer, and rm or note touch only the caller's own layer, so an agent cannot edit or delete your work.

08 · Control

One reader, many documents, no stolen focus.

Every repo gets a stack. Any pane can push a document into the running reader, switch it, search across all of it, or read the visible page without moving it.

rex plugin
hoja rex install    # writes lua/hoja/init.lua and registers it in ~/.config/rex/init.luahoja rex uninstall

Press Cmd + Shift + P and type Hoja: Open PDF / Paper / File, Open Side-by-Side (New Split), Watch File (Live LaTeX / Markdown), Open arXiv Paper or PDF URL, Switch Document, and Doctor. Readers launched from Rex export HOJA_ANCHOR with the spawning pane id, so hoja ctl open finds that reader instead of spawning a duplicate split.

control plane
hoja ctl ls                          # live readers, pid, stack, active titlehoja ctl status                      # stack, anchor block, doc counthoja ctl open ./related-paper.pdf    # add in the background, no focus stolenhoja ctl open 1706.03762 --focus -p 3 --find "attention"hoja ctl switch 2                    # 1-based index or title substringhoja ctl goto --page 7 --y 0.25hoja ctl peek --text                 # read the visible page without moving ithoja ctl peek --png -o /tmp/visible.pnghoja ctl search "scaled dot-product" # search every open document in the stackhoja ctl search "ablation" --limit 10 --jsonhoja ctl close 2

F gives the human the same index inside the reader: Enter jumps into a hit in another document and Backspace returns. Agents get the JSON reply instead, with document title, page, and snippet per hit, plus truncated and searched_docs when the stack was too large for one control frame.

ResolverBehavior
--pidTarget one reader process
--blockTarget the pane block id exported by Rex
defaultCurrent directory, then repo root, then most recently focused reader
--jsonStable registry payload for scripts

09 · Agents

Teach your coding agent the whole surface.

hoja ships its own playbooks inside the binary, so every install channel serves skills that match the installed version.

skills
npx skills add crafter-station/hojahoja skills listhoja skills get corehoja skills get core --fullhoja skills get annotatehoja skills get rex
SkillCovers
coreHeadless text and PNG extraction, annotation workflows, control plane, and troubleshooting. --full appends every flag, payload, and exit code.
annotateColor coded study guides written into an agent layer
rexDriving a live reader beside an agent inside Rex
Overrides
hoja skills list --json returns [{"name","description"}]. Set HOJA_SKILLS_DIR to add or override <name>/SKILL.md skills at runtime without rebuilding.

10 · Perf

100+ FPS scroll, one texture.

No page re-rasterization while you scroll. Geometry moves instantly, rasters arrive from a bounded cache, and the active strip slides on the GPU.

Held Space, PageDown, PageUp, g, or G repeats inside a short burst are deferred: hoja skips the intermediate PDFium renders and rasterizes once when scrolling settles, so a fast pager does not queue a page you already passed.

LayerJob
StripLayoutPoint geometry for the whole document, so scroll offsets and page dividers are instant
LRU PageCacheBounded 8 page raster cache shared across the stack
GPU stripsDouble-buffered 3x strips pre-composited off the UI thread, then slid with Kitty a=p crops in about 0.05 ms per frame
perf HUD
hoja paper.pdf --perf   # start with the HUD onhoja paper.pdf          # or press D inside the reader

D toggles live FPS, frame time, and the Kitty transport tag. The tag tells you which path actually presented the frame:

TagTransport
gpuPre-composited strip placed with an a=p crop
shmShared memory image transfer
tmpTemporary file transfer
dirDirect inline transfer

11 · Keys

Complete controls reference.

Dvorak-friendly by default, with j and k kept as aliases. Esc clears search or closes a modal and never quits.

Navigate

KeyAction
↑ ↓ / wheel (j k)Smooth continuous pixel scroll
d / uHalf viewport down / up
Space / PageDownNext page top
Shift+Space / PageUp / Shift+TabCurrent page top, then previous page
g / G (Home / End)First / last page
← / →Horizontal pan when zoomed, else previous / next page
BackspaceJump back after a link, outline entry, or cross-stack search hit, across documents too
[ / ] or H / LPrevious / next document in the stack
b / 'Document switcher (also opens a new document) / last document

View

KeyAction
+ or = / - / 0Zoom in / out / reset around the viewport center
fToggle fit-width / fit-page
mToggle auto-crop / full margins
p or iToggle OKLab theme / paper colors
cToggle continuous / single page
SToggle the side-by-side 2up spread (needs 160 columns, remembered per document)
xClose the current document
BToggle the wide rail (140 columns, hides below 130)
DToggle the live FPS and transport HUD

Find and outline

KeyAction
/Full-text search with pixel highlights on visible pages
n / NNext / previous match
oOutline modal with live filter
FSearch every open document in the stack, Enter to jump
;Label links and arXiv mentions: a-z opens, A-Z fetches in the background
EscClear search or close the modal. Never quits

Tools and annotations

KeyAction
TabCycle tool mode SNIP / HL / NOTE
s / h / aSelect Snip / Highlight / Note
1 2 3 4Color amber / mint / sky / rose
dragSNIP hands off a 2x PNG, HL selects lines, NOTE opens a prompt
clickInspect a mark, follow a link, or drop a point note in NOTE mode
y / @Hand off the visible viewport in any tool mode
t or AAnnotations drawer and Markdown export
v / TToggle agent layer / show annotations across the stack
?Help overlay
q / Ctrl+CQuit and save position, view mode, zoom, fit, crop, and ink

Annotations drawer

KeyAction
↑ ↓ / j k, g / GMove, first / last
EnterJump to the annotation
eEdit the note
ddDelete the mark (u undoes)
kKeep an agent mark by promoting it into your notes
aFilter by author
yExport Markdown
/Filter the list
Esc / t / qClose the drawer

12 · CLI

Flag surface and exit codes.

Everything below is available without the TUI, which is what makes hoja usable from an agent, a script, or a cron job.

FlagMeaning
[SOURCE]...PDF path, http(s) PDF or article URL, arXiv ID or URL, .typ, .epub, .tex, or .md file
--paperStart in original paper colors instead of the theme
-w, --watchWatch a local .tex, .md, .typ, or .pdf and reload live
--password <PASS>Encrypted PDF password, falls back to HOJA_PDF_PASSWORD
--textPrint extracted text instead of opening the reader
-p, --page <PAGE>1-based page for --text or --png
--pngRender one page to PNG instead of opening the reader
-o, --output <PATH>Output path, required by --png
--width <PX>Target pixel width for --png, default 1600
--perfStart with the live FPS and transport HUD enabled

--text without --page prints every page as --- page 1 --- followed by that page text. With no source, hoja exits 1 and prints usage.

ExitMeaning
0Success
1Runtime error: bad color or style, missing pdfium, unreadable file, invalid HOJA_DATA_DIR, reader rejected the request, no source
2Clap usage error: unknown flag, missing required flag
3no_match or no_live_reader
4ambiguous, retry with --occurrence K

hoja annot

SubcommandKey flags
ls--by human / agent / <slug>, -p, --stack, --json, --md
add--by, --match / --from+--to / --rect, -p, --color, --style, --note, --batch, --occurrence, --all, --dry-run
applyFILE or -, --by, --batch, --dry-run, --json
rmID..., --by
noteID TEXT..., --by
clear--by <slug> or --by agent, --batch
export--obsidian, -o, --include-agent, --force, --json
Targets
annot commands accept an explicit target, or --active for the live reader in this directory, which is also the default when no target is given. annot ls --stack reads every document in the repo stack.

hoja ctl

SubcommandKey flags
ls--json
status--pid, --block, --json
openTARGET, --focus, -p, --find, --by
switchQUERY (1-based index or title substring)
close[QUERY], defaults to the active document
goto--page, --y, --doc
peek--text or --png -o <PATH>
searchQUERY, --limit (1 to 200), --json

13 · Trust

Storage, privacy, and file security.

Everything hoja remembers lives in your own user directories with restrictive permissions. There is no account, no upload, and no telemetry.

DatamacOSLinux
Annotations~/Library/Application Support/hoja/annotations/~/.local/share/hoja/annotations/
Cache~/Library/Caches/hoja~/.cache/hoja
Web articles and EPUB~/Library/Caches/hoja/url, epub~/.cache/hoja/url, epub
Handoff bundles~/Library/Caches/hoja/handoff~/.cache/hoja/handoff
Stacks and sockets~/Library/Caches/hoja/stacks, run~/.cache/hoja/stacks, run
portable data dir
export HOJA_DATA_DIR=/Users/you/hoja-data   # absolute, no ~, mode 0700 /Users/you/hoja-data/annotations/   # layers and exports/Users/you/hoja-data/state/         # reading position and view state/Users/you/hoja-data/stacks/        # per-repo stacks and history# sockets stay in the cache, because socket paths are length limited
  • Private by default. Annotation JSON, exports, cache files, and handoff bundles are written 0600. Run, stack, and handoff directories are 0700.
  • Multi-process safe. Annotation writes take an exclusive flock on <hash>.lock and rename into place, so a reader, an agent, and a batch job cannot interleave a partial write.
  • No secrets at rest. PDF passwords are used in memory and never stored. Remote source titles and error messages strip the query string, fragment, and user info, so signed URL tokens do not land in stacks or logs.
  • Safe URI allowlist. PDF links open http and https, mailto is copied, and file, javascript, data, and PDF Launch actions are blocked before anything executes.
  • Portable data dir. HOJA_DATA_DIR takes an absolute path only, rejects ~ and .., creates the tree with mode 0700, and refuses a directory you do not own or one that is group or world writable.
  • Read-only toward your files. hoja never rewrites the PDFs you open. Highlights, notes, and exports are separate files in the annotation directory.
Offline
Local reading never touches the network. Only a remote URL, an arXiv ID, or hoja setup makes a request.