MCPcopy Index your code
hub / github.com/simstudioai/sim / loadPiMemory

Function loadPiMemory

apps/sim/executor/handlers/pi/context.ts:53–65  ·  view source on GitHub ↗
(
  ctx: ExecutionContext,
  config: PiMemoryConfig
)

Source from the content-addressed store, hash-verified

51
52/** Loads prior conversation messages to seed the Pi run. */
53export async function loadPiMemory(
54 ctx: ExecutionContext,
55 config: PiMemoryConfig
56): Promise<PiMessage[]> {
57 if (!isMemoryEnabled(config)) return []
58 try {
59 const messages = await memoryService.fetchMemoryMessages(ctx, config)
60 return messages.map((message: Message) => ({ role: message.role, content: message.content }))
61 } catch (error) {
62 logger.warn('Failed to load Pi memory', { error: getErrorMessage(error) })
63 return []
64 }
65}
66
67/**
68 * Builds the prompt: optional operating `guidance` (mode-specific constraints),

Callers 1

executeMethod · 0.90

Calls 4

getErrorMessageFunction · 0.90
isMemoryEnabledFunction · 0.85
fetchMemoryMessagesMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected