PublicTxt Aggregator

wiki forked

Part of PublicTxt Web.

A server that follows many content repos (PublicTxt and other Git-backed knowledge commons), keeps a fast in-memory index of their bookmarks, tags and pages, and commits snapshots of that index to an PublicTxt Index Repository.

The aggregator is the engine; the index repo is the durable output. Discovery keeps working from the last committed index repos even when no aggregator is running.

content repos ──git fetch──► Aggregator (followers → in-memory index) ──commit──► index repo
                                   │
                                   └── API / live feeds ──► clients

Responsibilities

  • Follow source repos: fetch on a schedule (or webhook) and detect what changed.
  • Parse changed files into index records using the spec’s Document model: paths, front matter, tags, links and bookmarks.
  • Merge records from many repos by resource_id. Shared tags emerge here.
  • Serve queries and live feeds to clients.
  • Commit snapshots in the Discovery Index format.
  • Enforce consent: opt-in, the trust list and opt-out flags.

Not its job: hosting or editing user content, or republishing full page bodies (metadata, links and tags only, unless the licence and consent allow more).

Design (current)

One process per followed repo. Failures stay local. A single writer owns the index.

PieceRoleNotes
Follower supervisorDynamicSupervisor; starts and restarts followers independentlyA broken repo only crashes its own follower
FollowerGenServer per repo; timer → git fetch → diff → reportUses call to the index (backpressure); a call timeout is an expected error → back off, don’t crash
Source adapterPer source type: PublicTxt, Agora garden, …Maps source formats into the index model
IndexGenServer owning an ETS table keyed by resource_idSingle writer; readers query ETS directly; rebuilt from the index repo on restart
CommitterOn a timer, writes a deterministic snapshot and commits it if anything changedNo diff, no commit
API / feedsPhoenix: query API, live updates, later ActivityPubAfter the core works; format-neutral JSON so any client can use it

Detail and reasoning: PublicTxt Web - Design Log.

Sources

  • PublicTxt content repos (opt-in or trust-listed)
  • Other Git-stored knowledge commons, starting with Flancian’s Agora gardens
  • Other index repos (federation: see PublicTxt Index Repository)
  • Later, possibly: service connectors (Hypothesis, Raindrop) via adapters
  • Inclusion is opt-in, or the repo appears on the trust list (already-public repos the operator vouches for).
  • The aggregator honours an opt-out flag in the source repo (format: spec/consent-and-trust.md, todo) and respects licences.
  • The trust list is published in the index repo, so others can follow the curation (CuratedCommons for repos).
  • Transitive following stops after 1–2 hops.

Constraints (to quantify)

  • Git host rate limits: use conditional fetches (git ls-remote before fetch), backoff and per-host budgets; prefer webhooks where they’re available.
  • Initial scale target: TBD (for example 1,000 repos at a 15-minute poll interval on one small VM).
  • Snapshot frequency vs index repo growth: TBD.

Open questions

  • Finalise the Discovery Index format before building the committer.
  • Opt-out flag location and semantics.
  • Canonical repo URL form (spec §13.2). It’s the repo key everywhere.
  • Multi-author community repos: authorship resolution (front matter → manifest → commit author).
  • Stack: Elixir vs .NET/F#. Decide after the Elixir spike and record it as an ADR.
  • Threat model: spam repos, trust-list poisoning, malicious Markdown.

Status

Elixir prototype spike in progress (about 5 days): supervisor, followers, ETS index, local JSON snapshot, crash test. Out of scope for now: real parsing, Phoenix, Git push and ActivityPub.