Some tasks, when complete, still offer helpful contextual information for sibling/parent tasks. I like keeping those around for awhile.
Other tasks, when complete, are no longer of any use.

Therefore I’d like a way to archive some done tasks, but not others.
Any of the following would suffice:
Archive @done tasks which are currently selected.
Archive @done tasks which match the current search.
Archive the current line and it’s child nodes (recursive).

Done gives the date. Done-keep doesn’t. At some point I’d want to selectively move some done-keeps to done and archive. Your solution won’t work for me.

My request is to solve a deeper problem, which is: if you have a hierarchical todo, and complete a child and archive it, it loses it’s context. If you complete all and archive, the hierarchy is archived together. For that reason I wanted to avoid archiving hierarchies until the whole thing is done.

I should have mention that making the shortcut was to be done in one of the keyboard applications like, textexpander, alfred, keyboard maestro, etc. that easily add the date to you done-keep tag.

If you don’t feel like buying a new app to accomplish just this, you should give HammerSpoon a look. It is free and uses Lua. You could easily do it there too.

About the deeper problem, if you don’t ask, you don’t receive. Explain the feature you want, why you want it, and why you think other people might want it; and it might be implemented if the developer sees the need. Again, that might or not might happen, but this way you can get it done tonight

My request is to solve a deeper problem, which is: if you have a hierarchical todo, and complete a child and archive it, it loses it’s context. If you complete all and archive, the hierarchy is archived together. For that reason I wanted to avoid archiving hierarchies until the whole thing is done.

Of course everything in TaskPaper is a hierarchy, so we need to set some limiting context first. How about this for a rule: “Only archive @done tasks when all subtasks and ancestor tasks are also marked @done”. This limits the archive and conditions to “tasks”.

For example in this case the @done item would get archived:

one
- two @done

But in this case the @done item would not get archived since it has an ancestor task that isn’t also @done:

- one
- two @done

I don’t think that I would necessarily like to build this into TaskPaper, since the logic is somewhat complicated. But I agree it would be useful once understood, and could make for a nice script.

Here’s a item path that you can use to “I think” select only the items that you want to archive:

//task @done except task not @done/ancestor-or-self::task///*

Please try it out and let know if it works as you want. It should only select tasks where all descendent and all ancestor tasks are also @done. (Plus since it’s displaying in the editor it will also show ancestors for context, but the archive function would only archive the root tasks, not the ancestors other items that it contains.