memoryrouter-claude 2.4.0 → 2.6.0
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/CHANGELOG.md +13 -0
- package/README.md +14 -0
- package/bin/cli.js +99 -0
- package/lib/hook-runner.js +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.6.0 (2026-08-17)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Tier-guide teaching text on every model-facing surface: the injected recall hint, the `date-search` CLI help, and the in-code guidance now teach that tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, and tier 1 holds raw verbatim memories. Broad "most important things" questions use `--tiers 3 --importance 8`; specific events use `--tiers 2`; exact details use tier 1 or blended.
|
|
8
|
+
|
|
9
|
+
## 2.5.0 (2026-08-17)
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `date-search` CLI verb: time-window retrieval with `--from` (required ISO 8601), `--to`, `--query`, `--tiers 1,2,3`, `--importance N` (minimum threshold; only reflections carry ratings), `--max-tokens N`, and `--json`. Prints continuation cursors when the window is truncated.
|
|
14
|
+
- Injected recall context now carries a one-line hint teaching the model to use `date-search` with `--tiers 2,3 --importance 7` for questions like "most important things lately".
|
|
15
|
+
|
|
3
16
|
## Unreleased
|
|
4
17
|
|
|
5
18
|
### Added
|
package/README.md
CHANGED
|
@@ -172,6 +172,7 @@ The key is stored only at `~/.memoryrouter/config.json` with mode `0600` in a mo
|
|
|
172
172
|
| `npx memoryrouter-claude init` | Install or upgrade automatic hooks |
|
|
173
173
|
| `npx memoryrouter-claude doctor` | Diagnose config, permissions, hooks, project ID, pending capture, API, and MCP |
|
|
174
174
|
| `npx memoryrouter-claude status` | Show key, vault stats, consolidation debt, and active project scope |
|
|
175
|
+
| `npx memoryrouter-claude date-search` | Retrieve memories from a specific time window with tier and importance filters |
|
|
175
176
|
| `npx memoryrouter-claude reflect` | Consolidate memories into reflections using your local `claude` CLI |
|
|
176
177
|
| `npx memoryrouter-claude mcp install` | Add the OAuth MCP manual surface with current Claude CLI syntax |
|
|
177
178
|
| `npx memoryrouter-claude mcp status` | Inspect MCP configuration |
|
|
@@ -179,6 +180,19 @@ The key is stored only at `~/.memoryrouter/config.json` with mode `0600` in a mo
|
|
|
179
180
|
| `npx memoryrouter-claude off` | Remove MemoryRouter hooks from local/project/user settings |
|
|
180
181
|
| `npx memoryrouter-claude off --purge` | Also delete private key/config/checkpoint state |
|
|
181
182
|
|
|
183
|
+
## Date search (time-window retrieval)
|
|
184
|
+
|
|
185
|
+
Retrieve memories from a specific time window. Use for questions like 'what happened last week' or 'most important things this month or lately'. For importance questions set importance to 7 or higher with tiers 2,3, since only reflections carry importance ratings. Omit `--query` for a chronological review; include `--query` to rank by relevance within the window. Resolve relative phrases like 'lately' to concrete ISO dates before calling.
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npx memoryrouter-claude date-search --from 2026-08-10 # chronological review
|
|
189
|
+
npx memoryrouter-claude date-search --from 2026-08-01 --to 2026-08-15 --query "launches"
|
|
190
|
+
npx memoryrouter-claude date-search --from 2026-08-10 --tiers 2,3 --importance 7 # most important lately
|
|
191
|
+
npx memoryrouter-claude date-search --from 2026-08-10 --json # raw server response
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Flags: `--from` (required, ISO 8601), `--to` (default now), `--query`, `--tiers 1,2,3` (only tiers 2 and 3 carry importance ratings), `--importance N` (minimum threshold 1 to 10; raw memories are excluded whenever this is set), `--max-tokens N` (1000 to 200000), `--json`. Truncated windows print a continuation cursor. The injected recall context also carries a one-line hint teaching Claude this exact pattern, so the agent can answer "what are the most important things we've done lately?" by itself.
|
|
195
|
+
|
|
182
196
|
## Reflections (memory consolidation)
|
|
183
197
|
|
|
184
198
|
MemoryRouter's [Reflection Hierarchy](https://docs.memoryrouter.ai/reflections) consolidates raw memories into higher-level reflections. This package runs the loop headless with YOUR local Claude Code as the reflecting model (you pay your own inference; MemoryRouter never calls a provider):
|
package/bin/cli.js
CHANGED
|
@@ -49,6 +49,35 @@ Usage:
|
|
|
49
49
|
Show key validity, vault stats, consolidation debt, and deterministic
|
|
50
50
|
project identity.
|
|
51
51
|
|
|
52
|
+
npx memoryrouter-claude date-search --from <ISO> [--to <ISO>] [--query <text>] [--tiers 1,2,3] [--importance N] [--max-tokens N] [--json]
|
|
53
|
+
Retrieve memories from a specific time window. Use for questions like
|
|
54
|
+
'what happened last week' or 'most important things this month or lately'.
|
|
55
|
+
Tier guide: tier 3 holds the highest-level consolidated reflections
|
|
56
|
+
(identity, principles, what matters most), tier 2 holds reflections of
|
|
57
|
+
specific meaningful events, tier 1 holds raw verbatim memories. Match
|
|
58
|
+
filters to the question. Broad 'most important things last month'
|
|
59
|
+
questions: --tiers 3 --importance 8 with a generous --max-tokens.
|
|
60
|
+
Big-picture overviews of a period: --tiers 3 with no importance filter.
|
|
61
|
+
Specific lookups like 'find the decision about X': omit --tiers and
|
|
62
|
+
--importance; a high importance filter hides the specific detail you
|
|
63
|
+
are looking for. Specific events without raw noise: --tiers 2 or
|
|
64
|
+
--tiers 2,3. Exact verbatim detail: --tiers 1. Mixing tiers is fine;
|
|
65
|
+
adjust the importance threshold to the question rather than always
|
|
66
|
+
setting it high. Only reflections (tiers 2 and 3) carry
|
|
67
|
+
importance ratings. Omit --query for a chronological review; include
|
|
68
|
+
--query to rank by relevance within the window. Resolve relative phrases
|
|
69
|
+
like 'lately' to concrete ISO dates before calling.
|
|
70
|
+
--from Window start, ISO 8601 date or datetime (required)
|
|
71
|
+
--to Window end, ISO 8601 date or datetime (default: now)
|
|
72
|
+
--query Optional relevance query (omit for chronological browse)
|
|
73
|
+
--tiers Comma-separated subset of 1,2,3 (3 highest-level reflections,
|
|
74
|
+
2 specific-event reflections, 1 raw; only 2 and 3 carry ratings)
|
|
75
|
+
--importance Minimum importance threshold, 1 to 10. Only reflections
|
|
76
|
+
(tiers 2 and 3) carry ratings, so raw memories are excluded
|
|
77
|
+
whenever this is set.
|
|
78
|
+
--max-tokens Token budget 1000 to 200000 (server default 50000)
|
|
79
|
+
--json Print the raw server response
|
|
80
|
+
|
|
52
81
|
npx memoryrouter-claude reflect [--tier 1|2] [--batches N|all] [--max-tokens N] [--dry-run]
|
|
53
82
|
Consolidate unconsolidated memories into reflections. Checks out a batch
|
|
54
83
|
under a 15 minute lease, runs YOUR local Claude Code (claude -p) with the
|
|
@@ -116,6 +145,12 @@ function parseArgs(argv) {
|
|
|
116
145
|
else if (value === '--file') args.file = argv[++i];
|
|
117
146
|
else if (value === '--dismiss') args.dismiss = true;
|
|
118
147
|
else if (value === '--final') args.final = true;
|
|
148
|
+
else if (value === '--from') args.from = argv[++i];
|
|
149
|
+
else if (value === '--to') args.to = argv[++i];
|
|
150
|
+
else if (value === '--query') args.query = argv[++i];
|
|
151
|
+
else if (value === '--tiers') args.tiers = argv[++i];
|
|
152
|
+
else if (value === '--importance') args.importance = parseInt(argv[++i], 10);
|
|
153
|
+
else if (value === '--json') args.json = true;
|
|
119
154
|
else if (value === '--help' || value === '-h') args.help = true;
|
|
120
155
|
else if (value === '--version' || value === '-v') args.version = true;
|
|
121
156
|
else args._.push(value);
|
|
@@ -247,6 +282,69 @@ async function cmdStatus() {
|
|
|
247
282
|
`);
|
|
248
283
|
}
|
|
249
284
|
|
|
285
|
+
async function cmdDateSearch(args) {
|
|
286
|
+
// Time-window retrieval. Use for questions like 'what happened last week'
|
|
287
|
+
// or 'most important things this month or lately'. Tier guide: tier 3 holds
|
|
288
|
+
// the highest-level consolidated reflections (identity, principles, what
|
|
289
|
+
// matters most), tier 2 holds reflections of specific meaningful events,
|
|
290
|
+
// tier 1 holds raw verbatim memories. Broad 'most important' questions:
|
|
291
|
+
// --tiers 3 --importance 8. Big-picture overviews: --tiers 3 alone.
|
|
292
|
+
// Specific lookups: omit --tiers and --importance (high importance filters
|
|
293
|
+
// hide specific detail). Specific events: --tiers 2 or 2,3. Omit --query for a
|
|
294
|
+
// chronological review; include --query to rank by relevance within the
|
|
295
|
+
// window. Resolve relative phrases like 'lately' to concrete ISO dates
|
|
296
|
+
// before calling.
|
|
297
|
+
const key = getApiKey();
|
|
298
|
+
if (!key) throw new Error('No Memory Key configured. Run: npx memoryrouter-claude init');
|
|
299
|
+
if (!args.from) throw new Error('--from <ISO date or datetime> is required (e.g. --from 2026-08-10)');
|
|
300
|
+
let tiers;
|
|
301
|
+
if (args.tiers !== undefined) {
|
|
302
|
+
tiers = String(args.tiers).split(',').map((value) => parseInt(value.trim(), 10));
|
|
303
|
+
if (!tiers.length || tiers.some((tier) => ![1, 2, 3].includes(tier))) {
|
|
304
|
+
throw new Error('--tiers must be a comma-separated subset of 1,2,3 (e.g. --tiers 2,3)');
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (args.importance !== undefined && (!Number.isInteger(args.importance) || args.importance < 1 || args.importance > 10)) {
|
|
308
|
+
throw new Error('--importance must be an integer 1 to 10');
|
|
309
|
+
}
|
|
310
|
+
if (args.maxTokens !== undefined && (!Number.isInteger(args.maxTokens) || args.maxTokens < 1000 || args.maxTokens > 200000)) {
|
|
311
|
+
throw new Error('--max-tokens must be an integer between 1000 and 200000');
|
|
312
|
+
}
|
|
313
|
+
const params = { from: args.from };
|
|
314
|
+
if (args.to !== undefined) params.to = args.to;
|
|
315
|
+
if (args.query !== undefined) params.query = args.query;
|
|
316
|
+
if (tiers !== undefined) params.tiers = tiers;
|
|
317
|
+
if (args.importance !== undefined) params.importance = args.importance;
|
|
318
|
+
if (args.maxTokens !== undefined) params.max_tokens = args.maxTokens;
|
|
319
|
+
const res = await api.dateSearch(key, params, { timeoutMs: 20000 });
|
|
320
|
+
if (!res.ok) {
|
|
321
|
+
const detail = res.data && res.data.error ? `: ${res.data.error}` : '';
|
|
322
|
+
throw new Error(`date-search failed (HTTP ${res.status})${detail}`);
|
|
323
|
+
}
|
|
324
|
+
const data = res.data || {};
|
|
325
|
+
if (args.json) {
|
|
326
|
+
console.log(JSON.stringify(data, null, 2));
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const rows = Array.isArray(data.results) ? data.results : [];
|
|
330
|
+
if (!rows.length) {
|
|
331
|
+
console.log(' No memories in that window matched the filters.');
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const windowLine = data.window ? `${data.window.from || params.from} to ${data.window.to || 'now'}` : `${params.from} to ${params.to || 'now'}`;
|
|
335
|
+
console.log(`\n ${rows.length} memories, window ${windowLine}${data.truncated ? ' (truncated)' : ''}\n`);
|
|
336
|
+
for (const row of rows) {
|
|
337
|
+
const tierTag = row.tier != null ? ` | tier ${row.tier}` : '';
|
|
338
|
+
const importanceTag = row.importance != null ? ` | importance ${row.importance}` : '';
|
|
339
|
+
console.log(` [${row.date || 'unknown date'}${tierTag}${importanceTag}]`);
|
|
340
|
+
console.log(` ${String(row.content || '').split('\n').join('\n ')}\n`);
|
|
341
|
+
}
|
|
342
|
+
if (data.truncated) {
|
|
343
|
+
const cursor = data.next_to ? `--to ${data.next_to}` : data.next_from ? `--from ${data.next_from}` : 'a narrower window';
|
|
344
|
+
console.log(` Truncated. Continue with ${cursor}.`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
250
348
|
async function cmdReflect(args) {
|
|
251
349
|
const key = getApiKey();
|
|
252
350
|
if (!key) throw new Error('No Memory Key configured. Run: npx memoryrouter-claude init');
|
|
@@ -413,6 +511,7 @@ async function main() {
|
|
|
413
511
|
switch (cmd) {
|
|
414
512
|
case 'init': return cmdInit(args);
|
|
415
513
|
case 'status': return cmdStatus();
|
|
514
|
+
case 'date-search': return cmdDateSearch(args);
|
|
416
515
|
case 'reflect': return cmdReflect(args);
|
|
417
516
|
case 'reflect-auto': {
|
|
418
517
|
// Internal entrypoint for the detached automatic consolidation run
|
package/lib/hook-runner.js
CHANGED
|
@@ -95,7 +95,10 @@ function mergeContexts(results, identity, maxChars) {
|
|
|
95
95
|
const header = identity.memoryScope === 'global'
|
|
96
96
|
? 'MemoryRouter recall (personal/global scope)'
|
|
97
97
|
: `MemoryRouter recall (project scope ${identity.id})`;
|
|
98
|
-
|
|
98
|
+
// One-line teaching hint: time-window and importance questions have a
|
|
99
|
+
// dedicated retrieval path the model cannot reach through /prepare.
|
|
100
|
+
const hint = "For time-window questions like 'what happened last week' or 'most important things lately', run: npx memoryrouter-claude date-search --from <ISO>. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question: broad 'most important' questions use --tiers 3 --importance 8; big-picture overviews use --tiers 3 with no importance filter; specific lookups omit --tiers and --importance (a high importance filter hides the specific detail); specific events without raw noise use --tiers 2 or --tiers 2,3. Mixing tiers is fine; only reflections carry ratings. Resolve relative phrases to concrete ISO dates first.";
|
|
101
|
+
return compactText(`${header}\n${hint}\n${sections.join('\n\n')}`, maxChars);
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
function reflectionNudgeLine(results) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memoryrouter-claude",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Deterministic, project-scoped persistent memory for Claude Code: automatic hook retrieval/capture plus an optional OAuth MCP control surface.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "John Rood <john@memoryrouter.ai>",
|