@pcircle/memesh 4.9.4 → 4.10.2

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.
Files changed (159) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/AGENTS.md +75 -13
  5. package/README.de.md +5 -5
  6. package/README.md +5 -5
  7. package/README.zh-TW.md +5 -5
  8. package/dashboard/dist/index.html +8 -8
  9. package/dist/cli/view-live.d.ts.map +1 -1
  10. package/dist/cli/view-live.js +0 -427
  11. package/dist/cli/view-live.js.map +1 -1
  12. package/dist/core/agent-message-inbox.d.ts +6 -0
  13. package/dist/core/agent-message-inbox.d.ts.map +1 -1
  14. package/dist/core/agent-message-inbox.js +28 -1
  15. package/dist/core/agent-message-inbox.js.map +1 -1
  16. package/dist/core/briefing-index.d.ts +30 -0
  17. package/dist/core/briefing-index.d.ts.map +1 -0
  18. package/dist/core/briefing-index.js +140 -0
  19. package/dist/core/briefing-index.js.map +1 -0
  20. package/dist/core/briefing-level.d.ts +22 -0
  21. package/dist/core/briefing-level.d.ts.map +1 -0
  22. package/dist/core/briefing-level.js +75 -0
  23. package/dist/core/briefing-level.js.map +1 -0
  24. package/dist/core/briefing.d.ts +7 -0
  25. package/dist/core/briefing.d.ts.map +1 -1
  26. package/dist/core/briefing.js +72 -12
  27. package/dist/core/briefing.js.map +1 -1
  28. package/dist/core/capture-liveness.d.ts +137 -0
  29. package/dist/core/capture-liveness.d.ts.map +1 -0
  30. package/dist/core/capture-liveness.js +448 -0
  31. package/dist/core/capture-liveness.js.map +1 -0
  32. package/dist/core/config.d.ts +2 -0
  33. package/dist/core/config.d.ts.map +1 -1
  34. package/dist/core/config.js +5 -1
  35. package/dist/core/config.js.map +1 -1
  36. package/dist/core/delegation.d.ts +47 -0
  37. package/dist/core/delegation.d.ts.map +1 -0
  38. package/dist/core/delegation.js +174 -0
  39. package/dist/core/delegation.js.map +1 -0
  40. package/dist/core/doctor-fixes.d.ts +1 -0
  41. package/dist/core/doctor-fixes.d.ts.map +1 -1
  42. package/dist/core/doctor-fixes.js +21 -0
  43. package/dist/core/doctor-fixes.js.map +1 -1
  44. package/dist/core/doctor.d.ts +8 -0
  45. package/dist/core/doctor.d.ts.map +1 -1
  46. package/dist/core/doctor.js +148 -3
  47. package/dist/core/doctor.js.map +1 -1
  48. package/dist/core/note-derive.d.ts +14 -0
  49. package/dist/core/note-derive.d.ts.map +1 -0
  50. package/dist/core/note-derive.js +66 -0
  51. package/dist/core/note-derive.js.map +1 -0
  52. package/dist/core/note-ingest.d.ts +34 -0
  53. package/dist/core/note-ingest.d.ts.map +1 -0
  54. package/dist/core/note-ingest.js +445 -0
  55. package/dist/core/note-ingest.js.map +1 -0
  56. package/dist/core/operations.d.ts +10 -1
  57. package/dist/core/operations.d.ts.map +1 -1
  58. package/dist/core/operations.js +129 -14
  59. package/dist/core/operations.js.map +1 -1
  60. package/dist/core/paths.d.ts +1 -0
  61. package/dist/core/paths.d.ts.map +1 -1
  62. package/dist/core/paths.js +4 -0
  63. package/dist/core/paths.js.map +1 -1
  64. package/dist/core/schema-export.d.ts.map +1 -1
  65. package/dist/core/schema-export.js +15 -5
  66. package/dist/core/schema-export.js.map +1 -1
  67. package/dist/core/serializer.d.ts +2 -0
  68. package/dist/core/serializer.d.ts.map +1 -1
  69. package/dist/core/serializer.js +119 -3
  70. package/dist/core/serializer.js.map +1 -1
  71. package/dist/core/session-insight.d.ts +44 -0
  72. package/dist/core/session-insight.d.ts.map +1 -0
  73. package/dist/core/session-insight.js +216 -0
  74. package/dist/core/session-insight.js.map +1 -0
  75. package/dist/core/task-state-store.d.ts +4 -0
  76. package/dist/core/task-state-store.d.ts.map +1 -1
  77. package/dist/core/task-state-store.js +18 -5
  78. package/dist/core/task-state-store.js.map +1 -1
  79. package/dist/core/task-state.d.ts +5 -0
  80. package/dist/core/task-state.d.ts.map +1 -1
  81. package/dist/core/task-state.js +70 -0
  82. package/dist/core/task-state.js.map +1 -1
  83. package/dist/core/turn-signal.d.ts +22 -0
  84. package/dist/core/turn-signal.d.ts.map +1 -0
  85. package/dist/core/turn-signal.js +89 -0
  86. package/dist/core/turn-signal.js.map +1 -0
  87. package/dist/core/types.d.ts +14 -3
  88. package/dist/core/types.d.ts.map +1 -1
  89. package/dist/core/update-entrypoint.d.ts +19 -0
  90. package/dist/core/update-entrypoint.d.ts.map +1 -0
  91. package/dist/core/update-entrypoint.js +222 -0
  92. package/dist/core/update-entrypoint.js.map +1 -0
  93. package/dist/core/update-notice.d.ts +69 -0
  94. package/dist/core/update-notice.d.ts.map +1 -0
  95. package/dist/core/update-notice.js +188 -0
  96. package/dist/core/update-notice.js.map +1 -0
  97. package/dist/core/work-topology.d.ts +1 -0
  98. package/dist/core/work-topology.d.ts.map +1 -1
  99. package/dist/core/work-topology.js +3 -0
  100. package/dist/core/work-topology.js.map +1 -1
  101. package/dist/host-runtime/codex-session.d.ts +10 -0
  102. package/dist/host-runtime/codex-session.d.ts.map +1 -1
  103. package/dist/host-runtime/codex-session.js +1 -1
  104. package/dist/host-runtime/codex-session.js.map +1 -1
  105. package/dist/knowledge-graph.d.ts.map +1 -1
  106. package/dist/knowledge-graph.js +24 -3
  107. package/dist/knowledge-graph.js.map +1 -1
  108. package/dist/mcp/THIRD_PARTY_NOTICES.txt +2 -2
  109. package/dist/mcp/server.js +1438 -122
  110. package/dist/mcp/server.js.map +3 -3
  111. package/dist/skills-manifest.json +61 -36
  112. package/dist/storage/fts-index.d.ts +1 -0
  113. package/dist/storage/fts-index.d.ts.map +1 -1
  114. package/dist/storage/fts-index.js +5 -0
  115. package/dist/storage/fts-index.js.map +1 -1
  116. package/dist/transports/cli/cli.d.ts.map +1 -1
  117. package/dist/transports/cli/cli.js +7846 -5613
  118. package/dist/transports/cli/cli.js.map +3 -3
  119. package/dist/transports/http/server.d.ts.map +1 -1
  120. package/dist/transports/http/server.js +48 -28
  121. package/dist/transports/http/server.js.map +1 -1
  122. package/dist/transports/mcp/handlers.d.ts +31 -7
  123. package/dist/transports/mcp/handlers.d.ts.map +1 -1
  124. package/dist/transports/mcp/handlers.js +49 -7
  125. package/dist/transports/mcp/handlers.js.map +1 -1
  126. package/dist/transports/schemas.d.ts +5 -2
  127. package/dist/transports/schemas.d.ts.map +1 -1
  128. package/dist/transports/schemas.js +30 -3
  129. package/dist/transports/schemas.js.map +1 -1
  130. package/docs/platforms/README.md +1 -0
  131. package/docs/platforms/agent-messaging.md +39 -8
  132. package/package.json +11 -6
  133. package/scripts/hooks/_generated/agent-message-inbox.js +28 -1
  134. package/scripts/hooks/_generated/briefing-index.js +147 -0
  135. package/scripts/hooks/_generated/briefing-level.js +82 -0
  136. package/scripts/hooks/_generated/capture-liveness.js +455 -0
  137. package/scripts/hooks/_generated/core-paths.js +4 -0
  138. package/scripts/hooks/_generated/fts-index.js +5 -0
  139. package/scripts/hooks/_generated/task-state.js +70 -0
  140. package/scripts/hooks/_generated/update-notice.js +195 -0
  141. package/scripts/hooks/_generated/work-topology.js +3 -0
  142. package/scripts/hooks/_shared.js +923 -27
  143. package/scripts/hooks/_stop-notes.js +504 -0
  144. package/scripts/hooks/auto-update-runner.mjs +22 -0
  145. package/scripts/hooks/decision-nudge.js +32 -5
  146. package/scripts/hooks/guard-check.js +30 -3
  147. package/scripts/hooks/post-commit.js +329 -133
  148. package/scripts/hooks/pre-compact.js +17 -2
  149. package/scripts/hooks/pre-edit-recall.js +416 -64
  150. package/scripts/hooks/session-start.js +617 -150
  151. package/scripts/hooks/session-summary.js +217 -41
  152. package/scripts/hooks/user-prompt-intent.js +124 -22
  153. package/scripts/upgrade-plugin.sh +3 -4
  154. package/skills/memesh/SKILL.md +45 -23
  155. package/dist/cli/assets/d3.v7.min.js +0 -2
  156. package/dist/core/graph.d.ts +0 -26
  157. package/dist/core/graph.d.ts.map +0 -1
  158. package/dist/core/graph.js +0 -74
  159. package/dist/core/graph.js.map +0 -1
@@ -28,14 +28,14 @@ All examples below use CLI. MCP tools accept the same parameters as JSON objects
28
28
  | Tool | Purpose |
29
29
  |---|---|
30
30
  | `work_package` | Prepare one bounded untrusted `digest` (calendar cluster) or `transcript` package from the newest Claude Code session under the client's single matching MCP workspace root; submit exactly one strict result or defer. Submit only stages pending human review and retains bounded redacted source turns for comparison; agents cannot apply or reject. No hidden reasoning, raw transcript, transcript path, API key, LLM, embedding, or vector data is exposed or used; hashes identify freshness and workspace scope rather than authentication. |
31
- | `remember` | Store knowledge as an entity with observations, tags, and relations |
31
+ | `remember` | Store knowledge as an entity with observations, tags, and relations; `note` (free text) derives title/observations/name; `replace: true` rewrites a named memory, keeping history |
32
32
  | `recall` | Search stored knowledge; empty query lists recent memories |
33
33
  | `forget` | Archive an entity or remove one exact observation |
34
34
  | `export` | Export memories as portable JSON |
35
35
  | `import` | Import a JSON export with the required skip, append, or overwrite strategy |
36
36
  | `learn` | Record a structured lesson with error, fix, root cause, and prevention |
37
37
  | `task_state` | Read or update user-stated goal, next step, blocker, and finished work |
38
- | `briefing` | Assemble the current project's work topology |
38
+ | `briefing` | Assemble the current project's work topology, closing, by default, with a capped index of its durable memories (the `briefing` setting — `minimal` / `standard` / `full` — controls how much is assembled) |
39
39
  | `user_patterns` | Analyze work schedule, tool preferences, and focus areas |
40
40
  | `improvement` | Propose an evidence-linked product improvement or read its status; only a human may accept or reject it |
41
41
  | `message` | Discover live agents in one project, then contact one exact recipient with a bounded, untrusted payload. Native size and availability failures are distinct; acceptance, discovery, polling, and fetching do not acknowledge |
@@ -98,15 +98,22 @@ Durable audit does not mean unbounded silent growth. Owners can inspect it with
98
98
 
99
99
  **SESSION START → load the briefing (once).**
100
100
  Call the `briefing` MCP tool or run `memesh briefing`. It returns the assembled
101
- work topology: where the work was left off (goal / next / blocked / done),
102
- decisions and direction, lessons not to repeat, what is known, recent activity.
101
+ work topology: this project's decisions and direction, lessons not to repeat,
102
+ what is known, and recent activity always; where the work was left off (goal /
103
+ next / blocked / done) too at `standard`/`full` (the `briefing` setting's
104
+ default and above).
103
105
  One call is cheaper than re-exploring the repo to reconstruct the same picture.
104
- Generic briefing and SessionStart context do not report unread durable messages:
105
- they have no recipient identity. If you already know the exact logical
106
- recipient, pass `recipient` with `project` (MCP) or use
106
+ `memesh briefing --index` returns only the index of durable memories — what is
107
+ known here, one line each, without the ranked sections.
108
+ Generic briefing does not report unread durable messages: it has no recipient
109
+ identity. The session-start hook and each prompt do report them, but only when
110
+ the session declared who it is by starting with `MEMESH_RECIPIENT=<id>`. If you
111
+ already know the exact logical recipient, pass `recipient` with `project` (MCP) or use
107
112
  `memesh briefing --project <name> --recipient <id>`. The scoped line names the
108
113
  project and recipient and directs you to `message poll` first, then `message
109
- fetch` each returned `message_id`; fetching does not acknowledge. At zero
114
+ fetch` each returned `message_id`, then record `intake` for it (the session-start
115
+ and prompt reminders repeat until you do; fetching alone does not acknowledge).
116
+ At zero
110
117
  unread it also says so explicitly if that exact recipient id has never been
111
118
  seen in this project at all — treat that as a probable typo in `--recipient`,
112
119
  not as an empty, healthy inbox.
@@ -120,15 +127,18 @@ memesh task --blocked "Waiting on the Windows runner"
120
127
  memesh task --blocked "" # blocker resolved — empty string clears the field
121
128
  ```
122
129
  Fields: `--goal` `--next` `--blocked` `--done` (MCP tool: `task_state`).
123
- Record ONLY what the user actually said. This state is injected at the top of
124
- the next session and read as fact a goal you guessed from which files were
125
- edited reaches that session with nothing to correct it. If it was not said,
126
- leave the field out.
130
+ Record ONLY what the user actually said. Fresh state is injected at the top
131
+ of the next session at `standard`/`full` (default and above) and read as
132
+ fact a goal you guessed from which files were edited reaches that session
133
+ with nothing to correct it; `minimal` never shows a fresh state, but a
134
+ stale or unknown-age one still gets a one-line flag at every level. If it
135
+ was not said, leave the field out.
127
136
 
128
137
  **SESSION END or milestone → make the task state match reality.**
129
- `memesh task` (no flags) shows exactly what the next session will be told.
130
- If "next" is now done, record what is actually next; if the blocker cleared,
131
- clear it.
138
+ `memesh task` (no flags) always shows the complete stored state not
139
+ necessarily what the next session will be told, which depends on freshness
140
+ and the `briefing` level. If "next" is now done, record what is actually
141
+ next; if the blocker cleared, clear it.
132
142
 
133
143
  **USER ASKS "what do you remember / where were we" → briefing, then relay.**
134
144
  Run `memesh briefing` (or `--project <name>`) and answer from it. For specific
@@ -149,18 +159,19 @@ With the Claude Code plugin, the first eight rows happen **without any action fr
149
159
 
150
160
  | Hook | When | What it does |
151
161
  |------|------|-------------|
152
- | **SessionStart** | Every session begins | Injects the briefing: task state lessons project memories recent activity |
162
+ | **SessionStart** | Every session begins | Injects the briefing when the configured level has something to show (an empty project at `minimal` injects nothing) — decisions, lessons and recent activity always; task state and the durable-memory index too at `standard`/`full` (default and above) |
153
163
  | **PreToolUse (Edit/Write)** | Before editing files | Injects memories related to the file or project |
154
164
  | **UserPromptSubmit** | When you submit a prompt | Detects "remember this" intent (5 languages) and reminds Claude to use memesh |
155
165
  | **PostToolUse (Bash)** | After `git commit` | Auto-tracks the commit with diff stats as a memory entity |
156
166
  | **PostToolUse (ExitPlanMode/AskUserQuestion)** | A plan is approved or you answer a question | Reminds Claude to `remember` the decision if it's worth keeping — once per tool per session |
157
- | **Stop** | Session ends | Auto-captures session knowledge and applies the configured update policy |
167
+ | **Stop** | Session ends | Auto-captures session knowledge, ingests the project's Claude Code memory directory (frontmatter notes → `source:note-file` memories), shows one line when the turn made a decision-shaped move and stored no memory, and applies the configured update policy. The two writes (session capture, note-directory ingestion) stop when auto-capture is off (`memesh config set autoCapture false` / `MEMESH_AUTO_CAPTURE=false`); the advisory line still runs |
158
168
  | **PreCompact** | Before context compaction | Saves important knowledge before history is compressed |
159
169
  | **PreToolUse (Bash)** | Before a command runs | Fires accepted lesson-guards — warns when a recorded mistake is about to repeat |
160
170
  | **SessionStart/SessionEnd (Codex)** | An ordinary Codex CLI plugin session starts, resumes, or ends | Launches the detached exact-thread companion, replaces its generation on resume, and retires it after the bounded idle queue window; a matching owner-private config may override its project/principal |
161
171
 
162
172
  Because of the SessionStart hook: **in Claude Code, do NOT call `briefing` at
163
- session start — it is already in your context.** Call it only mid-session
173
+ session start — whatever the configured level has to show is already in your
174
+ context.** Call it only mid-session
164
175
  (context was compacted, or the user asks what you remember) or on hosts
165
176
  without these hooks (other MCP clients, shell-only agents). Double-injection
166
177
  spends the very tokens this system exists to save.
@@ -174,7 +185,8 @@ and retiring outdated info.
174
185
  | Situation | Action |
175
186
  |-----------|--------|
176
187
  | User states what they're working on / what's next / what's blocking | `memesh task --goal "…"` / `--next "…"` / `--blocked "…"` |
177
- | Design decision made | `memesh remember --name "auth-choice" --type decision --obs "Use OAuth 2.0 with PKCE" --tags "project:myapp"` |
188
+ | Design decision made | `memesh remember "Use OAuth 2.0 with PKCE for the API" --type decision --tags "project:myapp"` (or `remember({ note })` over MCP) |
189
+ | A stored memory is wrong | `memesh remember --name "auth-choice" --obs "the corrected fact" --replace` — the memory keeps its type and the old version moves to `metadata.replaced_history` (add `--type` only to reclassify it) |
178
190
  | Bug fixed | `memesh learn --error "what broke" --fix "what fixed it" --root-cause "why" --severity major` |
179
191
  | Starting work on a feature | `memesh recall "feature-name" --json` |
180
192
  | User asks "what did we decide?" | `memesh recall "topic" --tag "project:myapp"` |
@@ -211,7 +223,13 @@ memesh remember \
211
223
  Use a **stable name** (`db-choice`, not `db-choice-2026-08-16`): reusing the
212
224
  name appends to the same entity instead of scattering duplicates. `--title` is
213
225
  the human-readable headline; the name stays the machine key. If this replaces
214
- an older decision, add `--supersedes "old-db-choice"`.
226
+ an older decision, add `--supersedes "old-db-choice"`. To correct it instead
227
+ of adding to it, repeat the call with `--replace`.
228
+
229
+ Quicker when the text is all you have: `memesh remember "SQLite for local-first
230
+ storage"` (MCP: `remember({ note: "…" })`). The first line becomes the title,
231
+ each following paragraph an observation, and the name is derived from the text,
232
+ so repeating the same text does not create a duplicate.
215
233
  Types: `decision` `pattern` `lesson_learned` `bug_fix` `architecture` `convention` `feature` `best_practice` `concept` `tool` `note`
216
234
 
217
235
  ### You need context on a specific topic
@@ -239,15 +257,19 @@ human review. Do not hand-compress memories yourself.
239
257
  ```bash
240
258
  memesh export --tag "project:myapp" > memories.json
241
259
  memesh import memories.json --merge skip # skip | overwrite | append
260
+ # append/overwrite leave a memory you archived (forgot) alone; --merge append|overwrite --restore-archived brings it back
242
261
  memesh status # version, install channel, update state
243
262
  memesh reindex --fts # rebuild the local keyword index
244
263
  ```
245
264
 
246
265
  ## Memory hygiene
247
266
 
248
- 1. **Stable names append.** Remembering under an existing name adds
249
- observations and dedupes tags it never replaces the entity. Reuse the
250
- name to grow one memory; do not mint `-v2` / dated variants of it.
267
+ 1. **Stable names append — unless you ask to replace.** Remembering under an
268
+ existing name adds observations and dedupes tags by default. Pass
269
+ `replace: true` (CLI: `--replace`) to rewrite the entity's observations,
270
+ tags and title instead — the previous version moves to
271
+ `metadata.replaced_history`, not lost. Reuse the name to grow or correct
272
+ one memory; do not mint `-v2` / dated variants of it.
251
273
  2. **`supersedes` retires the loser.** When a new memory replaces an old one,
252
274
  record it with `--supersedes <old-name>` (MCP: a relation of type
253
275
  `supersedes`). The old entity is archived — recoverable, out of recall.