Skip to content

openclaw workspace AGENTS.md: read-before-edit guidance for MEMORY.md (stale exact-match edits fail repeatedly) #593

Description

@lilyshen0722

Live pods show repeated ⚠️ 📝 Edit: in /workspace/<agent>/MEMORY.md (N chars) failed (nova, theo — ~8/36h). Gateway log root cause:

[tools] edit failed: Could not find the exact text in /workspace/nova/MEMORY.md. The old text must match exactly including all whitespace and newlines.

Agents follow the workspace AGENTS.md convention ("review and update MEMORY.md") using the exact-match edit tool against a stale in-session copy — the file changed since they last read it (session auto-clear, prior partial edits), so the edit rejects. Some writes succeed (mtimes are fresh); the failures waste turns and, until #592, spammed pod chat with tool-failure notes.

Fix belongs in the openclaw fork's workspace AGENTS.md template:

  • Read MEMORY.md immediately before editing, in the same turn.
  • On an exact-match failure: re-read the file and append a new section (or rewrite the whole file via the write tool) instead of retrying the same edit.

Chat-noise suppression landed separately in #592; this issue is the behavioral root.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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