{"versions":{"0.1.0":{"name":"dsh-memory","version":"0.1.0","description":"Durable cross-session memory for DeepSeek Harness: local SQLite FTS5 store, three model-facing tools, and a recall prompt section — no embedding service and no sidecar","keywords":["dsh","dsh-plugin","deepseek-harness","memory","sqlite"],"type":"module","main":"lib/index.js","types":"lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","default":"./lib/index.js"},"./cordis.patch.yml":"./cordis.patch.yml","./package.json":"./package.json"},"license":"MIT","engines":{"node":"^22.19.0 || >=24.0.0"},"dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"peerDependencies":{"@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.6","@deepseek-ai/dsh-tools":"^0.1.0-rc.6"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"},"devDependencies":{"@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.6","@deepseek-ai/dsh-tools":"^0.1.0-rc.6","@types/node":"^26.2.0","tsdown":"^0.15.6","typescript":"^5.9.3","vitest":"^3.2.4"},"scripts":{"build":"tsdown","prepare":"tsdown","test":"vitest run","typecheck":"tsc --noEmit"},"_id":"dsh-memory@0.1.0","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-ZDm81nMFI2iwBDzZS7PIeGKTO7R93ihlt757SB6qngHabJ+yGOrmBC95yMm9AiMCpX2+LQNZniHJRGvEuU8YTg==","shasum":"b71786eb607eec7f07711d09b60515d2af4526a0","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/dsh-memory/-/dsh-memory-0.1.0.tgz","fileCount":5,"unpackedSize":26252,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA4t2wUkVm/JkNRYj/fQxQp/laXvHb4vcskSXMO8mVI/AiAZ2WsDuemjXlWopIFvEzxpe2lW+Yrx6izcaG8QxrCTLQ=="}],"size":8699},"_npmUser":{"name":"anonymous","email":"wangbin042@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"wangbin042@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dsh-memory_0.1.0_1786636909047_0.3001629177073246"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-08-13T16:01:49.259Z","publish_time":1786636909259,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"0.1.0"},"name":"dsh-memory","time":{"created":"2026-08-13T16:02:19.616Z","modified":"2026-08-13T16:02:21.216Z","0.1.0":"2026-08-13T16:01:49.259Z"},"readme":"# dsh-memory\n\nDurable cross-session memory for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).\n\nThe harness ships no memory plugin. Its `extension-cookbook` names the mechanism — a prompt section plus tools — but nothing implements it, so every session starts blank. This package fills that gap with one local SQLite file: **no embedding service, no API key, no sidecar process.**\n\n## Install\n\n```bash\ndsh plugin --profile web add dsh-memory\n```\n\nThe shipped bundle row stores memories at `$DSH_HOME/memory/memory.db`, shared by every profile on the machine.\n\n## What it gives the model\n\n| Tool | Purpose |\n|---|---|\n| `memory_write` | Store one self-contained durable fact, optionally tagged and pinned |\n| `memory_search` | Keyword search over memory text and tags |\n| `memory_forget` | Delete a memory that is now wrong or obsolete |\n\nPlus a `memory:recall` prompt section that renders **pinned memories first, then the most recently updated**, under a character budget. Recall therefore does not depend on the model remembering to search — what it stored is already in front of it, and search is for anything older than the budget allows.\n\nThe `memory_write` description steers the model away from the common failure modes: transient task state (that is what the todo list is for), secrets, and facts the repository already records.\n\n## Configuration\n\n```yaml\n- id: memory\n  name: dsh-memory\n  config:\n    path: !!js dshHomePath('memory/memory.db')\n    promptRecentCount: 10\n    promptMaxChars: 2000\n    maxTextChars: 2000\n    searchLimitDefault: 10\n    searchLimitMax: 50\n    promptOrder: 50\n```\n\n| Field | Default | Meaning |\n|---|---|---|\n| `path` | — (required) | SQLite file, or `:memory:` for an ephemeral store |\n| `promptRecentCount` | `10` | Unpinned recent memories offered to the prompt section |\n| `promptMaxChars` | `2000` | Budget for the rendered section; overflow is reported as a count, and pinned memories are emitted first so they survive a tight budget |\n| `maxTextChars` | `2000` | Maximum characters accepted for one memory |\n| `searchLimitDefault` | `10` | `memory_search` limit when the model omits it |\n| `searchLimitMax` | `50` | Hard cap, whatever the model asks for |\n| `promptOrder` | `50` | Section order; `-100` is the harness identity, `0` the persona |\n\n`path` has **no code-side default on purpose**: a default would scatter durable user facts into whatever directory the harness happened to start in. The deployment value lives in the patch row.\n\n## Storage\n\nOne SQLite file: a `memories` table plus an external-content FTS5 index kept in sync by triggers. Parent directories are created on open, and the store survives process restarts.\n\nSearch compiles the query by **quoting every token**, so FTS5 operators a model happens to type (`OR`, `*`, `-`, `\"`) are matched literally instead of changing the query's meaning or raising a syntax error mid-tool-call. Surviving tokens combine with FTS5's implicit AND: every token must appear, and a query whose tokens include a word you did not store legitimately matches nothing.\n\n`node:sqlite` is still flagged experimental in Node 22/24, so running the harness prints one `ExperimentalWarning`. The harness's own `dsh-session-query-sqlite` uses the same module.\n\n## Failure behavior\n\nLoad-time misconfiguration fails loud: an empty `path`, a non-positive bound, or a `searchLimitDefault` above `searchLimitMax` throws at plugin load.\n\nAt call time, a blank fact or one over `maxTextChars` is a tool error the model can correct. A `memory_forget` for an id that does not exist is a **successful** result reporting `forgotten: false` — the model asked for a state that already holds, which is not an infrastructure failure.\n\n## Extension points\n\n`ctx.tools.register()` for the three tools and `ctx.systemPrompt.section()` for recall. Every registration is a Cordis effect, so unloading the plugin removes the tools and the section together and closes the database.\n\n## Development\n\n```bash\npnpm install --ignore-workspace\npnpm run typecheck\npnpm test\npnpm run build\n```\n\nTests cover the store directly (FTS retrieval, the literal-token query contract, prompt ordering, durability across reopens) and the plugin against the **real** tool registry and prompt service (registration, disposal, the write→recall round trip, bounds, fail-loud config).\n\n## License\n\nMIT\n\n## Prior art\n\nThe idea comes from [pi-mentis](https://github.com/guchengod/pi-mentis) (MIT) in the Pi ecosystem. This is an independent implementation against Harness extension points and shares no code with it. It deliberately drops pi-mentis's sidecar process, Zvec vector store, and required SiliconFlow embedding key in favour of one local FTS5 file — smaller, keyless, and offline, at the cost of lexical rather than semantic retrieval.","users":{}}