openclaw - ✅(Solved) Fix [Bug]: Claude CLI session resume doesn't reload harness initialization files (SOUL.md, IDENTITY.md) [1 pull requests, 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#80374Fetched 2026-05-11 03:15:25
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

When using Claude CLI integration, resumed sessions fail to load harness initialization files (SOUL.md, IDENTITY.md, etc.), causing inconsistent agent personality. Fresh sessions work correctly, but resumed sessions operate as generic Claude instead of the defined identity.

Environment

• OpenClaw Version: 2026.5.7 (eeef486) • Platform: Linux 6.17.0-1013-aws • Provider: Claude CLI integration • Migration Context: Issue appeared after switching from OAuth to Claude CLI

Root Cause

Process inspection reveals the root cause:

Fix Action

Fix / Workaround

Workarounds

PR fix notes

PR #80376: fix(cli-runner): inject system prompt on --resume sessions

Description (problem / solution / changelog)

Summary

Fixes #80374. When resuming a Claude CLI session with --resume, the --append-system-prompt-file flag was silently dropped, causing harness initialization files (SOUL.md, IDENTITY.md, AGENTS.md) to not be loaded.

Root cause — three independent guards all blocked the path:

  1. buildCliArgs (helpers.ts) had !params.useResume && on all three system-prompt injection branches, preventing them from emitting on resumed sessions.
  2. execute.ts had !useResume && systemPromptArg guarding the temp-file write, so the file was never created.
  3. resolveSystemPromptUsage was called with isNewSession: isNew (false on resume) — causing it to return null for the default "first" policy.

Fix: Remove all three !useResume guards and pass isNewSession: isNew || useResume so resume is treated like a new session for system-prompt injection.

Real behavior proof

Behavior or issue addressed: --append-system-prompt-file (and --append-system-prompt) flags are omitted from the Claude CLI invocation on session resume, so SOUL.md / IDENTITY.md / AGENTS.md content is never injected into the resumed context. Fresh sessions work; resumed sessions silently revert to generic Claude.

Real environment tested: Node.js 22, openclaw local build from this branch, src/agents/cli-runner/helpers.ts buildCliArgs invoked directly via unit harness.

Exact steps or command run after this patch:

node --experimental-vm-modules node_modules/vitest/vitest.mjs run src/agents/cli-runner.helpers.test.ts --reporter=verbose

Evidence after fix:

✓ buildCliArgs > keeps passing model overrides on resumed CLI sessions
✓ buildCliArgs > injects --append-system-prompt-file on resumed Claude CLI sessions
✓ buildCliArgs > injects system prompt arg on resumed sessions when no file arg is configured
✓ buildCliArgs > strips the internal cache boundary from CLI system prompt args
✓ buildCliArgs > passes Codex system prompts via a model instructions file config override
✓ buildCliArgs > passes Claude system prompts through its file flag

Test Files  2 passed (2)
     Tests  42 passed (42)

The new test injects --append-system-prompt-file on resumed Claude CLI sessions calls buildCliArgs with useResume: true and asserts the output array contains ['--append-system-prompt-file', '/tmp/openclaw/system-prompt.md'] — this test failed before the fix (output was missing those args) and passes after.

Observed result after fix: Resumed sessions now emit --append-system-prompt-file <path> in the Claude CLI argument list, matching fresh-session behavior. The system prompt temp file is written and the flag injected regardless of whether useResume is true or false.

What was not tested: End-to-end session resume against a live Claude CLI binary — the arg-assembly path is fully covered; the integration path (Claude CLI actually reading and honoring the appended prompt) relies on Claude CLI's existing --append-system-prompt-file behavior.

Changed files

  • src/agents/cli-runner.helpers.test.ts (modified, +43/-0)
  • src/agents/cli-runner/execute.ts (modified, +7/-8)
  • src/agents/cli-runner/helpers.ts (modified, +2/-8)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

When using Claude CLI integration, resumed sessions fail to load harness initialization files (SOUL.md, IDENTITY.md, etc.), causing inconsistent agent personality. Fresh sessions work correctly, but resumed sessions operate as generic Claude instead of the defined identity.

Environment

• OpenClaw Version: 2026.5.7 (eeef486) • Platform: Linux 6.17.0-1013-aws • Provider: Claude CLI integration • Migration Context: Issue appeared after switching from OAuth to Claude CLI

Steps to reproduce

  1. Configure OpenClaw with Claude CLI integration
  2. Create SOUL.md, IDENTITY.md, USER.md files in workspace
  3. Start fresh session - agent correctly loads identity
  4. Exit and resume same session
  5. Agent no longer follows identity/personality rules

Expected behavior

Resumed sessions should maintain the same personality and behavior as fresh sessions by loading harness initialization files.

Actual behavior

• Fresh sessions: Agent follows SOUL.md personality, uses defined name/identity • Resumed sessions: Agent behaves as generic Claude, ignores all harness files

OpenClaw version

2026.5.7 (eeef486)

Operating system

Linux 6.17.0-1013-aws

Install method

npm

Model

Claude CLI integration

Provider / routing chain

Issue appeared after switching from OAuth to Claude CLI

Additional provider/model setup details

Process inspection reveals the root cause:

Fresh session:

claude --append-system-prompt-file /tmp/openclaw/openclaw-cli-system-prompt-8C3tJt/system-prompt.md [other flags]

Resumed session:

claude --resume 06e6ffad-3ac8-47bd-aa19-231228bdb0e2 [other flags]

Issue: Session resumption (--resume) doesn't include the --append-system-prompt-file flag that loads harness initialization content.

Logs, screenshots, and evidence

Impact and severity

• Inconsistent user experience between fresh and resumed sessions • Agent "forgets" its identity mid-conversation after restarts • Security implications: AGENTS.md constraints may not be enforced in resumed sessions • Affects users migrating from OAuth (which worked correctly) to Claude CLI

Additional information

Workarounds

• Use /reset to force fresh sessions • Use /reload when personality drift is detected • Avoid session resumption entirely

Additional Context

This appears to be a Claude CLI integration regression. The OAuth authentication method correctly maintained personality across sessions. The issue affects all harness initialization files that should be loaded via the system prompt mechanism.

The same workspace files work perfectly in fresh sessions, confirming the files and configuration are correct - only the session resumption mechanism is broken.

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…

FAQ

Expected behavior

Resumed sessions should maintain the same personality and behavior as fresh sessions by loading harness initialization files.

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 - ✅(Solved) Fix [Bug]: Claude CLI session resume doesn't reload harness initialization files (SOUL.md, IDENTITY.md) [1 pull requests, 1 comments, 2 participants]