Expand description
First-run automation.
The installer cannot set Paper up: install.sh, cargo install and the
Claude plugin have no common post-install hook, and an installer should not
start a long-lived service. So the work happens here, on the first ordinary
command, and only once.
Effects, in order:
- register the background indexer as a user service (launchd/systemd), or fall back to a detached daemon for this login session;
- the daemon downloads the default models in the background (the embedding model first, then the optional reranker);
- the daemon indexes the auto-discovered roots immediately (instead of waiting for the first five-minute scheduler tick).
Escape hatches: PAPER_NO_AUTOSTART=1 (never), PAPER_OFFLINE=1 (no
network at all), PAPER_FORCE_BOOTSTRAP=1 (run even when PAPER_HOME is
set), and paper daemon-control uninstall (turn it off afterwards).
CI suppresses it too: a build machine must never index its own files.
Functions§
- clear_
setup_ status - ensure_
models - Download the default models if they are missing. Runs inside the daemon, so the user’s command has already returned. Failure is not fatal: keyword search keeps working and the next daemon start tries again.
- ensure_
reranker - Download the effective reranker (up to ~1.1 GB) if missing. Only search processes
use it and it only improves ordering, so the daemon spawns this instead of
delaying the first index pass. A failed or skipped download costs accuracy,
never functionality.
PAPER_NO_RERANKER=1keeps it off disk entirely. - index_
is_ empty - True when the index holds no chunks yet, which is the moment to index immediately rather than wait for the five-minute incremental tick.
- is_
offline PAPER_OFFLINEis set: nothing may touch the network.- maybe_
autostart - Called from
mainbefore dispatchingcommand. Never fails the command and never blocks on the network: the daemon does the slow work. - set_
setup_ status - Record what the daemon is doing in the background so searches can say so. Best effort: a failed write only loses the hint.
- setup_
status - The current background phase, if setup is in progress.