So, what's the reason you want to clear recent apps?
1 - to save memory? (that's usually not necessary I'll bet you'd agree),
2 so you don't have so many apps to scroll through to find a recent one?
If #2 is that case, I have a different solution which doesn't do what you want but gives another tool to launch apps quickly that'll make you forget you ever needed recent apps to launch apps: A gesture launcher like swipepad.
https://play.google.com/store/apps/details?id=mobi.conduction.swipepad.android
Gives you the ability to set up a large number of quick intuitive gestures which can launch pretty much any app or shortcut starting from almost any app. Doesn't replace your regular "launcher"... it just sits in the background waiting for you to ask it to do something. How does it work? It takes advantage of the fact that almost no apps use the very edge of the screen. So you use a swipe from off-screen to on-screen to initiate a gesture that it recognizes (and it jumps in front of the app you were using before because that app didn't care about the edge of the screen). It does have tweaks to adjust how large the target area at the edge of the screen is. And it has a blacklist of apps where it won't activate (in case you find regular use of the app interferes with swipepad or launches swipepad unintentionally)... I haven't found the need to blacklist any apps.
The base app is free. If you like it you'll want the "more space" add on for a couple bucks to give you ability to set up a lot more app shortcuts (you can assign a different swipepad screen for each of the different edge zones of the screen) . And maybe you'll want to buy the shortcut add-in for a couple more bucks so you can easily launch "shortcuts" like for example tasker tasks.
You have to try it to understand / believe it. I might make a video demo of it sometime. (I'm not affiliated with the app... just like it a lot).
Sorry if I missed your objective. I realize people have different preferences and usually want what they ask for, not what someone else tells them they should want ;-)