It turned out not to be too difficult to do what I believe is the right thing, in limabean at least.
The right thing in my view is to allow the duplicate include if and only if the include context of tags and metadata is identical.
This is now implemented on main branch of limabean, although not yet in an official release. (I have some work to finish on plugins before making a new release.)
And for example:
kiri> limabean --beanfile examples/beancount/multiple-includes.beancount
[Rebel readline] Type :repl/help for online help info
[limabean] 5 directives loaded from examples/beancount/multiple-includes.beancount
user=> (show (journal))
2014-01-27 Income:Donations Donations -100.00 NZD -100.00 NZD
2014-01-27 Assets:Common Donations 100.00 NZD
2014-02-05 Income:Work Work -750.00 NZD -750.00 NZD
2014-02-05 Assets:Common Work 750.00 NZD
:ok
kiri> limabean --beanfile examples/beancount/multiple-includes-different-context.beancount
[Rebel readline] Type :repl/help for online help info
Error: duplicate include
╭─[ examples/beancount/multiple-includes/included-2.beancount:1:9 ]
│
1 │ include "common.beancount"
│ ─────────┬────────
│ ╰────────── context #include-2
│
├─[ examples/beancount/multiple-includes/included-1.beancount:1:9 ]
│
1 │ include "common.beancount"
│ ─────────┬────────
│ ╰────────── context #include-1
───╯
This was pretty easy to implement in limabean's Rust parser as the codebase is still quite fresh, and, well, Rust.
Hoping that someone will be able to enjoy this. And that someone else might be able to add a similar implementation for OG Beancount. 🤞