Skip to content

Overview

Use a local SQLite database for machine-memory.

Updated View as Markdown
For humans

Usage

machine-memory init --local

The --local flag selects a SQLite database on the local filesystem. Use it on every database-backed command:

machine-memory add "A local project decision" --local
machine-memory list --local

Only one backend flag is allowed. Do not combine --local with --remote.

Database location

By default, the database binary that will be generated and used will be called machine-memory.db and will be saved in the current repository root.

The database and its parent directory are created when the first database-backed command opens it. Set MACHINE_MEMORY_DB_PATH to use a different path; a relative path is resolved from the current working directory.

The local backend does not use remote Worker credentials or the operating system keychain. It is useful when memory should remain self-contained in a project or when a remote backend is not available.

Exporting to remote D1

Use local export to copy this repository’s local memories into the configured remote D1 database.

Caveats of using a local .db file

SQLite databases are binary blobs, so Git can’t diff or merge them: concurrent commits from multiple users will produce conflicts that must be resolved by picking one version wholesale, silently discarding the other’s data.

Branch-local databases compound this: entries written while working on a throwaway branch live only in that branch’s checked-out file, and once the branch is deleted (or the file is overwritten by a checkout/merge), those rows are gone with no recovery path.

History lesson: bun.lockb files.

Bun exclusively used, until v1.1.39, a binary lockfile for speed purposes. A text-based lockfile became the default in v1.2.

The core complaint (GitHub Discussion #409, 2022): early adopters flagged the binary bun.lockb format as a “HUGE turn off” mainly because it’s impossible to diff, though Bun offered a workaround where bun install -y would output as a yarn v1 lockfile for human-readable diffing.

Merge conflicts (Issue #11863): the Bun team itself acknowledged that merge conflicts are hard — you can’t tell whether to pick bun.lockb.1 or bun.lockb.2, or both.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close