コンテンツにスキップ

LTM Sub-Pipeline

このコンテンツはまだ日本語訳がありません。

Handles persistent, database-backed memory writes initiated by the LLM via tool calls during the tool-loop. Two tools cover the full CRUD surface:

StageFileTool nameWhat it does
01-ltm-create.mdMemoryToolcreate_long_term_memoryInserts a new server or personal memory record
02-ltm-update-delete.mdUpdateLongTermMemoryToolupdate_long_term_memoryReplaces or deletes an existing memory by its ID:N
  • Feature-flagged: both tools require self_teaching_enabled = true in TomoriState.config. When disabled, the tool returns a user-reportable error without writing to the DB.
  • Persona-lineage scoping: all DB writes use persona_lineage_id, not persona_id, so memories are shared across all personas of the same character lineage (different server instances of the same persona still see each other’s memories).
  • Cache invalidation on success: every successful write immediately invalidates the relevant TomoriState or user cache so the next context-build reads fresh DB state.
  • Dual scope: memories are either server_wide (stored in server_memories, keyed by server_id + persona_lineage_id) or target_user (stored in personal_memories, keyed by user_id + persona_lineage_id).
  • Template placeholders: content must use {user} and {bot} tokens instead of hardcoded names. Both tools strip unknown brace-wrapped tokens (e.g. {obonya}) via sanitizeUnknownTemplatePlaceholders() before the DB write.