openclaw - 💡(How to fix) Fix [bug] active-memory plugin: 7-15s framework overhead per turn even when model responds in <2s [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75020Fetched 2026-05-01 05:39:02
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

The active-memory plugin's before_prompt_build hook adds 7-15s of latency per chat turn, even though the underlying model (Anthropic Claude Haiku 4-5) responds within 2s. This blocks every chat reply on the configured agent and makes it unusable in interactive contexts.

Root Cause

The active-memory plugin's before_prompt_build hook adds 7-15s of latency per chat turn, even though the underlying model (Anthropic Claude Haiku 4-5) responds within 2s. This blocks every chat reply on the configured agent and makes it unusable in interactive contexts.

Fix Action

Workaround

For now: enabled: false. Will re-enable once a fix lands.

Happy to share more logs / try patches if useful.

Code Example

"active-memory": {
  "enabled": true,
  "config": {
    "agents": ["main"],
    "allowedChatTypes": ["direct"],
    "queryMode": "recent",
    "promptStyle": "balanced",
    "model": "anthropic/claude-haiku-4-5",
    "modelFallback": "openai/gpt-4o-mini",
    "timeoutMs": 10000,
    "maxSummaryChars": 300,
    "thinking": "off"
  }
}

---

active-memory: agent=main start timeoutMs=15000 queryChars=369
[hooks] before_prompt_build handler from active-memory failed: timed out after 15000ms
active-memory: ... done status=timeout elapsedMs=15979 summaryChars=0
[events] Cost: claude/claude-haiku-4-5 [main]2967 in, 0cr, 0cw, 181 out [active-memory]

---

liveness warning: eventLoopDelayMaxMs=8157.9 eventLoopUtilization=0.842 cpuCoreRatio=0.603

---

sqlite-vec unavailable: Cannot find package 'sqlite-vec' imported from
  /home/node/.openclaw/plugin-runtime-deps/openclaw-2026.4.27-*/dist/engine-storage-CO3qFXo7.js
Did you mean to import "sqlite-vec/index.cjs"?
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw 2026.4.27
  • Docker deployment, Linux ARM64 (Apple Silicon host)
  • Anthropic API key working (verified: direct curl returns in ~1s)

Summary

The active-memory plugin's before_prompt_build hook adds 7-15s of latency per chat turn, even though the underlying model (Anthropic Claude Haiku 4-5) responds within 2s. This blocks every chat reply on the configured agent and makes it unusable in interactive contexts.

Repro

Single agent (main) with active-memory enabled, defaults:

"active-memory": {
  "enabled": true,
  "config": {
    "agents": ["main"],
    "allowedChatTypes": ["direct"],
    "queryMode": "recent",
    "promptStyle": "balanced",
    "model": "anthropic/claude-haiku-4-5",
    "modelFallback": "openai/gpt-4o-mini",
    "timeoutMs": 10000,
    "maxSummaryChars": 300,
    "thinking": "off"
  }
}

Send any direct chat message to the configured agent.

Observed (gateway logs)

active-memory: agent=main start timeoutMs=15000 queryChars=369
[hooks] before_prompt_build handler from active-memory failed: timed out after 15000ms
active-memory: ... done status=timeout elapsedMs=15979 summaryChars=0
[events] Cost: claude/claude-haiku-4-5 [main] — 2967 in, 0cr, 0cw, 181 out [active-memory]

The cost log proves the model did respond with 181 tokens during the call, but the framework timed out before delivering the result. A subsequent identical query: status=empty elapsedMs=7107 — still 7s, even with cacheTtlMs: 60000 configured.

Liveness diagnostic during the call:

liveness warning: eventLoopDelayMaxMs=8157.9 eventLoopUtilization=0.842 cpuCoreRatio=0.603

— event loop blocked ~8s by the embedded run.

Tested config variations (none helped)

  • Models: anthropic/claude-haiku-4-5, openai-codex/gpt-5.5, openai/gpt-4o-mini — all hit timeout/empty
  • Settings: queryMode: "message", promptStyle: "preference-only", recentUserTurns: 0, recentAssistantTurns: 0, cacheTtlMs: 60000, thinking: "off" — no measurable improvement
  • Memory backend: Vector: ready and FTS: ready (after side-issue fix below)

Side issue: missing dep sqlite-vec

sqlite-vec is imported by dist/engine-storage-*.js but not declared in plugin-runtime-deps/*/package.json. Out of the box: Vector: unavailable. Manual npm install sqlite-vec sqlite-vec-linux-arm64 in the runtime-deps directory was needed before vector search worked.

sqlite-vec unavailable: Cannot find package 'sqlite-vec' imported from
  /home/node/.openclaw/plugin-runtime-deps/openclaw-2026.4.27-*/dist/engine-storage-CO3qFXo7.js
Did you mean to import "sqlite-vec/index.cjs"?

Suggest declaring sqlite-vec (and platform-specific binaries) as bundled runtime dependencies.

Expected

Active-memory before_prompt_build hook completes in <3s when the underlying model returns in <2s. If framework overhead is intrinsic, the docs should state a realistic minimum timeoutMs (15s currently insufficient).

Workaround

For now: enabled: false. Will re-enable once a fix lands.

Happy to share more logs / try patches if useful.

extent analysis

TL;DR

The active-memory plugin's before_prompt_build hook is causing significant latency, and a potential fix involves optimizing the plugin's performance or adjusting the timeoutMs configuration.

Guidance

  • Investigate the active-memory plugin's implementation to identify potential bottlenecks or optimization opportunities, focusing on the before_prompt_build hook.
  • Consider increasing the timeoutMs value to accommodate the plugin's processing time, although this may not be a scalable solution.
  • Verify the event loop utilization and CPU core ratio to ensure the system is not overwhelmed, as indicated by the liveness diagnostic warning.
  • Review the plugin's dependencies, including the manually installed sqlite-vec, to ensure all required packages are properly declared and installed.

Example

No code snippet is provided, as the issue is more related to configuration and performance optimization.

Notes

The root cause of the issue is unclear, and further investigation is needed to determine the best course of action. The provided workaround of disabling the active-memory plugin may not be a long-term solution.

Recommendation

Apply workaround: disable the active-memory plugin (enabled: false) until a fix is implemented, as the current configuration is causing significant latency and rendering the agent unusable.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [bug] active-memory plugin: 7-15s framework overhead per turn even when model responds in <2s [1 comments, 2 participants]