From 5b6f4c18d17e0366ac6491c4c514007270aa4aca Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Fri, 17 Apr 2026 16:30:41 -0400 Subject: [PATCH] fix(audit): Ensure Chat Skill is Merkle-compliant and secure (Component IV) --- skills/org-skill-chat.org | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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))