Benchmark, diagnose, and optimize OpenClaw test and plugin-suite runtime, import hotspots, CPU/RSS, heap growth, and slow coverage paths.
Capabilities
Plugin-Suite Workflow
For bundled plugins, plugin-inspector, SDK barrels, package-boundary…
Metric Collection
Collect at least one stable metric before and after
Common Root Causes
Benchmark Commands
Getting started
Full instructionsExample command
Metric Collection
pnpm buildInstructions: SKILL.mdv1.0.9
OpenClaw Test Performance
Use evidence first. The goal is real pnpm test, plugin-suite, and
plugin-inspector speed/RSS improvement with coverage intact, not runner tuning by
guesswork.
Workflow
- Read the relevant local
AGENTS.mdfiles before editing:src/agents/AGENTS.mdfor agent/import hotspots.src/channels/AGENTS.mdandsrc/plugins/AGENTS.mdfor plugin/channel
laziness.src/gateway/AGENTS.mdfor server lifecycle tests.test/helpers/AGENTS.mdand
src/channels/plugins/contracts/test-helpers/AGENTS.mdfor shared contract
helpers.src/infra/outbound/AGENTS.mdfor outbound/media/action tests.
- Establish a baseline before changing code:
- Prefer
pnpm test:perf:groups --full-suite --allow-failures --output <file>
for full-suite ranking. - For bundled plugin breadth, run the smallest relevant
pnpm test:extensions:batch <plugin[,plugin...]>or plugin-inspector command
before jumping to the full extension sweep. - For a scoped hotspot use:
/usr/bin/time -l pnpm test <file-or-files> --maxWorkers=1 --reporter=verbose - For import-heavy suspicion add:
OPENCLAW_VITEST_IMPORT_DURATIONS=1 OPENCLAW_VITEST_PRINT_IMPORT_BREAKDOWN=1.
- Prefer
- Separate wall/runner noise from real file cost:
- Compare Vitest duration, test body timing, import breakdown, wall time, and
max RSS. - Re-run single files when grouped/full-suite numbers look stale or noisy.
- If a full-suite grouped run reports a lane failure but JSON says tests
passed, report the discrepancy and inspect the lane exit and logs. A passing file rerun does not explain a failed lane.
- Compare Vitest duration, test body timing, import breakdown, wall time, and
- Pick the next attack by return and risk:
- High return: one file/test dominates seconds or RSS and has a clear root.
- High leverage: one plugin or SDK barrel causes every plugin-inspector or
extension-batch run to load broad runtime. - Lower risk: static descriptors, target parsing, routing, auth bypass,
setup hints, registry fixtures, or test server lifecycle. - Higher risk: real memory/runtime behavior, live providers, protocol
contracts, or broad production refactors.
- Fix the root cause, not the symptom:
- Move static metadata/parsing into narrow helpers or lightweight artifacts
reused by full runtime and fast paths. - Prefer dependency injection, loaded-plugin-only lookup, explicit fixtures,
and pure helpers over broad mocks. - Reuse suite-level servers/clients when a fresh handshake is irrelevant.
- Keep schedulers/background loops off unless the test proves scheduling.
- In plugin paths, move static metadata into manifest/lightweight artifacts
and keep runtime plugin loads behind explicit execution boundaries.
- Move static metadata/parsing into narrow helpers or lightweight artifacts
- Preserve coverage shape:
- Do not delete a slow integration proof unless the exact production
composition is extracted into a named helper and tested. - Keep one cheap integration smoke when cross-component wiring matters.
- State explicitly what incidental coverage was removed, if any.
- Do not delete a slow integration proof unless the exact production
- Re-benchmark the same command after the change and compute seconds plus
percent gain. - Update the running report when requested or when this thread is tracking one.
Include before/after commands, artifacts, coverage notes, verification, and
next attack order. - Stage the intended paths, commit with standard Git, and push when the
user asked for commits/pushes. Stage only files touched for this attack.
Plugin-Suite Workflow
For bundled plugins, plugin-inspector, SDK barrels, package-boundary tests, or
extension suites, read the plugin-suite workflow
in full before choosing benchmarks or proof. It covers suite breadth, host
selection, and package-artifact escalation.
Metric Collection
Collect at least one stable metric before and after. Prefer the same machine and
same command. For Testbox comparisons, use the same tbx_... id when possible.
| Metric | Use for | Preferred source |
|---|---|---|
| wall time | user-visible suite cost | /usr/bin/time -l, test wrapper duration, Testbox run time |
| Vitest duration | test body/import cost | Vitest output per file/shard |
| import duration | broad barrel/runtime loads | OPENCLAW_VITEST_IMPORT_DURATIONS=1 |
| max RSS | memory pressure and OOM risk | /usr/bin/time -l, pnpm test:extensions:memory, wrapper memory summaries |
| CPU/user/sys | CPU-bound vs wait-bound split | /usr/bin/time -l locally, Testbox job timing when local CPU is noisy |
| heap evidence | real leak vs retained module graph | openclaw-test-heap-leaks workflow |
Local scoped command with CPU/RSS:
timeout 240 /usr/bin/time -l pnpm test <file> --maxWorkers=1 --reporter=verbose
Plugin import memory profile:
pnpm build
pnpm test:extensions:memory -- --top 20 --json .artifacts/test-perf/extensions-memory.json
Targeted plugin import memory:
pnpm test:extensions:memory -- --extension discord --extension telegram --skip-combined
Heap/RSS escalation:
pnpm test:perf:groups \
--config test/vitest/vitest.unit-fast.config.ts \
--allow-failures \
--output .artifacts/test-perf/unit-fast-memory.json
pnpm test:perf:profile:runner -- \
--output-dir .artifacts/test-perf/vitest-runner-profile -- <file>
Use openclaw-test-heap-leaks when RSS keeps growing across intervals, workers
OOM, or the suspect command has app-object retention. Do not call RSS growth a
leak until snapshots or retainers support it.
Common Root Causes
- Full bundled channel/plugin runtime loaded for static data.
getChannelPlugin()fallback used when an already-loaded fixture or pure
parser would suffice.- Broad
api.ts,runtime-api.ts,test-api.ts, or plugin-sdk barrels pulled
into hot tests. - SDK root aliases or package barrels pulling focused subpaths back into a broad
plugin graph. - Plugin-inspector loading runtime code just to render metadata, reports, or CI
policy scores. - Bundled plugin capture reusing real config/home state instead of synthetic,
redacted, isolated state. - Partial-real mocks using
importActual()around broad modules. vi.resetModules()plus fresh imports in per-test loops.- Test plugin registry seeded in
beforeAllwhile runtime state resets in
afterEach. - Per-test gateway/server/client startup when state reset would suffice.
- Runtime/default model/auth selection paid by idle snapshots or fixtures.
- Plugin-owned media/action discovery triggered before checking whether args
contain plugin-owned fields. - Parallel Vitest runs sharing
node_modules/.experimental-vitest-cachewithout
distinctOPENCLAW_VITEST_FS_MODULE_CACHE_PATHvalues.
Benchmark Commands
Scoped file:
timeout 240 /usr/bin/time -l pnpm test <file> --maxWorkers=1 --reporter=verbose
Scoped file with import breakdown:
timeout 240 /usr/bin/time -l env \
OPENCLAW_VITEST_IMPORT_DURATIONS=1 \
OPENCLAW_VITEST_PRINT_IMPORT_BREAKDOWN=1 \
pnpm test <file> --maxWorkers=1 --reporter=verbose
Grouped suite:
pnpm test:perf:groups --full-suite --allow-failures \
--output .artifacts/test-perf/<name>.json
Extension batch:
pnpm test:extensions:batch <plugin[,plugin...]> -- --reporter=verbose
All extension tests:
pnpm test:extensions
Package-boundary plugin checks:
pnpm run test:extensions:package-boundary:canary
pnpm run test:extensions:package-boundary:compile
Reuse an existing Vitest JSON report:
pnpm test:perf:groups --report <vitest-json> \
--output .artifacts/test-perf/<name>.json
Verification
- Always run the targeted test surface that proves the change.
- Follow OpenClaw testing for focused tests,
required builds, proof routing, and publication timing. - For test-only changes, run the exact edited tests through that owner's supported command.
- For plugin SDK/barrel/runtime changes, compare exact commits with
pnpm plugin-sdk:api:diff -- --base <base-sha> --head <head-sha>when the
public API surface may drift. For PR-local proof, use the branch merge base
as<base-sha>and the exact tested head commit as<head-sha>. - For plugin-suite perf fixes, verify at least one representative plugin batch
plus the changed gate; use Package Acceptance if the bug only exists in a
packed artifact. - For missing or stale dependencies, follow Source dependencies
and the current worktree's owner instructions. Use a qualified proof route. - Use the report format:
| Metric | Before | After | Gain |
| -------------- | -----: | -----: | ------------: |
| File wall time | `Xs` | `Ys` | `-Zs` (`P%`) |
| Max RSS | `XMB` | `YMB` | `-ZMB` (`P%`) |
| CPU user/sys | `X/Ys` | `A/Bs` | explain |
Handoff
Keep the final concise:
- Root cause.
- Suite/plugin scope.
- Files changed.
- Before/after wall, Vitest/import, CPU, and RSS numbers where available.
- Leak classification if memory was involved: real leak, retained module graph,
or inconclusive. - Coverage retained.
- Verification commands.
- Testbox ID or workflow URL for remote proof.
- Commit hash and push status.
Explore more skills
Browse all- Meme MakerSearch meme templates, suggest formats, and generate local or hosted image memes.
- Apple NotesCreate, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.
- himalayaHimalaya CLI for IMAP/SMTP mail: list, read, search, compose, reply, forward, copy, move, delete.
- Diagram MakerCreate SVG/HTML or Excalidraw diagrams for concepts, architecture, flows, and whiteboards.
- Apple RemindersList, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.
- obsidianWork with Obsidian vaults using the official obsidian CLI: read/search/create/edit notes, tasks, links, properties,…
Security
Reviews (0)
More from OpenClaw
View source →Frequently asked questions about openclaw-test-performance
What does the openclaw-test-performance skill do?
Benchmark, diagnose, and optimize OpenClaw test and plugin-suite runtime, import hotspots, CPU/RSS, heap growth, and slow coverage paths. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the openclaw-test-performance skill?
Run `npx @skills-hub-ai/cli install openclaw-test-performance` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/openclaw-test-performance/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does openclaw-test-performance work with?
openclaw-test-performance runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the openclaw-test-performance skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use openclaw-test-performance after installing it?
In Claude Code, type `/openclaw-test-performance` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the openclaw-test-performance skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/openclaw-test-performance)<a href="https://skills-hub.ai/skills/openclaw-test-performance"><img src="https://skills-hub.ai/api/badges/skill/openclaw-test-performance" alt="Install on Skills Hub"></a>More options in the badge docs.