agent-recall-mcp 3.3.1 → 3.3.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 +268 -224
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,67 +1,45 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<h1 align="center">AgentRecall</h1>
|
|
3
|
-
<p align="center"><strong>
|
|
4
|
-
<p align="center">
|
|
3
|
+
<p align="center"><strong>Memory Palace for AI Agents — A Second Brain That Compounds</strong></p>
|
|
4
|
+
<p align="center">Room-based knowledge organization · Cross-project insight recall · Salience scoring · Obsidian-compatible</p>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/agent-recall-mcp"><img src="https://img.shields.io/npm/v/agent-recall-mcp?style=flat-square&color=5D34F2" alt="npm"></a>
|
|
9
|
-
<a href="https://github.com/
|
|
10
|
-
<img src="https://img.shields.io/badge/MCP-
|
|
9
|
+
<a href="https://github.com/Goldentrii/AgentRecall/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen?style=flat-square" alt="License"></a>
|
|
10
|
+
<img src="https://img.shields.io/badge/MCP-21_tools-orange?style=flat-square" alt="Tools">
|
|
11
11
|
<img src="https://img.shields.io/badge/protocol-Intelligent_Distance-5B2D8E?style=flat-square" alt="Protocol">
|
|
12
12
|
<img src="https://img.shields.io/badge/cloud-zero-blue?style=flat-square" alt="Zero Cloud">
|
|
13
|
+
<img src="https://img.shields.io/badge/Obsidian-compatible-7C3AED?style=flat-square" alt="Obsidian">
|
|
13
14
|
</p>
|
|
14
15
|
|
|
15
16
|
---
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## What Is AgentRecall?
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
AgentRecall is an **MCP server** (Model Context Protocol) that gives AI agents persistent memory, cross-project insight recall, and a self-compounding awareness system. It works with Claude Code, Cursor, VS Code, Windsurf, and any MCP-compatible agent.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
**
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
**Not just a memory system.** Most agent memory tools store and retrieve. AgentRecall also:
|
|
23
|
+
- **Organizes** knowledge into themed rooms (Memory Palace)
|
|
24
|
+
- **Compounds** — insights merge and strengthen over time, not just accumulate
|
|
25
|
+
- **Cross-references** — writing to one room auto-updates related rooms
|
|
26
|
+
- **Recalls** — before starting a task, surfaces relevant lessons from any project
|
|
27
|
+
- **Detects misunderstanding** — measures the gap between human intent and agent interpretation
|
|
26
28
|
|
|
27
29
|
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Human gives: scattered, non-linear instructions
|
|
37
|
-
Agent picks: one instruction, ignores the rest
|
|
38
|
-
Gap: the connective tissue between points is lost
|
|
30
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
31
|
+
│ Layer 1: Quick Capture journal_capture │
|
|
32
|
+
│ Layer 2: Daily Journal journal_write / journal_read │
|
|
33
|
+
│ Layer 3: Memory Palace palace_write / palace_walk │
|
|
34
|
+
│ Layer 4: Awareness awareness_update (compounding) │
|
|
35
|
+
│ Layer 5: Insight Index recall_insight (cross-project) │
|
|
36
|
+
└──────────────────────────────────────────────────────────────┘
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
**AgentRecall doesn't try to close this gap. It builds the protocol to navigate it.**
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## How AgentRecall Bridges the Gap
|
|
46
|
-
|
|
47
|
-
| Intelligent Distance Gap | AgentRecall Tool | What It Does |
|
|
48
|
-
|--------------------------|-----------------|-------------|
|
|
49
|
-
| Agent forgets what human said yesterday | `journal_read` + `journal_cold_start` | Persistent memory — 3-layer, cache-aware |
|
|
50
|
-
| Agent misunderstands human intent | `alignment_check` | Records confidence + assumptions → human corrects BEFORE work |
|
|
51
|
-
| Agent contradicts a prior decision | `nudge` | Detects contradiction → surfaces it BEFORE damage |
|
|
52
|
-
| Agent says "done" but human disagrees | Think-Execute-Reflect loop | Quality scoring with COUNTS ("built 11 pages, 35 tabs"), not feelings ("went well") |
|
|
53
|
-
| Agent builds from imagination, not data | `journal_state` (JSON) | Structured state transfers agent-to-agent — no prose interpretation |
|
|
54
|
-
| Agent repeats the same mistake | Failures section + `context_synthesize` | Cross-session pattern detection → promoted to permanent memory |
|
|
55
|
-
| Next agent starts from zero | `journal_cold_start` (v3) | Hot/warm/cold cache — loads 3 files instead of 28 |
|
|
56
|
-
|
|
57
|
-
**Memory solves forgetting. AgentRecall solves misunderstanding.**
|
|
58
|
-
|
|
59
39
|
---
|
|
60
40
|
|
|
61
41
|
## Quick Start
|
|
62
42
|
|
|
63
|
-
### MCP Server (any agent)
|
|
64
|
-
|
|
65
43
|
```bash
|
|
66
44
|
# Claude Code
|
|
67
45
|
claude mcp add agent-recall -- npx -y agent-recall-mcp
|
|
@@ -71,321 +49,387 @@ claude mcp add agent-recall -- npx -y agent-recall-mcp
|
|
|
71
49
|
|
|
72
50
|
# VS Code — .vscode/mcp.json
|
|
73
51
|
{ "servers": { "agent-recall": { "command": "npx", "args": ["-y", "agent-recall-mcp"] } } }
|
|
74
|
-
```
|
|
75
52
|
|
|
76
|
-
|
|
53
|
+
# Windsurf — ~/.codeium/windsurf/mcp_config.json
|
|
54
|
+
{ "mcpServers": { "agent-recall": { "command": "npx", "args": ["-y", "agent-recall-mcp"] } } }
|
|
55
|
+
```
|
|
77
56
|
|
|
57
|
+
**Skill (Claude Code only):**
|
|
78
58
|
```bash
|
|
79
59
|
mkdir -p ~/.claude/skills/agent-recall
|
|
80
60
|
curl -o ~/.claude/skills/agent-recall/SKILL.md \
|
|
81
|
-
https://raw.githubusercontent.com/
|
|
61
|
+
https://raw.githubusercontent.com/Goldentrii/AgentRecall/main/SKILL.md
|
|
82
62
|
```
|
|
83
63
|
|
|
84
|
-
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## How an Agent Uses AgentRecall
|
|
67
|
+
|
|
68
|
+
### Session Start
|
|
69
|
+
```
|
|
70
|
+
1. recall_insight(context="current task description") → relevant cross-project insights
|
|
71
|
+
2. palace_walk(depth="active") → project context + awareness
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### During Work
|
|
75
|
+
```
|
|
76
|
+
3. alignment_check(goal="...", confidence="medium") → verify understanding before big tasks
|
|
77
|
+
4. palace_write(room="architecture", content="...") → permanent knowledge with cross-refs
|
|
78
|
+
5. journal_capture(question="...", answer="...") → lightweight Q&A log
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Session End
|
|
82
|
+
```
|
|
83
|
+
6. journal_write(content="...", section="decisions") → daily journal entry
|
|
84
|
+
7. awareness_update(insights=[...]) → compound into awareness system
|
|
85
|
+
8. context_synthesize(consolidate=true) → promote journal → palace rooms
|
|
86
|
+
```
|
|
85
87
|
|
|
86
88
|
---
|
|
87
89
|
|
|
88
|
-
##
|
|
90
|
+
## 21 MCP Tools
|
|
91
|
+
|
|
92
|
+
### Memory Palace (5 tools)
|
|
93
|
+
|
|
94
|
+
| Tool | Purpose |
|
|
95
|
+
|------|---------|
|
|
96
|
+
| `palace_read` | Read a room or list all rooms in the Memory Palace |
|
|
97
|
+
| `palace_write` | Write memory with fan-out — auto-updates cross-references via `[[wikilinks]]` |
|
|
98
|
+
| `palace_walk` | Progressive cold-start: identity (~50 tok) → active (~200) → relevant (~500) → full (~2000) |
|
|
99
|
+
| `palace_lint` | Health check: stale, orphan, low-salience rooms. `fix=true` to auto-archive |
|
|
100
|
+
| `palace_search` | Search across all rooms, results ranked by salience score |
|
|
101
|
+
|
|
102
|
+
### Awareness & Insights (2 tools)
|
|
103
|
+
|
|
104
|
+
| Tool | Purpose |
|
|
105
|
+
|------|---------|
|
|
106
|
+
| `awareness_update` | Add insights to the compounding awareness system. Merges with existing, detects patterns |
|
|
107
|
+
| `recall_insight` | Before starting work, recall cross-project insights relevant to the current task |
|
|
89
108
|
|
|
90
109
|
### Session Memory (6 tools)
|
|
91
110
|
|
|
92
111
|
| Tool | Purpose |
|
|
93
112
|
|------|---------|
|
|
94
|
-
| `journal_read` | Read entry by date or "latest"
|
|
95
|
-
| `journal_write` | Write
|
|
96
|
-
| `journal_capture` | Lightweight L1 Q&A capture |
|
|
97
|
-
| `journal_list` | List recent entries |
|
|
98
|
-
| `journal_search` | Full-text search across history |
|
|
113
|
+
| `journal_read` | Read entry by date or "latest", with section filtering |
|
|
114
|
+
| `journal_write` | Write daily journal. Optional `palace_room` for palace integration |
|
|
115
|
+
| `journal_capture` | Lightweight L1 Q&A capture. Optional `palace_room` |
|
|
116
|
+
| `journal_list` | List recent journal entries |
|
|
117
|
+
| `journal_search` | Full-text search across history. `include_palace=true` for palace too |
|
|
99
118
|
| `journal_projects` | List all tracked projects |
|
|
100
119
|
|
|
101
|
-
###
|
|
120
|
+
### Architecture (3 tools)
|
|
102
121
|
|
|
103
122
|
| Tool | Purpose |
|
|
104
123
|
|------|---------|
|
|
105
|
-
| `journal_state` |
|
|
106
|
-
| `journal_cold_start` |
|
|
107
|
-
| `journal_archive` |
|
|
124
|
+
| `journal_state` | JSON state layer — structured read/write for agent-to-agent handoffs |
|
|
125
|
+
| `journal_cold_start` | Cache-aware cold start: HOT (0-1d) / WARM (2-7d) / COLD (7d+) |
|
|
126
|
+
| `journal_archive` | Archive old entries to cold storage with summaries |
|
|
108
127
|
|
|
109
|
-
### Knowledge
|
|
128
|
+
### Knowledge (2 tools)
|
|
110
129
|
|
|
111
130
|
| Tool | Purpose |
|
|
112
131
|
|------|---------|
|
|
113
|
-
| `knowledge_write` |
|
|
114
|
-
| `knowledge_read` |
|
|
132
|
+
| `knowledge_write` | Write permanent lessons — dynamic categories, auto-creates palace rooms |
|
|
133
|
+
| `knowledge_read` | Read lessons by project, category, or search query |
|
|
115
134
|
|
|
116
|
-
### Alignment
|
|
135
|
+
### Alignment (3 tools)
|
|
117
136
|
|
|
118
137
|
| Tool | Purpose |
|
|
119
138
|
|------|---------|
|
|
120
|
-
| `alignment_check` | Record confidence + assumptions
|
|
121
|
-
| `nudge` |
|
|
122
|
-
| `context_synthesize` | L3 synthesis
|
|
139
|
+
| `alignment_check` | Record confidence + assumptions → human corrects BEFORE work starts |
|
|
140
|
+
| `nudge` | Detect contradiction between current and past input → surface before damage |
|
|
141
|
+
| `context_synthesize` | L3 synthesis. `consolidate=true` writes results into palace rooms |
|
|
123
142
|
|
|
124
143
|
---
|
|
125
144
|
|
|
126
|
-
##
|
|
145
|
+
## Architecture
|
|
127
146
|
|
|
128
|
-
|
|
147
|
+
### Memory Palace
|
|
148
|
+
|
|
149
|
+
Inspired by the Method of Loci, Karpathy's LLM Wiki, and nashsu/llm_wiki.
|
|
129
150
|
|
|
130
151
|
```
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
|
|
152
|
+
~/.agent-recall/
|
|
153
|
+
awareness.md # 200-line compounding document (global)
|
|
154
|
+
awareness-state.json # Structured awareness data
|
|
155
|
+
insights-index.json # Cross-project insight matching
|
|
156
|
+
projects/
|
|
157
|
+
<project>/
|
|
158
|
+
journal/ # RAW SOURCES (immutable)
|
|
159
|
+
YYYY-MM-DD.md # Daily journal
|
|
160
|
+
YYYY-MM-DD-log.md # L1 captures
|
|
161
|
+
YYYY-MM-DD.state.json # JSON state
|
|
162
|
+
palace/ # MEMORY PALACE (mutable wiki)
|
|
163
|
+
identity.md # ~50 token project identity card
|
|
164
|
+
palace-index.json # Room catalog + salience scores
|
|
165
|
+
graph.json # Cross-reference edges
|
|
166
|
+
log.md # Operation audit trail
|
|
167
|
+
rooms/
|
|
168
|
+
goals/ # Active goals, evolution
|
|
169
|
+
architecture/ # Technical decisions, patterns
|
|
170
|
+
blockers/ # Current and resolved
|
|
171
|
+
alignment/ # Human corrections, misunderstandings
|
|
172
|
+
knowledge/ # Learned lessons by category
|
|
173
|
+
<custom>/ # Agents create rooms on demand
|
|
136
174
|
```
|
|
137
175
|
|
|
138
|
-
|
|
176
|
+
### Key Mechanisms
|
|
139
177
|
|
|
140
|
-
|
|
178
|
+
**Fan-out writes** — Write to one room, cross-references auto-update in related rooms via `[[wikilinks]]`. Mechanical, zero LLM cost.
|
|
141
179
|
|
|
142
|
-
|
|
180
|
+
**Salience scoring** — Every room has a salience score: `importance(0.4) + recency(0.3) + access_frequency(0.2) + connections(0.1)`. High-salience rooms surface first. Below threshold → auto-archive.
|
|
143
181
|
|
|
144
|
-
|
|
145
|
-
NUDGE:
|
|
146
|
-
- You decided Clerk for auth on March 25.
|
|
147
|
-
- Now you're asking for custom auth from scratch.
|
|
148
|
-
- Has the goal changed, or should we stick with Clerk?
|
|
149
|
-
```
|
|
182
|
+
**Compounding awareness** — `awareness.md` is capped at 200 lines. When new insights are added, similar existing ones merge (strengthen), dissimilar ones compete (lowest-confirmation gets replaced). The constraint creates compression. Compression creates compounding.
|
|
150
183
|
|
|
151
|
-
|
|
184
|
+
**Cross-project insight recall** — `insights-index.json` maps insights to situations via keywords. `recall_insight("building quality gates")` returns relevant lessons from any project, ranked by severity × confirmation count.
|
|
152
185
|
|
|
153
|
-
|
|
186
|
+
**Obsidian-compatible** — Every palace file has YAML frontmatter + `[[wikilinks]]`. Open `palace/` as an Obsidian vault → graph view shows room connections. Zero Obsidian dependency.
|
|
154
187
|
|
|
155
|
-
|
|
188
|
+
### Intelligent Distance Protocol
|
|
156
189
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
│ v3: JSON State Layer [per-session] Agent-to-agent data │
|
|
167
|
-
│ journal_state → .state.json alongside .md │
|
|
168
|
-
├─────────────────────────────────────────────────────────┤
|
|
169
|
-
│ v3: Cache Layer HOT (0-1d) → WARM (2-7d) → COLD │
|
|
170
|
-
│ journal_cold_start → loads 3 files, not 28 │
|
|
171
|
-
└─────────────────────────────────────────────────────────┘
|
|
172
|
-
```
|
|
190
|
+
The gap between human intent and agent understanding is structural — different cognitive origins, not a temporary technology problem. AgentRecall doesn't close this gap; it navigates it:
|
|
191
|
+
|
|
192
|
+
| Gap | Tool | How |
|
|
193
|
+
|-----|------|-----|
|
|
194
|
+
| Agent misunderstands intent | `alignment_check` | Records confidence + assumptions → human corrects before work |
|
|
195
|
+
| Agent contradicts prior decision | `nudge` | Surfaces contradiction → human clarifies |
|
|
196
|
+
| Agent forgets across sessions | `palace_walk` | Progressive loading from identity to full context |
|
|
197
|
+
| Agent repeats past mistakes | `recall_insight` | Cross-project insights surface before work starts |
|
|
198
|
+
| Agent's work quality is unclear | Think-Execute-Reflect | Counts, not feelings ("built 11 pages") |
|
|
173
199
|
|
|
174
200
|
---
|
|
175
201
|
|
|
176
|
-
##
|
|
202
|
+
## Supported Agents
|
|
177
203
|
|
|
178
|
-
|
|
204
|
+
| Agent | MCP | Skill | Notes |
|
|
205
|
+
|-------|:---:|:-----:|-------|
|
|
206
|
+
| Claude Code | ✅ | ✅ | Full support — MCP + SKILL.md |
|
|
207
|
+
| Cursor | ✅ | ⚡ | MCP via .cursor/mcp.json |
|
|
208
|
+
| VS Code (Copilot) | ✅ | — | MCP via .vscode/mcp.json |
|
|
209
|
+
| Windsurf | ✅ | ⚡ | MCP via mcp_config.json |
|
|
210
|
+
| Claude Desktop | ✅ | — | MCP server |
|
|
211
|
+
| Any MCP agent | ✅ | — | Standard MCP protocol |
|
|
179
212
|
|
|
180
|
-
|
|
181
|
-
🧠 THINK → Was the approach right? Was research done?
|
|
182
|
-
⚡ EXECUTE → What happened vs planned? (COUNTS, not feelings)
|
|
183
|
-
🔍 REFLECT → 5-dimension quality score + Intelligent Distance gap
|
|
184
|
-
🔄 FEEDBACK → Loop (needs iteration) or Exit (quality sufficient)
|
|
185
|
-
```
|
|
213
|
+
---
|
|
186
214
|
|
|
187
|
-
|
|
188
|
-
- What user meant vs what I interpreted
|
|
189
|
-
- The gap between them (or "none — aligned")
|
|
190
|
-
- What to change so the gap shrinks next time
|
|
215
|
+
## Design Philosophy
|
|
191
216
|
|
|
192
|
-
|
|
217
|
+
**Memory is not the goal. Understanding is.**
|
|
193
218
|
|
|
194
|
-
|
|
219
|
+
Most memory systems optimize for retrieval accuracy. AgentRecall optimizes for **alignment accuracy** — reducing the gap between what the human means and what the agent does.
|
|
220
|
+
|
|
221
|
+
**Compounding over accumulation.** A filing cabinet with better labels is still a filing cabinet. AgentRecall's awareness system forces merge-on-insert: every new insight either strengthens an existing one or replaces the weakest. After 100 sessions, `awareness.md` is still 200 lines — but each line carries the weight of confirmed, cross-validated observations.
|
|
222
|
+
|
|
223
|
+
**Cross-project by default.** Insights learned in one project apply everywhere. `recall_insight` doesn't care which project produced the lesson — it matches the current situation against the global index.
|
|
195
224
|
|
|
196
|
-
|
|
197
|
-
|-------|:-----:|:---:|:--------:|
|
|
198
|
-
| Claude Code | ✅ | ✅ | ✅ |
|
|
199
|
-
| Cursor | ⚡ | ✅ | ✅ |
|
|
200
|
-
| VS Code Copilot | — | ✅ | ✅ |
|
|
201
|
-
| Windsurf | ⚡ | ✅ | ✅ |
|
|
202
|
-
| Claude Desktop | — | ✅ | ✅ |
|
|
203
|
-
| Any MCP agent | — | ✅ | ✅ |
|
|
204
|
-
| Any AI agent | — | — | ✅ (manual) |
|
|
225
|
+
**Agent-friendly, human-visible.** Everything is markdown on disk. Agents consume it via MCP tools. Humans browse it in Obsidian (or any text editor). Zero cloud, zero telemetry, zero lock-in.
|
|
205
226
|
|
|
206
227
|
---
|
|
207
228
|
|
|
208
229
|
## Real Results
|
|
209
230
|
|
|
210
|
-
Validated over
|
|
211
|
-
- Cold-start: **5 min → 2 seconds** (
|
|
212
|
-
- Decision
|
|
231
|
+
Validated over 30+ sessions across 5 production projects:
|
|
232
|
+
- Cold-start: **5 min → 2 seconds** (cache-aware loading)
|
|
233
|
+
- Decision retention: **0% → 100%** across sessions
|
|
213
234
|
- Misunderstanding caught before wrong work: **6+ instances** via alignment checks
|
|
214
|
-
-
|
|
215
|
-
-
|
|
235
|
+
- Repeated mistakes prevented: **3 instances** via cross-project insight recall
|
|
236
|
+
- All data local, all files markdown, all tools stateless
|
|
216
237
|
|
|
217
238
|
---
|
|
218
239
|
|
|
219
|
-
##
|
|
240
|
+
## Contributing
|
|
220
241
|
|
|
221
|
-
Built by [tongwu](https://github.com/Goldentrii)
|
|
222
|
-
|
|
223
|
-
**We'd love your feedback:**
|
|
242
|
+
Built by [tongwu](https://github.com/Goldentrii).
|
|
224
243
|
|
|
244
|
+
- Issues & feedback: [GitHub Issues](https://github.com/Goldentrii/AgentRecall/issues)
|
|
225
245
|
- Email: tongwu0824@gmail.com
|
|
226
|
-
-
|
|
246
|
+
- Protocol spec: [docs/intelligent-distance-protocol.md](docs/intelligent-distance-protocol.md)
|
|
227
247
|
|
|
228
|
-
|
|
229
|
-
2. **Implement it** in a new agent → PR welcome
|
|
230
|
-
3. **Improve the spec** → [protocol doc](docs/intelligent-distance-protocol.md)
|
|
248
|
+
MIT License.
|
|
231
249
|
|
|
232
250
|
---
|
|
233
251
|
|
|
234
|
-
|
|
252
|
+
---
|
|
235
253
|
|
|
236
|
-
|
|
254
|
+
# AgentRecall(中文文档)
|
|
237
255
|
|
|
238
|
-
|
|
256
|
+
> 给你的 AI 智能体一个会成长的第二大脑。
|
|
239
257
|
|
|
240
258
|
---
|
|
241
259
|
|
|
242
|
-
|
|
260
|
+
## AgentRecall 是什么?
|
|
243
261
|
|
|
244
|
-
|
|
262
|
+
AgentRecall 是一个 **MCP 服务器**(Model Context Protocol),为 AI 智能体提供持久化记忆、跨项目洞察召回和自复合感知系统。支持 Claude Code、Cursor、VS Code、Windsurf 及所有 MCP 兼容的智能体。
|
|
245
263
|
|
|
246
|
-
|
|
264
|
+
**不只是记忆系统。** 大多数智能体记忆工具只做存储和检索。AgentRecall 还能:
|
|
265
|
+
- **组织** — 知识按主题房间分类(记忆宫殿)
|
|
266
|
+
- **复合** — 洞察随时间合并增强,不是单纯累积
|
|
267
|
+
- **交叉引用** — 写入一个房间时自动更新相关房间
|
|
268
|
+
- **召回** — 开始任务前,自动呈现任何项目中的相关经验教训
|
|
269
|
+
- **检测误解** — 测量人类意图和智能体理解之间的差距
|
|
247
270
|
|
|
248
271
|
---
|
|
249
272
|
|
|
250
|
-
##
|
|
273
|
+
## 快速开始
|
|
251
274
|
|
|
252
|
-
|
|
275
|
+
```bash
|
|
276
|
+
# Claude Code
|
|
277
|
+
claude mcp add agent-recall -- npx -y agent-recall-mcp
|
|
253
278
|
|
|
254
|
-
|
|
279
|
+
# Cursor — .cursor/mcp.json
|
|
280
|
+
{ "mcpServers": { "agent-recall": { "command": "npx", "args": ["-y", "agent-recall-mcp"] } } }
|
|
255
281
|
|
|
282
|
+
# VS Code — .vscode/mcp.json
|
|
283
|
+
{ "servers": { "agent-recall": { "command": "npx", "args": ["-y", "agent-recall-mcp"] } } }
|
|
256
284
|
```
|
|
257
|
-
人类说:「全部点击」
|
|
258
|
-
AI 理解:「点击主要的」
|
|
259
|
-
差距:「全部」≠「主要的」
|
|
260
|
-
|
|
261
|
-
人类说:「做完意味着完全一样」
|
|
262
|
-
AI 认为:「差不多就行」
|
|
263
|
-
差距:「完全一样」≠「差不多」
|
|
264
285
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
286
|
+
**Claude Code 技能安装:**
|
|
287
|
+
```bash
|
|
288
|
+
mkdir -p ~/.claude/skills/agent-recall
|
|
289
|
+
curl -o ~/.claude/skills/agent-recall/SKILL.md \
|
|
290
|
+
https://raw.githubusercontent.com/Goldentrii/AgentRecall/main/SKILL.md
|
|
268
291
|
```
|
|
269
292
|
|
|
270
|
-
**AgentRecall 不试图缩小这个差距,而是构建一个协议来导航它。**
|
|
271
|
-
|
|
272
293
|
---
|
|
273
294
|
|
|
274
|
-
##
|
|
295
|
+
## 智能体使用流程
|
|
275
296
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
| 智能体说「完成了」但人类不同意 | Think-Execute-Reflect 循环 | 用数字评分(「建了 11 页 35 个标签」),不用感觉(「做得不错」)|
|
|
282
|
-
| 智能体凭想象构建,而非基于数据 | `journal_state` (JSON) | agent 间结构化交接 — 毫秒级,无需解析散文 |
|
|
283
|
-
| 智能体重复同样的错误 | 失败记录 + `context_synthesize` | 跨会话模式检测 → 提升为永久记忆 |
|
|
284
|
-
| 下一个 agent 从零开始 | `journal_cold_start` (v3) | 热/温/冷缓存 — 加载 3 个文件而非 28 个 |
|
|
297
|
+
### 会话开始
|
|
298
|
+
```
|
|
299
|
+
1. recall_insight(context="当前任务描述") → 跨项目相关洞察
|
|
300
|
+
2. palace_walk(depth="active") → 项目上下文 + 感知摘要
|
|
301
|
+
```
|
|
285
302
|
|
|
286
|
-
|
|
303
|
+
### 工作中
|
|
304
|
+
```
|
|
305
|
+
3. alignment_check(goal="...", confidence="medium") → 大任务前确认理解
|
|
306
|
+
4. palace_write(room="architecture", content="...") → 永久知识 + 交叉引用
|
|
307
|
+
5. journal_capture(question="...", answer="...") → 轻量问答记录
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### 会话结束
|
|
311
|
+
```
|
|
312
|
+
6. journal_write(content="...", section="decisions") → 每日日志
|
|
313
|
+
7. awareness_update(insights=[...]) → 洞察复合到感知系统
|
|
314
|
+
8. context_synthesize(consolidate=true) → 日志内容提升到宫殿
|
|
315
|
+
```
|
|
287
316
|
|
|
288
317
|
---
|
|
289
318
|
|
|
290
|
-
##
|
|
319
|
+
## 21 个 MCP 工具
|
|
291
320
|
|
|
292
|
-
|
|
293
|
-
# Claude Code
|
|
294
|
-
claude mcp add agent-recall -- npx -y agent-recall-mcp
|
|
321
|
+
### 记忆宫殿(5 个)
|
|
295
322
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
323
|
+
| 工具 | 功能 |
|
|
324
|
+
|------|------|
|
|
325
|
+
| `palace_read` | 读取房间内容或列出所有房间 |
|
|
326
|
+
| `palace_write` | 写入记忆,自动通过 `[[wikilinks]]` 扇出交叉引用 |
|
|
327
|
+
| `palace_walk` | 渐进式冷启动:identity (~50 tok) → active (~200) → relevant (~500) → full (~2000) |
|
|
328
|
+
| `palace_lint` | 健康检查:过期、孤立、低显著性房间。`fix=true` 自动归档 |
|
|
329
|
+
| `palace_search` | 全房间搜索,按显著性评分排序 |
|
|
302
330
|
|
|
303
|
-
|
|
331
|
+
### 感知与洞察(2 个)
|
|
304
332
|
|
|
305
|
-
|
|
333
|
+
| 工具 | 功能 |
|
|
334
|
+
|------|------|
|
|
335
|
+
| `awareness_update` | 添加洞察到复合感知系统。自动合并相似洞察,检测跨洞察模式 |
|
|
336
|
+
| `recall_insight` | 开始任务前,召回跨项目的相关洞察 |
|
|
306
337
|
|
|
307
338
|
### 会话记忆(6 个)
|
|
308
339
|
|
|
309
340
|
| 工具 | 功能 |
|
|
310
341
|
|------|------|
|
|
311
342
|
| `journal_read` | 按日期读取日志,支持章节过滤 |
|
|
312
|
-
| `journal_write` |
|
|
343
|
+
| `journal_write` | 写入每日日志。可选 `palace_room` 同步到宫殿 |
|
|
313
344
|
| `journal_capture` | 轻量问答捕获 |
|
|
314
345
|
| `journal_list` | 列出最近日志 |
|
|
315
|
-
| `journal_search` |
|
|
346
|
+
| `journal_search` | 全文搜索。`include_palace=true` 同时搜索宫殿 |
|
|
316
347
|
| `journal_projects` | 列出所有项目 |
|
|
317
348
|
|
|
318
|
-
###
|
|
349
|
+
### 架构工具(3 个)
|
|
319
350
|
|
|
320
351
|
| 工具 | 功能 |
|
|
321
352
|
|------|------|
|
|
322
|
-
| `journal_state` |
|
|
323
|
-
| `journal_cold_start` |
|
|
324
|
-
| `journal_archive` |
|
|
353
|
+
| `journal_state` | JSON 状态层 — agent 间毫秒级结构化交接 |
|
|
354
|
+
| `journal_cold_start` | 缓存感知冷启动:热 (0-1天) / 温 (2-7天) / 冷 (7天+) |
|
|
355
|
+
| `journal_archive` | 归档旧条目到冷存储 |
|
|
325
356
|
|
|
326
|
-
###
|
|
357
|
+
### 知识工具(2 个)
|
|
327
358
|
|
|
328
359
|
| 工具 | 功能 |
|
|
329
360
|
|------|------|
|
|
330
|
-
| `knowledge_write` |
|
|
331
|
-
| `knowledge_read` |
|
|
361
|
+
| `knowledge_write` | 写入永久教训 — 动态类别,自动创建宫殿房间 |
|
|
362
|
+
| `knowledge_read` | 按项目、类别或搜索词读取教训 |
|
|
332
363
|
|
|
333
|
-
###
|
|
364
|
+
### 对齐工具(3 个)
|
|
334
365
|
|
|
335
366
|
| 工具 | 功能 |
|
|
336
367
|
|------|------|
|
|
337
|
-
| `alignment_check` |
|
|
338
|
-
| `nudge` |
|
|
339
|
-
| `context_synthesize` |
|
|
368
|
+
| `alignment_check` | 记录置信度 + 假设 → 人类在工作前纠正 |
|
|
369
|
+
| `nudge` | 检测与过去决策的矛盾 → 在造成损失前提出 |
|
|
370
|
+
| `context_synthesize` | L3 合成。`consolidate=true` 将结果写入宫殿房间 |
|
|
340
371
|
|
|
341
372
|
---
|
|
342
373
|
|
|
343
|
-
##
|
|
374
|
+
## 架构
|
|
375
|
+
|
|
376
|
+
### 五层记忆模型
|
|
344
377
|
|
|
345
378
|
```
|
|
346
|
-
|
|
347
|
-
│
|
|
348
|
-
│
|
|
349
|
-
│
|
|
350
|
-
│
|
|
351
|
-
│
|
|
352
|
-
|
|
353
|
-
├─────────────────────────────────────────────────────────┤
|
|
354
|
-
│ v3: JSON 状态层 [每会话] agent 间结构化数据 │
|
|
355
|
-
├─────────────────────────────────────────────────────────┤
|
|
356
|
-
│ v3: 缓存层 热(0-1天)→ 温(2-7天)→ 冷(7天+) │
|
|
357
|
-
│ journal_cold_start → 加载 3 个文件而非 28 个 │
|
|
358
|
-
└─────────────────────────────────────────────────────────┘
|
|
379
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
380
|
+
│ L1: 工作记忆 journal_capture 「发生了什么」 │
|
|
381
|
+
│ L2: 情景记忆 journal_write 「这意味着什么」 │
|
|
382
|
+
│ L3: 记忆宫殿 palace_write / walk 「跨会话的知识」 │
|
|
383
|
+
│ L4: 感知系统 awareness_update 「复合的洞察」 │
|
|
384
|
+
│ L5: 洞察索引 recall_insight 「跨项目的经验」 │
|
|
385
|
+
└──────────────────────────────────────────────────────────────┘
|
|
359
386
|
```
|
|
360
387
|
|
|
361
|
-
|
|
388
|
+
### 核心机制
|
|
362
389
|
|
|
363
|
-
|
|
390
|
+
**扇出写入** — 写入一个房间,相关房间通过 `[[wikilinks]]` 自动更新交叉引用。机械式处理,零 LLM 成本。
|
|
364
391
|
|
|
365
|
-
|
|
366
|
-
🧠 THINK → 方法对吗?做了调研吗?
|
|
367
|
-
⚡ EXECUTE → 实际 vs 计划?(用数字,不用感觉)
|
|
368
|
-
🔍 REFLECT → 5 维度质量评分 + 智能距离差距分析
|
|
369
|
-
🔄 FEEDBACK → 循环(需要迭代)或 退出(质量足够)
|
|
370
|
-
```
|
|
392
|
+
**显著性评分** — 每个房间有显著性分数:`重要性(0.4) + 时效性(0.3) + 访问频率(0.2) + 连接数(0.1)`。高显著性房间优先展示,低于阈值自动归档。
|
|
371
393
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
-
|
|
375
|
-
|
|
394
|
+
**复合感知** — `awareness.md` 上限 200 行。新洞察加入时,相似的合并(增强),不相似的竞争(最低确认次数的被替换)。约束创造压缩,压缩创造复合。
|
|
395
|
+
|
|
396
|
+
**跨项目洞察召回** — `insights-index.json` 通过关键词将洞察映射到场景。`recall_insight("构建质量检查")` 返回来自任何项目的相关教训。
|
|
397
|
+
|
|
398
|
+
**Obsidian 兼容** — 每个宫殿文件都有 YAML frontmatter + `[[wikilinks]]`。将 `palace/` 作为 Obsidian vault 打开 → 图形视图展示房间连接。零 Obsidian 依赖。
|
|
399
|
+
|
|
400
|
+
### 智能距离协议
|
|
401
|
+
|
|
402
|
+
人类意图与智能体理解之间的差距是结构性的 — 源于不同的认知起源,不是临时的技术问题。
|
|
403
|
+
|
|
404
|
+
| 差距 | 工具 | 机制 |
|
|
405
|
+
|------|------|------|
|
|
406
|
+
| 智能体误解意图 | `alignment_check` | 记录置信度 + 假设 → 人类在工作前纠正 |
|
|
407
|
+
| 智能体与先前决策矛盾 | `nudge` | 发现矛盾 → 人类澄清 |
|
|
408
|
+
| 智能体跨会话遗忘 | `palace_walk` | 从身份到完整上下文的渐进式加载 |
|
|
409
|
+
| 智能体重复过去的错误 | `recall_insight` | 跨项目洞察在工作前自动呈现 |
|
|
376
410
|
|
|
377
411
|
---
|
|
378
412
|
|
|
379
|
-
##
|
|
413
|
+
## 设计理念
|
|
380
414
|
|
|
381
|
-
|
|
415
|
+
**记忆不是目的,理解才是。**
|
|
382
416
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
417
|
+
大多数记忆系统优化检索准确性。AgentRecall 优化**对齐准确性** — 缩小人类意图和智能体行为之间的差距。
|
|
418
|
+
|
|
419
|
+
**复合优于累积。** 贴了更好标签的文件柜还是文件柜。AgentRecall 的感知系统在插入时强制合并:每个新洞察要么增强已有的,要么替换最弱的。100 个会话后,`awareness.md` 仍是 200 行 — 但每一行承载着经过确认和交叉验证的观察。
|
|
420
|
+
|
|
421
|
+
**默认跨项目。** 在一个项目中学到的洞察适用于所有项目。`recall_insight` 不关心教训来自哪个项目 — 它匹配当前场景和全局索引。
|
|
422
|
+
|
|
423
|
+
**智能体友好,人类可见。** 一切都是磁盘上的 markdown。智能体通过 MCP 工具消费。人类在 Obsidian(或任何文本编辑器)中浏览。零云端、零遥测、零锁定。
|
|
386
424
|
|
|
387
425
|
---
|
|
388
426
|
|
|
389
|
-
##
|
|
427
|
+
## 贡献
|
|
428
|
+
|
|
429
|
+
由 [tongwu](https://github.com/Goldentrii) 构建。
|
|
430
|
+
|
|
431
|
+
- Issues & 反馈:[GitHub Issues](https://github.com/Goldentrii/AgentRecall/issues)
|
|
432
|
+
- 邮箱:tongwu0824@gmail.com
|
|
433
|
+
- 协议规范:[docs/intelligent-distance-protocol.md](docs/intelligent-distance-protocol.md)
|
|
390
434
|
|
|
391
|
-
MIT
|
|
435
|
+
MIT 许可证。
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared types, interfaces, and constants for agent-recall-mcp.
|
|
3
3
|
*/
|
|
4
|
-
export declare const VERSION = "3.3.
|
|
4
|
+
export declare const VERSION = "3.3.2";
|
|
5
5
|
export declare const JOURNAL_ROOT: string;
|
|
6
6
|
export declare const LEGACY_ROOT: string;
|
|
7
7
|
export declare const SECTION_HEADERS: Record<string, string>;
|
package/dist/types.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as os from "node:os";
|
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
// Constants
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
|
-
export const VERSION = "3.3.
|
|
9
|
+
export const VERSION = "3.3.2";
|
|
10
10
|
export const JOURNAL_ROOT = process.env.AGENT_RECALL_ROOT || path.join(os.homedir(), ".agent-recall");
|
|
11
11
|
export const LEGACY_ROOT = path.join(os.homedir(), ".claude", "projects");
|
|
12
12
|
export const SECTION_HEADERS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-recall-mcp",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Memory Palace for AI agents — room-based knowledge organization with fan-out cross-referencing, salience scoring, and Obsidian-compatible output",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|