Skip to content

v0.16.0

Choose a tag to compare

@plur9 plur9 released this 28 Jul 19:57
· 1728 commits to main since this release

The big memory update.

  • BREAKING: async writes for shared memory
  • npx @plur-ai/migrate adds awaits
  • Postgres option: scale out
  • scope allow-list, BM25 in SQL
  • cross-process write safety
  • unified recall surface — same engine local and server-side

One engine, two deployments: the same memory engine now spans a laptop YAML
file and a shared Postgres server. That is why the write path went async —
memory that several agents and processes share safely cannot pretend it is a
synchronous local file. Postgres is an option for stores that outgrow local
files, not a new requirement: YAML stays the default and the source of truth
everywhere else.

BREAKING — the write path is asynchronous

Plur's store interface and 23 public methods now return promises (#728):
compact, episodeToEngram, getById, ingest, inject, installPack,
learn, list, listPinned, listStores, outboxCount, purgeTensions,
recall, receipt, recordTensions, reindex, rerankerEvalStatus,
resolveTension, saveMetaEngrams, setPinned, status, sync,
updateEngram.

learnRouted, learnBatch, recallHybrid, injectHybrid, feedback,
forget and flushOutbox were ALREADY async before 0.16 and are unchanged
here — an earlier draft of this section listed them as newly promise-returning,
which would have sent you auditing call sites that never moved.

npx @plur-ai/migrate still reports un-awaited calls to learnRouted,
learnBatch, feedback, forget and flushOutbox, because such a call was a
bug before this release too. It does NOT report recallHybrid or
injectHybrid — those are embedding-backed retrieval that callers have always
awaited, so they are out of the tool's scope.

Every out-of-tree consumer must add await. The failure mode is quiet: a
call whose result is used without awaiting yields a Promise, and most
assertions and property reads on a Promise succeed rather than throw, so code
appears to work while operating on nothing. {...plur.status()} becomes {}.
for (const e of plur.recall(q)) throws, but plur.recall(q).length is simply
undefined. TypeScript catches all of it; JavaScript consumers will not.

capture() and timeline() stay synchronous — they are backed by
episodes.yaml, not the engram primary store. So do suggestScope,
dismissScope, reofferScopes, CapabilityCanary.warnings and
listImportSources: an automated pass made them async during the flip even
though they do no async work, and they were reverted rather than shipped as
breaking changes that bought nothing.

Why: a network-backed store cannot satisfy a synchronous contract (there is no
synchronous Postgres client for Node, and manufacturing one trades a documented
limitation for an undocumented hazard). The sync interface was a hard ceiling on
running core anywhere except one local process. See ADR-0003 and ADR-0004.

PrimaryStore and AsyncPrimaryStore have collapsed into one interface;
AsyncPrimaryStore remains as a deprecated alias so existing imports resolve.

StorageAdapter — a public export — gains two required members (role,
vectorIndex) and demotes syncFromYaml() / reindex() to optional. An
out-of-tree implementation of that interface will not compile until updated;
DERIVED_INDEX_DEFAULTS is exported to make that a two-line change for an
adapter that has the historical behaviour (a derived index over YAML, answering
searchVector exactly). Adapters that are approximate should declare that
rather than take the default — a wrong vectorIndex is worse than none,
because it is a claim a caller may act on.

Added

  • MCP Toplist rank badge (#748) in the README.

  • Packs install from a URL (#746): plur packs install <url> and
    plur packs preview <url> fetch a pack over HTTP instead of requiring a local
    directory, so a pack can be shared by link. Preview still runs the security
    scan before anything is written, and the same scan gates install.

  • The engram schema tolerates an unknown commitment value (#744): parsing
    passes through values it does not recognise rather than rejecting the engram,
    so a store written by a newer or differently-configured deployment stays
    readable instead of failing the whole load.

  • @plur-ai/mcp exposes a side-effect-free ./tools subpath (#714, #717):
    import { getToolDefinitions } from '@plur-ai/mcp/tools' yields the tool
    definitions without starting a server or touching stdio, so another server can
    host PLUR's tools inside its own process.

  • npx @plur-ai/migrate — finds the un-awaited calls this release creates, and fixes the unambiguous ones. Reports by default; --write applies. It refuses to rewrite the three cases where inserting await changes program meaning rather than just adding a wait (inside a Promise combinator array, a concise arrow body, a result consumed across lines) and lists them for a human instead. Exit code 2 when anything needs attention, so it composes in CI. Every hazard it guards is one the codemods that migrated PLUR itself actually hit.

  • Postgres as a primary store (ADR-0005) (#720). new Plur({ store: new PostgresAdapter({ connectionString }) }) runs the engine directly against server Postgres — the same engine, a different deployment. pgvector for vectors, exact or HNSW with the recall target declared rather than implied.

    Vectors on this tier are not populated by the engine. upsertEmbedding
    and searchVector are implemented and work, but core's only caller of
    upsertEmbedding runs for the PGLite derived index, never for a primary
    store — so engram_embeddings stays empty unless your deployment writes to
    it, and semantic recall falls back to loading engrams and scoring in memory.
    Configuring vectorIndex: 'hnsw' now logs a warning saying so rather than
    quietly indexing an empty table. Wiring the engine to fill it is follow-up
    work: the existing auto-embed pass loads the whole corpus and probes each id
    on every write, which at the 50,000-engram threshold that selects this tier
    would cost more than the gap it closes.

  • Cross-process write safety (ADR-0004) (#719). PrimaryStore.withExclusiveAccess?() — the store decides how it is serialized, because the store is what knows what it shares. PostgresAdapter takes a session-scoped advisory lock; a local-file store keeps its file lock. Without this, two processes over one database silently overwrote each other, and a read-only recall() on one could delete an engram another had just committed (recall updates activation, so it is a whole-corpus write).

  • Permitted-scope allow-list pushed into the query (#715, #739, #743) — scopes on RecallOptions and now InjectOptions. An AUTHORIZATION filter, distinct from the scope visibility filter: absent = unrestricted, [] = matches nothing, non-empty = exact membership with no hierarchy expansion and no personal-family pass-through. inject() had no authorization filter at all before this, which for a multi-tenant caller meant every principal's personal engrams reached every other principal's context.

  • BM25 narrowing pushed into Postgres (#711, #732, #743) via pg_trgm, with corpus-wide statistics (CorpusStats: N, per-term df, avgDocLength) supplied by the store so narrowing cannot change the ranking. Tokens are computed in TypeScript at write time by the same ftsTokenize the scorer uses, so there is no second tokenizer free to drift.

Fixed

  • Pre-release audit fixes (#747): concurrent Postgres schema init, the migrate
    tool's combinator/paren/template/optional-chaining scanning, setPinned's
    fabricated remote return, the release smoke's authorization checks and its CI
    wiring, plus lean-tool/storage/ADR documentation drift.
  • Independent pre-release audit fixes (#752, #755): the migrate tool's ASI
    hazard (a line-leading (await ...) after an unterminated statement parses
    as a call on the previous expression — it now refuses), bracket-indexed
    receivers it silently missed, and a combinator false positive from comment
    text; recall's multi-store union is now scored with exact union corpus
    statistics instead of primary-only ones (a term absent from the primary
    corpus priced as maximally rare and buried the best match); vacuous fallback
    paths in the migrate method-list guard now hard-fail in CI; Plur's
    constructor warns when a supplied store implements exactly one of
    loadByIds/updateMany (safe via the call-site fallback, but almost
    certainly an implementation mistake); the
    PostgresAdapter.close() construction-race leak is actually documented
    (#751); release.sh gained a working-tree preflight and canary-publish
    recovery guidance; README states the Postgres-tier embeddings caveat.
  • A recall() could delete the corpus on a partially-targeted store (#749).
    loadByIds and updateMany are independently optional on PrimaryStore;
    with the targeted read present and the targeted write absent, reactivation's
    whole-file fallback replaced the corpus with the current result page —
    measured: 12 engrams in, recall(limit 3), 3 left. Both paths are now gated
    behind one capability check (the pair, or neither), and updateEngram's
    remote-store error path no longer takes down the MCP server.
  • recall() returned the wrong rows on a pushdown store (#750). Two bugs:
    secondary-store and pack engrams were appended AFTER primary results, so a
    team engram that was the single best match never appeared once the primary
    store had limit hits — they are now ranked together; and the fixed 3x
    over-fetch starved recall when residual filters (expiry, min_strength)
    rejected more than two thirds of a page — the fetch now widens and re-queries,
    bounded at three rounds (recoverable rejection ceiling 26/27 ≈ 96.3%).

Fixed

  • BM25 reverse-substring matches (#721, #724): qt.includes(t) let any document token that was a non-prefix substring of the query score a hit — deploying matched an engram about yin, postgres matched one about res. Now qt.startsWith(t), which keeps morphological prefixes (deploy → deploying) and drops the junk. Measured on a 3,930-engram store: no query loses results, and the reverse-substring matches it removes were never meaningful.
  • pg is externalized from the bundle — it is an optionalDependency, so it was being inlined into dist and the published PostgresAdapter would have thrown on first use.
  • plur learn's 5s remote-write timeout was dead code (an await inside Promise.race resolved the call before the timer was armed).
  • init-remote silently ignored --quiet and printed prose under --json.
  • MCP tool schemas silently dropped array items (#705): a union item schema was
    emitted without a usable items definition, so a client sending a well-formed
    array had elements discarded on the way in. Union item schemas are now coerced,
    and a partial drop is surfaced rather than passed through as a shorter array.
  • truncated was reported wrong when budget.max_results capped a recall
    (#725, #726): the flag was computed before the budget cap applied, so a
    truncated result set claimed to be complete and callers had no signal to page.
  • server.json version drift (#699): the MCP Registry manifest carried its
    version in two places and only one was bumped, so the published listing could
    disagree with the package. release.sh now writes both.

Changed

  • plur_recall is now the unified recall tool (#693, #702): gains a mode parameter — 'hybrid' (default, BM25 + local embeddings via RRF) or 'keyword' (BM25-only). Existing callers that pass no mode get a quality upgrade without any API change. Breaking for the lean/cursor profile: plur_recall_hybrid is no longer a top-level lean tool — plur_recall takes its slot. Agents configured against the lean profile that call plur_recall_hybrid by name will still get results (the tool remains accessible via plur_admin dispatch), but should migrate to plur_recall.
  • plur_recall_hybrid is a deprecated alias (#693): it invokes the canonical plur_recall handler with {mode:'hybrid'} and prepends a one-line deprecated notice — a real forwarder, so budget capping, episode expansion, the degraded-embeddings warning and reranker surfacing cannot drift between the two before the alias is removed. Removal target: 0.18. Accessible in both full and lean profiles (via plur_admin) to avoid breaking existing CLAUDE.md files and agent templates in the wild.

Added

  • plur init now prompts for anonymous usage statistics opt-in (#701). On interactive installs a single yes/no prompt asks "Enable anonymous usage statistics? (helps us improve PLUR — no code, no keys) [y/N]" and persists the answer to ~/.plur/telemetry.json. Non-interactive installs (CI, piped stdin, --no-prompt) write enabled:false silently — they are never opted in without explicit consent. Already-configured installs skip the prompt entirely, as do installs with an explicit PLUR_TELEMETRY env var — env wins at runtime, so no contradictory config file is written. To enable after the fact: PLUR_TELEMETRY=on env var or edit ~/.plur/telemetry.json. See docs/telemetry-design.md for what is collected (learn/recall counters only — no code, no keys, no content).