Minimal, schemaless persistence for hand-made objects — prompts, LLM dialogs,
generation logs, Logseq blocks — stored as JSON under hyperphor://<realm>/<type>/<id>
URIs. A drawer for data, like Multitool is a drawer for functions. See design/design.md.
(require '[hyperphor.tunamelt.core :as t])
(t/configure! {:store "tunamelt.db" :realm "okc"}) ; or env TUNAMELT_DB / TUNAMELT_REALM
(t/put "hyperphor://okc/prompt/summarize" {:text "Summarize: {{doc}}"} {:mode :append-only})
(t/put "dialog" {:turns [...]}) ; generated uuid, configured realm
(t/get "hyperphor://okc/prompt/summarize")
(t/find "log" {:realm "okc" :since #inst "2026-10-01" :attrs {:ok false} :limit 20})
(t/history "hyperphor://okc/prompt/summarize")
(t/put-many [[uri obj] ...]) ; one transaction, for bulk loads
(t/delete uri)
(t/types) ; => ("dialog" "log" "prompt")
(t/types {:counts? true :realm "okc"}) ; => {"log" 12, "prompt" 3}
(t/refs uri) ; => {:parent ["hyperphor://..."] :refs [...]}
(t/referrers uri {:attr :refs}) ; backlinks: objects whose :refs hold uri
(t/search "heidegger tech" {:type "block" :limit 20}) ; full-text, best first, with :snippet
:mutable (default, overwrite in place) or
:append-only (each put adds a revision; history walks them). Changing mode throws.:block/uuid);
keyword and #inst values come back as strings.:since/:until on last
update), and top-level attribute equality via :attrs. Newest first.
{:tags "a"} matches {:tags ["a" "b"]}.{:tags ["a" "b"]}.nil matches objects without that attribute.get returns them, so :done, "done", an #inst and its
ISO string all match.No declared relation types: any attribute value (or array element) that is a hyperphor://
URI is a reference. refs lists an object's outgoing references; referrers finds incoming
ones across all types, optionally limited by :attr or :type, using the attribute index.
get reads the object's JSON, which is the source of truth. Every put also rebuilds
the object's rows in an attrs table (attr, v_text / v_num / v_bool): one row
per top-level scalar, or per element of a top-level array of scalars. Nested maps and
arrays of maps aren't indexed. For :append-only objects the index reflects the latest
revision. Databases created before the index existed are backfilled on open; the same
goes for the full-text index.
search is separate from find. It matches against an object's text: its top-level
string values and string array elements, but not hyperphor:// URIs. Each object has one
row in an FTS5 index, so results come one per object, ranked by bm25, each with :rank and
a :snippet that marks matches with «». By default every word in the query must match as
a word prefix: heidegger matches "Heideggerian". Matching is case-insensitive and
ignores diacritics: cafe matches "Café". There's no stemming. Pass :raw? true to use
FTS5 query syntax directly ("exact phrase", OR, NOT, NEAR); malformed raw queries
throw. :type/:realm filters apply after the text match.
| Backend | type/realm/time filters | :attrs filter | search |
|---|---|---|---|
| SQLite (JVM default) | indexed | indexed (attrs table) | FTS5 (fts table); type/realm filtered after match |
| IndexedDB (cljs default) | indexed (type/realm/updated compound indexes) | first positive attr narrows via the attrs index; remaining filters checked in memory | word-prefix lookups on a multiEntry token index, intersected; rank = minus the number of matching word occurrences (lower is better, as with bm25); :raw? unsupported |
The hyperphor.tunamelt.store/Store protocol is the extension point for other backends.
The same API, on IndexedDB, for browsers and extension service workers. Every function returns a Promise; objects are stored as the same JSON as on the JVM, so round-trip semantics match.
(require '[hyperphor.tunamelt.core :as t])
(t/configure! {:store "my-db" :realm "okc"}) ; IndexedDB database name (default "tunamelt")
(-> (t/put "hyperphor://okc/prompt/summarize" {:text "Summarize: {{doc}}"})
(.then #(t/find "prompt" {:attrs {:text "Summarize: {{doc}}"}})))
types scans every object. search supports the default word-prefix syntax only: words are
split on non-alphanumerics, lowercased, and diacritic-folded, and every word must match.
Tests run under node against fake-indexeddb: npm install && npm run test:cljs.
usage.clj: runnable tour of the JVM API (lein run -m clojure.main usage.clj).main. Build locally with bin/build-docs.sh.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |