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

Function buildPiPrompt

apps/sim/executor/handlers/pi/context.ts:71–100  ·  view source on GitHub ↗
(input: {
  skills: PiSkill[]
  initialMessages: PiMessage[]
  task: string
  guidance?: string
})

Source from the content-addressed store, hash-verified

69 * then skills, prior memory, and the task.
70 */
71export function buildPiPrompt(input: {
72 skills: PiSkill[]
73 initialMessages: PiMessage[]
74 task: string
75 guidance?: string
76}): string {
77 const parts: string[] = []
78
79 if (input.guidance) {
80 parts.push(`# Operating instructions\n${input.guidance}`)
81 }
82
83 if (input.skills.length > 0) {
84 parts.push('# Available skills')
85 for (const skill of input.skills) {
86 parts.push(`## ${skill.name}\n${skill.content}`)
87 }
88 }
89
90 if (input.initialMessages.length > 0) {
91 parts.push('# Prior conversation')
92 for (const message of input.initialMessages) {
93 parts.push(`${message.role}: ${message.content}`)
94 }
95 }
96
97 parts.push('# Task')
98 parts.push(input.task)
99 return parts.join('\n\n')
100}
101
102/** Persists the user task and the agent's final message to memory. */
103export async function appendPiMemory(

Callers 2

runCloudPiFunction · 0.90
runLocalPiFunction · 0.90

Calls 2

joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected