provenance plugin

Fixes #242.

- [ ] add tests, fix style
- [ ] get and address feedback
A `for` loop with `break` would be more efficient here, and probably more readable.