@hasna/mementos 0.3.3 → 0.3.4
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/dist/cli/index.js +22 -4
- package/dist/mcp/index.js +5 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3581,7 +3581,7 @@ program2.command("recall <key>").description("Recall a memory by key").option("-
|
|
|
3581
3581
|
handleError(e);
|
|
3582
3582
|
}
|
|
3583
3583
|
});
|
|
3584
|
-
program2.command("list").description("List memories with optional filters").option("-s, --scope <scope>", "Scope filter").option("-c, --category <cat>", "Category filter").option("--tags <tags>", "Comma-separated tags filter").option("--importance-min <n>", "Minimum importance", parseInt).option("--pinned", "Show only pinned").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Offset for pagination", parseInt).option("--status <status>", "Status filter: active, archived, expired").action((opts) => {
|
|
3584
|
+
program2.command("list").description("List memories with optional filters").option("-s, --scope <scope>", "Scope filter").option("-c, --category <cat>", "Category filter").option("--tags <tags>", "Comma-separated tags filter").option("--importance-min <n>", "Minimum importance", parseInt).option("--pinned", "Show only pinned").option("--agent <name>", "Agent filter").option("--project <path>", "Project filter").option("--limit <n>", "Max results", parseInt).option("--offset <n>", "Offset for pagination", parseInt).option("--status <status>", "Status filter: active, archived, expired").option("--format <fmt>", "Output format: compact (default), json, csv").action((opts) => {
|
|
3585
3585
|
try {
|
|
3586
3586
|
const globalOpts = program2.opts();
|
|
3587
3587
|
const agentId = opts.agent || globalOpts.agent;
|
|
@@ -3606,10 +3606,19 @@ program2.command("list").description("List memories with optional filters").opti
|
|
|
3606
3606
|
session_id: globalOpts.session
|
|
3607
3607
|
};
|
|
3608
3608
|
const memories = listMemories(filter);
|
|
3609
|
-
|
|
3609
|
+
const fmt = opts.format || (globalOpts.json ? "json" : "compact");
|
|
3610
|
+
if (fmt === "json") {
|
|
3610
3611
|
outputJson(memories);
|
|
3611
3612
|
return;
|
|
3612
3613
|
}
|
|
3614
|
+
if (fmt === "csv") {
|
|
3615
|
+
console.log("key,value,scope,category,importance,id");
|
|
3616
|
+
for (const m of memories) {
|
|
3617
|
+
const v = m.value.replace(/"/g, '""');
|
|
3618
|
+
console.log(`"${m.key}","${v}",${m.scope},${m.category},${m.importance},${m.id.slice(0, 8)}`);
|
|
3619
|
+
}
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3613
3622
|
if (memories.length === 0) {
|
|
3614
3623
|
console.log(chalk.yellow("No memories found."));
|
|
3615
3624
|
return;
|
|
@@ -3701,7 +3710,7 @@ program2.command("forget <keyOrId>").description("Delete a memory by key or ID")
|
|
|
3701
3710
|
handleError(e);
|
|
3702
3711
|
}
|
|
3703
3712
|
});
|
|
3704
|
-
program2.command("search <query>").description("Full-text search across memories").option("-s, --scope <scope>", "Scope filter").option("-c, --category <cat>", "Category filter").option("--tags <tags>", "Comma-separated tags filter").option("--limit <n>", "Max results", parseInt).action((query, opts) => {
|
|
3713
|
+
program2.command("search <query>").description("Full-text search across memories").option("-s, --scope <scope>", "Scope filter").option("-c, --category <cat>", "Category filter").option("--tags <tags>", "Comma-separated tags filter").option("--limit <n>", "Max results", parseInt).option("--format <fmt>", "Output format: compact (default), json, csv").action((query, opts) => {
|
|
3705
3714
|
try {
|
|
3706
3715
|
const globalOpts = program2.opts();
|
|
3707
3716
|
const filter = {
|
|
@@ -3711,10 +3720,19 @@ program2.command("search <query>").description("Full-text search across memories
|
|
|
3711
3720
|
limit: opts.limit || 20
|
|
3712
3721
|
};
|
|
3713
3722
|
const results = searchMemories(query, filter);
|
|
3714
|
-
|
|
3723
|
+
const fmt = opts.format || (globalOpts.json ? "json" : "compact");
|
|
3724
|
+
if (fmt === "json") {
|
|
3715
3725
|
outputJson(results);
|
|
3716
3726
|
return;
|
|
3717
3727
|
}
|
|
3728
|
+
if (fmt === "csv") {
|
|
3729
|
+
console.log("key,value,scope,category,importance,score,id");
|
|
3730
|
+
for (const r of results) {
|
|
3731
|
+
const v = r.memory.value.replace(/"/g, '""');
|
|
3732
|
+
console.log(`"${r.memory.key}","${v}",${r.memory.scope},${r.memory.category},${r.memory.importance},${r.score.toFixed(1)},${r.memory.id.slice(0, 8)}`);
|
|
3733
|
+
}
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3718
3736
|
if (results.length === 0) {
|
|
3719
3737
|
console.log(chalk.yellow(`No memories found matching "${query}".`));
|
|
3720
3738
|
return;
|
package/dist/mcp/index.js
CHANGED
|
@@ -5214,9 +5214,10 @@ server.tool("memory_inject", "Get memory context for system prompt injection. Se
|
|
|
5214
5214
|
agent_id: exports_external.string().optional().describe("Agent ID for scope filtering"),
|
|
5215
5215
|
project_id: exports_external.string().optional().describe("Project ID for scope filtering"),
|
|
5216
5216
|
session_id: exports_external.string().optional().describe("Session ID for scope filtering"),
|
|
5217
|
-
max_tokens: exports_external.coerce.number().optional().describe("
|
|
5217
|
+
max_tokens: exports_external.coerce.number().optional().describe("Token budget (default: 500)"),
|
|
5218
5218
|
categories: exports_external.array(exports_external.enum(["preference", "fact", "knowledge", "history"])).optional(),
|
|
5219
|
-
min_importance: exports_external.coerce.number().optional().describe("
|
|
5219
|
+
min_importance: exports_external.coerce.number().optional().describe("Min importance 1-10 (default: 3)"),
|
|
5220
|
+
raw: exports_external.boolean().optional().describe("Return plain lines only, no headers or tags")
|
|
5220
5221
|
}, async (args) => {
|
|
5221
5222
|
try {
|
|
5222
5223
|
const maxTokens = args.max_tokens || 500;
|
|
@@ -5280,7 +5281,8 @@ server.tool("memory_inject", "Get memory context for system prompt injection. Se
|
|
|
5280
5281
|
if (lines.length === 0) {
|
|
5281
5282
|
return { content: [{ type: "text", text: "No relevant memories found for injection." }] };
|
|
5282
5283
|
}
|
|
5283
|
-
const context =
|
|
5284
|
+
const context = args.raw ? lines.join(`
|
|
5285
|
+
`) : `<agent-memories>
|
|
5284
5286
|
${lines.join(`
|
|
5285
5287
|
`)}
|
|
5286
5288
|
</agent-memories>`;
|