Skip to content

nick27g/pocketbrain

Repository files navigation

pocketbrain

One-tap capture into the inbox of your git-based second brain. Open it on your phone, type (or dictate) a one-line thought, tap Capture, and it commits to your GitHub repo as:

- [2026-07-13] the thought you had  #idea

No app store, no server, no account. It is a single static page you can add to your home screen. Your GitHub token stays in your browser's localStorage and talks directly to api.github.com, nothing else ever sees it.

Use it here: https://pocketbrain-smoky.vercel.app/

Why this exists

If you keep a markdown "second brain" in a git repo (Claude Code brain repos, Obsidian-on-git, Foam, Logseq), mobile capture is the weak link. The existing options are a native app, a self-hosted server, or hand-rolled iOS Shortcuts. This is none of those: one auditable page, open it, type, done. Capture speed is the whole product, which is also why it uses system fonts and zero dependencies.

Setup (3 minutes)

  1. Open the page, it asks for four things: GitHub username, repo, file path (default inbox.md), and a fine-grained personal access token
  2. Make the token at github.com/settings/personal-access-tokens/new with access to only your notes repo and only Contents read & write. The setup screen walks through the exact clicks and explains why that scoping keeps the worst case boring
  3. Add to home screen. On iPhone: Share → Add to Home Screen

How it works

  • Captures queue in localStorage first, so nothing is lost offline. The queue is visible and drains automatically when you're back online
  • Sync batches all pending lines into one commit: GET the file, append, PUT with the file's SHA. If GitHub answers 409 (something else wrote the file first), it re-reads and retries once, per GitHub's guidance that contents-API writes be serialized
  • Dictation is progressive enhancement: a mic button where the Web Speech API works (Android Chrome, desktop). On iPhone home-screen apps the API is unavailable, so use the mic key on the keyboard, which works fine
  • A service worker caches the shell so the app opens instantly and offline

Running locally

Open index.html in a browser (the service worker needs HTTPS, everything else works from a file). Test the pure logic with:

node test/core.test.js

Security notes, honestly

A personal access token in localStorage is a tradeoff, the alternative is a backend that holds your token for you, which is a bigger one. Keep it sane: fine-grained token, one repo, Contents permission only, set an expiry, revoke anytime. Worst case if your device is compromised is edits to that one repo, which is versioned anyway. The entire app is a few files you can read in five minutes.

License

MIT. Built by Nick Ghuneim.

About

One-tap capture into the inbox of your git-based second brain. A single static PWA: type or dictate, it commits to your GitHub repo. No app, no server, your token never leaves your device.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors