View and restore earlier versions of bank directives
Use Case
An operator edits a standing rule in the control plane while an agent uses the same bank through MCP. Both can read the same version before either saves. We want to see which rule was in effect, recover from a mistaken edit or deletion, and catch an edit based on an outdated copy.
Problem Statement
The directive API exposes the current rule. If one client saves and the other later submits its older copy, the API has no revision precondition for detecting that conflict. After an accidental deletion, a client that kept the directive ID has no directive-history endpoint from which to recover its text, tags, priority, and active status.
How This Feature Would Help
An operator could recover a single rule while keeping later changes to other rules. A client that encounters a conflicting edit could show the latest version and let its user decide how to reconcile the two edits.
Proposed Solution
Return a revision with each directive. Record creates, edits, and deletions atomically with the rule change. Let an authorized client list earlier versions and restore one under the same directive ID. Restoration should create a new revision so the edit or deletion remains visible. Accept an optional expected revision on existing edit and delete calls, and return HTTP 409 when it is stale. Make these operations available through REST and MCP, with bank permissions applying to historical content as well.
Alternatives Considered
We previously kept rule files in Git. That gave us reviewable changes, but every writer had to go through the Git publisher for the history to be complete. Our control plane and agents already share a Hindsight bank.
Priority
Important - affects my workflow
Additional Context
In our tested Linux environment, we exercised the PostgreSQL implementation through MCP with a disposable rule. After an edit and deletion, we restored its original text under the same ID and could still inspect all four revisions. A separate REST edit based on the first revision returned HTTP 409. Existing rules start with a baseline at upgrade. This implementation covers PostgreSQL.