Add Phase 4C Adaptive Memory Intelligence (classification, redaction, embeddings, retrieval, MCP & REST) - #103
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 40 minutes and 51 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughAdds Phase 4C adaptive memory tables, service layers for redaction/classification/retrieval/persistence, new API routes and MCP tools, updated admin status pages and OpenAPI paths, plus supporting docs and tests. ChangesPhase 4C adaptive memory intelligence
Sequence Diagram(s)sequenceDiagram
participant NextRequest
participant SearchRoute as "POST /api/memory/search"
participant BridgeHelper as "withBridge(request)"
participant RetrievalService as "getHybridMemoryContext"
participant MemoryBridgeDbClient
NextRequest->>SearchRoute: POST body
SearchRoute->>BridgeHelper: withBridge(request)
BridgeHelper-->>SearchRoute: principal, client
SearchRoute->>RetrievalService: getHybridMemoryContext(client, input)
RetrievalService->>MemoryBridgeDbClient: query memory tables
MemoryBridgeDbClient-->>RetrievalService: rows
RetrievalService-->>SearchRoute: data and warnings
SearchRoute-->>NextRequest: JSON response
sequenceDiagram
participant MCPClient as "MCP client"
participant PandoraMcpServer as "createPandoraMcpServer"
participant AdaptiveContextTool as "getAdaptiveContextTool"
participant ContextService as "buildAdaptiveChatGptContext"
participant RetrievalService as "getHybridMemoryContext"
participant AuditLog as "auditPandoraMcpToolCall"
MCPClient->>PandoraMcpServer: request get_adaptive_context
PandoraMcpServer->>AdaptiveContextTool: dispatch rawInput
AdaptiveContextTool->>ContextService: buildAdaptiveChatGptContext(...)
ContextService->>RetrievalService: getHybridMemoryContext(...)
RetrievalService-->>ContextService: context
AdaptiveContextTool->>AuditLog: audit tool call
AdaptiveContextTool-->>PandoraMcpServer: data and warnings
PandoraMcpServer-->>MCPClient: JSON content
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)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d7cfaa5be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Motivation
PANDORA_ENABLE_MODEL_CALLSandPANDORA_ENABLE_EMBEDDINGSwithout exposing secrets or breaking existing Phase 4A/4B flows.Description
lib/services/memory-redaction-service.ts) to prevent secrets from reaching model/embedding providers.lib/services/memory-classification-service.ts,lib/services/memory-model-provider.ts) that is gated and falls back to deterministic output when models are not enabled.lib/services/memory-embedding-service.tsand provider shim).user_id+namespace(lib/services/*), plus an adaptive ChatGPT context builder (lib/services/adaptive-chatgpt-context-service.ts)./api/memory/adaptive/*,/api/memory/search, and/api/memory/profiles/refresh, and extends MCP tools with adaptive tools (lib/services/pandora-mcp-tools.ts,lib/services/pandora-mcp-server.ts).memory_capture_candidates,memory_profiles,memory_embeddings(pgvector),memory_session_digests,memory_open_loops, model/retrieval logs, indexes and user-scoped RLS (supabase/migrations/20260627040000_phase_4c_adaptive_memory_intelligence.sql).docs/phase-4c-*.md), tests for redaction/classification/embeddings, and updatespublic/pandora-memory-openapi.jsonwith adaptive endpoints.Testing
npm installandnpm run typecheckwith no type errors.npm run lintwhich passed but left three non-blocking warnings (unused symbols / anonymous default export) that are informational only.npm run testwhere the full test suite passed: 77 test files / 463 tests all green (including the new Phase 4C unit tests).npm run buildwhich completed successfully; the build produced Next.js runtime warnings about Supabase usage in Edge contexts and standard lint warnings, but completed the production build.Limitations: live external model calls are not wired yet (provider abstraction currently returns deterministic fallback until a provider is configured), and semantic vector retrieval returns no semantic matches until a vector query integration is enabled and
PANDORA_ENABLE_EMBEDDINGS/PANDORA_ENABLE_SEMANTIC_RETRIEVALare turned on.Codex Task
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests