dsh-brain/docs/MNEMON_FORK.md

80 lines
3.4 KiB
Markdown

# Mnemon fork (dsh-brain)
## Status
- Fork location: `vendor/dsh-mnemon`
- Fork package: `dsh-brain-mnemon` `0.5.54-dsh.1` (private)
- Upstream: `omdsh-dev/dsh-mnemon`
- Upstream revision: `8b650ab5ef33522e03887b250b13336593daa26f`
- Upstream version: `0.5.54`
- License: MIT, Copyright (c) 2026 dsh-external contributors
The snapshot contains the complete upstream Monorepo source: core/host/client/sdk,
Runtime, Documents, Memory Spaces, Skills Source, Mnemon Native, every external
Provider plugin and every strategy plugin. Upstream docs, changelogs and the MIT
license/third-party notices are kept as-is.
## Identity policy
Every package name, import specifier, runtime schema id, bundle entry id and
plugin directory has been rewritten from `dsh-mnemon` to `dsh-brain-mnemon`.
The root package is marked private and records its upstream provenance in
`package.json#dshBrainFork` and `FORK_NOTICE.md`. Upstream repository URLs,
copyright notices and license files are preserved.
## Active integration
`src/mnemon/fork` is the provider-SDK subset dsh-brain actually builds against.
It mirrors `plugins/dsh-mnemon-source-memory-spaces/src` from the same upstream
revision with a local contract adapter, and is imported by `src/mnemon/index.ts`,
`src/mnemon/descriptor.ts` and `src/mnemon/driver.ts`. dsh-brain no longer
declares `dsh-mnemon-source-memory-spaces` as a peer or dev dependency.
## Sync and verification
Regenerate the snapshot with:
```bash
node scripts/fork-mnemon.mjs --source <upstream-checkout> --target vendor/dsh-mnemon --force
node scripts/fork-mnemon.mjs --check
node verify-mnemon-fork.mjs
```
Update `PINNED_REVISION` and `PINNED_VERSION` in `scripts/fork-mnemon.mjs` when
syncing. Review the diff and keep `LICENSE`, `THIRD_PARTY_NOTICES.md` and
`FORK_NOTICE.md` intact.
## Current scope
The fork snapshot is complete, but dsh-brain currently loads only its local
provider-SDK subset and the phase-1 local JSON memory engine. Loading the full
upstream Mnemon runtime as the memory engine, cloud change cursors, remote
conflict merging and external Provider adapters remain later cloud-sync work.
## Native provider entry
`src/mnemon/native.ts` exposes the local JSON memory store through the vendored
provider contract `dsh-brain-mnemon.memory-space-provider/v1`. Its manifest and
actual host `install()` path are covered by `verify-mnemon-native.mjs`, including
remember / search / get / forget against a temporary project workspace.
## Cloud-sync handoff
The later cloud-sync layer must add, rather than assume, these semantics on top of
the provider protocol:
- local `changeSeq` is not a cloud `change_id`; each sync stream needs a durable
cloud cursor and a local outbox state (`pending` / `pushed` / `acknowledged`);
- idempotency keys per write/delete operation, plus retry and backoff policy;
- revision-based conflict detection and a merge/quarantine result instead of
last-write-wins;
- tombstone/delete events because some providers hard-delete and cannot expose
deletions through browse;
- Provider transport adapters reusing connection discovery, status, search,
read/write, graph, timeout, cancellation and redaction;
- separate switches for memory sync and Skill sync, and an explicit first-sync
scope confirmation for spaces, profile and project documents.
The current phase intentionally does not implement cloud push/pull or conflict
merge (plan section 15).