refactor(conversation-memory): V3 redesign - 3-hook architecture - #463
Merged
Conversation
… architecture Adds end-to-end integration tests covering: - PostToolUse → pending_events → Stop → observations workflow - SessionStart hook injection with token budgeting - MCP tools (search, get_observations) with V3 database - Full lifecycle from tool events to observations to search/injection - Batch processing with context carryover between batches - Multi-project isolation and concurrent session handling - Error handling (LLM failures, malformed responses, rate limits) Test coverage: - 18 new integration tests - 603 total tests passing - All component interactions verified Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix mock setup for LLM provider to properly type vitest mock function - Remove unused imports: searchObservationsV3, getPendingEventCountV3, mockEmbedding The mock function now returns a type that includes both LLMProvider and the vitest mock function properties, allowing proper access to mock.calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use __mockFn.mock.calls instead of __mockFn.calls to properly access vitest mock call history. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughA comprehensive integration test suite for the V3 architecture is added, exercising end-to-end workflows, session injections, MCP tool integration, batch processing, threshold-based extraction, filtering, and error handling scenarios with mocked LLM providers and in-memory SQLite. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
Complete redesign of conversation-memory plugin from complex observer daemon architecture to simplified 3-hook architecture.
Key Changes
Architecture Simplification:
New Components:
db.v3.ts- Clean slate database schema (pending_events + observations)compress.ts- Rule-based tool compression (no LLM)observations.v3.ts- Simplified CRUD operationsbatch-extract-prompt.ts- LLM batch extraction for Stop hooksearch.v3.ts- Observation-only searchpost-tool-use.ts- Hook to store compressed eventsstop.ts- Hook for batch LLM extraction at session endsession-start.ts- Hook for token-budgeted injectionread.ts- Raw conversation access from JSONLLegacy Files Deleted:
49 files (~16,000 lines) including:
parser.ts,sync.ts,tool-compress.tsobserver.ts,observation-prompt.tsround-robin-provider.ts3 New Hooks:
MCP Server Simplified to 3 Tools:
search- Single query, returns compact observations (Layer 1)get_observations- Full details by ID array (Layer 2)read- Raw conversation from JSONL (Layer 3)Test Plan
Breaking Changes
Config file format changed:
Old format:
{ "provider": "gemini", "gemini": { "apiKeys": ["key1", "key2"], "model": "gemini-2.0-flash" } }New format:
{ "apiKey": "your-gemini-api-key", "model": "gemini-2.0-flash" }Database migration:
🤖 Generated with Claude Code
Summary by CodeRabbit