English not my native language maybe I not clearly write question.
Usually Sieve filter look like this.
If header contains something do this…
require "fileinto";
if header :contains "X-Spam" "Yes" {
fileinto "Junk";
}
When user mark message as Spam in Mail app, on message icon appears exclamation mark and word ‘Junk’. But mail headers does not change.

How to catch flags or event in SIeve script when user mark message as spam?
Could you please provide a simple example of such Sieve filter?
What should be in IF condition in the Sieve script to handle a message marked as spam?
require "fileinto";
if ??? {
fileinto "Junk";
}