A bug in the PostToolUse hook causes excessive duplication of observations in the database, with each tool use creating 6-10 identical records instead of one. Despite efforts to clean up 51,140 duplicate entries and leave only 6,098 unique observations, the issue reoccurs immediately after new tool usage. Investigation confirms there is only one registered PostToolUse hook, and no additional configuration anomalies, indicating the problem likely lies in the worker-service.cjs file, which lacks deduplication logic in the observation creation pipeline. Evidence includes screenshots of identical entries and cleanup scripts identifying duplicate groups. The suggested fix involves introducing hash-based or time-window deduplication before inserting observations into the SQLite database to ensure each tool use results in a single, unique record.
Originally posted by @github-actions in thedotmack/claude-mem#1158 (comment)