Could be detonation, as flipside indicated. Commonly cured with Av gas or head mod or leaded race gas or new crank seals.
If the piston is a forged piston, they are typically noisier than the stock cast piston, especially on startup and once the cylinder clearance starts to open up. Could be time for a top end and check the rod for play while you're in there.
You can always remove the flywheel cover and check the crank for play on the left side.
My YZs were all pretty noisy at idle with the clutch out/released. Clutch lash was basically non-existent as soon as I pulled in the clutch.
If you happen to have the clutch cover off, check that the primary drive gear bolt is still tight. If it backs out you'll hole the clutch cover, loose your oil and probably DNF. As the bolt is back out, you'll notice some more rattles and vibes.