instance-storage-patterns

Pass

Audited by Gen Agent Trust Hub on Jun 19, 2026

Risk Level: SAFE
Full Analysis
  • File System Management Patterns: The skill outlines a structured approach for organizing instance data within the user's home directory (e.g., ~/.my-tool). This method of isolating instance-specific data into subdirectories is a standard and effective design for maintaining data integrity in multi-instance environments.
  • Atomic Write Implementation: The provided Python snippets utilize tempfile.mkstemp and os.replace to perform atomic writes. This is a recommended security and reliability practice that prevents data corruption by ensuring that a file is only updated once the write operation has successfully completed.
  • Thread-Safe Concurrency Control: The pattern incorporates threading.Lock within an InstanceStore class. This ensures that concurrent writes to the same instance's metadata are serialized, protecting the application from race conditions during parallel processing.
  • Path Construction Considerations: The code examples demonstrate using variables like instance_id to build file paths. While appropriate for the described pattern, developers should ensure that such identifiers are validated or sanitized if they are sourced from untrusted inputs to prevent potential directory traversal.
Audit Metadata
Risk Level
SAFE
Analyzed
Jun 19, 2026, 07:38 PM
Security Audit — agent-trust-hub — instance-storage-patterns