Skip to content

Agent prep takes >40s: system-prompt building regression (30-35s spent in resolvePromptBuildSystemPrompt) #75329

@erforschtbot-cmyk

Description

@erforschtbot-cmyk

Version

OpenClaw 2026.4.29 (a448042)

Environment

  • OS: CachyOS (Arch Linux), Kernel 6.19.12-1
  • Node: v25.9.0
  • Install: npm global
  • Hardware: Dell Latitude 5300

Symptoms

Every agent start takes over 40 seconds. The system-prompt stage alone consumes 30-35 seconds (74-78% of total prep time). This was <5 seconds in v2026.4.23.

Measured Data (4 consecutive runs, same session)

totalMs=41088 system-prompt:30606ms (74%) core-plugin-tools:6357ms
totalMs=42444 system-prompt:33470ms (78%) core-plugin-tools:5725ms
totalMs=43250 system-prompt:34099ms (78%) core-plugin-tools:5496ms
totalMs=46183 system-prompt:34531ms (74%) core-plugin-tools:5611ms

Full stage breakdown (typical run)

Stage Duration %
system-prompt 30,606 ms 74.6%
core-plugin-tools 6,357 ms 15.5%
stream-setup 2,255 ms 5.5%
session-resource-loader 1,404 ms 3.4%
bundle-tools 454 ms 1.1%
bootstrap-context 8 ms 0.0%
workspace-sandbox 1 ms 0.0%
skills 0 ms 0.0%
Total 41,088 ms

Context Size

  • 7 workspace files (AGENTS.md, SOUL.md, USER.md, etc.): ~10 KB total
  • 9 SKILL.md skill files: ~71 KB total
  • Memory (today + yesterday): ~10-20 KB
  • Dynamic runtime context: variable
  • Total: ~80-100 KB

For processing ~80-100 KB of text, 30+ seconds is not normal.

Processing Path

The system prompt is built in:
dist/agent-harness-runtime-CZhqA2px.jsresolvePromptBuildSystemPrompt()

This function processes workspace context, skill manifests, memory files, and assembles the final system prompt string.

Additional Observation

core-plugin-tools also increased significantly: 5-6s in v2026.4.29 vs <1s in v2026.4.23. This could be related to the json5 import issue (#75328) if frontmatter parsing is happening synchronously and blocking.

session-resource-loader duration is highly variable (0.5s to 2.5s) - also a potential sub-issue.

Impact

Regression

Version 2026.4.23: agent prep took ~5-8 seconds total.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions