feat(plugins): share native session handoff and soften memory search

This commit is contained in:
kartik-mem0
2026-09-10 18:20:36 +05:30
parent 02f7a9b2c4
commit 82c32f993e
130 changed files with 16430 additions and 379 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { runNativeSession } from "../../agent-plugin-core/typescript/src/handoff.ts";
/** Native commands receive the trusted active transcript path from OpenClaw. */
export function registerHandoffCommand(api: OpenClawPluginApi): void {
api.registerCommand?.({
name: "mem0-handoff",
description: "Continue this OpenClaw session in a new Codex task",
acceptsArgs: true,
requireAuth: true,
async handler(ctx: { args?: string; sessionFile?: string }) {
if (ctx.args?.trim() !== "codex") return { text: "Usage: /mem0-handoff codex" };
if (!ctx.sessionFile) return { text: "The active OpenClaw transcript is unavailable. Run this command inside a session." };
try {
return { text: await runNativeSession(new URL("./session_handoff.py", import.meta.url), "openclaw", ctx.sessionFile) };
} catch (error) {
return { text: `Session handoff failed: ${error instanceof Error ? error.message : String(error)}` };
}
},
});
}
+2 -1
View File
@@ -1,3 +1,4 @@
import { SEARCH_GUIDANCE } from "../../agent-plugin-core/typescript/src/search_guidance.ts";
import { Type } from "@sinclair/typebox";
import type { MemoryItem, SearchOptions } from "../types.ts";
import type { ToolDeps } from "./index.ts";
@@ -8,7 +9,7 @@ export function createMemorySearchTool(deps: ToolDeps) {
return {
name: "memory_search",
label: "Memory Search",
description: "Search long-term memories stored in Mem0 by semantic meaning. Use this proactively before answering when the request may depend on the user's past work, preferences, or decisions -- relevant memories are not always already in context. For multi-part or comparative questions, run several searches with different phrasings and combine the results rather than stopping after one (multi-hop).",
description: SEARCH_GUIDANCE,
parameters: Type.Object({
query: Type.String({ description: "Search query" }),
limit: Type.Optional(Type.Number({ description: `Max results (default: ${cfg.topK})` })),