dipper PLAN.md
21 kB 362 lines
Markdown
at main

dipper — self-hosted multi-protocol feed reader + publisher TUI (Go + MCP) #

dipper (n.): the American dipper, a rare songbird that hunts underwater in fast mountain streams, diving into the current and walking the streambed for food, then returning to its perch above the water. dipper the tool dives into every open subscription protocol, fetches everything onto one local store (the perch), and lets you read, filter, and publish back out to AT Protocol and ActivityPub for maximum reach.

Single static Go binary. Same core powers three front-ends: the Bubble Tea TUI, an MCP server (dipper mcp, any agent can read/publish all content), and a headless sync/daemon for the background fetch loop.


Status (2026-11-30) #

Milestone 1 shipped: read/browse works end-to-end on all three surfaces.

  • Store: SQLite (pure-Go modernc.org/sqlite) with sources/cursors/items; upsert dedupes by stable id; per-source cursors for incremental sync.
  • Connectors (read): rss (RSS/Atom/JSON via gofeed), github (/events/public), atproto (public appview), ap (WebFinger -> actor -> outbox, tolerates secure-mode 401 as non-fatal).
  • TUI: All/Posts/Blogs/Images/Videos/Code tabs with live counts, two-pane list + glamour detail, tab/h l switch (reloads), j k g G nav, r sync, / search, q quit.
  • MCP: dipper_list_sources, dipper_add_source, dipper_remove_source, dipper_sync, dipper_feed, dipper_get_item, dipper_search.
  • Daemon: dipper daemon -interval D, -once for cron; SIGTERM-clean; systemd user unit example in deploy/dipper.service.
  • Build: make static produces a CGO_ENABLED=0 stripped ~22 MB static ELF. GOTOOLCHAIN=auto (Charm deps pin a newer Go than the system toolchain).

Deferred per plan: publishing + reply connectors (AT, AP via GoToSocial Mastodon-compatible API), media download/attachment rendering, image/video preview in the TUI, and authenticated/private-source ingestion.


Verified today against live GitHub (stars / license / last push), not memory.

Go — the load-bearing libs are all mature #

need Go library stars lic pushed
TUI framework (your ask) charmbracelet/bubbletea 45.9k MIT 2026-11
TUI widgets charmbracelet/bubbles 9.1k MIT 2026-11
Layout/styling charmbracelet/lipgloss 12.1k MIT 2026-11
Publishing forms charmbracelet/huh 7.3k MIT 2026-10
Markdown render (blogs) charmbracelet/glamour 3.8k MIT 2026-11
MCP (official) modelcontextprotocol/go-sdk 5.4k BSD 2026-11
MCP (popular alt) mark3labs/mcp-go 9.3k MIT 2026-11
RSS/Atom/JSON mmcdole/gofeed 2.9k MIT 2026-11
atproto (official) bluesky-social/indigo 1.4k Apache-2 2026-11
atproto CLI prior art mattn/bsky 458 MIT 2026-08
AP vocabulary go-ap/activitypub 160 MIT 2026-11
sixel encode mattn/go-sixel 178 MIT 2026-11

Rust — the same needs, for comparison #

need Rust crate stars lic
TUI framework ratatui/ratatui 23.5k MIT
TUI image widget ratatui/ratatui-image 422 MIT
MCP (official) modelcontextprotocol/rust-sdk 4.2k mixed
async runtime / http tokio 33.8k / reqwest 12.0k — MIT
atproto client atrium-rs/atrium 418 MIT
atproto server rsky 723 (Apache) — Apache
AP federation LemmyNet/activitypub-federation-rust 497 AGPL

The case #

Go wins for dipper specifically, because the charmbracelet ecosystem you named is itself the single most mature TUI stack in existence, and it covers the feature shape of dipper out of the box: glamour renders long-form blogs, huh builds the publish forms, bubbles gives tabs/lists/spinners, lipgloss the layout. In Rust you reach for ratatui + and then hand-assemble markdown rendering, forms, and the rich components charm already ships. That is the difference between "assemble" and "rebuild."

  • MCP: both have an official SDK; Go also has the 9.3k-star mcp-go. Toss-up, slight Go edge on community tooling.
  • atproto: Go has indigo (first-party, the same stack your pds/knot/ATCR run on) plus mattn/bsky as a working client reference, and the ES256K/JWT primitive is already proven in this environment. Rust's atrium is fine but smaller.
  • RSS: gofeed is more battle-tested than the Rust options.
  • Static binary: Go compiles a single static binary trivially; Rust needs a musl target + care. The user asked for "pretty golang static binary."

Rust wins exactly one axis that matters here: the image widget. ratatui-image (422★) renders kitty/sixel nearly free. Go has no comparable widget — charm/x is experimental and mattn/go-sixel only encodes. Verdict: that gap is a bounded, self-contained component (~a few hundred lines of kitty + sixel ANSI escape sequences), not worth abandoning the whole charm ecosystem and rebuilding forms + markdown. So: Go, with a hand-rolled graphics backend.

ActivityPub note (true in both languages): the best AP federation libs are server-side frameworks and largely AGPL (LemmyNet). dipper is a reader + publisher, not a federation server. AP read = public outbox JSON / RSS (no signing). AP publish (see §5): dipper posts through an AP platform account you already have creds for (Mastodon / Pixelfed / any instance, via its account token API), and that platform's actor federates to every follower natively. That is the most-compatible, least-code way to reach Mastodon+Pixelfed and it needs no federation framework in either language. (A pure "dipper-is-the-actor" path that signs its own Create/ Note/Article over HTTP signatures and hosts an inbox on lance.dev is an optional advanced mode, not the default; it needs a small hosted actor, not just a CLI, because followers push deliveries to an inbox.) Go's thin AP vocab lib covers the optional mode; nothing AGPL is required.

Recommendation: Go. If image fidelity later becomes the dominant requirement over the charm ecosystem, ratatui is the escape hatch — but it is a rewrite, so decide once, up front: Go.


2. Core architecture #

                      ┌─────────────────────────────────────────┐
  sources/ (Connectors) │            core store (SQLite)          │
  ─────────────────────►│  Item{ id, source, kind, author, ts,    │
   at, ap, rss/atom/json│    title, body(md), media[], url,       │
   peertube, youtube    │    protocol, uri, raw, seen, pub_to{} }  │
   github, codeberg     │  + sources, creds, publish_log           │
   tangled, git         └───────────────┬─────────────────────────┘
   (each → normalized Items)            │
              ┌─────────────────────────┼─────────────────────────┐
              ▼                         ▼                          ▼
        dipper (TUI)              dipper mcp (stdio)          dipper sync (daemon)
        tabs + reader        agent tools: list/read/     background poll +
        + publisher          search/publish              incremental fetch
  • Connector interface — the one abstraction everything hangs off. Each source is a Connector: Discover, FetchSince(cursor) → []Item, Capabilities, Publish(Item) → []Receipt. Adding YouTube or a forge = adding a Connector.
  • Item — one normalized schema. kind ∈ {post, blog, image, video, commit, merge_request, issue, comment, release, track, ...}. media[] carries image/video refs (URI + mime + local cache path). Tabs are pure filters over this store.
  • Store — SQLite (CGO-free modernc.org/sqlite, or libsql to match the lancedev stack). Dedup on (protocol, uri). Feed = a query; global tab = no filter; content tabs = where kind in (...).
  • Cursor sync — each connector stores a cursor (last ts / last rid / etag / git sha) so the daemon does incremental fetch, never re-downloads.
  • Media cache — images/short videos cached under ~/.local/share/dipper/media/ for offline render + kitty/sixel display. Big videos stay as links + player.

3. Tabs (UI = filters over the store) #

Global All feed, plus per-content-type tabs, each sortable/most-recent-first:

  • Posts — microblog (AT notes, Mastodon notes, RSS "notes")
  • Blogs — long-form (site.standard.document, blog.envio, RSS articles)
  • Images — photo posts (Pixelfed, Instagram-ish AT embeds, AP Image)
  • Videos — PeerTube, YouTube, AT native video, MP4 attachments
  • Code — commits, merge/pull requests, issues, comments, releases (Tangled, GitHub, Codeberg, local git)
  • per-source drilldown inside each tab (filter to one author / one repo).
  • p opens the publisher (pre-selects tab as content kind), g global feed, 1..6 switch tabs, / search, e read item, i toggle kitty/sixel render.

4. Subscription sources (all open/standard protocols) #

source read protocol fetch lib notes
Bluesky / AT atproto (XRPC, firehose/jetstream optional) indigo notes, embeds, video
long-form blogs site.standard.document (+ blog.envio) indigo + lexicon canonical records
Mastodon/Pixelfed ActivityPub outbox (public) or RSS gofeed + http no signing needed for public read
PeerTube RSS + AP Actor gofeed + http channels have RSS; AP for rich
YouTube RSS (channel_id feed) gofeed every channel has RSS
Generic blogs RSS / Atom / JSON Feed gofeed covers most of "custom blogs"
GitHub releases/commits/PR RSS + REST/GraphQL gofeed + http RSS first, API for detail
Codeberg (Gitea) RSS/Atom (commits, PRs, issues) gofeed Gitea-native RSS
Tangled git (SSH) + ATProto records go-git / _knot.py port reuse ES256K/JWT
git (local/remote) git log go-git / git CLI any repo, no API

AP read path: resolve handle via WebFinger → actor JSON → outbox → Items. Public outboxes are plain GET. (Only follow/push delivery needs an AP actor + HTTP signatures; dipper reads by polling, so that heavy machinery stays optional.)


5. Publishing — direct to each platform, capability-gated by local creds #

Design rule (locked): every credential lives locally in the CLI (~/.config/dipper/secrets.env, 0600, gitignored). dipper publishes directly to each platform it holds creds for, via that platform's own API. A platform is publishable iff its creds are present — the publish menu only offers targets you have creds for. No broker/bridge sits in the publish path; records land where the creds point (your PDS, your forge, your PeerTube, your Mastodon/Pixelfed). publish_log records every receipt and every publish is undoable.

Targets to direct-publish (creds present → target offered) #

platform publish API creds needed
Bluesky / AT XRPC com.atproto.repo.createRecord PDS app-password or OAuth (lance.dev)
PeerTube POST /api/v1/videos + actor PeerTube account token
Mastodon POST /api/v1/statuses Mastodon account token
Pixelfed Mastodon-compat POST /api/v1/media + statuses Pixelfed token
Tangled git push + ATProto records (ES256K/JWT) your account key (_knot.py port)
GitHub git push (and PR API) forge token / SSH key
Codeberg (Gitea) git push + Gitea API token / SSH key
git remote git push SSH key / token

Per-kind, per-target representation (max reach) #

kind AT (PDS) PeerTube Mastodon/Pixelfed forge/git
post app.bsky.feed.post — Note (full text) —
blog site.standard.document + native teaser post — Article (content + link) —
image app.bsky.embed.images (thumbnail) media attach + note —
video com.atproto.video.createVideo native video object media attach (mp4) —
commit/MR announce post — announce note git push / PR API

Cross-protocol reach for one publish #

dipper publish fans out to all targets whose creds are present and for which the kind is representable (table above). One blog post becomes: canonical site.standard.document on your PDS + a native teaser feed.post (so every AT follower sees it in-feed regardless of client) + an AP Article on your own AP home (GoToSocial, below). The dual-emit rule still applies inside AT (canonical record + teaser). AP reach is native to the AP home (its actor federates to all followers on their own instances), so no bridge is required in the publish path. AP read still uses public outbox/RSS (§4).

AP publish home = your own headless GoToSocial on lance.dev (DECIDED) #

AP publishing now has exactly one target: the self-hosted headless GoToSocial that lives on lance.dev, the AP mirror of the ATCR hold. It is the AP equivalent of "post to your own PDS" — one actor, one credential, federates out to every fediverse instance, zero third-party accounts needed.

  • Canonical AP handle: @lance@lance.dev (discovery at apex lance.dev, actor served from ap.lance.dev). Mirrors the AT handle/identity.
  • dipper logs into GTS with the lance account (OAuth password grant or a created app token) and uses the Mastodon-compatible /api/v1/... REST (POST /statuses, media via POST /media, etc.) to publish. GTS is Mastodon- API-compatible, so a single generic Mastodon Connector covers both GTS and, if ever wanted, a real Mastodon/Pixelfed account.
  • Long-form: AP Article + Note teaser, mirroring the AT dual-emit.
  • HTTP signatures: GTS signs all outgoing AP requests itself (secure-mode / AUTHORIZED_FETCH). dipper never signs anything — it talks plain Mastodon REST over localhost/TLS. Do NOT hand-roll AP signing here; that is GTS's job.
  • The full actor JSON on GTS is signed-fetch-only by design (returns 401 to a plain GET); this is correct fediverse "secure mode" and is irrelevant to dipper, which authenticates as the account. Do not "fix" it.

The earlier "dipper-as-its-own-AP-actor" idea (self-signed Create/Article over HTTP signatures + hosted inbox) is now replaced by this GTS home server and stays deferred/removed as a primary path.


6. MCP surface (identical core) #

dipper mcp runs the same store/connectors as a stdio MCP server (official go-sdk or mcp-go). Tools:

  • dipper_list_sources, dipper_add_source, dipper_sync
  • dipper_feed {tab, source, since, query, limit} → normalized Items
  • dipper_get_item {id} (full body + media refs)
  • dipper_publish {kind, protocol[], ...} → receipts (URIs)
  • dipper_search {query, kind} So any MCP-capable agent reads the whole perch and publishes back out, using the exact code the TUI drives. One core, three surfaces.

7. Graphics (kitty / sixel) #

Bounded graphics backend, no external dep beyond a decoder (github.com/disim/... / std image + go-sixel for sixel encode):

  1. Kitty graphics protocol (primary): inline truecolor PNG, best fidelity, used by modern terminals (kitty, ghostty, WezTerm, foot, Konsole).
  2. Sixel (fallback): encode → emit (mattn/go-sixel). xterm/mlterm/st.
  3. Unicode blocks / ascii (last resort). Detect capability once at startup; dipper chooses. Renders images inline in the reader + a preview in the composer. This is the component Rust would have shipped for free; hand-rolling it is the accepted Go cost and it stays isolated behind internal/graphics.

8. Config / auth / storage layout #

Credential model: local-only, one entry per platform, capability-gated. A platform becomes a publish target iff its creds are present; readers (public feeds) need no creds. dipper never calls a third-party broker.

~/.config/dipper/config.toml      sources to subscribe, display prefs, default targets
~/.config/dipper/secrets.env      0600 — per-platform creds (gitignored):
    DIPPER_AT_APP_PASSWORD=...        # PDS lance.dev (publish AT)
    # AP home = your own headless GoToSocial (default + primary AP target).
    DIPPER_AP_URL=https://lance.dev   # GTS API base (or http://127.0.0.1:8181 locally)
    DIPPER_AP_USER=lance              # -> @lance@lance.dev
    DIPPER_AP_PASSWORD=...            # OAuth password grant; or mint an app token
    # Optional extra AP accounts (same generic Mastodon-compatible Connector):
    DIPPER_MASTODON_URL=...  DIPPER_MASTODON_TOKEN=...
    DIPPER_PIXELFED_URL=...  DIPPER_PIXELFED_TOKEN=...
    DIPPER_PEERTUBE_URL=...  DIPPER_PEERTUBE_TOKEN=...
    DIPPER_GITHUB_TOKEN=...  DIPPER_CODEBERG_TOKEN=...
    DIPPER_TANGLED_SIGNING_KEY=...    # ES256K account key (AT records via forge)
~/.local/share/dipper/dipper.db     normalized items + cursors + publish log
~/.local/share/dipper/media/      cached images/video posters

On the server these AP creds already exist at ~/.config/dipper.env (0600, from the oci-gts deploy: DIPPER_GTS_*); reconcile names with the table above when the secrets layer is built. secrets.env can live wherever you prefer (a secrets_file config key); plaintext local 0600 matches the lancedev ~/.secrets convention already in use (see the ssh-keys note in ~/.bashrc). AT auth reuses the ES256K key + JWT minting proven in _knot.py (ported to Go). Optional keyring backend later. All state under ~ → portable, backup-restorable, sudoless.


9. Repo layout (Go module git.lance.dev/dipper, or local path) #

Sources/dipper/
  cmd/dipper/main.go            cobra: dipper | dipper mcp | dipper sync | dipper publish
  internal/core/               Item, store, connector iface, sync, publish engine
  internal/sources/{at,ap,rss,peertube,youtube,github,codeberg,tangled,git}/
  internal/publish/{at,mastodon,pixelfed,peertube,github,codeberg,tangled,git}/
                               each gated on its creds being present (capability)
  internal/graphics/           kitty, sixel, fallback, capability detect
  internal/mcp/                MCP tool registration over core
  internal/tui/                bubbletea app, tabs, reader, composer, glamour
  internal/config/             toml + secrets + credential store

10. Phased build order (each phase ships something usable) #

  1. Skeleton + store + TUI tabs — dipper runs, empty tabs, config, SQLite.
  2. RSS/Atom/JSON connector + global feed + reader (fastest visible win: blogs
    • YouTube + PeerTube-via-RSS all come free here).
  3. atproto connector (indigo) — Bluesky posts/images/video, standard.site blogs. Reuse ES256K/JWT.
  4. ActivityPub reader — public outbox/WebFinger for Mastodon/Pixelfed.
  5. Code connectors — git / GitHub / Codeberg / Tangled → commit/MR/issue items.
  6. Publish engine — capability-gated fan-out: post/blog/image/video → AT (+ teaser) direct to PDS; Article/Note → Mastodon + Pixelfed via their tokens; video → PeerTube via its token. Each target only offered when its creds exist.
  7. MCP server over the same core.
  8. Graphics backend — kitty then sixel; inline image render + composer preview.
  9. sync daemon + cursors + dedup hardening.
  10. polish: search, filters per tab, keyboard map, packaging (static build, AUR-ish).

11. Locked vs open decisions #

Locked: local-only creds, publish direct to each platform (no bridge); Go + charmbracelet + official/mcp-go MCP; standard.site for long-form + native teaser; kitty-primary/sixel-fallback graphics.

Still to confirm before phase 2:

  • Store engine: libsql (matches the lancedev stack you run) vs plain modernc.org/sqlite (zero-CGO, simplest static binary)? Leaning modernc for portability unless you want libsql sync.
  • AP read scope: Mastodon/Pixelfed/PeerTube via RSS only (trivial, but RSS truncates + misses threads) vs AP outbox JSON (full items, needs WebFinger + a signed GET when an instance runs authorized-fetch)? Suggest RSS first, outbox in a later pass.
  • Build target now: confirm start in ~/Sources/dipper (local Go build) — sync daemon later as a systemd user unit on lance.dev is fine to defer.