Working Memory icon

Working Memory

Update working memory with new information. Always send complete JSON object with all existing fields plus any new ones.

Working Memory

AI-generated

Summary

Update the persistent working memory for a specified session or user in a Postgres database, storing a complete JSON object representation of the working memory state with scope control (thread- or user-scoped).

Inputs

  • Working Memory Content (required) — The full working memory as a JSON object including all existing and any new fields to be stored.
  • Session ID (required) — The session ID relevant to this working memory, matching the Postgres Memory+ node session ID.
  • User Options — Optional settings including User ID (required if using user-scoped memory) and working memory scope (thread-scoped or user-scoped).
  • Schema Name — The Postgres schema name where the sessions table resides; defaults to 'public'.
  • Sessions Table Name — The name of the sessions table in the database, must match the Postgres Memory+ node configuration; defaults to 'n8n_chat_sessions'.

Output shape

a JSON result object per input item

Each output item includes success status, the session or user ID, scope of memory, a result message, and the stored JSON content. The update operation is queued asynchronously, so success means the update was queued for processing, not necessarily completed synchronously. Errors in JSON formatting or missing required fields are reported with failure indication.

Examples

Example 1: Update thread-scoped working memory for a specific session ID

Provide the complete working memory JSON, the session ID string, and leave User Options empty or set scope to 'thread'. The node updates the working memory in the specified session's row in the Postgres database.

Example 2: Update user-scoped working memory across all threads for a user

Provide the complete working memory JSON, the session ID, the User ID, and set Working Memory Scope to 'user'. The node updates the working memory in the user memory table keyed by User ID, persisting across conversation threads.

Links

Discussion