Skip to content

[STAGING — DO NOT MERGE AS-IS] retrieval port + open-core scaffolds (split into reviewable PRs)#297

Draft
ohdearquant wants to merge 1 commit into
mainfrom
staging/2026-05-22-open-core-scaffold-and-retrieval-port
Draft

[STAGING — DO NOT MERGE AS-IS] retrieval port + open-core scaffolds (split into reviewable PRs)#297
ohdearquant wants to merge 1 commit into
mainfrom
staging/2026-05-22-open-core-scaffold-and-retrieval-port

Conversation

@ohdearquant
Copy link
Copy Markdown
Owner

⚠️ STAGING BRANCH

Do not merge this PR as-is. This is a staging snapshot for tomorrow's review. Ocean and λ_khive will split this into individually reviewable PRs per concern before any merge to main.

What's in this snapshot

1. Retrieval port from khive-internal/platform/retrieval

Verified, formally-proof-paired implementation ported into OSS as 4 separate crates (one crate ↔ one proof tree):

  • khive-hnsw — HNSW with INT8 quantized two-phase search (~9K LOC + tests)
  • khive-bm25 — Okapi BM25 with deterministic scoring (~5K LOC + tests)
  • khive-fusion — RRF + Weighted + Union fusion strategies (~1.5K LOC + tests)
  • khive-retrieval — hybrid composer over the above (~12K LOC + tests)

Plus khive-fold/src/objective/registry.rs (NEW — ObjectiveRegistry<T> for dynamic objective dispatch; adapted to OSS Selection.item API; parking_lot dep added to khive-fold).

Tests: ~627 across the new code; cargo check --workspace clean.

2. Open-core scaffolds for pack-comm / channel / calendar / skills

Doc-comment-only scaffolds; impl is tomorrow's work. Strategy locked in a separate decision record (local working note, not in this PR).

Crate Role
khive-pack-comm Communication verb pack (declares note_kind=message)
khive-pack-skills Skills verb pack (agent-discoverable directives)
khive-channel ChannelHandler trait + envelope types
khive-channel-gmail Gmail reference impl
khive-channel-macos-mail Mail.app via AppleScript / MailKit (local-first)
khive-channel-macos-imessage Messages + iMessage via chat.db
khive-calendar CalendarHandler trait + event envelope types
khive-calendar-google Google Calendar reference impl

Preserved AppleScript reference impls (mail_bridge.applescript, cal_bridge.applescript, test_mail_sync.sh) live under the respective crate's docs/reference/ for tomorrow's wiring pass.

3. Workspace update

crates/Cargo.toml registers the 12 new crates.

Suggested PR split for tomorrow

Each of these can land as its own PR with focused review:

  1. khive-fold registry port — adds ObjectiveRegistry<T> + parking_lot dep. Tiny, lowest-risk first.
  2. Retrieval port (4 crates)khive-hnsw + khive-bm25 + khive-fusion + khive-retrieval. Largest. Could optionally split further by crate.
  3. Channel surfacekhive-channel + khive-pack-comm. Trait + pack that consumes it.
  4. Channel reference implskhive-channel-gmail + khive-channel-macos-mail + khive-channel-macos-imessage. Three impls of the same trait; could be one PR or three.
  5. Calendar surfacekhive-calendar + khive-calendar-google. Mirrors the channel pattern.
  6. Skills packkhive-pack-skills. Smallest scaffold, independent.

Test plan

  • cargo check --workspace — verified clean locally before push
  • cargo test --workspace for retrieval crates — verified ~627 tests pass locally
  • Review trait surfaces in tomorrow's session before any of the scaffolds get implementation
  • Confirm naming + pack vocabulary (note_kind=message, edge endpoint rules) before any pack-comm impl

🤖 Generated with Claude Code

…hannel / calendar / skills

STAGING BRANCH — for tomorrow's review and split into individually reviewable PRs.
Do not merge as a single PR; the intent is to break this down per concern.

What lands here:

1. Retrieval port from khive-internal/platform/retrieval (this session's earlier compact arc):
   - khive-hnsw (HNSW with INT8 quantized two-phase search; ~9K LOC + tests)
   - khive-bm25 (Okapi BM25 with deterministic scoring; ~5K LOC + tests)
   - khive-fusion (RRF + Weighted + Union fusion; ~1.5K LOC + tests)
   - khive-retrieval (hybrid composer over the above; ~12K LOC + tests)
   - khive-fold/src/objective/registry.rs (NEW — ObjectiveRegistry<T> for dynamic
     dispatch; adapted to OSS Selection.item API; parking_lot dep added)
   - Tests: ~627 across the new code; all green via cargo check --workspace

2. Open-core surface scaffolds (intent in doc comments; impl tomorrow):
   - khive-pack-comm     — communication verb pack (declares note_kind=message)
   - khive-pack-skills   — skills verb pack (agent-discoverable directives)
   - khive-channel       — ChannelHandler trait + envelope types
   - khive-channel-gmail               — Gmail reference impl
   - khive-channel-macos-mail          — Mail.app via AppleScript / MailKit
   - khive-channel-macos-imessage      — Messages + iMessage via chat.db
   - khive-calendar      — CalendarHandler trait + event envelope types
   - khive-calendar-google             — Google Calendar reference impl
   - Each lib.rs is doc-comment only; preserved AppleScript reference impls
     (mail_bridge.applescript, cal_bridge.applescript, test_mail_sync.sh) live
     under the respective crate's docs/reference/ for tomorrow's wiring pass.

3. Workspace update:
   - crates/Cargo.toml registers the 12 new crates

Strategy + decisions captured separately in .khive/notes/ (gitignored — local
working memory). Tomorrow's session will read those, split this branch into
focused PRs (retrieval, fold registry, comm scaffolds, channel scaffolds,
calendar scaffolds, skills), and merge per concern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant