ocsmarttools 0.1.8 → 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,13 @@
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
+
5
12
  ## [0.1.8] - 2026-02-22
6
13
 
7
14
  ### Changed
package/README.md CHANGED
@@ -1,194 +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
- Skills compatibility:
15
- - Works with OpenClaw skills because skills are instructions layered on top of tools.
16
- - For blocked websites, skill workflows that use `browser`/Playwright-style flows are compatible with `tool_dispatch` and `tool_batch`.
17
-
18
- ## Why It Helps
19
-
20
- ```mermaid
21
- flowchart LR
22
- A["Traditional"] --> B["Model -> tool -> model -> tool"] --> C["More turns + repeated context"]
23
- D["ocsmarttools"] --> E["Batch + shaped results"] --> F["Fewer turns + smaller context"]
24
- C --> G["Higher cost/latency"]
25
- F --> H["Lower cost/latency"]
26
- ```
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)
27
19
 
28
20
  ## Install
29
21
 
30
- Compatibility:
31
- - OpenClaw: `>=2026.2.19`
32
- - Works with existing installed instances (no core patch required)
33
-
34
- ### npm
35
-
36
22
  ```bash
37
23
  openclaw plugins install ocsmarttools --pin
38
24
  openclaw plugins enable ocsmarttools
39
25
  openclaw gateway restart
40
26
  ```
41
27
 
42
- ### Local folder
43
-
44
- ```bash
45
- openclaw plugins install /absolute/path/to/OpenClaw-SmartToolCalls
46
- openclaw plugins enable ocsmarttools
47
- openclaw gateway restart
48
- ```
49
-
50
28
  ## Quick Start
51
29
 
52
- 1. Install + enable + restart.
53
- 2. Done. The plugin auto-bootstraps and starts working in background.
54
- 3. It also auto-manages an OCSmartTools routing block in `AGENTS.md` (unless disabled).
55
- 4. Enable strict plugin-managed routing (optional):
56
-
57
30
  ```text
31
+ /ocsmarttools status
58
32
  /ocsmarttools strict on
33
+ /ocsmarttools stats
59
34
  ```
60
35
 
61
- 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
62
74
 
63
- ```text
64
- /ocsmarttools status
65
- ```
75
+ Config path:
76
+ - `plugins.entries.ocsmarttools.config`
66
77
 
67
- Model note:
68
- - No model setup is required in this plugin.
69
- - It automatically uses the model OpenClaw is already using.
70
-
71
- ## Commands
72
-
73
- ### Chat Commands
74
-
75
- | Command | What it does |
76
- |---|---|
77
- | `/ocsmarttools help` | Shows all commands in plain language |
78
- | `/ocsmarttools status` | Shows mode and safety settings |
79
- | `/ocsmarttools strict <on\|off\|status>` | Turns strict routing on/off or checks status |
80
- | `/ocsmarttools sync` | Rewrites the managed routing block in `AGENTS.md` |
81
- | `/ocsmarttools stats` | Shows calls, errors, timeouts, latency, and estimated savings |
82
- | `/ocsmarttools stats reset` | Resets plugin stats |
83
- | `/ocsmarttools setup [safe\|standard]` | Applies recommended defaults |
84
- | `/ocsmarttools mode <safe\|standard>` | Changes mode only |
85
- | `/ocsmarttools config` | Shows plugin config |
86
- | `/ocsmarttools config keys` | Lists editable config keys |
87
- | `/ocsmarttools config set <key> <value>` | Changes one config value |
88
- | `/ocsmarttools config reset [key]` | Resets one key or all keys |
89
- | `/ocsmarttools version` | Shows installed plugin version |
90
-
91
- ### CLI Commands
92
-
93
- | Command | What it does |
94
- |---|---|
95
- | `openclaw ocsmarttools help` | Shows all commands in plain language |
96
- | `openclaw ocsmarttools status` | Shows mode and safety settings |
97
- | `openclaw ocsmarttools strict <on\|off>` | Turns strict routing on/off |
98
- | `openclaw ocsmarttools sync` | Rewrites the managed routing block in `AGENTS.md` |
99
- | `openclaw ocsmarttools stats` | Shows calls, errors, timeouts, latency, and estimated savings |
100
- | `openclaw ocsmarttools stats-reset` | Resets plugin stats |
101
- | `openclaw ocsmarttools setup [safe\|standard]` | Applies recommended defaults |
102
- | `openclaw ocsmarttools mode <safe\|standard>` | Changes mode only |
103
- | `openclaw ocsmarttools config` | Shows plugin config |
104
- | `openclaw ocsmarttools config-keys` | Lists editable config keys |
105
- | `openclaw ocsmarttools config-set <key> <value>` | Changes one config value |
106
- | `openclaw ocsmarttools config-reset [key]` | Resets one key or all keys |
107
- | `openclaw ocsmarttools version` | Shows installed plugin version |
108
-
109
- ## Common Config Actions
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`)
84
+
85
+ Example:
110
86
 
111
87
  ```text
112
- /ocsmarttools config
113
- /ocsmarttools config keys
114
- /ocsmarttools config set maxResultChars 120000
115
- /ocsmarttools config set storeLargeResults true
116
- /ocsmarttools config set toolSearch.useLiveRegistry true
117
- /ocsmarttools config set toolSearch.liveTimeoutMs 1500
118
88
  /ocsmarttools config set strictRouting true
119
- /ocsmarttools config set autoInjectRoutingGuide true
120
- /ocsmarttools config set autoInjectRoutingGuide false
121
- /ocsmarttools config reset maxResultChars
122
- /ocsmarttools stats
89
+ /ocsmarttools config set maxResultChars 120000
90
+ /ocsmarttools config set invokeTimeoutMs 30000
123
91
  ```
124
92
 
125
- Config path:
126
- - `plugins.entries.ocsmarttools.config`
127
-
128
93
  ## Modes
129
94
 
130
- - `standard` (default): zero-touch mode, no sandbox requirement, control-plane dispatch still blocked
131
- - `safe`: requires sandboxed execution and blocks control-plane dispatch (`gateway`, `cron`)
132
- - `strictRouting=true`: strict plugin-managed routing policy is auto-synced with no manual workspace edits.
133
-
134
- Setup default:
135
- - `/ocsmarttools setup` and `openclaw ocsmarttools setup` default to `standard`.
136
-
137
- ## Recommended Defaults
138
-
139
- 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
140
98
 
141
- - `maxResultChars`: `120000`
142
- - `storeLargeResults`: `true`
143
- - `resultStoreTtlSec`: `3600`
144
- - `resultSampleItems`: `10`
99
+ ## Skills and Blocked Sites
145
100
 
146
- Example:
147
-
148
- ```text
149
- /ocsmarttools config set maxResultChars 120000
150
- /ocsmarttools config set resultStoreTtlSec 3600
151
- /ocsmarttools config set resultSampleItems 10
152
- ```
101
+ Skills in OpenClaw are instruction layers, not separate execution engines. OCSmartTools can still dispatch/batch the underlying tools used by skills.
153
102
 
154
- ## 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.
155
104
 
156
- If your instance uses strict `tools.allow`, include:
105
+ ## Safety Notes
157
106
 
158
- ```json5
159
- {
160
- tools: {
161
- allow: ["tool_search", "tool_dispatch", "tool_batch", "tool_result_get"]
162
- }
163
- }
164
- ```
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.
165
110
 
166
- ## Safety and Limits
111
+ ## Troubleshooting
167
112
 
168
- - `ocsmarttools` does not bypass OpenClaw tool policy.
169
- - Routing policy is auto-injected into `AGENTS.md` with managed markers; it can be re-synced via `/ocsmarttools sync`.
170
- - `strictRouting=true` forces `autoInjectRoutingGuide=true`.
171
- - `tool_batch` is intentionally bounded (`maxSteps`, `maxForEach`).
172
- - Large-result handles are in-memory and expire by TTL.
173
- - `tool_result_get` works only while handle is still valid.
174
- - `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`
175
119
 
176
120
  ## Development
177
121
 
178
122
  ```bash
179
123
  npm install
180
124
  npm run typecheck
181
- ```
182
-
183
- ## Versioning
184
-
185
- ```bash
186
- npm run version:show
187
- npm run version:bump:patch
188
- npm run version:bump:minor
189
- npm run version:bump:major
190
125
  npm run release:check
191
126
  ```
192
127
 
193
- - Version source of truth: `package.json`.
194
- - 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.8",
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");