Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AMAP ML SkillClaw AgentWorkspace

From Leeroopedia
Knowledge Sources
Domains Filesystem_Management, Skill_Evolution
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for preparing and managing the filesystem workspace that an OpenClaw agent reads and writes during skill evolution, provided by the SkillClaw evolve server package.

Description

The AgentWorkspace class manages the directory structure that the OpenClaw agent operates on. The `prepare` method writes compact session files, existing skill bundles, a manifest, the methodology document (EVOLVE_AGENTS.md), and bootstrap files (AGENTS.md, SOUL.md, IDENTITY.md, USER.md) that direct the agent to focus on skill evolution. The `snapshot_skills` and `collect_changes` methods detect which skills the agent created or modified by comparing tree-sha256 hashes before and after the agent run.

Usage

Import and use when you need to:

  • Prepare a workspace for the OpenClaw agent to evolve skills
  • Detect which skills were created or modified by the agent
  • Understand the workspace directory structure and bootstrap files

Code Reference

Source Location

  • Repository: SkillClaw
  • File: `evolve_server/engines/agent_workspace.py:L108-304`

Signature

class AgentWorkspace:
    """Manages the filesystem workspace that the OpenClaw agent reads/writes."""

    def __init__(self, root: str | Path) -> None:
        """Set up workspace root, sessions_dir, skills_dir."""

    def reset(self) -> None:
        """Completely wipe and recreate the workspace (fresh mode)."""

    def prepare(
        self,
        sessions: list[dict],
        existing_skills: dict[str, str | dict[str, bytes | bytearray | str]],
        manifest: dict[str, dict],
        agents_md: str,
        skill_registry_info: dict[str, Any] | None = None,
    ) -> None:
        """Populate workspace with sessions, skills, manifest, bootstrap files."""

    def snapshot_skills(self) -> dict[str, str]:
        """Return {skill_name: tree_sha256} for all skills in the workspace."""

    def collect_changes(
        self, before_snapshot: dict[str, str]
    ) -> list[dict[str, Any]]:
        """Compare current skills against before_snapshot; return changed/new skills.

        Each change dict has: name, action ("create"/"improve"), skill, raw_md,
        bundle_files, tree_sha256.
        """

Import

from evolve_server.engines.agent_workspace import AgentWorkspace

I/O Contract

Inputs

Name Type Required Description
root Path Yes Workspace directory path
sessions list[dict] Yes (prepare) Compact session dicts
existing_skills dict Yes (prepare) skill_name -> bundle (SKILL.md str or {rel_path: bytes})
manifest dict Yes (prepare) Current manifest {skill_name: metadata}
agents_md str Yes (prepare) Full EVOLVE_AGENTS.md methodology text
before_snapshot dict[str, str] Yes (collect_changes) Pre-run {skill_name: tree_sha256}

Outputs

Name Type Description
prepare() side effects Directory tree sessions/*.json, skills/<name>/, manifest.json, bootstrap files
snapshot_skills() returns dict[str, str] {skill_name: tree_sha256}
collect_changes() returns list[dict] Changed skills with name, action, skill, bundle_files

Usage Examples

Prepare and Collect Changes

from evolve_server.engines.agent_workspace import AgentWorkspace
from evolve_server.engines.agents_md import load_agents_md

workspace = AgentWorkspace("/tmp/agent_workspace")
workspace.reset()

# Snapshot before agent run
agents_md = load_agents_md()
workspace.prepare(
    sessions=summarized_sessions,
    existing_skills=existing_skill_bundles,
    manifest=current_manifest,
    agents_md=agents_md,
)

before = workspace.snapshot_skills()

# ... Run OpenClaw agent here (edits files in workspace/skills/) ...

# Detect what the agent changed
changes = workspace.collect_changes(before)
for change in changes:
    print(f"  {change['action']}: {change['name']}")

Related Pages

Implements Principle

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment