multi-tenant

Enforces owner_id to isolate documents and search across tenants.

6|1|Updated Aug 11, 2025
One-click install
npx skills add https://github.com/juanre/llmemory --skill multi-tenant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenant
Source: https://github.com/juanre/llmemory/tree/main/skills/multi-tenant
Command: npx skills add https://github.com/juanre/llmemory --skill multi-tenant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides built-in multi-tenant data isolation for document storage and search by enforcing owner_id across all operations, ensuring tenants cannot access each other's data.

Core Features & Use Cases

  • Automatic owner_id filtering for all document operations (add, list, search, delete)
  • Optional schema-per-tenant or single-database tenancy to meet regulatory or scaling needs
  • Hierarchical tenancy support (organization → workspace → user) with full isolation guarantees
  • Practical guidance for secure multi-tenant patterns in SaaS apps, including auditability and export/delete workflows
  • Use Case: A SaaS app serving multiple organizations can store each organization's documents under its owner_id and safely query within the same tenant without cross-tenant leakage.

Quick Start

Install llmemory and initialize a shared pool. Create a memory instance scoped to a tenant using owner_id, then add a document and perform a tenant-scoped search to verify isolation.

Frequently Asked Questions about multi-tenant

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce tenant isolation for document storage in a SaaS application?

Tenant isolation for document storage is enforced by applying a deterministic owner_id filter across all add, list, search, and delete operations. This guarantees that tenants querying a shared PostgreSQL-backed layer cannot access each other's data.

Does multi-tenant data isolation work with organization and workspace hierarchies?

Yes, multi-tenant data isolation supports hierarchical tenancy structures like organization, workspace, and user. It maintains full isolation guarantees by scoping all document and embedding operations to the specific hierarchical owner_id.

How do I isolate tenant data using PostgreSQL and llmemory?

To isolate tenant data, initialize a shared pool with the llmemory library and a PostgreSQL storage layer. Create a memory instance scoped to a specific owner_id, then add documents and execute searches to verify deterministic tenant filtering.

What is the best way to scale multi-tenant document search without cross-tenant data leakage?

The best way to prevent cross-tenant data leakage is enforcing automatic owner_id filtering on every query. You can also choose between schema-per-tenant or single-database tenancy models to meet specific regulatory or scaling requirements.

Are there limitations to using a single-database multi-tenant architecture for document search?

Single-database multi-tenant architectures rely entirely on deterministic owner_id filtering for security. While easier to manage, they may not satisfy strict regulatory isolation requirements compared to schema-per-tenant approaches, requiring careful auditability planning.

Can I securely export and delete tenant documents in a multi-tenant SaaS environment?

Yes, you can securely export and delete tenant documents by following the provided multi-tenant workflow patterns. These patterns ensure that export and delete operations remain strictly scoped to the correct tenant owner_id without data leakage.