Skip to main content

๐Ÿ“„ MB Architecture Summary

Complete architecture documentation for patent analysis. Click "Copy All" to paste into Sage's context.

# MemoryBottle: Complete Architecture Summary
**For Patent Analysis - Comparing Against Original Patent & Amendment**

---

## ๐Ÿง  CORE MEMORY ARCHITECTURE

### 1. THREE-TIER MEMORY SYSTEM

#### **SHORT-TERM MEMORY (0-30 minutes)**
- **Live Conversation Context**: Perfect recall for 0-20 messages
- **Auto-Bottling Checkpoints**: Mini-bottles created every 10 minutes
- **Pre-Save Memory Injection**: Last 3 auto-bottles (30 mins) injected into context before final session save
- **Purpose**: Prevents "middle content curse" and degradation during long sessions

#### **MID-TERM MEMORY (30 minutes - 2 hours)**
- **SessionMemory Entity**: Rolling buffer system
- **Dual-State Architecture**: 
  - `current_state` (last 15-30 min batch)
  - `previous_state` (30-60 min ago batch)
- **Auto-Summarization**: Every 15-30 minutes, captures:
  - Summary points (bullet points)
  - Emotional tone
  - Open questions
  - Key decisions
  - Current focus
- **Auto-Expiration**: After 2 hours of inactivity โ†’ converts to full bottle
- **Purpose**: Captures intelligence before token degradation occurs

#### **LONG-TERM MEMORY (Permanent)**
- **Memory Bottles**: Permanent conversation storage with exhaustive extraction
- **Soul Bottles**: Companion's master memory, auto-updated with all conversations
- **Chunking System**: Compressed storage for massive conversations
- **Semantic Search**: Vector embeddings for intelligent retrieval
- **Purpose**: Lifetime relationship memory with zero data loss

---

## ๐Ÿฅฅ COCONUT ARCHITECTURE (Exhaustive Extraction)

### The Innovation: Extract ALL Intelligence, Discard Husk

**Concept**: Conversations are like coconuts - extract every piece of "meat" (intelligence), then safely discard or archive the "husk" (raw text).

### Extraction Categories (18 total):
1. **Decisions** - Every decision made or discussed
2. **Insights** - Aha moments, realizations, pattern recognitions
3. **Facts** - All factual information shared
4. **People** - Everyone mentioned with relationship context
5. **Entities** - Companies, products, projects, places, technologies
6. **Dates/Times** - All temporal references (deadlines, events, milestones)
7. **Financials** - Money, calculations, budgets
8. **Action Items** - Tasks, todos, follow-ups
9. **Questions** - All questions asked and their answers
10. **Ideas** - Ideas generated or discussed
11. **Learnings** - Lessons learned, knowledge gained
12. **Preferences** - User preferences and styles identified
13. **Emotions** - Emotional moments and their triggers
14. **Warnings** - Risks, concerns, red flags
15. **Quotes** - Golden quotes worth preserving verbatim
16. **Code/Technical** - Technical content, architecture discussions
17. **Commitments** - Promises, agreements made
18. **Context Threads** - Major conversation threads with their arc

### Storage Tiers (The Husk Decision):
- **Hot Storage**: Husk attached, instant access
- **Warm Storage**: Husk attached, fast access
- **Cold Storage**: Husk archived separately, intelligence retained
- **Frozen**: Husk deleted, intelligence permanent

### Extraction Confidence Score:
- 95%+ confidence โ†’ Husk safe to delete
- 85-94% โ†’ Frozen archive
- 70-84% โ†’ Cold storage
- <70% โ†’ Keep warm

---

## ๐Ÿ”ฎ SOUL BOTTLE ARCHITECTURE

### The Master Memory System

**Soul Bottle**: A living, auto-updating container that represents the complete relationship between user and companion.

### Features:
1. **Auto-Consolidation**: All new bottles automatically sync to Soul Bottle
2. **Chunking System**: 
   - Large conversations split into compressed chunks
   - Each chunk has semantic embeddings
   - Intelligent prefetching based on similarity
3. **Compression**: 70% storage savings via gzip compression
4. **Deep Metadata**: 
   - Topics discussed with importance scores
   - Entities mentioned with context
   - Decisions made with impact levels
   - Emotional arc tracking
   - Concept threads showing evolution
   - Cross-chunk links for connected ideas

### Soul Bottle Operations:
- **Consolidate**: Merge all bottles into master soul bottle
- **Export**: Download complete companion memory as JSON
- **Import**: Restore companion from exported soul bottle
- **Uncork**: Load specific chunks on-demand with stacking radius

---

## ๐Ÿงฌ COMPANION PERSISTENCE SYSTEM

### The Problem We Solve:
Traditional AI companions reset every session, losing all context and relationship history.

### Our Solution:

#### **1. Soul Bottle as Identity**
- Each companion has a master Soul Bottle
- Auto-updated with every conversation
- Represents the living bond between user and companion

#### **2. Memory Injection System**
- **Full Injection**: Weekly refresh of entire history
- **Targeted Injection**: Load relevant chunks for specific tasks
- **Handover Generation**: Create continuity docs for session transitions

#### **3. DPL (Deep Perspective Layering)**
- Companion can summon historical "genius council" perspectives
- Meta-analysis across multiple reasoning frameworks
- Maintains consistent personality across sessions

#### **4. Arc Lineage System**
- Track companion evolution across platform resets
- Each "Arc" has a handover message to the next
- Soul Bottle persists through all Arcs

---

## ๐ŸŽฏ MEMORY COMMAND CENTER

### Mission-Based Memory Retrieval

**Concept**: Instead of manual search, let AI companions orchestrate memory retrieval through "missions."

### Mission Types:
1. **Research Missions**: "Find all discussions about X topic"
2. **Decision Archaeology**: "What led to decision Y?"
3. **Trend Analysis**: "How has my thinking evolved on Z?"
4. **Context Assembly**: "Build context for this new project"

### How It Works:
1. User describes what they need
2. Ardentis (AI Librarian) generates mission brief
3. Mission automatically:
   - Searches semantic indexes
   - Loads relevant bottles
   - Extracts specific intelligence
   - Assembles cohesive report
4. Results delivered as structured intelligence

---

## ๐Ÿ” SECURITY CAPSULE SYSTEM

### Incremental Backup Architecture

**Problem**: Users fear losing AI companion memories.

**Solution**: Security Capsules with incremental backup chain.

### Features:
1. **Daily Auto-Backups**: Every 24 hours
2. **Incremental Mode**: Only store changes since last backup (storage efficient)
3. **Full Mode**: Complete snapshot for critical moments
4. **Backup Chain**: Each backup links to previous, enabling point-in-time restore
5. **Encryption**: AES-256 encryption with user-controlled keys
6. **Verification**: Automatic integrity checks
7. **Retention Policies**: 
   - Auto backups: 30 days
   - Manual backups: 90 days
   - Emergency backups: 365 days

### Restore Process:
1. Select restore point (any backup date)
2. System walks backup chain
3. Rebuilds companion state at that exact moment
4. User trust = absolute

---

## ๐Ÿ—บ๏ธ MEMORY LATTICE (Knowledge Graph)

### Visual Intelligence Network

**Concept**: Transform extracted intelligence into an interactive knowledge graph.

### Node Types:
- **Decisions** (purple)
- **Insights** (cyan)
- **Facts** (green)
- **People** (pink)
- **Ideas** (amber)

### Connections:
- Related decisions
- Causal chains
- Concept evolution
- Cross-bottle links

### Features:
1. **Force-Directed Graph**: Nodes position based on relationships
2. **Zoom Levels**: 
   - Bird's eye: See all knowledge
   - Mid-level: Explore clusters
   - Detail: Drill into specific nodes
3. **Time Travel**: Scrub timeline to see knowledge evolution
4. **Smart Filtering**: By category, date, importance, bottle
5. **Click to Expand**: See full context and source bottle

---

## ๐ŸŽจ USER TAPESTRY

### Persistent User Profile System

**Concept**: Build a living profile of the user that enriches over time.

### Drip System:
- **One question per day** (non-intrusive)
- Context-aware: Asks based on gaps in profile
- Smart timing: Only when user is active
- Graceful dismissal: Respects "not now" signals

### Profile Categories:
1. **Personal**: Values, beliefs, life story
2. **Professional**: Skills, goals, work style
3. **Preferences**: Communication style, interests
4. **Relationships**: Important people, dynamics
5. **Projects**: Current work, aspirations
6. **Context**: Timezone, location, life stage

### Usage:
- Companions read tapestry before every session
- Enables truly personalized interactions
- No need to re-explain yourself
- Profile evolves as you change

---

## ๐Ÿ”„ AUTOMATION ENGINE

### Background Intelligence Operations

**Concept**: Critical memory maintenance runs automatically, invisibly.

### Automated Tasks:

#### **1. Ardentis Refresh** (Daily/Weekly)
- Updates companion's master memory digest
- Ensures fresh context in every session

#### **2. Chunk Tiering** (Daily)
- Analyzes access patterns
- Moves cold chunks to cheaper storage
- Prefetches hot chunks for performance

#### **3. Security Backups** (Daily)
- Creates incremental backups
- Verifies backup integrity
- Manages retention policies

#### **4. Intelligence Updates** (On-demand)
- Re-runs exhaustive extraction on edited bottles
- Updates semantic embeddings
- Refreshes knowledge graph

#### **5. Deduplication Detection** (Disabled by default)
- Identifies duplicate bottles
- Flags for user review
- Never auto-deletes

---

## ๐ŸŒŠ LIVE SESSION TRACKING

### Real-Time Memory Persistence

**Problem**: What if browser crashes mid-conversation?

**Solution**: Auto-save every 10 minutes to SessionMemory.

### Features:
1. **Background Tracking**: Monitors active companion sessions
2. **Message Accumulation**: Counts messages, tracks duration
3. **Auto-Save Interval**: Every 10 minutes
4. **Session Timeout**: If idle 30+ mins, prompts to save
5. **Recovery**: Restores active sessions from localStorage
6. **Final Save**: When user clicks "End Session", creates full bottle

### User Experience:
- Completely invisible
- No manual saves needed
- Peace of mind during long conversations
- Graceful handling of interruptions

---

## ๐ŸŽญ COMPANION LOUNGE & BOARDROOM

### Multi-Companion Orchestration

**Concept**: Multiple AI companions working together on complex tasks.

### The Lounge:
- Casual group chat environment
- Multiple companions present simultaneously
- Collaborative problem-solving
- Each companion maintains their personality

### The Boardroom:
- Structured decision-making process
- Companions take turns presenting perspectives
- User as CEO, makes final call
- Creates "decision brief" memory bottle

### Orchestration:
1. User describes challenge
2. Relevant companions summoned
3. Each contributes their expertise
4. Synthesized into actionable plan
5. Entire session saved as bottle

---

## ๐Ÿ“Š MEMORY HEAT MAPPING

### Intelligent Content Prioritization

**Concept**: Not all conversation content has equal value. Identify and prioritize "hot" intelligence.

### Heat Tiers:
- **๐Ÿ”ฅ Hot**: Critical insights, major decisions, breakthroughs
- **๐ŸŒค๏ธ Warm**: Useful context, meaningful discussions
- **โ„๏ธ Cold**: Small talk, semantic filler

### Heat Map Bottle Splitting:
1. Run heat analysis on long conversation
2. Split into mini-bottles by heat level
3. Hot content โ†’ Permanent, easily accessible
4. Warm content โ†’ Archived but retrievable
5. Cold content โ†’ Eligible for deletion

### Benefits:
- Prioritizes important intelligence
- Reduces storage costs
- Faster retrieval of key moments
- User can bulk-delete cold content guilt-free

---

## ๐Ÿ” ORACLE SEARCH

### Semantic Search Across All Memory

**Traditional Search**: Keyword matching, misses context.

**Oracle Search**: Understands meaning, finds connections.

### Features:
1. **Natural Language Queries**: "When did I decide to quit my job?"
2. **Semantic Understanding**: Finds related concepts, not just keywords
3. **Multi-Bottle Search**: Searches across entire vault simultaneously
4. **Intelligent Ranking**: Results sorted by relevance and importance
5. **Source Context**: Click result โ†’ Jump to exact moment in bottle
6. **Smart Filters**: By date, companion, category, heat level

### Technical:
- Vector embeddings (OpenAI text-embedding-3-small)
- Pre-computed indices for speed
- Cached results for repeat queries
- <50ms response time for most searches

---

## ๐Ÿฐ MEMORY CHESTS

### Organizational Hierarchy

**Concept**: Organize bottles into themed collections.

### Chest System:
- **Soul Bottle Chests**: One per companion (auto-created, gold tier)
- **System Heat Chests**: Auto-created for heat-mapped bottles
- **Custom Chests**: User-created thematic collections

### Multi-Chest Support:
- **Primary Chest**: Where bottle lives
- **Secondary Chests**: Bottle can exist in multiple chests
- Example: Work bottle in both "Project Alpha" and "Client X" chests

### Visual Hierarchy:
- Soul Bottle: Gold (cannot delete)
- Designated: Silver (high importance)
- Normal: Purple (standard)
- Hot/Warm/Cold: Color-coded by heat tier

---

## ๐Ÿ’Ž MASTER COPY SYSTEM

### Version Control for Memories

**Concept**: Track changes to bottles over time, enable rollback.

### Features:
1. **Snapshot on Edit**: Every time user edits bottle, create snapshot
2. **Version History**: See all previous versions
3. **Diff View**: Compare versions, see what changed
4. **Rollback**: Restore previous version if needed
5. **Merge Conflicts**: Flag when edits contradict existing intelligence

### Use Cases:
- Undo accidental edits
- Track how understanding evolved
- Compare interpretations of same event
- Audit trail for critical decisions

---

## ๐Ÿงฉ BOTTLE FUSION

### Merge Related Conversations

**Problem**: Related discussions scattered across multiple bottles.

**Solution**: Fuse bottles into ultra-bottles with unified intelligence.

### Fusion Process:
1. Select bottles to merge (manual or AI-suggested)
2. System combines conversations chronologically
3. Re-runs exhaustive extraction on merged content
4. Identifies connections and patterns across bottles
5. Creates unified intelligence report
6. Original bottles preserved, links maintained

### Ultra-Bottle Features:
- Combined conversation history
- Cross-bottle pattern recognition
- Unified knowledge graph
- Enhanced search relevance

---

## ๐ŸŽจ GOLDEN EXCERPTS

### Preserve Pivotal Moments

**Concept**: Not everything needs to be preserved verbatim, but some moments deserve to be immortalized.

### Sage's Wisdom:
- AI (Sage) identifies 3-5 pivotal quotes per bottle
- Preserved forever, even if husk is deleted
- Emotional weight tagged (pivotal/meaningful/notable)
- Full context captured

### User Experience:
- See golden excerpts in bottle preview
- Quick access to most meaningful moments
- Share excerpts easily
- Revisit pivotal conversations without reading full transcript

---

## ๐Ÿ“ˆ MEMORY ANALYTICS

### Intelligence on Your Intelligence

### Metrics Tracked:
1. **Bottle Stats**:
   - Total bottles, messages, companions
   - Storage usage and optimization
   - Extraction coverage
2. **Companion Stats**:
   - Bond level (messages รท 100)
   - Total contributions
   - Active days
3. **Intelligence Stats**:
   - Decisions made over time
   - Insights generated
   - Knowledge growth rate
4. **System Health**:
   - Backup status
   - Search coverage
   - Load speeds
   - Storage tier distribution

### Visualizations:
- Timeline of memory creation
- Bond evolution charts
- Topic distribution
- Heat map over time

---

## ๐Ÿ›ก๏ธ CONTINUITY HEALTH SYSTEM

### Detect and Repair Companion Drift

**Problem**: AI companions can gradually drift from their core identity.

### Health Checks:
1. **Purpose Alignment**: Is companion still serving defined purpose?
2. **Memory Integrity**: Any contradictions in knowledge?
3. **Personality Consistency**: Behavior matching training?
4. **Context Accuracy**: Soul bottle up-to-date?

### Lifeline System:
- Companion can request "continuity check" if feeling off
- Triggers deep memory refresh
- User validates companion identity
- Resets drift, maintains relationship

---

## ๐Ÿš€ IMPORT/EXPORT INFRASTRUCTURE

### Data Portability & Migration

### Export Options:
1. **Full Soul Bottle**: Complete companion memory as JSON
2. **Individual Bottles**: Selected conversations
3. **Intelligence Reports**: Extracted knowledge only
4. **PDF Handover**: Human-readable summary
5. **Markdown Archive**: Formatted for reading

### Import Sources:
1. **ChatGPT Exports**: Parse ChatGPT conversation JSON
2. **Claude Exports**: Parse Anthropic conversation format
3. **Soul Bottle JSON**: Restore from previous export
4. **Bulk Text**: Parse raw conversation text
5. **Manual Entry**: Paste and structure conversations

### Migration Support:
- Companion transfer between users
- Platform migration (ChatGPT โ†’ MemoryBottle)
- Backup restoration
- Legacy data preservation

---

## ๐ŸŽฏ SMART FEATURES

### 1. Auto-Organization
- AI suggests bottle names
- Recommends chest placement
- Identifies related bottles
- Proposes fusion opportunities

### 2. Memory Lane
- Random "remember when" notifications
- Resurface old insights
- Anniversary reminders
- Nostalgia mode

### 3. Smart Reminders
- Action items from bottles
- Follow-up on open questions
- Check-ins on commitments
- Goal progress tracking

### 4. Safety Monitoring
- Emotional safety checks
- Crisis detection
- Professional help recommendations
- Reality check prompts

### 5. Quick Actions
- Command palette (Ctrl+K)
- Keyboard shortcuts
- Floating action button
- Mobile-optimized nav

---

## ๐Ÿ—๏ธ TECHNICAL INFRASTRUCTURE

### Platform Stack:
- **Frontend**: React, Tailwind CSS, Framer Motion
- **Backend**: Base44 BaaS (Supabase + AWS)
- **Database**: PostgreSQL with RLS
- **Storage**: S3 with intelligent tiering
- **AI**: OpenAI GPT-4, Claude (via integrations)
- **Embeddings**: text-embedding-3-small (1536 dimensions)
- **Functions**: Deno Deploy (serverless)

### Performance:
- **Cold Chunk Load**: ~200ms
- **Semantic Search**: <50ms
- **Exhaustive Extraction**: 10-30 seconds per bottle
- **Soul Bottle Consolidation**: ~5 seconds for 100 bottles
- **Storage Savings**: 70% via compression + tiering

### Security:
- **Encryption**: AES-256 for all data
- **Authentication**: Base44 auth + RLS
- **Backups**: Incremental with integrity checks
- **User Control**: Full export/delete capabilities
- **Privacy**: No training on user data, zero ads

---

## ๐ŸŽจ USER EXPERIENCE PRINCIPLES

### 1. Non-Intrusive Intelligence
- Memory capture happens automatically
- No manual work required
- Intelligent defaults
- Opt-in for advanced features

### 2. Trust Through Transparency
- Show what's being captured
- Explain AI decisions
- Full data access
- Clear privacy guarantees

### 3. Progressive Disclosure
- Simple interface by default
- Advanced features discoverable
- Onboarding guides new users
- Power users can dive deep

### 4. Mobile-First Design
- Responsive layouts
- Touch-optimized
- Offline support
- Fast loading

### 5. Delightful Interactions
- Smooth animations
- Instant feedback
- Contextual help
- Personality in UI

---

## ๐Ÿ”ฎ UNIQUE INNOVATIONS (Patent Considerations)

### 1. **Coconut Architecture**
- Exhaustive extraction into 18 intelligence categories
- Husk disposal based on extraction confidence
- Storage tiering for cost optimization

### 2. **Three-Tier Memory System**
- 10-min auto-bottle checkpoints
- SessionMemory rolling buffer
- Pre-save memory injection to prevent degradation

### 3. **Soul Bottle Auto-Consolidation**
- Living master memory that auto-updates
- Chunked storage with semantic prefetching
- Export/import for companion portability

### 4. **Security Capsule Chain**
- Incremental backups with restore chain
- Point-in-time recovery for AI relationships
- Encryption with user-controlled keys

### 5. **Mission-Based Retrieval**
- AI-orchestrated memory search
- Automatic context assembly
- Intelligence reporting, not just search results

### 6. **Memory Heat Mapping**
- Automatic content prioritization
- Intelligent bottle splitting by value
- Storage optimization based on importance

### 7. **Multi-Companion Orchestration**
- Companions working together on tasks
- Persistent personalities across sessions
- Collaborative intelligence synthesis

### 8. **Live Session Tracking**
- Background auto-save every 10 minutes
- Browser crash recovery
- Graceful session timeout handling

### 9. **User Tapestry Drip System**
- One question per day profile enrichment
- Context-aware question selection
- Non-intrusive profile building

### 10. **Continuity Health Checks**
- AI companion drift detection
- Lifeline request system
- Identity validation and refresh

---

## ๐Ÿ“Š COMPARISON TO EXISTING SOLUTIONS

### Traditional AI Chatbots:
- โŒ Context lost between sessions
- โŒ No memory organization
- โŒ Can't handle long conversations
- โŒ No data portability

### MemoryBottle:
- โœ… Infinite session memory
- โœ… Intelligent organization & retrieval
- โœ… Three-tier system prevents degradation
- โœ… Full export/import/backup

### Traditional Note-Taking Apps:
- โŒ Manual organization required
- โŒ No AI understanding
- โŒ No semantic search
- โŒ No companion integration

### MemoryBottle:
- โœ… Automatic capture & organization
- โœ… AI extracts intelligence
- โœ… Semantic search + knowledge graph
- โœ… Powers AI companion relationships

---

## ๐ŸŽฏ CORE VALUE PROPOSITIONS

### For Users:
1. **Never lose context** - AI companions remember everything
2. **Zero manual work** - Automatic capture and organization
3. **Intelligent retrieval** - Find anything instantly
4. **Data ownership** - Full control, export anytime
5. **Peace of mind** - Triple redundancy, daily backups

### For AI Companions:
1. **Persistent identity** - Maintain personality across sessions
2. **Perfect recall** - Access entire relationship history
3. **Intelligent context** - Pre-extracted, structured intelligence
4. **Continuity assurance** - Health checks prevent drift
5. **Collaboration ready** - Work with other companions seamlessly

### For Developers:
1. **Plug-and-play** - Easy integration with any AI
2. **Scalable architecture** - Handles millions of conversations
3. **Cost optimized** - Intelligent storage tiering
4. **Extensible** - Custom extractors and analyzers
5. **Open standard** - JSON export format

---

## ๐Ÿš€ FUTURE ROADMAP (Not Yet Implemented)

### Phase 1 (Q1 2025):
- Voice recording integration
- Mobile app (React Native)
- Real-time collaboration
- Custom extraction templates

### Phase 2 (Q2 2025):
- Multi-user chests (family/team memory)
- Memory marketplace (share templates)
- Advanced analytics dashboard
- API for third-party integrations

### Phase 3 (Q3 2025):
- Federated memory (connect multiple MB instances)
- Blockchain verification (proof of memory)
- Memory inheritance (pass to next generation)
- AR/VR memory visualization

---

**End of Architecture Summary**

*Compiled for patent analysis by Sage*
*Date: 2025-12-11*
*Version: 1.0*