Feat/deterministic vouch sync#91
Conversation
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughAdds JSON-capable proposal listing and an interactive review CLI; implements read-only artifact diffs; introduces deterministic sync-check/sync-apply for KB directories or bundles with conflict policies; hardens storage reads and normalizes page line endings; updates docs and adds tests covering these flows. ChangesNew CLI commands and core infrastructure
Sequence Diagram(s)sequenceDiagram
participant Client
participant diff_artifacts
participant KBStore
Client->>diff_artifacts: old_id, new_id
diff_artifacts->>KBStore: resolve old_id (claim or page)
diff_artifacts->>KBStore: resolve new_id (claim or page)
diff_artifacts->>diff_artifacts: validate same kind
diff_artifacts->>diff_artifacts: compute field changes (scalar/list)
diff_artifacts->>diff_artifacts: compute unified text diff
diff_artifacts->>Client: ArtifactDiff (changes, text_diff)
sequenceDiagram
participant Source as Source KB/Bundle
participant sync_check
participant sync_apply
participant LocalKB
Source->>sync_check: incoming files
sync_check->>LocalKB: compare (new/identical/conflict)
sync_check->>sync_check: classify conflicts (semantic/decided)
sync_check-->>Source: SyncCheckResult
Source->>sync_apply: on_conflict policy
sync_apply->>LocalKB: validate source issues
alt conflict detected and on_conflict=fail
sync_apply-->>Source: RuntimeError
else new or identical file
sync_apply->>LocalKB: revalidate hash and content
sync_apply->>LocalKB: write file
else conflicting and on_conflict=propose
sync_apply->>LocalKB: write conflict report JSON
end
sync_apply->>LocalKB: audit.log_event()
sync_apply-->>Source: operation summary
sequenceDiagram
participant User
participant pending_cmd
participant review_cmd
participant KBStore
User->>pending_cmd: vouch pending [--json]
pending_cmd->>KBStore: list proposals by status
alt --json
pending_cmd->>User: JSON array of proposals
else text
pending_cmd->>User: formatted proposal list
end
User->>review_cmd: vouch review [--limit] [--type] [--dry-run]
review_cmd->>KBStore: fetch proposals
loop each proposal
review_cmd->>User: render proposal preview
User->>review_cmd: approve/reject/skip/quit
alt --dry-run
review_cmd->>User: Would approve/reject
else live
review_cmd->>KBStore: update proposal status and claim
end
end
review_cmd->>User: completion summary
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Really nice work — the sync logic is careful in the right ways (reuses the bundle safety checks, re-verifies hashes at write time, never overwrites conflicts), and the tests cover the main paths. Three things before merge:
Minor, non-blocking: on Windows the Thanks for tackling the multi-agent story! 🙏 |
200114d to
53d148a
Compare
|
@plind-junior Done. |
|
Create the PR against the test branch |
53d148a to
a764129
Compare
|
@plind-junior Done |

What changed
Added a CLI-only deterministic sync workflow for reconciling another
.vouchdirectory or exported bundle.vouch sync-checkreports new, identical, and conflicting files without writing, whilevouch sync-applyimports only non-conflicting files and supports--on-conflict fail|skip|propose. Theproposemode writes a local conflict report underproposed/sync-reports/for human review.Closes #90
Why
This closes the biggest gap in the distributed multi-agent story: separate agents, teammates, branches, or repos can now converge reviewed knowledge without relying only on git conflicts or manual bundle import interpretation. It keeps the review-gated model intact by refusing to silently overwrite divergent approved artifacts.
What might break
This is additive. Existing
.vouch/files do not move, and no on-disk artifact fields change shape. Nokb.*methods are added or changed because the feature is CLI-only. Bundle format is unchanged.One compatibility fix was included: page frontmatter parsing now tolerates CRLF line endings, and
read_under_rootno longer assumesos.O_NOFOLLOWexists on Windows.VEP
This adds CLI surface but does not change object model,
kb.*methods, on-disk layout, bundle format, or audit-log event shape beyond adding a newsync.applyevent. If CLI surface changes require a VEP for this repo, this should be backed by one before merge.Tests
make checkpasses locally (lint + mypy + pytest)CHANGELOG.mdupdated under## [Unreleased]Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests