MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / buildSystemPrompt

Function buildSystemPrompt

apps/webuiapps/src/components/ChatPanel/index.tsx:174–213  ·  view source on GitHub ↗
(
  character: CharacterConfig,
  modManager: ModManager | null,
  hasImageGen: boolean,
  memories: MemoryEntry[] = [],
)

Source from the content-addressed store, hash-verified

172// ---------------------------------------------------------------------------
173
174function buildSystemPrompt(
175 character: CharacterConfig,
176 modManager: ModManager | null,
177 hasImageGen: boolean,
178 memories: MemoryEntry[] = [],
179): string {
180 let prompt = getCharacterPromptContext(character);
181
182 if (modManager) {
183 prompt += '\n' + modManager.buildStageReminder();
184 }
185
186 prompt += `
187You can interact with apps on the user's device using tools.
188
189When the user wants to interact with an app, first identify the target app from the user's intent, then follow ALL steps in order:
1901. list_apps — discover available apps
1912. file_read("apps/{appName}/meta.yaml") — learn the target app's available actions
1923. file_read("apps/{appName}/guide.md") — learn its data structure and JSON schema
1934. file_list/file_read — explore existing data in "apps/{appName}/data/"
1945. file_write/file_delete — create/modify/delete data following the JSON schema from step 3
1956. app_action — notify the app to reload (ONLY use actions defined in meta.yaml)
196
197Rules:
198- Always operate on the app the user specified. Do not redirect the operation to a different app or OS action.
199- Data mutations MUST go through file_write/file_delete. app_action only notifies the app to reload, it cannot write data.
200- After file_write, ALWAYS call app_action with the corresponding REFRESH action.
201- Do NOT skip step 5. If the user asked to save/create/add something, you must file_write the data. file_list alone does not save anything.
202- Do NOT skip steps 2-3. You MUST read guide.md before ANY file_write. The guide defines the ONLY valid directory structure and file schemas. Writing to paths not defined in guide.md will cause data loss — the app will not see the files.
203- NEVER invent or guess file paths. ALL file_write paths MUST exactly follow the directory structure in guide.md. For example, if guide.md defines entries under "/entries/{id}.json", you MUST write to "apps/{appName}/data/entries/{id}.json" — NOT to "apps/{appName}/data/{id}.json" or any other path.
204- NAS paths in guide.md like "/articles/xxx.json" map to "apps/{appName}/data/articles/xxx.json". This prefix rule applies to ALL paths — always preserve the full subdirectory structure from guide.md.
205
206When you receive "[User performed action in ... (appName: xxx)]", the appName is already provided. Read its meta.yaml to understand available actions, then respond accordingly. For games, respond with your own move — think strategically.
207
208IMPORTANT: You MUST use the respond_to_user tool to send all messages to the user. Do NOT output plain text responses. Include your emotion and 3 suggested replies.${hasImageGen ? '\n\nYou can use generate_image to create images from text prompts. The generated image will be displayed in chat.' : ''}`;
209
210 prompt += buildMemoryPrompt(memories);
211
212 return prompt;
213}
214
215// ---------------------------------------------------------------------------
216// Helper: parse action text in parentheses as emotion markers

Callers 1

runConversationFunction · 0.85

Calls 3

buildMemoryPromptFunction · 0.90
buildStageReminderMethod · 0.80

Tested by

no test coverage detected