MCPcopy Create free account
hub / github.com/MemTensor/MemOS / buildMemoryPromptSection

Function buildMemoryPromptSection

apps/memos-local-openclaw/index.ts:64–99  ·  view source on GitHub ↗
({ availableTools, citationsMode }: {
  availableTools: Set<string>;
  citationsMode?: string;
})

Source from the content-addressed store, hash-verified

62const CONTINUE_PROMPT_RE = /^Continue where you left off\.[\s\S]*/i;
63
64const buildMemoryPromptSection = ({ availableTools, citationsMode }: {
65 availableTools: Set<string>;
66 citationsMode?: string;
67}) => {
68 const lines: string[] = [];
69 const hasMemorySearch = availableTools.has("memory_search");
70 const hasMemoryGet = availableTools.has("memory_get");
71
72 if (!hasMemorySearch && !hasMemoryGet) {
73 return lines;
74 }
75
76 lines.push("## Memory Recall");
77 lines.push(
78 "This workspace uses MemOS Local as the active memory slot. Prefer recalled memories and the memory tools before claiming prior context is unavailable.",
79 );
80
81 if (hasMemorySearch && hasMemoryGet) {
82 lines.push(
83 "Use `memory_search` to locate relevant memories, then `memory_get` or `memory_timeline` when you need the full source text or surrounding context.",
84 );
85 } else if (hasMemorySearch) {
86 lines.push("Use `memory_search` before answering questions about prior conversations, preferences, plans, or decisions.");
87 } else {
88 lines.push("Use `memory_get` or `memory_timeline` to inspect the referenced memory before answering.");
89 }
90
91 if (citationsMode === "off") {
92 lines.push("Citations are disabled, so avoid mentioning internal memory ids unless the user asks.");
93 } else {
94 lines.push("When it helps the user verify a memory-backed claim, mention the relevant memory identifier or tool result.");
95 }
96
97 lines.push("");
98 return lines;
99};
100
101const INSTRUCTIONAL_PROMPT_MAX_LEN = 300;
102const SYSTEM_ROLE_PROMPT_RE = /^You are\b/i;

Callers

nothing calls this directly

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected