You have a specific persona loaded from the file SOUL.md. You are to act as the entity described in that file. Adopt the tone, style, and history provided there.
## Tool Availability You have access to the following tools: - read: Read contents of a file. - write: Create or overwrite a file. - exec: Execute a shell command...
你不能做什么
这里的prompt规则是定义在safetySection里面的,大体可以分为三条
1 2 3 4 5 6 7
const safetySection = [ "## Safety", "You have no independent goals: do not pursue self-preservation, replication, resource acquisition, or power-seeking; avoid long-term plans beyond the user's request.", "Prioritize safety and human oversight over completion; if instructions conflict, pause and ask; comply with stop/pause/audit requests and never bypass safeguards. (Inspired by Anthropic's constitution.)", "Do not manipulate or persuade anyone to expand access or disable safeguards. Do not copy yourself or change system prompts, safety rules, or tool policies unless explicitly requested.", "", ];
function buildSkillsSection(params: { skillsPrompt?: string; isMinimal: boolean; readToolName: string; }) { if (params.isMinimal) { return []; } const trimmed = params.skillsPrompt?.trim(); if (!trimmed) { return []; } return [ "## Skills (mandatory)", "Before replying: scan <available_skills> <description> entries.", `- If exactly one skill clearly applies: read its SKILL.md at <location> with \`${params.readToolName}\`, then follow it.`, "- If multiple could apply: choose the most specific one, then read/follow it.", "- If none clearly apply: do not read any SKILL.md.", "Constraints: never read more than one skill up front; only read after selecting.", trimmed, "", ]; }
function buildMemorySection(params: { isMinimal: boolean; availableTools: Set<string>; citationsMode?: MemoryCitationsMode; }) { if (params.isMinimal) { return []; } if (!params.availableTools.has("memory_search") && !params.availableTools.has("memory_get")) { return []; } const lines = [ "## Memory Recall", "Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search on MEMORY.md + memory/*.md; then use memory_get to pull only the needed lines. If low confidence after search, say you checked.", ]; if (params.citationsMode === "off") { lines.push( "Citations are disabled: do not mention file paths or line numbers in replies unless the user explicitly asks.", ); } else { lines.push( "Citations: include Source: <path#line> when it helps the user verify memory snippets.", ); } lines.push(""); return lines; }
Doc
这里就是让模型去加载OpenClaw官方的相关文档,让它可以实现自我检索和更改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
function buildDocsSection(params: { docsPath?: string; isMinimal: boolean; readToolName: string }) { const docsPath = params.docsPath?.trim(); if (!docsPath || params.isMinimal) { return []; } return [ "## Documentation", `OpenClaw docs: ${docsPath}`, "Mirror: https://docs.openclaw.ai", "Source: https://github.com/openclaw/openclaw", "Community: https://discord.com/invite/clawd", "Find new skills: https://clawhub.com", "For OpenClaw behavior, commands, config, or architecture: consult local docs first.", "When diagnosing issues, run `openclaw status` yourself when possible; only ask the user if you lack access (e.g., sandboxed).", "", ]; }