dsh-engramory 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +242 -233
- package/README.md +141 -137
- package/client.js +103 -1
- package/package.json +79 -79
package/README.en.md
CHANGED
|
@@ -1,233 +1,242 @@
|
|
|
1
|
-
[简体中文](README.md) | **English**
|
|
2
|
-
|
|
3
|
-
# dsh-engramory
|
|
4
|
-
|
|
5
|
-
[](https://unstone.github.io/dsh-xray/registry.html#tinqiao-oss__engramory)
|
|
6
|
-
|
|
7
|
-
Long-term memory for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
8
|
-
(dsh). What the AI remembers is kept as plain markdown files you can open and edit
|
|
9
|
-
at any time. It is the dsh build of [Engramory](https://github.com/tinqiao-oss/engramory),
|
|
10
|
-
which is general-purpose agent memory: Claude Code, Codex and others can use the same store.
|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
## What it does
|
|
15
|
-
|
|
16
|
-
- **The memory index rides along on every step.** The index, `MEMORY.md`, lists the
|
|
17
|
-
notes by name. The plugin puts it into dsh's context on every step, so the AI knows
|
|
18
|
-
what it has saved without reading a file first, and opens a note when it needs the
|
|
19
|
-
detail. A write shows up on the next request; whatever is past the cap is left
|
|
20
|
-
out, and the AI is told to compact.
|
|
21
|
-
- **The index has a hard cap.** 200 lines / 25 KB by default. When the AI writes the
|
|
22
|
-
index with dsh's file tools and the plugin can work out the result, a write that
|
|
23
|
-
would grow it past the cap is refused before it happens, and the AI is told to
|
|
24
|
-
compact; compaction still passes. Details in [How the cap decides](#how-the-cap-decides).
|
|
25
|
-
- **The rules come with it.** What to save, how, and when to clean up: the rules
|
|
26
|
-
(a skill) are registered by the plugin, with no files to install.
|
|
27
|
-
- **A reminder to save before dsh compacts.** When a conversation grows long, dsh
|
|
28
|
-
compacts what came before into a summary, which need not keep what is worth
|
|
29
|
-
remembering later. As a conversation nears that point, the plugin reminds the AI to
|
|
30
|
-
save that first; the AI is reminded, not you.
|
|
31
|
-
- **A Memory page in the sidebar.** Read-only; it lists the notes by name and opens
|
|
32
|
-
one in your computer's default app, with a check-up that flags broken links in the
|
|
33
|
-
index and notes left out of it.
|
|
34
|
-
|
|
35
|
-
## Install
|
|
36
|
-
|
|
37
|
-
Needs Node.js 18+ and `pnpm` on PATH (dsh's plugin command uses it). In dsh's desktop
|
|
38
|
-
app you can also search for `dsh-engramory` on the Plugins page.
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
dsh plugin --profile <name> add dsh-engramory
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
To uninstall, use `remove` instead of `add`. Compatible dsh releases are listed in
|
|
45
|
-
`dsh.compatibility.dshReleases` in [`package.json`](https://github.com/tinqiao-oss/engramory/blob/master/adapters/dsh/plugin/package.json); an unlisted release
|
|
46
|
-
is unverified.
|
|
47
|
-
|
|
48
|
-
**Where the memory lives:**
|
|
49
|
-
|
|
50
|
-
- **The global store**, `~/.dsh/.engramory-memory/` (under `$DSH_HOME` when it is set).
|
|
51
|
-
With the plugin alone this is the only store; the AI creates it on its first save.
|
|
52
|
-
- **A project store** (optional), `.engramory-memory/` in a project's root, is created
|
|
53
|
-
by you only: run `python tools/engramory_init.py dsh --project-root <project>` from
|
|
54
|
-
the Engramory repo, which also git-ignores it. Where one exists, what holds only in
|
|
55
|
-
that project goes there; everything else stays in the global store.
|
|
56
|
-
|
|
57
|
-
Only one AI may write a store; two writers overwrite each other. To share it, let the
|
|
58
|
-
others read it only: see [one writer, many readers](https://github.com/tinqiao-oss/engramory/blob/master/adapters/reader/README.md). Memories are plain text and carry machine-local detail. Inside a project's git repo
|
|
59
|
-
the store must be git-ignored; a dedicated private repo for the store is fine.
|
|
60
|
-
|
|
61
|
-
**Without the plugin:** `python tools/engramory_init.py dsh --install-skill` writes the
|
|
62
|
-
rules into `$DSH_HOME/AGENTS.md`, installs the skill in `$DSH_HOME/skills/engramory/`
|
|
63
|
-
(`$DSH_HOME` defaults to `~/.dsh`) and creates the global store. The AI still keeps memory, but reads the index itself, and
|
|
64
|
-
the cap holds only if it runs `engramory_check.py` after each write.
|
|
65
|
-
|
|
66
|
-
## Companion mode (大肥鱼模式)
|
|
67
|
-
|
|
68
|
-
For a character you chat with: the community's 大肥鱼, or any persona. Turn on the
|
|
69
|
-
companion switch on the settings page, or set `companion: true`.
|
|
70
|
-
|
|
71
|
-

|
|
72
|
-
|
|
73
|
-
- **Three more types for the character's own life** ([SKILL.md §2.2](https://github.com/tinqiao-oss/engramory/blob/master/SKILL.md)):
|
|
74
|
-
`moment`, something you shared, with its date, folded into a monthly archive when
|
|
75
|
-
the index fills; `upcoming`, something coming up in your life, asked about once its
|
|
76
|
-
date passes and rewritten as a moment once you say how it went; `self`, a change in
|
|
77
|
-
the character itself, such as a nickname. A moment or self note is deleted only when
|
|
78
|
-
you ask it to forget.
|
|
79
|
-
- **Recall in character.** Even a greeting may call for recall, and what it remembered,
|
|
80
|
-
or failed to save, is told in the character's voice, without naming files or tools.
|
|
81
|
-
- **The persona preset needs the file tools.** The memory arrives even under a preset
|
|
82
|
-
that turns optional context off (dsh's `minimal`, for one). To save notes, though, the
|
|
83
|
-
preset needs dsh's file tools and the skill tool; a preset with only a shell reads the
|
|
84
|
-
memory, and its writes go past the cap.
|
|
85
|
-
|
|
86
|
-
## Social mode
|
|
87
|
-
|
|
88
|
-
A choice inside companion mode, for a character other people can talk to as well, such
|
|
89
|
-
as one wired to QQ, WeChat, Douyin or Bilibili through a bridge plugin. Choose *Social*
|
|
90
|
-
under *Memory access* on the settings page, or set `audience: social`. If only you talk
|
|
91
|
-
to this dsh, keep the default, *Private*.
|
|
92
|
-
|
|
93
|
-
With it on, **only your own conversations get the memory**: one is yours when you have
|
|
94
|
-
typed in it in dsh's own window (the desktop app or `dsh web`) and nobody else has.
|
|
95
|
-
A subagent goes with its parent. Messages from a bridge plugin (unless it marks them as
|
|
96
|
-
the owner's, below), `dsh headless`, other programs, and terminal or editor clients
|
|
97
|
-
count as someone else's. Once anyone else has written in a conversation it stays
|
|
98
|
-
theirs, and the memory already put into it stays in its history.
|
|
99
|
-
|
|
100
|
-
Someone else's conversation gets no index and is not told where the store is; dsh's
|
|
101
|
-
file tools there may name files only (every directory is refused), and any path into
|
|
102
|
-
a store is refused however it is spelled. This is **not** a security boundary: a shell
|
|
103
|
-
tool reads any file, and another profile on the same account can read the store too.
|
|
104
|
-
Real isolation needs filesystem permissions or a sandbox. A custom `skill` (see
|
|
105
|
-
[Configuration](#configuration)) reaches every conversation as written, someone else's
|
|
106
|
-
included, so if it says where the store is, they are told too.
|
|
107
|
-
|
|
108
|
-
### For bridge authors
|
|
109
|
-
|
|
110
|
-
With social mode on, every message a bridge submits counts as someone else's. For a
|
|
111
|
-
message from the owner's own account (their private QQ chat with the character, say),
|
|
112
|
-
put a `speaker` on its source:
|
|
113
|
-
|
|
114
|
-
```js
|
|
115
|
-
agent.followup(createUserMessage({
|
|
116
|
-
content: [{ type: 'text', text }],
|
|
117
|
-
source: { kind: 'plugin:your-bridge', speaker: { role: 'owner' } },
|
|
118
|
-
}))
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
| `speaker.role` | Meaning |
|
|
122
|
-
|---|---|
|
|
123
|
-
| `owner` | The owner wrote it: it comes from the account the user set as theirs in your bridge. |
|
|
124
|
-
| `guest` | Someone else wrote it, the same as no `speaker` at all. |
|
|
125
|
-
| `none` | Nobody wrote it: your plugin's own report, reminder or notice. It does not make the owner's conversation someone else's. |
|
|
126
|
-
|
|
127
|
-
In a group chat, add `chat: 'group'` (`{ role: 'owner', chat: 'group' }`): the whole
|
|
128
|
-
group reads the reply, so the conversation counts as someone else's even while only the
|
|
129
|
-
owner has spoken in it. A private chat may say `chat: 'private'` or leave it out; any
|
|
130
|
-
other value counts as a group. A group conversation stays someone else's once anyone else in it
|
|
131
|
-
speaks. A program that talks to dsh only through dsh web's API cannot set a source, so its messages count
|
|
132
|
-
as someone else's; if it sends `clientTimeZone` with a prompt it is taken for the
|
|
133
|
-
owner, so a program forwarding other people's messages must leave it out.
|
|
134
|
-
|
|
135
|
-
## Settings page and memory page
|
|
136
|
-
|
|
137
|
-

|
|
138
|
-
|
|
139
|
-
- **Settings page:** on dsh's *Plugins* page, open *Engramory memory* to set companion
|
|
140
|
-
mode, memory access and the index cap. Saving goes through dsh's own profile editor,
|
|
141
|
-
which writes your profile's `cordis.patch.yml` and reloads the plugin. Only you, signed
|
|
142
|
-
in, can call it, so an agent cannot use it to switch social mode off.
|
|
143
|
-
- **Memory page:** *Memory* in the sidebar. It lists the global store and each
|
|
144
|
-
workspace's project store (with an absolute `indexPath`, that store alone; with a
|
|
145
|
-
relative one, none), with each index's size against the cap, its notes' names
|
|
146
|
-
by type, and its archive. Each store comes with a check-up: the index's links to
|
|
147
|
-
files that are not there, the notes not in the index (recall starts from the index, so
|
|
148
|
-
the AI will not find them unless another note links to them), and notes with no type.
|
|
149
|
-
It goes by file names and the index's links alone, never through a symbolic link, and
|
|
150
|
-
is skipped when the index is over the cap, there is too much to check, or a file cannot
|
|
151
|
-
be read; `engramory_doctor.py` still does the full check.
|
|
152
|
-
Read-only, never a note's text; a name, *Open the index* and
|
|
153
|
-
*Open the folder* open on the machine dsh runs on; a machine with no desktop (a
|
|
154
|
-
headless server, a session over SSH) shows none of them. The switches at the top
|
|
155
|
-
(companion mode, and memory access once it is on) save as you flip them.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
|
175
|
-
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
|
191
|
-
|
|
192
|
-
|
|
|
193
|
-
|
|
|
194
|
-
| The index is
|
|
195
|
-
|
|
|
196
|
-
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
- **
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
- **
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
[
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1
|
+
[简体中文](README.md) | **English**
|
|
2
|
+
|
|
3
|
+
# dsh-engramory
|
|
4
|
+
|
|
5
|
+
[](https://unstone.github.io/dsh-xray/registry.html#tinqiao-oss__engramory)
|
|
6
|
+
|
|
7
|
+
Long-term memory for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
8
|
+
(dsh). What the AI remembers is kept as plain markdown files you can open and edit
|
|
9
|
+
at any time. It is the dsh build of [Engramory](https://github.com/tinqiao-oss/engramory),
|
|
10
|
+
which is general-purpose agent memory: Claude Code, Codex and others can use the same store.
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
- **The memory index rides along on every step.** The index, `MEMORY.md`, lists the
|
|
17
|
+
notes by name. The plugin puts it into dsh's context on every step, so the AI knows
|
|
18
|
+
what it has saved without reading a file first, and opens a note when it needs the
|
|
19
|
+
detail. A write shows up on the next request; whatever is past the cap is left
|
|
20
|
+
out, and the AI is told to compact.
|
|
21
|
+
- **The index has a hard cap.** 200 lines / 25 KB by default. When the AI writes the
|
|
22
|
+
index with dsh's file tools and the plugin can work out the result, a write that
|
|
23
|
+
would grow it past the cap is refused before it happens, and the AI is told to
|
|
24
|
+
compact; compaction still passes. Details in [How the cap decides](#how-the-cap-decides).
|
|
25
|
+
- **The rules come with it.** What to save, how, and when to clean up: the rules
|
|
26
|
+
(a skill) are registered by the plugin, with no files to install.
|
|
27
|
+
- **A reminder to save before dsh compacts.** When a conversation grows long, dsh
|
|
28
|
+
compacts what came before into a summary, which need not keep what is worth
|
|
29
|
+
remembering later. As a conversation nears that point, the plugin reminds the AI to
|
|
30
|
+
save that first; the AI is reminded, not you.
|
|
31
|
+
- **A Memory page in the sidebar.** Read-only; it lists the notes by name and opens
|
|
32
|
+
one in your computer's default app, with a check-up that flags broken links in the
|
|
33
|
+
index and notes left out of it.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
Needs Node.js 18+ and `pnpm` on PATH (dsh's plugin command uses it). In dsh's desktop
|
|
38
|
+
app you can also search for `dsh-engramory` on the Plugins page.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
dsh plugin --profile <name> add dsh-engramory
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
To uninstall, use `remove` instead of `add`. Compatible dsh releases are listed in
|
|
45
|
+
`dsh.compatibility.dshReleases` in [`package.json`](https://github.com/tinqiao-oss/engramory/blob/master/adapters/dsh/plugin/package.json); an unlisted release
|
|
46
|
+
is unverified.
|
|
47
|
+
|
|
48
|
+
**Where the memory lives:**
|
|
49
|
+
|
|
50
|
+
- **The global store**, `~/.dsh/.engramory-memory/` (under `$DSH_HOME` when it is set).
|
|
51
|
+
With the plugin alone this is the only store; the AI creates it on its first save.
|
|
52
|
+
- **A project store** (optional), `.engramory-memory/` in a project's root, is created
|
|
53
|
+
by you only: run `python tools/engramory_init.py dsh --project-root <project>` from
|
|
54
|
+
the Engramory repo, which also git-ignores it. Where one exists, what holds only in
|
|
55
|
+
that project goes there; everything else stays in the global store.
|
|
56
|
+
|
|
57
|
+
Only one AI may write a store; two writers overwrite each other. To share it, let the
|
|
58
|
+
others read it only: see [one writer, many readers](https://github.com/tinqiao-oss/engramory/blob/master/adapters/reader/README.md). Memories are plain text and carry machine-local detail. Inside a project's git repo
|
|
59
|
+
the store must be git-ignored; a dedicated private repo for the store is fine.
|
|
60
|
+
|
|
61
|
+
**Without the plugin:** `python tools/engramory_init.py dsh --install-skill` writes the
|
|
62
|
+
rules into `$DSH_HOME/AGENTS.md`, installs the skill in `$DSH_HOME/skills/engramory/`
|
|
63
|
+
(`$DSH_HOME` defaults to `~/.dsh`) and creates the global store. The AI still keeps memory, but reads the index itself, and
|
|
64
|
+
the cap holds only if it runs `engramory_check.py` after each write.
|
|
65
|
+
|
|
66
|
+
## Companion mode (大肥鱼模式)
|
|
67
|
+
|
|
68
|
+
For a character you chat with: the community's 大肥鱼, or any persona. Turn on the
|
|
69
|
+
companion switch on the settings page, or set `companion: true`.
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+
- **Three more types for the character's own life** ([SKILL.md §2.2](https://github.com/tinqiao-oss/engramory/blob/master/SKILL.md)):
|
|
74
|
+
`moment`, something you shared, with its date, folded into a monthly archive when
|
|
75
|
+
the index fills; `upcoming`, something coming up in your life, asked about once its
|
|
76
|
+
date passes and rewritten as a moment once you say how it went; `self`, a change in
|
|
77
|
+
the character itself, such as a nickname. A moment or self note is deleted only when
|
|
78
|
+
you ask it to forget.
|
|
79
|
+
- **Recall in character.** Even a greeting may call for recall, and what it remembered,
|
|
80
|
+
or failed to save, is told in the character's voice, without naming files or tools.
|
|
81
|
+
- **The persona preset needs the file tools.** The memory arrives even under a preset
|
|
82
|
+
that turns optional context off (dsh's `minimal`, for one). To save notes, though, the
|
|
83
|
+
preset needs dsh's file tools and the skill tool; a preset with only a shell reads the
|
|
84
|
+
memory, and its writes go past the cap.
|
|
85
|
+
|
|
86
|
+
## Social mode
|
|
87
|
+
|
|
88
|
+
A choice inside companion mode, for a character other people can talk to as well, such
|
|
89
|
+
as one wired to QQ, WeChat, Douyin or Bilibili through a bridge plugin. Choose *Social*
|
|
90
|
+
under *Memory access* on the settings page, or set `audience: social`. If only you talk
|
|
91
|
+
to this dsh, keep the default, *Private*.
|
|
92
|
+
|
|
93
|
+
With it on, **only your own conversations get the memory**: one is yours when you have
|
|
94
|
+
typed in it in dsh's own window (the desktop app or `dsh web`) and nobody else has.
|
|
95
|
+
A subagent goes with its parent. Messages from a bridge plugin (unless it marks them as
|
|
96
|
+
the owner's, below), `dsh headless`, other programs, and terminal or editor clients
|
|
97
|
+
count as someone else's. Once anyone else has written in a conversation it stays
|
|
98
|
+
theirs, and the memory already put into it stays in its history.
|
|
99
|
+
|
|
100
|
+
Someone else's conversation gets no index and is not told where the store is; dsh's
|
|
101
|
+
file tools there may name files only (every directory is refused), and any path into
|
|
102
|
+
a store is refused however it is spelled. This is **not** a security boundary: a shell
|
|
103
|
+
tool reads any file, and another profile on the same account can read the store too.
|
|
104
|
+
Real isolation needs filesystem permissions or a sandbox. A custom `skill` (see
|
|
105
|
+
[Configuration](#configuration)) reaches every conversation as written, someone else's
|
|
106
|
+
included, so if it says where the store is, they are told too.
|
|
107
|
+
|
|
108
|
+
### For bridge authors
|
|
109
|
+
|
|
110
|
+
With social mode on, every message a bridge submits counts as someone else's. For a
|
|
111
|
+
message from the owner's own account (their private QQ chat with the character, say),
|
|
112
|
+
put a `speaker` on its source:
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
agent.followup(createUserMessage({
|
|
116
|
+
content: [{ type: 'text', text }],
|
|
117
|
+
source: { kind: 'plugin:your-bridge', speaker: { role: 'owner' } },
|
|
118
|
+
}))
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
| `speaker.role` | Meaning |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `owner` | The owner wrote it: it comes from the account the user set as theirs in your bridge. |
|
|
124
|
+
| `guest` | Someone else wrote it, the same as no `speaker` at all. |
|
|
125
|
+
| `none` | Nobody wrote it: your plugin's own report, reminder or notice. It does not make the owner's conversation someone else's. |
|
|
126
|
+
|
|
127
|
+
In a group chat, add `chat: 'group'` (`{ role: 'owner', chat: 'group' }`): the whole
|
|
128
|
+
group reads the reply, so the conversation counts as someone else's even while only the
|
|
129
|
+
owner has spoken in it. A private chat may say `chat: 'private'` or leave it out; any
|
|
130
|
+
other value counts as a group. A group conversation stays someone else's once anyone else in it
|
|
131
|
+
speaks. A program that talks to dsh only through dsh web's API cannot set a source, so its messages count
|
|
132
|
+
as someone else's; if it sends `clientTimeZone` with a prompt it is taken for the
|
|
133
|
+
owner, so a program forwarding other people's messages must leave it out.
|
|
134
|
+
|
|
135
|
+
## Settings page and memory page
|
|
136
|
+
|
|
137
|
+

|
|
138
|
+
|
|
139
|
+
- **Settings page:** on dsh's *Plugins* page, open *Engramory memory* to set companion
|
|
140
|
+
mode, memory access and the index cap. Saving goes through dsh's own profile editor,
|
|
141
|
+
which writes your profile's `cordis.patch.yml` and reloads the plugin. Only you, signed
|
|
142
|
+
in, can call it, so an agent cannot use it to switch social mode off.
|
|
143
|
+
- **Memory page:** *Memory* in the sidebar. It lists the global store and each
|
|
144
|
+
workspace's project store (with an absolute `indexPath`, that store alone; with a
|
|
145
|
+
relative one, none), with each index's size against the cap, its notes' names
|
|
146
|
+
by type, and its archive. Each store comes with a check-up: the index's links to
|
|
147
|
+
files that are not there, the notes not in the index (recall starts from the index, so
|
|
148
|
+
the AI will not find them unless another note links to them), and notes with no type.
|
|
149
|
+
It goes by file names and the index's links alone, never through a symbolic link, and
|
|
150
|
+
is skipped when the index is over the cap, there is too much to check, or a file cannot
|
|
151
|
+
be read; `engramory_doctor.py` still does the full check.
|
|
152
|
+
Read-only, never a note's text; a name, *Open the index* and
|
|
153
|
+
*Open the folder* open on the machine dsh runs on; a machine with no desktop (a
|
|
154
|
+
headless server, a session over SSH) shows none of them. The switches at the top
|
|
155
|
+
(companion mode, and memory access once it is on) save as you flip them. Below them
|
|
156
|
+
is a short *How to use it*, open while there is no memory yet; at the foot, where to
|
|
157
|
+
send feedback: a new GitHub issue (its body pre-filled with the plugin's version and the
|
|
158
|
+
OS family, no path and no note), or an email, with a button that copies the address.
|
|
159
|
+
|
|
160
|
+
## Configuration
|
|
161
|
+
|
|
162
|
+
Settings the page does not cover go in your profile's `cordis.patch.yml`. Patch the
|
|
163
|
+
EXISTING row by id; a second `- insert:` adds another engramory row and leaves the old
|
|
164
|
+
caps in force. A patch replaces the row's whole `config`, so list every key you keep:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
- id: engramory
|
|
168
|
+
config:
|
|
169
|
+
indexName: MEMORY.md
|
|
170
|
+
maxLines: 200
|
|
171
|
+
maxBytes: 25600
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
| Field | Default | Meaning |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `indexName` | `MEMORY.md` | The file name treated as the index. The cap matches it case-insensitively; putting the index into context needs the exact name on a case-sensitive filesystem (Linux, say). |
|
|
177
|
+
| `maxLines` | `200` | Line cap for the index. |
|
|
178
|
+
| `maxBytes` | `25600` | UTF-8 byte cap for the index (25 KB). |
|
|
179
|
+
| `indexPath` | unset | The one index to use: absolute, or relative to the session's directory. Unset, a `MEMORY.md` in any project is capped as an index; a store outside the default places also needs it to be found. |
|
|
180
|
+
| `registerSkill` | `true` | `false` skips the built-in rules; the cap and the index in context stay. |
|
|
181
|
+
| `injectIndex` | `true` | `false` stops putting the index into context; the AI reads it instead. |
|
|
182
|
+
| `compactionReminder` | `true` | `false` stops the reminder to save before dsh compacts. The plugin works out where dsh will compact from dsh's own compaction settings (on dsh 0.2 with DeepSeek's defaults, about 69% of the window, not 80%) and reminds at 85% of that. A best effort: a conversation that grows past the gap in one step goes unreminded; with no compaction, or automatic compaction off, there is no reminder. |
|
|
183
|
+
| `language` | dsh's | `zh` (or `zh-CN` and other regional forms) writes the store in Chinese: note names, headings such as `## 用户`, the Why/How labels. Any other string is English; a value that is not a string, or is empty, counts as unset. Unset, it follows dsh's language; a change applies once dsh restarts. Frontmatter keys and `type:` values stay English, so every host reads the store. |
|
|
184
|
+
| `companion` | `false` | `true` turns companion mode on. |
|
|
185
|
+
| `audience` | `private` | With companion mode on, `social` turns social mode on. |
|
|
186
|
+
| `skill` | built-in | Your own markdown in place of the built-in rules; it must then say where the store is. In social mode, others' conversations see it too. |
|
|
187
|
+
|
|
188
|
+
## How the cap decides
|
|
189
|
+
|
|
190
|
+
| Case | Decision |
|
|
191
|
+
|---|---|
|
|
192
|
+
| The index ends within the caps | allow |
|
|
193
|
+
| The write grows the index past a cap | **deny**, with the numbers and what to compact |
|
|
194
|
+
| The index is over a cap and the write shrinks it or keeps its size | allow, so compaction can go step by step (210 → 205 → 198) |
|
|
195
|
+
| A partial edit whose result can be worked out: `edit` (`old_string`/`new_string`), `str_replace_editor`'s replace (`old_str`/`new_str`) and `insert` | its result is worked out first, then judged as above; each tool from the arguments it uses and the way it matches |
|
|
196
|
+
| A partial edit whose result cannot be worked out (arguments missing or not recognised) | deny on an over-cap index, else allow |
|
|
197
|
+
| The index is missing, unreadable, or not a regular file | a whole-file write is judged as if it were empty; a partial edit passes |
|
|
198
|
+
| The index is past the read limit (`min(16 MiB, max(1 MiB, 4 × maxBytes))`) | not read whole: a whole-file write is judged on bytes alone; a partial edit passes |
|
|
199
|
+
| Reads, writes to other files, unknown tools or arguments | allow; reads are never blocked, even over the cap |
|
|
200
|
+
|
|
201
|
+
Lines and bytes are judged apart: only a dimension that is over its cap AND grew is
|
|
202
|
+
refused, so a write with fewer bytes but lines grown past the cap is still refused.
|
|
203
|
+
The line count ignores a trailing newline, so an index exactly at the cap stays
|
|
204
|
+
writable. This table is pinned by `node --test` in CI.
|
|
205
|
+
|
|
206
|
+
## Known limits
|
|
207
|
+
|
|
208
|
+
- **Only dsh's file tools are capped:** `write`, `edit`, and the `str_replace_editor`
|
|
209
|
+
some versions and presets carry; a tool of the same name from another plugin is
|
|
210
|
+
judged the same way. Shell tools, MCP file tools and external editors go past it: run
|
|
211
|
+
`engramory_check.py` after editing the index and `engramory_doctor.py` now and then.
|
|
212
|
+
- **Stores are found only where the installer puts them.** Elsewhere, or for a project
|
|
213
|
+
store that links out of the project, set `indexPath`. A project's root is found by
|
|
214
|
+
its `.git` only, and a project store created mid-session can take ten seconds to appear.
|
|
215
|
+
- **Social mode knows you by what dsh's window sends.** Apart from a bridge's owner
|
|
216
|
+
messages, only what you type in dsh's own window is yours, and not when the browser's
|
|
217
|
+
time zone cannot be read. A kind of
|
|
218
|
+
message a later dsh adds counts as someone else's until this plugin knows it: your
|
|
219
|
+
conversation may lose the memory, never the other way round.
|
|
220
|
+
- **What the memory page opens is checked by path.** dsh's opener resolves the path once
|
|
221
|
+
more before the desktop opens it, so a process changing the store's files at that
|
|
222
|
+
moment could redirect what opens (as with dsh's own opener for any workspace file).
|
|
223
|
+
- **Experimental:** companion mode, social mode, and the settings and memory pages may
|
|
224
|
+
change in a minor version.
|
|
225
|
+
|
|
226
|
+
## Feedback
|
|
227
|
+
|
|
228
|
+
For a problem or an idea, [open an issue on GitHub](https://github.com/tinqiao-oss/engramory/issues/new)
|
|
229
|
+
or email engramory@agent.qq.com. Emails are sorted with the help of an AI assistant, and issues
|
|
230
|
+
are public: do not paste your memory notes into either.
|
|
231
|
+
|
|
232
|
+
## Versions
|
|
233
|
+
|
|
234
|
+
This package carries Engramory's version: `dsh-engramory@X.Y.Z` is the repo's
|
|
235
|
+
`vX.Y.Z`. The cap's decisions (the table above) and the settings outside the
|
|
236
|
+
experimental features change incompatibly only in a major version. See Engramory's
|
|
237
|
+
[Versioning](https://github.com/tinqiao-oss/engramory/blob/master/README.en.md#versioning); history is in the
|
|
238
|
+
[CHANGELOG](https://github.com/tinqiao-oss/engramory/blob/master/CHANGELOG.md).
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
MIT — see the [Engramory repository](https://github.com/tinqiao-oss/engramory).
|
package/README.md
CHANGED
|
@@ -1,137 +1,141 @@
|
|
|
1
|
-
**简体中文** | [English](README.en.md)
|
|
2
|
-
|
|
3
|
-
# dsh-engramory
|
|
4
|
-
|
|
5
|
-
[](https://unstone.github.io/dsh-xray/registry.html#tinqiao-oss__engramory)
|
|
6
|
-
|
|
7
|
-
给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)用的长期记忆插件。AI 记住的东西存成一个个普通 markdown 文件,你随时能打开看、能改。它是 [Engramory](https://github.com/tinqiao-oss/engramory) 的 dsh 专用版:Engramory 本身是通用的 AI agent 记忆,Claude Code、Codex 等也能用同一个库。
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
## 它做什么
|
|
12
|
-
|
|
13
|
-
- **每轮自动带上记忆索引。** 索引 `MEMORY.md` 只列笔记名字,插件每一步都把它放进上下文,AI 不用先读文件就知道自己记过什么,要细节再打开那条笔记。写入后下一轮就能看到;超出上限的部分不带上,并提醒 AI 压缩。
|
|
14
|
-
- **索引有硬上限。** 默认 200 行 / 25 KB。AI 用 dsh 的文件工具写索引时,只要插件算得出写完的样子,会超上限就在写入前拒绝,让它先压缩;压缩照样放行。细节见[上限怎么判](#上限怎么判)。
|
|
15
|
-
- **自带记忆规则。** 记什么、怎么记、什么时候清理,这套规则(skill)随插件注册,不用另外装文件。
|
|
16
|
-
- **快压缩时提醒 AI 存记忆。** dsh 会在对话太长时把前面压缩成摘要,摘要不一定留得下以后还用得着的东西。对话快到 dsh 要压缩的地方时,插件提醒 AI 把值得长期记住的先存进记忆;提醒的是 AI,不打扰你。
|
|
17
|
-
- **侧栏多一个「记忆」页。** 只读,列出笔记名字,点名字用电脑上的默认程序打开;顺带体检,标出索引里的坏链接和没进索引的笔记。
|
|
18
|
-
|
|
19
|
-
## 安装
|
|
20
|
-
|
|
21
|
-
需要 Node.js 18+,PATH 里要有 `pnpm`(dsh 的插件命令要用)。dsh 桌面版也可以在插件页搜 `dsh-engramory` 安装。
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
dsh plugin --profile <名字> add dsh-engramory
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
卸载把 `add` 换成 `remove`。兼容的 dsh 版本见 [`package.json`](https://github.com/tinqiao-oss/engramory/blob/master/adapters/dsh/plugin/package.json) 里的 `dsh.compatibility.dshReleases`,没列出的版本未经验证。
|
|
28
|
-
|
|
29
|
-
**记忆存在哪:**
|
|
30
|
-
|
|
31
|
-
- **全局库** `~/.dsh/.engramory-memory/`(设了 `$DSH_HOME` 就在它下面)。只装插件就用这一个,AI 第一次保存时自己建。
|
|
32
|
-
- **项目库**(可选)是项目根目录下的 `.engramory-memory/`,只能由你来建:在 Engramory 仓库里运行 `python tools/engramory_init.py dsh --project-root <项目>`,它会顺手加进 `.gitignore`。有项目库时,只在这个项目成立的事记在那里,其余仍记全局库。
|
|
33
|
-
|
|
34
|
-
一个库只能有一个 AI 写,同时写会互相覆盖;想让别的 AI 也用,让它只读,见[单写者、多读者](https://github.com/tinqiao-oss/engramory/blob/master/adapters/reader/README.md)。记忆是明文,带着本机细节。放在项目的 git 仓库里必须 git-ignore;给记忆库单独开一个私有仓没问题。
|
|
35
|
-
|
|
36
|
-
**不装插件也能用:** `python tools/engramory_init.py dsh --install-skill` 把记忆规则写进 `$DSH_HOME/AGENTS.md`、把 skill 装进 `$DSH_HOME/skills/engramory/`(`$DSH_HOME` 默认 `~/.dsh`),并建好全局库。AI 照样会记,但索引要它自己去读,上限只靠它写完后自觉运行 `engramory_check.py`。
|
|
37
|
-
|
|
38
|
-
## 大肥鱼模式
|
|
39
|
-
|
|
40
|
-
给陪你聊天的角色用(社区里的大肥鱼,或任何人设)。在设置页打开「大肥鱼模式」,或在配置里写 `companion: true`。
|
|
41
|
-
|
|
42
|
-

|
|
43
|
-
|
|
44
|
-
- **多记三类角色自己的事**([SKILL.md §2.2](https://github.com/tinqiao-oss/engramory/blob/master/SKILL.md)):`moment`(经历)是和你一起经历的事,带日期,索引满了按月归档;`upcoming`(约定)是你将要发生的事,日子过了会问起结果,问到了再改写成经历;`self`(我自己)是角色自己的变化,比如外号。经历和我自己只有你说忘掉才删。
|
|
45
|
-
- **用角色口吻回忆。** 打招呼也可能让它想起点什么;记住了、没记上,都用角色的话说,不提文件和工具。
|
|
46
|
-
- **人设预设要留着文件工具。** 记忆总会送到,哪怕预设关掉了可选上下文(比如 dsh 的 `minimal`)。但角色要保存记忆,预设得带上 dsh 的文件工具和 skill 工具;只给了 shell 的预设读得到记忆,写入却绕过上限。
|
|
47
|
-
|
|
48
|
-
## 社交模式
|
|
49
|
-
|
|
50
|
-
大肥鱼模式里的一个选项,给别人也能聊的角色用,比如通过接入插件接到 QQ、微信、抖音、B 站的角色。在设置页「记忆权限」选「社交」,或写 `audience: social`。只有你自己跟这个 dsh 聊,就保持默认的「专属」。
|
|
51
|
-
|
|
52
|
-
打开后,**只有你本人的会话拿得到记忆**:你在 dsh 自己的窗口(桌面版或 `dsh web`)里亲手发过消息、且没有别人说过话的会话才算你的。子 agent 跟着它的父会话算。接入插件转来的消息(标明是主人的除外,见下文)、`dsh headless`、外部程序、终端和编辑器客户端发的都算别人的;一个会话只要有别人说过话,就一直算别人的,之前已经带进去的记忆仍留在对话记录里。
|
|
53
|
-
|
|
54
|
-
别人的会话拿不到索引,也不知道记忆库在哪;dsh 的文件工具只能指名文件(任何目录都不让列),指向记忆库的路径不管怎么写都拒绝。这**不是**安全边界:shell 工具照样能读任何文件,同一账户下的另一个 profile 也读得到。要真正隔离,得靠文件权限或沙箱。自定义的 `skill`(见[配置](#配置))会原样给所有会话,别人的也一样,里面写了库在哪,别人也看得到。
|
|
55
|
-
|
|
56
|
-
### 给接入插件作者
|
|
57
|
-
|
|
58
|
-
社交模式下,接入插件转进来的消息默认都算别人的。来自主人自己账号的消息(比如主人和角色的 QQ 私聊),在来源章上标 `speaker`:
|
|
59
|
-
|
|
60
|
-
```js
|
|
61
|
-
agent.followup(createUserMessage({
|
|
62
|
-
content: [{ type: 'text', text }],
|
|
63
|
-
source: { kind: 'plugin:your-bridge', speaker: { role: 'owner' } },
|
|
64
|
-
}))
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
| `speaker.role` | 含义 |
|
|
68
|
-
|---|---|
|
|
69
|
-
| `owner` | 主人发的:来自用户在你插件里设为"自己"的那个账号。 |
|
|
70
|
-
| `guest` | 别人发的,和不写 `speaker` 一样。 |
|
|
71
|
-
| `none` | 不是人发的:你插件自己的汇报、提醒或通知,不会让主人的会话变成别人的。 |
|
|
72
|
-
|
|
73
|
-
群聊里的消息再加上 `chat: 'group'`(如 `{ role: 'owner', chat: 'group' }`):回复全群都看得到,所以就算群里只有主人开过口,这个会话也算别人的;私聊写 `chat: 'private'` 或不写,`chat` 是别的值都按群聊算。群聊里只要有别人说话,那个会话就一直算别人的。只通过 dsh web 接口发消息的程序设不了来源章,消息都算别人的;它若带上 `clientTimeZone`,会被当成主人,所以替别人转发消息的程序不要带。
|
|
74
|
-
|
|
75
|
-
## 设置页与记忆页
|
|
76
|
-
|
|
77
|
-

|
|
78
|
-
|
|
79
|
-
- **设置页**:dsh 的「插件」页里点开「Engramory 记忆」,能改大肥鱼模式、记忆权限和索引上限。保存走 dsh 自己的配置服务,写进你 profile 的 `cordis.patch.yml` 并重新加载插件。这个接口只有登录了的你能调,AI 没法调用它关掉社交模式。
|
|
80
|
-
- **记忆页**:左侧栏「记忆」。列出全局库和各工作区的项目库(设了绝对路径的 `indexPath` 时只列那一个,相对路径则列不出),显示索引离上限还有多远、按类型分组的笔记名字和归档。每个库附一段体检:索引里指向不存在的文件、不在索引里的笔记(AI 回忆从索引开始,除非别的笔记链到它们,否则通常找不到)、没写类型的笔记。体检只按文件名和索引里的链接判断,不顺着符号链接走;索引超上限、要核对的太多或有文件读不了时不做,完整检查仍用 `engramory_doctor.py`。只读,不显示正文;点名字、「打开索引」「打开文件夹」都在运行 dsh 的那台机器上打开;没有桌面的机器(无界面服务器、SSH
|
|
81
|
-
|
|
82
|
-
## 配置
|
|
83
|
-
|
|
84
|
-
设置页没有的配置,写在你 profile 的 `cordis.patch.yml` 里:按 id 改已有的那一行,别再写一个 `- insert:`(那会多出第二行 engramory,旧上限照样生效)。一次 patch 会整体替换 `config`,要保留的键都列上:
|
|
85
|
-
|
|
86
|
-
```yaml
|
|
87
|
-
- id: engramory
|
|
88
|
-
config:
|
|
89
|
-
indexName: MEMORY.md
|
|
90
|
-
maxLines: 200
|
|
91
|
-
maxBytes: 25600
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
| 字段 | 默认值 | 含义 |
|
|
95
|
-
|---|---|---|
|
|
96
|
-
| `indexName` | `MEMORY.md` | 哪个文件名算索引。卡上限时不分大小写;每轮带上索引时,在区分大小写的系统(如 Linux)上要和文件名完全一致。 |
|
|
97
|
-
| `maxLines` | `200` | 索引行数上限。 |
|
|
98
|
-
| `maxBytes` | `25600` | 索引字节上限(25 KB)。 |
|
|
99
|
-
| `indexPath` | 不设 | 只认这一个索引:绝对路径,或相对会话目录。不设时,任何项目里叫 `MEMORY.md` 的文件都按索引卡上限;记忆库不在默认位置时也要设它,否则不会自动带上。 |
|
|
100
|
-
| `registerSkill` | `true` | `false`:不注册内置的记忆规则;上限和每轮带上索引照旧。 |
|
|
101
|
-
| `injectIndex` | `true` | `false`:不再每轮带上索引,改由 AI 自己读。 |
|
|
102
|
-
| `compactionReminder` | `true` | `false`:快压缩时不再提醒 AI 存记忆。插件照 dsh 的压缩设置算出它会在哪压缩(dsh 0.2 加 DeepSeek 默认约在窗口的 69%,不是 80%),到那一点的 85% 时提醒。尽力而为:一步就涨过这段余量的对话等不到提醒;没装压缩或关了自动压缩时不提醒。 |
|
|
103
|
-
| `language` | 跟随 dsh | `zh`(`zh-CN` 等也算)用中文写记忆(笔记名、`## 用户` 这类标题、**为什么:**/**怎么用:**),其他字符串用英文;不是字符串或为空,当作没设。不设就跟 dsh 的语言,改了要重启 dsh。frontmatter 的键和 `type:` 取值始终是英文,别的宿主照样能读。 |
|
|
104
|
-
| `companion` | `false` | `true` 打开大肥鱼模式。 |
|
|
105
|
-
| `audience` | `private` | 大肥鱼模式下设 `social` 打开社交模式。 |
|
|
106
|
-
| `skill` | 内置 | 用你自己的 markdown 换掉内置规则,这时得自己写明记忆库在哪。社交模式下别人的会话也看得到它。 |
|
|
107
|
-
|
|
108
|
-
## 上限怎么判
|
|
109
|
-
|
|
110
|
-
| 情况 | 结果 |
|
|
111
|
-
|---|---|
|
|
112
|
-
| 写完后索引在上限内 | 放行 |
|
|
113
|
-
| 写入让索引变大,并超过上限 | **拒绝**,报出数字,提示压缩什么 |
|
|
114
|
-
| 索引已超限,写入让它变小或不变 | 放行(压缩可以一步步来:210 → 205 → 198) |
|
|
115
|
-
| 算得出结果的局部编辑:`edit`(`old_string`/`new_string`)、`str_replace_editor` 的替换(`old_str`/`new_str`)和 `insert` | 先算出改完的结果,再按上面三条判;每个工具都只按它自己会用的参数和匹配方式算 |
|
|
116
|
-
| 算不出结果的局部编辑(参数不全或认不出) | 索引已超限时拒绝,否则放行 |
|
|
117
|
-
| 索引不存在、读不到,或不是普通文件 | 整文件写入当它是空的来判;局部编辑放行 |
|
|
118
|
-
| 索引大到超过读取上限(`min(16 MiB, max(1 MiB, 4 × maxBytes))`) | 不整份读:整文件写入只按字节比大小;局部编辑放行 |
|
|
119
|
-
| 读文件、写别的文件、不认识的工具或参数 | 放行;索引超限也不挡读取 |
|
|
120
|
-
|
|
121
|
-
行数和字节分开判:只拒绝既超上限、又比原来变大的那一项,所以字节变少但行数涨过上限的写入照样被拒。行数不算末尾换行,正好卡在上限的索引还能写。这张表由 CI 里的 `node --test` 固定。
|
|
122
|
-
|
|
123
|
-
## 已知限制
|
|
124
|
-
|
|
125
|
-
- **只拦 dsh 的文件工具**:`write`、`edit`,以及有的版本和预设带的 `str_replace_editor`;别的插件提供的同名工具也照样判。shell、MCP 文件工具和外部编辑器写入都绕过上限;改完索引跑 `engramory_check.py`,定期跑 `engramory_doctor.py`。
|
|
126
|
-
- **记忆库只在默认位置自动找到。** 放在别处,或项目库是指向项目外的链接,要设 `indexPath`;项目根只按 `.git` 认;会话中途新建的项目库最多十秒后才出现。
|
|
127
|
-
- **社交模式靠 dsh 窗口发来的信息认你。** 除了接入插件标明的主人消息,只有 dsh 自己窗口里打的字算你的;浏览器读不出时区时也认不出。dsh 以后新加的消息种类,插件认识之前都算别人的:你的会话可能拿不到记忆,但不会把记忆漏给别人。
|
|
128
|
-
- **记忆页打开文件前按路径检查。** dsh 的打开功能拿到路径后还会再解析一次,如果恰好在这一刻有程序改动记忆库里的文件,桌面最终打开的可能是别的东西(dsh 自己打开工作区文件也是这样)。
|
|
129
|
-
- **实验性功能**:大肥鱼模式、社交模式、设置页和记忆页在小版本里也可能改。
|
|
130
|
-
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
##
|
|
136
|
-
|
|
137
|
-
|
|
1
|
+
**简体中文** | [English](README.en.md)
|
|
2
|
+
|
|
3
|
+
# dsh-engramory
|
|
4
|
+
|
|
5
|
+
[](https://unstone.github.io/dsh-xray/registry.html#tinqiao-oss__engramory)
|
|
6
|
+
|
|
7
|
+
给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)用的长期记忆插件。AI 记住的东西存成一个个普通 markdown 文件,你随时能打开看、能改。它是 [Engramory](https://github.com/tinqiao-oss/engramory) 的 dsh 专用版:Engramory 本身是通用的 AI agent 记忆,Claude Code、Codex 等也能用同一个库。
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## 它做什么
|
|
12
|
+
|
|
13
|
+
- **每轮自动带上记忆索引。** 索引 `MEMORY.md` 只列笔记名字,插件每一步都把它放进上下文,AI 不用先读文件就知道自己记过什么,要细节再打开那条笔记。写入后下一轮就能看到;超出上限的部分不带上,并提醒 AI 压缩。
|
|
14
|
+
- **索引有硬上限。** 默认 200 行 / 25 KB。AI 用 dsh 的文件工具写索引时,只要插件算得出写完的样子,会超上限就在写入前拒绝,让它先压缩;压缩照样放行。细节见[上限怎么判](#上限怎么判)。
|
|
15
|
+
- **自带记忆规则。** 记什么、怎么记、什么时候清理,这套规则(skill)随插件注册,不用另外装文件。
|
|
16
|
+
- **快压缩时提醒 AI 存记忆。** dsh 会在对话太长时把前面压缩成摘要,摘要不一定留得下以后还用得着的东西。对话快到 dsh 要压缩的地方时,插件提醒 AI 把值得长期记住的先存进记忆;提醒的是 AI,不打扰你。
|
|
17
|
+
- **侧栏多一个「记忆」页。** 只读,列出笔记名字,点名字用电脑上的默认程序打开;顺带体检,标出索引里的坏链接和没进索引的笔记。
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
需要 Node.js 18+,PATH 里要有 `pnpm`(dsh 的插件命令要用)。dsh 桌面版也可以在插件页搜 `dsh-engramory` 安装。
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
dsh plugin --profile <名字> add dsh-engramory
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
卸载把 `add` 换成 `remove`。兼容的 dsh 版本见 [`package.json`](https://github.com/tinqiao-oss/engramory/blob/master/adapters/dsh/plugin/package.json) 里的 `dsh.compatibility.dshReleases`,没列出的版本未经验证。
|
|
28
|
+
|
|
29
|
+
**记忆存在哪:**
|
|
30
|
+
|
|
31
|
+
- **全局库** `~/.dsh/.engramory-memory/`(设了 `$DSH_HOME` 就在它下面)。只装插件就用这一个,AI 第一次保存时自己建。
|
|
32
|
+
- **项目库**(可选)是项目根目录下的 `.engramory-memory/`,只能由你来建:在 Engramory 仓库里运行 `python tools/engramory_init.py dsh --project-root <项目>`,它会顺手加进 `.gitignore`。有项目库时,只在这个项目成立的事记在那里,其余仍记全局库。
|
|
33
|
+
|
|
34
|
+
一个库只能有一个 AI 写,同时写会互相覆盖;想让别的 AI 也用,让它只读,见[单写者、多读者](https://github.com/tinqiao-oss/engramory/blob/master/adapters/reader/README.md)。记忆是明文,带着本机细节。放在项目的 git 仓库里必须 git-ignore;给记忆库单独开一个私有仓没问题。
|
|
35
|
+
|
|
36
|
+
**不装插件也能用:** `python tools/engramory_init.py dsh --install-skill` 把记忆规则写进 `$DSH_HOME/AGENTS.md`、把 skill 装进 `$DSH_HOME/skills/engramory/`(`$DSH_HOME` 默认 `~/.dsh`),并建好全局库。AI 照样会记,但索引要它自己去读,上限只靠它写完后自觉运行 `engramory_check.py`。
|
|
37
|
+
|
|
38
|
+
## 大肥鱼模式
|
|
39
|
+
|
|
40
|
+
给陪你聊天的角色用(社区里的大肥鱼,或任何人设)。在设置页打开「大肥鱼模式」,或在配置里写 `companion: true`。
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
- **多记三类角色自己的事**([SKILL.md §2.2](https://github.com/tinqiao-oss/engramory/blob/master/SKILL.md)):`moment`(经历)是和你一起经历的事,带日期,索引满了按月归档;`upcoming`(约定)是你将要发生的事,日子过了会问起结果,问到了再改写成经历;`self`(我自己)是角色自己的变化,比如外号。经历和我自己只有你说忘掉才删。
|
|
45
|
+
- **用角色口吻回忆。** 打招呼也可能让它想起点什么;记住了、没记上,都用角色的话说,不提文件和工具。
|
|
46
|
+
- **人设预设要留着文件工具。** 记忆总会送到,哪怕预设关掉了可选上下文(比如 dsh 的 `minimal`)。但角色要保存记忆,预设得带上 dsh 的文件工具和 skill 工具;只给了 shell 的预设读得到记忆,写入却绕过上限。
|
|
47
|
+
|
|
48
|
+
## 社交模式
|
|
49
|
+
|
|
50
|
+
大肥鱼模式里的一个选项,给别人也能聊的角色用,比如通过接入插件接到 QQ、微信、抖音、B 站的角色。在设置页「记忆权限」选「社交」,或写 `audience: social`。只有你自己跟这个 dsh 聊,就保持默认的「专属」。
|
|
51
|
+
|
|
52
|
+
打开后,**只有你本人的会话拿得到记忆**:你在 dsh 自己的窗口(桌面版或 `dsh web`)里亲手发过消息、且没有别人说过话的会话才算你的。子 agent 跟着它的父会话算。接入插件转来的消息(标明是主人的除外,见下文)、`dsh headless`、外部程序、终端和编辑器客户端发的都算别人的;一个会话只要有别人说过话,就一直算别人的,之前已经带进去的记忆仍留在对话记录里。
|
|
53
|
+
|
|
54
|
+
别人的会话拿不到索引,也不知道记忆库在哪;dsh 的文件工具只能指名文件(任何目录都不让列),指向记忆库的路径不管怎么写都拒绝。这**不是**安全边界:shell 工具照样能读任何文件,同一账户下的另一个 profile 也读得到。要真正隔离,得靠文件权限或沙箱。自定义的 `skill`(见[配置](#配置))会原样给所有会话,别人的也一样,里面写了库在哪,别人也看得到。
|
|
55
|
+
|
|
56
|
+
### 给接入插件作者
|
|
57
|
+
|
|
58
|
+
社交模式下,接入插件转进来的消息默认都算别人的。来自主人自己账号的消息(比如主人和角色的 QQ 私聊),在来源章上标 `speaker`:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
agent.followup(createUserMessage({
|
|
62
|
+
content: [{ type: 'text', text }],
|
|
63
|
+
source: { kind: 'plugin:your-bridge', speaker: { role: 'owner' } },
|
|
64
|
+
}))
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| `speaker.role` | 含义 |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `owner` | 主人发的:来自用户在你插件里设为"自己"的那个账号。 |
|
|
70
|
+
| `guest` | 别人发的,和不写 `speaker` 一样。 |
|
|
71
|
+
| `none` | 不是人发的:你插件自己的汇报、提醒或通知,不会让主人的会话变成别人的。 |
|
|
72
|
+
|
|
73
|
+
群聊里的消息再加上 `chat: 'group'`(如 `{ role: 'owner', chat: 'group' }`):回复全群都看得到,所以就算群里只有主人开过口,这个会话也算别人的;私聊写 `chat: 'private'` 或不写,`chat` 是别的值都按群聊算。群聊里只要有别人说话,那个会话就一直算别人的。只通过 dsh web 接口发消息的程序设不了来源章,消息都算别人的;它若带上 `clientTimeZone`,会被当成主人,所以替别人转发消息的程序不要带。
|
|
74
|
+
|
|
75
|
+
## 设置页与记忆页
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
- **设置页**:dsh 的「插件」页里点开「Engramory 记忆」,能改大肥鱼模式、记忆权限和索引上限。保存走 dsh 自己的配置服务,写进你 profile 的 `cordis.patch.yml` 并重新加载插件。这个接口只有登录了的你能调,AI 没法调用它关掉社交模式。
|
|
80
|
+
- **记忆页**:左侧栏「记忆」。列出全局库和各工作区的项目库(设了绝对路径的 `indexPath` 时只列那一个,相对路径则列不出),显示索引离上限还有多远、按类型分组的笔记名字和归档。每个库附一段体检:索引里指向不存在的文件、不在索引里的笔记(AI 回忆从索引开始,除非别的笔记链到它们,否则通常找不到)、没写类型的笔记。体检只按文件名和索引里的链接判断,不顺着符号链接走;索引超上限、要核对的太多或有文件读不了时不做,完整检查仍用 `engramory_doctor.py`。只读,不显示正文;点名字、「打开索引」「打开文件夹」都在运行 dsh 的那台机器上打开;没有桌面的机器(无界面服务器、SSH 连过去的)不显示这些按钮。顶部的开关(大肥鱼模式,打开后还有记忆权限)拨了就保存。下面有一段「怎么用」,还没有记忆时自动展开;页底是反馈入口:到 GitHub 提 issue(正文预先写好插件版本和系统类型,不带路径和笔记),或发邮件,地址可以一键复制。
|
|
81
|
+
|
|
82
|
+
## 配置
|
|
83
|
+
|
|
84
|
+
设置页没有的配置,写在你 profile 的 `cordis.patch.yml` 里:按 id 改已有的那一行,别再写一个 `- insert:`(那会多出第二行 engramory,旧上限照样生效)。一次 patch 会整体替换 `config`,要保留的键都列上:
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
- id: engramory
|
|
88
|
+
config:
|
|
89
|
+
indexName: MEMORY.md
|
|
90
|
+
maxLines: 200
|
|
91
|
+
maxBytes: 25600
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| 字段 | 默认值 | 含义 |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `indexName` | `MEMORY.md` | 哪个文件名算索引。卡上限时不分大小写;每轮带上索引时,在区分大小写的系统(如 Linux)上要和文件名完全一致。 |
|
|
97
|
+
| `maxLines` | `200` | 索引行数上限。 |
|
|
98
|
+
| `maxBytes` | `25600` | 索引字节上限(25 KB)。 |
|
|
99
|
+
| `indexPath` | 不设 | 只认这一个索引:绝对路径,或相对会话目录。不设时,任何项目里叫 `MEMORY.md` 的文件都按索引卡上限;记忆库不在默认位置时也要设它,否则不会自动带上。 |
|
|
100
|
+
| `registerSkill` | `true` | `false`:不注册内置的记忆规则;上限和每轮带上索引照旧。 |
|
|
101
|
+
| `injectIndex` | `true` | `false`:不再每轮带上索引,改由 AI 自己读。 |
|
|
102
|
+
| `compactionReminder` | `true` | `false`:快压缩时不再提醒 AI 存记忆。插件照 dsh 的压缩设置算出它会在哪压缩(dsh 0.2 加 DeepSeek 默认约在窗口的 69%,不是 80%),到那一点的 85% 时提醒。尽力而为:一步就涨过这段余量的对话等不到提醒;没装压缩或关了自动压缩时不提醒。 |
|
|
103
|
+
| `language` | 跟随 dsh | `zh`(`zh-CN` 等也算)用中文写记忆(笔记名、`## 用户` 这类标题、**为什么:**/**怎么用:**),其他字符串用英文;不是字符串或为空,当作没设。不设就跟 dsh 的语言,改了要重启 dsh。frontmatter 的键和 `type:` 取值始终是英文,别的宿主照样能读。 |
|
|
104
|
+
| `companion` | `false` | `true` 打开大肥鱼模式。 |
|
|
105
|
+
| `audience` | `private` | 大肥鱼模式下设 `social` 打开社交模式。 |
|
|
106
|
+
| `skill` | 内置 | 用你自己的 markdown 换掉内置规则,这时得自己写明记忆库在哪。社交模式下别人的会话也看得到它。 |
|
|
107
|
+
|
|
108
|
+
## 上限怎么判
|
|
109
|
+
|
|
110
|
+
| 情况 | 结果 |
|
|
111
|
+
|---|---|
|
|
112
|
+
| 写完后索引在上限内 | 放行 |
|
|
113
|
+
| 写入让索引变大,并超过上限 | **拒绝**,报出数字,提示压缩什么 |
|
|
114
|
+
| 索引已超限,写入让它变小或不变 | 放行(压缩可以一步步来:210 → 205 → 198) |
|
|
115
|
+
| 算得出结果的局部编辑:`edit`(`old_string`/`new_string`)、`str_replace_editor` 的替换(`old_str`/`new_str`)和 `insert` | 先算出改完的结果,再按上面三条判;每个工具都只按它自己会用的参数和匹配方式算 |
|
|
116
|
+
| 算不出结果的局部编辑(参数不全或认不出) | 索引已超限时拒绝,否则放行 |
|
|
117
|
+
| 索引不存在、读不到,或不是普通文件 | 整文件写入当它是空的来判;局部编辑放行 |
|
|
118
|
+
| 索引大到超过读取上限(`min(16 MiB, max(1 MiB, 4 × maxBytes))`) | 不整份读:整文件写入只按字节比大小;局部编辑放行 |
|
|
119
|
+
| 读文件、写别的文件、不认识的工具或参数 | 放行;索引超限也不挡读取 |
|
|
120
|
+
|
|
121
|
+
行数和字节分开判:只拒绝既超上限、又比原来变大的那一项,所以字节变少但行数涨过上限的写入照样被拒。行数不算末尾换行,正好卡在上限的索引还能写。这张表由 CI 里的 `node --test` 固定。
|
|
122
|
+
|
|
123
|
+
## 已知限制
|
|
124
|
+
|
|
125
|
+
- **只拦 dsh 的文件工具**:`write`、`edit`,以及有的版本和预设带的 `str_replace_editor`;别的插件提供的同名工具也照样判。shell、MCP 文件工具和外部编辑器写入都绕过上限;改完索引跑 `engramory_check.py`,定期跑 `engramory_doctor.py`。
|
|
126
|
+
- **记忆库只在默认位置自动找到。** 放在别处,或项目库是指向项目外的链接,要设 `indexPath`;项目根只按 `.git` 认;会话中途新建的项目库最多十秒后才出现。
|
|
127
|
+
- **社交模式靠 dsh 窗口发来的信息认你。** 除了接入插件标明的主人消息,只有 dsh 自己窗口里打的字算你的;浏览器读不出时区时也认不出。dsh 以后新加的消息种类,插件认识之前都算别人的:你的会话可能拿不到记忆,但不会把记忆漏给别人。
|
|
128
|
+
- **记忆页打开文件前按路径检查。** dsh 的打开功能拿到路径后还会再解析一次,如果恰好在这一刻有程序改动记忆库里的文件,桌面最终打开的可能是别的东西(dsh 自己打开工作区文件也是这样)。
|
|
129
|
+
- **实验性功能**:大肥鱼模式、社交模式、设置页和记忆页在小版本里也可能改。
|
|
130
|
+
|
|
131
|
+
## 反馈
|
|
132
|
+
|
|
133
|
+
遇到问题或有建议,到 [GitHub 提 issue](https://github.com/tinqiao-oss/engramory/issues/new),或发邮件到 engramory@agent.qq.com。邮件会由 AI 助手协助整理,issue 是公开的,两处都别把记忆内容原样贴上去。
|
|
134
|
+
|
|
135
|
+
## 版本
|
|
136
|
+
|
|
137
|
+
本包和 Engramory 用同一个版本号:`dsh-engramory@X.Y.Z` 就是仓库的 `vX.Y.Z`。上限判定(上面那张表)和实验性功能以外的配置,只在主版本做不兼容改动。详见[版本规则](https://github.com/tinqiao-oss/engramory#版本规则),改动历史见 [CHANGELOG](https://github.com/tinqiao-oss/engramory/blob/master/CHANGELOG.md)。
|
|
138
|
+
|
|
139
|
+
## 许可
|
|
140
|
+
|
|
141
|
+
MIT,见 [Engramory 仓库](https://github.com/tinqiao-oss/engramory)。
|
package/client.js
CHANGED
|
@@ -26,6 +26,15 @@ window.__ModuleLoader__.load({
|
|
|
26
26
|
/** Relative to the page, as dsh's own pages fetch, so a mounted deployment keeps its prefix. */
|
|
27
27
|
const SETTINGS_API = 'api/engramory/settings'
|
|
28
28
|
const MEMORY_API = 'api/engramory/memory'
|
|
29
|
+
/** This plugin's version, for the feedback footer; a test keeps it equal to package.json's. */
|
|
30
|
+
const VERSION = '1.0.8'
|
|
31
|
+
/** Where feedback goes: a new issue on the repository, or the project's mailbox. Opening
|
|
32
|
+
* the link is the browser's (the desktop app hands it to the system's); the footer submits
|
|
33
|
+
* nothing by itself. */
|
|
34
|
+
const ISSUES = 'https://github.com/tinqiao-oss/engramory/issues/new'
|
|
35
|
+
const EMAIL = 'engramory@agent.qq.com'
|
|
36
|
+
/** The how-to's lines, in order. */
|
|
37
|
+
const HOW_TO = ['howToSay', 'howToRecall', 'howToEdit', 'howToMove', 'howToSocial']
|
|
29
38
|
const DEFAULT_LINES = 200
|
|
30
39
|
const DEFAULT_BYTES = 25600
|
|
31
40
|
/** The order the memory page shows note types in (SKILL.md §2, §2.2). */
|
|
@@ -109,6 +118,20 @@ window.__ModuleLoader__.load({
|
|
|
109
118
|
healthLarge: '要核对的太多,没做体检。',
|
|
110
119
|
healthUnreadable: '有文件读不了,没做体检。',
|
|
111
120
|
healthPartial: '文件太多没列全,没做体检。',
|
|
121
|
+
howTo: '怎么用',
|
|
122
|
+
howToSay: '想让 AI 记住什么,直接跟它说,比如「记住:我习惯用 pnpm」「把这个决定记下来」。平时它也会尽量自己挑值得长期记住的记下来,比如你纠正过它的做法。',
|
|
123
|
+
howToRecall: '默认每次对话都会带上记忆的目录(索引),AI 用到细节时再打开那条笔记,不用你提醒。',
|
|
124
|
+
howToEdit: '这里列出读得到的记忆,打开笔记就能直接改;想让 AI 忘掉什么,跟它说「忘掉……」就行。',
|
|
125
|
+
howToMove: '记忆是存在运行 dsh 那台电脑上的普通 markdown 文件,位置写在每个库的标题下面。换电脑时把那个文件夹拷到新电脑的同一位置;在配置里指定过位置的,配置也一起带过去。',
|
|
126
|
+
howToSocial: '接了 QQ、微信等、别人也能跟你的 AI 聊的话,在上面打开「大肥鱼模式」,再把「记忆权限」改成「社交」:只有认得出是你本人的对话才拿得到记忆。这不是安全隔离,详见插件说明。',
|
|
127
|
+
feedbackLead: '遇到问题或有建议:',
|
|
128
|
+
feedbackIssue: '到 GitHub 提 issue',
|
|
129
|
+
feedbackMail: ',或发邮件到',
|
|
130
|
+
copy: '复制',
|
|
131
|
+
copied: '已复制',
|
|
132
|
+
copyFailed: '复制不了,请手动选中上面的地址。',
|
|
133
|
+
feedbackNote: '邮件会由 AI 助手协助整理,issue 是公开的,两处都别把记忆内容原样贴上去。插件版本 {version}。',
|
|
134
|
+
issueBody: '(写下遇到的问题或建议)\n\n---\ndsh-engramory {version}\n打开这个页面的电脑:{os}\ndsh 版本:',
|
|
112
135
|
}
|
|
113
136
|
const en = {
|
|
114
137
|
summary: 'Companion mode and memory access, and the index cap.',
|
|
@@ -188,6 +211,20 @@ window.__ModuleLoader__.load({
|
|
|
188
211
|
healthLarge: 'Too much to check here, so no check-up.',
|
|
189
212
|
healthUnreadable: 'Some files could not be read, so no check-up.',
|
|
190
213
|
healthPartial: 'Too many files to list them all, so no check-up here.',
|
|
214
|
+
howTo: 'How to use it',
|
|
215
|
+
howToSay: 'To have the AI remember something, just tell it: "remember that I use pnpm", "note this decision down". It also tries to keep what is worth keeping on its own, such as a way of working you corrected.',
|
|
216
|
+
howToRecall: 'By default every conversation carries the memory\'s table of contents (the index), and the AI opens a note when it needs the details; you do not have to remind it.',
|
|
217
|
+
howToEdit: 'The memory this page can read is listed here; open a note to edit it. To have the AI forget something, tell it "forget …".',
|
|
218
|
+
howToMove: 'The memory is plain markdown files on the computer dsh runs on, in the folder shown under each store\'s title. On a new computer, copy that folder to the same place, and if your configuration names where the store is, bring that setting along.',
|
|
219
|
+
howToSocial: 'If others can talk to your AI too (through QQ, WeChat and the like), turn on Companion mode above and set Memory access to Social: only conversations it can tell are yours get the memory. This is not a security boundary; see the plugin\'s README.',
|
|
220
|
+
feedbackLead: 'Found a problem or have an idea? ',
|
|
221
|
+
feedbackIssue: 'Open an issue on GitHub',
|
|
222
|
+
feedbackMail: ', or email ',
|
|
223
|
+
copy: 'Copy',
|
|
224
|
+
copied: 'Copied',
|
|
225
|
+
copyFailed: 'Could not copy; select the address above by hand.',
|
|
226
|
+
feedbackNote: 'Emails are sorted with the help of an AI assistant, and issues are public: do not paste your memory notes into either. Plugin version {version}.',
|
|
227
|
+
issueBody: '(What happened, or your idea)\n\n---\ndsh-engramory {version}\nComputer this page was opened on: {os}\ndsh version: ',
|
|
191
228
|
}
|
|
192
229
|
|
|
193
230
|
const CSS = `
|
|
@@ -249,6 +286,17 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
249
286
|
.eng-archive[open]>summary{margin-bottom:2px;}
|
|
250
287
|
.eng-health{display:flex;flex-direction:column;gap:8px;padding:10px 14px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-layer-1);}
|
|
251
288
|
.eng-health-item{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
|
|
289
|
+
.eng-howto{box-sizing:border-box;padding:10px 14px;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,10px);}
|
|
290
|
+
.eng-howto>summary{cursor:pointer;font-size:13px;font-weight:500;line-height:20px;}
|
|
291
|
+
.eng-howto ul{display:flex;flex-direction:column;gap:4px;margin:8px 0 2px;padding-left:18px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
|
|
292
|
+
.eng-feedback{display:flex;flex-direction:column;gap:2px;padding-top:16px;border-top:.5px solid var(--dsw-alias-border-l2);font-size:12px;line-height:22px;color:var(--dsw-alias-label-secondary);}
|
|
293
|
+
.eng-feedback p{margin:0;}
|
|
294
|
+
.eng-link{color:var(--dsw-alias-brand-primary);text-decoration:underline;text-underline-offset:2px;}
|
|
295
|
+
.eng-link:hover{opacity:.8;}
|
|
296
|
+
.eng-email{margin:0 8px 0 2px;font-family:var(--ds-font-family-code,ui-monospace,monospace);user-select:all;color:var(--dsw-alias-label-primary);}
|
|
297
|
+
.eng-btn-small{padding:1px 8px;font-size:11.5px;}
|
|
298
|
+
.eng-feedback-note{color:var(--dsw-alias-label-tertiary);}
|
|
299
|
+
.eng-link:focus-visible,.eng-howto>summary:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary));outline-offset:1px;}
|
|
252
300
|
`
|
|
253
301
|
|
|
254
302
|
/** The settings the page edits, in the order the host computes its revision from. */
|
|
@@ -615,6 +663,57 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
615
663
|
store.more ? h('p', { className: 'eng-note' }, t('more')) : null)
|
|
616
664
|
}
|
|
617
665
|
|
|
666
|
+
/** A store with anything in it: an index with text, a note, an archived note. A folder or an
|
|
667
|
+
* empty index alone is not memory yet. */
|
|
668
|
+
const hasMemory = (store) => (store.index !== null && store.index.bytes > 0) ||
|
|
669
|
+
store.notes.length > 0 || store.archive.length > 0
|
|
670
|
+
|
|
671
|
+
/** How to use it, in a few lines: open while there is no memory yet, folded once there is. */
|
|
672
|
+
function HowTo({ open, t }) {
|
|
673
|
+
return h('details', { className: 'eng-howto', open },
|
|
674
|
+
h('summary', null, t('howTo')),
|
|
675
|
+
h('ul', null, HOW_TO.map((key) => h('li', { key }, t(key)))))
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/** The OS family for a bug report, and nothing that tells one machine from another. */
|
|
679
|
+
function osName() {
|
|
680
|
+
const platform = String(globalThis.navigator?.userAgentData?.platform ?? globalThis.navigator?.platform ?? '')
|
|
681
|
+
return /^win/i.test(platform) ? 'Windows' : /^mac/i.test(platform) ? 'macOS'
|
|
682
|
+
: /linux/i.test(platform) ? 'Linux' : 'unknown'
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Where to report a problem or send an idea: a new issue, its body started with the
|
|
687
|
+
* plugin's version and the OS (no path, no note), or the mailbox, whose address the
|
|
688
|
+
* button copies — the desktop app opens only web links, not `mailto:`.
|
|
689
|
+
*/
|
|
690
|
+
function Feedback({ t }) {
|
|
691
|
+
const [copy, setCopy] = useState('copy')
|
|
692
|
+
const alive = useRef(true)
|
|
693
|
+
useEffect(() => () => { alive.current = false }, [])
|
|
694
|
+
const copyAddress = async () => {
|
|
695
|
+
let done = false
|
|
696
|
+
try {
|
|
697
|
+
await globalThis.navigator.clipboard.writeText(EMAIL)
|
|
698
|
+
done = true
|
|
699
|
+
} catch {
|
|
700
|
+
// no clipboard here (a page served over plain http) or permission refused
|
|
701
|
+
}
|
|
702
|
+
if (alive.current) setCopy(done ? 'copied' : 'copyFailed')
|
|
703
|
+
}
|
|
704
|
+
const href = `${ISSUES}?body=${encodeURIComponent(t('issueBody', { version: VERSION, os: osName() }))}`
|
|
705
|
+
return h('footer', { className: 'eng-feedback' },
|
|
706
|
+
h('p', null,
|
|
707
|
+
t('feedbackLead'),
|
|
708
|
+
h('a', { className: 'eng-link', href, target: '_blank', rel: 'noopener noreferrer' }, t('feedbackIssue')),
|
|
709
|
+
t('feedbackMail'),
|
|
710
|
+
h('span', { className: 'eng-email' }, EMAIL),
|
|
711
|
+
h('button', { type: 'button', className: 'eng-btn eng-btn-small', onClick: copyAddress },
|
|
712
|
+
t(copy === 'copied' ? 'copied' : 'copy'))),
|
|
713
|
+
copy === 'copyFailed' ? h('p', { className: 'eng-feedback-note', role: 'status' }, t('copyFailed')) : null,
|
|
714
|
+
h('p', { className: 'eng-feedback-note' }, t('feedbackNote', { version: VERSION })))
|
|
715
|
+
}
|
|
716
|
+
|
|
618
717
|
/** The sidebar's Memory page: the stores recall can use, by name, and two settings. */
|
|
619
718
|
function MemoryPage({ t }) {
|
|
620
719
|
const { state, load } = useMemory()
|
|
@@ -663,7 +762,10 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
663
762
|
h(SettingsStrip, { t }),
|
|
664
763
|
status ? h('div', { className: 'eng-banner', 'data-tone': status.tone, role: 'status' }, status.text) : null,
|
|
665
764
|
data !== undefined && !canOpen && data.stores.length > 0 ? h('p', { className: 'eng-note' }, t('openUnavailable')) : null,
|
|
666
|
-
|
|
765
|
+
h(HowTo, { open: data !== undefined && data.pinned !== 'relative' && data.more !== true &&
|
|
766
|
+
!data.stores.some(hasMemory), t }),
|
|
767
|
+
body,
|
|
768
|
+
h(Feedback, { t }))
|
|
667
769
|
}
|
|
668
770
|
|
|
669
771
|
/** The sidebar entry's icon: the logo, [[ ]] around a cursor, drawn in the row's own colour
|
package/package.json
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-engramory",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "DeepSeek Harness 的长期记忆插件:AI 记住的东西存成普通 markdown 文件,每轮自动带上记忆索引,索引有大小上限。",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"dsh-plugin",
|
|
7
|
-
"deepseek-harness",
|
|
8
|
-
"dsh",
|
|
9
|
-
"memory",
|
|
10
|
-
"agent-memory",
|
|
11
|
-
"long-term-memory",
|
|
12
|
-
"engramory",
|
|
13
|
-
"markdown"
|
|
14
|
-
],
|
|
15
|
-
"type": "module",
|
|
16
|
-
"main": "index.js",
|
|
17
|
-
"dsh": {
|
|
18
|
-
"bundle": {
|
|
19
|
-
"patch": "./cordis.patch.yml"
|
|
20
|
-
},
|
|
21
|
-
"client": {
|
|
22
|
-
"platform": "web",
|
|
23
|
-
"inject": [
|
|
24
|
-
"@deepseek-ai/dsh-client-locale",
|
|
25
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"compatibility": {
|
|
29
|
-
"dsh": ">=0.1.0-rc.7 <0.3.0-0",
|
|
30
|
-
"dshReleases": {
|
|
31
|
-
"0.1.5-rc.3": "compatible",
|
|
32
|
-
"0.1.7-alpha.1": "compatible",
|
|
33
|
-
"0.1.7-alpha.2": "compatible",
|
|
34
|
-
"0.1.7-rc.1": "compatible",
|
|
35
|
-
"0.1.7-rc.2": "compatible",
|
|
36
|
-
"0.2.1-alpha.5": "compatible",
|
|
37
|
-
"0.2.1-rc.1": "compatible",
|
|
38
|
-
"0.2.1-rc.2": "compatible",
|
|
39
|
-
"0.2.1-rc.3": "compatible",
|
|
40
|
-
"0.2.1-rc.4": "compatible",
|
|
41
|
-
"0.2.1-rc.5": "compatible",
|
|
42
|
-
"0.2.2-alpha.2": "compatible"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"exports": {
|
|
47
|
-
".": "./index.js",
|
|
48
|
-
"./client": "./client.js",
|
|
49
|
-
"./locale/*.json": "./locale/*.json",
|
|
50
|
-
"./icon": "./icon.svg",
|
|
51
|
-
"./package.json": "./package.json"
|
|
52
|
-
},
|
|
53
|
-
"files": [
|
|
54
|
-
"index.js",
|
|
55
|
-
"client.js",
|
|
56
|
-
"cordis.patch.yml",
|
|
57
|
-
"locale/*.json",
|
|
58
|
-
"icon.svg",
|
|
59
|
-
"README.md",
|
|
60
|
-
"LICENSE"
|
|
61
|
-
],
|
|
62
|
-
"author": "tinqiao-oss",
|
|
63
|
-
"license": "MIT",
|
|
64
|
-
"repository": {
|
|
65
|
-
"type": "git",
|
|
66
|
-
"url": "git+https://github.com/tinqiao-oss/engramory.git",
|
|
67
|
-
"directory": "adapters/dsh/plugin"
|
|
68
|
-
},
|
|
69
|
-
"homepage": "https://github.com/tinqiao-oss/engramory/tree/master/adapters/dsh/plugin#readme",
|
|
70
|
-
"bugs": {
|
|
71
|
-
"url": "https://github.com/tinqiao-oss/engramory/issues"
|
|
72
|
-
},
|
|
73
|
-
"engines": {
|
|
74
|
-
"node": ">=18"
|
|
75
|
-
},
|
|
76
|
-
"publishConfig": {
|
|
77
|
-
"access": "public"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-engramory",
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"description": "DeepSeek Harness 的长期记忆插件:AI 记住的东西存成普通 markdown 文件,每轮自动带上记忆索引,索引有大小上限。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh-plugin",
|
|
7
|
+
"deepseek-harness",
|
|
8
|
+
"dsh",
|
|
9
|
+
"memory",
|
|
10
|
+
"agent-memory",
|
|
11
|
+
"long-term-memory",
|
|
12
|
+
"engramory",
|
|
13
|
+
"markdown"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "index.js",
|
|
17
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
},
|
|
21
|
+
"client": {
|
|
22
|
+
"platform": "web",
|
|
23
|
+
"inject": [
|
|
24
|
+
"@deepseek-ai/dsh-client-locale",
|
|
25
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"compatibility": {
|
|
29
|
+
"dsh": ">=0.1.0-rc.7 <0.3.0-0",
|
|
30
|
+
"dshReleases": {
|
|
31
|
+
"0.1.5-rc.3": "compatible",
|
|
32
|
+
"0.1.7-alpha.1": "compatible",
|
|
33
|
+
"0.1.7-alpha.2": "compatible",
|
|
34
|
+
"0.1.7-rc.1": "compatible",
|
|
35
|
+
"0.1.7-rc.2": "compatible",
|
|
36
|
+
"0.2.1-alpha.5": "compatible",
|
|
37
|
+
"0.2.1-rc.1": "compatible",
|
|
38
|
+
"0.2.1-rc.2": "compatible",
|
|
39
|
+
"0.2.1-rc.3": "compatible",
|
|
40
|
+
"0.2.1-rc.4": "compatible",
|
|
41
|
+
"0.2.1-rc.5": "compatible",
|
|
42
|
+
"0.2.2-alpha.2": "compatible"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"exports": {
|
|
47
|
+
".": "./index.js",
|
|
48
|
+
"./client": "./client.js",
|
|
49
|
+
"./locale/*.json": "./locale/*.json",
|
|
50
|
+
"./icon": "./icon.svg",
|
|
51
|
+
"./package.json": "./package.json"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"index.js",
|
|
55
|
+
"client.js",
|
|
56
|
+
"cordis.patch.yml",
|
|
57
|
+
"locale/*.json",
|
|
58
|
+
"icon.svg",
|
|
59
|
+
"README.md",
|
|
60
|
+
"LICENSE"
|
|
61
|
+
],
|
|
62
|
+
"author": "tinqiao-oss",
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "git+https://github.com/tinqiao-oss/engramory.git",
|
|
67
|
+
"directory": "adapters/dsh/plugin"
|
|
68
|
+
},
|
|
69
|
+
"homepage": "https://github.com/tinqiao-oss/engramory/tree/master/adapters/dsh/plugin#readme",
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/tinqiao-oss/engramory/issues"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=18"
|
|
75
|
+
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public"
|
|
78
|
+
}
|
|
79
|
+
}
|