Skip to content

The loop

Freehand is one loop. Words go out to paper, your pen comes back, and your AI hands what you wrote back as edits, notes and drafts. Everything else in these docs is a piece of that loop, or a place to plug into it.

The loop: a Google Doc, a markdown file or a web article goes through freehand to your e-ink device as a PDF. Pages and marks come back to your AI when you sync, and your AI hands them back to the source as edits, notes and drafts.

The loop is three jobs, each of which you can start by hand or have started for you:

  1. Send. Something to read or edit (a Google Doc, a markdown file, a web article) becomes a PDF in your device’s folder. It’s a proof if you’re editing it, and a reading copy if you’re reading it. Send a Doc, a file or an article shows how.
  2. Notice. When you sync, new notebook pages and new marks arrive on your drive, and something has to see them.
  3. Read and apply. Your AI reads the pages and the marks, files notes, and applies edits to the source.

Each job is made of the same three parts, and each part can run in more than one place. That’s why Freehand can be installed small or large:

Part What it is Where it can run
Notice What changed, and when Drive’s change list (the freehand script) · a synced folder on disk (freehand watch) · a git push (Send to paper)
Run The work: render, read a notebook, read marks Your computer (the freehand command) · a GitHub runner · any hosted service you call with a URL
Deliver Where the result goes The device’s folder in Drive · a git repo · a plain folder (an Obsidian vault, say) · a Google Doc

A few things can only happen inside your Google account, in the freehand script, which is an Apps Script running as you:

  • Sending a Google Doc. The script copies the Doc, lays it out, resizes its images and uses Google’s own PDF export. The Docs API can’t resize images already in a Doc, so no outside tool can do this.
  • Images in Docs. Images inserted through Google’s APIs show as broken boxes in the editor, so google-doc-images inserts them as you.
  • The Freehand panel in Docs.
  • Anything that has to happen with every computer off. The script’s every-minute trigger is the one part of Freehand that’s always on, and it costs nothing.

Everything else runs anywhere Node does: rendering markdown, clipping articles, reading notebooks and marks, and deciding what to send. Python is a detail, used only where it earns its place. Reading Supernote files uses supernotelib, a Python library whose maintainers follow the device’s format changes, and the commands that need it print JSON, so nothing that calls them knows what language they are.

A watcher notices changes, decides when to act, and acts. Freehand has two, and they share the deciding. Only .note and .mark files count, never the device’s conflict copies, and nothing happens until the folder has been quiet for a few minutes, so a sync that’s still uploading isn’t read half done.

The freehand script freehand watch on your computer
Notices Asks Drive what changed since it last looked Lists the synced folders on disk every 30 seconds
Acts Starts a GitHub workflow, or POSTs to a URL you give it Runs from your config: records new pages, reads marks, sends repos, then runs your then: command
Needs A GitHub token, or a URL Nothing: no token, and your notebooks never leave your computer
Runs when Always While the computer is on

They hand off to each other. With alive: set, the script leaves the reading to your computer while it’s on, and takes over when it’s been off for ten minutes, so nothing is read twice and nothing is missed. See the watcher as a launch agent.

A pipeline ends when the output is made. Freehand’s value is in what comes back. A proof you marked is only useful when the marks reach the source, and a notebook page is only useful when what’s on it lands in your notes. So the loop’s rules are about the return trip: every page names its source, round and version, so any mark maps back to the words it was made on, and nothing is applied until you tick the Done box.

The pieces are small on purpose. The next page, the six seams, says where a new device, format or sync app plugs in.