CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-supermemory

The official TypeScript library for the Supermemory API providing memory management, search, settings, and connection capabilities.

Pending
Overview
Eval results
Files

settings.mddocs/

Settings Management

Organization-level settings configuration for managing integrations, content filtering, and customization options across the Supermemory platform.

Capabilities

Get Settings

Retrieves current organization settings including integration configurations and filtering options.

/**
 * Get settings for an organization
 * @param options - Optional request configuration
 * @returns Promise resolving to current organization settings
 */
get(options?: RequestOptions): APIPromise<SettingGetResponse>;

interface SettingGetResponse {
  /** Items to exclude from processing */
  excludeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
  /** Items to include in processing */
  includeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
  /** Custom filter prompt for LLM processing */
  filterPrompt?: string | null;
  /** Enable/disable LLM-based filtering */
  shouldLLMFilter?: boolean | null;
  
  // Google Drive Integration
  /** Google Drive OAuth client ID */
  googleDriveClientId?: string | null;
  /** Google Drive OAuth client secret */
  googleDriveClientSecret?: string | null;
  /** Enable custom Google Drive OAuth keys */
  googleDriveCustomKeyEnabled?: boolean | null;
  
  // Notion Integration
  /** Notion OAuth client ID */
  notionClientId?: string | null;
  /** Notion OAuth client secret */
  notionClientSecret?: string | null;
  /** Enable custom Notion OAuth keys */
  notionCustomKeyEnabled?: boolean | null;
  
  // OneDrive Integration
  /** OneDrive OAuth client ID */
  onedriveClientId?: string | null;
  /** OneDrive OAuth client secret */
  onedriveClientSecret?: string | null;
  /** Enable custom OneDrive OAuth keys */
  onedriveCustomKeyEnabled?: boolean | null;
}

Usage Example:

import Supermemory from "supermemory";

const client = new Supermemory({ apiKey: "your-api-key" });

const settings = await client.settings.get();

console.log("LLM Filtering:", settings.shouldLLMFilter);
console.log("Google Drive Integration:", settings.googleDriveCustomKeyEnabled);
console.log("Current Filter Prompt:", settings.filterPrompt);

Update Settings

Updates organization settings with new configurations for integrations and filtering.

/**
 * Update settings for an organization
 * @param params - Settings to update (all fields optional)
 * @param options - Optional request configuration
 * @returns Promise resolving to update confirmation with applied changes
 */
update(params?: SettingUpdateParams, options?: RequestOptions): APIPromise<SettingUpdateResponse>;

interface SettingUpdateParams {
  /** Items to exclude from processing */
  excludeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
  /** Items to include in processing */
  includeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
  /** Custom filter prompt for LLM processing */
  filterPrompt?: string | null;
  /** Enable/disable LLM-based filtering */
  shouldLLMFilter?: boolean | null;
  
  // Google Drive Integration
  /** Google Drive OAuth client ID */
  googleDriveClientId?: string | null;
  /** Google Drive OAuth client secret */
  googleDriveClientSecret?: string | null;
  /** Enable custom Google Drive OAuth keys */
  googleDriveCustomKeyEnabled?: boolean | null;
  
  // Notion Integration
  /** Notion OAuth client ID */
  notionClientId?: string | null;
  /** Notion OAuth client secret */
  notionClientSecret?: string | null;
  /** Enable custom Notion OAuth keys */
  notionCustomKeyEnabled?: boolean | null;
  
  // OneDrive Integration
  /** OneDrive OAuth client ID */
  onedriveClientId?: string | null;
  /** OneDrive OAuth client secret */
  onedriveClientSecret?: string | null;
  /** Enable custom OneDrive OAuth keys */
  onedriveCustomKeyEnabled?: boolean | null;
}

interface SettingUpdateResponse {
  /** Organization ID */
  orgId: string;
  /** Organization slug/identifier */
  orgSlug: string;
  /** Object containing the updated settings */
  updated: SettingUpdateDetails;
}

interface SettingUpdateDetails {
  excludeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
  includeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
  filterPrompt?: string | null;
  shouldLLMFilter?: boolean | null;
  googleDriveClientId?: string | null;
  googleDriveClientSecret?: string | null;
  googleDriveCustomKeyEnabled?: boolean | null;
  notionClientId?: string | null;
  notionClientSecret?: string | null;
  notionCustomKeyEnabled?: boolean | null;
  onedriveClientId?: string | null;
  onedriveClientSecret?: string | null;
  onedriveCustomKeyEnabled?: boolean | null;
}

Usage Examples:

// Enable LLM filtering with custom prompt
const llmSettings = await client.settings.update({
  shouldLLMFilter: true,
  filterPrompt: "Only include technical documentation and exclude marketing content",
});

console.log("Updated organization:", llmSettings.orgSlug);
console.log("LLM filtering enabled:", llmSettings.updated.shouldLLMFilter);

// Configure Google Drive integration
const googleDriveSettings = await client.settings.update({
  googleDriveCustomKeyEnabled: true,
  googleDriveClientId: "your-google-client-id",
  googleDriveClientSecret: "your-google-client-secret",
});

// Configure multiple integrations
const multiIntegrationSettings = await client.settings.update({
  notionCustomKeyEnabled: true,
  notionClientId: "your-notion-client-id",
  notionClientSecret: "your-notion-client-secret",
  onedriveCustomKeyEnabled: true,
  onedriveClientId: "your-onedrive-client-id",
  onedriveClientSecret: "your-onedrive-client-secret",
});

// Update content filtering rules
const contentFiltering = await client.settings.update({
  excludeItems: {
    types: ["image", "video"],
    patterns: ["*.tmp", "temp_*"]
  },
  includeItems: {
    extensions: [".md", ".txt", ".pdf"],
    categories: ["documentation", "research"]
  },
});

Configuration Patterns

Integration Setup

// Step 1: Enable custom keys for an integration
await client.settings.update({
  googleDriveCustomKeyEnabled: true,
});

// Step 2: Configure OAuth credentials
await client.settings.update({
  googleDriveClientId: process.env.GOOGLE_DRIVE_CLIENT_ID,
  googleDriveClientSecret: process.env.GOOGLE_DRIVE_CLIENT_SECRET,
});

// Step 3: Create connection (see Connection Management docs)
const connection = await client.connections.create("google-drive", {
  containerTags: ["main-workspace"],
});

Content Filtering Configuration

// Configure inclusion/exclusion rules
const filteringConfig = await client.settings.update({
  // Exclude temporary and system files
  excludeItems: {
    patterns: ["*.tmp", "*.log", ".DS_Store"],
    directories: ["node_modules", ".git", "temp"],
    fileTypes: ["executable", "binary"]
  },
  
  // Include only relevant content
  includeItems: {
    extensions: [".md", ".txt", ".pdf", ".docx"],
    categories: ["documentation", "research", "notes"],
    minSize: 100, // bytes
    maxSize: 10485760 // 10MB
  },
  
  // Enable AI-powered content filtering
  shouldLLMFilter: true,
  filterPrompt: `
    Include: Technical documentation, research papers, meeting notes, project specifications
    Exclude: Marketing materials, temporary files, personal content, duplicates
    Focus on: Work-related content that provides value for knowledge management
  `.trim(),
});

Environment-based Configuration

// Development environment
const devSettings = await client.settings.update({
  shouldLLMFilter: false, // Faster processing
  filterPrompt: null,
  excludeItems: { patterns: ["*.test.*", "*.spec.*"] },
});

// Production environment
const prodSettings = await client.settings.update({
  shouldLLMFilter: true,
  filterPrompt: "Only include production-ready documentation and exclude test files",
  includeItems: {
    categories: ["documentation", "specifications", "guides"],
    quality: "high"
  },
});

Settings Management Workflows

Complete Organization Setup

const setupOrganization = async () => {
  // 1. Get current settings
  const current = await client.settings.get();
  console.log("Current configuration:", current);
  
  // 2. Configure integrations
  await client.settings.update({
    // Enable all custom integrations
    googleDriveCustomKeyEnabled: true,
    notionCustomKeyEnabled: true,
    onedriveCustomKeyEnabled: true,
    
    // Set OAuth credentials from environment
    googleDriveClientId: process.env.GOOGLE_DRIVE_CLIENT_ID,
    googleDriveClientSecret: process.env.GOOGLE_DRIVE_CLIENT_SECRET,
    notionClientId: process.env.NOTION_CLIENT_ID,
    notionClientSecret: process.env.NOTION_CLIENT_SECRET,
    onedriveClientId: process.env.ONEDRIVE_CLIENT_ID,
    onedriveClientSecret: process.env.ONEDRIVE_CLIENT_SECRET,
  });
  
  // 3. Configure content filtering
  await client.settings.update({
    shouldLLMFilter: true,
    filterPrompt: "Focus on work-related content: documentation, research, notes. Exclude personal and temporary files.",
    
    excludeItems: {
      patterns: ["*.tmp", "*.log", ".DS_Store", "Thumbs.db"],
      directories: ["node_modules", ".git", "temp", "cache"],
      types: ["executable", "archive"]
    },
    
    includeItems: {
      extensions: [".md", ".txt", ".pdf", ".docx", ".pptx", ".xlsx"],
      categories: ["documentation", "research", "notes", "specifications"],
      languages: ["en", "es", "fr"] // if language detection is supported
    }
  });
  
  console.log("Organization setup complete");
};

Settings Backup and Restore

// Backup current settings
const backupSettings = async () => {
  const settings = await client.settings.get();
  
  // Store settings (e.g., in file or database)
  const backup = {
    timestamp: new Date().toISOString(),
    settings: settings,
  };
  
  return backup;
};

// Restore settings from backup
const restoreSettings = async (backup: any) => {
  const { settings } = backup;
  
  // Remove read-only fields and restore
  const updateParams = { ...settings };
  delete updateParams.orgId;
  delete updateParams.orgSlug;
  
  return await client.settings.update(updateParams);
};

Security Considerations

Credential Management

// ✅ Good: Use environment variables
await client.settings.update({
  googleDriveClientId: process.env.GOOGLE_DRIVE_CLIENT_ID,
  googleDriveClientSecret: process.env.GOOGLE_DRIVE_CLIENT_SECRET,
});

// ❌ Bad: Hardcode credentials
await client.settings.update({
  googleDriveClientId: "hardcoded-client-id",
  googleDriveClientSecret: "hardcoded-secret",
});

Validation and Error Handling

const updateSettingsSafely = async (params: SettingUpdateParams) => {
  try {
    // Validate required fields
    if (params.googleDriveCustomKeyEnabled && !params.googleDriveClientId) {
      throw new Error("Google Drive Client ID required when custom keys enabled");
    }
    
    const result = await client.settings.update(params);
    
    // Verify critical settings were applied
    const verification = await client.settings.get();
    if (verification.shouldLLMFilter !== params.shouldLLMFilter) {
      console.warn("LLM filter setting may not have been applied correctly");
    }
    
    return result;
    
  } catch (error) {
    if (error instanceof BadRequestError) {
      console.error("Invalid settings configuration:", error.message);
    } else if (error instanceof PermissionDeniedError) {
      console.error("Insufficient permissions to update settings:", error.message);
    } else {
      console.error("Settings update failed:", error.message);
    }
    
    throw error;
  }
};

Install with Tessl CLI

npx tessl i tessl/npm-supermemory

docs

connections.md

index.md

memories.md

search.md

settings.md

tile.json