I use the Memory app for time-tracking at work (at their request). It’s pretty helpful and saves me from having to remember what I’ve spent my time on during the day.

By default however it collects a tonne of data, including URLs of pages visited, and window titles.

This data is meant to be 100% private, not even accessible to my employer, but I’d rather it wasn’t uploaded to begin with.

It is possible to setup rules to customise what data is collected, however this is a timely (😉) process and pretty much as to be done on an app-by-app basis.

After some poking around I found that Memory uses a SQLite database and stores these rules in the privacy_rules table.

e.g.

idsequence_numberdefinition
8FBE81DE-BCDD-4A5B-8050-DEFDDC636F5710{“condition”:{“fields”:[“AppName”],“matcher”:“Contains”,“value”:“Firefox”},“action”:{“type”:“Ignore”}}
6F6478AD-449C-4458-8802-010C391F1D0520{“condition”:{“fields”:[“AppName”],“matcher”:“Contains”,“value”:“IINA”},“action”:{“type”:“Ignore”}}
078566E8-674F-4E55-B9E3-0FD7C4B2783A30{“condition”:{“fields”:[“AppName”],“matcher”:“Contains”,“value”:“Alfred 5”},“action”:{“type”:“Rewrite”,“app_name”:“Alfred 5”,“window_title”:“Alfred 5”,“url_or_document”:“https://Alfred 5”}}
B6DD287A-BB6C-45D6-BDAB-1078B3C33DA240{“condition”:{“fields”:[“AppName”],“matcher”:“Contains”,“value”:“Amphetamine”},“action”:{“type”:“Rewrite”,“app_name”:“Amphetamine”,“window_title”:“Amphetamine”,“url_or_document”:“https://Amphetamine”}}

My settings were located in : /Users/Andrew/Library/Application Support/com.TimelyApp.Memory/db.sqlite

I wrote a shell script that

  • Sets ignore rules for a few applications I know are unlikely to be work related
  • Sets rewrite rules for every other Application in the /Applications folder.

This works for me as I generally can remember/atrribute what I was working on to the application I was using, without needing the additional detail Memory collects.

seq_num=10

# Remove all existing entries from the privacy_rules table
sqlite3 /Users/ausdrew/Library/Application\ Support/com.TimelyApp.Memory/db.sqlite "DELETE FROM privacy_rules;"

#Ignored Applications
ignored=("Firefox" "IINA" "Amphetamine" "Music" "Messages" "Notes" "TV" "FaceTime" "Textual" "Java")

for app_name in "${ignored[@]}"; do
    # Generate the insert statement
    
    insert="INSERT INTO privacy_rules (ID, sequence_number, definition) VALUES ('$(uuidgen)', $seq_num, '{\"condition\":{\"fields\":[\"AppName\"],\"matcher\":\"Contains\",\"value\":\"$app_name\"},\"action\":{\"type\":\"Ignore\"}}');"
    
    # Execute the insert statement
    sqlite3 /Users/ausdrew/Library/Application\ Support/com.TimelyApp.Memory/db.sqlite "$insert"
    
    # Increment the sequence number
    seq_num=$((seq_num+10))
done

# Find all .app files in /Applications and its subdirectories
find /Applications -name "*.app" -type d | while read app; do
  # Get the application name
  app_name=$(basename "$app" .app)

  # Generate the insert statement
  insert="INSERT INTO privacy_rules (ID, sequence_number, definition) VALUES ('$(uuidgen)', $seq_num, '{\"condition\":{\"fields\":[\"AppName\"],\"matcher\":\"Contains\",\"value\":\"$app_name\"},\"action\":{\"type\":\"Rewrite\",\"app_name\":\"$app_name\",\"window_title\":\"$app_name\",\"url_or_document\":\"https://example.com\"}}');"

  # Execute the insert statement
  sqlite3 /Users/ausdrew/Library/Application\ Support/com.TimelyApp.Memory/db.sqlite "$insert"

  # Increment the sequence number
  seq_num=$((seq_num+10))
done