---
digest: >
  v0.39.0 is a minor release that ships CV24's first eight Delivery Stories: a library
  entry, `mirror-mind/desktop`, through which a host such as Mirror Desktop 0.3 embeds
  this core in its own Node process instead of spawning a CLI. Twenty-five calls and refusal
  classes, beside `DESKTOP_API_VERSION`, cover a
  home's migration state, Conversations, sidebar reads, home creation, migration on
  request, Mirror's context for a turn, learning from open Conversations, and Journey
  administration, each taking an explicit path and reading no environment. The package
  gains an `exports` field, which closes every deep import other than the new entry. The
  terminal, the bins and the hooks behave as before. No migration, and no model or prompt
  change.
---

# v0.39.0 — The Core as a Library

**Date:** 2026-10-31

## Highlights

- **`mirror-mind/desktop`, a library entry for a host**
  ([CV24](../project/roadmap/cv24-embeddable-core-for-mirror-desktop/index.md)). Imported by
  package name from a host's `node_modules`, with no flags: the entry registers the bins'
  type-stripping hook itself. Everything a host may call is re-exported there by name, with
  `DESKTOP_API_VERSION = 1`; a name not in that file is not part of the contract.
- **Eight stories, one rule.** Every call takes an explicit database or home path, never reads
  `MIRROR_HOME`, `MIRROR_USER`, `DB_PATH` or a key from the environment, never migrates as a side
  effect, and refuses a database that is not `current` before opening it for writing.
- **Custody chosen per write, with a decision for each.** Conversation writes go through a
  narrowed handle instead of a per-write snapshot; a home is created beside its target and renamed
  into place; a home migrates only behind a uniquely named, verified backup the core never deletes.
- **Breaking for deep imports only.** The package now declares `exports` with `./desktop` and
  `./package.json`. Any other `import "mirror-mind/…"` path that resolved before no longer does.
  The `mirror` and `mirror-hook` bins are unaffected.
- **A Windows package install can update itself** (PR #46 by @rodrigoimmaginario, CR189;
  *added on 2026-10-31*). An earlier version needs one manual install to get here; see Upgrading.
- No migration, and no model or prompt change, so the model-behavior release gate does not apply.

## Where We Started

Decision CV22.DS10.TS1 left Mirror Desktop outside the TypeScript migration: it kept calling the
Python core through the retired Journey administration and a catalog script. On 2026-10-28 Mirror
Desktop decided to follow this core instead. It froze its 0.2 line on Python and opened a 0.3 line
that hosts the core in its own Node process, on its own home.

That host could not use the CLI's way in. It runs from `node_modules`, where Node refuses to strip
TypeScript types. A shell that starts it may export another home's `MIRROR_HOME`. It writes on every
turn of a Conversation that never ends. And it has to ask the person before a home is migrated,
while every open through the front door migrates first.

## What Changed

The contract grew one story at a time on `desktop/library-seam-1a`, each with its spec first, and
merged as PR #52.

- **DS1, inspect a home without migrating.** `inspectMigrationState` reports `missing`,
  `not_mirror`, `current`, `pending` or `ahead`, with the pending list. It shares its three
  ledger readers with `ensureMigratedOnOpen`, so what it calls pending is exactly what an open
  would apply. The loader became `boot` plus an idempotent `registerTypeStripping`; only `boot`,
  which owns its process, filters warnings.
- **DS2, Conversations as calls.** `ensureConversation`, `appendConversationMessages` (the
  `conversations append` contract, byte for byte), `renameConversation` and
  `rebindConversationJourney`, written through `openDatabaseForConversationWrites`. That handle
  prepares only a single SELECT, INSERT … VALUES into three tables, and an UPDATE of four
  `conversations` columns by id. The per-write `VACUUM INTO` measured about 0.9 s on a 108 MB
  home, too much for every turn.
- **DS3, Journey reads.** `readJourneyTree` (a new contract in the stored sibling order, not a
  revival of the retired registry dump), `listJourneyConversations` and `inspectConversation`,
  read-only.
- **DS4, create a home.** `createHome` copies the templates with the person's name, bootstraps,
  and seeds in a staging directory, renaming it into place only when the home reads `current`.
  It never writes `~/.config/mirror/env`.
- **DS5, migrate on request.** `migrateHome` applies exactly the pending list the person was
  shown, under the bootstrap lock, behind a backup that is quick-checked, hashed, and read back as
  the same pre-image.
- **DS6, Mirror's context as a call.** `deliverMirrorContext` is the doorman for a host's turn,
  with the key as an argument and Mirror Mode from the first turn; each provider call is tried
  once within its own bound. Its write is `mirror doorman`'s, behind the front door's snapshot.
- **DS7, learning from an open Conversation.** `learnFromConversations` extracts the stretch an
  idle, unended Conversation gained since its `learned_through` watermark, in bounded pieces,
  with the terminal's prompts, and never ends it.
- **DS8, Journey administration as calls.** `addJourney`, `setJourneyProjectPath`, `moveJourney`
  and `deleteJourney` port Python 0.31.14's administration, so the requests Desktop 0.2 sent keep
  their meaning. `updateJourney` is new: it edits a Journey's name, description and status, and
  refuses `journey_changed` when the row changed since the host read it.

Existing code changed only where the entry needed it: the loader, three exported readers, two
`export` keywords in `extraction.ts`, the tarball guard (`lib/` allowed, `lib/desktop.js`
required), and `package.json`. No existing test changed. The npm smoke installs the package and
imports the entry from a host project for DS1 to DS5.

*Added on 2026-10-31:* this release also carries one change outside CV24, merged to `main` the
day before and missing from this note when it was published, so the paragraph above covers CV24
only. PR #46 (CR189, by @rodrigoimmaginario) runs the package update's `npm install -g` from the
parent of `node_modules` instead of from inside the package. npm renames the package's directory
aside before it lays down the new version, and Windows refuses to rename a directory a process is
running in, so on Windows `runtime update` failed at apply with `EBUSY` every time. Nothing
changes on macOS or Linux. See Upgrading.

## Upgrading

*Added on 2026-10-31.* Everyone updates as usual:

```bash
mirror runtime update          # or: npm install -g mirror-mind
```

On Windows, a package install of an earlier version cannot install this one itself: its
`runtime update` fails at apply with `EBUSY`. Once, by hand, from any directory other than the
package's own:

```bash
npm install -g mirror-mind@latest
```

From then on `mirror runtime update` works.

## Conscious Exclusions

- **Renaming a Journey's slug.** The slug keys Conversations, memories and tasks; renaming it is a
  migration, not a call.
- **A Journey's icon and color, and a receipt ledger for Journey calls.**
- **The front door's own migration custody.** `ensureMigratedOnOpen` still overwrites one fixed
  backup; giving it DS5's custody is a separate decision.
- **Installed-package smoke for DS6 to DS8.** DS6 and DS7 need a provider key. DS8 is exercised
  end to end by Mirror Desktop's real-host test; a keyless smoke probe is a cheap follow-up.

## What We Learned

A library entry is a stricter consumer than a CLI. Every assumption the bins could make about
their own process — environment, warnings, migrate-on-open, a snapshot per write — had to become
an explicit argument or a decision. The retired-surfaces sweep also caught the port twice naming a
retired verb in comments, which says the sweep is doing its job on new files.

## Next Horizon

Mirror Desktop moves its pin from a branch tarball to this release, then its first 0.3 alpha. CV24
stays open for the pieces that alpha's use asks for.
