Principle:AMAP ML SkillClaw Shared Storage Operations
| Knowledge Sources | |
|---|---|
| Domains | Object_Storage, Shared_Infrastructure |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
A shared storage operations pattern that provides backend-agnostic functions for managing sessions, skill manifests, skill bundles, and versioned snapshots across local, S3, and OSS object storage.
Description
Shared storage operations address the problem of persisting and retrieving data from shared object storage in a backend-agnostic way. The SkillClaw pattern provides functions that work with any bucket implementing the `iter_objects`, `get_object`, `put_object`, `delete_object` interface. Session JSON files are listed and read from `{prefix}sessions/`. The skill manifest is stored as JSONL (`manifest.jsonl`). Skill bundles include the entrypoint `SKILL.md` plus optional supporting files under `skills/{name}/files/`. Versioned snapshots are written to `skills/{name}/versions/v{n}/` for history. Consumed sessions are deleted after processing.
Usage
Use this principle when designing systems that need:
- Backend-agnostic object storage operations
- JSONL manifest management
- Multi-file skill bundle persistence
- Versioned content snapshots
Theoretical Basis
The storage abstraction relies on a common interface:
# Abstract algorithm (NOT real implementation)
# Storage interface (implemented by LocalBucket, S3, OSS):
# put_object(key: str, data: bytes) -> None
# get_object(key: str) -> BinaryIO
# delete_object(key: str) -> None
# iter_objects(prefix: str) -> Iterator[ObjectInfo]
def save_manifest(bucket, prefix, manifest):
lines = [json.dumps(record) for record in manifest.values()]
bucket.put_object(f"{prefix}manifest.jsonl", "\n".join(lines))
def save_version_bundle(bucket, prefix, name, version, files):
for rel_path, data in files.items():
key = f"{prefix}skills/{name}/versions/v{version}/{rel_path}"
bucket.put_object(key, data)