Skip to content

feat(cohort-mcp): retention and recovery - #109

Merged
evdatsion merged 1 commit into
mainfrom
claude/p6-3-retention-recovery
Oct 20, 2026
Merged

evdatsion merged 1 commit into
mainfrom
claude/p6-3-retention-recovery

Conversation

@evdatsion

Copy link
Copy Markdown
Member

What this does

Adds retention and recovery on top of git history.

  • Because no record is ever hard-deleted, a removed or superseded record keeps its full content in git. cohort recover --vault <dir> <id> reads the record's last-existing version from history and, with --write, restores it to the working tree for a human to review and commit.
  • cohort retention --vault <dir> lists records removed from the working tree and flags whether each is still within the configured recovery window (.cohort/retention.yml, default 365 days).
  • Recovery guards against a path that once held a different record: it parses the recovered content and refuses if the id does not match.

Closes #67.

Security

The retention window is a guaranteed recovery period, not an expiry: nothing here rewrites or prunes git history, so a record is never destroyed by this feature, only reported as inside or beyond the window (and it stays in git either way). Recovery writes into the working tree but never commits, so a restore is a reviewable proposal rather than a silent change, consistent with the rest of Cohort. The id guard prevents recovering the wrong record when a path has been reused.

Tests

Eight new tests: pathForId mapping, the retention-window calculation, config parsing with a default and bad-input rejection, recovering a removed record (reporting the removal and then restoring it), reporting a still-tracked record, not-found for an id with no history, and listRemoved finding a removed record and flagging the window under both a normal and a zero-day policy. Full suite: 160 tests, 159 pass, 1 skipped (real-gitleaks). Build, lint, audit clean; local redaction scan clean.

Cohort never hard-deletes a record, so a removed or superseded record keeps its
full content in git history. cohort recover restores a record by id from
history into the working tree for a human to review and commit, guarding against
a path that once held a different record. cohort retention lists records removed
from the working tree and flags whether each is still within the configured
recovery window (.cohort/retention.yml, default 365 days).

Nothing here rewrites or prunes git history; the retention window is the
guaranteed recovery period, not an expiry that destroys anything.

Closes #67

Signed-off-by: evdatsion <31140661+evdatsion@users.noreply.github.com>
@evdatsion evdatsion added this to the Phase 6 milestone Oct 20, 2026
@evdatsion evdatsion added phase-6 Phase 6: enterprise (hold) type:feat New feature labels Oct 20, 2026
@evdatsion
evdatsion merged commit b07f209 into main Oct 20, 2026
4 checks passed
@evdatsion
evdatsion deleted the claude/p6-3-retention-recovery branch October 20, 2026 15:22
@evdatsion evdatsion mentioned this pull request Oct 20, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase-6 Phase 6: enterprise (hold) type:feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P6-3 feat: retention and recovery

1 participant