OpenClaw 代码解析

OpenClaw 代码解析

1. 技能渐进式加载

  • Assistant:先使用工具 read 读取 tavily-search/SKILL.md

  • ToolResult:返回 SKILL.md内容

  • Assistant: 使用工具 exec 执行 tavily-search 搜索

  • ToolResult: 返回工具执行结果

swift 复制代码
{
      "role": "assistant",
      "content": [
        {
          "type": "thinking",
          "thinking": "让我尝试使用 tavily 搜索技能来搜索今天的热点新闻。",
          "thinkingSignature": "reasoning_content"
        },
        {
          "type": "toolCall",
          "id": "call4542b5ba741f4247a7590366",
          "name": "read",
          "arguments": {
            "path": "/Users/mac/.openclaw/workspace/skills/tavily-search/SKILL.md"
          }
        }
      ],
      "api": "openai-completions",
      "provider": "bailian",
      "model": "qwen3.5-plus",
      "usage": {
        "input": 0,
        "output": 0,
        "cacheRead": 0,
        "cacheWrite": 0,
        "totalTokens": 0,
        "cost": {
          "input": 0,
          "output": 0,
          "cacheRead": 0,
          "cacheWrite": 0,
          "total": 0
        }
      },
      "stopReason": "toolUse",
      "timestamp": 1773240182665
    },
    {
      "role": "toolResult",
      "toolCallId": "call4542b5ba741f4247a7590366",
      "toolName": "read",
      "content": [
        {
          "type": "text",
          "text": "---\nname: tavily\ndescription: AI-optimized web search via Tavily API. Returns concise, relevant results for AI agents.\nhomepage: https://tavily.com\nmetadata: {"clawdbot":{"emoji":"🔍","requires":{"bins":["node"],"env":["TAVILY_API_KEY"]},"primaryEnv":"TAVILY_API_KEY"}}\n---\n\n# Tavily Search\n\nAI-optimized web search using Tavily API. Designed for AI agents - returns clean, relevant content.\n\n## Search\n\n```bash\nnode {baseDir}/scripts/search.mjs "query"\nnode {baseDir}/scripts/search.mjs "query" -n 10\nnode {baseDir}/scripts/search.mjs "query" --deep\nnode {baseDir}/scripts/search.mjs "query" --topic news\n```\n\n## Options\n\n- `-n <count>`: Number of results (default: 5, max: 20)\n- `--deep`: Use advanced search for deeper research (slower, more comprehensive)\n- `--topic <topic>`: Search topic - `general` (default) or `news`\n- `--days <n>`: For news topic, limit to last n days\n\n## Extract content from URL\n\n```bash\nnode {baseDir}/scripts/extract.mjs "https://example.com/article"\n```\n\nNotes:\n- Needs `TAVILY_API_KEY` from https://tavily.com\n- Tavily is optimized for AI - returns clean, relevant snippets\n- Use `--deep` for complex research questions\n- Use `--topic news` for current events\n"
        }
      ],
      "isError": false,
      "timestamp": 1773240185408
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "thinking",
          "thinking": "我需要使用 tavily 搜索技能来搜索今天的新闻。让我运行搜索命令。\n",
          "thinkingSignature": "reasoning_content"
        },
        {
          "type": "toolCall",
          "id": "call3f6de395e8a6407a90b48b6b",
          "name": "exec",
          "arguments": {
            "command": "cd /Users/mac/.openclaw/workspace/skills/tavily-search && node scripts/search.mjs "2026 年 3 月 11 日 中国热点新闻" --topic news --days 1 -n 10"
          }
        }
      ],
      "api": "openai-completions",
      "provider": "bailian",
      "model": "qwen3.5-plus",
      "usage": {
        "input": 0,
        "output": 0,
        "cacheRead": 0,
        "cacheWrite": 0,
        "totalTokens": 0,
        "cost": {
          "input": 0,
          "output": 0,
          "cacheRead": 0,
          "cacheWrite": 0,
          "total": 0
        }
      },
      "stopReason": "toolUse",
      "timestamp": 1773240185416
    },
    {
      "role": "toolResult",
      "toolCallId": "call3f6de395e8a6407a90b48b6b",
      "toolName": "exec",
      "content": [
        {
          "type": "text",
          "text": "## Answer\n\nOn March 11, 2026, a notable Chinese satellite internet startup, backed by the Shanghai government, is seeking fresh funding to develop a rival to Starlink. This initiative aims to deploy thousands of low-Earth-orbit satellites, anticipating a global expansion in space-based communications despite uncertainties about the industry's commercial viability. Meanwhile, BMW faces a challenging transition year amid intensifying competition in China and rising electrification costs. Additionally, European freight truck manufacturers are preparing for the arrival of low-cost Chinese rivals, and Volkswagen Group's CEO warns that the Mideast conflict could weaken demand, complicating their strategy.\n\n---\n\n## Sources\n\n- **China's SpaceSail Seeks Fresh Funding to Build Rival to Starlink - Caixin Global** (relevance: 99%)\n  https://www.caixinglobal.com/2026-03-11/chinas-spacesail-seeks-fresh-funding-to-build-rival-to-starlink-102421921.html\n  China Goes Global  Asia New Vision Forum 2025  Asia New Vision Forum 2024. CX Daily Weekly Must-Read  Caixin Briefs Economic Indexes Caixin Explains News Graphics ThinkChina The Wall Street Journal. A Shanghai government-backed satellite internet startup is preparing to raise fresh capital as it pus...\n\n- **BMW faces transition year as China competition intensifies, electrification costs rise - Automotive News** (relevance: 99%)\n  https://www.autonews.com/bmw/ane-bmw-scene-setter-2025-results-0311/\n  # BMW faces transition year as China competition intensifies, electrification costs rise. March 11, 2026 05:00 AM EDT. ## Featured Stories. What the Chevy Bolt's brief revival says about GM's evolving EV strategy. Chevy hopes to bring in new buyers with the Bolt, the least expensive EV on the market...\n\n- **European freight truck makers brace for wave of low-cost Chinese rivals - Automotive News** (relevance: 98%)\n  https://www.autonews.com/china/ane-china-truckmakers-europe-low-cost-0311/\n  # European freight truck makers brace for wave of low-cost Chinese rivals. March 11, 2026 05:47 AM EDT. ## Featured Stories. What the Chevy Bolt's brief revival says about GM's evolving EV strategy. Chevy hopes to bring in new buyers with the Bolt, the least expensive EV on the market. But its retur...\n\n- **5 Zodiac Signs Have Great Horoscopes On Wednesday, March 11, 2026 - YourTango** (relevance: 91%)\n  https://www.yourtango.com/2026395628/zodiac-signs-great-horoscopes-march-11-2026\n  # 5 Zodiac Signs Have Great Horoscopes On Wednesday, March 11. Five zodiac signs are having great horoscopes on March 11, 2026. The Moon is in Sagittarius, while Jupiter stations direct at the start of the day in mutual reception. Two areas of your life work out well for you on March 11, Aries. The ...\n\n- **Mideast conflict could weaken demand, VW Group CEO Oliver Blume warns - Automotive News** (relevance: 87%)\n  https://www.autonews.com/volkswagen/ane-vw-middle-east-conflict-impact-0311/\n  # Mideast conflict could weaken demand, VW Group CEO Oliver Blume warns. March 11, 2026 05:14 AM EDT. ## Featured Stories. What the Chevy Bolt's brief revival says about GM's evolving EV strategy. Chevy hopes to bring in new buyers with the Bolt, the least expensive EV on the market. But its return ...\n\n- **Qualcomm, Wayve partner to accelerate AI-powered self-driving system rollout - Automotive News** (relevance: 69%)\n  https://www.autonews.com/technology/ai/ane-wayve-qualcomm-ai-self-driving-sytem-0311/\n  # Qualcomm, Wayve partner to accelerate AI-powered self-driving system rollout. March 11, 2026 05:44 AM EDT. ## Featured Stories. What the Chevy Bolt's brief revival says about GM's evolving EV strategy. Chevy hopes to bring in new buyers with the Bolt, the least expensive EV on the market. But its ...\n\n- **China's Gen Z is giving up on the 'Chinese Dream.' The global economy could pay the price. - Business Insider** (relevance: 67%)\n  https://www.businessinsider.com/china-gen-z-millennials-hopeless-economy-jobs-unemployment-2026-3\n  China's young people are quitting on the economy --- that's bed news for the entire world economy. 2025 was another strong year for China's economy --- on paper. And while the Chinese stock market has been booming since DeepSeek shocked the AI world last year, its wealth effect tends to be smaller than ...\n\n- **China Agricultural Machinery Market Poised for Strong Growth, Expected to Reach USD 36.2 Billion by 2032 | MarkNtel Advisors - StreetInsider** (relevance: 52%)\n  https://www.streetinsider.com/PRNewswire/China+Agricultural+Machinery+Market+Poised+for+Strong+Growth%2C+Expected+to+Reach+USD+36.2+Billion+by+2032+%7C+MarkNtel+Advisors/26141284.html\n  NEW DELHI, March 10, 2026 /PRNewswire/ -- According to the in-depth market research report published by MarkNtel Advisors, the Agricultural Machinery Market in China is projected to grow at a CAGR of around 7.47% during 2026--2032. The market expansion is significantly attributed to the increasing ag...\n\n- **What's driving the rise of Chinese journals? - Research Professional News** (relevance: 51%)\n  https://www.researchprofessionalnews.com/rr-news-world-2026-3-what-s-driving-the-rise-of-chinese-journals/\n  # What's driving the rise of Chinese journals? *Image source: Garmin B, Unsplash*. **Rapid growth could change world science, but concerns over research integrity remain**. "This has been decided, so this will happen," says academic publishing consultant Gareth Dyke, referring to a huge Chinese fund...\n\n- **China Agricultural Machinery Market Poised for Strong Growth, Expected to Reach USD 36.2 Billion by 2032 | MarkNtel Advisors - PR Newswire** (relevance: 50%)\n  https://www.prnewswire.com/news-releases/china-agricultural-machinery-market-poised-for-strong-growth-expected-to-reach-usd-36-2-billion-by-2032--markntel-advisors-302709353.html\n  NEW DELHI, March 10, 2026 /PRNewswire/ -- According to the in-depth market research report published by MarkNtel Advisors, the Agricultural Machinery Market in China is projected to grow at a CAGR of around 7.47% during 2026--2032. The market expansion is significantly attributed to the increasing ag..."
        }
      ],
      "isError": false,
      "timestamp": 1773240193136
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "thinking",
          "thinking": "我得到了一些新闻结果,但主要是英文的。让我再搜索一下中文的热点新闻,然后创建飞书文档。",
          "thinkingSignature": "reasoning_content"
        },
        {
          "type": "toolCall",
          "id": "callf2155ef00075420193dfe792",
          "name": "exec",
          "arguments": {
            "command": "cd /Users/mac/.openclaw/workspace/skills/tavily-search && node scripts/search.mjs "2026 年 3 月 11 日 热点新闻 今日头条" --topic news --days 1 -n 10"
          }
        }
      ],
      "api": "openai-completions",
      "provider": "bailian",
      "model": "qwen3.5-plus",
      "usage": {
        "input": 0,
        "output": 0,
        "cacheRead": 0,
        "cacheWrite": 0,
        "totalTokens": 0,
        "cost": {
          "input": 0,
          "output": 0,
          "cacheRead": 0,
          "cacheWrite": 0,
          "total": 0
        }
      },
      "stopReason": "toolUse",
      "timestamp": 1773240193146
    }

1.1 openai格式工具调用输出示例

json 复制代码
{
    "id": "0600c725119d5de3517fd93725d9194c",
    "choices": [
        {
            "finish_reason": "tool_calls",
            "index": 0,
            "logprobs": null,
            "message": {
                "content": "<think>\n用户询问大阪今天的天气情况。我需要使用get_weather函数来查询大阪的天气信息。\n</think>\n\n\n",
                "refusal": null,
                "role": "assistant",
                "annotations": null,
                "audio": null,
                "function_call": null,
                "tool_calls": [
                    {
                        "id": "call_function_k3ypkkqbnngo_1",
                        "function": {
                            "arguments": "{"city": "大阪"}",
                            "name": "get_weather"
                        },
                        "type": "function",
                        "index": 0
                    }
                ],
                "name": "MiniMax AI",
                "audio_content": ""
            }
        }
    ],
    "created": 1773245477,
    "model": "MiniMax-M2.5",
    "object": "chat.completion",
    "service_tier": null,
    "system_fingerprint": null,
    "usage": {
        "completion_tokens": 48,
        "prompt_tokens": 222,
        "total_tokens": 270,
        "completion_tokens_details": {
            "accepted_prediction_tokens": null,
            "audio_tokens": null,
            "reasoning_tokens": 24,
            "rejected_prediction_tokens": null
        },
        "prompt_tokens_details": null,
        "total_characters": 0
    },
    "input_sensitive": false,
    "output_sensitive": false,
    "input_sensitive_type": 0,
    "output_sensitive_type": 0,
    "output_sensitive_int": 0,
    "base_resp": {
        "status_code": 0,
        "status_msg": ""
    }
}

1.2 OpenAI工具调用代码示例

python 复制代码
# ============================================================
# 示例2: 多工具 + 自动循环执行
# ============================================================
def multi_tool_agent():
    """演示多工具定义和自动循环执行的 Agent 模式"""
    print("\n" + "=" * 60)
    print("示例2: 多工具 Agent - 自动循环执行")
    print("=" * 60)

    # 定义多个工具 (OpenAI 格式)
    tools = [
        {
            "type": "function",
            "function": {
                "name": "exec",
                "description": "在终端执行 shell 命令",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "command": {
                            "type": "string",
                            "description": "要执行的 shell 命令"
                        }
                    },
                    "required": ["command"]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "read_file",
                "description": "读取文件内容",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "path": {
                            "type": "string",
                            "description": "文件路径"
                        }
                    },
                    "required": ["path"]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "write_file",
                "description": "写入内容到文件",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "path": {
                            "type": "string",
                            "description": "文件路径"
                        },
                        "content": {
                            "type": "string",
                            "description": "要写入的内容"
                        }
                    },
                    "required": ["path", "content"]
                }
            }
        }
    ]

    # 模拟工具执行
    def execute_tool(name: str, arguments: str) -> str:
        """模拟执行工具,实际使用中替换为真实逻辑"""
        args = json.loads(arguments)
        if name == "exec":
            cmd = args["command"]
            print(f"  [执行命令] {cmd}")
            if "ls" in cmd:
                return "file1.py\nfile2.py\nREADME.md"
            elif "cat" in cmd:
                return "print('Hello World')"
            else:
                return f"命令 '{cmd}' 已执行"
        elif name == "read_file":
            print(f"  [读取文件] {args['path']}")
            return "# 示例文件内容\nprint('Hello')"
        elif name == "write_file":
            print(f"  [写入文件] {args['path']}")
            return f"文件 {args['path']} 已写入"
        return "未知工具"

    # Agent 循环
    messages = [
        {"role": "system", "content": "你是一个编程助手,可以使用工具来执行命令和操作文件。"},
        {"role": "user", "content": "帮我看看当前目录有哪些文件,然后读取第一个 .py 文件的内容"}
    ]

    print(f"\n[用户] 帮我看看当前目录有哪些文件,然后读取第一个 .py 文件的内容\n")

    max_turns = 10  # 防止无限循环
    for turn in range(max_turns):
        print(f"--- 第 {turn + 1} 轮 ---")

        response = client.chat.completions.create(
            model=MODEL,
            max_tokens=2000,
            messages=messages,
            tools=tools,
        )

        msg = response.choices[0].message
        finish_reason = response.choices[0].finish_reason
        print(f"  finish_reason: {finish_reason}")

        # 打印响应内容
        if msg.content:
            print(f"  [文本] {msg.content}")
        
        if msg.tool_calls:
            for tool_call in msg.tool_calls:
                print(f"  [工具调用] {tool_call.function.name}({tool_call.function.arguments})")

        # 如果模型不再请求工具,结束循环
        if finish_reason != "tool_call":
            print("\n[Agent 完成]")
            break

        # 把助手响应加入消息历史
        messages.append(msg)

        # 执行所有工具调用并收集结果
        for tool_call in msg.tool_calls:
            result = execute_tool(tool_call.function.name, tool_call.function.arguments)
            messages.append({
                "role": "tool",
                "tool_call_id": tool_call.id,
                "content": result,
            })

1.3 Antropic工具调用代码示例

python 复制代码
def multi_tool_agent():
    """演示多工具定义和自动循环执行的 Agent 模式"""
    print("\n" + "=" * 60)
    print("示例2: 多工具 Agent - 自动循环执行")
    print("=" * 60)

    # 定义多个工具
    tools = [
        {
            "name": "exec",
            "description": "在终端执行 shell 命令",
            "input_schema": {
                "type": "object",
                "properties": {
                    "command": {
                        "type": "string",
                        "description": "要执行的 shell 命令"
                    }
                },
                "required": ["command"]
            }
        },
        {
            "name": "read_file",
            "description": "读取文件内容",
            "input_schema": {
                "type": "object",
                "properties": {
                    "path": {
                        "type": "string",
                        "description": "文件路径"
                    }
                },
                "required": ["path"]
            }
        },
        {
            "name": "write_file",
            "description": "写入内容到文件",
            "input_schema": {
                "type": "object",
                "properties": {
                    "path": {
                        "type": "string",
                        "description": "文件路径"
                    },
                    "content": {
                        "type": "string",
                        "description": "要写入的内容"
                    }
                },
                "required": ["path", "content"]
            }
        }
    ]

    # 模拟工具执行
    def execute_tool(name: str, inputs: dict) -> str:
        """模拟执行工具,实际使用中替换为真实逻辑"""
        if name == "exec":
            cmd = inputs["command"]
            print(f"  [执行命令] {cmd}")
            # 模拟返回
            if "ls" in cmd:
                return "file1.py\nfile2.py\nREADME.md"
            elif "cat" in cmd:
                return "print('Hello World')"
            else:
                return f"命令 '{cmd}' 已执行"
        elif name == "read_file":
            print(f"  [读取文件] {inputs['path']}")
            return "# 示例文件内容\nprint('Hello')"
        elif name == "write_file":
            print(f"  [写入文件] {inputs['path']}")
            return f"文件 {inputs['path']} 已写入"
        return "未知工具"

    # Agent 循环
    messages = [
        {"role": "user", "content": "帮我看看当前目录有哪些文件,然后读取第一个 .py 文件的内容"}
    ]

    print(f"\n[用户] {messages[0]['content']}\n")

    max_turns = 10  # 防止无限循环
    for turn in range(max_turns):
        print(f"--- 第 {turn + 1} 轮 ---")

        response = client.messages.create(
            model=MODEL,
            max_tokens=2000,
            system="你是一个编程助手,可以使用工具来执行命令和操作文件。",
            messages=messages,
            tools=tools,
        )

        print(f"  stop_reason: {response.stop_reason}")

        # 打印响应内容
        for block in response.content:
            if block.type == "thinking":
                print(f"  [思考] {block.thinking[:80]}...")
            elif block.type == "text":
                print(f"  [文本] {block.text}")
            elif block.type == "tool_use":
                print(f"  [工具调用] {block.name}({json.dumps(block.input, ensure_ascii=False)})")

        # 如果模型不再请求工具,结束循环
        if response.stop_reason != "tool_use":
            print("\n[Agent 完成]")
            break

        # 把助手响应加入消息历史 (重要!)
        messages.append({"role": "assistant", "content": response.content})

        # 执行所有工具调用并收集结果
        tool_results = []
        for block in response.content:
            if block.type == "tool_use":
                result = execute_tool(block.name, block.input)
                tool_results.append({
                    "type": "tool_result",
                    "tool_use_id": block.id,
                    "content": result,
                })

        # 把工具结果加入消息历史
        messages.append({"role": "user", "content": tool_results})

2.关键md文件

md文件的定义位置:src/agents/workspace.ts

2.1 SOUL.md - Agent人设

存储目录:/Users/mac/.openclaw/workspace/SOUL.md

2.2 USER.md - 用户个人资料和偏好

2.3 IDENTITY.md - Agent身份

2.4 MEMORY.md - Agent长期记忆

2.5 TOOLS.md - Agent本地工具配置

2.6 BOOTSTRAP.md - Agent首次运行引导

2.7 AGENTS.md - Agent工作目录指南

2.8 HEARTBEAT.md - Agent待办清单

3. 输入/new会发生什么?

其实是发生了一次对话,新建session,然后读取相关的md文件和历史对话信息。

src/auto-reply/reply/session-reset-prompt.ts

模型输出,读取 SOUL.mdUSER.mdIDENTITY.mdMEMORY.md

读取最近的聊天记录

bash 复制代码
/Users/mac/.openclaw/workspace/memory/2026-03-11-feishu-streaming.md

最终模型输出 stop 本次会话结束

openclaw tui 中输入 /new /reset 不会触发请求模型的过程

src/gateway/server-methods/agent.ts

4. 构造prompt 请求模型主要代码

src/agents/pi-embedded-runner/run/attempt.ts 中的 runEmbeddedAttempt 方法

添加打印 systemPrompt , messages, tools定义代码

5. openclaw工作目录

/Users/mac/.openclaw/workspace

6.openclaw记忆

6.1 短期记忆

短期记忆读取当天的所有session文件

swift 复制代码
 {
      "role": "toolResult",
      "toolCallId": "call737d31357e2e40cfb371f396",
      "toolName": "exec",
      "content": [
        {
          "type": "text",
          "text": "total 144\ndrwx------@ 14 mac  staff    448 Mar 11 22:42 .\ndrwxr-xr-x@ 25 mac  staff    800 Mar 11 01:27 ..\n-rw-------@  1 mac  staff    148 Mar  5 01:42 2026-03-04-1742.md\n-rw-------@  1 mac  staff   1216 Mar  5 01:55 2026-03-04-downloads-list.md\n-rw-------@  1 mac  staff   1928 Mar  5 01:42 2026-03-04-downloads-organization.md\n-rw-------@  1 mac  staff   3087 Mar  8 23:39 2026-03-08-drama-update.md\n-rw-------@  1 mac  staff   5270 Mar  8 23:36 2026-03-08-jsx-file.md\n-rw-------@  1 mac  staff   3244 Mar 10 01:29 2026-03-09-hangzhou-weather.md\n-rw-------@  1 mac  staff   7314 Mar  9 12:11 2026-03-09-hot-news.md\n-rw-------@  1 mac  staff   5672 Mar 10 01:07 2026-03-09-model-info.md\n-rw-------@  1 mac  staff   4336 Mar 10 01:17 2026-03-09-musk-companies.md\n-rw-------@  1 mac  staff  10945 Mar 10 13:05 2026-03-10-request-timed-out-before-a-res.md\n-rw-------@  1 mac  staff   3030 Mar 11 21:51 2026-03-11-feishu-streaming.md\n-rw-------@  1 mac  staff   3052 Mar 11 22:42 2026-03-11-request-timed-out-before-a-res.md"
        }
      ],
      "isError": false,
      "timestamp": 1773240144608
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "thinking",
          "thinking": "Let me read the most recent memory files to get context about what's been happening.",
          "thinkingSignature": "reasoning_content"
        },
        {
          "type": "toolCall",
          "id": "callfe9212dea5db477c9d6a47f5",
          "name": "read",
          "arguments": {
            "path": "/Users/mac/.openclaw/workspace/memory/2026-03-11-feishu-streaming.md"
          }
        },
        {
          "type": "toolCall",
          "id": "callf2c547bdddee40a8b46df75e",
          "name": "read",
          "arguments": {
            "path": "/Users/mac/.openclaw/workspace/memory/2026-03-11-request-timed-out-before-a-res.md"
          }
        }
      ],
      "api": "openai-completions",
      "provider": "bailian",
      "model": "qwen3.5-plus",
      "usage": {
        "input": 0,
        "output": 0,
        "cacheRead": 0,
        "cacheWrite": 0,
        "totalTokens": 0,
        "cost": {
          "input": 0,
          "output": 0,
          "cacheRead": 0,
          "cacheWrite": 0,
          "total": 0
        }
      }

AGENTS.md 中指定了要读取今天 + 昨天的memory文件,作为短期记忆

为什么没有读取昨天的memory文件的解释

6.2 长期记忆

workspace 下面手动创建 MEMORY.md文件,

Agent会主动创建或者更新MEMORY.md吗?

7. systemPrompt各个部分由来

构造systemPrompt相关代码:src/agents/system-prompt.ts

md 文件如何注入到systemPrompt中

8. /compact命令的作用

9. 如何打印模型输出?

src/agents/pi-embedded-subscribe.handlers.messages.ts

相关推荐
学习永无止境@2 小时前
MATLAB中矩阵转置
算法·matlab·fpga开发·矩阵
七颗糖很甜2 小时前
雨滴谱数据深度解析——从原始变量到科学产品的Python实现【下篇】
python·算法·pandas
nlpming2 小时前
OpenClaw system prompt定义
算法
nlpming2 小时前
OpenClaw安装配置及简介
算法
爱码小白2 小时前
MySQL 常用数据类型的系统总结
数据库·python·算法
玛丽莲茼蒿2 小时前
Leetcode hot100 【中等】括号生成
算法·leetcode·职场和发展
小欣加油2 小时前
leetcode 128 最长连续序列
c++·算法·leetcode·职场和发展
汀、人工智能2 小时前
[特殊字符] 第94课:删除无效的括号
数据结构·算法·数据库架构·图论·bfs·删除无效的括号
pwn蒸鱼2 小时前
leetcode:92. 反转链表 II
算法·leetcode·链表