prgrmrwy/ohmydsh--packages-dsh-memex ↗★ 1

dsh-memex

提供持久化记忆库,为不同知识域划分独立的存储空间。 适合需要Agent长期记住特定项目上下文的用户。依赖全局安装的@touchskyer/memex。

包名
dsh-memex
兼容性
待验证
Harness 依赖范围
^0.2.0-rc.2
Cordis 依赖范围
^4.0.4
版本
0.3.0
许可证
MIT
最近更新
2026年10月10日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:prgrmrwy/ohmydsh#4d0809d824b42ae9b548bda8aa0ce9bdf105adf2&path:packages/dsh-memex

Configuration

Configuration is the plugin's own config, with the scope table fields editable live without remounting the plugin. The keys, as defined in src/scope/settings.ts:

autoDerive: true            # derive libraries for unclaimed workspaces (default)
scopes:                     # the "memory entries"
  - name: acme              # kebab-case library name
    home: ~/path/to/library # optional; default is ~/.dsh-memex/
    pathPrefixes: [~/work/acme]   # workspaces this entry claims
    remotePatterns: []      # repository remotes this entry claims
    publish: external       # internal | external (default external)
    primary: true           # needed when several entries claim the same path: exactly one
    fallback: false         # false closes the personal fallback (older entry-level form)
bindings:                   # the extra reach a scope may select; limits, never grants
  - name: acme-set
    read: [acme, personal]
    write: [acme, personal]
workspaces:                 # per-path declarations; they can only close things
  - path: ~/work/acme
    memory: false           # memory off for everything under this path
    fallback: false         # personal fallback closed for this path

An absent section means the schema defaults: only personal, auto-derive on. Invalid settings at registration prevent the plugin from publishing tools; invalid live edits are rejected and the plugin keeps using the last-good value, so an invalid draft can never change how memory is routed. A binding set bounds what an agent may additionally select: it limits rather than grants, and a workspace's own entries are always reachable. Resolution order is path prefix, then remote pattern, then auto-derivation, then the local-path fallback. The older entry-level memory and fallback fields are still read; if either the declaration or the entry closes something, it is closed.

The Memory settings page

The web half registers a Memory section (shown as 记忆 in the Chinese UI) in the DSH web settings panel.

Its unit is a workspace — the host's own workspace registry, not a re-reading of the configured paths — and each workspace lists the memory entries a session in that directory uses:

  • the primary entry carries the route: recall, the graph-level operations and default reads and writes. A workspace nothing declares shows the library the resolver derives for it, marked as derived and written to the configuration only when a decision (a second entry, or the fallback) needs it to be.
  • additional entries — including the fallback entry personal, on by default and switchable on the row itself — are reachable but never touched unless a call names them.

An entry is listed as role + name + card count and expands into its own facts: library path (copyable, with the namespace default as a placeholder), remote address, auto-sync state, last sync and publication direction (read-only).

Adding an entry picks from the libraries that exist (declared ones plus undeclared ones found under the namespace) or offers to create a new one, so a duplicate name is not reachable from the interface — one library is always one configuration entry, whatever number of workspaces claim it.

Each workspace also carries a memory switch. Off means the workspace is memory-free: no recall prompt, no write reminder, and every memex tool refuses there — the refusal happens before the library is ever materialized. It is a property of that workspace's route, so a library that also serves as another workspace's fallback target stays writable by that other workspace. The switch is read at session start, so turning it back on needs no restart. (dsh.yaml's DSH_MEMEX_ENABLED is the other extreme: it takes the whole plugin out at build time.) Workspaces with memory off are gathered in a collapsed group at the end of the list.

It also lists libraries that exist under the namespace but no entry declares (derived ones included) and can declare them, and offers a path probe that answers which library a directory resolves to without creating anything. Switching the primary entry is a replace: the old primary no longer serves that workspace.

Two claims are refused before a save: one library directory shared by two entries, and one repository pattern written verbatim under two entries. Whether two different patterns claim the same repository cannot be decided from the configuration, so that case is reported when a session actually resolves against it.

The publication direction is deliberately not editable on this page (see Guard boundary).

Remote actions

The page configures remotes, and only through the kernel CLI:

Library stateActions
no remote configuredconfigure remote (memex sync --init )
remote configuredsync now, pull, auto-sync on/off, change remote (separate, confirmed)

An already-configured library is never re-initialized or rebuilt: the kernel detects the existing repository and updates the remote instead. Every kernel call runs with a C locale, because the kernel decides "remote already exists" by matching an English git error string — a localized git remote add failure would otherwise make re-running --init refuse.

The system never writes a library's own files: .sync.json, .gitignore and the git repository remain the kernel's.

Browsing cards

An expanded entry offers Open cards. It starts the kernel's own memex serve for that library on demand, runs it local-only, suppresses the kernel's attempt to open a browser on the Host machine, takes the address the kernel actually reports (the last one printed when ports collide), and stops it when the plugin stops. A library with memory off is refused before anything is spawned. No browsing UI is built here and no upstream resource is rewritten. Across machines the address is resolved through an extension point that cockpit-memex-browse-shim connects to the cockpit; if that registration fails the button never falls back to a local address, which on a remote machine would point at the wrong host. Known limit: the upstream page loads its Markdown renderer from a public CDN, so rendering degrades offline.