Spaces:
Sleeping
Sleeping
File size: 1,027 Bytes
116524e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """PersistStep — writes the skillbook to an external file."""
from __future__ import annotations
from pathlib import Path
from ..core.skillbook import Skillbook
from ..core.context import ACEStepContext
class PersistStep:
"""Write the current skillbook to a target file after each sample.
Integration-specific side-effect step — used by ClaudeCodeACE to
persist learned strategies into the project's CLAUDE.md.
Unlike CheckpointStep (which saves full JSON at intervals), PersistStep
runs on every sample and writes in whatever format the target expects.
"""
requires: frozenset[str] = frozenset({"skillbook"})
provides: frozenset[str] = frozenset()
def __init__(self, target_path: str | Path, skillbook: Skillbook) -> None:
self.target_path = Path(target_path)
self.skillbook = skillbook
def __call__(self, ctx: ACEStepContext) -> ACEStepContext:
self.skillbook.save_to_file(str(self.target_path))
return ctx
|