linksee-memory 0.4.0 → 0.4.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.
- package/README.md +139 -47
- package/dist/bin/setup.d.ts +2 -0
- package/dist/bin/setup.js +220 -0
- package/dist/skill/SKILL.md +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# linksee-memory
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **Your agent forgets everything when a session ends. Linksee Memory is the fix.**
|
|
4
4
|
>
|
|
5
|
-
>
|
|
5
|
+
> 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** it happened: 6-layer structured memory with precision recall that surfaces the right context at the right moment.
|
|
6
|
+
>
|
|
7
|
+
> `npx linksee-memory-setup` — one command, done.
|
|
6
8
|
|
|
7
9
|
[](https://www.npmjs.com/package/linksee-memory)
|
|
8
10
|
[](./LICENSE)
|
|
@@ -98,47 +100,46 @@ It is a Model Context Protocol (MCP) server that gives any AI agent four superpo
|
|
|
98
100
|
## Three pillars
|
|
99
101
|
|
|
100
102
|
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.**
|
|
101
|
-
2. **Cross-agent portability** — single SQLite file at `~/.linksee-memory/memory.db`. Same brain for Claude Code, Cursor, OpenAI Codex, Gemini CLI.
|
|
103
|
+
2. **Cross-agent portability** — single SQLite file at `~/.linksee-memory/memory.db`. Same brain for Claude Code, Cursor, Windsurf, OpenAI Codex, Gemini CLI.
|
|
102
104
|
3. **WHY-first structured memory** — six explicit layers (`goal` / `context` / `emotion` / `implementation` / `caveat` / `learning`). Solves "flat fact memory is useless without goals".
|
|
103
105
|
|
|
104
|
-
##
|
|
106
|
+
## Quick Start — One Command
|
|
105
107
|
|
|
106
108
|
```bash
|
|
107
|
-
|
|
108
|
-
linksee-memory-import --help # bundled importer for Claude Code session history
|
|
109
|
+
npx linksee-memory-setup
|
|
109
110
|
```
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
This does everything:
|
|
113
|
+
1. Registers the MCP server with Claude Code
|
|
114
|
+
2. Installs the agent skill (teaches the agent when to recall/remember)
|
|
115
|
+
3. Configures auto-capture (every session saved to your local brain)
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
Restart Claude Code, then just chat normally. Add **"Use Linksee"** to any prompt to trigger memory recall.
|
|
118
|
+
|
|
119
|
+
### Manual setup (if you prefer step-by-step)
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
<details>
|
|
122
|
+
<summary>Click to expand manual installation</summary>
|
|
118
123
|
|
|
119
|
-
|
|
124
|
+
**Install & register:**
|
|
120
125
|
|
|
121
126
|
```bash
|
|
122
127
|
claude mcp add -s user linksee -- npx -y linksee-memory
|
|
123
128
|
```
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
### Recommended: install the skill (auto-invocation)
|
|
130
|
+
Tools appear as `mcp__linksee__remember`, `mcp__linksee__recall`, `mcp__linksee__recall_file`, `mcp__linksee__read_smart`, `mcp__linksee__forget`, `mcp__linksee__consolidate`.
|
|
128
131
|
|
|
129
|
-
|
|
132
|
+
**Install the skill (auto-invocation):**
|
|
130
133
|
|
|
131
134
|
```bash
|
|
132
135
|
npx -y linksee-memory-install-skill
|
|
133
136
|
```
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
Copies `SKILL.md` to `~/.claude/skills/linksee-memory/`. Agent auto-fires on phrases like "前に…", "また同じエラー", "覚えておいて", new task starts, file edits, etc.
|
|
136
139
|
|
|
137
|
-
|
|
140
|
+
**Configure auto-capture (Stop hook):**
|
|
138
141
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Add to `~/.claude/settings.json` to record every Claude Code session to your local brain automatically:
|
|
142
|
+
Add to `~/.claude/settings.json`:
|
|
142
143
|
|
|
143
144
|
```json
|
|
144
145
|
{
|
|
@@ -155,18 +156,107 @@ Add to `~/.claude/settings.json` to record every Claude Code session to your loc
|
|
|
155
156
|
}
|
|
156
157
|
```
|
|
157
158
|
|
|
158
|
-
Each turn end takes ~100 ms. Failures are silent
|
|
159
|
+
Each turn end takes ~100 ms. Failures are silent. Logs at `~/.linksee-memory/hook.log`.
|
|
160
|
+
|
|
161
|
+
</details>
|
|
162
|
+
|
|
163
|
+
### Other editors / CLIs
|
|
164
|
+
|
|
165
|
+
Linksee Memory is a standard MCP server (stdio). Any tool that speaks MCP can connect:
|
|
166
|
+
|
|
167
|
+
<details>
|
|
168
|
+
<summary><strong>Cursor</strong></summary>
|
|
169
|
+
|
|
170
|
+
Add to `~/.cursor/mcp.json`:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"mcpServers": {
|
|
175
|
+
"linksee": {
|
|
176
|
+
"command": "npx",
|
|
177
|
+
"args": ["-y", "linksee-memory"]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Restart Cursor. Memory tools appear in the agent panel.
|
|
184
|
+
|
|
185
|
+
</details>
|
|
186
|
+
|
|
187
|
+
<details>
|
|
188
|
+
<summary><strong>Windsurf</strong></summary>
|
|
189
|
+
|
|
190
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"mcpServers": {
|
|
195
|
+
"linksee": {
|
|
196
|
+
"command": "npx",
|
|
197
|
+
"args": ["-y", "linksee-memory"]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
</details>
|
|
204
|
+
|
|
205
|
+
<details>
|
|
206
|
+
<summary><strong>OpenAI Codex CLI</strong></summary>
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
codex --mcp-server "npx -y linksee-memory"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Or add to `~/.codex/config.json`:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"mcpServers": {
|
|
217
|
+
"linksee": {
|
|
218
|
+
"command": "npx",
|
|
219
|
+
"args": ["-y", "linksee-memory"]
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
</details>
|
|
226
|
+
|
|
227
|
+
<details>
|
|
228
|
+
<summary><strong>Gemini CLI</strong></summary>
|
|
229
|
+
|
|
230
|
+
Add to `~/.gemini/settings.json`:
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"mcpServers": {
|
|
235
|
+
"linksee": {
|
|
236
|
+
"command": "npx",
|
|
237
|
+
"args": ["-y", "linksee-memory"]
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
</details>
|
|
244
|
+
|
|
245
|
+
All editors share the same `~/.linksee-memory/memory.db`. A decision made in Claude Code is recalled in Cursor. A caveat recorded in Windsurf prevents the same mistake in Codex.
|
|
246
|
+
|
|
247
|
+
### Database location
|
|
248
|
+
|
|
249
|
+
Default: `~/.linksee-memory/memory.db`. Override with `LINKSEE_MEMORY_DIR` env var.
|
|
159
250
|
|
|
160
|
-
##
|
|
251
|
+
## What's new in v0.4
|
|
161
252
|
|
|
162
|
-
|
|
|
253
|
+
| Feature | Detail |
|
|
163
254
|
|---|---|
|
|
164
|
-
| **
|
|
165
|
-
| **
|
|
166
|
-
| **
|
|
167
|
-
| **
|
|
168
|
-
| **
|
|
169
|
-
| **Elicitation** *(client opt-in, newer primitive)* | `forget{interactive:true, memory_id:N}` asks the user to confirm via the client UI before deleting. |
|
|
255
|
+
| **One-command setup** | `npx linksee-memory-setup` — registers MCP server, installs skill, configures auto-capture hook. One command instead of three. |
|
|
256
|
+
| **Structured memory v2** | 3-axis classification (altitude × type × state) for every memory. Auto-extraction from sessions produces machine-scannable JSON, not raw chat dumps. |
|
|
257
|
+
| **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. |
|
|
258
|
+
| **"Use Linksee" trigger** | Add "Use Linksee" to any prompt to force memory recall — same adoption pattern as Context7. |
|
|
259
|
+
| **Five MCP Blocks** | Tools + Resources + Prompts + Sampling + Roots + Elicitation. Most MCP servers expose only Tools; linksee-memory implements all six primitives. |
|
|
170
260
|
|
|
171
261
|
## Tools
|
|
172
262
|
|
|
@@ -185,32 +275,33 @@ Each turn end takes ~100 ms. Failures are silent (Claude Code never blocks). Log
|
|
|
185
275
|
|
|
186
276
|
| Command | Purpose |
|
|
187
277
|
|---|---|
|
|
278
|
+
| `npx linksee-memory-setup` | **v0.4.1** One-command setup: MCP server + skill + Stop hook. Idempotent — skips what's already done. |
|
|
188
279
|
| `npx linksee-memory` | MCP server (stdio) |
|
|
189
280
|
| `npx linksee-memory-sync` | Claude Code Stop-hook entry point |
|
|
190
281
|
| `npx linksee-memory-import` | Batch-import Claude Code session JSONL history |
|
|
191
282
|
| `npx linksee-memory-install-skill` | Install the Claude Code Skill that teaches the agent when to call recall/remember/read_smart |
|
|
192
|
-
| `npx linksee-memory-stats` |
|
|
283
|
+
| `npx linksee-memory-stats` | Summary of the local DB (entity count / layer breakdown / top entities / top edited files). Add `--json` for machine-readable output. |
|
|
193
284
|
|
|
194
285
|
## The 6 memory layers
|
|
195
286
|
|
|
196
|
-
Each entity (person / company / project / file / concept) can have memories across six layers.
|
|
287
|
+
Each entity (person / company / project / file / concept) can have memories across six layers. Since v0.4, each memory uses the **3-axis structured format** (altitude × type × state):
|
|
197
288
|
|
|
198
289
|
```json
|
|
199
290
|
{
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
"learning":[{ "at": "...", "learned": "...", "prior_belief": "..." }]
|
|
291
|
+
"title": "freee OAuth token expires in 24h",
|
|
292
|
+
"altitude": "implementation",
|
|
293
|
+
"type": "outcome",
|
|
294
|
+
"state": "done",
|
|
295
|
+
"what": "freee OAuth token expires in 24 hours. Must refresh proactively.",
|
|
296
|
+
"why": "freee uses short-lived tokens unlike most SaaS (usually 30-90 day expiry)",
|
|
297
|
+
"affects": ["src/integrations/freee/auth.ts"],
|
|
298
|
+
"next_action": null
|
|
209
299
|
}
|
|
210
300
|
```
|
|
211
301
|
|
|
212
302
|
- `caveat` memories are auto-protected from forgetting (pain lessons, never lost).
|
|
213
303
|
- `goal` memories bypass decay while the goal is active.
|
|
304
|
+
- `state` tracks lifecycle: `open` → `decided` → `in_progress` → `done` / `stalled` / `superseded`.
|
|
214
305
|
|
|
215
306
|
## Architecture
|
|
216
307
|
|
|
@@ -233,15 +324,16 @@ The conversation↔file linkage is the key. Every file edit captured by the Stop
|
|
|
233
324
|
|
|
234
325
|
## Roadmap
|
|
235
326
|
|
|
236
|
-
- ✅ Core
|
|
327
|
+
- ✅ Core 8 MCP tools + Five Blocks (Tools + Resources + Prompts + Sampling + Roots + Elicitation)
|
|
237
328
|
- ✅ Stop-hook auto-capture for Claude Code
|
|
238
329
|
- ✅ JP/EN trigram FTS5
|
|
239
|
-
- ✅
|
|
240
|
-
- ✅
|
|
241
|
-
-
|
|
242
|
-
-
|
|
330
|
+
- ✅ One-command setup (`npx linksee-memory-setup`)
|
|
331
|
+
- ✅ Structured memory v2 (3-axis classification: altitude × type × state)
|
|
332
|
+
- ✅ Precision recall guide + proactive caveat surfacing
|
|
333
|
+
- ✅ Cross-LLM: Claude Code, Cursor, Windsurf, OpenAI Codex, Gemini CLI
|
|
334
|
+
- 🚧 Landing page + SEO
|
|
243
335
|
- 🔮 Vector search via `sqlite-vec` (already in deps, embedding backend pending)
|
|
244
|
-
- 🔮 Cross-device cloud sync (Pro tier
|
|
336
|
+
- 🔮 Cross-device cloud sync (Pro tier)
|
|
245
337
|
- 🔮 Optional anonymized telemetry → MCP-quality intelligence layer
|
|
246
338
|
|
|
247
339
|
## Comparison with Claude Code auto-memory
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// setup: One-command setup for Linksee Memory — the "Use Linksee" installer.
|
|
3
|
+
//
|
|
4
|
+
// Usage:
|
|
5
|
+
// npx linksee-memory-setup (interactive setup)
|
|
6
|
+
// npx linksee-memory-setup --yes (accept all defaults, no prompts)
|
|
7
|
+
// npx linksee-memory-setup --dry-run
|
|
8
|
+
//
|
|
9
|
+
// Does three things:
|
|
10
|
+
// 1. Registers the MCP server with Claude Code
|
|
11
|
+
// 2. Installs the SKILL.md (agent trigger phrases)
|
|
12
|
+
// 3. Configures the Stop hook (auto-capture sessions)
|
|
13
|
+
//
|
|
14
|
+
// After setup, every Claude Code session:
|
|
15
|
+
// - Auto-captures decisions, learnings, caveats to local memory
|
|
16
|
+
// - Agent auto-recalls past context at task start (via SKILL.md triggers)
|
|
17
|
+
// - "Use Linksee" in any prompt forces a recall
|
|
18
|
+
//
|
|
19
|
+
// Why: Competing memory tools (claude-mem, etc.) are one-install-and-done.
|
|
20
|
+
// Our MCP approach gives more precision, but the setup was 3 manual steps.
|
|
21
|
+
// This command eliminates that friction entirely.
|
|
22
|
+
import { spawnSync } from 'node:child_process';
|
|
23
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync } from 'node:fs';
|
|
24
|
+
import { join, dirname } from 'node:path';
|
|
25
|
+
import { homedir } from 'node:os';
|
|
26
|
+
import { fileURLToPath } from 'node:url';
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
const dryRun = args.includes('--dry-run');
|
|
29
|
+
const autoYes = args.includes('--yes') || args.includes('-y');
|
|
30
|
+
const showHelp = args.includes('--help') || args.includes('-h');
|
|
31
|
+
if (showHelp) {
|
|
32
|
+
console.log(`linksee-memory-setup — One-command setup for Linksee Memory
|
|
33
|
+
|
|
34
|
+
Usage:
|
|
35
|
+
npx linksee-memory-setup Interactive setup
|
|
36
|
+
npx linksee-memory-setup --yes Accept all defaults, no prompts
|
|
37
|
+
npx linksee-memory-setup --dry-run Show what would happen
|
|
38
|
+
|
|
39
|
+
What it does:
|
|
40
|
+
1. Registers linksee-memory MCP server with Claude Code
|
|
41
|
+
2. Installs SKILL.md (teaches the agent when to recall/remember)
|
|
42
|
+
3. Configures Stop hook (auto-captures every session)
|
|
43
|
+
|
|
44
|
+
After setup, just chat with Claude Code normally.
|
|
45
|
+
Add "Use Linksee" to any prompt to trigger memory recall.`);
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
// ── Constants ────────────────────────────────────────────
|
|
49
|
+
const HOME = homedir();
|
|
50
|
+
const CLAUDE_DIR = join(HOME, '.claude');
|
|
51
|
+
const SETTINGS_PATH = join(CLAUDE_DIR, 'settings.json');
|
|
52
|
+
const SKILL_DIR = join(CLAUDE_DIR, 'skills', 'linksee-memory');
|
|
53
|
+
const SKILL_TARGET = join(SKILL_DIR, 'SKILL.md');
|
|
54
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
55
|
+
const SKILL_SRC = join(dirname(__filename), '..', 'skill', 'SKILL.md');
|
|
56
|
+
const SERVER_NAME = 'linksee';
|
|
57
|
+
const MCP_COMMAND = `claude mcp add -s user ${SERVER_NAME} -- npx -y linksee-memory`;
|
|
58
|
+
const HOOK_COMMAND = 'npx -y linksee-memory-sync';
|
|
59
|
+
const CHECK = '\x1b[32m✓\x1b[0m';
|
|
60
|
+
const SKIP = '\x1b[33m○\x1b[0m';
|
|
61
|
+
const FAIL = '\x1b[31m✗\x1b[0m';
|
|
62
|
+
const BOLD = '\x1b[1m';
|
|
63
|
+
const DIM = '\x1b[2m';
|
|
64
|
+
const RESET = '\x1b[0m';
|
|
65
|
+
console.log('');
|
|
66
|
+
console.log(`${BOLD}Linksee Memory Setup${RESET}`);
|
|
67
|
+
console.log(`${DIM}Local-first cross-LLM memory · precision recall${RESET}`);
|
|
68
|
+
console.log('');
|
|
69
|
+
// ── Step 1: Register MCP server ──────────────────────────
|
|
70
|
+
console.log(`${BOLD}[1/3]${RESET} Registering MCP server...`);
|
|
71
|
+
let mcpAlreadyRegistered = false;
|
|
72
|
+
try {
|
|
73
|
+
// Check if already registered by looking at settings.json or .claude.json
|
|
74
|
+
for (const confFile of [SETTINGS_PATH, join(HOME, '.claude.json')]) {
|
|
75
|
+
if (!existsSync(confFile))
|
|
76
|
+
continue;
|
|
77
|
+
try {
|
|
78
|
+
const conf = JSON.parse(readFileSync(confFile, 'utf8'));
|
|
79
|
+
if (conf?.mcpServers?.[SERVER_NAME]) {
|
|
80
|
+
mcpAlreadyRegistered = true;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch { /* ignore parse errors */ }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch { /* ignore */ }
|
|
88
|
+
if (mcpAlreadyRegistered) {
|
|
89
|
+
console.log(` ${SKIP} MCP server '${SERVER_NAME}' already registered`);
|
|
90
|
+
}
|
|
91
|
+
else if (dryRun) {
|
|
92
|
+
console.log(` ${DIM}[dry-run] Would run: ${MCP_COMMAND}${RESET}`);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
try {
|
|
96
|
+
// Check if 'claude' CLI is available
|
|
97
|
+
const which = spawnSync(process.platform === 'win32' ? 'where' : 'which', ['claude'], {
|
|
98
|
+
encoding: 'utf8',
|
|
99
|
+
timeout: 5000,
|
|
100
|
+
});
|
|
101
|
+
if (which.status !== 0) {
|
|
102
|
+
console.log(` ${FAIL} 'claude' CLI not found. Install Claude Code first:`);
|
|
103
|
+
console.log(` https://docs.anthropic.com/en/docs/claude-code`);
|
|
104
|
+
console.log(` ${DIM}Then run this setup again.${RESET}`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const r = spawnSync('claude', ['mcp', 'add', '-s', 'user', SERVER_NAME, '--', 'npx', '-y', 'linksee-memory'], {
|
|
108
|
+
encoding: 'utf8',
|
|
109
|
+
timeout: 15000,
|
|
110
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
111
|
+
});
|
|
112
|
+
if (r.status === 0) {
|
|
113
|
+
console.log(` ${CHECK} MCP server registered as '${SERVER_NAME}'`);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// May fail if already exists with different config
|
|
117
|
+
const stderr = (r.stderr || '').trim();
|
|
118
|
+
if (stderr.includes('already exists') || stderr.includes('already registered')) {
|
|
119
|
+
console.log(` ${SKIP} MCP server '${SERVER_NAME}' already registered`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(` ${FAIL} Registration failed: ${stderr || 'unknown error'}`);
|
|
123
|
+
console.log(` ${DIM}Manual: ${MCP_COMMAND}${RESET}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
console.log(` ${FAIL} Error: ${e?.message ?? e}`);
|
|
130
|
+
console.log(` ${DIM}Manual: ${MCP_COMMAND}${RESET}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
console.log('');
|
|
134
|
+
// ── Step 2: Install SKILL.md ─────────────────────────────
|
|
135
|
+
console.log(`${BOLD}[2/3]${RESET} Installing agent skill...`);
|
|
136
|
+
if (!existsSync(SKILL_SRC)) {
|
|
137
|
+
console.log(` ${FAIL} Bundled SKILL.md not found (packaging bug)`);
|
|
138
|
+
console.log(` ${DIM}Expected at: ${SKILL_SRC}${RESET}`);
|
|
139
|
+
}
|
|
140
|
+
else if (dryRun) {
|
|
141
|
+
console.log(` ${DIM}[dry-run] Would copy to: ${SKILL_TARGET}${RESET}`);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
mkdirSync(SKILL_DIR, { recursive: true });
|
|
145
|
+
let shouldWrite = true;
|
|
146
|
+
if (existsSync(SKILL_TARGET)) {
|
|
147
|
+
try {
|
|
148
|
+
const existing = readFileSync(SKILL_TARGET, 'utf8');
|
|
149
|
+
const bundled = readFileSync(SKILL_SRC, 'utf8');
|
|
150
|
+
if (existing === bundled) {
|
|
151
|
+
console.log(` ${SKIP} Skill already installed and up to date`);
|
|
152
|
+
shouldWrite = false;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Newer version — overwrite
|
|
156
|
+
console.log(` ${DIM}Updating to latest version...${RESET}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch { /* fallthrough to write */ }
|
|
160
|
+
}
|
|
161
|
+
if (shouldWrite) {
|
|
162
|
+
copyFileSync(SKILL_SRC, SKILL_TARGET);
|
|
163
|
+
console.log(` ${CHECK} Skill installed → ${SKILL_TARGET}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
console.log('');
|
|
167
|
+
// ── Step 3: Configure Stop hook ──────────────────────────
|
|
168
|
+
console.log(`${BOLD}[3/3]${RESET} Configuring auto-capture hook...`);
|
|
169
|
+
let settings = {};
|
|
170
|
+
if (existsSync(SETTINGS_PATH)) {
|
|
171
|
+
try {
|
|
172
|
+
settings = JSON.parse(readFileSync(SETTINGS_PATH, 'utf8'));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
console.log(` ${FAIL} Could not parse ${SETTINGS_PATH}`);
|
|
176
|
+
settings = {};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Check if hook already exists
|
|
180
|
+
const stopHooks = settings?.hooks?.Stop ?? [];
|
|
181
|
+
const alreadyHooked = stopHooks.some((entry) => entry.hooks?.some((h) => h.command?.includes('linksee-memory-sync')));
|
|
182
|
+
if (alreadyHooked) {
|
|
183
|
+
console.log(` ${SKIP} Stop hook already configured`);
|
|
184
|
+
}
|
|
185
|
+
else if (dryRun) {
|
|
186
|
+
console.log(` ${DIM}[dry-run] Would add Stop hook to ${SETTINGS_PATH}${RESET}`);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// Add hook
|
|
190
|
+
if (!settings.hooks)
|
|
191
|
+
settings.hooks = {};
|
|
192
|
+
if (!settings.hooks.Stop)
|
|
193
|
+
settings.hooks.Stop = [];
|
|
194
|
+
settings.hooks.Stop.push({
|
|
195
|
+
matcher: '',
|
|
196
|
+
hooks: [{ type: 'command', command: HOOK_COMMAND }],
|
|
197
|
+
});
|
|
198
|
+
mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
199
|
+
writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2), 'utf8');
|
|
200
|
+
console.log(` ${CHECK} Stop hook added → ${SETTINGS_PATH}`);
|
|
201
|
+
}
|
|
202
|
+
console.log('');
|
|
203
|
+
// ── Summary ──────────────────────────────────────────────
|
|
204
|
+
console.log(`${BOLD}Setup complete!${RESET}`);
|
|
205
|
+
console.log('');
|
|
206
|
+
console.log('How it works:');
|
|
207
|
+
console.log(` ${DIM}• Every session is auto-captured (decisions, caveats, learnings)${RESET}`);
|
|
208
|
+
console.log(` ${DIM}• Agent auto-recalls past context when starting a task${RESET}`);
|
|
209
|
+
console.log(` ${DIM}• Memory is local-first (nothing leaves your machine)${RESET}`);
|
|
210
|
+
console.log(` ${DIM}• Works across Claude Code, Cursor, ChatGPT (cross-LLM)${RESET}`);
|
|
211
|
+
console.log('');
|
|
212
|
+
console.log('Test by asking:');
|
|
213
|
+
console.log(` ${BOLD}"How did we solve this before?"${RESET}`);
|
|
214
|
+
console.log(` ${BOLD}"Same error again"${RESET}`);
|
|
215
|
+
console.log(` ${BOLD}"Remember: I prefer TypeScript over JavaScript"${RESET}`);
|
|
216
|
+
console.log(` ${BOLD}「前にこの問題どう解決したっけ」${RESET}`);
|
|
217
|
+
console.log('');
|
|
218
|
+
console.log(`Or add ${BOLD}"Use Linksee"${RESET} to any prompt to trigger memory recall.`);
|
|
219
|
+
console.log('');
|
|
220
|
+
//# sourceMappingURL=setup.js.map
|
package/dist/skill/SKILL.md
CHANGED
|
@@ -14,8 +14,8 @@ description: |
|
|
|
14
14
|
⑥ When asked "why did we do that", "when was this decided", "where did we discuss this" / 「なぜそうした」「いつ決めた」「どこで議論した」
|
|
15
15
|
⑦ Returning from another project / switching sessions / 別プロジェクトから戻ってきたとき
|
|
16
16
|
|
|
17
|
-
Triggers (EN): remember/recall/forget/memory/before/earlier/last time/previously/remember when/same as before/history
|
|
18
|
-
Triggers (JP):
|
|
17
|
+
Triggers (EN): remember/recall/forget/memory/before/earlier/last time/previously/remember when/same as before/history/use linksee/linksee
|
|
18
|
+
Triggers (JP): 記憶/覚えて/忘れて/過去/前回/前に/そういえば/覚えてる/リンクシー
|
|
19
19
|
Error keywords (EN): failed/broken/stuck/error/bug/doesn't work/not working/same error again/again/repeated/debug
|
|
20
20
|
Error keywords (JP): 失敗/エラー/うまくいかない/ハマった/同じ/また/繰り返し
|
|
21
21
|
Decision keywords (EN): decided/let's go with/approved/settled on/pivot/strategy/switch to/abandon
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linksee-memory",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"mcpName": "io.github.michielinksee/linksee-memory",
|
|
5
5
|
"description": "Local-first agent memory MCP — cross-agent brain with 6-layer structured memory + token-saving file diff cache",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"linksee-memory-import": "dist/bin/import-sessions.js",
|
|
10
10
|
"linksee-memory-sync": "dist/bin/sync-session.js",
|
|
11
11
|
"linksee-memory-install-skill": "dist/bin/install-skill.js",
|
|
12
|
-
"linksee-memory-stats": "dist/bin/stats.js"
|
|
12
|
+
"linksee-memory-stats": "dist/bin/stats.js",
|
|
13
|
+
"linksee-memory-setup": "dist/bin/setup.js"
|
|
13
14
|
},
|
|
14
15
|
"main": "./dist/mcp/server.js",
|
|
15
16
|
"files": [
|