Skip to main content

Shared Memory System

Pryveo’s Shared Memory system transforms the platform into a comprehensive AI OS layer by providing apps with access to centralized user data—calendar events, files, browsing history, contacts, and more—all with fine-grained permission control.

Privacy First

All shared memory data stays on the user’s device. Apps request specific permissions, and every access is logged in an audit trail.

Overview

Instead of each app maintaining its own isolated data silos, Pryveo offers a unified knowledge base that apps can access with explicit user permission.

Available Data Types

User Profile

Name, email, preferences, timezone

Calendar Events

Upcoming meetings, all-day events, locations

File Index

Indexed files with content snippets

Browsing History

Recently visited websites and pages

Conversations

Chat history across all apps

Contacts

Personal and professional contacts

Clipboard History

Recent clipboard entries

Architecture

Permissions

Apps must declare shared memory permissions in their manifest.json:
{
  "id": "com.example.myapp",
  "name": "My App",
  "permissions": {
    "permissions": [
      "shared_memory_calendar_read",
      "shared_memory_files_read",
      "shared_memory_contacts_read"
    ],
    "reasons": {
      "shared_memory_calendar_read": "To show your upcoming schedule",
      "shared_memory_files_read": "To help you find documents",
      "shared_memory_contacts_read": "To suggest meeting participants"
    }
  }
}

Permission Types

PermissionDescription
shared_memory_user_profileRead/write user profile
shared_memory_calendar_readRead calendar events
shared_memory_calendar_writeCreate/update/delete events
shared_memory_calendarFull calendar access (read + write)
shared_memory_files_readSearch indexed files
shared_memory_browsing_historyRead browsing history
shared_memory_conversations_readRead conversation history
shared_memory_conversations_writeCreate conversations, append messages
shared_memory_conversationsFull conversation access
shared_memory_contacts_readRead contacts
shared_memory_contacts_writeCreate/update/delete contacts
shared_memory_contactsFull contacts access
shared_memory_clipboard_historyRead clipboard history
Write permissions automatically grant read access. For example, shared_memory_calendar_write implies shared_memory_calendar_read.

SDK Usage

User Profile

use pryveo_sdk::prelude::*;

fn main_app() -> Result<()> {
    // Get user profile
    let profile = get_user_profile()?;
    log(LogLevel::Info, &format!("Hello, {}!", 
        profile.name.unwrap_or("User".to_string())))?;
    
    Ok(())
}

Calendar Events

use pryveo_sdk::prelude::*;

fn show_upcoming_events() -> Result<()> {
    // List events (None for all dates)
    let events = list_calendar_events(None, None)?;
    
    for event in events.iter().take(5) {
        log(LogLevel::Info, &format!("📅 {} - {}", 
            event.title, 
            event.start_time))?;
            
        if let Some(location) = &event.location {
            log(LogLevel::Info, &format!("   📍 {}", location))?;
        }
    }
    
    Ok(())
}
use pryveo_sdk::prelude::*;

fn search_documents() -> Result<()> {
    // Search for files containing "rust"
    let files = search_files("rust", 10)?;
    
    for file in files {
        log(LogLevel::Info, &format!("Found: {} ({})", 
            file.filename, 
            file.path))?;
            
        if let Some(snippet) = file.content_snippet {
            log(LogLevel::Info, &format!("  Preview: {}", snippet))?;
        }
    }
    
    Ok(())
}

Browsing History

use pryveo_sdk::prelude::*;

fn search_history() -> Result<()> {
    // Search browsing history
    let entries = search_browsing_history("github", 5)?;
    
    for entry in entries {
        log(LogLevel::Info, &format!("🌐 {}", 
            entry.title.unwrap_or("Untitled".to_string())))?;
        log(LogLevel::Info, &format!("   {}", entry.url))?;
    }
    
    Ok(())
}

Conversations

use pryveo_sdk::prelude::*;

fn manage_conversations() -> Result<()> {
    // List all conversations
    let convos = list_conversations()?;
    log(LogLevel::Info, &format!("You have {} conversations", convos.len()))?;
    
    // Create new conversation
    let messages = vec![
        Message {
            role: "user".to_string(),
            content: "Hello!".to_string(),
            timestamp: chrono::Utc::now().to_rfc3339(),
        }
    ];
    let convo_id = create_conversation(&messages)?;
    
    // Append to conversation
    let new_message = Message {
        role: "assistant".to_string(),
        content: "Hi there!".to_string(),
        timestamp: chrono::Utc::now().to_rfc3339(),
    };
    append_to_conversation(&convo_id, &new_message)?;
    
    Ok(())
}

Contacts

use pryveo_sdk::prelude::*;

fn list_my_contacts() -> Result<()> {
    let contacts = list_contacts()?;
    
    for contact in contacts {
        log(LogLevel::Info, &format!("👤 {}", contact.name))?;
        if let Some(email) = contact.email {
            log(LogLevel::Info, &format!("   ✉️  {}", email))?;
        }
    }
    
    Ok(())
}

Clipboard History

use pryveo_sdk::prelude::*;

fn recent_clipboard() -> Result<()> {
    // Get last 5 clipboard entries
    let entries = list_clipboard_history(5)?;
    
    for (i, entry) in entries.iter().enumerate() {
        log(LogLevel::Info, &format!("{}. \"{}\"", 
            i + 1, 
            truncate(&entry.content, 50)))?;
    }
    
    Ok(())
}

Data Providers

Shared memory data is populated by data providers that run in the background:

Calendar Provider

  • macOS: Integrates with Calendar.app via AppleScript
  • Windows: Outlook/Windows Calendar integration (planned)
  • Linux: Evolution/Thunderbird support (planned)
  • Sync: Every 10 minutes

File Watcher

  • Uses notify crate for real-time file system monitoring
  • Indexes text files with content snippets
  • Supports 20+ file types (rs, js, py, md, json, etc.)
  • Respects .gitignore patterns
  • Watches user-configured directories

Browser Monitor

  • Parses browser history databases
  • Supported browsers: Chrome, Firefox, Safari, Edge, Brave
  • Platform-specific database paths
  • Syncs every 5 minutes
  • Last 1000 entries per browser

Clipboard History

  • Monitors system clipboard changes
  • Polls every 500ms
  • Stores last 100 entries (configurable)
  • Text content only

Privacy Controls

Users have complete control over shared memory:

Privacy Dashboard

Access via the Privacy tab in Pryveo:
  1. Data Summary: View how much data is stored
  2. Audit Log: See every app access with timestamp
  3. Permission Management: Grant/revoke per-app permissions
  4. Data Export: Download all data as JSON
  5. Data Deletion: Clear specific data types
  6. Provider Settings: Enable/disable data collection

Permission Flow

Error Handling

use pryveo_sdk::prelude::*;

fn safe_calendar_access() -> Result<()> {
    match list_calendar_events(None, None) {
        Ok(events) => {
            log(LogLevel::Info, &format!("Found {} events", events.len()))?;
        }
        Err(e) => {
            // Permission denied or not available
            log(LogLevel::Warn, &format!("Calendar access failed: {}", e))?;
            log(LogLevel::Info, "Request calendar permission in manifest.json")?;
        }
    }
    
    Ok(())
}

Best Practices

Only request shared memory permissions that are essential for your app’s functionality. Users are more likely to grant specific, justified permissions.
Always include a reasons field explaining why each permission is needed. Be specific and user-friendly.
Not all users will have all data types populated. Handle empty results and errors elegantly.
Even with permission, use shared memory data responsibly. Don’t store sensitive data in logs or external storage.
Only access shared memory when needed. Batch operations and cache results appropriately.

Complete Example

See LifeOS Assistant for a complete working example that demonstrates all shared memory features.

API Reference

Types

pub struct UserProfile {
    pub name: Option<String>,
    pub email: Option<String>,
    pub preferences: Option<serde_json::Value>,
    pub timezone: Option<String>,
}

pub struct CalendarEvent {
    pub id: String,
    pub title: String,
    pub description: Option<String>,
    pub start_time: String, // ISO 8601
    pub end_time: String,
    pub location: Option<String>,
    pub all_day: bool,
    pub source: Option<String>,
    pub created_at: String,
    pub updated_at: String,
}

pub struct FileEntry {
    pub id: String,
    pub path: String,
    pub filename: String,
    pub content_snippet: Option<String>,
    pub file_type: Option<String>,
    pub size_bytes: Option<i64>,
    pub last_modified: String,
    pub indexed_at: String,
}

pub struct BrowsingHistoryEntry {
    pub id: String,
    pub url: String,
    pub title: Option<String>,
    pub visit_time: String,
    pub duration_seconds: Option<i64>,
    pub source_browser: Option<String>,
    pub created_at: String,
}

pub struct Conversation {
    pub id: String,
    pub app_id: String,
    pub title: Option<String>,
    pub messages: Vec<Message>,
    pub created_at: String,
    pub updated_at: String,
}

pub struct Message {
    pub role: String, // "user" | "assistant" | "system"
    pub content: String,
    pub timestamp: String,
}

pub struct Contact {
    pub id: String,
    pub name: String,
    pub email: Option<String>,
    pub phone: Option<String>,
    pub notes: Option<String>,
    pub created_at: String,
    pub updated_at: String,
}

pub struct ClipboardEntry {
    pub id: String,
    pub content: String,
    pub content_type: String,
    pub timestamp: String,
}

Functions

// User Profile
pub fn get_user_profile() -> Result<UserProfile>
pub fn update_user_profile(profile: &UserProfile) -> Result<()>

// Calendar
pub fn list_calendar_events(start: Option<String>, end: Option<String>) -> Result<Vec<CalendarEvent>>
pub fn create_calendar_event(event: &CalendarEvent) -> Result<String>
pub fn update_calendar_event(event: &CalendarEvent) -> Result<()>
pub fn delete_calendar_event(event_id: &str) -> Result<()>

// Files
pub fn search_files(query: &str, limit: usize) -> Result<Vec<FileEntry>>
pub fn get_file_content(file_id: &str) -> Result<String>

// Browsing History
pub fn search_browsing_history(query: &str, limit: usize) -> Result<Vec<BrowsingHistoryEntry>>

// Conversations
pub fn list_conversations() -> Result<Vec<Conversation>>
pub fn create_conversation(messages: &[Message]) -> Result<String>
pub fn append_to_conversation(conv_id: &str, message: &Message) -> Result<()>

// Contacts
pub fn list_contacts() -> Result<Vec<Contact>>
pub fn create_contact(contact: &Contact) -> Result<String>
pub fn update_contact(contact: &Contact) -> Result<()>
pub fn delete_contact(contact_id: &str) -> Result<()>

// Clipboard History
pub fn list_clipboard_history(limit: usize) -> Result<Vec<ClipboardEntry>>
All functions require appropriate permissions declared in manifest.json and granted by the user.

Platform Support

FeaturemacOSWindowsLinux
User Profile
Calendar Sync🚧🚧
File Indexing
Browser History
Conversations
Contacts🚧🚧
Clipboard History
✅ = Fully supported | 🚧 = Planned
Contribute platform-specific implementations! See the developer guide for details.