You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(web-providers): reduce system prompt size for zero-token web providers
Web provider sessions were sending ~55k chars because:
- buildAgentSystemPrompt() included all 30 sections (Tooling, Skills,
Memory, OpenClaw Self-Update, Sandbox, Messaging, etc.) even though
zero-token web providers have no tool exec / sandbox / messaging infra
- Each web stream then appended a second copy of tool instructions with
full JSON Schema serialization via JSON.stringify(tool.parameters)
Changes:
- Add "web" promptMode to buildAgentSystemPrompt: only Safety + Authorized
Senders + Time + Runtime line (~500 chars vs ~20k+ for full mode)
- attempt.ts + compact.ts: detect zero-token providers via
listWebStreamApiIds() and set promptMode="web" automatically
- All 11 web streams: replace verbose tool section with a simple
"- tool_name: description" list; remove duplicate browser tool
instructions and JSON Schema parameter serialization
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/zero-token/streams/claude-web-stream.ts
+2-20Lines changed: 2 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -42,27 +42,9 @@ export function createClaudeWebStreamFn(cookieOrJson: string): StreamFn {
42
42
lettoolPrompt="";
43
43
44
44
if(tools.length>0){
45
-
toolPrompt="\n## Tool Use Instructions\n";
46
-
toolPrompt+=
47
-
"You are equipped with specialized tools to perform actions or retrieve information. "+
48
-
'To use a tool, output a specific XML tag: <tool_call id="unique_id" name="tool_name">{"arg": "value"}</tool_call>. '+
49
-
"Rules for tool use:\n"+
50
-
"1. ALWAYS think before calling a tool. Explain your reasoning inside <think> tags.\n"+
51
-
"2. The 'id' attribute should be a unique 8-character string for each call.\n"+
52
-
"3. Wait for the tool result before proceeding with further analysis.\n\n"+
53
-
"### Special Instructions for Browser Tool\n"+
54
-
"- **Profile 'openclaw' (Independent/Recommended)**: Opens a SEPARATE independent browser window. Use this for consistent, isolated sessions. Highly recommended for complex automation.\n"+
55
-
"- Profile 'chrome' (Shared): Uses your existing Chrome tabs (requires extension). Use this if you need to access personal logins or already open tabs.\n"+
56
-
"- **CONSISTENCY RULE**: Once you have started using a profile (or if you are switched to 'openclaw' due to connection errors), STAY with that profile for the remainder of the session. Do NOT switch back and forth as it will open redundant browser instances.\n\n"+
57
-
"### Automation Policy\n"+
58
-
"- DO NOT use the 'exec' tool to install secondary automation libraries like Playwright, Selenium, or Puppeteer if the 'browser' tool fails.\n"+
59
-
"- Instead, inform the user about the connection issue or try the alternative browser profile ('openclaw').\n"+
60
-
"- Installing automation tools via 'exec' is slow and redundant; the 'browser' tool is the primary way to interact with web content.\n\n"+
Copy file name to clipboardExpand all lines: src/zero-token/streams/deepseek-web-stream.ts
+2-20Lines changed: 2 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -78,27 +78,9 @@ export function createDeepseekWebStreamFn(cookieOrJson: string): StreamFn {
78
78
letsystemPromptContent=systemPrompt;
79
79
80
80
if(tools.length>0){
81
-
lettoolPrompt="\n## Tool Use Instructions\n";
82
-
toolPrompt+=
83
-
"You are equipped with specialized tools to perform actions or retrieve information. "+
84
-
'To use a tool, output a specific XML tag: <tool_call id="unique_id" name="tool_name">{"arg": "value"}</tool_call>. '+
85
-
"Rules for tool use:\n"+
86
-
"1. ALWAYS think before calling a tool. Explain your reasoning inside <think> tags.\n"+
87
-
"2. The 'id' attribute should be a unique 8-character string for each call.\n"+
88
-
"3. Output the tool call tag ONLY inside a <final> section if you are in reasoning mode.\n"+
89
-
"4. Wait for the tool result before proceeding with further analysis.\n\n"+
90
-
"### Special Instructions for Browser Tool\n"+
91
-
"- **Profile 'openclaw' (Independent/Recommended)**: Opens a SEPARATE independent browser window. Use this for consistent, isolated sessions. Highly recommended for complex automation.\n"+
92
-
"- Profile 'chrome' (Shared): Uses your existing Chrome tabs (requires extension). Use this if you need to access personal logins or already open tabs.\n"+
93
-
"- **CONSISTENCY RULE**: Once you have started using a profile (or if you are switched to 'openclaw' due to connection errors), STAY with that profile for the remainder of the session. Do NOT switch back and forth as it will open redundant browser instances.\n\n"+
94
-
"### Automation Policy\n"+
95
-
"- DO NOT use the 'exec' tool to install secondary automation libraries like Playwright, Selenium, or Puppeteer if the 'browser' tool fails.\n"+
96
-
"- Instead, inform the user about the connection issue or try the alternative browser profile ('openclaw').\n"+
97
-
"- Installing automation tools via 'exec' is slow and redundant; the 'browser' tool is the primary way to interact with web content.\n\n"+
Copy file name to clipboardExpand all lines: src/zero-token/streams/doubao-web-stream.ts
+2-20Lines changed: 2 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -41,27 +41,9 @@ export function createDoubaoWebStreamFn(cookieOrJson: string): StreamFn {
41
41
lettoolPrompt="";
42
42
43
43
if(tools.length>0){
44
-
toolPrompt="\n## Tool Use Instructions\n";
45
-
toolPrompt+=
46
-
"You are equipped with specialized tools to perform actions or retrieve information. "+
47
-
'To use a tool, output a specific XML tag: <tool_call id="unique_id" name="tool_name">{"arg": "value"}</tool_call>. '+
48
-
"Rules for tool use:\n"+
49
-
"1. ALWAYS think before calling a tool. Explain your reasoning inside <think> tags.\n"+
50
-
"2. The 'id' attribute should be a unique 8-character string for each call.\n"+
51
-
"3. Wait for the tool result before proceeding with further analysis.\n\n"+
52
-
"### Special Instructions for Browser Tool\n"+
53
-
"- **Profile 'openclaw' (Independent/Recommended)**: Opens a SEPARATE independent browser window. Use this for consistent, isolated sessions. Highly recommended for complex automation.\n"+
54
-
"- Profile 'chrome' (Shared): Uses your existing Chrome tabs (requires extension). Use this if you need to access personal logins or already open tabs.\n"+
55
-
"- **CONSISTENCY RULE**: Once you have started using a profile (or if you are switched to 'openclaw' due to connection errors), STAY with that profile for the remainder of the session. Do NOT switch back and forth as it will open redundant browser instances.\n\n"+
56
-
"### Automation Policy\n"+
57
-
"- DO NOT use the 'exec' tool to install secondary automation libraries like Playwright, Selenium, or Puppeteer if the 'browser' tool fails.\n"+
58
-
"- Instead, inform the user about the connection issue or try the alternative browser profile ('openclaw').\n"+
59
-
"- Installing automation tools via 'exec' is slow and redundant; the 'browser' tool is the primary way to interact with web content.\n\n"+
Copy file name to clipboardExpand all lines: src/zero-token/streams/glm-intl-web-stream.ts
+2-20Lines changed: 2 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -42,27 +42,9 @@ export function createGlmIntlWebStreamFn(cookieOrJson: string): StreamFn {
42
42
lettoolPrompt="";
43
43
44
44
if(tools.length>0){
45
-
toolPrompt="\n## Tool Use Instructions\n";
46
-
toolPrompt+=
47
-
"You are equipped with specialized tools to perform actions or retrieve information. "+
48
-
'To use a tool, output a specific XML tag: <tool_call id="unique_id" name="tool_name">{"arg": "value"}</tool_call>. '+
49
-
"Rules for tool use:\n"+
50
-
"1. ALWAYS think before calling a tool. Explain your reasoning inside <think> tags.\n"+
51
-
"2. The 'id' attribute should be a unique 8-character string for each call.\n"+
52
-
"3. Wait for the tool result before proceeding with further analysis.\n\n"+
53
-
"### Special Instructions for Browser Tool\n"+
54
-
"- **Profile 'openclaw' (Independent/Recommended)**: Opens a SEPARATE independent browser window. Use this for consistent, isolated sessions. Highly recommended for complex automation.\n"+
55
-
"- Profile 'chrome' (Shared): Uses your existing Chrome tabs (requires extension). Use this if you need to access personal logins or already open tabs.\n"+
56
-
"- **CONSISTENCY RULE**: Once you have started using a profile (or if you are switched to 'openclaw' due to connection errors), STAY with that profile for the remainder of the session. Do NOT switch back and forth as it will open redundant browser instances.\n\n"+
57
-
"### Automation Policy\n"+
58
-
"- DO NOT use the 'exec' tool to install secondary automation libraries like Playwright, Selenium, or Puppeteer if the 'browser' tool fails.\n"+
59
-
"- Instead, inform the user about the connection issue or try the alternative browser profile ('openclaw').\n"+
60
-
"- Installing automation tools via 'exec' is slow and redundant; the 'browser' tool is the primary way to interact with web content.\n\n"+
Copy file name to clipboardExpand all lines: src/zero-token/streams/glm-web-stream.ts
+2-20Lines changed: 2 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -44,27 +44,9 @@ export function createZWebStreamFn(cookieOrJson: string): StreamFn {
44
44
lettoolPrompt="";
45
45
46
46
if(tools.length>0){
47
-
toolPrompt="\n## Tool Use Instructions\n";
48
-
toolPrompt+=
49
-
"You are equipped with specialized tools to perform actions or retrieve information. "+
50
-
'To use a tool, output a specific XML tag: <tool_call id="unique_id" name="tool_name">{"arg": "value"}</tool_call>. '+
51
-
"Rules for tool use:\n"+
52
-
"1. ALWAYS think before calling a tool. Explain your reasoning inside <think> tags.\n"+
53
-
"2. The 'id' attribute should be a unique 8-character string for each call.\n"+
54
-
"3. Wait for the tool result before proceeding with further analysis.\n\n"+
55
-
"### Special Instructions for Browser Tool\n"+
56
-
"- **Profile 'openclaw' (Independent/Recommended)**: Opens a SEPARATE independent browser window. Use this for consistent, isolated sessions. Highly recommended for complex automation.\n"+
57
-
"- Profile 'chrome' (Shared): Uses your existing Chrome tabs (requires extension). Use this if you need to access personal logins or already open tabs.\n"+
58
-
"- **CONSISTENCY RULE**: Once you have started using a profile (or if you are switched to 'openclaw' due to connection errors), STAY with that profile for the remainder of the session. Do NOT switch back and forth as it will open redundant browser instances.\n\n"+
59
-
"### Automation Policy\n"+
60
-
"- DO NOT use the 'exec' tool to install secondary automation libraries like Playwright, Selenium, or Puppeteer if the 'browser' tool fails.\n"+
61
-
"- Instead, inform the user about the connection issue or try the alternative browser profile ('openclaw').\n"+
62
-
"- Installing automation tools via 'exec' is slow and redundant; the 'browser' tool is the primary way to interact with web content.\n\n"+
0 commit comments