Skip to main content

sonagram

Ask your AI assistant for a playlist from your own music collection — and get a file any music app can play.

sonagram listens to every track you own (tempo, energy, mood, key, how songs feel), organizes what it learns into a fast, searchable map of your library, and lets an AI agent translate your sentence into a typed request. Sonagram's deterministic library engine—not the agent—then selects, orders, audits, and explains the playlist:

"Make me a deep-focus work playlist." "A party mix for Saturday that builds." "Songs like Teardrop, but calmer."

Your music files are never modified, moved, or uploaded — everything happens on your machine.

For AI agents

You are an AI agent and a user asked you to work with their music library — start here:

  1. Install — pip install sonagram. Prebuilt wheels cover macOS (Apple Silicon + Intel), Linux x86_64, and Windows x86_64 on Python ≥ 3.9 — no toolchain needed. Only on other platforms does pip fall back to the sdist, which compiles the native core and needs a Rust toolchain (rustup).
  2. Install the skill — sonagram skill install. This writes the sonagram-playlist skill to ~/.claude/skills/ (pass --dir <skills_root> for a non-default skills location).
  3. Read the installed SKILL.md and follow it now. It covers library detection, scanning, the optional Last.fm walkthrough, and playlist delivery. A skill only auto-loads at the next session start, so act on it immediately in this one.

Use it through your agent (no code)

This is the main way to use sonagram. One-time setup:

  1. Install it — pip install sonagram. That's it on Mac, Windows, and regular Linux — prebuilt packages, nothing to compile. (On unusual platforms pip builds from source, which needs the free Rust toolchain — your agent can sort that out.)
  2. Point it at your music — sonagram sources add ~/Music (repeat for other folders).
  3. Give your agent the skill — sonagram skill install.

That's it. From now on, just ask:

  • "make me a deep-focus work playlist"
  • "a party mix for Saturday that builds"
  • "songs like Teardrop but calmer"
  • "which songs do I have multiple versions of? pair them"
  • "what's even in my library?"

The first request analyzes your whole collection (about an hour for ~10,000 songs — your agent will tell you and can let it run in the background). Every request after that takes seconds: sonagram notices what changed, re-reads only that, and keeps the map current — including songs you've added or deleted.

Each playlist is saved with its name, your original request, and the full track list, so you can always ask for it again later (sonagram playlists). The .m3u8 files point straight at your own music files and open in any player.

Optional: better picks with Last.fm. A free Last.fm API key adds richer genre info, song popularity, and "fans also like" connections. Your agent can walk you through getting one — just ask.

CLI (scriptable)

pip install sonagram also gives you the standalone sonagram command (the same shared code path the agent uses, so the two can't drift). Once a source is registered, commands need no path arguments:

sonagram sources add ~/Music     # register a library folder (repeatable)
sonagram status                  # is everything up to date? (exit 0/1/2)
sonagram scan                    # analyze new/changed files → local cache
sonagram enrich                  # optional: fold in Last.fm metadata (needs a key)
sonagram build                   # merge all sources → the central graph
sonagram profile --format json   # curation-relevant coverage/distributions
sonagram curate --preset focus --tracks 25 \
    --name "Deep Focus" --description "a calm work playlist" --format json
sonagram playlists               # list stored playlists (newest first)
sonagram mcp install             # native kglite manifest + revealed music skills

sonagram config shows where everything lives (defaults under ~/.sonagram/) and whether a Last.fm key is set up. Explicit-path forms (sonagram scan ~/Music, sonagram status ~/Music --format json, …) still work for scripting a single library without touching the config, and sonagram playlist ... --copy-to <dir> produces a portable folder — the tracks copied next to the playlist file, ready for a USB stick or another device.

Everything is incremental: a rescan of an unchanged library analyzes nothing and finishes in well under a second.

For building your own agents / integrations

Install Sonagram's safe kglite manifest/revealed skills, then use the absolute launch command it prints—or drive the same library contract from Python:

sonagram mcp install
# RUN: '/absolute/path/sonagram-mcp-server' --graph '/.../music.kgl'

The thin Sonagram frontend embeds KGLite 0.17.5's server and registers typed profile/policy/curate/audit/explain/store tools against its live graph. KGLite still owns MCP, Cypher, graph lifecycle, and generic tools; Sonagram owns only the music-domain handlers.

MCP query output is bounded by default. Agents should discover the response controls through tools/list and copy the preview's advertised expansion action to inspect retained evidence. Query LIMIT controls executed rows; response budgeting controls only how the completed result is presented.

import sonagram
sonagram.scan("~/Music")
g = sonagram.build("~/Music", out_path="music.kgl")   # a live kglite graph
brief = {"preset": "focus", "target_tracks": 25,
         "target_duration_sec": None, "seed_ids": [],
         "seed_role": "pinned", "unsupported_intents": []}
result = sonagram.curate_playlist("music.kgl", brief)
assert result["exportable"] and result["audit"]["passed"]

Agents get a full manual (AGENT-GUIDE.md: the schema, a query cookbook, and a typed curation contract) plus live-gated kglite skills. Both route final selection/order/audit through the library rather than agent-authored heuristics.

How it works (the short version)

  • sonara does the listening: tempo, key, energy, mood, loudness, structure, and an audio "fingerprint of feel" for every track.
  • kglite stores the map: a graph database with search, similarity, and an agent-friendly query interface.
  • sonagram is the part in between: it decides what the map contains — every song with all its signals, connected to artists, genres, decades, moods, detected styles, and its 10 most similar tracks — and keeps the map exactly reproducible, byte for byte, no matter how often you rescan.

Full documentation (CLI reference, Python API, the graph's schema, and the engineering details) lives on Read the Docs — see docs/.

License: MIT

Release files for sonagram 0.2.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sonagram 0.2.20
File Size Uploaded
sonagram-0.2.20.tar.gz 941.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for sonagram 0.2.20
File
sonagram-0.2.20-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
sonagram-0.2.20-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
sonagram-0.2.20-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
sonagram-0.2.20-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 47.2 MB

Release files / sonagram-0.2.20.tar.gz

Download URL sonagram-0.2.20.tar.gz
Size 941.2 kB
Tags Source
SHA-256 checksum
How to use checksums
24f7d15dcd1ac43bb83f17c8b1c211119fe45ad69eaf2e8892c996c43635e793
BLAKE2b-256 checksum
How to use checksums
dc2cf2aac34f78914efac7a208ba63a12dd83cbabef1bed260ea65c6d2068739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / sonagram-0.2.20-cp39-abi3-win_amd64.whl

Download URL sonagram-0.2.20-cp39-abi3-win_amd64.whl
Size 11.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c4cc073619f9e98e37f0636ea0dfb9070bf73208181537e3b34bad9e3ffb6ea4
BLAKE2b-256 checksum
How to use checksums
bc733d755a652f3cd0b21ef1763c54c1be1c7cb9e7eccedbb0e16eb1cf75202c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / sonagram-0.2.20-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL sonagram-0.2.20-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 12.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9f680f422f75f67fca56db03b461cc2a0cbd4fc4c54c5a06e0b07d92de8eafd0
BLAKE2b-256 checksum
How to use checksums
962ef065baa54945d0b22064d5e4826d384c2b0f690971550a279df8897c6ad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / sonagram-0.2.20-cp39-abi3-macosx_11_0_arm64.whl

Download URL sonagram-0.2.20-cp39-abi3-macosx_11_0_arm64.whl
Size 10.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4ab37f999335ef1dd42882aae12a7599eca3365bc120b284ec81d6517c06cb12
BLAKE2b-256 checksum
How to use checksums
ace13994804db6dc1f662ddc592a41851c2d60a804e659eb8833968060dd7a58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / sonagram-0.2.20-cp39-abi3-macosx_10_12_x86_64.whl

Download URL sonagram-0.2.20-cp39-abi3-macosx_10_12_x86_64.whl
Size 11.7 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c90aead5d29bd9d11b4f962b4631c3eabc8cd9a84fa2c871b240f57bdb648c38
BLAKE2b-256 checksum
How to use checksums
e0cb3f6310c314006dd118329f213e5e407d61e2a35106399dfe98bd9eb94314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.24

5 release files

0.2.23

5 release files

0.2.22

5 release files

0.2.21

5 release files

This release

0.2.20 This release

5 release files

0.2.19

5 release files

0.2.18

5 release files

0.2.13

5 release files

0.2.12

5 release files

0.2.11

5 release files

0.2.10

5 release files

0.2.9

5 release files

0.2.8

5 release files

0.2.7

5 release files

0.2.6

5 release files

0.2.5

5 release files

0.2.4

5 release files

0.2.3

5 release files

0.2.2

5 release files

0.2.1

5 release files

0.2.0

5 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page