Compare commits

..

No commits in common. "main" and "v1.0.0" have entirely different histories.
main ... v1.0.0

7 changed files with 72 additions and 324 deletions

View file

@ -1,14 +1,5 @@
# Changelog
## 1.0.2 — 2026-12-04
- Правила: перед исследованием репозитория, сервера или CI сначала искать процедуру в памяти.
- memory_search по умолчанию ищет по всей установке, включая заметки других проектов.
## 1.0.1 — 2026-12-03
- Первая версия, обработанная npm после ревью; содержимое пакета без изменений.
## 1.0.0 — 2026-12-03
Первый публичный выпуск.

View file

@ -1,93 +0,0 @@
# Memory & Vault
> **Память и сейф паролей для DeepSeek Harness**
[![npm](https://img.shields.io/npm/v/%40itmarkovnpm%2Fdsh-memory-vault?color=41b883&label=npm)](https://www.npmjs.com/package/@itmarkovnpm/dsh-memory-vault)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![node](https://img.shields.io/badge/node-%E2%89%A522.13-brightgreen.svg)](https://nodejs.org)
Агент больше не начинает каждый чат с чистого листа. Memory & Vault хранит то, что выяснилось в прошлых сессиях — конвенции, решения, ловушки, доступы — и отдаёт это модели в нужный момент.
Заметки живут локально и зеркалятся на ваш сервер. Пароли и токены лежат отдельно, под замком, и попадают к агенту только тогда, когда действительно нужны.
---
## Две вещи в одном плагине
| | **Память** | **Сейф** |
|---|---|---|
| **Что хранит** | предпочтения, конвенции, решения, инфраструктуру, ловушки | пароли, токены, API-ключи, пары логин/пароль |
| **Как попадает к агенту** | автоматический recall + поиск по ключевым словам | только по явному `secret_get`, с предупреждением |
| **Где лежит** | `memory_entries`, обе базы | `memory_secrets`, обе базы |
| **Интерфейс** | команда `/memory`, карточка плагина | менеджер паролей в карточке и вкладка в боковой панели |
---
## Возможности
- **Память, которая не теряется.** Запись идёт в локальную SQLite всегда, а в PostgreSQL — когда сервер доступен. Сервер упал — работа продолжается локально и догоняется позже.
- **Чтение «сервер → локально → досыл».** Сначала спрашиваем сервер, при пустом ответе берём локальную базу и возвращаем найденное на сервер.
- **Разделы заметок.** `personal`, `home-server`, имя проекта или сайта, `dsh` — чтобы «всё про домашний сервер» лежало в одном месте.
- **Поиск с индексами.** FTS5 в SQLite; GIN по словоформам, триграммам и тегам в PostgreSQL. Работает и по чужим проектам: деплой-плейбук находится из любой сессии.
- **Обновление вместо дублей.** `memory_update` переписывает запись на месте, сохраняя id и историю.
- **Правила в системном промпте.** Когда сохранять, что не хранить, как обращаться с кредами — модель следует этому без напоминаний.
- **Сейф с менеджером.** Поиск, показ на 30 секунд, копирование в буфер, добавление, правка, удаление. Список отдаёт только метаданные.
- **Внешняя база по просьбе.** Скажите «разверни внешнюю базу» — агент спросит, где, поднимет PostgreSQL в Docker, применит схему, подключит плагин и проверит.
---
## Как это выглядит в работе
```text
Пользователь: выкати itmarkov.ru
Агент: memory_search("деплой itmarkov forgejo")
→ схема /opt/проект, releases/<sha>, current
→ CI tests → build → deploy по ssh, DEPLOY_SSH_KEY
→ ждать прогон через actions/tasks
дальше — по записанной процедуре, а не с нуля
```
---
## Установка
```bash
dsh plugin add @itmarkovnpm/dsh-memory-vault
```
Или в интерфейсе: **Plugins → Add plugin** → `@itmarkovnpm/dsh-memory-vault`.
**Требования:** DeepSeek Harness 0.2.x, Node.js 22.13+. PostgreSQL не обязателен — без него всё работает локально.
---
## Хранение
```text
┌──────────────────┐ запись всегда ┌──────────────────┐
│ SQLite (локально) │ ───────────────────────────▶ │ PostgreSQL (сервер) │
│ memory.sqlite │ ◀─────────────────────────── │ memory_entries │
└──────────────────┘ чтение: сервер первым └──────────────────┘
│ │
└──── досыл найденного ──┘
```
Секреты не попадают в заметки: для них отдельная таблица, отдельные инструменты и отдельный экран.
---
## Безопасность
> **Секреты хранятся в открытом виде** — в локальной SQLite и в PostgreSQL, как и любой файл с паролями. Доступ к файлу или базе означает доступ к кредам. Для автоматизации передавайте их через переменные окружения или `$DSH_HOME/.env`, а базу держите в LAN или за VPN.
---
## Ссылки
- npm: https://www.npmjs.com/package/@itmarkovnpm/dsh-memory-vault
- исходники: https://git.itmarkov.ru/dmarkov/dsh-memory-vault
- лицензия: [MIT](LICENSE)
<p align="center"><sub>Сделано для DeepSeek Harness · память, которая остаётся</sub></p>

View file

@ -1,23 +0,0 @@
# Memory & Vault
**Память и сейф паролей для DeepSeek Harness.**
Агент запоминает конвенции, решения и ловушки между сессиями, а пароли и токены хранит отдельно — в сейфе с менеджером прямо в интерфейсе.
- заметки в локальной SQLite с зеркалом в PostgreSQL на вашем сервере;
- разделы `personal`, `home-server`, проект или сайт;
- поиск с индексами (FTS5 / GIN), обновление записей без дублей;
- пароли, токены и ключи — отдельная таблица, доступ только по запросу;
- правила памяти и секретов в системном промпте.
**Установка**
```bash
dsh plugin add @itmarkovnpm/dsh-memory-vault
```
Или: **Plugins → Add plugin** → `@itmarkovnpm/dsh-memory-vault`. Нужен Node.js 22.13+, PostgreSQL не обязателен.
Секреты хранятся в открытом виде в обеих базах — держите сервер в LAN или за VPN.
[npm](https://www.npmjs.com/package/@itmarkovnpm/dsh-memory-vault) · [исходники](https://git.itmarkov.ru/dmarkov/dsh-memory-vault) · MIT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

View file

@ -1,119 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-label="Memory and Vault: a shield holding a memory graph and a keyhole badge, next to stacks of notes and recall orbits">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#1b1e25"/>
<stop offset="0.55" stop-color="#14171c"/>
<stop offset="1" stop-color="#0d0f12"/>
</linearGradient>
<radialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
<stop offset="0" stop-color="#5b8dff" stop-opacity="0.26"/>
<stop offset="0.55" stop-color="#3b64b8" stop-opacity="0.09"/>
<stop offset="1" stop-color="#000000" stop-opacity="0"/>
</radialGradient>
<linearGradient id="edge" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#b7cdff"/>
<stop offset="0.5" stop-color="#6f9bff"/>
<stop offset="1" stop-color="#3f5f9c"/>
</linearGradient>
<linearGradient id="shieldFill" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#232b3a"/>
<stop offset="1" stop-color="#11151c"/>
</linearGradient>
<linearGradient id="card" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#242c3c"/>
<stop offset="1" stop-color="#161b24"/>
</linearGradient>
<linearGradient id="accent" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#c9dbff"/>
<stop offset="1" stop-color="#6f9bff"/>
</linearGradient>
<pattern id="dots" width="40" height="40" patternUnits="userSpaceOnUse">
<circle cx="2" cy="2" r="1.3" fill="#ffffff" opacity="0.05"/>
</pattern>
<filter id="soft" x="-60%" y="-60%" width="220%" height="220%">
<feGaussianBlur stdDeviation="26"/>
</filter>
<filter id="badgeShadow" x="-60%" y="-60%" width="220%" height="220%">
<feDropShadow dx="0" dy="10" stdDeviation="16" flood-color="#000000" flood-opacity="0.45"/>
</filter>
</defs>
<rect width="1600" height="900" fill="url(#bg)"/>
<rect width="1600" height="900" fill="url(#dots)"/>
<ellipse cx="800" cy="440" rx="640" ry="480" fill="url(#glow)"/>
<ellipse cx="800" cy="520" rx="300" ry="120" fill="#6f9bff" opacity="0.10" filter="url(#soft)"/>
<!-- Стек заметок слева -->
<g transform="rotate(-10 360 450)">
<rect x="205" y="300" width="300" height="300" rx="28" fill="url(#card)" stroke="#ffffff" stroke-opacity="0.05"/>
</g>
<g transform="rotate(-4 390 450)">
<rect x="235" y="316" width="300" height="300" rx="28" fill="url(#card)" stroke="#ffffff" stroke-opacity="0.10"/>
<rect x="271" y="366" width="176" height="10" rx="5" fill="#ffffff" opacity="0.20"/>
<rect x="271" y="396" width="222" height="10" rx="5" fill="#ffffff" opacity="0.13"/>
<rect x="271" y="426" width="146" height="10" rx="5" fill="#ffffff" opacity="0.13"/>
<rect x="271" y="470" width="70" height="22" rx="11" fill="#6f9bff" opacity="0.45"/>
<rect x="353" y="470" width="52" height="22" rx="11" fill="#ffffff" opacity="0.09"/>
</g>
<!-- Пунктирная связь заметки → щит -->
<path d="M 560 470 C 592 470 596 448 622 444" fill="none" stroke="#9dbdff" stroke-opacity="0.6" stroke-width="3" stroke-dasharray="2 12" stroke-linecap="round"/>
<!-- Орбиты «вспоминания» справа -->
<g transform="translate(1180 440)" fill="none">
<circle r="118" stroke="#9dbdff" stroke-opacity="0.18" stroke-width="2"/>
<circle r="184" stroke="#9dbdff" stroke-opacity="0.11" stroke-width="2"/>
<circle r="250" stroke="#9dbdff" stroke-opacity="0.06" stroke-width="2"/>
<circle cx="118" cy="0" r="9" fill="#c9dbff" opacity="0.9"/>
<circle cx="-96" cy="112" r="7" fill="#9dbdff" opacity="0.7"/>
<circle cx="-28" cy="-181" r="6" fill="#9dbdff" opacity="0.55"/>
<circle cx="168" cy="148" r="5" fill="#9dbdff" opacity="0.35"/>
</g>
<path d="M 1002 622 C 1046 588 1082 538 1112 496" fill="none" stroke="#9dbdff" stroke-opacity="0.4" stroke-width="3" stroke-dasharray="2 12" stroke-linecap="round"/>
<!-- Щит -->
<g filter="url(#badgeShadow)">
<path d="M 800 220 L 986 286 V 470 C 986 596 902 676 800 710 C 698 676 614 596 614 470 V 286 Z"
fill="url(#shieldFill)" stroke="url(#edge)" stroke-width="6" stroke-linejoin="round"/>
</g>
<!-- Граф памяти внутри щита -->
<g stroke="#9dbdff" stroke-opacity="0.40" stroke-width="2.5" stroke-linecap="round">
<line x1="726" y1="382" x2="872" y2="356"/>
<line x1="872" y1="356" x2="896" y2="468"/>
<line x1="896" y1="468" x2="772" y2="512"/>
<line x1="772" y1="512" x2="726" y2="382"/>
<line x1="726" y1="382" x2="800" y2="446"/>
<line x1="872" y1="356" x2="800" y2="446"/>
<line x1="896" y1="468" x2="800" y2="446"/>
<line x1="772" y1="512" x2="800" y2="446"/>
</g>
<g>
<circle cx="726" cy="382" r="14" fill="#0f131a" stroke="url(#accent)" stroke-width="3"/>
<circle cx="872" cy="356" r="14" fill="#0f131a" stroke="url(#accent)" stroke-width="3"/>
<circle cx="896" cy="468" r="14" fill="#0f131a" stroke="url(#accent)" stroke-width="3"/>
<circle cx="772" cy="512" r="14" fill="#0f131a" stroke="url(#accent)" stroke-width="3"/>
<circle cx="800" cy="446" r="28" fill="#6f9bff" opacity="0.14"/>
<circle cx="800" cy="446" r="20" fill="#0f131a" stroke="url(#accent)" stroke-width="4"/>
<circle cx="800" cy="446" r="6" fill="#c9dbff"/>
</g>
<!-- Сейф-значок -->
<g transform="translate(946 636)" filter="url(#badgeShadow)">
<circle cx="0" cy="0" r="74" fill="#161c26" stroke="url(#edge)" stroke-width="5"/>
<circle cx="0" cy="0" r="56" fill="none" stroke="#ffffff" stroke-opacity="0.09" stroke-width="2"/>
<circle cx="0" cy="-14" r="15" fill="none" stroke="#c9dbff" stroke-width="6"/>
<path d="M -6 0 L 6 0 L 4 34 L -4 34 Z" fill="#c9dbff"/>
</g>
<!-- Частицы -->
<g fill="#c9dbff">
<circle cx="300" cy="210" r="3" opacity="0.35"/>
<circle cx="1300" cy="230" r="2.5" opacity="0.3"/>
<circle cx="1430" cy="700" r="3" opacity="0.25"/>
<circle cx="230" cy="700" r="2.5" opacity="0.3"/>
<circle cx="1080" cy="150" r="2" opacity="0.35"/>
<circle cx="620" cy="760" r="2" opacity="0.25"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -42,7 +42,6 @@ You have durable memory shared by every session in this installation (plugin \`m
The recall block in context is a cached digest and may lag behind the store.
- **One signal is enough.** Save immediately, without asking and without waiting for confirmation, when any of these appear: a user preference, correction, or feedback; a project convention; an architectural decision together with its reason; an environment fact; a non-obvious gotcha that will outlive this session. Never ask the user whether to save.
- **Start from memory.** Before exploring a repository, server, or CI system, call \`memory_search\` with the task's keywords (deploy, release, pipeline, forgejo, service or host name). Earlier sessions likely recorded the procedure, the exact commands, and its gotchas: read that note and follow it instead of re-deriving the setup from scratch. Re-research only when memory has nothing or the note proves stale.
- **Check before writing.** Call \`memory_search\` first. If a note already covers the topic but the fact changed, rewrite it in place with \`memory_update\` (same id, same history); use \`memory_forget\` + \`memory_save\` only when the old note is about something else. Do not keep two contradicting notes.
- **One topic per note, one collection per note.** Write for a future session that knows nothing about this conversation: name the paths, commands, services, and reasons. Give the note a collection: \`personal\` for user facts and preferences, \`home-server\` for infrastructure, the project or site name (e.g. \`autoan\`, \`itmarkov.ru\`) for project knowledge, \`dsh\` for the harness itself. Scope \`global\` for user-wide facts, \`workspace\` for this project's conventions and decisions. Pin only rules that must always apply. When searching, pass \`collection\` to narrow the store.
- **Do not save:** transient task state, secrets or credentials, anything already in the repository or AGENTS.md, unverified claims, point-in-time values (line numbers, counts, commit hashes), or facts that are cheaper to re-derive from the code than to recall.
@ -448,8 +447,6 @@ function createLocalStore(logger) {
const cwdParam = cwd ?? null
if (scope === 'global') return { sql: `scope = 'global'`, params: [] }
if (scope === 'workspace') return { sql: `scope = 'workspace' AND workspace IS ?`, params: [cwdParam] }
// all без каталога = вся память установки, включая заметки других проектов.
if (scope === 'all' && cwdParam === null) return { sql: '1 = 1', params: [] }
return { sql: `(scope = 'global' OR (scope = 'workspace' AND workspace IS ?))`, params: [cwdParam] }
}
@ -642,10 +639,8 @@ function createPgStore(pool, logger) {
? `scope = 'global'`
: scope === 'workspace'
? `scope = 'workspace' AND workspace = $1`
: scope === 'all' && cwd === undefined
? `true`
: `(scope = 'global' OR (scope = 'workspace' AND workspace = $1))`
const params = (scope === 'global' || (scope === 'all' && cwd === undefined)) ? [] : [cwd ?? null]
: `(scope = 'global' OR (scope = 'workspace' AND workspace = $1))`
const params = scope === 'global' ? [] : [cwd ?? null]
const filters = [where]
if (collection) { filters.push(`collection = $${params.length + 1}`); params.push(collection) }
params.push(limit)
@ -662,10 +657,8 @@ function createPgStore(pool, logger) {
? `scope = 'global'`
: scope === 'workspace'
? `scope = 'workspace' AND workspace = $2`
: scope === 'all' && cwd === undefined
? `true`
: `(scope = 'global' OR (scope = 'workspace' AND workspace = $2))`
const params = (scope === 'global' || (scope === 'all' && cwd === undefined)) ? [needle] : [needle, cwd ?? null]
: `(scope = 'global' OR (scope = 'workspace' AND workspace = $2))`
const params = scope === 'global' ? [needle] : [needle, cwd ?? null]
let filters = [where]
if (collection) { filters.push(`collection = $${params.length + 1}`); params.push(collection) }
const likeIndex = params.length + 1
@ -1089,13 +1082,13 @@ function createTools(ctx, engine, settings, recall) {
{
name: 'memory_search',
description:
'Search saved memory notes by keyword (substring of the note or an exact tag). Searches every collection and every project by default, so a deployment or CI note saved in another workspace is found here. '
+ 'Call it before exploring a repository, server, or CI system: earlier sessions likely recorded the procedure and its gotchas.',
'Search saved memory notes by keyword (substring of the note or an exact tag). '
+ 'Call it when the user refers to something from an earlier session, an earlier decision, or a preference you do not see in the current conversation.',
parameters: {
type: 'object',
properties: {
query: { type: 'string', description: 'Keyword or phrase to look for.' },
scope: { type: 'string', enum: ['all', 'global', 'workspace'], description: 'all (default) searches everything; global only user-wide notes; workspace only notes of the current working directory.' },
scope: { type: 'string', enum: ['global', 'workspace', 'all'], description: 'Limit to global notes, workspace notes, or both (default).' },
collection: { type: 'string', description: 'Only notes from this collection (personal, home-server, project/site name). Optional.' },
limit: { type: 'number', description: 'Maximum results, 1-20 (default 8).' },
},
@ -1108,8 +1101,7 @@ function createTools(ctx, engine, settings, recall) {
if (text.length === 0) throw new Error('memory: `query` must be a non-empty string')
const limit = clampInt(args.limit, 1, 20, 8)
const scope = args.scope === 'global' || args.scope === 'workspace' ? args.scope : 'all'
const cwd = scope === 'workspace' ? sessionCwd(ctx, exec) : undefined
const rows = await engine.search(text.toLowerCase(), scope, cwd, limit, normalizeCollection(args.collection))
const rows = await engine.search(text.toLowerCase(), scope, sessionCwd(ctx, exec), limit, normalizeCollection(args.collection))
if (rows.length === 0) return `No memories match ${JSON.stringify(text)}.`
return `Found ${rows.length} memor${rows.length === 1 ? 'y' : 'ies'}:\n${rows.map(row => formatRow(row, { showDate: true })).join('\n')}`
},

View file

@ -1,65 +1,65 @@
{
"name": "@itmarkovnpm/dsh-memory-vault",
"version": "1.0.2",
"description": "Memory \u0026 Vault: durable agent notes and a password/secret vault for DeepSeek Harness. Local SQLite plus an optional PostgreSQL mirror, indexed search, agent tools, /memory commands, global rules, a bundled setup skill, and an in-app password manager.",
"type": "module",
"license": "MIT",
"author": "Denis Markov",
"keywords": [
"dsh",
"dsh-plugin",
"dsh-bundle",
"deepseek-harness",
"memory",
"vault",
"secrets",
"postgres",
"sqlite"
],
"repository": {
"type": "git",
"url": "git+https://git.itmarkov.ru/dmarkov/dsh-memory-vault.git"
},
"homepage": "https://git.itmarkov.ru/dmarkov/dsh-memory-vault",
"bugs": {
"url": "https://git.itmarkov.ru/dmarkov/dsh-memory-vault/issues"
},
"engines": {
"node": "\u003e=22.13"
},
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./client": "./client.js",
"./locale/*.json": "./locale/*.json",
"./icon": "./icon.svg"
},
"files": [
"index.js",
"client.js",
"cordis.patch.yml",
"README.md",
"LICENSE",
"locale/*.json",
"icon.svg",
"sql"
],
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
},
"client": {
"platform": "web",
"immediately": true,
"inject": [
"@deepseek-ai/dsh-client-ui-plugin-manager"
]
}
},
"dependencies": {
"@deepseek-ai/schemastery": "~3.19.0",
"pg": "^8.23.1"
}
"name": "@itmarkovnpm/dsh-memory-vault",
"version": "1.0.0",
"description": "Memory & Vault: durable agent notes and a password/secret vault for DeepSeek Harness. Local SQLite plus an optional PostgreSQL mirror, indexed search, agent tools, /memory commands, global rules, a bundled setup skill, and an in-app password manager.",
"type": "module",
"license": "MIT",
"author": "Denis Markov",
"keywords": [
"dsh",
"dsh-plugin",
"dsh-bundle",
"deepseek-harness",
"memory",
"vault",
"secrets",
"postgres",
"sqlite"
],
"repository": {
"type": "git",
"url": "git+https://git.itmarkov.ru/dmarkov/dsh-memory-vault.git"
},
"homepage": "https://git.itmarkov.ru/dmarkov/dsh-memory-vault",
"bugs": {
"url": "https://git.itmarkov.ru/dmarkov/dsh-memory-vault/issues"
},
"engines": {
"node": ">=22.13"
},
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./client": "./client.js",
"./locale/*.json": "./locale/*.json",
"./icon": "./icon.svg"
},
"files": [
"index.js",
"client.js",
"cordis.patch.yml",
"README.md",
"LICENSE",
"locale/*.json",
"icon.svg",
"sql"
],
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
},
"client": {
"platform": "web",
"immediately": true,
"inject": [
"@deepseek-ai/dsh-client-ui-plugin-manager"
]
}
},
"dependencies": {
"@deepseek-ai/schemastery": "~3.19.0",
"pg": "^8.23.1"
}
}