Repository navigation
feat(memory): auto-index all harnesses on session end (debounced sweep) - #116
Merged
Merged
Conversation
The SessionEnd hook only indexed Claude Code, so other harnesses (codex/cursor/gemini/cline/amazon-q/opencode) were never picked up automatically — they required a manual `kit memory index`. runSessionEndIndex now sweeps ALL harnesses via indexAllHarnesses, but debounced: at most once per 6h, gated by a `.harness-sweep` marker file's mtime under the memory dir. The common path stays cheap (just the incremental Claude index of the just-ended session); the full multi-dir sweep runs only when due. Deliberately NOT added to the SessionStart hot path. Fail-open throughout: if we can't read the marker we skip the sweep rather than add latency, and a missed marker just means we sweep next time. ensureMemoryDir is now exported for the marker writer (0o600). Test covers the debounce: due when no marker, not due for 6h after a sweep, due again once the interval elapses. Full suite 1537/0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
|
✅ Docker image built successfully
|
Closed
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes item 3 from the OpenCode/memory follow-ups: get all harnesses indexed automatically, without paying for it on every session.
Problem
The SessionEnd hook (
runSessionEndIndex) only ranindexClaudeTranscripts. The other harnesses (codex/cursor/gemini/cline/amazon-q, and OpenCode once #115 lands) have no kit hook, so they were only indexed when a user manually rankit memory index.Fix — debounced sweep, not hot-path
runSessionEndIndexnow runs the fullindexAllHarnesses, but debounced to at most once per 6h, gated by a.harness-sweepmarker file's mtime under the memory dir:ensureMemoryDiris exported for the marker writer (written0o600).This was the design choice flagged earlier — periodic background-style sweep rather than walking six extra dirs on every session end.
Test: debounce logic (due when no marker; not due for 6h after a sweep; due again once the interval elapses). Full suite 1537/0. Independent of #115 (composes with it — once #115 merges, the sweep picks up OpenCode too).
🤖 Generated with Claude Code
https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
Generated by Claude Code