How best to debug Applescripts running inside DT3

You can’t. Only AppleScript is supported in the smart rule’s Execute Script action.

Also, the solution is much simpler than all that :slight_smile:
Use this form in Script Editor and you can test the Execute Script function on a selection…

tell application id "DNtp"
set sel to (selection as list)
my performSmartRule(sel)
end tell

on performSmartRule(theRecords)
tell application id "DNtp" 
repeat with theRecord in theRecords 
-- Do stuff
end repeat 
end tell 
end performSmartRule