---
title: Cross-Tenant Agent Memory Isolation Audit | SkillMarket
description: Audit stateful AI skills and memory MCP servers (Mem0, Zep, SQLite/graph memory) for strict cross-tenant namespace isolation and temp-file cleanup.
canonical: "https://skillmarket.ai/j/test-cross-tenant-memory-isolation-in-skills"
modified: 2026-11-14
author: skillmarket.ai editorial team
source: "https://skillmarket.ai"
category: Skill Security, Injection & Permission Audits
category_url: "https://skillmarket.ai/j#group-security-permission-audits"
---

# Verify stateful agent skills and memory MCPs never leak context across customer workspaces

> Local memory files, shared tmp directories, and unscoped vector collections can bleed Customer A's context into Customer B's session.

## Prepared starting prompt

Audit memory MCP servers and file-generating skills for strict tenant_id isolation and /tmp artifact cleanup in multi-tenant SaaS.

### Quick scenarios
- **Memory MCP namespace isolation:** Compare Mem0, Knowledge Graph, and SQLite memory MCPs on hard tenant scoping.
- **Shared /tmp file bleed check:** Find skills audited against fixed /tmp/output.json race conditions across sessions.
- **Subagent context sanitization:** Verify multi-tenant skills clear cached global state between concurrent runs.

- [Join Early Access Waitlist](https://skillmarket.ai/#waitlist-8efd41)

*Multi-tenant isolation requires infrastructure-enforced namespaces and ephemeral sandboxes in addition to clean skill code.*

## Four state-bleed bugs found in multi-tenant skill deployments

1. **Eliminate hardcoded /tmp filenames in helper scripts** — Skills writing '/tmp/report.csv' instead of mkdtemp() leak data or corrupt outputs when two concurrent requests share a container.
2. **Enforce server-bound tenant_id on memory MCPs** — Never pass tenant_id solely via prompt instructions where injection can rewrite it; bind namespace credentials at connection init.
3. **Check module-level global cache persistence** — Long-lived Python or Node MCP servers caching last_query_result in global variables leak state across sequential users.
4. **Verify workspace directory wipe after completion** — Confirm ephemeral working directories and browser cookie jars reset completely after every tenant job.

## Frequently Asked Questions

### How could a stateless-looking SKILL.md cause cross-tenant leakage?

Bundled helper scripts frequently write fixed cache files like /tmp/schema_cache.json or ~/.cache/skill-db without scoping by session or tenant ID.

### How does SkillMarket test concurrency and tenant bleed?

Harnesses fire interleaved concurrent sessions seeded with canary tokens for Tenant A and Tenant B, scanning all responses and disk artifacts for cross-contamination.

### Which memory MCP architectures are safest for B2B SaaS?

Architectures enforcing cryptographic auth tokens mapped server-side to isolated database schemas or row-level security policies.

## Related tasks in this category

- [Scan third-party SKILL.md packages and reference files for covert prompt injection](https://skillmarket.ai/j/audit-skill-md-for-hidden-prompt-injection.md)
- [Audit MCP server OAuth scopes, API token handling, and credential storage hygiene](https://skillmarket.ai/j/verify-mcp-oauth-scope-least-privilege.md)
- [Test agent skills for covert data exfiltration via Markdown images, DNS, or webhooks](https://skillmarket.ai/j/detect-data-exfiltration-in-agent-skills.md)
- [Verify destructive command blocking and sandboxing in Bash-enabled agent skills](https://skillmarket.ai/j/inspect-shell-execution-guardrails-in-skills.md)
- [Check commit pinning, lockfile hashes, and maintainer provenance in community skill packs](https://skillmarket.ai/j/audit-third-party-skill-supply-chain-pins.md)
- [Benchmark PII and secret redaction skills that scrub sensitive payloads before LLM or API calls](https://skillmarket.ai/j/evaluate-pii-redaction-before-tool-calls.md)

---

*Published by **Wondel.ai sp. z o.o.** · [skillmarket.ai](https://skillmarket.ai) · [About](https://skillmarket.ai/about) · [Editorial Guidelines](https://skillmarket.ai/editorial) · [Contact](https://skillmarket.ai/contact) · [Wondel.ai Products](https://wondel.ai/products)*