ocsmarttools 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to `ocsmarttools` are documented here.
4
4
 
5
+ ## [0.1.9] - 2026-02-22
6
+
7
+ ### Changed
8
+ - Strengthened auto-managed routing policy so research/report prompts with sources/benchmarks must run retrieval tools before final output.
9
+ - Added explicit anti-fabrication guidance in routing policy: do not output citations that were not retrieved in the current run.
10
+ - Added failure behavior guidance: return clear retrieval gaps/partial result instead of fabricated evidence.
11
+
12
+ ## [0.1.8] - 2026-02-22
13
+
14
+ ### Changed
15
+ - Improved `tool_search` fallback discovery for skill-driven workflows by adding relevance keywords for browser/playwright/stealth-style usage.
16
+ - Added explicit skill-compatibility note in search results and README.
17
+
5
18
  ## [0.1.7] - 2026-02-22
6
19
 
7
20
  ### Fixed
package/README.md CHANGED
@@ -1,190 +1,130 @@
1
- # OCSmartTools for OpenClaw
1
+ # OCSmartTools
2
2
 
3
- Provider-agnostic tool orchestration for lower latency and lower token cost.
3
+ Provider-agnostic tool orchestration plugin for OpenClaw.
4
4
 
5
- `ocsmarttools` is designed to work immediately after install, with safe defaults and minimal setup.
5
+ OCSmartTools helps reduce latency and token cost by routing multi-step work through deterministic tool flows (`tool_dispatch` / `tool_batch`) and shaping large outputs.
6
6
 
7
- ## What It Adds
7
+ ## Highlights
8
8
 
9
- - `tool_search`: finds relevant tools quickly
10
- - `tool_dispatch`: runs one tool call through normal OpenClaw policy checks
11
- - `tool_batch`: runs bounded multi-step workflows (`call` + `foreach`)
12
- - `tool_result_get`: retrieves large stored outputs by handle
13
-
14
- ## Why It Helps
15
-
16
- ```mermaid
17
- flowchart LR
18
- A["Traditional"] --> B["Model -> tool -> model -> tool"] --> C["More turns + repeated context"]
19
- D["ocsmarttools"] --> E["Batch + shaped results"] --> F["Fewer turns + smaller context"]
20
- C --> G["Higher cost/latency"]
21
- F --> H["Lower cost/latency"]
22
- ```
9
+ - Works with existing OpenClaw installs (`openclaw >= 2026.2.19`)
10
+ - Zero-touch startup (auto-bootstrap on install)
11
+ - Tools added:
12
+ - `tool_search`
13
+ - `tool_dispatch`
14
+ - `tool_batch`
15
+ - `tool_result_get`
16
+ - Built-in metrics for success/failure/timeout, latency, and estimated savings
17
+ - Skill-compatible (including browser/Playwright-style workflows)
18
+ - Auto-managed routing guidance for research/report tasks (no per-prompt guardrails needed)
23
19
 
24
20
  ## Install
25
21
 
26
- Compatibility:
27
- - OpenClaw: `>=2026.2.19`
28
- - Works with existing installed instances (no core patch required)
29
-
30
- ### npm
31
-
32
22
  ```bash
33
23
  openclaw plugins install ocsmarttools --pin
34
24
  openclaw plugins enable ocsmarttools
35
25
  openclaw gateway restart
36
26
  ```
37
27
 
38
- ### Local folder
39
-
40
- ```bash
41
- openclaw plugins install /absolute/path/to/OpenClaw-SmartToolCalls
42
- openclaw plugins enable ocsmarttools
43
- openclaw gateway restart
44
- ```
45
-
46
28
  ## Quick Start
47
29
 
48
- 1. Install + enable + restart.
49
- 2. Done. The plugin auto-bootstraps and starts working in background.
50
- 3. It also auto-manages an OCSmartTools routing block in `AGENTS.md` (unless disabled).
51
- 4. Enable strict plugin-managed routing (optional):
52
-
53
30
  ```text
31
+ /ocsmarttools status
54
32
  /ocsmarttools strict on
33
+ /ocsmarttools stats
55
34
  ```
56
35
 
57
- 5. Optional check:
36
+ What these do:
37
+ - `status`: shows current mode, strict-routing state, and key limits
38
+ - `strict on`: enables strict plugin-managed routing guidance
39
+ - `stats`: shows usage, failures, latency, and savings
40
+
41
+ ## Core Commands (Chat)
42
+
43
+ - `/ocsmarttools help` -> simple command guide
44
+ - `/ocsmarttools status` -> current state and limits
45
+ - `/ocsmarttools strict <on|off|status>` -> strict routing control
46
+ - `/ocsmarttools sync` -> re-apply managed routing block in `AGENTS.md`
47
+ - `/ocsmarttools stats` -> metrics summary
48
+ - `/ocsmarttools stats reset` -> reset metrics window
49
+ - `/ocsmarttools setup [safe|standard]` -> apply recommended defaults
50
+ - `/ocsmarttools mode <safe|standard>` -> change mode only
51
+ - `/ocsmarttools config` -> show effective config
52
+ - `/ocsmarttools config keys` -> list editable keys
53
+ - `/ocsmarttools config set <key> <value>` -> update one key
54
+ - `/ocsmarttools config reset [key]` -> reset one key or all
55
+ - `/ocsmarttools version` -> installed plugin version
56
+
57
+ ## Core Commands (CLI)
58
+
59
+ - `openclaw ocsmarttools help`
60
+ - `openclaw ocsmarttools status`
61
+ - `openclaw ocsmarttools strict <on|off>`
62
+ - `openclaw ocsmarttools sync`
63
+ - `openclaw ocsmarttools stats`
64
+ - `openclaw ocsmarttools stats-reset`
65
+ - `openclaw ocsmarttools setup [safe|standard]`
66
+ - `openclaw ocsmarttools mode <safe|standard>`
67
+ - `openclaw ocsmarttools config`
68
+ - `openclaw ocsmarttools config-keys`
69
+ - `openclaw ocsmarttools config-set <key> <value>`
70
+ - `openclaw ocsmarttools config-reset [key]`
71
+ - `openclaw ocsmarttools version`
72
+
73
+ ## Config
58
74
 
59
- ```text
60
- /ocsmarttools status
61
- ```
75
+ Config path:
76
+ - `plugins.entries.ocsmarttools.config`
77
+
78
+ High-impact keys:
79
+ - `strictRouting` (`true|false`)
80
+ - `maxResultChars` (result shaping threshold)
81
+ - `maxSteps`, `maxForEach` (batch limits)
82
+ - `invokeTimeoutMs` (per-dispatch timeout)
83
+ - `toolSearch.useLiveRegistry` (`true|false`)
62
84
 
63
- Model note:
64
- - No model setup is required in this plugin.
65
- - It automatically uses the model OpenClaw is already using.
66
-
67
- ## Commands
68
-
69
- ### Chat Commands
70
-
71
- | Command | What it does |
72
- |---|---|
73
- | `/ocsmarttools help` | Shows all commands in plain language |
74
- | `/ocsmarttools status` | Shows mode and safety settings |
75
- | `/ocsmarttools strict <on\|off\|status>` | Turns strict routing on/off or checks status |
76
- | `/ocsmarttools sync` | Rewrites the managed routing block in `AGENTS.md` |
77
- | `/ocsmarttools stats` | Shows calls, errors, timeouts, latency, and estimated savings |
78
- | `/ocsmarttools stats reset` | Resets plugin stats |
79
- | `/ocsmarttools setup [safe\|standard]` | Applies recommended defaults |
80
- | `/ocsmarttools mode <safe\|standard>` | Changes mode only |
81
- | `/ocsmarttools config` | Shows plugin config |
82
- | `/ocsmarttools config keys` | Lists editable config keys |
83
- | `/ocsmarttools config set <key> <value>` | Changes one config value |
84
- | `/ocsmarttools config reset [key]` | Resets one key or all keys |
85
- | `/ocsmarttools version` | Shows installed plugin version |
86
-
87
- ### CLI Commands
88
-
89
- | Command | What it does |
90
- |---|---|
91
- | `openclaw ocsmarttools help` | Shows all commands in plain language |
92
- | `openclaw ocsmarttools status` | Shows mode and safety settings |
93
- | `openclaw ocsmarttools strict <on\|off>` | Turns strict routing on/off |
94
- | `openclaw ocsmarttools sync` | Rewrites the managed routing block in `AGENTS.md` |
95
- | `openclaw ocsmarttools stats` | Shows calls, errors, timeouts, latency, and estimated savings |
96
- | `openclaw ocsmarttools stats-reset` | Resets plugin stats |
97
- | `openclaw ocsmarttools setup [safe\|standard]` | Applies recommended defaults |
98
- | `openclaw ocsmarttools mode <safe\|standard>` | Changes mode only |
99
- | `openclaw ocsmarttools config` | Shows plugin config |
100
- | `openclaw ocsmarttools config-keys` | Lists editable config keys |
101
- | `openclaw ocsmarttools config-set <key> <value>` | Changes one config value |
102
- | `openclaw ocsmarttools config-reset [key]` | Resets one key or all keys |
103
- | `openclaw ocsmarttools version` | Shows installed plugin version |
104
-
105
- ## Common Config Actions
85
+ Example:
106
86
 
107
87
  ```text
108
- /ocsmarttools config
109
- /ocsmarttools config keys
110
- /ocsmarttools config set maxResultChars 120000
111
- /ocsmarttools config set storeLargeResults true
112
- /ocsmarttools config set toolSearch.useLiveRegistry true
113
- /ocsmarttools config set toolSearch.liveTimeoutMs 1500
114
88
  /ocsmarttools config set strictRouting true
115
- /ocsmarttools config set autoInjectRoutingGuide true
116
- /ocsmarttools config set autoInjectRoutingGuide false
117
- /ocsmarttools config reset maxResultChars
118
- /ocsmarttools stats
89
+ /ocsmarttools config set maxResultChars 120000
90
+ /ocsmarttools config set invokeTimeoutMs 30000
119
91
  ```
120
92
 
121
- Config path:
122
- - `plugins.entries.ocsmarttools.config`
123
-
124
93
  ## Modes
125
94
 
126
- - `standard` (default): zero-touch mode, no sandbox requirement, control-plane dispatch still blocked
127
- - `safe`: requires sandboxed execution and blocks control-plane dispatch (`gateway`, `cron`)
128
- - `strictRouting=true`: strict plugin-managed routing policy is auto-synced with no manual workspace edits.
129
-
130
- Setup default:
131
- - `/ocsmarttools setup` and `openclaw ocsmarttools setup` default to `standard`.
132
-
133
- ## Recommended Defaults
134
-
135
- For mixed daily usage (research + writing + coding):
95
+ - `standard` (default): balanced, zero-touch
96
+ - `safe`: requires sandbox and blocks control-plane dispatch
97
+ - `strictRouting=true`: enforces plugin-managed routing guidance and keeps routing block synced
136
98
 
137
- - `maxResultChars`: `120000`
138
- - `storeLargeResults`: `true`
139
- - `resultStoreTtlSec`: `3600`
140
- - `resultSampleItems`: `10`
99
+ ## Skills and Blocked Sites
141
100
 
142
- Example:
143
-
144
- ```text
145
- /ocsmarttools config set maxResultChars 120000
146
- /ocsmarttools config set resultStoreTtlSec 3600
147
- /ocsmarttools config set resultSampleItems 10
148
- ```
101
+ Skills in OpenClaw are instruction layers, not separate execution engines. OCSmartTools can still dispatch/batch the underlying tools used by skills.
149
102
 
150
- ## Strict Policy Note
103
+ For websites that block plain fetch, use browser-based flows via installed skills/plugins; OCSmartTools can orchestrate those tool calls with the same metrics and shaping behavior.
151
104
 
152
- If your instance uses strict `tools.allow`, include:
105
+ ## Safety Notes
153
106
 
154
- ```json5
155
- {
156
- tools: {
157
- allow: ["tool_search", "tool_dispatch", "tool_batch", "tool_result_get"]
158
- }
159
- }
160
- ```
107
+ - OCSmartTools does not bypass OpenClaw policy.
108
+ - Control-plane tools (`gateway`, `cron`) are blocked by default in dispatch/batch.
109
+ - Large result handles are in-memory and expire by TTL.
161
110
 
162
- ## Safety and Limits
111
+ ## Troubleshooting
163
112
 
164
- - `ocsmarttools` does not bypass OpenClaw tool policy.
165
- - Routing policy is auto-injected into `AGENTS.md` with managed markers; it can be re-synced via `/ocsmarttools sync`.
166
- - `strictRouting=true` forces `autoInjectRoutingGuide=true`.
167
- - `tool_batch` is intentionally bounded (`maxSteps`, `maxForEach`).
168
- - Large-result handles are in-memory and expire by TTL.
169
- - `tool_result_get` works only while handle is still valid.
170
- - `tool_search` tries live registry endpoints first, then automatically falls back to policy/static catalog.
113
+ - If plugin commands do not appear, restart gateway:
114
+ - `openclaw gateway restart`
115
+ - If strict policy blocks tools, verify `tools.allow`/`tools.deny` in OpenClaw config.
116
+ - If discovery seems stale, run:
117
+ - `/ocsmarttools sync`
118
+ - `/ocsmarttools stats`
171
119
 
172
120
  ## Development
173
121
 
174
122
  ```bash
175
123
  npm install
176
124
  npm run typecheck
177
- ```
178
-
179
- ## Versioning
180
-
181
- ```bash
182
- npm run version:show
183
- npm run version:bump:patch
184
- npm run version:bump:minor
185
- npm run version:bump:major
186
125
  npm run release:check
187
126
  ```
188
127
 
189
- - Version source of truth: `package.json`.
190
- - Release notes: `CHANGELOG.md`.
128
+ Version and release notes:
129
+ - Version source of truth: `package.json`
130
+ - Release notes: `CHANGELOG.md`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocsmarttools",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Provider-agnostic advanced tool orchestration plugin for OpenClaw with search, dispatch, and batching",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -16,9 +16,12 @@ function buildRoutingBlock(strictRouting: boolean): string {
16
16
  "Mandatory rules in strict mode:",
17
17
  "1. Route tool usage through `tool_dispatch` or `tool_batch`.",
18
18
  "2. Use `tool_batch` for 2+ related calls, iterative steps, or map-style tasks.",
19
- "3. Use `tool_search` only when tool choice is unclear.",
20
- "4. Use `tool_result_get` only when a stored handle needs more detail.",
21
- "5. Avoid direct native tool calls unless routing tools are unavailable due to runtime/tool-policy constraints.",
19
+ "3. For research/report/benchmark/source requests, always run live tool retrieval before final output (typically `web_search` + `web_fetch`).",
20
+ "4. Use `tool_search` only when tool choice is unclear.",
21
+ "5. Use `tool_result_get` only when a stored handle needs more detail.",
22
+ "6. Avoid direct native tool calls unless routing tools are unavailable due to runtime/tool-policy constraints.",
23
+ "7. Do not present citations/sources unless they came from successful tool calls in the current run.",
24
+ "8. If required retrieval fails, return a clear partial/failure report instead of fabricated evidence.",
22
25
  "",
23
26
  "Common large/noisy tools: `web_fetch`, `read` (large files), `exec`, `process`, `browser`, `nodes`.",
24
27
  ].join("\n")
@@ -29,9 +32,12 @@ function buildRoutingBlock(strictRouting: boolean): string {
29
32
  "",
30
33
  "1. If tool usage is needed and result size is uncertain, use `tool_dispatch`.",
31
34
  "2. If the task needs 2+ related tool calls, use `tool_batch`.",
32
- "3. Use `tool_search` only when tool choice is unclear.",
33
- "4. Prefer compact/tool-shaped outputs; use `tool_result_get` only when more detail is required.",
34
- "5. Use direct native tool calls only for simple one-shot small-output actions.",
35
+ "3. For research/report requests with sources or benchmarks, run retrieval tools first before final output.",
36
+ "4. Use `tool_search` only when tool choice is unclear.",
37
+ "5. Prefer compact/tool-shaped outputs; use `tool_result_get` only when more detail is required.",
38
+ "6. Use direct native tool calls only for simple one-shot small-output actions.",
39
+ "7. Do not include citations/sources that were not retrieved by tools in the current run.",
40
+ "8. If retrieval fails, explicitly report the gap.",
35
41
  "",
36
42
  "Common large/noisy tools: `web_fetch`, `read` (large files), `exec`, `process`, `browser`, `nodes`.",
37
43
  ].join("\n");
@@ -5,11 +5,19 @@ export type ToolEntry = {
5
5
  group: string;
6
6
  description: string;
7
7
  paramsHint?: string;
8
+ keywords?: string[];
8
9
  source: "builtin" | "policy" | "live";
9
10
  };
10
11
 
11
12
  const BUILTIN: ToolEntry[] = [
12
- { name: "exec", group: "runtime", description: "Run shell commands.", paramsHint: "{ command }", source: "builtin" },
13
+ {
14
+ name: "exec",
15
+ group: "runtime",
16
+ description: "Run shell commands.",
17
+ paramsHint: "{ command }",
18
+ keywords: ["script", "python", "node", "playwright", "stealth", "scrape"],
19
+ source: "builtin",
20
+ },
13
21
  { name: "bash", group: "runtime", description: "Alias for exec in many contexts.", paramsHint: "{ command }", source: "builtin" },
14
22
  { name: "process", group: "runtime", description: "Manage background command sessions.", paramsHint: "{ action, sessionId? }", source: "builtin" },
15
23
  { name: "read", group: "fs", description: "Read files.", paramsHint: "{ path }", source: "builtin" },
@@ -23,9 +31,30 @@ const BUILTIN: ToolEntry[] = [
23
31
  { name: "session_status", group: "sessions", description: "Show current session status.", paramsHint: "{}", source: "builtin" },
24
32
  { name: "memory_search", group: "memory", description: "Search memory snippets.", paramsHint: "{ query }", source: "builtin" },
25
33
  { name: "memory_get", group: "memory", description: "Read memory entries.", paramsHint: "{ key }", source: "builtin" },
26
- { name: "web_search", group: "web", description: "Search the web.", paramsHint: "{ query }", source: "builtin" },
27
- { name: "web_fetch", group: "web", description: "Fetch and extract web page content.", paramsHint: "{ url }", source: "builtin" },
28
- { name: "browser", group: "ui", description: "Browser automation.", paramsHint: "{ action, ... }", source: "builtin" },
34
+ {
35
+ name: "web_search",
36
+ group: "web",
37
+ description: "Search the web.",
38
+ paramsHint: "{ query }",
39
+ keywords: ["research", "discover", "find"],
40
+ source: "builtin",
41
+ },
42
+ {
43
+ name: "web_fetch",
44
+ group: "web",
45
+ description: "Fetch and extract web page content.",
46
+ paramsHint: "{ url }",
47
+ keywords: ["read page", "extract", "html"],
48
+ source: "builtin",
49
+ },
50
+ {
51
+ name: "browser",
52
+ group: "ui",
53
+ description: "Browser automation.",
54
+ paramsHint: "{ action, ... }",
55
+ keywords: ["playwright", "stealth", "anti-bot", "captcha", "dynamic site", "javascript page"],
56
+ source: "builtin",
57
+ },
29
58
  { name: "canvas", group: "ui", description: "Canvas/artifact rendering actions.", paramsHint: "{ action, ... }", source: "builtin" },
30
59
  { name: "cron", group: "automation", description: "Manage scheduled jobs.", paramsHint: "{ action, ... }", source: "builtin" },
31
60
  { name: "gateway", group: "automation", description: "Gateway control-plane actions.", paramsHint: "{ action, ... }", source: "builtin" },
@@ -298,6 +327,7 @@ function score(query: string, entry: ToolEntry): number {
298
327
  const n = entry.name.toLowerCase();
299
328
  const d = entry.description.toLowerCase();
300
329
  const g = entry.group.toLowerCase();
330
+ const keywords = (entry.keywords ?? []).map((v) => v.toLowerCase());
301
331
 
302
332
  let s = 0;
303
333
  if (n === q) s += 100;
@@ -305,10 +335,13 @@ function score(query: string, entry: ToolEntry): number {
305
335
  if (n.includes(q)) s += 30;
306
336
  if (g.includes(q)) s += 15;
307
337
  if (d.includes(q)) s += 10;
338
+ if (keywords.includes(q)) s += 25;
308
339
 
309
340
  for (const token of q.split(/\s+/).filter(Boolean)) {
310
341
  if (n.includes(token)) s += 12;
311
342
  if (d.includes(token)) s += 4;
343
+ if (g.includes(token)) s += 4;
344
+ if (keywords.some((k) => k.includes(token))) s += 8;
312
345
  }
313
346
  return s;
314
347
  }
@@ -65,6 +65,8 @@ export function createToolSearchTool(api: OpenClawPluginApi): AnyAgentTool {
65
65
  liveCount: built.liveCount,
66
66
  totalCatalogSize: catalog.length,
67
67
  count: matches.length,
68
+ note:
69
+ "Skills are instruction layers. OCSmartTools can still dispatch/batch-call runtime and browser tools used by those skills.",
68
70
  tools: matches,
69
71
  });
70
72
  },