Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/mergisi/openclaw-rules/tool-scriptsgit clone --depth 1 https://github.com/mergisi/openclaw-rulesWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01135 | $0.01135 |
| Opus 5 | $0.00567 | $0.00567 |
| Sonnet 5 | $0.00227 | $0.00227 |
| Haiku 4.5 | $0.00113 | $0.00113 |
Grade A, and why
tool-scripts scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 136 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Writing Tool Scripts
When creating tool scripts for OpenClaw agents, follow these patterns.
Rules
- Zero npm dependencies. Use only Node.js built-ins:
https,fs,path,crypto. - CommonJS format. Use
.cjsextension andrequire(). - Self-contained. Each script must work standalone with
node tools/script.cjs. - Accept CLI arguments. Date ranges, flags, output format.
- Print to stdout. The agent captures stdout. Use
console.log()for output,console.error()for errors.
Template
#!/usr/bin/env node
// Tool Name — Short description
// Usage: node tool-name.cjs [date] [--json]
// Requires: API_KEY in .env or secrets/
const https = require("https");
const path = require("path");
const fs = require("fs");
// Load config
const envPath = path.resolve(__dirname, "../secrets/.env");
if (fs.existsSync(envPath)) {
fs.readFileSync(envPath, "utf-8").split("\n").forEach(line => {
const [k, ...v] = line.split("=");
if (k && !k.startsWith("#")) process.env[k.trim()] = v.join("=").trim();
});
}
const API_KEY = process.env.API_KEY;
if (!API_KEY) { console.error("Set API_KEY in secrets/.env"); process.exit(1); }
// HTTP helper — works with any JSON API
function httpGet(url, headers = {}) {
return new Promise((resolve, reject) => {
const u = new URL(url);
const req = https.request({
hostname: u.hostname,
path: u.pathname + u.search,
method: "GET",
headers: { "User-Agent": "OpenClaw-Agent/1.0", ...headers },
timeout: 15000,
}, res => {
let body = "";
res.on("data", d => body += d);
res.on("end", () => {
try { resolve(JSON.parse(body)); }
catch { resolve(body); }
});
});
req.on("error", reject);
req.on("timeout", () => { req.destroy(); reject(new Error("timeout")); });
req.end();
});
}
function httpPost(url, headers, data) {
return new Promise((resolve, reject) => {
const body = typeof data === "string" ? data : JSON.stringify(data);
const u = new URL(url);
const req = https.request({
hostname: u.hostname,
path: u.pathname + u.search,
method: "POST",
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body), ...headers },
timeout: 15000,
}, res => {
let b = "";
res.on("data", d => b += d);
res.on("end", () => {
try { resolve(JSON.parse(b)); }
catch { resolve(b); }
});
});
req.on("error", reject);
req.on("timeout", () => { req.destroy(); reject(new Error("timeout")); });
req.write(body);
req.end();
});
}
// Date helpers
const yesterday = new Date(Date.now() - 86400000).toISOString().slice(0, 10);
const date = process.argv[2] || yesterday;
const jsonOutput = process.argv.includes("--json");
async function main() {
// Your tool logic here
const data = await httpGet(`https://api.example.com/data?date=${date}`);
if (jsonOutput) {
console.log(JSON.stringify(data, null, 2));
} else {
console.log(`Report for ${date}`);
console.log("=".repeat(40));
// Format and print results
}
}
main().catch(e => { console.error("Fatal:", e.message); process.exit(1); });
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 136 lines · 1,135 tokens per session scan A f1d0ce40d99f
tool-scripts is a cursor rule published in the GitHub repository mergisi/openclaw-rules (2 stars, last pushed 6mo ago), licensed MIT. It adds 1,135 tokens to every session, about $0.0057 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
050-plan
When the user types /plan or asks to create a project plan, feature PRD, or retrospective.
002-verify-before-act
Requires Claude to read before writing, verify before installing, and confirm before destructive operations.
pre-flight-check
Mandatory fail-fast quality gate — run Typecheck, Lint, Test, and Security Audit sequentially before declaring any task done or committing code.
graphql
GraphQL: schema design, resolvers, performance.
infra-devops
Infrastructure, Cloud, Terraform, Docker & CI/CD Agent.
context-routing
System, platform, and developer instructions take precedence; then repository-specific rules; then this framework. Before work, read .ai/bootstrap/boot.md and .ai/rules/00-master-rules.md. Load focused rules and skills only when triggered.