instance-storage-patterns

Design isolated filesystem storage with per-instance locking and atomic JSON updates.

10|11|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/microsoft/amplifier-bundle-skills --skill instance-storage-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instance-storage-patterns
Source: https://github.com/microsoft/amplifier-bundle-skills/tree/main/skills/instance-storage-patterns
Command: npx skills add https://github.com/microsoft/amplifier-bundle-skills --skill instance-storage-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you design and implement reliable per-instance storage for systems that manage many concurrent sessions, jobs, or agents. It solves the common problems of data collisions, scattered state, and fragile cleanup when each instance needs its own isolated files and lifecycle metadata.

Core Features & Use Cases

  • Instance-rooted storage layout: Keep every session's workspace, logs, events, sidecar data, and outputs under one directory for easy inspection and deletion.
  • Per-instance concurrency control: Use targeted locking so writes to one instance do not block unrelated instances.
  • Atomic persistence patterns: Write JSON and other state updates safely with temporary files and atomic replace operations.
  • Prepare-once, create-many workflows: Separate expensive initialization from lightweight session creation for scalable factories.
  • Use Case: A CLI tool managing many build jobs can store each job in its own directory, update status safely from multiple threads, and cleanly archive or remove one job without touching others.

Quick Start

Use this skill to design a filesystem-backed instance store for my concurrent sessions with isolated directories, atomic writes, and per-instance locking.

Frequently Asked Questions about instance-storage-patterns

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

FAQPage Schema
How do I design isolated filesystem storage for concurrent sessions?

Isolated filesystem storage for concurrent sessions is designed by assigning each instance its own directory for workspaces and logs, ensuring independent lifecycle tracking and cleanup without cross-instance data collisions.

What is the best way to prevent data collisions when multiple agents write to the same filesystem?

Preventing data collisions when multiple agents write to the filesystem requires per-instance locking mechanisms that restrict concurrent access, ensuring writes to one instance do not block or corrupt unrelated instances.

How do atomic writes work for updating JSON state files safely?

Atomic writes for updating JSON state files work by writing to a temporary file first, then performing an atomic replace operation to ensure the final state file is never left in a partially written or corrupted condition.

How can I scale session creation without repeating expensive initialization?

You can scale session creation without repeating initialization by using a prepare-once, create-many workflow, which separates expensive factory setup from lightweight per-instance session creation.

Can I override the root storage directory for instance storage using environment variables?

Yes, you can override the root storage directory for instance storage using environment-based root overrides, allowing flexible deployment configurations across different runtime environments.

Why does my concurrent job cleanup delete files from other running sessions?

Concurrent job cleanup deletes files from other sessions when storage is not properly isolated, which can be fixed by enforcing an instance-rooted storage layout with independent lifecycle tracking for each job.