Repository navigation
11 November 2026 - Release 1.5.0 - Service API & EPUB
notes-exporter can now run as a long-running service that other programs (FunHoard, a backup job, a script) use over HTTP, and exports EPUB.
Upgrading from 1.4.x
Nothing changes for the command line or the nightly job. requirements.txt gains the service's dependencies (FastAPI, uvicorn, bcrypt, PyJWT, httpx), so the next run of exportnotes.zsh installs them into .venv. To use the service, follow Running as a service; if you scheduled exports with setup_launchd.py, let the service take over with notes-exporter service install --replace-legacy and set a schedule in its settings.
Service
notes-exporter serve(notes_service/, FastAPI + uvicorn) on 127.0.0.1:8790:GET /api/health,/status(running and last run, next scheduled run, Notes automation and Full Disk Access checked without prompting, formats),/manifest(verbatim, ETag / 304),/notes(changed since a sequence, by account or folder, tombstones),/notes/{id},/files/{path}(realpath containment, Range, ETag from the manifest's sha256),/runs(start, list, events, log, cancel),/admin/settings,/admin/users,/admin/api-keys. See SERVICE-API.md.- Auth: users with bcrypt passwords and roles admin / reader, JWT sessions with logout, API keys (
ne_…, stored as SHA-256, scopes read / run / admin, optional expiry, shown once), a login rate limit, credentials in query strings refused, the last admin protected, first-time setup only from the Mac itself. - Runs: one at a time;
exportnotes.zsh --json-log --non-interactivein a clean environment, never with--sync; progress and counts from the events; cancel stops the whole process group (SIGTERM, then SIGKILL after a grace period); records in sqlite. A run can ask for extra formats (formats, a union with the settings) and for folder books. - Schedule: every N minutes or daily at HH:MM; a time missed while the Mac slept runs once; skipped while a run is in progress.
- Web page at
/: first-run setup, sign-in, status, Run now, live run log, settings, users, API keys (new key shown once with a Copy button, revoke). notes-exportercommand:serve,user add|list|passwd|remove,apikey create|list|revoke,permission status|request,service install|uninstall|statusfor thecom.storizzi.notes-exporterLaunchAgent (refuses while the oldcom.<user>.notes_exporterjob exists, unless--replace-legacy).- Setup without copying secrets:
user add|passwd --generate-password --keychainmakes a strong password and stores it in the login Keychain (throughsecurity -ion stdin, read back to check; never printed, never on a command line);apikey create --env-file PATH [--env-var NAME] [--replace]writes the key into another program's env file (other lines kept byte for byte, mode 0600, atomic), shows only its prefix, and with--replacerevokes the older keys of that name. - Asking for the Notes permission:
notes_permission.py --asklets macOS show its dialog (opening Notes in the background first if needed); the service asks for itself withPOST /api/admin/permission/request(one at a time, waits up toNOTES_SERVICE_PERMISSION_REQUEST_TIMEOUT_SECONDS), from the web page's Ask macOS for access to Notes ornotes-exporter permission request, which signs in with a short session of its own and revokes it afterwards.GET /api/admin/permissionreports it. - Every tunable (port, session hours, rate limit, grace period, scheduler tick, …) is a
NOTES_SERVICE_*variable.
EPUB
--convert-epub: one EPUB 3 per note inepub/, made from the HTML output: well-formed XHTML, every image it shows packaged (shared images once), nav.xhtml and toc.ncx, the note id as a URN, its dates, account and folder in the metadata. Standard-library zipfile only (no GPL / AGPL dependency). Incremental, deterministic (an unchanged note keeps its sha256), and renamed, moved and pruned like the other formats.outputs.epubin the manifest.--epub-books folder: one EPUB per Notes folder inepub-books/, each note a chapter, ordered by--epub-book-order modified|created|title;--epub-book-subfolders nestedmakes subfolders parts of their top folder's book. A book is rebuilt only when it changes; a folder with no notes left loses its book. The manifest gainsbooksanddeleted_books.
Manifest
- Additions within version 1:
books,deleted_books,run.counts.books,deleted[].deleted_in_run, andepubinformats/outputs.
Tests
- Service tests (TestClient with a fake exporter, a fake launchctl, a fake permission helper and a fake
security), an end-to-end suite on a real server port (also driving the realexportnotes.zshwith the fake osascript), EPUB structure and book tests, andikt.project.jssoikt test notes-exporterruns the tiersunit,service,e2eandepubcheck(optional), plus the opt-inlivetier (NOTES_EXPORTER_LIVE=1: one real export through the running service, checked file by file against the manifest, counts only).
11 November 2026 - Release 1.4.0 - Nested Folders, Manifest & Reliable Incremental Export
This release makes the export dependable for large libraries and for other programs: incremental runs only touch notes that changed, one bad note no longer stops a run, deletions are only recorded when they are certain, nested folders are kept, and every run leaves a machine-readable manifest.json.
Upgrading from 1.3.x
Nothing is required. The default layout (&account-&folder, &title-&id) is unchanged, and 1.3 tracking files are read as they are; the first 1.4 run adds ISO dates and folder information to each record. Use python3 (macOS has no python); exportnotes.zsh now creates .venv and installs the dependencies itself when no suitable Python is found. To move to nested folders, run reorganize_by_folder.py --dry-run, then without it, and export with --folder-hierarchy.
Export reliability
- Incremental runs re-exported unchanged notes (#30): modification dates are compared as ISO timestamps instead of localised strings, and recorded with a time zone.
- Note titles with a back-tick, quote or
$were silently dropped (#33): tracking data is no longer passed through a shell; the AppleScript writes it to a file thattracker_io.pymerges. - Same-named folders under different parents dropped each other's notes (#37): a note is recorded as deleted only after a run that listed its own folder to the end. Interrupted, failed and filtered runs never record deletions.
- Locked notes and failing notes are skipped and reported; the export carries on. Only a refused permission or Notes quitting stops it.
- Notes changing during an export: folders are checked by id and each folder's notes are read consistently, so another note's title or flags can't end up on a file.
- writeToFile appended instead of replacing shorter content, and closed the wrong file (#24, #25).
- Paths with spaces in the tool's own folder broke the script (#38).
pythonnot found on current macOS (#15, #17, #32).--venv-dirdidn't install dependencies (#29).- Dates from
set_file_dates.pywork with more locale formats (#24).
Nested folders
&folderpath(alias&path) in--subdir-format, and--folder-hierarchyfor&account/&folderpath(#36).--filter-foldersand the new--exclude-foldersaccept folder paths (Work/Projects).reorganize_by_folder.pymoves an existing flat export into the nested layout, offline from the tracking data.- Every later step (images, conversions, dates, sync, query, reconcile, Qdrant) follows the nested paths.
For other programs
manifest.json(formatnotes-exporter.manifest, version 1), written atomically after every run, failed ones included: notes with stable ids, nested folder paths, ISO dates, tags, locked / shared / pinned / checklist, every output file with SHA-256 and size, attachments,previous_outputsafter renames and moves,changed_this_run; deleted notes as tombstones; skipped notes with the reason. See INTEGRATION.md.--json-log [FILE]onexportnotes.zsh: JSON Lines events (start,plan,progress,stage,note_error,manifest,result).- Exit codes: 0 ok, 1 could not start, 2 partial, 3 Notes automation refused, 4 another export running, 5 failed.
--non-interactivechecks the automation permission without asking and exits with 3 rather than wait at a prompt.- A lock in the export root stops two exports sharing it.
--version,--python PATH.
Files and formats
--prune-deletedremoves the files of notes deleted in Apple Notes, keeping locally edited Markdown (#26). A moved note's old copy is always removed.--image-format,--image-format-from,--image-qualityconvert extracted images (sips; WebP through Pillow or cwebp) (#28).--tagsreads#tags, pinned and checklist flags from a copy of the Notes database (needs Full Disk Access) (#16);--tags-in-contentwrites a Tags line into each note. Without--tagsthe manifest lists hashtags found in the text.- Markdown image links work for attachment names with spaces or parentheses (#34, #35).
--html-wrapescapes the title and adds the tags as keywords.- A rename removes only that note's attachments (names with
[]matched others'). sync_to_notes.py: options with spaces are passed whole (#31), and Markdown edited before its first sync is detected as changed (#31).
Dependencies
beautifulsoup4 4.15.0, markdownify 1.2.3, pypandoc 1.17, pytest 9.2.0; tested on Python 3.15. Pillow is optional, for WebP.
Thanks to @rnoblecodes for the detailed reports and fixes behind #33, #34–#37 (PR #35 and the folder post-processor), @sai3563 (PR #24), @weijianfan (PR #25), @laurachencn (PR #32), @gdecugis (PR #38), @jtenniswood for the ideas in PR #27, and @chrisvanpatten, @dotherightthing, @tcrgit, @pppaapp and @MrSimmo for their reports.