Both PRs use WeakMap<index-object, fingerprint> to memoize
`resolveInstalledManifestRegistryIndexFingerprint`. Different layer
than this plugin's fs-level TTL — theirs only fires when the same
InstalledPluginIndex instance is passed twice; ours fires for every
stat/realpath on a plugin-tree path regardless of caller.
discoverInDirectory walks, the realpathSync ancestor-lstat chain, and
the loadConfig()-via-pushMetaToMonitor path don't go through the
fingerprint function, so this plugin keeps catching that traffic even
once their PR lands. Reevaluate the need then.
Both upstream PRs are blocked on review (type-check failure + need for
real-behavior profile evidence). Our prod 92-98% hit-ratio + 25%→<1%
baseline is exactly the evidence shape they're asking for, but
upstream involvement is intentionally out of scope per project decision.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wraps the global fs functions with a 1s TTL memo, scoped via path
whitelist to plugin-discovery paths only. Workaround for upstream
openclaw issue #86791: `loadPluginMetadataSnapshot()`'s cache-validity
check re-runs `hashWatchedFiles` on every lookup, which walks every
plugin's package.json + manifest + source via realpathSync ->
ancestor lstat chain. On prod t2 with ~100 plugins, one cache-check
pass is ~6 400 lstat + ~400 stat (~6-7s CPU per call). Fires on every
agent turn, every loadConfig() call, every channel routing decision.
This plugin doesn't fix the upstream design; it just absorbs the
repeated stats within a 1s window so the same paths aren't re-statted
6× per second during a discovery walk.
Verified on prod t2 (2026-05-27):
- Cache hit ratio: 92.1-98.2% (stable across windows)
- Idle baseline (0 turn, 0 push): 0.6-3.7% CPU (was 25%+ pre-fix)
- Per-turn cost: notably reduced; previously 100% sustained per turn
Path whitelist:
- /openclaw/dist/extensions/
- /.openclaw/plugins/
- /node_modules/@openclaw/
- /openclaw/plugin-sdk/
All other paths pass through to original fs functions unchanged.
Manifest requires `activation.onStartup: true` so openclaw register()s
the plugin even though it exposes no tools/contracts (otherwise jiti
caches the module without ever calling register).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>