Implementation:AMAP ML SkillClaw oss helpers
| Knowledge Sources | |
|---|---|
| Domains | Object_Storage, Shared_Infrastructure |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for shared storage operations (session listing, manifest management, skill bundle fetching, version bundles) across local/S3/OSS backends, provided by the SkillClaw evolve server package.
Description
The oss_helpers module provides backend-agnostic storage functions used by both evolution engines. `list_session_keys` enumerates session JSON objects, `load_manifest`/`save_manifest` manage the skill manifest (JSONL format), `fetch_skill_bundle`/`fetch_skill_content` download skill bundles, `save_version_bundle` writes versioned skill snapshots, and `delete_session_keys` removes consumed sessions. All functions work with any bucket implementing `iter_objects`, `get_object`, `put_object`, `delete_object` (LocalBucket, S3, or OSS).
Usage
Import and use when you need to:
- List and read session recordings from shared storage
- Load and save the skill manifest
- Fetch skill bundles (SKILL.md + supporting files)
- Save versioned skill bundles for history
- Delete consumed session keys
Code Reference
Source Location
- Repository: SkillClaw
- File: `evolve_server/storage/oss_helpers.py:L31-223`
Signature
def list_session_keys(bucket, prefix: str) -> list[str]:
"""List all *.json objects under {prefix}sessions/."""
def read_json_object(bucket, key: str) -> Optional[dict]:
"""Download and parse a single JSON object from storage."""
def load_manifest(bucket, prefix: str) -> dict[str, dict[str, Any]]:
"""Load manifest.jsonl from storage. Returns {skill_name: record}."""
def save_manifest(bucket, prefix: str, manifest: dict[str, dict[str, Any]]) -> None:
"""Write the full manifest back to storage as JSONL."""
def delete_session_keys(bucket, keys: list[str]) -> int:
"""Delete session objects. Returns count of successfully deleted keys."""
def fetch_skill_content(bucket, prefix: str, skill_name: str) -> Optional[str]:
"""Download a single SKILL.md from storage."""
def fetch_skill_bundle(
bucket, prefix: str, skill_name: str,
record: Optional[dict[str, Any]] = None,
) -> dict[str, bytes]:
"""Download a full skill bundle (SKILL.md + nested files)."""
def save_version_bundle(
bucket, prefix: str, skill_name: str, version: int,
bundle_files: dict[str, bytes],
) -> dict[str, Any]:
"""Write a versioned skill bundle snapshot to storage."""
Import
from evolve_server.storage.oss_helpers import (
list_session_keys, read_json_object,
load_manifest, save_manifest,
delete_session_keys,
fetch_skill_content, fetch_skill_bundle,
save_version_bundle,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| bucket | ObjectStore | Yes /// Storage backend (LocalBucket, S3, OSS) | |
| prefix | str | Yes /// Group ID prefix (e.g. "my-team/") | |
| key | str | Yes (read/delete) /// Full storage key | |
| manifest | dict | Yes (save_manifest) /// Full manifest {skill_name: record} | |
| skill_name | str | Yes (fetch/save) /// Skill name | |
| version | int | Yes (save_version_bundle) /// Skill version number | |
| bundle_files | dict[str, bytes] | Yes (save_version_bundle) /// Full bundle contents |
Outputs
| Name | Type | Description |
|---|---|---|
| list_session_keys() returns | list[str] | Storage keys for session JSON files |
| load_manifest() returns | dict[str, dict] | {skill_name: manifest record} |
| fetch_skill_bundle() returns | dict[str, bytes] | {rel_path: file_bytes} |
| save_version_bundle() returns | dict | Bundle record with format, tree_sha256, files |
Usage Examples
Drain and Delete Sessions
from evolve_server.storage.oss_helpers import list_session_keys, read_json_object, delete_session_keys
keys = list_session_keys(bucket, prefix="my-team/")
sessions = []
for key in keys:
session = read_json_object(bucket, key)
if session:
sessions.append(session)
# After processing, clean up
deleted = delete_session_keys(bucket, keys)
print(f"Deleted {deleted} session keys")
Manifest Management
from evolve_server.storage.oss_helpers import load_manifest, save_manifest
manifest = load_manifest(bucket, prefix="my-team/")
# Add or update a skill
manifest["python_deployment"] = {
"name": "python_deployment",
"version": 2,
"sha256": "abc123...",
"description": "How to deploy Python apps",
}
save_manifest(bucket, prefix="my-team/", manifest=manifest)
Related Pages
Implements Principle
- Principle:AMAP_ML_SkillClaw_Shared_Storage_Operations
- Principle:AMAP_ML_SkillClaw_Storage_Abstraction
- Principle:AMAP_ML_SkillClaw_Skill_Evolution_Pipeline