openclaw-test-performance
Skill59 starsChanged 16 days agoMITView on GitHub
Benchmark, diagnose, and optimize OpenClaw test and plugin-suite runtime, import hotspots, CPU/RSS, heap growth, and slow coverage paths.
We split this skill into the rules it gives an agent
23 rules. 15 are common, 0 are distinctive, and 8 are very specific to this project.
15
Common
Most of the 5 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use evidence first. The goal is real pnpm test, plugin-suite, and plugin-inspector speed/RSS improvement with coverage intact, not runner …
- Common: line 14
Read the relevant local AGENTS.md files before editing:
- Common: line 37
If a full-suite grouped run reports a lane failure but JSON says tests passed, capture that as harness/noise and verify the suspect file …
- Common: line 50
Prefer dependency injection, loaded-plugin-only lookup, explicit fixtures, and pure helpers over broad mocks.
- Common: line 53
Keep schedulers/background loops off unless the test proves scheduling.
- Common: line 57
Do not delete a slow integration proof unless the exact production composition is extracted into a named helper and tested.
- Common: line 59
Keep one cheap integration smoke when cross-component wiring matters.
- Common: line 63
Update the running report when requested or when this thread is tracking one.
- Common: line 71
Use this section when perf work involves bundled plugins, plugin-inspector, SDK barrels, package-boundary tests, or extension suites.
- Very specific: line 78
all bundled source tests: pnpm test:extensions
- Common: line 82
Start narrow, then widen:
- Common: line 90
Treat plugin-inspector failures as product signals:
- Very specific: line 96
Follow $openclaw-testing for host selection.
- Very specific: line 100
If plugin performance is package-artifact sensitive, switch to release-openclaw-plugin-testing and Package Acceptance rather than trusting …
- Very specific: line 148
Use openclaw-test-heap-leaks when RSS keeps growing across intervals, workers OOM, or the suspect command has app-object retention.
- Very specific: line 167
Test plugin registry seeded in beforeAll while runtime state resets in afterEach.
- Common: line 228
Always run the targeted test surface that proves the change.
- Very specific: line 231
Run pnpm build when touching lazy-loading, bundled artifacts, package boundaries, dynamic imports, build output, or public surfaces.
- Very specific: line 240
If deps are missing/stale, run pnpm install and retry the exact failed command once.
- Common: line 242
Use the report format:
- Common: line 254
Keep the final concise:
- Common: line 259
Before/after wall, Vitest/import, CPU, and RSS numbers where available.
- Common: line 265
Commit hash and push status.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.mdandsrc/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, capture that as harness/noise and verify the suspect file directly.
- 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.
- 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.
- 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
Use this section when perf work involves bundled plugins, plugin-inspector, SDK barrels, package-boundary tests, or extension suites.
- Map the suite shape first:
- source tests:
pnpm test extensions/<id>orpnpm test:extensions:batch <id> - package boundaries:
pnpm run test:extensions:package-boundary:canaryandpnpm run test:extensions:package-boundary:compile - all bundled source tests:
pnpm test:extensions - plugin import memory:
pnpm test:extensions:memory -- --json .artifacts/test-perf/extensions-memory.json - plugin-inspector/report work: keep report primitives in
plugin-inspector; keep wrappers thin and collect peak RSS when the command supports it.
- source tests:
- Start narrow, then widen:
- one plugin changed: run that plugin's tests and plugin-inspector slice.
- SDK/public barrel changed: add representative provider, channel, memory, and feature plugins.
- loader/runtime mirror changed: add package-boundary checks and build/package proof as needed.
- unknown shared plugin behavior: run
test:extensions:batchgroups beforepnpm test:extensions.
- Treat plugin-inspector failures as product signals:
- JSON must parse.
- warnings/errors must be classified, not hidden.
- runtime capture should be quiet and config-tolerant.
- command output should include wall time, exit code, and peak RSS when available.
- Follow
$openclaw-testingfor host selection. Trusted source benchmarks can run locally with comparable machine/load conditions. Use$crabboxwhen clean packaging, Linux/platform behavior, isolation, or an explicit remote request is part of the proof; reuse and clean up only the owned lease. - If plugin performance is package-artifact sensitive, switch to
release-openclaw-plugin-testingand Package Acceptance rather than trusting source-only timing.
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=verbosePlugin import memory profile:
pnpm build
pnpm test:extensions:memory -- --top 20 --json .artifacts/test-perf/extensions-memory.jsonTargeted plugin import memory:
pnpm test:extensions:memory -- --extension discord --extension telegram --skip-combinedHeap/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 inafterEach. - 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=verboseScoped 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=verboseGrouped suite:
pnpm test:perf:groups --full-suite --allow-failures \
--output .artifacts/test-perf/<name>.jsonExtension batch:
pnpm test:extensions:batch <plugin[,plugin...]> -- --reporter=verboseAll extension tests:
pnpm test:extensionsPackage-boundary plugin checks:
pnpm run test:extensions:package-boundary:canary
pnpm run test:extensions:package-boundary:compileReuse an existing Vitest JSON report:
pnpm test:perf:groups --report <vitest-json> \
--output .artifacts/test-perf/<name>.jsonVerification
- Always run the targeted test surface that proves the change.
- Source changes: focused local tests + targeted typecheck/lint/format before push;
pnpm check:changedoptional. PR CI = broad proof. Testbox only for CI/local gaps, immediate grant; warmed Testbox reuse when selected. - For test-only changes, run
pnpm test:changedor the exact edited tests. - Run
pnpm buildwhen touching lazy-loading, bundled artifacts, package boundaries, dynamic imports, build output, or public surfaces. - 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.
- If deps are missing/stale, run
pnpm installand retry the exact failed command once. - 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.
Other versions11 projects use a version of this.
Word for word · 6
- steipete/warelay★ 394k100% same
- moltbot/clawdbot★ 394k100% same
- moltbot/moltbot★ 394k100% same
- clawdbot/clawdbot★ 394k100% same
- steipete/clawdis★ 394k100% same
- openclaw/openclaw★ 394k100% same
Edited · 5
- molt-bot/clawdbot★ 391k98% same
- friuns2/openclaw-android-assistant★ 57398% same
- OpenClawAndroid/openclaw-android-assistant★ 55698% same
- clawsouls/soulclaw★ 988% same
- supermansuper563-ops/openclaw-workbench★ 088% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository107 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- extensions/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- test/AGENTS.mdAGENTS.md
- ui/AGENTS.mdAGENTS.md
- agent-transcriptSkill
- auto-qaSkill
- autoreviewSkill
- channel-message-flowsSkill
- clawdtributorSkill
- claw-scoreSkill
- clawsweeperSkill
- control-ui-e2eSkill
- crabboxSkill
- discord-clawdSkill
- discord-e2eSkill
- discord-user-postSkill
- discrawlSkill
- gitcrawlSkill
- graincrawlSkill
- notcrawlSkill
- openclaw-changelog-updateSkill
- openclaw-ci-limitsSkill
- openclaw-debuggingSkill
- openclaw-docker-e2e-authoringSkill
- openclaw-ghsa-maintainerSkill
- openclaw-live-updaterSkill
- openclaw-parallels-smokeSkill
- openclaw-pr-maintainerSkill
- openclaw-qa-testingSkill
- openclaw-refactor-docsSkill
- openclaw-release-validationSkill
- openclaw-repair-sweepSkill
- openclaw-secret-scanning-maintainerSkill
- openclaw-test-heap-leaksSkill
- openclaw-testingSkill
- openclaw-updateSkill
- parallels-discord-roundtripSkill
- plugin-sdk-impactSkill
- proof-videoSkill
- prototype-openclaw-tuiSkill
- pr-simplifySkill
- release-openclaw-announcementSkill
- release-openclaw-ciSkill
- release-openclaw-macSkill
- release-openclaw-maintainerSkill
- release-openclaw-plugin-testingSkill
- security-triageSkill
- slack-e2eSkill
- slacrawlSkill
- solidSkill
- tag-duplicate-prs-issuesSkill
- technical-documentationSkill
- telegram-e2e-userbotSkill
- test-auditSkill
- update-team-serverSkill
- verify-releaseSkill
- 1passwordSkill
- apple-notesSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

