diff --git a/skills/org-skill-chat.org b/skills/org-skill-chat.org index 36c72a3..78cddb8 100644 --- a/skills/org-skill-chat.org +++ b/skills/org-skill-chat.org @@ -54,14 +54,18 @@ Interfaces for conversational event handling and UI integration. Source of truth (defun chat-archive-message (text &key (role :user) channel chat-id) "Archives a chat message into the persistent Memory and triggers a snapshot." (let* ((msg-id (org-id-new)) + (attributes `(:role ,role :channel ,channel :chat-id ,chat-id :timestamp ,(get-universal-time))) + (hash (compute-merkle-hash msg-id :CHAT-MESSAGE attributes text nil)) (obj (make-org-object :id msg-id :type :CHAT-MESSAGE - :attributes `(:role ,role :channel ,channel :chat-id ,chat-id :timestamp ,(get-universal-time)) + :attributes attributes :content text + :hash hash :version (get-universal-time)))) + (setf (gethash hash *history-store*) obj) (setf (gethash msg-id *memory*) obj) - (harness-log "CHAT - Message archived: ~a (~a)" msg-id role) + (harness-log "CHAT - Message archived: ~a (~a) [Hash: ~a]" msg-id role (subseq hash 0 8)) (snapshot-memory) msg-id))