claude-memory-admin 1.1.0 → 1.2.0
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.md +79 -11
- package/package.json +1 -1
- package/public/app.mjs +487 -20
- package/public/styles.css +1 -1
- package/public/ui.mjs +19 -1
- package/server.mjs +82 -5
- package/src/instructions.mjs +123 -21
- package/src/model.mjs +4 -1
- package/src/mutate.mjs +355 -1
- package/src/parse.mjs +176 -0
- package/src/settings.mjs +120 -19
- package/src/stores.mjs +34 -4
package/README.md
CHANGED
|
@@ -97,13 +97,16 @@ project is to the cliff, and makes it quick to get back under it.
|
|
|
97
97
|
- **Graph** the wikilinks between memories. Hovering dims everything that is not
|
|
98
98
|
a neighbour, which is the only practical way to read a dense cluster.
|
|
99
99
|
- **Health**: orphans, dangling pointers, broken wikilinks, files linked only
|
|
100
|
-
mid-sentence, `name` fields that disagree with the filename.
|
|
100
|
+
mid-sentence, `name` fields that disagree with the filename. An orphan can be
|
|
101
|
+
given the `MEMORY.md` bullet it is missing without leaving the page.
|
|
101
102
|
- **Dates you can trust.** Claude Code stamps `modified` into frontmatter, but
|
|
102
103
|
only on files that already have some, and never adds frontmatter to a file
|
|
103
104
|
without it. Anything falling back to the file's mtime is labelled, because
|
|
104
105
|
mtime is reset by any copy or restore.
|
|
105
106
|
- **Context**: what a session starting in this project would load as
|
|
106
107
|
*instructions*, which is the other half of the startup budget (see below).
|
|
108
|
+
- **Settings**: every layer Claude Code would read, side by side, with the value
|
|
109
|
+
that wins and the ones it shadows (see below).
|
|
107
110
|
- **Delete with cascade**, always reversible.
|
|
108
111
|
|
|
109
112
|
Everything above works the same on both kinds of store. The load meter, graph,
|
|
@@ -129,10 +132,21 @@ session and, past the limit, silently stops loading.
|
|
|
129
132
|
remembered.
|
|
130
133
|
- **Long hooks**. The hook is the text after the dash in `MEMORY.md`. A
|
|
131
134
|
400-character hook can cost more than the memory it points at, and shortening
|
|
132
|
-
it is the cheapest win available.
|
|
135
|
+
it is the cheapest win available. **Edit hook** rewrites one in place, with the
|
|
136
|
+
projected load meter next to the character count, and changes nothing but the
|
|
137
|
+
text after the separator - the indent, title, link and the separator character
|
|
138
|
+
itself are kept byte for byte, so a project that writes ` - ` keeps writing it.
|
|
139
|
+
- **Move above the cutoff**. Past the limit, an entry is on disk but invisible.
|
|
140
|
+
**Move up** relocates its bullet, and the indented lines under it, to the end
|
|
141
|
+
of any section that starts above the cutoff. It moves one entry rather than
|
|
142
|
+
making room, so whatever is now last drops below the line instead - the tab
|
|
143
|
+
says so before you do it.
|
|
133
144
|
- **Possible overlap**. Pairs of memories ranked by shared *rare* vocabulary, to
|
|
134
145
|
surface the same lesson saved three times from three sessions. It is a hint,
|
|
135
|
-
not a verdict.
|
|
146
|
+
not a verdict. **Merge** folds one into the other: the body moves under a
|
|
147
|
+
heading you name, every `[[wikilink]]` that pointed at the source is repointed
|
|
148
|
+
rather than broken, a link the survivor had to the source becomes plain text
|
|
149
|
+
instead of a self-link, and the two index bullets collapse to one.
|
|
136
150
|
- **Bulk prune**. Sort by age, size, or inbound links, tick several, delete them
|
|
137
151
|
as one restore point.
|
|
138
152
|
|
|
@@ -161,15 +175,54 @@ It also finds the failures that leave a file silently doing nothing:
|
|
|
161
175
|
- Brace expansion past the 1,000-pattern budget, where the pattern is used
|
|
162
176
|
unexpanded and its literal braces match no file either.
|
|
163
177
|
- An `AGENTS.md` that no `CLAUDE.md` imports. Claude Code reads `CLAUDE.md`.
|
|
178
|
+
- A markdown file sitting in `~/.claude` that nothing in the chain reaches. It
|
|
179
|
+
looks load-bearing and loads nothing, which is what happens when the import
|
|
180
|
+
that pulled it in is deleted or its content is inlined.
|
|
164
181
|
|
|
165
182
|
Backticks are respected, so a `` `@README` `` in your prose is not reported as an
|
|
166
183
|
import, and neither is an email address.
|
|
167
184
|
|
|
185
|
+
Every file listed opens in place, so you can read what actually loads without
|
|
186
|
+
leaving the tab. Nothing here is editable: the app never rewrites a `CLAUDE.md`.
|
|
187
|
+
|
|
188
|
+
### The user scope on its own
|
|
189
|
+
|
|
190
|
+
The half of that chain no project owns — managed policy, `~/.claude/CLAUDE.md`,
|
|
191
|
+
`~/.claude/rules/` and their imports — is also a **Global** entry at the top of
|
|
192
|
+
the sidebar. It is what every session on the machine pays for before a project is
|
|
193
|
+
even chosen, and it resolves without a project directory, so it is there even when
|
|
194
|
+
no project's real path could be recovered from a transcript.
|
|
195
|
+
|
|
196
|
+
It holds instructions rather than memory, so it is read-only and has no MEMORY.md,
|
|
197
|
+
graph or trash. Search does not reach into it.
|
|
198
|
+
|
|
168
199
|
This is re-derived from the documented resolution rules rather than reported by
|
|
169
200
|
Claude Code, and the tab says so. Run `/context` in a session for the ground
|
|
170
201
|
truth, or the `InstructionsLoaded` hook to log exactly what loaded and why.
|
|
171
202
|
|
|
172
|
-
##
|
|
203
|
+
## Which settings are actually in force
|
|
204
|
+
|
|
205
|
+
Five files can set the keys this tool cares about, and the one everybody edits,
|
|
206
|
+
`~/.claude/settings.json`, is the weakest of them. The **Settings** tab reads all
|
|
207
|
+
five and shows, per key, the value that wins and the ones it shadows, struck
|
|
208
|
+
through, each labelled with the file it came from:
|
|
209
|
+
|
|
210
|
+
`autoMemoryEnabled`, `autoMemoryDirectory`, `claudeMdExcludes` and
|
|
211
|
+
`cleanupPeriodDays`, plus `CLAUDE_CODE_DISABLE_AUTO_MEMORY` when it is set in the
|
|
212
|
+
environment, where it outranks every file.
|
|
213
|
+
|
|
214
|
+
It also names the failures that are otherwise silent:
|
|
215
|
+
|
|
216
|
+
- A settings file that exists but is not valid JSON. Claude Code ignores the
|
|
217
|
+
whole file, so every value in it is doing nothing, and nothing says so.
|
|
218
|
+
- A file that parses but is not an object, or cannot be read at all.
|
|
219
|
+
- An `autoMemoryDirectory` that is neither absolute nor `~/`-prefixed.
|
|
220
|
+
- A value Claude Code accepts the key of but not the number, like a
|
|
221
|
+
`cleanupPeriodDays` below 1: the tab shows what is written *and* what applies.
|
|
222
|
+
|
|
223
|
+
The tab is read-only. It reports what is configured; it never writes a setting.
|
|
224
|
+
|
|
225
|
+
## Everything it writes is reversible
|
|
173
226
|
|
|
174
227
|
Delete shows a preview first: the exact lines that will go, the prose mentions it
|
|
175
228
|
will deliberately leave alone, and which other memories link here and will break.
|
|
@@ -185,8 +238,19 @@ exists. The markup goes and the words stay, so `see [[gone]] for details` become
|
|
|
185
238
|
`see gone for details`.
|
|
186
239
|
|
|
187
240
|
Everything lands in `memory/.trash/` with a restore record and comes back from the
|
|
188
|
-
Trash tab
|
|
189
|
-
|
|
241
|
+
Trash tab, one undo per operation however many files it touched.
|
|
242
|
+
|
|
243
|
+
The app never writes a memory file of its own. It edits `MEMORY.md` a line at a
|
|
244
|
+
time - a hook rewritten, a bullet added or moved - and each of those keeps every
|
|
245
|
+
other byte of the file. Adding a bullet to a project that has no `MEMORY.md` yet
|
|
246
|
+
is the one case where a file is created, and undoing it deletes that file again,
|
|
247
|
+
but only if nothing has touched it since. **Merge** is the one action that
|
|
248
|
+
rewrites prose inside a memory, which is why it shows you every file it will
|
|
249
|
+
touch first.
|
|
250
|
+
|
|
251
|
+
Each index edit keeps a copy of the whole `MEMORY.md` in the trash rather than a
|
|
252
|
+
note of which lines changed, so undo means writing back the exact bytes that were
|
|
253
|
+
there instead of recomputing them.
|
|
190
254
|
|
|
191
255
|
## Usage
|
|
192
256
|
|
|
@@ -219,8 +283,12 @@ claude-memory-admin --root /tmp/memory-snapshot
|
|
|
219
283
|
- `MEMORY.md` is replaced atomically (temp file, `fsync`, `rename`) with a backup
|
|
220
284
|
restored if anything throws.
|
|
221
285
|
- A test asserts that parsing and rewriting every real `MEMORY.md` with no
|
|
222
|
-
deletions reproduces it byte for byte
|
|
223
|
-
|
|
286
|
+
deletions reproduces it byte for byte, that rewriting a hook and putting the
|
|
287
|
+
original back does too, and that no edit ever disturbs a line it was not
|
|
288
|
+
aimed at. Real indexes are hand-written prose with headings and nested bullets,
|
|
289
|
+
and mangling one would be silent.
|
|
290
|
+
- Every index edit is guarded by the text the browser last saw, so an edit made
|
|
291
|
+
against a stale view is refused rather than applied to the wrong line.
|
|
224
292
|
|
|
225
293
|
## Development
|
|
226
294
|
|
|
@@ -247,15 +315,15 @@ ready to serve and never builds anything. After editing the source, run
|
|
|
247
315
|
| `bin/claude-memory-admin.mjs` | CLI entry point and argument parsing |
|
|
248
316
|
| `server.mjs` | HTTP server: static files + JSON API |
|
|
249
317
|
| `src/projects.mjs` | Project discovery, slug → real path resolution |
|
|
250
|
-
| `src/settings.mjs` | Layered reads of Claude Code's settings files |
|
|
318
|
+
| `src/settings.mjs` | Layered reads of Claude Code's settings files, and the report behind the Settings tab |
|
|
251
319
|
| `src/pathcache.mjs` | The opt-in record of confirmed project paths |
|
|
252
|
-
| `src/stores.mjs` | Store discovery: auto memory and the three agent scopes |
|
|
320
|
+
| `src/stores.mjs` | Store discovery: the user scope, auto memory and the three agent scopes |
|
|
253
321
|
| `src/instructions.mjs` | CLAUDE.md chain, `@` imports and rules resolution |
|
|
254
322
|
| `src/parse.mjs` | `MEMORY.md` and frontmatter parsers, wikilinks |
|
|
255
323
|
| `src/model.mjs` | Joins index, files, graph and health into one model |
|
|
256
324
|
| `src/stats.mjs` | Load-limit accounting and overlap detection |
|
|
257
325
|
| `src/search.mjs` | Full-text search across every store |
|
|
258
|
-
| `src/mutate.mjs` | Delete /
|
|
326
|
+
| `src/mutate.mjs` | Delete / edit / merge / restore, the only code that writes |
|
|
259
327
|
| `styles/app.css` | Tailwind source, compiled to `public/styles.css` |
|
|
260
328
|
| `public/` | Frontend |
|
|
261
329
|
|