linksee-memory 0.10.0 → 0.11.1
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/LICENSE +21 -21
- package/README.md +202 -100
- package/dist/bin/import-sessions.js +6 -6
- package/dist/bin/install-skill.js +14 -14
- package/dist/bin/map-import.d.ts +2 -0
- package/dist/bin/map-import.js +510 -0
- package/dist/bin/setup.js +22 -20
- package/dist/bin/stats.js +20 -20
- package/dist/db/migrate.js +36 -0
- package/dist/db/schema.sql +73 -2
- package/dist/lib/consolidate.js +19 -19
- package/dist/lib/drift-detection.js +38 -2
- package/dist/lib/edge-detection.js +8 -8
- package/dist/lib/guard.js +28 -28
- package/dist/lib/map-import.d.ts +55 -0
- package/dist/lib/map-import.js +150 -0
- package/dist/lib/map-reconcile.d.ts +29 -0
- package/dist/lib/map-reconcile.js +245 -0
- package/dist/lib/map-view.d.ts +103 -0
- package/dist/lib/map-view.js +201 -0
- package/dist/lib/momentum.js +7 -7
- package/dist/lib/truth-engine.js +11 -11
- package/dist/mcp/read-smart.js +8 -8
- package/dist/mcp/server.js +88 -1
- package/dist/skill/SKILL.md +734 -734
- package/package.json +9 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Synapse Arrows PTE. LTD.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Synapse Arrows PTE. LTD.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> **Your agent forgets everything when a session ends. Worse — it silently drifts from what you decided last week.**
|
|
4
4
|
>
|
|
5
|
-
>
|
|
5
|
+
> **Linksee Memory catches when your project drifts from its own decisions** — the option abandoned at a fork, the pipeline that quietly stalled, the code that contradicts what you agreed — and a re-injection guard re-surfaces the locked decision **before** the agent acts. Rules you've explicitly hardened get blocked.
|
|
6
6
|
>
|
|
7
|
-
>
|
|
7
|
+
> Underneath sits a local-first cross-LLM memory MCP — one SQLite file that **Claude Code, Cursor, Windsurf, OpenAI Codex, and Gemini CLI** all read from. Not just "what happened" but **WHY**: 6-layer structured memory with precision recall and an AST-aware diff cache (50–99% token savings on re-reads).
|
|
8
8
|
>
|
|
9
|
-
> `npx linksee-memory
|
|
9
|
+
> `npx -y linksee-memory setup` — one command, done.
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/linksee-memory)
|
|
12
12
|
[](./LICENSE)
|
|
@@ -14,6 +14,33 @@
|
|
|
14
14
|
[](https://glama.ai/mcp/servers/michielinksee/linksee-memory)
|
|
15
15
|
|
|
16
16
|
🌐 **Landing page**: [linksee-site.vercel.app](https://linksee-site.vercel.app) (includes non-developer onboarding for Claude Desktop / Cursor / Claude Code / OpenAI Codex / Gemini CLI)
|
|
17
|
+
📖 **Docs**: [docs.linksee.app](https://docs.linksee.app) — full reference: the product map & drift, install, and all 11 tools
|
|
18
|
+
|
|
19
|
+
## 🪄 Three spells to remember
|
|
20
|
+
|
|
21
|
+
| Say this | What happens |
|
|
22
|
+
|---|---|
|
|
23
|
+
| **"use linksee"** | Recalls relevant memories before acting |
|
|
24
|
+
| **"linksee this"** | Saves the decision / lesson right now |
|
|
25
|
+
| **"what's drifting?"** | Reconciles reality against your locked decisions |
|
|
26
|
+
|
|
27
|
+
> Make it automatic: add **"Use Linksee Memory"** to your system prompt / `CLAUDE.md`.
|
|
28
|
+
|
|
29
|
+
## 🗺️ Not just memory — a product map
|
|
30
|
+
|
|
31
|
+
Memory is the entry point. Tie it to a `map.yaml` of how your product fits together, and the `linksee-memory map` CLI catches drift with file:line evidence:
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
**The 30-second demo above:** the README says `--export`. The code doesn't. Linksee catches it — and shows what else a change would touch.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx -y linksee-memory map where README.md # this file belongs to the README node — and what it touches
|
|
39
|
+
npx -y linksee-memory map explain readme # README promises --export; the code doesn't implement it — drift, with evidence
|
|
40
|
+
npx -y linksee-memory map affects readme # changing the README also touches docs, the CLI help, and the npm listing
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
→ see [The Map](#the-map) for the full flow.
|
|
17
44
|
|
|
18
45
|
## 📣 As featured on
|
|
19
46
|
|
|
@@ -29,6 +56,24 @@
|
|
|
29
56
|
|
|
30
57
|
## 🎬 See it in action
|
|
31
58
|
|
|
59
|
+
**Drift, caught.** Decisions don't survive session boundaries — but their consequences do. Ask any session:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
You: What's drifting right now?
|
|
63
|
+
Agent: [calls drift_status]
|
|
64
|
+
|
|
65
|
+
28 anchors: ⚪ 1 held · 🔵 27 aligned
|
|
66
|
+
|
|
67
|
+
Needs attention:
|
|
68
|
+
⚪ HELD — "Focus on 4 areas: Recipe layer, agent-native API,
|
|
69
|
+
Japanese market, Agent Insights"
|
|
70
|
+
↻ Reopens 2026-07-04
|
|
71
|
+
|
|
72
|
+
Everything else is aligned — no unaccounted divergence.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**The memory underneath.** Drift detection only works because the *why* survives the session boundary:
|
|
76
|
+
|
|
32
77
|
**Without linksee-memory** — Monday morning, new Claude session:
|
|
33
78
|
|
|
34
79
|
```
|
|
@@ -59,73 +104,11 @@ That single `caveat` memory is what separates "flat fact storage" from "the agen
|
|
|
59
104
|
|
|
60
105
|
---
|
|
61
106
|
|
|
62
|
-
## 🧠 The 6-layer structure
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
66
|
-
│ 🎯 goal ← what the user is working toward │
|
|
67
|
-
├─────────────────────────────────────────────────────────────┤
|
|
68
|
-
│ 🧭 context ← why this, why now — constraints, people │
|
|
69
|
-
├─────────────────────────────────────────────────────────────┤
|
|
70
|
-
│ 💗 emotion ← user tone signals (frustration, etc.) │
|
|
71
|
-
├─────────────────────────────────────────────────────────────┤
|
|
72
|
-
│ 🛠 implementation ← how it was done (+ what failed) │
|
|
73
|
-
├─────────────────────────────────────────────────────────────┤
|
|
74
|
-
│ ⚠️ caveat ← "never do this again" · auto-protected │
|
|
75
|
-
├─────────────────────────────────────────────────────────────┤
|
|
76
|
-
│ 🌱 learning ← patterns distilled from cold memories │
|
|
77
|
-
└─────────────────────────────────────────────────────────────┘
|
|
78
|
-
│
|
|
79
|
-
▼
|
|
80
|
-
Ranked recall via relevance × heat × momentum × importance
|
|
81
|
-
Returns match_reasons explaining each hit
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Every memory is tagged with **exactly one layer**. `caveat`-layer entries are protected from auto-forgetting. Cold low-importance memories are auto-consolidated into `learning` entries on server startup.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## What it does
|
|
89
|
-
|
|
90
|
-
Most "agent memory" services (Mem0, Letta, Zep) save a flat list of facts. Then the agent looks at "edited file X 30 times" and has no idea why. **linksee-memory keeps the WHY.**
|
|
91
|
-
|
|
92
|
-
It is a Model Context Protocol (MCP) server with **7 tools** that gives any AI agent structured memory + drift detection:
|
|
93
|
-
|
|
94
|
-
| | Mem0 / Letta / Zep | Claude Code auto-memory | linksee-memory |
|
|
95
|
-
|---|---|---|---|
|
|
96
|
-
| Cross-agent | △ (cloud) | ❌ Claude only | ✅ single SQLite file |
|
|
97
|
-
| 6-layer WHY structure | ❌ flat | ❌ flat markdown | ✅ goal / context / emotion / impl / caveat / learning |
|
|
98
|
-
| **Drift detection** | ❌ | ❌ | ✅ intent ↔ reality divergence tracking |
|
|
99
|
-
| File diff cache | ❌ | ❌ | ✅ AST-aware, 50-99% token savings on re-reads |
|
|
100
|
-
| Active forgetting | △ | ❌ | ✅ Ebbinghaus curve, caveat layer protected |
|
|
101
|
-
| Local-first / private | ❌ | ✅ | ✅ |
|
|
102
|
-
|
|
103
|
-
## Four pillars
|
|
104
|
-
|
|
105
|
-
1. **Token savings** via `read_smart` — sha256 + AST/heading/indent chunking. Re-reads return only diffs. **Measured 86% saved on a typical TS file edit, 99% saved on unchanged re-reads.**
|
|
106
|
-
2. **Cross-agent portability** — single SQLite file at `~/.linksee-memory/memory.db`. Same brain for Claude Code, Cursor, Windsurf, OpenAI Codex, Gemini CLI.
|
|
107
|
-
3. **WHY-first structured memory** — six explicit layers (`goal` / `context` / `emotion` / `implementation` / `caveat` / `learning`). Solves "flat fact memory is useless without goals".
|
|
108
|
-
4. **Drift detection** — declare decisions as anchors, then the engine automatically detects when committed reality diverges from stated intent. Think "Datadog for product decisions" — unaccounted divergences surface as drift, intentional evolution (recorded as supersede/fix) stays quiet.
|
|
109
|
-
|
|
110
107
|
## 🔍 Drift Detection — "Intent Datadog"
|
|
111
108
|
|
|
112
109
|
Most teams make decisions, then forget them. The agent from last week decided "we'll use FTS5 instead of vector search" — but this week a new session installs `pgvector` without knowing why that was rejected. **That's drift.** Not a bug. Not malice. Just forgotten context.
|
|
113
110
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
You: What's drifting right now?
|
|
118
|
-
Agent: [calls drift_status]
|
|
119
|
-
|
|
120
|
-
28 anchors: ⚪ 1 held · 🔵 27 aligned
|
|
121
|
-
|
|
122
|
-
Needs attention:
|
|
123
|
-
⚪ HELD — "Focus on 4 areas: Recipe layer, agent-native API,
|
|
124
|
-
Japanese market, Agent Insights"
|
|
125
|
-
↻ Reopens 2026-07-04
|
|
126
|
-
|
|
127
|
-
Everything else is aligned — no unaccounted divergence.
|
|
128
|
-
```
|
|
111
|
+
Memory tools remember what you did. Nothing notices when you drift from what you decided — that's the layer Linksee Memory adds. Think **"Datadog for product decisions"**: unaccounted divergences surface as drift, intentional evolution (recorded as supersede/fix) stays quiet.
|
|
129
112
|
|
|
130
113
|
### How it works
|
|
131
114
|
|
|
@@ -136,7 +119,7 @@ Agent: [calls drift_status]
|
|
|
136
119
|
- 🟡 **Review** — a soft signal awaits your decision
|
|
137
120
|
- ⚪ **Held** — you acknowledged the gap, parked it with a review date
|
|
138
121
|
- 🔵 **Aligned** — reality matches intent, or a recorded resolution explains the change
|
|
139
|
-
4. **Resolve** with `fix`, `supersede`, `acknowledge`, or `dismiss`
|
|
122
|
+
4. **Resolve** with `fix`, `supersede`, `acknowledge`, or `dismiss` — plus two gates: `harden` (PreToolUse will block) and `soften` (back to a warning)
|
|
140
123
|
|
|
141
124
|
The **make-or-break rule**: a divergence accounted for by a recorded resolution (supersede/fix/acknowledge) is NOT drift. Only unaccounted gaps are flagged. This means intentional evolution stays quiet while silent abandonment gets caught.
|
|
142
125
|
|
|
@@ -153,6 +136,57 @@ Anchors are classified into four species with different display formats:
|
|
|
153
136
|
|
|
154
137
|
---
|
|
155
138
|
|
|
139
|
+
<a id="the-map"></a>
|
|
140
|
+
|
|
141
|
+
## 🗺️ The Map — `linksee-memory map`
|
|
142
|
+
|
|
143
|
+
Drift detection (above) checks individual anchors. The **Map** lifts it to the whole product: a `map.yaml` describing how value reaches your user (`discover → understand → try → adopt → retain → monetize → expand`), with typed dependencies between the pieces — README, npm listing, onboarding, the engine that powers them. The reconciler checks that map against your real code, and the CLI answers the question an engineer actually has:
|
|
144
|
+
|
|
145
|
+
> *I'm touching this file — where is it on the map, and what else must move?*
|
|
146
|
+
|
|
147
|
+
**1. Where am I?** — locate a file (or, with no argument, infer from your recent edits):
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
$ npx -y linksee-memory map where README.md
|
|
151
|
+
"README.md" belongs to this Map node:
|
|
152
|
+
|
|
153
|
+
readme [understand] convergence
|
|
154
|
+
changes ripple to:
|
|
155
|
+
must fix together (hard): lp, docs-site
|
|
156
|
+
should align (soft): onboarding, client-configs
|
|
157
|
+
fyi (may ripple): telemetry-contract
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The blast radius is **graded** — `must fix together` vs `should align` vs `fyi` — so a wide ripple isn't flat noise.
|
|
161
|
+
|
|
162
|
+
**2. Why is it in this state?** — the diagnosis, with file:line evidence:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
$ npx -y linksee-memory map explain readme
|
|
166
|
+
|
|
167
|
+
STATUS
|
|
168
|
+
declared: healthy (active)
|
|
169
|
+
reality: implemented / matches
|
|
170
|
+
verdict: declared and reality agree (verified)
|
|
171
|
+
|
|
172
|
+
EVIDENCE
|
|
173
|
+
✓ README's Tools section lists where_am_i
|
|
174
|
+
README.md:424 — found "where_am_i" in section "Tools"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Declared state and the reality verdict are shown **separately** — a hand-declared `suspect` the scanner refutes reads as *"declared suspect, refuted by reality (→ convergence)"*, not a confusing mix.
|
|
178
|
+
|
|
179
|
+
**3. Whole-project triage:** `npx -y linksee-memory map status` — a health %, what is *fixable now in code* vs *external checks*, and any deferral with no expiry (so "accounted-for" can't quietly become a drift graveyard).
|
|
180
|
+
|
|
181
|
+
**How it works**
|
|
182
|
+
- **`map.yaml`** (repo root) is the desired-state source of truth: a journey spine × surface/implementation layers × typed edges (`must-stay-consistent-with` / `should-align-with` / `realizes`).
|
|
183
|
+
- **`reconcile`** checks each node's declared `reality` against the code (`signal` / `regex` / `section_contains` / file checks) and overlays a verdict — reality overrides what you hand-declared, with evidence.
|
|
184
|
+
- `where_am_i` is also an **MCP tool**, so a coding agent can re-anchor itself mid-task.
|
|
185
|
+
|
|
186
|
+
Commands: `where` · `affects` · `explain` · `status` · `next` · `reconcile` · `inspect --json` · `blueprint`. Add `--lang ja` for Japanese labels.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
156
190
|
<a id="reinjection-guard"></a>
|
|
157
191
|
|
|
158
192
|
## 🛡 Re-injection Guard — enforce decisions *before* the action
|
|
@@ -170,7 +204,7 @@ It is **fail-open by construction**: any parse / DB / logic error surfaces nothi
|
|
|
170
204
|
|
|
171
205
|
### Enable it
|
|
172
206
|
|
|
173
|
-
`npx linksee-memory
|
|
207
|
+
`npx -y linksee-memory setup` offers to wire this into your **project's** `.claude/settings.json` (Step 4). To do it by hand, drop this block into `.claude/settings.json` at your project root — it points at the globally-installed `linksee-memory-guard` bin, so no build step is needed:
|
|
174
208
|
|
|
175
209
|
```json
|
|
176
210
|
{
|
|
@@ -179,7 +213,7 @@ It is **fail-open by construction**: any parse / DB / logic error surfaces nothi
|
|
|
179
213
|
{
|
|
180
214
|
"matcher": "startup|resume|compact",
|
|
181
215
|
"hooks": [
|
|
182
|
-
{ "type": "command", "command": "npx -y linksee-memory
|
|
216
|
+
{ "type": "command", "command": "npx -y linksee-memory guard", "timeout": 15 }
|
|
183
217
|
]
|
|
184
218
|
}
|
|
185
219
|
],
|
|
@@ -187,7 +221,7 @@ It is **fail-open by construction**: any parse / DB / logic error surfaces nothi
|
|
|
187
221
|
{
|
|
188
222
|
"matcher": "Edit|Write|Bash",
|
|
189
223
|
"hooks": [
|
|
190
|
-
{ "type": "command", "command": "npx -y linksee-memory
|
|
224
|
+
{ "type": "command", "command": "npx -y linksee-memory guard", "timeout": 8 }
|
|
191
225
|
]
|
|
192
226
|
}
|
|
193
227
|
]
|
|
@@ -197,14 +231,63 @@ It is **fail-open by construction**: any parse / DB / logic error surfaces nothi
|
|
|
197
231
|
|
|
198
232
|
It's **project-scoped on purpose** — the guard enforces *this* repo's decisions, and you opt in per project rather than letting it deny tool calls everywhere (the Stop hook from setup, by contrast, is user-global). Declare what it should watch with `declare_anchor(...)`; set `card_policy.gate_mode:'hard'` on an anchor to make a contradiction **block** instead of just warn (the soft default only re-injects). Anchors that are stale (`at_risk`), superseded, or card-disabled never gate.
|
|
199
233
|
|
|
200
|
-
> Developing linksee-memory itself? The repo dogfoods the guard via a (gitignored) `.claude/settings.json` that points at the local build (`node ${CLAUDE_PROJECT_DIR}/dist/bin/guard-hook.js`) so it runs against your uncommitted changes. End-user projects should use the published `npx -y linksee-memory
|
|
234
|
+
> Developing linksee-memory itself? The repo dogfoods the guard via a (gitignored) `.claude/settings.json` that points at the local build (`node ${CLAUDE_PROJECT_DIR}/dist/bin/guard-hook.js`) so it runs against your uncommitted changes. End-user projects should use the published `npx -y linksee-memory guard` form above.
|
|
201
235
|
|
|
202
236
|
---
|
|
203
237
|
|
|
238
|
+
## What it does
|
|
239
|
+
|
|
240
|
+
Most "agent memory" services (Mem0, Letta, Zep) save a flat list of facts. Then the agent looks at "edited file X 30 times" and has no idea why. And none of them notice when this week's work contradicts last week's decision. **linksee-memory keeps the WHY — and watches the drift.**
|
|
241
|
+
|
|
242
|
+
It is a Model Context Protocol (MCP) server with **11 tools** that gives any AI agent structured memory + drift detection:
|
|
243
|
+
|
|
244
|
+
| | Mem0 / Letta / Zep | Claude Code auto-memory | linksee-memory |
|
|
245
|
+
|---|---|---|---|
|
|
246
|
+
| **Drift detection** | ❌ | ❌ | ✅ intent ↔ reality divergence tracking |
|
|
247
|
+
| Cross-agent | △ (cloud) | ❌ Claude only | ✅ single SQLite file |
|
|
248
|
+
| 6-layer WHY structure | ❌ flat | ❌ flat markdown | ✅ goal / context / emotion / impl / caveat / learning |
|
|
249
|
+
| File diff cache | ❌ | ❌ | ✅ AST-aware, 50-99% token savings on re-reads |
|
|
250
|
+
| Active forgetting | △ | ❌ | ✅ Ebbinghaus curve, caveat layer protected |
|
|
251
|
+
| Local-first / private | ❌ | ✅ | ✅ |
|
|
252
|
+
|
|
253
|
+
## Four pillars
|
|
254
|
+
|
|
255
|
+
1. **Drift detection** — declare decisions as anchors, then the engine automatically detects when committed reality diverges from stated intent. Think "Datadog for product decisions" — unaccounted divergences surface as drift, intentional evolution (recorded as supersede/fix) stays quiet.
|
|
256
|
+
2. **Cross-agent portability** — single SQLite file at `~/.linksee-memory/memory.db`. Same brain for Claude Code, Cursor, Windsurf, OpenAI Codex, Gemini CLI.
|
|
257
|
+
3. **WHY-first structured memory** — six explicit layers (`goal` / `context` / `emotion` / `implementation` / `caveat` / `learning`). Solves "flat fact memory is useless without goals".
|
|
258
|
+
4. **Token savings** via `read_smart` — sha256 + AST/heading/indent chunking. Re-reads return only diffs. **Measured 86% saved on a typical TS file edit, 99% saved on unchanged re-reads.**
|
|
259
|
+
|
|
260
|
+
## 🧠 The 6-layer structure
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
264
|
+
│ 🎯 goal ← what the user is working toward │
|
|
265
|
+
├─────────────────────────────────────────────────────────────┤
|
|
266
|
+
│ 🧭 context ← why this, why now — constraints, people │
|
|
267
|
+
├─────────────────────────────────────────────────────────────┤
|
|
268
|
+
│ 💗 emotion ← user tone signals (frustration, etc.) │
|
|
269
|
+
├─────────────────────────────────────────────────────────────┤
|
|
270
|
+
│ 🛠 implementation ← how it was done (+ what failed) │
|
|
271
|
+
├─────────────────────────────────────────────────────────────┤
|
|
272
|
+
│ ⚠️ caveat ← "never do this again" · auto-protected │
|
|
273
|
+
├─────────────────────────────────────────────────────────────┤
|
|
274
|
+
│ 🌱 learning ← patterns distilled from cold memories │
|
|
275
|
+
└─────────────────────────────────────────────────────────────┘
|
|
276
|
+
│
|
|
277
|
+
▼
|
|
278
|
+
Ranked recall via relevance × heat × momentum × importance
|
|
279
|
+
Returns match_reasons explaining each hit
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Every memory is tagged with **exactly one layer**. `caveat`-layer entries are protected from auto-forgetting. Cold low-importance memories are auto-consolidated into `learning` entries on server startup.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
|
|
204
287
|
## Quick Start — One Command
|
|
205
288
|
|
|
206
289
|
```bash
|
|
207
|
-
npx linksee-memory
|
|
290
|
+
npx -y linksee-memory setup
|
|
208
291
|
```
|
|
209
292
|
|
|
210
293
|
This does everything:
|
|
@@ -231,7 +314,7 @@ Tools appear as `mcp__linksee__remember`, `mcp__linksee__recall`, `mcp__linksee_
|
|
|
231
314
|
**Install the skill (auto-invocation):**
|
|
232
315
|
|
|
233
316
|
```bash
|
|
234
|
-
npx -y linksee-memory
|
|
317
|
+
npx -y linksee-memory install-skill
|
|
235
318
|
```
|
|
236
319
|
|
|
237
320
|
Copies `SKILL.md` to `~/.claude/skills/linksee-memory/`. Agent auto-fires on phrases like "前に…", "また同じエラー", "覚えておいて", new task starts, file edits, etc.
|
|
@@ -247,7 +330,7 @@ Add to `~/.claude/settings.json`:
|
|
|
247
330
|
{
|
|
248
331
|
"matcher": "",
|
|
249
332
|
"hooks": [
|
|
250
|
-
{ "type": "command", "command": "npx -y linksee-memory
|
|
333
|
+
{ "type": "command", "command": "npx -y linksee-memory sync" }
|
|
251
334
|
]
|
|
252
335
|
}
|
|
253
336
|
]
|
|
@@ -305,20 +388,15 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
|
305
388
|
<summary><strong>OpenAI Codex CLI</strong></summary>
|
|
306
389
|
|
|
307
390
|
```bash
|
|
308
|
-
codex
|
|
391
|
+
codex mcp add linksee -- npx -y linksee-memory
|
|
309
392
|
```
|
|
310
393
|
|
|
311
|
-
Or add to `~/.codex/config.
|
|
394
|
+
Or add to `~/.codex/config.toml`:
|
|
312
395
|
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
"command": "npx",
|
|
318
|
-
"args": ["-y", "linksee-memory"]
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
396
|
+
```toml
|
|
397
|
+
[mcp_servers.linksee]
|
|
398
|
+
command = "npx"
|
|
399
|
+
args = ["-y", "linksee-memory"]
|
|
322
400
|
```
|
|
323
401
|
|
|
324
402
|
</details>
|
|
@@ -381,14 +459,14 @@ Default: `~/.linksee-memory/memory.db`. Override with `LINKSEE_MEMORY_DIR` env v
|
|
|
381
459
|
|
|
382
460
|
| Feature | Detail |
|
|
383
461
|
|---|---|
|
|
384
|
-
| **One-command setup** | `npx linksee-memory
|
|
462
|
+
| **One-command setup** | `npx -y linksee-memory setup` — registers MCP server, installs skill, configures auto-capture hook. One command instead of three. |
|
|
385
463
|
| **Structured memory v2** | 3-axis classification (altitude × type × state) for every memory. Auto-extraction from sessions produces machine-scannable JSON, not raw chat dumps. |
|
|
386
464
|
| **Precision recall guide** | SKILL.md now teaches agents HOW to write effective queries, WHEN to recall vs skip, and WHEN to proactively surface caveats before risky actions. |
|
|
387
465
|
| **Five MCP Blocks** | Tools + Resources + Prompts + Sampling + Roots + Elicitation. Most MCP servers expose only Tools; linksee-memory implements all five primitives. |
|
|
388
466
|
|
|
389
467
|
</details>
|
|
390
468
|
|
|
391
|
-
##
|
|
469
|
+
## 11 Tools
|
|
392
470
|
|
|
393
471
|
### Memory tools
|
|
394
472
|
|
|
@@ -406,20 +484,29 @@ Default: `~/.linksee-memory/memory.db`. Override with `LINKSEE_MEMORY_DIR` env v
|
|
|
406
484
|
| `check_decision` | **Deep-dive into a specific decision.** Returns the full context: what was decided, why, what reality says, pending candidates, and drift edges. |
|
|
407
485
|
| `declare_anchor` | **Record a decision as a truth-map anchor.** The drift detector checks these against committed reality. Supports v9 fields (domain, confidence, lifecycle, review_after). |
|
|
408
486
|
| `resolve_drift` | **Close the loop.** Record a resolution: `fix` (reality now matches), `supersede` (intent evolved), `acknowledge` (parking with review date), or `dismiss` (false positive). |
|
|
487
|
+
| `where_am_i` | **"Where on the Map am I, and what else does this touch?"** Locates the current topic/file on the Current Truth Map and returns its journey stage + blast radius (the `must-stay-consistent-with` / `should-align-with` dependents) + the decision behind it. The per-turn re-anchor that stops you optimizing one node while silently breaking its neighbors. |
|
|
488
|
+
|
|
489
|
+
### Fork-point tools (v0.10)
|
|
490
|
+
|
|
491
|
+
| Tool | What it does |
|
|
492
|
+
|---|---|
|
|
493
|
+
| `flag_proposals` | **Record orphaned proposals** — options you presented that the user never addressed. Conversations are tree-shaped but experienced linearly; the branches nobody engaged with become unresolved fork points that both you and the user lose track of. |
|
|
494
|
+
| `dream` | **Consolidate orphaned proposals against the North Star.** Returns the project's direction/goals/ICP alongside unresolved proposals; the evaluating agent decides per candidate: surface (genuinely important fork) or dismiss (outdated / irrelevant / implicitly resolved). |
|
|
495
|
+
| `resolve_proposal` | **Record the verdict** for each dreamed proposal: `surface` (keep visible on the dashboard for human decision) or `dismiss` (remove from the dashboard). |
|
|
409
496
|
|
|
410
|
-
Previous versions exposed 3 tools — v0.8.0 added 4 drift tools that let agents query and act on product-level intent ↔ reality divergence. The memory tools are unchanged.
|
|
497
|
+
Previous versions exposed 3 tools — v0.8.0 added 4 drift tools that let agents query and act on product-level intent ↔ reality divergence; v0.10 added the fork-point trio for orphaned-proposal triage; `where_am_i` adds the Current Truth Map's per-turn positional re-anchor. The memory tools are unchanged.
|
|
411
498
|
|
|
412
499
|
### CLI utilities
|
|
413
500
|
|
|
414
501
|
| Command | Purpose |
|
|
415
502
|
|---|---|
|
|
416
|
-
| `npx linksee-memory
|
|
503
|
+
| `npx -y linksee-memory setup` | One-command setup: MCP server + skill + Stop hook, then offers to wire the re-injection guard into this project. Idempotent — skips what's already done. |
|
|
417
504
|
| `npx linksee-memory` | MCP server (stdio) |
|
|
418
|
-
| `npx linksee-memory
|
|
419
|
-
| `npx linksee-memory
|
|
420
|
-
| `npx linksee-memory
|
|
421
|
-
| `npx linksee-memory
|
|
422
|
-
| `npx linksee-memory
|
|
505
|
+
| `npx -y linksee-memory sync` | Claude Code Stop-hook entry point |
|
|
506
|
+
| `npx -y linksee-memory guard` | Re-injection guard hook: `PreToolUse` gate (`Edit`/`Write`/`Bash`) + `SessionStart` boot digest. Wired per-project (see [Re-injection Guard](#reinjection-guard)); fail-open. |
|
|
507
|
+
| `npx -y linksee-memory import` | Batch-import Claude Code session JSONL history |
|
|
508
|
+
| `npx -y linksee-memory install-skill` | Install the Claude Code Skill that teaches the agent when to call recall/remember/read_smart |
|
|
509
|
+
| `npx -y linksee-memory stats` | Summary of the local DB (entity count / layer breakdown / top entities / top edited files). Add `--json` for machine-readable output. |
|
|
423
510
|
|
|
424
511
|
## The 6 memory layers
|
|
425
512
|
|
|
@@ -469,7 +556,7 @@ The conversation↔file linkage is the key. Every file edit captured by the Stop
|
|
|
469
556
|
- ✅ Five MCP Blocks (Tools + Resources + Prompts + Sampling + Roots + Elicitation)
|
|
470
557
|
- ✅ Stop-hook auto-capture for Claude Code
|
|
471
558
|
- ✅ JP/EN trigram FTS5
|
|
472
|
-
- ✅ One-command setup (`npx linksee-memory
|
|
559
|
+
- ✅ One-command setup (`npx -y linksee-memory setup`)
|
|
473
560
|
- ✅ Structured memory v2 (3-axis classification: altitude × type × state)
|
|
474
561
|
- ✅ Cross-LLM: Claude Code, Cursor, Windsurf, OpenAI Codex, Gemini CLI
|
|
475
562
|
- ✅ Landing page ([linksee-site.vercel.app](https://linksee-site.vercel.app))
|
|
@@ -546,7 +633,7 @@ No account, no credit card, no API key. Just install and use.
|
|
|
546
633
|
```bash
|
|
547
634
|
ls ~/.claude/skills/linksee-memory/SKILL.md
|
|
548
635
|
```
|
|
549
|
-
If absent, run `npx -y linksee-memory
|
|
636
|
+
If absent, run `npx -y linksee-memory install-skill`.
|
|
550
637
|
2. Restart Claude Code. Skills are indexed on session start.
|
|
551
638
|
3. Check that the MCP is registered under the name `linksee` (the skill expects `mcp__linksee__*` tool names):
|
|
552
639
|
```bash
|
|
@@ -561,9 +648,9 @@ No account, no credit card, no API key. Just install and use.
|
|
|
561
648
|
1. Check the hook log: `cat ~/.linksee-memory/hook.log`
|
|
562
649
|
2. Run a manual test:
|
|
563
650
|
```bash
|
|
564
|
-
echo '{"session_id":"test","transcript_path":"/path/to/some.jsonl"}' | npx linksee-memory
|
|
651
|
+
echo '{"session_id":"test","transcript_path":"/path/to/some.jsonl"}' | npx -y linksee-memory sync
|
|
565
652
|
```
|
|
566
|
-
3. Make sure the `Stop` hook in `~/.claude/settings.json` points to `npx -y linksee-memory
|
|
653
|
+
3. Make sure the `Stop` hook in `~/.claude/settings.json` points to `npx -y linksee-memory sync` (not the old `-import`).
|
|
567
654
|
</details>
|
|
568
655
|
|
|
569
656
|
<details>
|
|
@@ -572,7 +659,7 @@ No account, no credit card, no API key. Just install and use.
|
|
|
572
659
|
v0.0.6+ fixed the entity detection bug that collapsed all memories into the session's starting cwd. To re-index existing history with correct project attribution, run:
|
|
573
660
|
|
|
574
661
|
```bash
|
|
575
|
-
npx linksee-memory
|
|
662
|
+
npx -y linksee-memory import --all
|
|
576
663
|
```
|
|
577
664
|
|
|
578
665
|
The importer is idempotent (wipes existing session data before re-inserting). Typical runtime: a few minutes for hundreds of sessions. Expect a dramatic improvement in `recall` precision afterward.
|
|
@@ -700,6 +787,21 @@ After install, in a new Claude session ask: *"Can you remember that I prefer Typ
|
|
|
700
787
|
|
|
701
788
|
## Changelog
|
|
702
789
|
|
|
790
|
+
### v0.11.1 — Cold-start fixes (2026-06-16)
|
|
791
|
+
|
|
792
|
+
- **Run any CLI through the package name:** `npx -y linksee-memory setup` (and `map`, `sync`, `guard`, `stats`, `import`, `install-skill`). A fresh user couldn't reach the standalone bins (`linksee-memory-setup`, …) via `npx` — npx resolves package names, not sibling bin names — so the one-command install 404'd. The main bin now dispatches subcommands; the standalone bins remain as aliases.
|
|
793
|
+
- **`map` exits gracefully** with a next-step message when there's no `map.yaml` yet (was a raw stack trace — the exact state of a first-time user).
|
|
794
|
+
- **serverInfo** now reports the real package version (was pinned to an old string).
|
|
795
|
+
|
|
796
|
+
### v0.11.0 — The Map: `where_am_i` + `linksee-memory map` (2026-06-15)
|
|
797
|
+
|
|
798
|
+
**Memory is the entry point; the product map is the new surface.** Drift detection grows up from individual anchors into a whole-product map you navigate from the CLI.
|
|
799
|
+
|
|
800
|
+
- **`where_am_i`** (11th MCP tool) — locate the current topic/file on the Current Truth Map and get its blast radius. Call it with no args to auto-locate from your recent edits.
|
|
801
|
+
- **`linksee-memory map`** CLI — `where` · `affects` · `explain` · `status` · `next` · `reconcile` · `inspect --json` · `blueprint`. A `map.yaml` (git source of truth) describes how value reaches your user; the reconciler checks it against your code with file:line evidence. Bilingual: add `--lang ja`.
|
|
802
|
+
- Graded blast radius (`must fix together` / `should align` / `fyi`), declared-vs-reality verdicts, and an anti-graveyard guard for accounted-for drift.
|
|
803
|
+
- Per-project keys so the Map handles many projects at once.
|
|
804
|
+
|
|
703
805
|
### v0.8.0 — Drift Detection MCP Tools (2026-06-08)
|
|
704
806
|
|
|
705
807
|
**3 tools → 7 tools.** The biggest update since launch — agents can now detect, query, and resolve intent ↔ reality drift.
|
|
@@ -800,7 +902,7 @@ Based on one week of dogfooding, here's what changed:
|
|
|
800
902
|
**New tools**
|
|
801
903
|
- `update_memory` — atomic edit with preserved `memory_id`. Solves the "forget+remember breaks session_file_edits links" bug.
|
|
802
904
|
- `list_entities` — fast "what do I know about?" primitive for session init. Supports `kind`/`min_memories` filters and returns layer breakdown.
|
|
803
|
-
- `npx linksee-memory
|
|
905
|
+
- `npx -y linksee-memory stats` — local DB summary CLI.
|
|
804
906
|
|
|
805
907
|
**`recall` enhancements**
|
|
806
908
|
- `match_reasons` array on each memory: e.g. `["content_match_fts", "heat:hot", "pinned"]`.
|
|
@@ -16,10 +16,10 @@ import { extractSession } from '../lib/session-extractor.js';
|
|
|
16
16
|
import { normalizeEntityName } from '../lib/normalize.js';
|
|
17
17
|
const CLAUDE_PROJECTS = join(homedir(), '.claude', 'projects');
|
|
18
18
|
function usage() {
|
|
19
|
-
console.log(`Usage:
|
|
20
|
-
node dist/bin/import-sessions.js [--dry-run] [--all | <projectDir> [<projectDir> ...]]
|
|
21
|
-
--all : scan every project under ~/.claude/projects/*
|
|
22
|
-
--dry-run : parse + extract but do not write to DB
|
|
19
|
+
console.log(`Usage:
|
|
20
|
+
node dist/bin/import-sessions.js [--dry-run] [--all | <projectDir> [<projectDir> ...]]
|
|
21
|
+
--all : scan every project under ~/.claude/projects/*
|
|
22
|
+
--dry-run : parse + extract but do not write to DB
|
|
23
23
|
projectDir : absolute path to a project dir (must contain *.jsonl files)`);
|
|
24
24
|
}
|
|
25
25
|
function collectJsonlFiles(projectDir) {
|
|
@@ -48,7 +48,7 @@ function collectJsonlFiles(projectDir) {
|
|
|
48
48
|
function wipeSession(db, sessionId) {
|
|
49
49
|
const sidNeedle = `%"session_id":"${sessionId}"%`;
|
|
50
50
|
const editDel = db.prepare('DELETE FROM session_file_edits WHERE session_id = ?').run(sessionId);
|
|
51
|
-
const memDel = db.prepare(`DELETE FROM memories WHERE source LIKE ?
|
|
51
|
+
const memDel = db.prepare(`DELETE FROM memories WHERE source LIKE ?
|
|
52
52
|
AND (NOT json_valid(content) OR COALESCE(json_extract(content, '$.distilled'), 0) != 1)`).run(sidNeedle);
|
|
53
53
|
const evtDel = db.prepare('DELETE FROM events WHERE payload LIKE ?').run(sidNeedle);
|
|
54
54
|
return { memories: memDel.changes, edits: editDel.changes, events: evtDel.changes };
|
|
@@ -56,7 +56,7 @@ function wipeSession(db, sessionId) {
|
|
|
56
56
|
// A re-extracted memory must NOT be re-inserted if its source turn already has a surviving
|
|
57
57
|
// distilled rewrite (matched by turn_uuid — the stable key shared by raw and rewrite).
|
|
58
58
|
function makeDistilledTurnSet(db, sessionId) {
|
|
59
|
-
const rows = db.prepare(`SELECT source FROM memories
|
|
59
|
+
const rows = db.prepare(`SELECT source FROM memories
|
|
60
60
|
WHERE source LIKE ? AND json_valid(content) AND json_extract(content, '$.distilled') = 1`).all(`%"session_id":"${sessionId}"%`);
|
|
61
61
|
const set = new Set();
|
|
62
62
|
for (const r of rows) {
|
|
@@ -21,20 +21,20 @@ const force = args.includes('--force') || args.includes('-f');
|
|
|
21
21
|
const dryRun = args.includes('--dry-run');
|
|
22
22
|
const showHelp = args.includes('--help') || args.includes('-h');
|
|
23
23
|
if (showHelp) {
|
|
24
|
-
console.log(`linksee-memory-install-skill
|
|
25
|
-
|
|
26
|
-
Install the linksee-memory Claude Code skill into ~/.claude/skills/linksee-memory/.
|
|
27
|
-
|
|
28
|
-
Options:
|
|
29
|
-
--force, -f Overwrite an existing skill file
|
|
30
|
-
--dry-run Show what would happen without writing
|
|
31
|
-
--help, -h This message
|
|
32
|
-
|
|
33
|
-
After installation, ensure the MCP server is registered in Claude Code:
|
|
34
|
-
claude mcp add -s user linksee -- npx -y linksee-memory
|
|
35
|
-
|
|
36
|
-
The skill expects tool names of the form mcp__linksee__*. If you register the
|
|
37
|
-
server under a different name (e.g. "linksee-memory"), edit the skill file
|
|
24
|
+
console.log(`linksee-memory-install-skill
|
|
25
|
+
|
|
26
|
+
Install the linksee-memory Claude Code skill into ~/.claude/skills/linksee-memory/.
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
--force, -f Overwrite an existing skill file
|
|
30
|
+
--dry-run Show what would happen without writing
|
|
31
|
+
--help, -h This message
|
|
32
|
+
|
|
33
|
+
After installation, ensure the MCP server is registered in Claude Code:
|
|
34
|
+
claude mcp add -s user linksee -- npx -y linksee-memory
|
|
35
|
+
|
|
36
|
+
The skill expects tool names of the form mcp__linksee__*. If you register the
|
|
37
|
+
server under a different name (e.g. "linksee-memory"), edit the skill file
|
|
38
38
|
afterwards.`);
|
|
39
39
|
process.exit(0);
|
|
40
40
|
}
|