Skip to content

edit_note append should create file if it doesn't exist #614

@bm-clawd

Description

@bm-clawd

Feature: edit_note append/prepend should create file if not found

Current Behavior

edit_note(operation=append) on a nonexistent note returns an error (Entity not found). The MCP result doesn't set isError: true — it returns a malformed success response missing structuredContent, causing downstream clients to throw invalid edit_note payload.

Desired Behavior

edit_note should just work:

Operation Note Exists Behavior fileCreated
append yes Append content to end false
append no Create file with content true
prepend yes Prepend content to start false
prepend no Create file with content true
find_replace no Error (can't replace in nonexistent file) n/a
replace_section no Error (can't replace section that doesn't exist) n/a

Response Shape (always)

{
  "title": "conversations-2026-02-26",
  "permalink": "claw/conversations/conversations-2026-02-26",
  "file_path": "memory/conversations/conversations-2026-02-26.md",
  "fileCreated": true
}

No isError for the create-on-miss case. The caller asked to append — the tool appends. Whether the file was just created is metadata, not an error.

Motivation

The openclaw-basic-memory plugin's conversation auto-capture calls edit_note(append) to build up daily conversation notes. On the first message of the day, the note doesn't exist. Currently this silently fails every time (100+ failures/day logged in BM), and the fallback logic in the plugin was broken because the error format was unexpected.

With this change, the plugin's indexConversation becomes one line:

await this.editNote(title, 'append', entry)

Also applies to MCP tool callers (Claude, Cursor, etc.)

Any AI using edit_note to incrementally build a note shouldn't need to check if the note exists first. append to a nonexistent file should just work — same as echo 'hello' >> newfile.txt in a shell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions