« Documentation

WIP. Last update: 0.6.6

Architecture

Made in Switzerland  in personal time, at private expense.
Donate (external site, opens in a new tab) to help cover development costs, or support a charity (external site, opens in a new tab).

This page gives the picture: what Sleevesight is made of, what talks to what, and what leaves the phone for which service. The detail, with the reasons for each choice, is in the design documents: design/architecture.md for how the app is built, and design/design.md for what it does and why. The libraries it ships are on the dependencies page; what it sends, in the words that bind it, is in the privacy policy.

In short

Sleevesight is an Android app with no server of its own. It reads what your music player is playing from the phone’s media session, looks the track up at the music sources you switch on, has the AI service you choose write a short insight from what the sources found, and checks every citation in code once the reply is complete. Every request goes from the phone straight to the service it is for, with your own API key where the service needs one. Sleevesight has no accounts and no ads, and no telemetry, crash reporting or analytics of its own; if any is added, it will never carry your data. Nothing you play, and nothing the app sends on its own, reaches its developer: only a report you send from your own mail app does.

The parts

flowchart LR
  Player["Music player"] -- "media session" --> Session["Session layer"]
  Session --> Norm["Normalizer"]
  Norm --> Res["Entity resolution"]
  Norm --> Adapters["Source adapters"]
  Res -- "resolved ids, to verify matches" --> Adapters
  Adapters --> Ev["Evidence"]
  Ev --> Synth["Synthesis"]
  Synth --> Ground["Grounding check"]
  Ground --> UI["User interface"]
  Ev --> UI
  Session --> UI
  Session --> History[("History")]
  Adapters <--> Caches[("Caches")]
  Synth <--> Caches
  Keys[("Settings and keys")] --> Synth
  Keys --> Adapters

The session layer

Android lists other apps’ media sessions, where a music player says what it is playing, only to an app with notification access. The session layer holds that access, and reads the media session of each player you follow: which player it is; the title, artists, album and its year, length and cover; whether it is playing, and how far in; and the queue up next. It ignores the notifications themselves (and on Android 12 and later tells Android not to deliver any notification categories to it) and never touches the audio. A call’s session, from the phone’s own call apps or one Android marks as a voice call, is dropped before anything of it is read. An ad the player marks as one, such as Spotify Free’s, is not taken for a song: nothing is looked up or written for it. It settles each player’s reports into plays: a report continues the play or starts a new one, decided by the player, a media id where both reports have one, the title and the artists, and the album after the first second of a play; the queue item only times a change. The session layer also tells a skip from a track that ended on its own, which decides whether an insight is written under Reactive set to On track skip (auto). Playing, pausing and skipping from the app come in Phase 2; today a tap on the player’s name opens the player.

The pipeline

The pipeline turns a track into an insight. It is plain Kotlin with no Android in it, so the same code also runs on a computer in the project’s command-line tool, against recorded test data.

The model never decides what is true: resolution, matching, the choice of evidence and the citation check are all deterministic code, tested against fixtures.

The stores

Everything the app keeps is on the phone, and none of it is part of Android’s backup or of a transfer to a new phone.

The user interface

One Android activity in Jetpack Compose: the first-run screen, the home screen with the playing track (its cover flips to the album’s tracklist), its dates, genres and lyrics, the insight, its citations, the song’s, the artist’s and the album’s insights and Sources (and, with nothing playing, your players and a guide to the screen), the settings, the credits and the diagnostics. A link from a source opens only if it is a web address (http or https). Read aloud hands an insight’s text to the phone’s own text-to-speech engine, through Android; the app ships no speech engine of its own. Its colours come from the album art, computed on the phone. Its font is bundled, so nothing is fetched to show text. API keys can be pasted, scanned from a QR code with the camera (Load keys), or typed on a computer (Type on a computer), over Bluetooth.

The site’s pages

The website, served by GitHub Pages, has three pages that work with the app:

The pages with diagrams, this one among them, load the diagram script, Mermaid, from jsDelivr.

What leaves the phone

flowchart LR
  subgraph Phone
    App["Sleevesight"]
  end
  App -- "title and artists; the album's identifiers" --> MB["MusicBrainz"]
  App -- "song, artist, album and genre titles; Wikidata: identifiers only" --> WP["Wikipedia and Wikidata"]
  App -- "artists' names; the title and album, for genre labels and the album's insight; your key" --> LFM["Last.fm"]
  App -- "title, first artist, album, length" --> LRC["LRCLIB"]
  App -- "title, artists, album, the film or show, searches; your key" --> Exa["Exa web search"]
  App -- "title, artists, album, evidence, your key" --> AI["Anthropic, OpenAI or Google"]
  App -- "a request for the image" --> Art["The cover's server"]
  App -. "an insight's text, when read aloud" .-> TTS["The phone's text-to-speech engine"]
  App -. "a report, only if you send it from your mail app" .-> Dev["The developer, by email"]
  App -. "a Bluetooth advertisement, while you type a key on a computer" .-> Near["Devices nearby"]
  Play["Google Play"] -- "the app and its updates" --> App

Requests go straight from the phone to each service, over HTTPS; the app refuses any unencrypted connection, on every Android version it runs on. None passes through a server of Sleevesight’s, since there is none. Each service sees the phone’s IP address, as every service you connect to does, and every request names the app and its version in its User-Agent, with the project’s address, as MusicBrainz asks.

Service When What it receives
MusicBrainz Switched on (it is by default) The title and artists of the playing track, cleaned of tags such as “2006 Remaster”. While Proactive is on, as it is by default, the title and artists of the next track in the player’s queue, before it plays. While the album’s insight is unfolded or open on its page, and not before, the album’s identifiers (its release group, and a release Last.fm names). When you tap the cover to see the album’s tracklist, the album’s identifiers (its release group, and the release shown); when you open Dates, its release group.
Wikipedia and Wikidata Wikipedia switched on Wikipedia: the title and artists, to find their articles; for a track sung in a language other than English, as Search in the track’s language allows, Wikipedia in that language also gets the title, artists and film or album, written in that language where Wikidata has them. Wikidata: only identifiers, from MusicBrainz or Wikipedia, never a name. When you open a genre’s panel, Wikidata gets the genre’s MusicBrainz identifier and Wikipedia the title of the genre’s article, to show what the genre is; nothing about the track. While the album’s insight is unfolded or open on its page, and not before, Wikipedia gets the title of the album’s article, found by the album’s name with the first artist’s when MusicBrainz names no release group, and Wikidata the album’s identifiers.
Last.fm Switched on, with your key The artists’ names, and your Last.fm key. For the genre labels, while Show genres is on, its tags for the track and for the album are asked for by the first artist’s name with the title, and with the album name. While the album’s insight is unfolded or open on its page, the album’s name with the first artist’s.
LRCLIB Switched on (it is by default), when one of the track’s genres is Instrumental or MusicBrainz credits the song to composers alone The title, the first artist, the album and the track’s length in seconds, once per track, to find whether the song has lyrics. With no length from the player, it is not asked. No key.
Exa (web search) Switched on, with your key The title and artists, the film or show a title says it is from, and your Exa key; for a track sung in a language other than English, as Search in the track’s language allows, the title, artists and film or album, written in that language where Wikidata has them. When the album’s insight is written, a search for the album’s name with the first artist’s. With AI web search on, the searches of each Ask AI question, Find the lyrics and Explain the song, of each Why is this …? and instrumental check that searches the web, and of the artist’s insight when the other sources have nothing on the artist, or the song’s when they only list it: with Once, built by the app from the title, the artists and what is asked (such as the genre’s name, song genre, or words such as instrumental and lyrics), or from the artist’s name alone; with Up to 3 times, searches your AI service writes (with Google’s service, the one the app builds, as with Once), which never hold MusicBrainz’s genre tags.
The AI service you choose: Anthropic, OpenAI or Google Show insights on, a service switched on, with your key The title, artists and album, and what the sources found, for the playing track only; each insight (the key insight, and the song’s, the artist’s and the album’s, each a request of its own), each Why is this …? you tap in a genre’s panel (with the genre’s name; for a genre only MusicBrainz’s tags give, first a question for the track’s genres, naming none), each instrumental check, each Ask AI (for genres, with the app’s list of genres), Find the lyrics and Explain the song, a request of its own, with no conversation kept. With AI web search on, also the web pages Exa found for the question: their addresses, titles and short passages. Your key for that service, and the model you chose. The app also asks the service for its list of models, with your key and nothing about your listening: at start, and when you open the model choice.
The server a cover’s web address names A player gives the cover only as an https:// web address (a plain http:// one is not fetched) A request for that image. The address itself may identify the album or episode. An address whose host is an IP address, localhost or a .local name is not fetched, so a player cannot name a device on the phone’s network directly; a public name that leads to a local address, or redirects to one, is not caught.
A lyrics site (Genius, Musixmatch, or another MusicBrainz links to) You tap a link in the home screen’s Lyrics panel Your browser opens the page; a search link sends Genius the title and artist. The app itself sends nothing for the links: they come with MusicBrainz’s answer, the track’s web search results, or the answer of Find the lyrics.
The phone’s text-to-speech engine You tap Read aloud, or Read new insights aloud is on The insight’s text (or a genre’s Why is this …? answer), with the track’s title and artists if Read the track line first is on. The engine is the one chosen in Android’s settings: one that speaks on the phone sends nothing, while one with network voices, such as Google’s, sends the text to its server to be spoken, under its own policy.
The developer, at support@sleevesight.app You tap Report a problem on an insight and send the report from your own mail app The reason and your note; the track as the player reported it (title, artists, album, length) and its MusicBrainz ids; the insight and the evidence lines it was written from (for an insight kept from before, every evidence line of the track), with their sources and addresses; the prompt version, AI service, model and effort. You see all of it before your mail app opens; your mail app handles it from then on as any message you write (some keep a draft in your mail account), and sends it from your address only if you do. Never your keys, the history or the settings.
The developer, at support@sleevesight.app In developer mode with Report button at Show or Auto (by default only in the test build for Play’s testing tracks), you tap the button on the home screen, then Report, and send the tester’s report from your own mail app When you tapped, with the time zone, and the app’s version and build; the settings, never your keys; what the player reports and what the app made of it (the sources’ findings, the evidence, the insight and its citation check, the AI service and model); the diagnostics’ events and what skip detection has learned; the latest track changes, with the tracks’ titles and times, only if you add them. You see all of it, and can edit or leave out each part, before your mail app opens; it sends it from your address only if you do.
Devices nearby, over Bluetooth While a key’s dialog types on a computer (Type on a computer) The phone’s advertisement, which any device nearby that scans for Bluetooth can see: a random identifier for the session, and the phone’s Bluetooth name only with Share phone’s name with Type on a computer on. The typed text comes from the computer, encrypted; the phone sends back only Bluetooth’s acknowledgements.
Google Play Installing and updating the app Google handles the installation under its own policy; it gives the developer aggregated install statistics and, from phones that share usage and diagnostics with Google, crash reports that name no one. The app holds no Google Play library.

The album name goes to the AI service; among the sources, to Last.fm, LRCLIB and Exa, and to Wikipedia only for the album’s insight or a track looked up in its language. The track’s length goes only to LRCLIB. Each API key goes only to the service it belongs to. By default, lookups and writing happen only while Sleevesight is on screen; with Look up in the background on, also while it is not. A Spotify account, once the app offers connecting one, would add requests to Spotify’s Web API with your own token; no build offers it yet. Nothing else leaves the phone, except a diagnostics export you make yourself, a report you hand to your mail app, an insight read aloud by an engine that speaks through its server, and, while you type a key on a computer, the phone’s Bluetooth advertisement, which devices nearby can see (the session’s service, and the phone’s name only with Share phone’s name with Type on a computer on).

Enforced, not promised

The claims above are not only a policy. The build checks them, and fails when one breaks; CI runs the checks on every change.

What the checks do not cover is held by review instead: that :wiring makes no request of its own, and what each adapter puts into its requests. The code is open source, under the GPL 3, on GitHub, for anyone to check.

The modules

flowchart TD
  app[":app (Android)"] --> core
  app --> store
  app --> wiring
  cli[":cli (computer)"] --> core
  cli --> store
  cli --> wiring
  cli --> net
  wiring[":wiring"] --> core
  wiring --> sources
  wiring --> ai
  wiring --> net
  sources[":sources"] --> core
  sources --> net
  ai[":ai"] --> core
  ai --> net
  store[":store"] --> core
  net[":net"]
  core[":core"]
Module What it holds
:core The pipeline: the normalizer, resolution logic, evidence, prompts, the grounding check, the settings’ defaults. No network, no Android.
:net The one HTTP client: per-host rate limits, timeouts, retries that never send a paid request twice, and a log that redacts keys.
:sources The source adapters, LRCLIB’s client, and the fetcher for covers given as a web address.
:ai The clients of Anthropic, OpenAI and Google, small ones over :net rather than the vendors’ SDKs.
:store The caches and the history, in SQLite.
:wiring Puts the network side together and hands the app only :core types.
:app The Android app: the session layer, the user interface, settings and keys, and the diagnostics.
:cli The command-line tool that runs the pipeline over a playlist of test tracks, on a computer.

The diagram is the graph checkModuleGraph enforces: an arrow is a dependency the module may have, and a module may have no other.

« Documentation