feat:Add Policy-Based Memory Storage, Retrieval, and Chat Integration#284
Open
esafwan wants to merge 26 commits into
Open
feat:Add Policy-Based Memory Storage, Retrieval, and Chat Integration#284esafwan wants to merge 26 commits into
esafwan wants to merge 26 commits into
Conversation
- Phase 2: Policy enforcement, injection boundaries, auto-promotion - Phase 3: Post-run extraction with Learning Agents via Frappe background jobs - Phase 4: Formalized Memory Profiles and dedicated extraction agents - Phase 5: Hybrid search (RRF) via sqlite_hybrid and advanced JSON metadata filtering
Refactors the app layout to use a secondary internal sidebar for Knowledge and Settings pages.
Reverts the broken InnerSidebarLayout approach and implements proper in-sidebar sub-navigation using ShadCN Collapsible pattern for Knowledge and Settings pages.
…ge-memory-merge # Conflicts: # huf/install.py
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.
Overview
This PR represents a comprehensive integration that brings both the advanced backend Scoped Memory Architecture (merged from
feature/scoped-memory-implementation) and a completely overhauled Dynamic Two-Level Navigation & Sidebar System together with high-fidelity frontend UI dashboards and live chat integrations.It provides agents with transparent, policy-governed memory recall/saving mechanisms, adds a full-featured Memory Management Dashboard, and introduces responsive, Linear-style accordion and flyout popover sidebar rails for high-end aesthetic value and intuitive user navigation.
Key Components
1. Scoped Memory Backend & DB Framework
Memory RecordandMemory Policydoctypes.Conservative,Conversational,Research,Operational) that specify records capacity, token budgets, visibility checks, auto-promotions, and approval steps.save_memory_record: Performs validation against active agent policy constraints (allowed record types, confidence, importance scores).search_memory_records: Implements hybrid searching across scopes (User,Agent,Conversation,Site,Global) ordered by importance/recency.get_memory_recordandarchive_memory_record: Governs secure retrieval and archiving.promote_memory_to_knowledge: Seamlessly projects structured memory chunks to semantic sqlite-fts or Chroma vector spaces.run_background_memory_extractionscheduled automatically at the end of each message stream to ingest new facts and preferences asynchronously.2. High-Fidelity Memory UI & Chat Integration
/memory): Built a fully responsive page under the Knowledge submenu that displays all active memories using unified custom cards.MemoryCard.tsx): Integrates visual badges and unique icons tailored to the specific memory category (Fact, Preference, Instruction, Context, Reflection), shows importance scores, confidence gauges, and supports immediate archive operations with smooth micro-animations.MemoryContextBadge.tsx): Injected context badges withinChatMessage.tsxdisplaying next to response timestamps. Clicking the badge opens a lazy-loaded popover detailing the exact facts or preferences the AI utilized to construct its personal reply.3. Dynamic Two-Level Navigation Sidebar
app-sidebar.tsx): Restructured navigation hierarchy by grouping the table builder (Tables), file ingestion (Documents), and memory into a single, cohesive "Knowledge" section.nav-main.tsx): Implemented a smooth accordion control where expanding one section (e.g., Settings) automatically collapses any other active group, avoiding cluttered navigation rails.Verification & QA
yarn buildon host with zero errors. All type definitions, schemas, popover handlers, and API states are 100% correct.bench buildcleanly linking frontend distribution bundles to Frappe's public assets.bench run-tests --app hufsuite in the devcontainer, returning 100% success on all database integration, backend knowledge tool, and schema validations.save_memory_recordto create aPreferenceuser memory, which successfully persisted to MariaDB under user scope.search_memory_recordsmatching the custom query and confirming importance-sorted returns.archive_memory_recordsetting the record state toArchivedsafely.