claude-recall 0.30.0 → 0.30.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 +194 -397
- package/dist/hooks/kiro-classifier.js +9 -0
- package/docs/kiro-llm-capture.md +1 -1
- package/docs/kiro.md +159 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,247 +2,136 @@
|
|
|
2
2
|
|
|
3
3
|
### Persistent, local memory for coding agents — learn from every session.
|
|
4
4
|
|
|
5
|
-
Claude Recall
|
|
6
|
-
**the ability to learn from you over time.**
|
|
5
|
+
Coding agents forget everything between sessions. Claude Recall fixes that: it captures your preferences, corrections, project facts, and failures **automatically as you work**, stores them in a local SQLite database, and injects them back into the agent's context in every future session.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Your preferences, project structure, workflows, corrections, and coding style are captured automatically and applied in future sessions — **securely stored on your machine**.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Features
|
|
15
|
-
|
|
16
|
-
- **Smart Memory Capture** — LLM-powered classification (via Claude Haiku) detects preferences and corrections from natural language, with silent regex fallback
|
|
17
|
-
- **Project-Scoped Knowledge** — each project gets its own memory namespace; switch projects and the agent switches context automatically
|
|
18
|
-
- **Failure Learning** — captures what failed, why, and what to do instead — so the agent doesn't repeat mistakes
|
|
19
|
-
- **Outcome-Aware Learning** — tracks action outcomes (all tool results, test cycles, user corrections), synthesizes candidate lessons, and promotes validated patterns into active rules automatically
|
|
20
|
-
- **Skill Crystallization** — auto-generates `.claude/skills/auto-*/` files from accumulated memories, using Anthropic's [Agent Skills](https://agentskills.io/) open standard
|
|
21
|
-
- **Rule Hygiene** — token-budgeted `load_rules` payload, citation-aware auto-demotion of rules that never earn citations, and retroactive dedup for near-duplicates
|
|
22
|
-
- **Local-Only** — SQLite on your machine, no telemetry, no cloud, works fully offline
|
|
7
|
+
It works with **Claude Code**, **[Pi](https://github.com/mariozechner/pi)**, and **[Kiro CLI](https://kiro.dev/cli/)** — all three share the same database, so a rule learned in one agent is applied in the others. Everything stays on your machine: no cloud, no telemetry, works offline.
|
|
23
8
|
|
|
24
9
|
---
|
|
25
10
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
### Requirements
|
|
29
|
-
|
|
30
|
-
| Component | Version | Notes |
|
|
31
|
-
| --------- | ----------------------- | --------------------------- |
|
|
32
|
-
| Node.js | **20.19+** | required for better-sqlite3 (Node 20+) and chalk 5 (ESM `require()` needs ≥20.19) |
|
|
33
|
-
| OS | macOS / Linux / Windows | WSL supported |
|
|
11
|
+
## What it looks like in practice
|
|
34
12
|
|
|
35
|
-
|
|
13
|
+
**Tuesday — you correct the agent once, in plain language:**
|
|
36
14
|
|
|
37
|
-
|
|
15
|
+
> **You:** use pnpm here, not npm
|
|
38
16
|
|
|
39
|
-
```
|
|
40
|
-
|
|
17
|
+
```text
|
|
18
|
+
📌 Recall: auto-captured correction — Use pnpm, not npm
|
|
41
19
|
```
|
|
42
20
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
claude-recall setup --install
|
|
47
|
-
claude mcp add claude-recall -- claude-recall mcp start
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Restart Claude Code. Ask *"Load my rules"* to verify — Claude should call `load_rules`.
|
|
51
|
-
|
|
52
|
-
Prefer it active in **every** project? Register the MCP server once at user scope instead of per project (memories stay isolated per project either way — scoping comes from the working directory, not the install):
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
claude mcp add --scope user claude-recall -- claude-recall mcp start
|
|
56
|
-
```
|
|
21
|
+
That one line did everything. A hook classified your prompt with an LLM, decided it was a durable rule (not chit-chat), and stored it locally. No "remember this" incantation, no tool call, no config file to edit.
|
|
57
22
|
|
|
58
|
-
|
|
23
|
+
**Friday — brand-new session, no shared history:**
|
|
59
24
|
|
|
60
|
-
> **
|
|
25
|
+
> **You:** set up a test runner for this project
|
|
26
|
+
>
|
|
27
|
+
> **Agent:** Installing vitest with **pnpm** *(applied from memory: "Use pnpm, not npm")* …
|
|
61
28
|
|
|
62
|
-
|
|
29
|
+
Your rules are injected at session start and again right before each relevant tool call — at the moment of decision, not 50,000 tokens upstream. This works across agents too: correct Claude Code on Tuesday, and Kiro applies it on Friday.
|
|
63
30
|
|
|
64
|
-
|
|
31
|
+
**And you can audit what it knows at any time:**
|
|
65
32
|
|
|
66
33
|
```bash
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
That's it. Ask Pi to *"Load my rules"* to verify.
|
|
34
|
+
$ claude-recall search "pnpm"
|
|
35
|
+
🔍 Found 1 memories (showing top 1):
|
|
71
36
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Requires claude-recall **≥ 0.28.0** (`claude-recall --version` to check; `claude-recall upgrade` to update). Uses the same global binary (install it once per machine as above). Two ways to wire it in — full integration is what most people want.
|
|
75
|
-
|
|
76
|
-
**Option A — full integration (recommended): memory + hooks via a custom agent.**
|
|
77
|
-
|
|
78
|
-
In your shell, in the project directory, **before** starting Kiro:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
claude-recall kiro setup
|
|
37
|
+
1. [correction] Score: 7.9
|
|
38
|
+
Content: {"content":"Use pnpm, not npm","confidence":0.95,"source":"hook-auto-capture",...}
|
|
82
39
|
```
|
|
83
40
|
|
|
84
|
-
|
|
41
|
+
---
|
|
85
42
|
|
|
86
|
-
|
|
43
|
+
## Features
|
|
87
44
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
45
|
+
- **Automatic capture** — an LLM classifier detects preferences, corrections, and project facts in your normal prompts (regex fallback when no LLM is available)
|
|
46
|
+
- **Applied where it counts** — rules load at session start *and* are re-surfaced just-in-time before each tool call
|
|
47
|
+
- **Project-scoped** — each project gets its own memory namespace; switch directories and the agent switches context
|
|
48
|
+
- **Learns from failures** — records what broke, why, and what fixed it, so mistakes aren't repeated
|
|
49
|
+
- **Outcome-aware** — tracks whether rules actually help (tool results, test cycles, re-asks) and promotes validated lessons into active rules
|
|
50
|
+
- **Local-only** — one SQLite file on your machine; inspect, export, or delete everything from the CLI
|
|
91
51
|
|
|
92
|
-
|
|
52
|
+
---
|
|
93
53
|
|
|
94
|
-
|
|
95
|
-
/agent swap recall
|
|
96
|
-
```
|
|
54
|
+
## Quick Start
|
|
97
55
|
|
|
98
|
-
|
|
56
|
+
**Requirements:** Node.js **20.19+**, macOS / Linux / Windows (WSL supported).
|
|
99
57
|
|
|
100
|
-
|
|
58
|
+
Install the global binary once per machine:
|
|
101
59
|
|
|
102
60
|
```bash
|
|
103
|
-
|
|
61
|
+
npm install -g claude-recall
|
|
104
62
|
```
|
|
105
63
|
|
|
106
|
-
|
|
64
|
+
> **Do NOT add claude-recall as a project dependency** (`npm install claude-recall` inside a project). All projects share one database, and a stale project-local copy silently shadows your global one. One global binary; per-project *activation* only.
|
|
65
|
+
> Hit `EACCES: permission denied`? See [Upgrade & install troubleshooting](#upgrading) below.
|
|
107
66
|
|
|
108
|
-
|
|
67
|
+
### Claude Code
|
|
109
68
|
|
|
110
|
-
|
|
69
|
+
In each project where you want it active:
|
|
111
70
|
|
|
112
71
|
```bash
|
|
113
|
-
|
|
114
|
-
|
|
72
|
+
claude-recall setup --install
|
|
73
|
+
claude mcp add claude-recall -- claude-recall mcp start
|
|
115
74
|
```
|
|
116
75
|
|
|
117
|
-
|
|
76
|
+
Restart Claude Code. Ask *"Load my rules"* to verify — Claude should call `load_rules`.
|
|
77
|
+
|
|
78
|
+
Prefer it available in **every** project? Register the MCP server once at user scope (memories stay isolated per project either way — scoping comes from the working directory, not the install):
|
|
118
79
|
|
|
119
80
|
```bash
|
|
120
|
-
claude-recall
|
|
121
|
-
tail -5 ~/.claude-recall/hook-logs/hook-dispatcher.log
|
|
81
|
+
claude mcp add --scope user claude-recall -- claude-recall mcp start
|
|
122
82
|
```
|
|
123
83
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
> **Capture uses Kiro's own LLM — no API key needed.** To decide what's worth remembering, the capture hook classifies each prompt with Kiro's model via a headless `kiro-cli chat --no-interactive` call (through a bundled bare `claude-recall-classifier` agent). So natural statements like "my favourite color is green" are captured without any `ANTHROPIC_API_KEY` and without the `store_memory` MCP tool — which matters under enterprise governance that blocks the MCP server. It runs in a detached background worker, so your turn is never blocked; it spends ~0.06 Kiro credits per prompt. **Under Kiro the included LLM is used first even if you happen to have `ANTHROPIC_API_KEY` set** — so a key exported for other tools won't quietly spend your Anthropic credits. Order: Kiro's LLM → `ANTHROPIC_API_KEY` (if present) → regex; set `CLAUDE_RECALL_PREFER_API_KEY=1` to force your key first (e.g. for a stronger model you pay for). Tune the Kiro model with `CLAUDE_RECALL_KIRO_MODEL` (default `claude-haiku-4.5`). Details in [docs/kiro-llm-capture.md](docs/kiro-llm-capture.md).
|
|
127
|
-
|
|
128
|
-
**Option B — MCP tools only (no hooks, works in Kiro's default agent).**
|
|
84
|
+
Hook-based auto-capture remains a per-project opt-in via `claude-recall setup --install`.
|
|
129
85
|
|
|
130
|
-
|
|
86
|
+
### Pi
|
|
131
87
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
"mcpServers": {
|
|
135
|
-
"claude-recall": {
|
|
136
|
-
"command": "claude-recall",
|
|
137
|
-
"args": ["mcp", "start"],
|
|
138
|
-
"autoApprove": ["load_rules", "search_memory", "load_checkpoint"]
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
88
|
+
```bash
|
|
89
|
+
pi install npm:claude-recall
|
|
142
90
|
```
|
|
143
91
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
**Not available under Kiro** with either option (Kiro's hooks expose no transcript): transcript-based failure detection and session-end auto-checkpoints.
|
|
147
|
-
|
|
148
|
-
> **Project scoping & `--resume`.** Memories scope to the **working directory Kiro reports for the session** — normally the directory you launched Kiro from. `kiro --resume` resumes the most recent conversation *from the current directory* (it's per-project), so scoping and `--resume` naturally agree. Just remember the snapshot rule above: only conversations **created after** wiring run the hooks.
|
|
149
|
-
>
|
|
150
|
-
> To force a fixed project id regardless of directory, pin it with `CLAUDE_RECALL_PROJECT_ID`. A per-project shell alias makes it seamless:
|
|
151
|
-
>
|
|
152
|
-
> ```bash
|
|
153
|
-
> alias kiro-myproj='CLAUDE_RECALL_PROJECT_ID=my-project kiro-cli chat --agent <your-agent> --resume'
|
|
154
|
-
> ```
|
|
155
|
-
>
|
|
156
|
-
> `claude-recall kiro doctor` always prints the resolved project (and whether it's pinned) so you can confirm where memories are landing before trusting it.
|
|
157
|
-
>
|
|
158
|
-
> **Capture works even when the MCP tools are blocked.** Under enterprise governance that restricts MCP to a trusted registry, Kiro drops the claude-recall MCP server — so the agent may say it "has no memory tools." Ignore that: the hooks capture and inject against the local DB regardless. The agent is told this at session start and will confirm it's remembering; only the on-demand tools (the agent calling `search_memory` itself) need an admin to allowlist claude-recall.
|
|
159
|
-
|
|
160
|
-
### Shared Database
|
|
161
|
-
|
|
162
|
-
All runtimes (Claude Code, Pi, Kiro CLI) use the same database at `~/.claude-recall/claude-recall.db`, scoped per project by working directory. A correction learned in one agent is available in the others.
|
|
92
|
+
That's it. Ask Pi to *"Load my rules"* to verify.
|
|
163
93
|
|
|
164
|
-
###
|
|
94
|
+
### Kiro CLI
|
|
165
95
|
|
|
166
|
-
|
|
96
|
+
Requires claude-recall ≥ 0.28.0. In the project directory, before starting Kiro:
|
|
167
97
|
|
|
168
98
|
```bash
|
|
169
|
-
claude-recall
|
|
99
|
+
claude-recall kiro setup # writes a custom agent at .kiro/agents/recall.json
|
|
100
|
+
kiro # then inside the chat: /agent swap recall
|
|
170
101
|
```
|
|
171
102
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
Per-runtime notes:
|
|
175
|
-
|
|
176
|
-
- **Claude Code** — nothing else needed; registrations point at the `claude-recall` command, not a pinned path. If the release notes mention new or changed hooks (a `hooksVersion` bump), also re-run `claude-recall setup --install` in each active project — safe any time; a no-op when hooks are already current.
|
|
177
|
-
- **Pi** — run `pi update npm:claude-recall` and restart Pi.
|
|
178
|
-
- **Kiro CLI** — the agent config points at the `claude-recall` command, so the binary upgrade alone applies to hook *behaviour*. But when the release notes change the agent *template* (new hooks, the classifier agent, revised wiring — e.g. the **0.29.x** Kiro-LLM capture), re-run setup once so the agent picks it up: `claude-recall kiro setup --force` for the standalone `recall` agent, or `claude-recall kiro setup --merge-into <agent>` for an agent you merged into. That also writes the `claude-recall-classifier` agent and strips any superseded hooks. Then start one fresh conversation per project (the snapshot rollover above). `claude-recall kiro doctor` confirms the result.
|
|
103
|
+
Already living in a custom agent of your own? Merge Claude Recall into it instead of swapping (backup written, idempotent, your config preserved):
|
|
179
104
|
|
|
180
|
-
> **Claude Code registered before v0.27.x?** Older versions auto-registered the MCP server with an `npx`-based command, which re-resolves the package on every server start and can be shadowed by stale project-local installs. Switch to the direct binary form (run in each affected project):
|
|
181
|
-
>
|
|
182
|
-
> ```bash
|
|
183
|
-
> claude mcp remove claude-recall
|
|
184
|
-
> claude mcp add claude-recall -- claude-recall mcp start
|
|
185
|
-
> ```
|
|
186
|
-
|
|
187
|
-
> **Seeing `error: unknown command '<anything>'`?** Your installed global binary is older than the docs you're reading — commands ship with releases (`kiro` needs ≥ 0.28.0, `compact` ≥ 0.26.0, `upgrade` ≥ 0.23.2). Fix:
|
|
188
|
-
>
|
|
189
|
-
> ```bash
|
|
190
|
-
> claude-recall upgrade
|
|
191
|
-
> ```
|
|
192
|
-
>
|
|
193
|
-
> If `upgrade` itself is the unknown command (pre-0.23.2 install), bootstrap once with `npm install -g claude-recall@latest`.
|
|
194
|
-
|
|
195
|
-
<details>
|
|
196
|
-
<summary><b>If the install step reports <code>EACCES: permission denied</code></b></summary>
|
|
197
|
-
|
|
198
|
-
Your global npm prefix is root-owned (common when node was installed via `apt install nodejs`). Pick one:
|
|
199
|
-
|
|
200
|
-
**Quick** — one-time sudo:
|
|
201
105
|
```bash
|
|
202
|
-
|
|
106
|
+
claude-recall kiro setup --merge-into <agent-name>
|
|
203
107
|
```
|
|
204
108
|
|
|
205
|
-
**
|
|
206
|
-
```bash
|
|
207
|
-
mkdir -p ~/.npm-global
|
|
208
|
-
npm config set prefix ~/.npm-global
|
|
209
|
-
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
|
|
210
|
-
source ~/.bashrc
|
|
211
|
-
|
|
212
|
-
# Install claude-recall into the new user-owned prefix:
|
|
213
|
-
npm install -g claude-recall@latest
|
|
109
|
+
> **⚠️ One-time rollover:** after `kiro setup` or `--merge-into`, start **one fresh conversation** (no `--resume`). Kiro snapshots the agent config when a conversation is *created*, so older conversations never see the new hooks — even resumed or after a restart. After that one fresh start, `--resume` works normally.
|
|
214
110
|
|
|
215
|
-
|
|
216
|
-
claude-recall --version
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
The prefix fix only tells npm *where* to install; it doesn't install anything itself. The explicit `npm install -g` line picks up the new binary into the new prefix so `claude-recall` on your PATH has the `upgrade` command.
|
|
111
|
+
Capture under Kiro runs on **Kiro's own LLM** — no `ANTHROPIC_API_KEY`, no personal Anthropic subscription. It uses a dedicated fixed classifier model (default `claude-haiku-4.5`, independent of your chat model), costs ~0.06 Kiro credits per prompt, and never blocks your turn. Verify with `claude-recall kiro doctor`.
|
|
220
112
|
|
|
221
|
-
|
|
113
|
+
**Everything else Kiro** — MCP-only mode, project scoping and `--resume`, the classifier internals, enterprise-governance notes, troubleshooting: **[docs/kiro.md](docs/kiro.md)**.
|
|
222
114
|
|
|
223
115
|
---
|
|
224
116
|
|
|
225
|
-
## What
|
|
117
|
+
## What happens automatically
|
|
226
118
|
|
|
227
|
-
Once installed, Claude Recall works
|
|
119
|
+
Once installed, Claude Recall works in the background (CC = Claude Code):
|
|
228
120
|
|
|
229
121
|
| When | What happens | CC | Pi | Kiro |
|
|
230
122
|
|---|---|:-:|:-:|:-:|
|
|
231
|
-
| **Session start** | Active rules are
|
|
232
|
-
| **As you
|
|
233
|
-
| **Before each tool call
|
|
234
|
-
| **Tool outcomes** |
|
|
235
|
-
| **
|
|
236
|
-
| **Before context compression** |
|
|
237
|
-
| **After context compression** | Rules are
|
|
238
|
-
| **Sub-agent spawned** |
|
|
239
|
-
| **
|
|
240
|
-
| **
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
Classification and checkpoint extraction use Claude Haiku (via `ANTHROPIC_API_KEY`) with silent regex fallback. No configuration needed.
|
|
244
|
-
|
|
245
|
-
**Next session:** `load_rules` returns everything captured previously — the agent applies your preferences without being told twice.
|
|
123
|
+
| **Session start** | Active rules are injected into the agent's context | ✓ | ✓ | ✓ |
|
|
124
|
+
| **As you type** | Prompts are classified; durable preferences/corrections are stored | ✓ | ✓ | ✓ |
|
|
125
|
+
| **Before each tool call** | Relevant rules are re-surfaced next to the action (just-in-time injection) | ✓ | ✓ | ✓ |
|
|
126
|
+
| **Tool outcomes** | Failures are recorded; Bash failures are paired with their eventual fix | ✓ | ✓ | ✓ |
|
|
127
|
+
| **Re-ask detection** | Frustration signals (*"still broken"*) are recorded as outcome events | ✓ | ✓ | ✓ |
|
|
128
|
+
| **Before context compression** | Important context is captured before the window shrinks | ✓ | ✓ | |
|
|
129
|
+
| **After context compression** | Rules are re-injected into the fresh context | ✓ | | |
|
|
130
|
+
| **Sub-agent spawned** | Rules are injected into the sub-agent; its outcome is captured | ✓ | | |
|
|
131
|
+
| **Session exit** | An auto-checkpoint (`{completed, remaining, blockers}`) is saved for next time | ✓ | ✓ | |
|
|
132
|
+
| **End of session** | Failure patterns become candidate lessons; validated ones are promoted to rules | ✓ | ✓ | |
|
|
133
|
+
|
|
134
|
+
Classification uses an LLM wherever one is available — Claude Code provides `ANTHROPIC_API_KEY` to its hooks; Kiro uses its own included LLM — with silent regex fallback. No configuration needed.
|
|
246
135
|
|
|
247
136
|
```bash
|
|
248
137
|
# Verify it's working
|
|
@@ -252,249 +141,107 @@ claude-recall search "preference"
|
|
|
252
141
|
|
|
253
142
|
---
|
|
254
143
|
|
|
255
|
-
##
|
|
256
|
-
|
|
257
|
-
Claude Recall provides six memory tools (`load_rules`, `store_memory`, `search_memory`, `delete_memory`, `save_checkpoint`, `load_checkpoint`) backed by a local SQLite database with WAL mode, content-hash deduplication, and automatic compaction. The tools are exposed differently depending on the agent:
|
|
258
|
-
|
|
259
|
-
- **Claude Code** — MCP server with four tools and seven prompts, plus file-system hooks for automatic capture
|
|
260
|
-
- **Pi** — native extension with registered tools and event handlers, plus a skill file for behavioral guidance
|
|
261
|
-
|
|
262
|
-
| Tool | Claude Code | Pi |
|
|
263
|
-
| ---- | ----------- | --- |
|
|
264
|
-
| Load rules | `mcp__claude-recall__load_rules` | `recall_load_rules` |
|
|
265
|
-
| Store memory | `mcp__claude-recall__store_memory` | `recall_store_memory` |
|
|
266
|
-
| Search memory | `mcp__claude-recall__search_memory` | `recall_search_memory` |
|
|
267
|
-
| Delete memory | `mcp__claude-recall__delete_memory` | `recall_delete_memory` |
|
|
268
|
-
|
|
269
|
-
### Skills
|
|
270
|
-
|
|
271
|
-
Claude Recall uses skill files to teach agents when and how to use memory tools.
|
|
272
|
-
|
|
273
|
-
**Claude Code** uses Anthropic's [Agent Skills](https://agentskills.io/) open standard:
|
|
274
|
-
|
|
275
|
-
- `.claude/skills/memory-management/SKILL.md` — core skill, guides memory behavior
|
|
276
|
-
- `.claude/skills/auto-*/` — auto-generated, crystallized from accumulated memories
|
|
277
|
-
|
|
278
|
-
See Anthropic's [Agent Skills blog post](https://claude.com/blog/equipping-agents-for-the-real-world-with-agent-skills) for the standard.
|
|
279
|
-
|
|
280
|
-
**Pi** ships a single `skills/memory-management.md` loaded via Pi's package manifest. No setup needed.
|
|
281
|
-
|
|
282
|
-
### Outcome-Aware Learning
|
|
283
|
-
|
|
284
|
-
Claude Recall tracks what happens *after* the agent acts — not just what was said. The pipeline:
|
|
285
|
-
|
|
286
|
-
```
|
|
287
|
-
action → outcome event → episode → candidate lesson → promotion → active rule
|
|
288
|
-
↓
|
|
289
|
-
JIT-injected before next action
|
|
290
|
-
↓
|
|
291
|
-
PostToolUse resolves outcome per rule
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
- **Outcome events** capture results from all tool types (Bash, Edit, Write, MCP), test outcomes, user corrections, and reask signals
|
|
295
|
-
- **Episodes** summarize entire sessions with outcome type, severity, and confidence
|
|
296
|
-
- **Candidate lessons** are extracted from failure patterns — deduplicated by Jaccard similarity
|
|
297
|
-
- **Promotion engine** graduates lessons into active rules after 2+ observations (or immediately for high-severity failures)
|
|
298
|
-
- **Just-in-time rule injection (v0.22.0+)** — active rules are surfaced as a `<system-reminder>` block adjacent to each tool call (Claude Code) or each agent turn (Pi). Each injection is recorded in `rule_injection_events` and resolved with the tool's success/failure outcome by the PostToolUse hook. **This is the meter that measures rule effectiveness in practice.** It replaces the older citation-detection regex (which empirically returned 0 citations across thousands of opportunities — agents don't reliably write `(applied from memory: …)` markers, so the meter never had data to work with).
|
|
299
|
-
- **Per-rule effectiveness data** accumulates over time in `rule_injection_events`. Future releases will use it to deboost rules that are repeatedly injected without correlating to successful tool calls, and to auto-promote rules that are repeatedly injected before failures. As of v0.22.0 the data is being collected; ranking is not yet feeding back from it.
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## CLI Reference
|
|
304
|
-
|
|
305
|
-
### Health Check (run these first)
|
|
144
|
+
## Everyday commands
|
|
306
145
|
|
|
307
146
|
```bash
|
|
308
|
-
claude-recall
|
|
309
|
-
claude-recall
|
|
310
|
-
claude-recall stats # What's in the DB for this project
|
|
311
|
-
claude-recall stats --global # What's in the DB across ALL projects
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### Inspecting Memories
|
|
315
|
-
|
|
316
|
-
```bash
|
|
317
|
-
claude-recall search "query" # Search current project's memories
|
|
318
|
-
claude-recall search "query" --global # Search across all projects
|
|
319
|
-
claude-recall search "query" --json # Machine-readable output
|
|
320
|
-
claude-recall search "query" --project <id> # Search a specific project
|
|
321
|
-
|
|
322
|
-
claude-recall failures # View failure memories (current project)
|
|
323
|
-
claude-recall failures --limit 20 # Show more
|
|
147
|
+
claude-recall status # Installation health: hooks, MCP, DB path, project ID
|
|
148
|
+
claude-recall stats # What's in the DB for this project (--global for all)
|
|
324
149
|
|
|
150
|
+
claude-recall search "query" # Search this project's memories (--global, --json, --project <id>)
|
|
151
|
+
claude-recall failures # What broke and what fixed it
|
|
325
152
|
claude-recall outcomes # Outcome-aware learning status
|
|
326
|
-
claude-recall outcomes --section lessons # Just candidate lessons
|
|
327
|
-
claude-recall outcomes --section stats # Retrieval/helpfulness stats per memory
|
|
328
|
-
claude-recall outcomes --limit 20 # More items per section
|
|
329
153
|
|
|
330
|
-
claude-recall
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
154
|
+
claude-recall store "content" # Store a memory by hand (-t correction|devops|...)
|
|
155
|
+
claude-recall delete <key> # Delete one memory (keys shown by search)
|
|
156
|
+
claude-recall export backup.json # Export to JSON (import to restore)
|
|
157
|
+
claude-recall clear --force # Wipe this project's memories (auto-backup first)
|
|
334
158
|
|
|
335
|
-
|
|
336
|
-
claude-recall store "content" # Store a memory (default type: preference)
|
|
337
|
-
claude-recall store "content" -t correction # Store with specific type
|
|
338
|
-
claude-recall export backup.json # Export current project's memories to JSON
|
|
339
|
-
claude-recall export backup.json --global # Export ALL projects' memories
|
|
340
|
-
claude-recall import backup.json # Import memories from JSON
|
|
341
|
-
claude-recall clear --force # Delete current project's memories (auto-backup written first)
|
|
342
|
-
claude-recall clear --force --global # Delete ALL projects' memories
|
|
159
|
+
claude-recall upgrade # Update the global binary for all runtimes
|
|
343
160
|
```
|
|
344
161
|
|
|
345
|
-
### Task
|
|
162
|
+
### Task checkpoints
|
|
346
163
|
|
|
347
|
-
Persistent "where I left off" snapshots — one per project,
|
|
164
|
+
Persistent "where I left off" snapshots — one per project, replaced on each save:
|
|
348
165
|
|
|
349
166
|
```bash
|
|
350
|
-
claude-recall checkpoint save
|
|
351
|
-
|
|
352
|
-
--remaining "wire server.js, strip 3GPP URNs" \
|
|
353
|
-
--blockers "none" \
|
|
354
|
-
--notes "see inference/README.md"
|
|
355
|
-
|
|
356
|
-
claude-recall checkpoint load # Show the latest checkpoint
|
|
357
|
-
claude-recall checkpoint load --json # Machine-readable
|
|
358
|
-
claude-recall checkpoint clear # Delete the checkpoint
|
|
167
|
+
claude-recall checkpoint save --completed "API layer" --remaining "wire the UI" --blockers "none"
|
|
168
|
+
claude-recall checkpoint load
|
|
359
169
|
```
|
|
360
170
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
#### Auto-checkpoint on session exit (v0.21.2+)
|
|
364
|
-
|
|
365
|
-
Manual `checkpoint save` is the explicit path. **Auto-checkpoint** is the safety net: when a session ends, the most recent task is extracted into a checkpoint automatically so the next session can resume.
|
|
366
|
-
|
|
367
|
-
**When it fires:**
|
|
368
|
-
|
|
369
|
-
- **Pi** — every `session_shutdown` event. **This is the only way to recover context in Pi: there is no `pi --resume` equivalent.**
|
|
370
|
-
- **Claude Code** — voluntary `SessionEnd` reasons (`clear`, `prompt_input_exit`, `logout`). Skips `bypass_permissions_disabled` and `other` (system-driven exits, not user intent). Useful if you exit and start fresh instead of using `claude --resume`.
|
|
371
|
-
|
|
372
|
-
**Behavior (both runtimes):**
|
|
373
|
-
|
|
374
|
-
- Uses Haiku to extract `{completed, remaining, blockers}` from the most recent task in the transcript
|
|
375
|
-
- **Quality gate**: refuses to save if the LLM detects the task was already complete (e.g., agent said "Done.", user said "thanks"). **Manual checkpoints are never overwritten with garbage** — an empty checkpoint is far better than a fabricated one
|
|
376
|
-
- **Tagged**: auto-saved checkpoints include `[auto-saved on <pi|cc> session exit at <iso-timestamp>]` in their notes field
|
|
377
|
-
- **Requires `ANTHROPIC_API_KEY`**. Without it, no auto-checkpoint is saved and manual `checkpoint save` still works
|
|
378
|
-
|
|
379
|
-
**Disable:**
|
|
380
|
-
|
|
381
|
-
- **Claude Code**: remove the `SessionEnd` block from `.claude/settings.json`
|
|
382
|
-
- **Pi**: no per-project disable flag yet — [open an issue](https://github.com/raoulbia-ai/claude-recall/issues) if you need one
|
|
171
|
+
Auto-checkpoints are also saved on session exit in Claude Code and Pi (Pi has no `--resume`, so this is its main recovery path). Extraction uses Haiku via `ANTHROPIC_API_KEY`; without a key, only manual checkpoints work. A quality gate refuses to overwrite a manual checkpoint with a fabricated one when the task was already complete.
|
|
383
172
|
|
|
384
173
|
### Troubleshooting
|
|
385
174
|
|
|
386
175
|
```bash
|
|
387
|
-
#
|
|
388
|
-
|
|
389
|
-
claude-recall
|
|
390
|
-
claude-recall
|
|
176
|
+
claude-recall status # Are hooks + MCP registered? Which project is this?
|
|
177
|
+
claude-recall hooks check # Do the hook files exist and validate?
|
|
178
|
+
claude-recall mcp status # Is the MCP server running? (mcp ps lists all)
|
|
179
|
+
claude-recall project show # Which project ID does this directory map to?
|
|
180
|
+
claude-recall repair # Fix broken hook paths (--dry-run to preview)
|
|
181
|
+
claude-recall mcp cleanup --all # Stop stale MCP servers
|
|
391
182
|
|
|
392
|
-
#
|
|
393
|
-
claude-recall
|
|
394
|
-
claude-recall hooks check # Verify hook files exist and are valid
|
|
395
|
-
|
|
396
|
-
# "Is the MCP server running?"
|
|
397
|
-
claude-recall mcp status # Current project's server status
|
|
398
|
-
claude-recall mcp ps # List all running servers
|
|
399
|
-
|
|
400
|
-
# "Which project does this directory map to?"
|
|
401
|
-
claude-recall project show # Shows project ID for current directory
|
|
402
|
-
claude-recall project list # All registered projects
|
|
183
|
+
# What did the hooks actually do?
|
|
184
|
+
tail -20 ~/.claude-recall/hook-logs/hook-dispatcher.log
|
|
403
185
|
|
|
404
|
-
# "
|
|
405
|
-
claude-recall
|
|
406
|
-
claude-recall search "query" --global # Explicitly cross-project
|
|
407
|
-
|
|
408
|
-
# "How do I check what the DB actually contains?"
|
|
409
|
-
sqlite3 ~/.claude-recall/claude-recall.db "SELECT type, COUNT(*) FROM memories GROUP BY type"
|
|
410
|
-
sqlite3 ~/.claude-recall/claude-recall.db "SELECT type, COUNT(*) FROM memories WHERE project_id = '<id>' GROUP BY type"
|
|
411
|
-
|
|
412
|
-
# "Hook logs — what did the hooks actually do?"
|
|
413
|
-
tail -20 ~/.claude-recall/hook-logs/tool-outcome-watcher.log
|
|
414
|
-
tail -20 ~/.claude-recall/hook-logs/memory-stop.log
|
|
415
|
-
tail -20 ~/.claude-recall/hook-logs/correction-detector.log
|
|
416
|
-
|
|
417
|
-
# "Something is broken, start fresh"
|
|
418
|
-
claude-recall repair # Conservative: fix broken hook paths in settings.json (preserves your customizations)
|
|
419
|
-
claude-recall repair --dry-run # Preview what repair would change
|
|
420
|
-
claude-recall repair --reinstall-hooks # Opinionated: rewrite entire hook block from current template
|
|
421
|
-
claude-recall setup --install # Reinstall skills + hooks
|
|
422
|
-
claude-recall mcp cleanup --all # Stop all stale MCP servers
|
|
186
|
+
# "error: unknown command '<x>'" → your binary predates the feature:
|
|
187
|
+
claude-recall upgrade
|
|
423
188
|
```
|
|
424
189
|
|
|
425
190
|
<details>
|
|
426
|
-
<summary>All commands</summary>
|
|
191
|
+
<summary><b>All commands</b></summary>
|
|
427
192
|
|
|
428
193
|
```bash
|
|
429
194
|
# ── Setup & Diagnostics ─────────────────────────────────────────────
|
|
430
195
|
claude-recall setup # Show activation instructions
|
|
431
196
|
claude-recall setup --install # Install skills + hooks (Claude Code, current project)
|
|
432
|
-
claude-recall kiro setup # Write Kiro custom agent (
|
|
433
|
-
claude-recall kiro setup --merge-into <agent> # Merge
|
|
197
|
+
claude-recall kiro setup # Write Kiro custom agent (--global for all projects)
|
|
198
|
+
claude-recall kiro setup --merge-into <agent> # Merge into an existing Kiro agent
|
|
199
|
+
claude-recall kiro doctor # Kiro integration health report
|
|
434
200
|
claude-recall upgrade # One-shot upgrade: global binary + clear stale MCP servers
|
|
435
201
|
claude-recall status # Installation and system status
|
|
436
|
-
claude-recall repair # Fix broken claude-recall hook paths (
|
|
437
|
-
claude-recall repair --auto # Non-interactive; apply safe fixes without prompting
|
|
202
|
+
claude-recall repair # Fix broken claude-recall hook paths (preserves your customizations)
|
|
203
|
+
claude-recall repair --auto # Non-interactive; apply safe fixes without prompting
|
|
438
204
|
claude-recall repair --dry-run # Report what would change without writing
|
|
439
|
-
claude-recall repair --scope user|project|all # Scope the scan
|
|
205
|
+
claude-recall repair --scope user|project|all # Scope the scan (default: all)
|
|
440
206
|
claude-recall repair --reinstall-hooks # Opinionated: rewrite entire hook block from current template
|
|
441
207
|
claude-recall hooks check # Verify hook files exist and are valid
|
|
442
208
|
claude-recall hooks test-enforcement # Test if search enforcer hook works
|
|
443
209
|
|
|
444
210
|
# ── Memory ───────────────────────────────────────────────────────────
|
|
445
|
-
claude-recall stats # Memory statistics (
|
|
446
|
-
claude-recall
|
|
447
|
-
claude-recall search "query" # Search memories (current project)
|
|
448
|
-
claude-recall search "query" --global # Search memories (all projects)
|
|
449
|
-
claude-recall search "query" --json # Output as JSON
|
|
450
|
-
claude-recall search "query" --project <id> # Search specific project
|
|
211
|
+
claude-recall stats # Memory statistics (--global for all projects)
|
|
212
|
+
claude-recall search "query" # Search memories (--global, --json, --project <id>)
|
|
451
213
|
claude-recall store "content" # Store memory directly
|
|
452
|
-
claude-recall store "content" -t <type> #
|
|
453
|
-
claude-recall export backup.json # Export current project
|
|
454
|
-
claude-recall export backup.json --global # Export all projects
|
|
214
|
+
claude-recall store "content" -t <type> # Type: preference, correction, failure, devops, project-knowledge
|
|
215
|
+
claude-recall export backup.json # Export current project (--global for all)
|
|
455
216
|
claude-recall import backup.json # Import memories from JSON
|
|
456
217
|
claude-recall delete <key> # Delete one memory by key (get keys from `search`)
|
|
457
|
-
claude-recall clear --force # Clear current project (auto-backup written first)
|
|
458
|
-
claude-recall
|
|
459
|
-
claude-recall
|
|
460
|
-
claude-recall failures --limit 20 # Limit results
|
|
461
|
-
claude-recall outcomes # Outcome-aware learning status
|
|
462
|
-
claude-recall outcomes --section lessons # Just candidate lessons
|
|
463
|
-
claude-recall outcomes --section stats # Retrieval/helpfulness stats
|
|
464
|
-
claude-recall outcomes --limit 20 # More items per section
|
|
218
|
+
claude-recall clear --force # Clear current project (--global for all; auto-backup written first)
|
|
219
|
+
claude-recall failures # View failure memories (--limit N)
|
|
220
|
+
claude-recall outcomes # Outcome-aware learning status (--section lessons|stats, --limit N)
|
|
465
221
|
claude-recall monitor # Memory search monitoring stats
|
|
466
222
|
|
|
467
223
|
# ── Rule Hygiene ─────────────────────────────────────────────────────
|
|
468
|
-
claude-recall rules demote [--dry-run]
|
|
469
|
-
claude-recall rules demote --min-loads 20
|
|
470
|
-
claude-recall rules
|
|
471
|
-
claude-recall rules
|
|
472
|
-
claude-recall rules dedup [--dry-run] # Collapse near-duplicate rules (Jaccard >= threshold)
|
|
473
|
-
claude-recall rules dedup --threshold 0.8 # Stricter similarity (default 0.65)
|
|
474
|
-
|
|
475
|
-
# ── Cleanup (destructive — always --dry-run first) ─────────────────
|
|
476
|
-
claude-recall cleanup test-pollution [--dry-run] # Delete legacy test-fixture rows
|
|
224
|
+
claude-recall rules demote [--dry-run] # Demote rules loaded >=N times but never cited
|
|
225
|
+
claude-recall rules demote --min-loads 20 --min-age-days 7 # Tune thresholds
|
|
226
|
+
claude-recall rules promote <id> # Restore an auto-demoted or auto-deduped rule
|
|
227
|
+
claude-recall rules dedup [--dry-run] # Collapse near-duplicate rules (--threshold 0.8 for stricter)
|
|
477
228
|
|
|
478
229
|
# ── Task Checkpoints ────────────────────────────────────────────────
|
|
479
|
-
claude-recall checkpoint save --completed <text> --remaining <text> [--blockers <text>] [--notes <text>]
|
|
480
|
-
claude-recall checkpoint load [--
|
|
481
|
-
claude-recall checkpoint clear
|
|
230
|
+
claude-recall checkpoint save --completed <text> --remaining <text> [--blockers <text>] [--notes <text>]
|
|
231
|
+
claude-recall checkpoint load [--json]
|
|
232
|
+
claude-recall checkpoint clear
|
|
482
233
|
|
|
483
234
|
# ── Skills ───────────────────────────────────────────────────────────
|
|
484
|
-
claude-recall skills generate # Generate skills from memories
|
|
485
|
-
claude-recall skills generate --dry-run # Preview without writing
|
|
486
|
-
claude-recall skills generate --force # Regenerate even if unchanged
|
|
235
|
+
claude-recall skills generate # Generate skills from memories (--dry-run, --force)
|
|
487
236
|
claude-recall skills list # List generated skills
|
|
488
237
|
claude-recall skills clean --force # Remove all auto-generated skills
|
|
489
238
|
|
|
490
239
|
# ── MCP Server ───────────────────────────────────────────────────────
|
|
491
240
|
claude-recall mcp status # Current project's server status
|
|
492
241
|
claude-recall mcp ps # List all running servers
|
|
493
|
-
claude-recall mcp stop
|
|
494
|
-
claude-recall mcp
|
|
495
|
-
claude-recall mcp
|
|
496
|
-
claude-recall mcp cleanup # Remove stale PID files
|
|
497
|
-
claude-recall mcp cleanup --all # Stop all servers
|
|
242
|
+
claude-recall mcp stop [--force] # Stop server
|
|
243
|
+
claude-recall mcp restart # Stop server (Claude Code respawns it next session)
|
|
244
|
+
claude-recall mcp cleanup [--all] # Remove stale PID files / stop all servers
|
|
498
245
|
|
|
499
246
|
# ── Project ──────────────────────────────────────────────────────────
|
|
500
247
|
claude-recall project show # Current project info
|
|
@@ -504,8 +251,8 @@ claude-recall project unregister [id] # Unregister a project
|
|
|
504
251
|
claude-recall project clean # Remove stale registry entries
|
|
505
252
|
|
|
506
253
|
# ── Database Maintenance ─────────────────────────────────────────────
|
|
507
|
-
claude-recall compact # Dedup + prune
|
|
508
|
-
claude-recall
|
|
254
|
+
claude-recall compact # Dedup + prune + VACUUM (--dry-run to preview; also runs on MCP boot)
|
|
255
|
+
claude-recall cleanup test-pollution [--dry-run] # Delete legacy test-fixture rows
|
|
509
256
|
|
|
510
257
|
# ── Auto-Capture Hooks (run automatically, registered via setup --install) ──
|
|
511
258
|
claude-recall hook run correction-detector # UserPromptSubmit hook
|
|
@@ -518,52 +265,92 @@ claude-recall hook run memory-sync # Stop + PreCompact hook (syncs rul
|
|
|
518
265
|
|
|
519
266
|
---
|
|
520
267
|
|
|
521
|
-
##
|
|
268
|
+
## How it works
|
|
269
|
+
|
|
270
|
+
Six memory tools (`load_rules`, `store_memory`, `search_memory`, `delete_memory`, `save_checkpoint`, `load_checkpoint`) backed by one local SQLite database (`~/.claude-recall/claude-recall.db`, WAL mode, content-hash dedup, auto-compaction). Exposure per agent:
|
|
522
271
|
|
|
523
|
-
|
|
272
|
+
- **Claude Code** — MCP server (`mcp__claude-recall__*` tools) + file-system hooks for automatic capture
|
|
273
|
+
- **Pi** — native extension (`recall_*` tools) + event handlers
|
|
274
|
+
- **Kiro CLI** — custom agent bundling the MCP server + Kiro hooks ([details](docs/kiro.md))
|
|
524
275
|
|
|
525
|
-
|
|
276
|
+
**Skills.** Claude Recall teaches agents *when* to use memory via skill files — Anthropic's [Agent Skills](https://agentskills.io/) standard for Claude Code (`.claude/skills/memory-management/`, plus auto-generated `.claude/skills/auto-*/` crystallized from accumulated memories), and a bundled skill file for Pi.
|
|
277
|
+
|
|
278
|
+
**Outcome-aware learning.** Claude Recall tracks what happens *after* the agent acts:
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
action → outcome event → episode → candidate lesson → promotion → active rule
|
|
282
|
+
↓
|
|
283
|
+
JIT-injected before the next action
|
|
284
|
+
↓
|
|
285
|
+
outcome resolved per injected rule
|
|
286
|
+
```
|
|
526
287
|
|
|
527
|
-
|
|
288
|
+
Failures become candidate lessons (deduplicated by similarity); lessons seen 2+ times (or once, if severe) are promoted to active rules; every just-in-time injection is recorded and resolved against the tool's outcome, building per-rule effectiveness data over time.
|
|
528
289
|
|
|
529
290
|
---
|
|
530
291
|
|
|
531
|
-
##
|
|
292
|
+
## Upgrading
|
|
532
293
|
|
|
533
|
-
|
|
534
|
-
- No prompts, code, or memory content is transmitted
|
|
535
|
-
- Full transparency via CLI (`stats`, `search`, `export`)
|
|
536
|
-
- Never stores secrets (API keys, passwords, tokens)
|
|
294
|
+
One command upgrades the shared binary for **all** runtimes:
|
|
537
295
|
|
|
538
|
-
|
|
296
|
+
```bash
|
|
297
|
+
claude-recall upgrade
|
|
298
|
+
```
|
|
539
299
|
|
|
540
|
-
|
|
300
|
+
It checks the registry, refreshes the global binary, and clears any running MCP servers — they respawn on the next tool call with the new version.
|
|
301
|
+
|
|
302
|
+
Per-runtime notes:
|
|
303
|
+
|
|
304
|
+
- **Claude Code** — nothing else needed. If the release notes mention new or changed hooks, also re-run `claude-recall setup --install` in each active project (safe any time; a no-op when current).
|
|
305
|
+
- **Pi** — run `pi update npm:claude-recall` and restart Pi.
|
|
306
|
+
- **Kiro CLI** — the binary upgrade covers hook behaviour; when release notes change the agent *template*, re-run `kiro setup` once and start one fresh conversation — see [docs/kiro.md](docs/kiro.md#upgrading).
|
|
541
307
|
|
|
542
308
|
<details>
|
|
543
|
-
<summary>
|
|
309
|
+
<summary><b>Install & upgrade troubleshooting</b> (EACCES, unknown command, pre-0.27 registrations)</summary>
|
|
544
310
|
|
|
545
|
-
|
|
311
|
+
**`EACCES: permission denied`** — your global npm prefix is root-owned (common when node came from `apt`). Quick fix: `sudo npm install -g claude-recall@latest`. Permanent fix — move the prefix to a user-owned directory so global installs never need sudo again:
|
|
546
312
|
|
|
547
313
|
```bash
|
|
548
|
-
|
|
549
|
-
|
|
314
|
+
mkdir -p ~/.npm-global
|
|
315
|
+
npm config set prefix ~/.npm-global
|
|
316
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
|
|
317
|
+
source ~/.bashrc
|
|
318
|
+
npm install -g claude-recall@latest
|
|
319
|
+
claude-recall --version
|
|
550
320
|
```
|
|
551
321
|
|
|
552
|
-
|
|
322
|
+
**`error: unknown command '<anything>'`** — your installed binary is older than the docs you're reading (`kiro` needs ≥ 0.28.0, `compact` ≥ 0.26.0, `upgrade` ≥ 0.23.2). Run `claude-recall upgrade`; if `upgrade` itself is unknown, bootstrap with `npm install -g claude-recall@latest`.
|
|
323
|
+
|
|
324
|
+
**Claude Code registered before v0.27.x?** Older versions auto-registered the MCP server with an `npx`-based command, which can be shadowed by stale project-local installs. Switch to the direct binary form (run in each affected project):
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
claude mcp remove claude-recall
|
|
328
|
+
claude mcp add claude-recall -- claude-recall mcp start
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**WSL: "invalid ELF header"** — mixed Windows/WSL `node_modules`. Use the global install (the default) and verify the binary resolves to a Linux path: `which claude-recall` should show `/home/<user>/...`, not a Windows path. Global installation does not affect project scoping.
|
|
553
332
|
|
|
554
333
|
</details>
|
|
555
334
|
|
|
556
335
|
---
|
|
557
336
|
|
|
558
|
-
##
|
|
337
|
+
## Project scoping
|
|
338
|
+
|
|
339
|
+
Each project gets isolated memory. The **project ID** is derived from the working directory the agent reports; universal memories (no project scope) are available everywhere. Switching projects switches memory automatically — no configuration.
|
|
340
|
+
|
|
341
|
+
To pin one logical project across several directories (worktrees, subrepos), set `CLAUDE_RECALL_PROJECT_ID`. Details: [docs/project-scoping.md](docs/project-scoping.md).
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Configuration
|
|
559
346
|
|
|
560
|
-
|
|
347
|
+
Defaults work out of the box; tune via environment variables as needed.
|
|
561
348
|
|
|
562
349
|
| Variable | Default | Effect |
|
|
563
350
|
| ---------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------- |
|
|
564
351
|
| `CLAUDE_RECALL_DB_PATH` | `~/.claude-recall/` | Database directory. |
|
|
565
352
|
| `ANTHROPIC_API_KEY` | _(unset)_ | LLM classification via Haiku. Not required — Claude Code provides it to its hooks, and under Kiro the included LLM is used instead (and is preferred even if this is set). Regex is the final fallback. |
|
|
566
|
-
| `CLAUDE_RECALL_KIRO_MODEL` | `claude-haiku-4.5` |
|
|
353
|
+
| `CLAUDE_RECALL_KIRO_MODEL` | `claude-haiku-4.5` | Dedicated model for Kiro-LLM capture classification — **independent of your interactive Kiro chat model**. Raise to `claude-sonnet-4.6` for steadier judgement at more credits. See [docs/kiro-llm-capture.md](docs/kiro-llm-capture.md). |
|
|
567
354
|
| `CLAUDE_RECALL_PREFER_API_KEY` | _(unset)_ | Under Kiro, force `ANTHROPIC_API_KEY`-based classification ahead of Kiro's included LLM (uses your Anthropic credits — e.g. for a stronger model). No effect under Claude Code. |
|
|
568
355
|
| `CLAUDE_RECALL_KIRO_LLM_TIMEOUT_MS` | `30000` | Hard cap on the headless `kiro-cli` classify call before the capture worker gives up and falls back to regex. |
|
|
569
356
|
| `CLAUDE_RECALL_LOAD_BUDGET_TOKENS` | `2000` | Token budget for the `load_rules` payload. Rules are emitted in priority order (corrections → preferences by citation → devops by citation → failures) and dropped rules surface via `search_memory`. |
|
|
@@ -575,14 +362,24 @@ Runtime behavior can be tuned via environment variables. Defaults are chosen so
|
|
|
575
362
|
| `CLAUDE_RECALL_MAX_MEMORIES` | `10000` | Memory-row soft cap. |
|
|
576
363
|
| `CLAUDE_RECALL_ENFORCE_MODE` | `on` | Set to `off` to bypass the search-enforcer hook. |
|
|
577
364
|
| `CLAUDE_RECALL_LLM_TIMEOUT_MS` | `5000` | Timeout for hook-context LLM calls (classification, hindsight hints). Hooks fall back to regex when it fires. |
|
|
578
|
-
| `CLAUDE_RECALL_STOP_DEBOUNCE_MS` | `300000` | Debounce for the heavy Stop-hook pipeline (episodes, session extraction, promotion).
|
|
579
|
-
| `CLAUDE_RECALL_PROJECT_ID` | *(cwd)* | Pin the project scope to a fixed id, overriding working-directory detection.
|
|
365
|
+
| `CLAUDE_RECALL_STOP_DEBOUNCE_MS` | `300000` | Debounce for the heavy Stop-hook pipeline (episodes, session extraction, promotion). `0` disables. |
|
|
366
|
+
| `CLAUDE_RECALL_PROJECT_ID` | *(cwd)* | Pin the project scope to a fixed id, overriding working-directory detection. |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Security & privacy
|
|
371
|
+
|
|
372
|
+
- SQLite memory never leaves your machine — no prompts, code, or memory content is transmitted
|
|
373
|
+
- Full transparency via CLI (`stats`, `search`, `export`)
|
|
374
|
+
- Never stores secrets (API keys, passwords, tokens)
|
|
375
|
+
|
|
376
|
+
Details in [docs/security.md](docs/security.md).
|
|
580
377
|
|
|
581
378
|
---
|
|
582
379
|
|
|
583
|
-
## Development &
|
|
380
|
+
## Development & contributions
|
|
584
381
|
|
|
585
|
-
PRs welcome
|
|
382
|
+
PRs welcome.
|
|
586
383
|
|
|
587
384
|
```bash
|
|
588
385
|
npm run build # Compile TypeScript
|
|
@@ -154,6 +154,15 @@ function classifyWithKiro(text) {
|
|
|
154
154
|
if (!result) {
|
|
155
155
|
(0, shared_1.hookLog)('kiro-classifier', 'no parseable classification in kiro-cli output');
|
|
156
156
|
}
|
|
157
|
+
else {
|
|
158
|
+
// Log success too, not just failures — otherwise a successful Kiro
|
|
159
|
+
// classification is silent and indistinguishable from "never ran",
|
|
160
|
+
// which makes "did the Kiro LLM handle this?" impossible to answer
|
|
161
|
+
// from the log. Spell out that this ran on Kiro credits (not the
|
|
162
|
+
// ANTHROPIC_API_KEY) using a dedicated classifier model — the `model`
|
|
163
|
+
// is CLAUDE_RECALL_KIRO_MODEL, independent of the interactive chat model.
|
|
164
|
+
(0, shared_1.hookLog)('kiro-classifier', `classified via kiro-cli (model=${model}, Kiro credits, no API key): ${result.type} — ${result.extract.slice(0, 60)}`);
|
|
165
|
+
}
|
|
157
166
|
done(result);
|
|
158
167
|
});
|
|
159
168
|
});
|
package/docs/kiro-llm-capture.md
CHANGED
|
@@ -114,7 +114,7 @@ returns `null`, degrading to regex — a hook must never throw.
|
|
|
114
114
|
| Variable | Default | Effect |
|
|
115
115
|
| --- | --- | --- |
|
|
116
116
|
| `CLAUDE_RECALL_KIRO_CLASSIFIER` | *(set by the worker)* | Enables the Kiro-LLM path in `classifyContent`. Set automatically by `kiro-capture-worker`; never needed by hand. |
|
|
117
|
-
| `CLAUDE_RECALL_KIRO_MODEL` | `claude-haiku-4.5` | Model for the classify call. Raise to `claude-sonnet-4.6` for steadier judgement at ~3× the credits. |
|
|
117
|
+
| `CLAUDE_RECALL_KIRO_MODEL` | `claude-haiku-4.5` | Model for the classify call, passed explicitly as `--model`. This is a **dedicated classifier model, independent of the user's interactive Kiro chat model** (e.g. `auto`) — the headless call always uses this value. Raise to `claude-sonnet-4.6` for steadier judgement at ~3× the credits. |
|
|
118
118
|
| `CLAUDE_RECALL_KIRO_LLM_TIMEOUT_MS` | `30000` | Hard cap on the headless call before the worker gives up and falls back to regex. |
|
|
119
119
|
| `CLAUDE_RECALL_PREFER_API_KEY` | *(unset)* | Force `ANTHROPIC_API_KEY`-based classification ahead of Kiro's included LLM (opt-in; uses your Anthropic credits). |
|
|
120
120
|
|
package/docs/kiro.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Claude Recall + Kiro CLI — the full guide
|
|
2
|
+
|
|
3
|
+
Everything about running Claude Recall under [Kiro CLI](https://kiro.dev/cli/): setup options, the one-time conversation rollover, how capture works without an API key, project scoping, and troubleshooting.
|
|
4
|
+
|
|
5
|
+
Requires claude-recall **≥ 0.28.0** (`claude-recall --version` to check; `claude-recall upgrade` to update). Kiro uses the same global binary and the same database as Claude Code and Pi — a memory captured in one agent is available in the others.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Setup Option A — full integration (recommended)
|
|
10
|
+
|
|
11
|
+
Memory **plus** hooks (auto-capture, rule injection) via a Kiro custom agent.
|
|
12
|
+
|
|
13
|
+
In your shell, in the project directory, **before** starting Kiro:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
claude-recall kiro setup
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This writes a Kiro custom agent at `.kiro/agents/recall.json` (use `--global` for `~/.kiro/agents` so it's available in every project). It does **not** touch your `mcp.json` — the agent config carries its own `mcpServers` entry for claude-recall, so no separate MCP registration is needed. It also sets `includeMcpJson: true`, so any other servers you have in `mcp.json` keep working alongside it.
|
|
20
|
+
|
|
21
|
+
Then start Kiro from your shell:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
kiro
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
and inside the Kiro chat, switch to the agent:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
/agent swap recall
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
You get: active rules injected into context automatically at agent start (no tool call needed), just-in-time rule injection before each tool call, automatic capture of corrections/preferences from your prompts, tool-outcome tracking with Bash fix-pairing, and the full MCP tool surface (read-only tools pre-approved).
|
|
34
|
+
|
|
35
|
+
### Merging into an agent you already use
|
|
36
|
+
|
|
37
|
+
Don't want to swap agents? Merge Claude Recall into your own:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
claude-recall kiro setup --merge-into <agent-name>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This finds the agent config (workspace `.kiro/agents/` first, then `~/.kiro/agents/`; `--global` to target the global one directly), writes a timestamped backup, and appends the claude-recall pieces — MCP server, pre-approved read-only tools, and the four hooks — while leaving your own config untouched. It only rewrites claude-recall's own entries: superseded ones from an older version are swapped for the current wiring (any unrelated hook you have on the same event is preserved). Idempotent: on an already-current agent, re-running changes nothing. If the agent restricts tools with an explicit list, `@claude-recall` is added to it.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## The one-time conversation rollover
|
|
48
|
+
|
|
49
|
+
> **⚠️ After `kiro setup` or `--merge-into`: start ONE fresh conversation per project (no `--resume`).**
|
|
50
|
+
|
|
51
|
+
Kiro snapshots the agent config into each conversation **at creation** — `--resume` restores that snapshot and ignores agent-config changes made since. So conversations created *before* you wired claude-recall will **never** run its hooks, no matter how often you resume them or restart Kiro. Start one fresh conversation after wiring; every conversation created from then on carries the hooks, **including when resumed** (`--resume` works normally afterwards — this is a one-time rollover per project).
|
|
52
|
+
|
|
53
|
+
The rollover, concretely (add your usual flags, e.g. `--classic`, `--trust-all-tools`):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cd ~/path/to/your-project
|
|
57
|
+
kiro-cli chat --agent <your-agent>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
In that session state something memorable (e.g. `recall the deploy pipeline uses helm`), exit, then verify it was captured:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
claude-recall search "helm"
|
|
64
|
+
tail -5 ~/.claude-recall/hook-logs/hook-dispatcher.log
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The log should show a `scope [...] → project=your-project` line; `claude-recall kiro doctor` gives a fuller health report.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## How capture works under Kiro — no API key needed
|
|
72
|
+
|
|
73
|
+
To decide what's worth remembering, the capture hook classifies each prompt via a headless `kiro-cli chat --no-interactive --model …` call (through a bundled bare `claude-recall-classifier` agent). So natural statements like "my favourite color is green" are captured without any `ANTHROPIC_API_KEY` and without the `store_memory` MCP tool — which matters under enterprise governance that blocks the MCP server. It runs in a detached background worker, so your turn is never blocked; it spends ~0.06 Kiro credits per prompt.
|
|
74
|
+
|
|
75
|
+
**The classifier uses a dedicated, fixed model — not your chat model.** It always runs the model in `CLAUDE_RECALL_KIRO_MODEL` (default `claude-haiku-4.5`, chosen because classification is cheap and high-volume), **independent of your interactive Kiro chat model** (e.g. `auto`). This keeps classification cost predictable no matter what your chat is set to. Set `CLAUDE_RECALL_KIRO_MODEL` to any model from `kiro-cli chat --list-models` to change it. Every successful classification is logged to `~/.claude-recall/hook-logs/kiro-classifier.log` as `classified via kiro-cli (model=…, Kiro credits, no API key)`, so you can always see which model ran.
|
|
76
|
+
|
|
77
|
+
**Under Kiro the included LLM is used first even if you happen to have `ANTHROPIC_API_KEY` set** — so a key exported for other tools won't quietly spend your Anthropic credits. Order: Kiro's LLM → `ANTHROPIC_API_KEY` (if present) → regex; set `CLAUDE_RECALL_PREFER_API_KEY=1` to force your key first (e.g. for a stronger model you pay for).
|
|
78
|
+
|
|
79
|
+
Design details, latency measurements, and output-parsing internals: [kiro-llm-capture.md](kiro-llm-capture.md).
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Setup Option B — MCP tools only (no hooks)
|
|
84
|
+
|
|
85
|
+
Works in Kiro's default agent; nothing happens automatically. Register just the MCP server in Kiro's config — create or merge into `.kiro/settings/mcp.json` (project) or `~/.kiro/settings/mcp.json` (all projects):
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"claude-recall": {
|
|
91
|
+
"command": "claude-recall",
|
|
92
|
+
"args": ["mcp", "start"],
|
|
93
|
+
"autoApprove": ["load_rules", "search_memory", "load_checkpoint"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
With Option B the agent has the memory tools (`load_rules`, `store_memory`, `search_memory`, checkpoints) but no rules at session start and no auto-capture. Ask it to *"load my rules"*.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Project scoping and `--resume`
|
|
104
|
+
|
|
105
|
+
Memories scope to the **working directory Kiro reports for the session** — normally the directory you launched Kiro from. `kiro --resume` resumes the most recent conversation *from the current directory* (it's per-project), so scoping and `--resume` naturally agree. Just remember the snapshot rule above: only conversations **created after** wiring run the hooks.
|
|
106
|
+
|
|
107
|
+
To force a fixed project id regardless of directory, pin it with `CLAUDE_RECALL_PROJECT_ID`. A per-project shell alias makes it seamless:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
alias kiro-myproj='CLAUDE_RECALL_PROJECT_ID=my-project kiro-cli chat --agent <your-agent> --resume'
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`claude-recall kiro doctor` always prints the resolved project (and whether it's pinned) so you can confirm where memories are landing before trusting it.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Enterprise governance
|
|
118
|
+
|
|
119
|
+
Under enterprise governance that restricts MCP to a trusted registry, Kiro drops the claude-recall MCP server — so the agent may say it "has no memory tools." Ignore that: **the hooks capture and inject against the local DB regardless.** The agent is told this at session start and will confirm it's remembering; only the on-demand tools (the agent calling `search_memory` itself) need an admin to allowlist claude-recall.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## What's not available under Kiro
|
|
124
|
+
|
|
125
|
+
Kiro's hooks expose no transcript, so two features are off with either setup option:
|
|
126
|
+
|
|
127
|
+
- transcript-based failure detection
|
|
128
|
+
- session-end auto-checkpoints (existing checkpoints are still surfaced at agent start)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Upgrading
|
|
133
|
+
|
|
134
|
+
`claude-recall upgrade` refreshes the shared global binary, which is all hook *behaviour* needs — the agent config points at the `claude-recall` command, not a pinned path.
|
|
135
|
+
|
|
136
|
+
But when release notes change the agent *template* (new hooks, the classifier agent, revised wiring — e.g. the **0.29.x** Kiro-LLM capture), re-run setup once so the agent picks it up:
|
|
137
|
+
|
|
138
|
+
- `claude-recall kiro setup --force` for the standalone `recall` agent, or
|
|
139
|
+
- `claude-recall kiro setup --merge-into <agent>` for an agent you merged into.
|
|
140
|
+
|
|
141
|
+
That also writes the `claude-recall-classifier` agent and strips any superseded hooks. Then start one fresh conversation per project (the snapshot rollover above). `claude-recall kiro doctor` confirms the result.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Troubleshooting
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
claude-recall kiro doctor # full health report: agent config, hooks, classifier, project scope
|
|
149
|
+
claude-recall search "something you just said" # did capture land?
|
|
150
|
+
tail -5 ~/.claude-recall/hook-logs/hook-dispatcher.log # which hooks fired, which project
|
|
151
|
+
tail -5 ~/.claude-recall/hook-logs/kiro-classifier.log # which LLM classified (model, credits)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Common cases:
|
|
155
|
+
|
|
156
|
+
- **Hooks never fire** → you're in a conversation created before wiring; do the [rollover](#the-one-time-conversation-rollover).
|
|
157
|
+
- **Nothing captured from a natural statement** → check `kiro-classifier.log`; if it shows `kiro-cli error: ENOENT`, `kiro-cli` isn't on the hook's `PATH` and capture fell back to regex.
|
|
158
|
+
- **Agent says it has no memory tools** → see [Enterprise governance](#enterprise-governance); capture still works.
|
|
159
|
+
- **Memories landing in the wrong project** → `claude-recall kiro doctor` shows the resolved project id; pin with `CLAUDE_RECALL_PROJECT_ID` if needed.
|
package/package.json
CHANGED